问:
How to insert a line break in a markdown Notification
I'm using Laravel's Notifications system to send a welcome email when users register. Everything works great, except I can't for the life of me figure out how to insert a line break in the greeting.

This is my code:

```<code>namespace App\Notifications\Auth;

use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;

class UserRegistered extends Notification
{

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('Welcome to website!')
            ->greeting('Welcome '. $notifiable->name .'!')
            ->line('## Sub heading line')
            ->line('Paragraph line')
            ->markdown('mail.welcome');
    }
}
</code>```

I want to put a break here ->greeting('Welcome '. $notifiable->name .'!') between the welcome and the name. Anyone know how I can do this? I've tried double space as described on markdown documentation. I've tried using nl2br(). I've tried \n. I've tried
. Nothing works.

答:
You can just do following:

public function toMail($notifiable)
{
    $name = $notifiable->name;
    return (new MailMessage)
        ->subject('Welcome to website!')
        ->greeting(new HtmlString("Welcome
$name!"))
        ->markdown('mail.welcome');
}
```

This doesn't require to edit any templates.

Body:
I'm using Laravel's Notifications system to send a welcome email when users register. Everything works great, except I can't for the life of me figure out how to insert a line break in the greeting.

This is my code:

namespace App\Notifications\Auth;

use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;

class UserRegistered extends Notification
{

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('Welcome to website!')
            ->greeting('Welcome '. $notifiable->name .'!')
            ->line('## Sub heading line')
            ->line('Paragraph line')
            ->markdown('mail.welcome');
    }
}

I want to put a break here ->greeting('Welcome '. $notifiable->name .'!') between the welcome and the name. Anyone know how I can do this? I've tried double space as described on markdown documentation. I've tried using nl2br(). I've tried \n. I've tried
. Nothing works.

Body:
You can just do following:

public function toMail($notifiable)
{
    $name = $notifiable->name;
    return (new MailMessage)
        ->subject('Welcome to website!')
        ->greeting(new HtmlString("Welcome<br>$name!"))
        ->markdown('mail.welcome');
}

This doesn't require to edit any templates.


来源: stackexchange

问:
How to create several spinners on one page for Android?
Ive seen so many tutorials on how to make spinners, but they all show just one per page. When I try to insert 2, the second one just doesnt work. I have no previous knowledge of Android programming so maybe Im just putting the second spinner code in the wrong place of something. I could really use some help with a code example please.

Ive tried 5 times but I cant seem to post my code here so far but its just a simple code for one spinner

Thank you!

EDIT: got the answer here: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.html

答:
Try This Layout...</p>

```<code><?xml version="1.0" encoding="UTF-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_scrvw"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">

    <TableLayout
        android:id="@+id/search_table"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dip"
        android:layout_marginLeft="50dip" >

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <TextView
                android:text="Sex"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Spinner
                android:id="@+id/spnr_srch_sex"
                android:layout_width="150dip"
                android:layout_height="wrap_content" />

        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <TextView
                android:text="Age"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Spinner
                android:id="@+id/spnr_srch_age"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <TextView
                android:text="Country"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Spinner
                android:id="@+id/spnr_srch_country"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </TableRow>

        <Button
            android:id="@+id/search"
            android:text="Search"
            android:layout_width="100dip"
            android:layout_height="wrap_content" />

    </TableLayout>

  </ScrollView>
</LinearLayout>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Try This Layout...

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_scrvw"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">

    <TableLayout
        android:id="@+id/search_table"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dip"
        android:layout_marginLeft="50dip" >

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <TextView
                android:text="Sex"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Spinner
                android:id="@+id/spnr_srch_sex"
                android:layout_width="150dip"
                android:layout_height="wrap_content" />

        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <TextView
                android:text="Age"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Spinner
                android:id="@+id/spnr_srch_age"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <TextView
                android:text="Country"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <Spinner
                android:id="@+id/spnr_srch_country"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </TableRow>

        <Button
            android:id="@+id/search"
            android:text="Search"
            android:layout_width="100dip"
            android:layout_height="wrap_content" />

    </TableLayout>

  </ScrollView>
</LinearLayout>


问:
Select all rows but park on specific
I need to show all rows in a table but park on a specific one.

```<code>Select * from t_table
</code>```

will show me all but park on the top.

```<code>select * from t_table where id=1000
</code>```

will only show me id=1000.

what I need is

```<code>select * from t_table locate id=1000
</code>```

is this possible ?

Example :

If the storedprocedure showing this select has a parameter @PartCode.
This can be NULL (show all) of a certain partcode. f.e. 2000443

The select in the stored procedure should park on this partcode but not filter

答:
use top 1

```<code>select top 1 * from t_table order by id desc
</code>```

ContentLicense: CC BY-SA 4.0

Title: Select all rows but park on specific

Body:
I need to show all rows in a table but park on a specific one.

Select * from t_table

will show me all but park on the top.

select * from t_table where id=1000

will only show me id=1000.

what I need is

select * from t_table locate id=1000

is this possible ?

Example :

If the storedprocedure showing this select has a parameter @PartCode.
This can be NULL (show all) of a certain partcode. f.e. 2000443

The select in the stored procedure should park on this partcode but not filter

Body:
use top 1

select top 1 * from t_table order by id desc


问:
List of "Year-Month" from Current Year month to Jan-2021 in Java
I have a business requirement to write a service which returns the list of Year months (01-2021,02-2021,....) starting from 01-2021 to the current year month (current : 02-2022).

Can anyone suggest me the approach that I can take to solve this in Java 8

O/P : 01-2021, 02-2021, 03-2021, 04-2021 , so on , 02-2022.

答:
Something like the following would do.

YearMonth now = YearMonth.now();
YearMonth ym = YearMonth.of(2021, 1);
List<YearMonth> list = new ArrayList<>();
while (!ym.isAfter(now)) {
  list.add(ym);
  ym = ym.plusMonths(1);
}
DateTimeFormatter format = DateTimeFormatter.ofPattern("MM-yyyy");
List<String> list2 = list.stream().map(it -> it.format(format)).collect(Collectors.toList());
```
<p>Should get you a list starting from 2021-1 till now.</p>
<p>Another option is to use a stream.</p>
<pre class="lang-java prettyprint-override"><code>DateTimeFormatter format = DateTimeFormatter.ofPattern("MM-yyyy");
long months = Period.between(LocalDate.of(2021, 1, 1), LocalDate.now()).toTotalMonths();
List<String> yms = LongStream.rangeClosed(0, months)
  .mapToObj(it -> YearMonth.now().minusMonths(it))
  .map(it -> it.format(format))
  .collect(Collectors.toList());
</code>```

You first calculate the number of months, iterate over that number and generate the list.

Body:
Something like the following would do.

YearMonth now = YearMonth.now();
YearMonth ym = YearMonth.of(2021, 1);
List<YearMonth> list = new ArrayList<>();
while (!ym.isAfter(now)) {
  list.add(ym);
  ym = ym.plusMonths(1);
}
DateTimeFormatter format = DateTimeFormatter.ofPattern("MM-yyyy");
List<String> list2 = list.stream().map(it -> it.format(format)).collect(Collectors.toList());

Should get you a list starting from 2021-1 till now.

Another option is to use a stream.

DateTimeFormatter format = DateTimeFormatter.ofPattern("MM-yyyy");
long months = Period.between(LocalDate.of(2021, 1, 1), LocalDate.now()).toTotalMonths();
List<String> yms = LongStream.rangeClosed(0, months)
  .mapToObj(it -> YearMonth.now().minusMonths(it))
  .map(it -> it.format(format))
  .collect(Collectors.toList());

You first calculate the number of months, iterate over that number and generate the list.


问:
Print to web directly from the controller?
I have this controller function that returns cpu stats:

```<code>        public ActionResult GetStats()
        {
            Random rand = new Random();
            ViewData["cpu_temp"] = rand.Next(0, 100) + "%";

            return View();
        }
</code>```

And with a view it works 100%. Bu tI'm wondering if I could shorten the process, and just do something like:

```<code>        public ActionResult GetStats()
        {
            Random rand = new Random();

            something.writeline(rand.Next(0, 100) + "%");
        }
</code>```

Just so I can create controllers and not care about views for simple simple simple output :D

FIX, after a tip by Jamie Dixon i came up with this solution:

```<code>        public ActionResult GetStats()
        {
            Random rand = new Random();
            ViewData["cpu_temp"] = rand.Next(0, 100) + "%";

            return Json(ViewData, JsonRequestBehavior.AllowGet);
        }
</code>```

Works as intended :D

答:
That would have been easier to do:</p>

```<code>public ActionResult GetStats()
{
   Random rand = new Random();

   return Content(rand.Next(0, 100) + "%");
}
</code>```

Body:
I have this controller function that returns cpu stats:

        public ActionResult GetStats()
        {
            Random rand = new Random();
            ViewData["cpu_temp"] = rand.Next(0, 100) + "%";

            return View();
        }

And with a view it works 100%. Bu tI'm wondering if I could shorten the process, and just do something like:

        public ActionResult GetStats()
        {
            Random rand = new Random();

            something.writeline(rand.Next(0, 100) + "%");
        }

Just so I can create controllers and not care about views for simple simple simple output :D

FIX, after a tip by Jamie Dixon i came up with this solution:

        public ActionResult GetStats()
        {
            Random rand = new Random();
            ViewData["cpu_temp"] = rand.Next(0, 100) + "%";

            return Json(ViewData, JsonRequestBehavior.AllowGet);
        }

Works as intended :D

Body:
That would have been easier to do:

public ActionResult GetStats()
{
   Random rand = new Random();

   return Content(rand.Next(0, 100) + "%");
}


问:
How to get number of same id's where the item was found in mysql?
Let's say I have table like this:

some_id
date

1
2022-02-01

2
2022-02-02

3
2022-02-03

3
2022-02-04

3
2022-02-05

3
2022-02-06

I want to get the number of rows based on the id where the date was found?

I tried this but it's not working:

SELECT COUNT(id) FROM dates WHERE date = '2022-02-04'
```

Expected output should be 4 rows since there are 4 same id's where the 2022-02-04 was found.

答:
An exists query should do it:

```<code>SELECT id, COUNT(*)
FROM t
WHERE EXISTS (
    SELECT 1
    FROM t AS x
    WHERE x.id = t.id
    AND x.date = '2022-02-04'
)
GROUP BY id
</code>```

Body:
Let's say I have table like this:

some_id
date

1
2022-02-01

2
2022-02-02

3
2022-02-03

3
2022-02-04

3
2022-02-05

3
2022-02-06

I want to get the number of rows based on the id where the date was found?

I tried this but it's not working:

SELECT COUNT(id) FROM dates WHERE date = '2022-02-04'

Expected output should be 4 rows since there are 4 same id's where the 2022-02-04 was found.

Body:
An exists query should do it:

SELECT id, COUNT(*)
FROM t
WHERE EXISTS (
    SELECT 1
    FROM t AS x
    WHERE x.id = t.id
    AND x.date = '2022-02-04'
)
GROUP BY id


问:
Flutter - Google Maps not working on some iPhones (Error requesting StyleTable)
I have configured Google Maps with Flutter :

added google_maps_flutter: ^2.1.1 to pub spec.yaml

created the API keys for Google Maps SDK for iOS and Android

did the setup for iOS and Android.
It's working fine on Android, on iPhone 12 (iOS15), iPhone 7 (iOS14.8) but not working on iPhone SE 2nd Generation (iOS15) and iPhone 13 Pro (iOS15).
On these devices, I get a grey screen :

theses errors are logged :

```<code>Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <F25EF008-E136-4CAC-B288-E17FFC0434CF>.<2>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F25EF008-E136-4CAC-B288-E17FFC0434CF>.<2>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <A691A814-567C-4410-9609-2965BDFB2D89>.<4>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A691A814-567C-4410-9609-2965BDFB2D89>.<4>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <90C61430-6CDE-44E6-A4C2-AF76411E31F8>.<3>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <90C61430-6CDE-44E6-A4C2-AF76411E31F8>.<3>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <B13320DA-6D28-4B93-8532-93E8F67CDA30>.<5>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B13320DA-6D28-4B93-8532-93E8F67CDA30>.<5>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <D68888BF-341A-4CCD-AD70-70FAE1807A1A>.<6>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <D68888BF-341A-4CCD-AD70-70FAE1807A1A>.<6>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <AC059CF0-90A3-4022-9B8B-54403A65BB5F>.<7>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <AC059CF0-90A3-4022-9B8B-54403A65BB5F>.<7>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <5F5BBA4F-B00D-4926-B87D-493FD811C9AC>.<8>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5F5BBA4F-B00D-4926-B87D-493FD811C9AC>.<8>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <EC3F530E-FEFF-48B8-BEB7-6C23DC039E11>.<9>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <EC3F530E-FEFF-48B8-BEB7-6C23DC039E11>.<9>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <BD1EC1C7-1EE0-4AF1-94B8-6FA8673A17A2>.<10>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <BD1EC1C7-1EE0-4AF1-94B8-6FA8673A17A2>.<10>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <82883D18-4A4C-4D25-9E2C-CAE4545964F3>.<11>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <82883D18-4A4C-4D25-9E2C-CAE4545964F3>.<11>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <DD342BE0-97EF-4592-BA5C-E043C6B164C5>.<12>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <DD342BE0-97EF-4592-BA5C-E043C6B164C5>.<12>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <5F688E31-E179-4A7A-BE20-05A144765B50>.<13>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5F688E31-E179-4A7A-BE20-05A144765B50>.<13>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <C07671D9-3AA8-4556-8F51-27398D6B8C6D>.<14>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C07671D9-3AA8-4556-8F51-27398D6B8C6D>.<14>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <7C568B51-E785-4FD0-B29D-71E97611249F>.<15>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <7C568B51-E785-4FD0-B29D-71E97611249F>.<15>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <6289A626-4B31-453A-B750-8C2C5CB6EC71>.<16>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <6289A626-4B31-453A-B750-8C2C5CB6EC71>.<16>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <0394E81C-8A69-44F5-B96A-F1470C1119A5>.<17>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0394E81C-8A69-44F5-B96A-F1470C1119A5>.<17>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <CA0F185D-2DFF-43BE-A6D1-458A6819FDD2>.<18>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <CA0F185D-2DFF-43BE-A6D1-458A6819FDD2>.<18>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <ED823BB1-5F12-4B75-AEFB-D4787A385B0F>.<19>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <ED823BB1-5F12-4B75-AEFB-D4787A385B0F>.<19>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169

</code>```

答:
Do you unlook the things you want to do with google maps for both android and ios?

as far as I know this is necessary.

Body:
I have configured Google Maps with Flutter :

added google_maps_flutter: ^2.1.1 to pub spec.yaml

created the API keys for Google Maps SDK for iOS and Android

did the setup for iOS and Android.
It's working fine on Android, on iPhone 12 (iOS15), iPhone 7 (iOS14.8) but not working on iPhone SE 2nd Generation (iOS15) and iPhone 13 Pro (iOS15).
On these devices, I get a grey screen :

theses errors are logged :

Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <F25EF008-E136-4CAC-B288-E17FFC0434CF>.<2>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F25EF008-E136-4CAC-B288-E17FFC0434CF>.<2>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <A691A814-567C-4410-9609-2965BDFB2D89>.<4>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A691A814-567C-4410-9609-2965BDFB2D89>.<4>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <90C61430-6CDE-44E6-A4C2-AF76411E31F8>.<3>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <90C61430-6CDE-44E6-A4C2-AF76411E31F8>.<3>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <B13320DA-6D28-4B93-8532-93E8F67CDA30>.<5>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B13320DA-6D28-4B93-8532-93E8F67CDA30>.<5>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <D68888BF-341A-4CCD-AD70-70FAE1807A1A>.<6>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <D68888BF-341A-4CCD-AD70-70FAE1807A1A>.<6>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <AC059CF0-90A3-4022-9B8B-54403A65BB5F>.<7>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <AC059CF0-90A3-4022-9B8B-54403A65BB5F>.<7>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <5F5BBA4F-B00D-4926-B87D-493FD811C9AC>.<8>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5F5BBA4F-B00D-4926-B87D-493FD811C9AC>.<8>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <EC3F530E-FEFF-48B8-BEB7-6C23DC039E11>.<9>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <EC3F530E-FEFF-48B8-BEB7-6C23DC039E11>.<9>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <BD1EC1C7-1EE0-4AF1-94B8-6FA8673A17A2>.<10>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <BD1EC1C7-1EE0-4AF1-94B8-6FA8673A17A2>.<10>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <82883D18-4A4C-4D25-9E2C-CAE4545964F3>.<11>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <82883D18-4A4C-4D25-9E2C-CAE4545964F3>.<11>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <DD342BE0-97EF-4592-BA5C-E043C6B164C5>.<12>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <DD342BE0-97EF-4592-BA5C-E043C6B164C5>.<12>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <5F688E31-E179-4A7A-BE20-05A144765B50>.<13>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5F688E31-E179-4A7A-BE20-05A144765B50>.<13>, NSLocalizedDescription=cancelled}
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <C07671D9-3AA8-4556-8F51-27398D6B8C6D>.<14>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C07671D9-3AA8-4556-8F51-27398D6B8C6D>.<14>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-TransitFocused-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <7C568B51-E785-4FD0-B29D-71E97611249F>.<15>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <7C568B51-E785-4FD0-B29D-71E97611249F>.<15>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-Terrain-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <6289A626-4B31-453A-B750-8C2C5CB6EC71>.<16>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <6289A626-4B31-453A-B750-8C2C5CB6EC71>.<16>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-RoadmapSatellite-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <0394E81C-8A69-44F5-B96A-F1470C1119A5>.<17>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0394E81C-8A69-44F5-B96A-F1470C1119A5>.<17>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-NavigationLowLight-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <CA0F185D-2DFF-43BE-A6D1-458A6819FDD2>.<18>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <CA0F185D-2DFF-43BE-A6D1-458A6819FDD2>.<18>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-Roadmap-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169
Error requesting StyleTable (https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169): Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, NSErrorFailingURLKey=https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <ED823BB1-5F12-4B75-AEFB-D4787A385B0F>.<19>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <ED823BB1-5F12-4B75-AEFB-D4787A385B0F>.<19>, NSLocalizedDescription=cancelled}
A StyleTable fetch/validation failed for epoch 587, https://www.gstatic.com/maps/res/CompactLegend-Navigation-NaturalFeaturesHoldBack-b42f852db1129b669a3b718d21eb3169


问:
airflow DAG triggering for time consuming runs
I am completely new to Airflow and am trying to grasp the concepts of scheduling and default args.

I have a scenario where I would like to schedule my DAG hourly to do some data transfer task between a source and a database. What I am trying to understand is, lets say one of my DAG runs has triggered at 00:00 AM. Now if it takes more than an hour for this run to successfully complete all of its tasks (say 1 hour 30 min), does it mean that the next DAG run that was supposed to be triggered at 01:00 AM will NOT get triggered but the DAG run from 02:00 AM will get triggered?

答:
Airflow Scheduler used to monitor all DAGs and tasks in Airflow.Default Arguments can be used to create tasks with default parameters in DAG.
The first DAG runs based on start_date and runs based on scheduled_interval sequentially. Scheduler doesn’t trigger tasks until the period has ended.For your requirement you can set dag.catchup to true as to run the DAG for each completed interval and scheduler will execute them sequentially.Catchup is used to start the DAG run since the last data interval which has not started for any data interval.</p>


问:
Shutdown Postgres process in Docker but keep container alive?
I'm using the official Postgres Docker Image, namely postgres:12.9-alpine

I'd like to run docker container commit on a container whose Postgres process has been terminated gracefully.

When I attempt to run pg_ctl stop -D <datapath>, I do in fact shut down the Postgres process, but the container comes down with it.

Is it possible to keep the container alive so that I can commit the container to a new image in a clean state?

答: You can commit a new image from an exited container, so there's no need to keep it running. Just don't automatically remove the container on exit.</p>


问:
Installing MSSQL functions in PHP
I'm trying to connect to my SQL server through PHP. Obviously using MySQL php functions do not work, how do I go about installing MSSQL functions for PHP on OSX? After exhausting google, I thought there would be a lot more tutorials are resources available which suggests to me this isn't the best way to connect to an SQL server.

Thank you in advance!

答:
ps: mssql (at least 5 years ago) was a lot slower than mysql in doing simple stuff(SELECT/INSERT/UPDATE). mssql had the advantage of views and pretty human stored procedures... but speed was more important...

http://php.net/manual/en/book.mssql.php

http://php.net/manual/en/book.uodbc.php

Disclaimer: never used them

What have you tried until now?

Title: Installing MSSQL functions in PHP


答:
Using exists logic we can try:

SELECT COUNT(*)
FROM dates d1
WHERE EXISTS (SELECT 1 FROM dates d2
              WHERE d2.some_id = d1.some_id AND
                    d2.date = '2022-02-04');
```

Title: How to get number of same id's where the item was found in mysql?


问:
Fastreport : Detail Data: limit the number of records
I need to generate a two-sided report. In Detail Data, In the first page I need to limit the number of records to 15, and in the second page I need to limit the number of records to 8.

Page 1 : 15 records.

page 2 : 08 records.

How to do it please?

thanks

答:
One way is to use a fastreport script</p>
```<code>    var np : integer = 0;   // variable de script

procedure MasterData1OnAfterPrint(Sender: TfrxComponent);
var rec : integer;
begin
  np:=np+1;
  if (np=7) then engine.newpage;
  if (np=11) then begin
    np:=0;
    engine.newpage;
  end;
end;

begin

end.
</code>```

Body:
One way is to use a fastreport script

    var np : integer = 0;   // variable de script

procedure MasterData1OnAfterPrint(Sender: TfrxComponent);
var rec : integer;
begin
  np:=np+1;
  if (np=7) then engine.newpage;
  if (np=11) then begin
    np:=0;
    engine.newpage;
  end;
end;

begin

end.


问:
How to use FIND_IN_SET in jpa
How can I use find_in_set in jpa?

I need to achieve like this

SQL - select * from teacher where find_in_set("5", deptIds) and id = 101

where deptIds have comma separated ids (I know it's bad idea but legacy.)

To do so I had been tried using Criteria but not found any Restrictions that can fulfill find_in_set.

Note - need possible solution with Criteria and Restrictions

答:
```<code>criteriaBuilder.function("find_in_set", Boolean.class,
        criteriaBuilder.literal(s),
        root.get("field"))
</code>```

Title: How to use FIND_IN_SET in jpa


问:
How I add new 'Show answer' button to display the correct answer to the question?
How I add new 'Show answer' button to display the correct answer to the question? The answer isn't visible when the question is retrieved but is only displayed when the 'Show answer' button is pressed. I need to make only one fetch request / question and I can display the answer using conditional rendering, for example.</p>
```<code>const Trivia = () => {
    const [question, setQuestion] = React.useState();

    const fetchQuestion = () => {
        fetch("https://opentdb.com/api.php?amount=1")
        .then((response) => response.json())
        .then((data) => {
            setQuestion(data.results[0].question);
        });
    };

    React.useEffect(() => {
        fetchQuestion();
    }, []);

    return(
        <div>
            <p>{question}</p>
            <button onClick={fetchQuestion}>New Question</button>
        </div>
    );
};
</code>```

答:
```<code><div id="root"></div>

<script type="text/babel">

    const Trivia = () => {
        const [question, setQuestion] = React.useState();
     const [showAnswer, setShowAnswer] = React.useState(false);

     const fetchQuestion = () => {
         fetch("https://opentdb.com/api.php?amount=1")
         .then((response) => response.json())
         .then((data) => {
              setQuestion(data.results[0].question);

         });
       };

 const answerToggler = () => setShowAnswer(prevAns => !prevAns)

    React.useEffect(() => {
             fetchQuestion();
         }, []);

     return(
     <div>
     <p> {question}</p>
     <button onClick={fetchQuestion}>New Question</button>
    {showAnswer && <h3>Correct Answer</h3>}
<button onClick={answerToggler}>Show Answer </button>
    </div>

         );

 };
</code>```

i hope this will work

Body:
How I add new 'Show answer' button to display the correct answer to the question? The answer isn't visible when the question is retrieved but is only displayed when the 'Show answer' button is pressed. I need to make only one fetch request / question and I can display the answer using conditional rendering, for example.

const Trivia = () => {
    const [question, setQuestion] = React.useState();

    const fetchQuestion = () => {
        fetch("https://opentdb.com/api.php?amount=1")
        .then((response) => response.json())
        .then((data) => {
            setQuestion(data.results[0].question);
        });
    };

    React.useEffect(() => {
        fetchQuestion();
    }, []);

    return(

{question}

            <button onClick={fetchQuestion}>New Question</button>

    );
};

Body:
<div id="root"></div>

<script type="text/babel">

    const Trivia = () => {
        const [question, setQuestion] = React.useState();
     const [showAnswer, setShowAnswer] = React.useState(false);

     const fetchQuestion = () => {
         fetch("https://opentdb.com/api.php?amount=1")
         .then((response) => response.json())
         .then((data) => {
              setQuestion(data.results[0].question);

         });
       };

 const answerToggler = () => setShowAnswer(prevAns => !prevAns)

    React.useEffect(() => {
             fetchQuestion();
         }, []);

     return(
     <div>
     <p> {question}</p>
     <button onClick={fetchQuestion}>New Question</button>
    {showAnswer && <h3>Correct Answer</h3>}
<button onClick={answerToggler}>Show Answer </button>
    </div>

         );

 };

i hope this will work


问:
Getting the unique values and counts of them in a column of comma separated values in Google Sheets without using JOIN?
I have a column with a bunch of ingredients lists in it. I'm trying to figure out how many times different individual ingredients appear. There are 73,000 rows. The answers on this question works for a small amount of data in Google Sheets.

Formula is =UNIQUE(TRANSPOSE(SPLIT(JOIN(", ";A2:A);", ";FALSE)))

But I've overwhelmed JOIN with more than 50000 characters here. Is there another way to tackle this?

Sheet: https://docs.google.com/spreadsheets/d/1t0P9hMmVpwhI2IbATmIMjobuALTg8VWhl8-AQaq3zIo/edit?usp=sharing

答:
A fast running formula that works with columns of at least 40,000 rows:

```<code> =query(arrayformula(TRIM(flatten(split(A2:A20000,",")))),"select Col1,Count(Col1) Where NOT (Col1='' OR Col1 contains '#VALUE!') Group By Col1 order by Count(Col1) desc label Col1 'Ingredient',Count(Col1) 'Freq.'")
</code>```

FLATTEN function, combined with SQL (QUERY function) can be a solution for fast filtering of values (such as empty or error messages).

TRIM function avoids artifacts in the result due to meaningless spaces before/after each string.

Sheet: https://docs.google.com/spreadsheets/d/1m9EvhQB1Leg2H7L52WhPe66_jRrTc8VsnZcliQsxJ7s/edit?usp=sharing

*In case of false case differences, you could normalize all characters of the strings to uppercase before within the same formula with UPPER(A2:A20000).

Body:
A fast running formula that works with columns of at least 40,000 rows:

 =query(arrayformula(TRIM(flatten(split(A2:A20000,",")))),"select Col1,Count(Col1) Where NOT (Col1='' OR Col1 contains '#VALUE!') Group By Col1 order by Count(Col1) desc label Col1 'Ingredient',Count(Col1) 'Freq.'")

FLATTEN function, combined with SQL (QUERY function) can be a solution for fast filtering of values (such as empty or error messages).

TRIM function avoids artifacts in the result due to meaningless spaces before/after each string.

Sheet: https://docs.google.com/spreadsheets/d/1m9EvhQB1Leg2H7L52WhPe66_jRrTc8VsnZcliQsxJ7s/edit?usp=sharing

*In case of false case differences, you could normalize all characters of the strings to uppercase before within the same formula with UPPER(A2:A20000).


答:
The java.time package has a YearMonth class (documentation) ideal for this use case:

```<code>for (YearMonth ym = YearMonth.of(2021, Month.JANUARY); // or ...of(2021, 1)
     !ym.isAfter(YearMonth.now());
     ym = ym.plusMonths(1))
{
    System.out.printf("%Tm-%1$TY\n", ym);
}
</code>```

Title: List of "Year-Month" from Current Year month to Jan-2021 in Java

Body:
I have a business requirement to write a service which returns the list of Year months (01-2021,02-2021,....) starting from 01-2021 to the current year month (current : 02-2022).

Can anyone suggest me the approach that I can take to solve this in Java 8

O/P : 01-2021, 02-2021, 03-2021, 04-2021 , so on , 02-2022.

Body:
The java.time package has a YearMonth class (documentation) ideal for this use case:

for (YearMonth ym = YearMonth.of(2021, Month.JANUARY); // or ...of(2021, 1)
     !ym.isAfter(YearMonth.now());
     ym = ym.plusMonths(1))
{
    System.out.printf("%Tm-%1$TY\n", ym);
}


问:
Cannot add Actor in Cluster as Singleton Akka.NET
I have an interesting issue with AKKA.NET making 'SampleActor' to singleton in 'CustomCluster'. No exceptions or warnings are thrown.
During debugging on I am unable to get SampleActor initialized as cluster singleton, even in unit tests, I am able to get the ActorRef to this actor with full path no problems, but the actor seems not to be initializing (Constructor and other "OnStart" type of functions are not being hit.
I have tried "telling" messages directly to actor that in ordinary way it was used (like 'OrdinaryActor' in cluster) it was recieving those messages and working well. Sending messages thru proxy with full actor ref path is not working and I am sure it is because actor is not being initialized.

What am I missing at this point? There is full configuration for akka.cluster.singleton and I have tried with many different ways.

```<code>private static ActorSystem _actorSystem;

....

_actorSystem = ActorSystem.Create("CustomCluster", systemSetup);
var me = ServiceProvider.GetService<IActorRef>();

_actorSystem.ActorOf(
                Props.Create(() => new OrdinaryActor(me)),
                nameof(OrdinaryActor));   //Joins Cluster no problems

ClusterSingletonManagerSettings settings =
               ClusterSingletonManagerSettings.Create( _actorSystem ).WithRole("worker");
           _actorSystem.ActorOf( ClusterSingletonManager.Props(
               Props.Create( () => new SampleActor(me)),
           PoisonPill.Instance, settings ), "SampleActorSingleton" );

ClusterSingletonProxySettings proxySettings =
               ClusterSingletonProxySettings.Create( _actorSystem ).WithRole( "worker" );
           _actorSystem.ActorOf( ClusterSingletonProxy.Props( "/user/SampleActorSingleton", proxySettings ), "SampleActorSingletonProxy");
//Initialization of 'SampleActor is not being hit, no exceptions, I am able to get Actor ref but it is not functional'
</code>```

答:
@Sura98 can you show the code for the SampleActor?

From my personal experience, when that happens, that is, when the actor is not "initializing", it is most likely SampleActor class access level is not public or the constructor is not public.

Body:
I have an interesting issue with AKKA.NET making 'SampleActor' to singleton in 'CustomCluster'. No exceptions or warnings are thrown.
During debugging on I am unable to get SampleActor initialized as cluster singleton, even in unit tests, I am able to get the ActorRef to this actor with full path no problems, but the actor seems not to be initializing (Constructor and other "OnStart" type of functions are not being hit.
I have tried "telling" messages directly to actor that in ordinary way it was used (like 'OrdinaryActor' in cluster) it was recieving those messages and working well. Sending messages thru proxy with full actor ref path is not working and I am sure it is because actor is not being initialized.

What am I missing at this point? There is full configuration for akka.cluster.singleton and I have tried with many different ways.

private static ActorSystem _actorSystem;

....

_actorSystem = ActorSystem.Create("CustomCluster", systemSetup);
var me = ServiceProvider.GetService<IActorRef>();

_actorSystem.ActorOf(
                Props.Create(() => new OrdinaryActor(me)),
                nameof(OrdinaryActor));   //Joins Cluster no problems

ClusterSingletonManagerSettings settings =
               ClusterSingletonManagerSettings.Create( _actorSystem ).WithRole("worker");
           _actorSystem.ActorOf( ClusterSingletonManager.Props(
               Props.Create( () => new SampleActor(me)),
           PoisonPill.Instance, settings ), "SampleActorSingleton" );

ClusterSingletonProxySettings proxySettings =
               ClusterSingletonProxySettings.Create( _actorSystem ).WithRole( "worker" );
           _actorSystem.ActorOf( ClusterSingletonProxy.Props( "/user/SampleActorSingleton", proxySettings ), "SampleActorSingletonProxy");
//Initialization of 'SampleActor is not being hit, no exceptions, I am able to get Actor ref but it is not functional'


问:
How I can select a file with R, in this script
Hi this is my script and I want only files with name 'pancreas'.
How can I add this in my script? I have txt files.

This is my script:

Generate list of files in folder:

files <- data.frame(list.files(folder, recursive = TRUE, full.names = TRUE, pattern = '\\.txt$')[1:200])
colnames(files)[1] <- "path"
```
</li>
<li><p>Drop records containing "slide.txt" in file name:</p>
<pre class="lang-r prettyprint-override"><code>files <- subset(files, !grepl("slide.txt", files$path, fixed = TRUE))
</code>```

Here's the screen shot of my code:

答:
files <- list.files(".", pattern = "\\.txt$", recursive = TRUE)
files
#> [1] "foo.txt"       "pancreas1.txt" "pancreas2.txt" "slide.txt"
pancreas_files <- grep(pattern = "pancreas", x = files, value = TRUE)
pancreas_files
#> [1] "pancreas1.txt" "pancreas2.txt"
```

Body:
Hi this is my script and I want only files with name 'pancreas'.
How can I add this in my script? I have txt files.

This is my script:

Generate list of files in folder:

files <- data.frame(list.files(folder, recursive = TRUE, full.names = TRUE, pattern = '\\.txt$')[1:200])
colnames(files)[1] <- "path"

Drop records containing "slide.txt" in file name:

files <- subset(files, !grepl("slide.txt", files$path, fixed = TRUE))

Here's the screen shot of my code:


问:
Are there any possibilities to add an image on text in Flutter?
I have been searching for possibilities to use an image as the background of Text widget in Flutter for very long, and I am tired of getting some HTML/CSS solutions on the internet.

cut-out text effect is little similar, but it's not the thing I really want.

Actually, I want something like this.

Is there any Dart Package that exists? Can anyone help me with an idea or a solution?

答: Use "ShaderMask" Widget. For more get on to flutter.dev/shadermask</p>


答:
This should do the job:</p>
```<code>SELECT COUNT(*) FROM tbl
WHERE id IN (
 SELECT id FROM tbl WHERE `date`='2022-02-04'
)
</code>```

Body:
This should do the job:

SELECT COUNT(*) FROM tbl
WHERE id IN (
 SELECT id FROM tbl WHERE `date`='2022-02-04'
)


问:
tempt to perform arithmetic on a vector3 value fivem
In F8 console I get error : attempt to perform arithmetic on a vector3 value.
And any marker and menu can pop. This error create some beug and the script doesn't work :(</p>
```<code>local coords      = GetEntityCoords(PlayerPedId())
local isInMarker  = false
local currentZone = nil
for k,v in pairs(Config.Zones) do
            if(#(coords - v.Pos) < v.Size.x) then
                isInMarker  = true
                currentZone = k
            end
        end```
</code>```

答:
If this is one of the zones you're iterating over:

DMVSchool = {         Pos   = {x = 239.471, y = -1380.960, z = 32.741},
Size  = {x = 1.5, y = 1.5, z = 1.0},        Color = {r = 204, g = 204, b
= 0},         Type  = 1   }

v.Pos is a standard Lua table value, not a vector3.

You cannot do arrithmetics between a vector3 and a table.

You probably need to initialize field 'Pos' as Pos   = vector3(239.471,-1380.960,32.741).

See https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/vector3/

Body:
In F8 console I get error : attempt to perform arithmetic on a vector3 value.
And any marker and menu can pop. This error create some beug and the script doesn't work :(

local coords      = GetEntityCoords(PlayerPedId())
local isInMarker  = false
local currentZone = nil
for k,v in pairs(Config.Zones) do
            if(#(coords - v.Pos) < v.Size.x) then
                isInMarker  = true
                currentZone = k
            end
        end```


问:
Stop jQuery counterUp Plugin Script from Reloading
I'm using a simple counterUp script but when the columns of the website resize via media queries it is triggered again. Could anyone advise on the best way to run this and have it function just once without being retriggered unless the page is refreshed? Thanks!

```<code><h3><span class="counter">457</span></h3>

$(document).ready(function() { //when document is ready
        $('.counter').counterUp({
            delay: 10,
            time: 1800
        });
    });
</code>```

Fixed counterUp issue with the following:

```<code>$( window ).resize(function() { //Prevent being triggered again with window resize
        $('.counter').destroy();

    });
</code>```

Solved! :)

Body:
I'm using a simple counterUp script but when the columns of the website resize via media queries it is triggered again. Could anyone advise on the best way to run this and have it function just once without being retriggered unless the page is refreshed? Thanks!

457

$(document).ready(function() { //when document is ready
        $('.counter').counterUp({
            delay: 10,
            time: 1800
        });
    });

Fixed counterUp issue with the following:

$( window ).resize(function() { //Prevent being triggered again with window resize
        $('.counter').destroy();

    });

Solved! :)


问:
Preventing VS 2019 from rebuilding a solution though no source has changed
I am trying to track down a VS 2019 build issue for a few weeks which drives me crazy. I have a C# project (targeting .Net Framework 4.8) which VS rebuilds regularly even when nothing has changed. The project is not very complex and has no specific dependencies, but a postbuild event which must always be executed. Hence I used the approach described in this answer, which forces msbuild to do the "up-to-date" check instead of the VS IDE. This has worked well for years, but started to make trouble a few weeks ago.

To create a minimal reproducible example:

use the VS project wizard to create a trivial "hello world" console app, .Net Fw 4.8, AnyCpu

add the following lines to the csproj file:

```<code><PropertyGroup>
   <RunPostBuildEvent>Always</RunPostBuildEvent>
   <PostBuildEvent>
   </PostBuildEvent>
   <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
</code>```

change the "Run Post Build" setting in the IDE's project settings to "On Build Success" (or back to "Always", this does not really matter), save the settings

The Postbuild action is intentionally left empty, one can add arbitrary actions here, but even an empty action will produce the issue.

When I choose to rebuild the solution in the IDE (using Ctrl-Shift-B), without touching anything the source code, the executable is recreated. This effect occurs when the time between two consecutive builds is approx. 10 seconds or more, when I rebuild the solution quicker, the exe file stays untouched.

To make the effect more visible, I set "AssemblyVersion("1.0.0.*"), stripped the "AssemblyInformationalVersion" attribute from AssemblyInfo.cs, so the build system assigns a new build number to the exe file with each new creation, which allows to observe the effect in the Windows Explorer more easily (by activating the "File Version" column in the Explorer view).

Note this effect does not seem to occur when I comment out either the post build event, or the DisableFastUpToDateCheck setting.

I observed this with VS 2019 V16.11.9 and V16.11.10 (currently the latest versions in the "2019" product line).

In my real project, this happens for a central DLL inside a solution where more then 70 other projects depend on, including a large C++/CLI dll, resulting in a build time of ~2 minutes - every time I only want to start the debugger, since this causes a new build! And yes, I also tried to set the "project build output" settings to "Diagnostic", but could not find anything suspicious in the large amount of messages.

答:
Starting with jesshouwing's answer, and using this information from Microsoft how to extend the VS build process, I implemented this workaround: in the csproj, I added the following section the end:

```<code>    <Target Name="CustomAfterBuild" AfterTargets="Build"
          Inputs="... input for postbuild step ..."
          Outputs=" ... output of postbuild step ..">

       <Message Text="... some message here ..." />
       <!-- here are the post build actions -->
    </Target>
</code>```

This seems to work well for now without the nasty effects. The only drawback here is that this custom build step does not show up in the Visual Studio project editor, but I can work with that.

Body:
I am trying to track down a VS 2019 build issue for a few weeks which drives me crazy. I have a C# project (targeting .Net Framework 4.8) which VS rebuilds regularly even when nothing has changed. The project is not very complex and has no specific dependencies, but a postbuild event which must always be executed. Hence I used the approach described in this answer, which forces msbuild to do the "up-to-date" check instead of the VS IDE. This has worked well for years, but started to make trouble a few weeks ago.

To create a minimal reproducible example:

use the VS project wizard to create a trivial "hello world" console app, .Net Fw 4.8, AnyCpu

add the following lines to the csproj file:

<PropertyGroup>
   <RunPostBuildEvent>Always</RunPostBuildEvent>
   <PostBuildEvent>
   </PostBuildEvent>
   <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>

change the "Run Post Build" setting in the IDE's project settings to "On Build Success" (or back to "Always", this does not really matter), save the settings

The Postbuild action is intentionally left empty, one can add arbitrary actions here, but even an empty action will produce the issue.

When I choose to rebuild the solution in the IDE (using Ctrl-Shift-B), without touching anything the source code, the executable is recreated. This effect occurs when the time between two consecutive builds is approx. 10 seconds or more, when I rebuild the solution quicker, the exe file stays untouched.

To make the effect more visible, I set "AssemblyVersion("1.0.0.*"), stripped the "AssemblyInformationalVersion" attribute from AssemblyInfo.cs, so the build system assigns a new build number to the exe file with each new creation, which allows to observe the effect in the Windows Explorer more easily (by activating the "File Version" column in the Explorer view).

Note this effect does not seem to occur when I comment out either the post build event, or the DisableFastUpToDateCheck setting.

I observed this with VS 2019 V16.11.9 and V16.11.10 (currently the latest versions in the "2019" product line).

In my real project, this happens for a central DLL inside a solution where more then 70 other projects depend on, including a large C++/CLI dll, resulting in a build time of ~2 minutes - every time I only want to start the debugger, since this causes a new build! And yes, I also tried to set the "project build output" settings to "Diagnostic", but could not find anything suspicious in the large amount of messages.

Body:
Starting with jesshouwing's answer, and using this information from Microsoft how to extend the VS build process, I implemented this workaround: in the csproj, I added the following section the end:

    <Target Name="CustomAfterBuild" AfterTargets="Build"
          Inputs="... input for postbuild step ..."
          Outputs=" ... output of postbuild step ..">

       <Message Text="... some message here ..." />
       <!-- here are the post build actions -->
    </Target>

This seems to work well for now without the nasty effects. The only drawback here is that this custom build step does not show up in the Visual Studio project editor, but I can work with that.


问:
How to convert Datetime from (ddmmyyyy hh:mm:ss) to (ddmmmyyyy:00:00:00) [SAS]
I need to convert hour, minutes and seconds to 00:00:00

I´ve tried a lot but i got nothing but the real time.

data pr; dat=put(date()-1,yymmddn.); datsas=PUT(datetime(), datetime.); run;

Thank You!

答:
Use the INTNX function to advance a date time value to another date time value.

Example:

```<code>data _null_;
  now_dtm = datetime();
  now0_dtm = intnx ('dtday', now_dtm, 0);

  put now_dtm datetime19.;
  put now0_dtm datetime19.;
run;

----- Log -----
 10FEB2022:04:22:51
 10FEB2022:00:00:00
</code>```

Body:
Use the INTNX function to advance a date time value to another date time value.

Example:

data _null_;
  now_dtm = datetime();
  now0_dtm = intnx ('dtday', now_dtm, 0);

  put now_dtm datetime19.;
  put now0_dtm datetime19.;
run;

----- Log -----
 10FEB2022:04:22:51
 10FEB2022:00:00:00


问:
flutter_local_notifications plugin not showing the big image in notification
I need to make like this notification

My Output code

my Pubspec.yaml file. I am using latest version of flutter_local_notifications

  flutter_local_notifications: ^9.2.0
```
<p>This is my Notification Controller code</p>
<pre class="lang-dart prettyprint-override"><code>import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:image/image.dart' as image;
import 'package:path_provider/path_provider.dart';

class NotificationService {
  static final NotificationService _notificationService =
      NotificationService._internal();

  final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
      FlutterLocalNotificationsPlugin();

  factory NotificationService() {
    return _notificationService;
  }

  NotificationService._internal();
  Future<void> init(
      Function(int, String?, String?, String?)?
          onDidReceiveLocalNotification) async {
    const AndroidInitializationSettings initializationSettingsAndroid =
        AndroidInitializationSettings('@mipmap/launcher_icon');

    final IOSInitializationSettings initializationSettingsIOS =
        IOSInitializationSettings(
      requestAlertPermission: false,
      requestBadgePermission: false,
      requestSoundPermission: false,
      onDidReceiveLocalNotification:
          (int id, String? title, String? body, String? payload) async {},
    );
    final InitializationSettings initializationSettings =
        InitializationSettings(
      android: initializationSettingsAndroid,
      iOS: initializationSettingsIOS,
    );
    await flutterLocalNotificationsPlugin.initialize(
      initializationSettings,
      onSelectNotification: (String? payload) async {
        if (payload != null) {
          print('notification payload: $payload');
        }
      },
    );
  }

  Future selectNotification(String? payload) async {
    print('selectNotification: $payload');
  }

  Future<String> _downloadAndSaveFile(String url, String fileName) async {
    final Directory? directory = await getExternalStorageDirectory();
    final String filePath = '${directory!.path}/$fileName.png';
    final http.Response response = await http.get(Uri.parse(url));
    final File file = File(filePath);
    await file.writeAsBytes(response.bodyBytes);
    return filePath;
  }

  Future showNotify({
    required String body,
    required String image,
  }) async {
    final String largeIconPath = await _downloadAndSaveFile(
      'https://via.placeholder.com/48x48',
      'largeIcon',
    );
    final String bigPicturePath = await _downloadAndSaveFile(
      image,
      'bigPicture',
    );

    await flutterLocalNotificationsPlugin.show(
      123,
      'New Buisness Sutra Updated',
      body,
      NotificationDetails(
        android: AndroidNotificationDetails(
          'big text channel id',
          'big text channel name',
          ongoing: true,
          priority: Priority.max,
          largeIcon: FilePathAndroidBitmap(largeIconPath),
          channelDescription: 'big text channel description',
          styleInformation: BigPictureStyleInformation(
            FilePathAndroidBitmap(bigPicturePath),
            hideExpandedLargeIcon: false,
            contentTitle: 'overridden <b>big</b> content title',
            htmlFormatContentTitle: true,
            summaryText: 'summary <i>text</i>',
            htmlFormatSummaryText: true,
          ),
        ),
      ),
      payload: 'data',
    );
  }
}
</code>```

I initialized the firebase and notification on my main.dart file

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  if (!kIsWeb) {
    await Firebase.initializeApp();
    firebaseCloudMessagingListeners();
    await NotificationService().init();
  }
  runApp(const MyApp());
}
```
<pre class="lang-dart prettyprint-override"><code>
firebaseCloudMessagingListeners() {
  FirebaseMessaging.onBackgroundMessage(_messageHandler);
  FirebaseMessaging.onMessage.listen((RemoteMessage message) {
    print(message);
    _messageHandler(message);
  });
  FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
    print("Message opened");
  });
}

Future<void> _messageHandler(RemoteMessage message) async {
  Map<String, dynamic> data = message.data;
  print(data);
  await NotificationService().showNotify(
    body: data["body"],
    image: data["image"],
  );
}
</code>```

The firebase_messaging plugin works fine. The problem is with the big picture on the notification from flutter_local_notifications.
I download the image by using path_provider and http. also this image succesfully downloaded on my app External storage directory. But not shown on the notification

/storage/emulated/0/Android/data/in.myapp.dhrona/files/largeIcon.png
/storage/emulated/0/Android/data/in.myapp.dhrona/files/bigIcon.png

Any solutions for this issue

答:
With AwesomeNotifications I don't need to download. I just give the url like below:</p>
```<code>  Future<void> showNotificationChatMessage(
      RemoteMessage message, MyMessage myMessage) async {
    final chatId = message.data['chatId'];
    NotificationContent? notificationContent;
    if (myMessage.type == MyMessageType.text ||
        myMessage.replyType == MyMessageReplyType.text) {
      notificationContent = NotificationContent(
          id: 10,
          channelKey: 'basic_channel',
          title: message.data['title'].toString(),
          body: message.data['body'].toString(),
          payload: {'chatId': chatId.toString()});
    } else if (myMessage.type == MyMessageType.image ||
        myMessage.replyType == MyMessageReplyType.image) {
      notificationContent = NotificationContent(
          id: 11,
          channelKey: 'big_picture',
          title: message.data['title'].toString(),
          body: 'Image',
          bigPicture: myMessage.message,
          showWhen: true,
          displayOnBackground: true,
          payload: {'chatId': chatId.toString()},
          notificationLayout: NotificationLayout.BigPicture);
    }
    if (notificationContent != null) {
      AwesomeNotifications().createNotification(content: notificationContent);
    }
  }
</code>```

Body:
I need to make like this notification

My Output code

my Pubspec.yaml file. I am using latest version of flutter_local_notifications

  flutter_local_notifications: ^9.2.0

This is my Notification Controller code

import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:image/image.dart' as image;
import 'package:path_provider/path_provider.dart';

class NotificationService {
  static final NotificationService _notificationService =
      NotificationService._internal();

  final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
      FlutterLocalNotificationsPlugin();

  factory NotificationService() {
    return _notificationService;
  }

  NotificationService._internal();
  Future<void> init(
      Function(int, String?, String?, String?)?
          onDidReceiveLocalNotification) async {
    const AndroidInitializationSettings initializationSettingsAndroid =
        AndroidInitializationSettings('@mipmap/launcher_icon');

    final IOSInitializationSettings initializationSettingsIOS =
        IOSInitializationSettings(
      requestAlertPermission: false,
      requestBadgePermission: false,
      requestSoundPermission: false,
      onDidReceiveLocalNotification:
          (int id, String? title, String? body, String? payload) async {},
    );
    final InitializationSettings initializationSettings =
        InitializationSettings(
      android: initializationSettingsAndroid,
      iOS: initializationSettingsIOS,
    );
    await flutterLocalNotificationsPlugin.initialize(
      initializationSettings,
      onSelectNotification: (String? payload) async {
        if (payload != null) {
          print('notification payload: $payload');
        }
      },
    );
  }

  Future selectNotification(String? payload) async {
    print('selectNotification: $payload');
  }

  Future<String> _downloadAndSaveFile(String url, String fileName) async {
    final Directory? directory = await getExternalStorageDirectory();
    final String filePath = '${directory!.path}/$fileName.png';
    final http.Response response = await http.get(Uri.parse(url));
    final File file = File(filePath);
    await file.writeAsBytes(response.bodyBytes);
    return filePath;
  }

  Future showNotify({
    required String body,
    required String image,
  }) async {
    final String largeIconPath = await _downloadAndSaveFile(
      'https://via.placeholder.com/48x48',
      'largeIcon',
    );
    final String bigPicturePath = await _downloadAndSaveFile(
      image,
      'bigPicture',
    );

    await flutterLocalNotificationsPlugin.show(
      123,
      'New Buisness Sutra Updated',
      body,
      NotificationDetails(
        android: AndroidNotificationDetails(
          'big text channel id',
          'big text channel name',
          ongoing: true,
          priority: Priority.max,
          largeIcon: FilePathAndroidBitmap(largeIconPath),
          channelDescription: 'big text channel description',
          styleInformation: BigPictureStyleInformation(
            FilePathAndroidBitmap(bigPicturePath),
            hideExpandedLargeIcon: false,
            contentTitle: 'overridden big content title',
            htmlFormatContentTitle: true,
            summaryText: 'summary text',
            htmlFormatSummaryText: true,
          ),
        ),
      ),
      payload: 'data',
    );
  }
}

I initialized the firebase and notification on my main.dart file

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  if (!kIsWeb) {
    await Firebase.initializeApp();
    firebaseCloudMessagingListeners();
    await NotificationService().init();
  }
  runApp(const MyApp());
}

firebaseCloudMessagingListeners() {
  FirebaseMessaging.onBackgroundMessage(_messageHandler);
  FirebaseMessaging.onMessage.listen((RemoteMessage message) {
    print(message);
    _messageHandler(message);
  });
  FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
    print("Message opened");
  });
}

Future<void> _messageHandler(RemoteMessage message) async {
  Map<String, dynamic> data = message.data;
  print(data);
  await NotificationService().showNotify(
    body: data["body"],
    image: data["image"],
  );
}

The firebase_messaging plugin works fine. The problem is with the big picture on the notification from flutter_local_notifications.
I download the image by using path_provider and http. also this image succesfully downloaded on my app External storage directory. But not shown on the notification

/storage/emulated/0/Android/data/in.myapp.dhrona/files/largeIcon.png
/storage/emulated/0/Android/data/in.myapp.dhrona/files/bigIcon.png

Any solutions for this issue

Body:
With AwesomeNotifications I don't need to download. I just give the url like below:

  Future<void> showNotificationChatMessage(
      RemoteMessage message, MyMessage myMessage) async {
    final chatId = message.data['chatId'];
    NotificationContent? notificationContent;
    if (myMessage.type == MyMessageType.text ||
        myMessage.replyType == MyMessageReplyType.text) {
      notificationContent = NotificationContent(
          id: 10,
          channelKey: 'basic_channel',
          title: message.data['title'].toString(),
          body: message.data['body'].toString(),
          payload: {'chatId': chatId.toString()});
    } else if (myMessage.type == MyMessageType.image ||
        myMessage.replyType == MyMessageReplyType.image) {
      notificationContent = NotificationContent(
          id: 11,
          channelKey: 'big_picture',
          title: message.data['title'].toString(),
          body: 'Image',
          bigPicture: myMessage.message,
          showWhen: true,
          displayOnBackground: true,
          payload: {'chatId': chatId.toString()},
          notificationLayout: NotificationLayout.BigPicture);
    }
    if (notificationContent != null) {
      AwesomeNotifications().createNotification(content: notificationContent);
    }
  }


问:
Some beginner Objective-C/iPhone questions
I'm just starting out (reading up a lot for the past couple of days). Here's some questions that I have stacked up, hopefully someone can answer them.

1. the (self != nil) check in initializer code. Why do it? To prevent accidental access to some "run-only-once" code that's wrapped up in there? Where from could this accidental access come from? Doing such checks suggest that I don't have control over what's going on.

```
- (id)init {
    self = [super init]
    if (self != nil) {
    // Code..
    }
    return self;
}
```

2. How is it that you don't have to free up anything that static methods return? (or this is the idea I've got)

3. How is str = @"Hi there!" different from

```str = [[NSString alloc] initWithString:@"Hi there!"];```

As I understand, you have to release str in aquired with second method, but not with first? If so, when does the first one get released? Which one is preferable (not minding the typing length)?

4. What is autorelease, if iphone has no garbage collection? I've noticed something called "an autorelease pool" being created in main.m. Is [myObject autorelease]; a way of adding myObject to the nearest wrapping "autorelease pool", which will release it? Basically, some magic to avoid releasing it yourself? Why use it?

Well, thats it for now. Thanks for any answers!

答:
1: This check is to ensure that the super constructor returned a new object.

2: Static methods don't refer to an instance

3:

str = @"Hi there!"

This assigns the address of the constant string "Hi there!" to the pointer str

str = [[NSString alloc] initWithString:@"Hi there!"];

This allocates a string and copies "Hi There!" to it. This means that a) str is modifiable and b) needs to be deallocated when you are done with it.

OwnerDisplayName: Karolis

ContentLicense: CC BY-SA 2.5

Body:
I'm just starting out (reading up a lot for the past couple of days). Here's some questions that I have stacked up, hopefully someone can answer them.

1. the (self != nil) check in initializer code. Why do it? To prevent accidental access to some "run-only-once" code that's wrapped up in there? Where from could this accidental access come from? Doing such checks suggest that I don't have control over what's going on.

- (id)init {
    self = [super init]
    if (self != nil) {
    // Code..
    }
    return self;
}

2. How is it that you don't have to free up anything that static methods return? (or this is the idea I've got)

3. How is str = @"Hi there!" different from

str = [[NSString alloc] initWithString:@"Hi there!"];

As I understand, you have to release str in aquired with second method, but not with first? If so, when does the first one get released? Which one is preferable (not minding the typing length)?

4. What is autorelease, if iphone has no garbage collection? I've noticed something called "an autorelease pool" being created in main.m. Is [myObject autorelease]; a way of adding myObject to the nearest wrapping "autorelease pool", which will release it? Basically, some magic to avoid releasing it yourself? Why use it?

Well, thats it for now. Thanks for any answers!

OwnerDisplayName: Brian Mitchell


问:
Subtraction of numbers double and long
In my JAVA program there is code like this:

```<code>int f_part = (int) ((f_num - num) * 100);
</code>```

f_num is double and num is long. I just want to take the fractional part out and assign it to f_part. But some times f_part value is one less than it's value. Which means if f_num = 123.55 and num = 123, But f_part equals to 54. And it happens only f_num and num is greater than 100. I don't know why this happening. Please can someone explain why this happens and way to correct it.

答:
```<code>int f_part = (int) Math.round(((f_num - num) * 100));
</code>```

Title: Subtraction of numbers double and long

Body:
In my JAVA program there is code like this:

int f_part = (int) ((f_num - num) * 100);

f_num is double and num is long. I just want to take the fractional part out and assign it to f_part. But some times f_part value is one less than it's value. Which means if f_num = 123.55 and num = 123, But f_part equals to 54. And it happens only f_num and num is greater than 100. I don't know why this happening. Please can someone explain why this happens and way to correct it.


问:
Problems getting PowerPoint Combobox to list items correctly
I am creating a PowerPoint in which I want users to be able to select an item from a list in a combo box. Nothing needs to happen after this, it is just to provide a record, on screen, of their choice.

My problem is that I seem to either be able to populate the combo box and users can select an item but the list gets longer each time the combobox is clicked on (i.e each time it is clicked on the list gets duplicated). Or alternatively, I can clear the combo box, then populate it but in this scenario, the users choice also seems to get cleared.

VBA example 1:

```<code>Private Sub ComboBox1_DropButtonClick()
With ComboBox1
.AddItem " ", 0
.AddItem "speed", 1
.AddItem "provisionality", 2
.AddItem "automation", 3
.AddItem "replication", 4
.AddItem "communicability", 5
.AddItem "multi-modality", 6
.AddItem "non-linearity", 7
.AddItem "capacity", 8
.AddItem "interactivity", 9
End With
End Sub
</code>```

VBA example 2:

```<code>Private Sub ComboBox1_DropButtonClick()
ComboBox1.Clear
With ComboBox1
.AddItem " ", 0
.AddItem "speed", 1
.AddItem "provisionality", 2
.AddItem "automation", 3
.AddItem "replication", 4
.AddItem "communicability", 5
.AddItem "multi-modality", 6
.AddItem "non-linearity", 7
.AddItem "capacity", 8
.AddItem "interactivity", 9
End With
End Sub
</code>```

Can anyone help?

答:
If the combobox items don't change, you only need to run the code once on a macro enable pptm file.

```<code>Private Sub SetupCombo()
    ' set the combobox1
    ComboBox1.Clear
    With ComboBox1
        .AddItem " ", 0
        .AddItem "speed", 1
        .AddItem "provisionality", 2
        .AddItem "automation", 3
        .AddItem "replication", 4
        .AddItem "communicability", 5
        .AddItem "multi-modality", 6
        .AddItem "non-linearity", 7
        .AddItem "capacity", 8
        .AddItem "interactivity", 9
    End With
End Sub

Private Sub ComboBox1_Click()
    ' no code need here
End Sub
</code>```

Run the code by setting the cursor inside SetupCombo() and press play in the bar.

Present, check if the combo is okay and save the presentation as pptx (no need for vba or macro code). Your presentation is ready.

Body:
I am creating a PowerPoint in which I want users to be able to select an item from a list in a combo box. Nothing needs to happen after this, it is just to provide a record, on screen, of their choice.

My problem is that I seem to either be able to populate the combo box and users can select an item but the list gets longer each time the combobox is clicked on (i.e each time it is clicked on the list gets duplicated). Or alternatively, I can clear the combo box, then populate it but in this scenario, the users choice also seems to get cleared.

VBA example 1:

Private Sub ComboBox1_DropButtonClick()
With ComboBox1
.AddItem " ", 0
.AddItem "speed", 1
.AddItem "provisionality", 2
.AddItem "automation", 3
.AddItem "replication", 4
.AddItem "communicability", 5
.AddItem "multi-modality", 6
.AddItem "non-linearity", 7
.AddItem "capacity", 8
.AddItem "interactivity", 9
End With
End Sub

VBA example 2:

Private Sub ComboBox1_DropButtonClick()
ComboBox1.Clear
With ComboBox1
.AddItem " ", 0
.AddItem "speed", 1
.AddItem "provisionality", 2
.AddItem "automation", 3
.AddItem "replication", 4
.AddItem "communicability", 5
.AddItem "multi-modality", 6
.AddItem "non-linearity", 7
.AddItem "capacity", 8
.AddItem "interactivity", 9
End With
End Sub

Can anyone help?

Body:
If the combobox items don't change, you only need to run the code once on a macro enable pptm file.

Private Sub SetupCombo()
    ' set the combobox1
    ComboBox1.Clear
    With ComboBox1
        .AddItem " ", 0
        .AddItem "speed", 1
        .AddItem "provisionality", 2
        .AddItem "automation", 3
        .AddItem "replication", 4
        .AddItem "communicability", 5
        .AddItem "multi-modality", 6
        .AddItem "non-linearity", 7
        .AddItem "capacity", 8
        .AddItem "interactivity", 9
    End With
End Sub

Private Sub ComboBox1_Click()
    ' no code need here
End Sub

Run the code by setting the cursor inside SetupCombo() and press play in the bar.

Present, check if the combo is okay and save the presentation as pptx (no need for vba or macro code). Your presentation is ready.


问:
JxBrowser - From what version it does support WebGL?
From what version JxBrowser does support WebGL? Is it possible to enable it in v6.14.2? I was searching references in official documentation but it seems to be missing in versions previous to 7.x.

Thanks

答:
By default, WebGL is enabled in both JxBrowser 6 and 7.

If it doesn't work in 6.14.2, then it's probably due to the old and outdated Chromium 58 version used in JxBrowser 6.14.2. Some websites, including WebGL content, might not be compatible with Chromium 58 anymore. Please consider using the latest JxBrowser versions based on the latest Chromium builds.


问:
Could someone tell me the difference between these two MongoDB queries
I was given the following problem in MongoDB:

How many companies in the sample_training.companies dataset were

(Either founded in 2004 && ( either have the social category_code [or] web category_code))

|| (founded in the month of October && ( either have the social category_code [or] web category_code))

The actual query for the above question is given below and it returned 149 documents.

CorrectQuery:

```<code>db.companies.find({
  "$or":[
    {
      "founded_year":2004,
      "$or":[
        { "category_code":"social" },
        { "category_code":"web" }
      ]
    },
    {
      "founded_month":10,
      "$or":[
        { "category_code":"social" },
        { "category_code":"web" }
      ]
    }
  ]
}).count()
</code>```

But I've tried to formulate another query for the same problem, unfortunately, it returned the incorrect value of 668 rows.

Incorrect Query:

```<code>db.companies.find({
  "$or":[
    {"category_code":"social"},
    {"category_code":"web"}
  ],
  "$or":[
    {"founded_year":2004},
    {"founded_month":10}
  ]
}).count()
</code>```

Could someone help me in understanding the difference between these queries?

答:
The answer is just the standard order of operations in boolean logic.

AND has priority over OR in the same way that multiplication has priority over addition in mathematics.

The first example is correct because the logic matches the logic in your problem.

The second example logic is:

```<code>(category_code is "social" or category_code is "web") and (founded_year is 2004 or founded_month is 10)
</code>```

Your second example:

```<code>db.companies.find({
  "$or":[
    {"category_code":"social"},
    {"category_code":"web"}
  ],
  "$or":[
    {"founded_year":2004},
    {"founded_month":10}
  ]
}).count()
</code>```

Body:
I was given the following problem in MongoDB:

How many companies in the sample_training.companies dataset were

(Either founded in 2004 && ( either have the social category_code [or] web category_code))

|| (founded in the month of October && ( either have the social category_code [or] web category_code))

The actual query for the above question is given below and it returned 149 documents.

CorrectQuery:

db.companies.find({
  "$or":[
    {
      "founded_year":2004,
      "$or":[
        { "category_code":"social" },
        { "category_code":"web" }
      ]
    },
    {
      "founded_month":10,
      "$or":[
        { "category_code":"social" },
        { "category_code":"web" }
      ]
    }
  ]
}).count()

But I've tried to formulate another query for the same problem, unfortunately, it returned the incorrect value of 668 rows.

Incorrect Query:

db.companies.find({
  "$or":[
    {"category_code":"social"},
    {"category_code":"web"}
  ],
  "$or":[
    {"founded_year":2004},
    {"founded_month":10}
  ]
}).count()

Could someone help me in understanding the difference between these queries?

Body:
The answer is just the standard order of operations in boolean logic.

AND has priority over OR in the same way that multiplication has priority over addition in mathematics.

The first example is correct because the logic matches the logic in your problem.

The second example logic is:

(category_code is "social" or category_code is "web") and (founded_year is 2004 or founded_month is 10)

Your second example:

db.companies.find({
  "$or":[
    {"category_code":"social"},
    {"category_code":"web"}
  ],
  "$or":[
    {"founded_year":2004},
    {"founded_month":10}
  ]
}).count()