问:
Flutter Overlay not triggering onPress
We are trying to show an Overlay when onPress is executed on an ElevatedButton but this doesn't seem to be rendering

```<code>void _submit() async {
    HapticFeedback.mediumImpact();
    OverlayLoadingProgress.start(context, barrierDismissible: false);
    if (!_isLoading) {
      setState(() {
        _isLoading = true;
      });

      DatabaseService.createPayout(context, widget.user!, widget.task!);

      setState(() {
        _isLoading = false;
      });
    }
    OverlayLoadingProgress.stop(context);
  }
</code>```

We can see that the above function is being called and run but no Overlay being presented

```<code>Container(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
                  alignment: Alignment.center,
                  child: ElevatedButton(
                      style: ElevatedButton.styleFrom(
                          enableFeedback: true,
                          minimumSize: const Size(double.infinity, 45)),
                      onPressed: () {
                        _submit();
                      },
                      child: const Text('Release Payment'))),
</code>```

Overlay widget

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

class OverlayLoadingProgress {
  static OverlayEntry? _overlay;

  static start(
    BuildContext context, {
    Color? barrierColor = Colors.black54,
    Widget? widget,
    Color color = Colors.black38,
    String? gifOrImagePath,
    bool barrierDismissible = true,
  }) async {
    if (_overlay != null) return;
    _overlay = OverlayEntry(builder: (BuildContext context) {
      return _LoadingWidget(
        color: color,
        barrierColor: barrierColor,
        widget: widget,
        gifOrImagePath: gifOrImagePath,
        barrierDismissible: barrierDismissible,
      );
    });
    Overlay.of(context)!.insert(_overlay!);
  }

  static stop(BuildContext context, [bool rootNavigator = true]) {
    if (_overlay == null) return;
    _overlay!.remove();
    _overlay = null;
  }
}

    class _LoadingWidget extends StatelessWidget {
  final Widget? widget;
  final Color? color;
  final Color? barrierColor;
  final String? gifOrImagePath;
  final bool barrierDismissible;

  const _LoadingWidget({
    Key? key,
    this.widget,
    this.color,
    this.barrierColor,
    this.gifOrImagePath,
    required this.barrierDismissible,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: barrierDismissible
          ? () {
              OverlayLoadingProgress.stop(context);
            }
          : null,
      child: Container(
        constraints: const BoxConstraints.expand(),
        color: barrierColor,
        child: GestureDetector(
          onTap: () {},
          child: Center(
            child: widget ??
                SizedBox(
                  width: MediaQuery.of(context).size.width / 9,
                  child: AspectRatio(
                    aspectRatio: 1,
                    child: gifOrImagePath != null
                        ? Image.asset(gifOrImagePath!)
                        : const CircularProgressIndicator(
                            strokeWidth: 3,
                          ),
                  ),
                ),
          ),
        ),
      ),
    );
  }
}
</code>```

Title: Flutter Overlay not triggering onPress

Body:
We are trying to show an Overlay when onPress is executed on an ElevatedButton but this doesn't seem to be rendering

void _submit() async {
    HapticFeedback.mediumImpact();
    OverlayLoadingProgress.start(context, barrierDismissible: false);
    if (!_isLoading) {
      setState(() {
        _isLoading = true;
      });

      DatabaseService.createPayout(context, widget.user!, widget.task!);

      setState(() {
        _isLoading = false;
      });
    }
    OverlayLoadingProgress.stop(context);
  }

We can see that the above function is being called and run but no Overlay being presented

Container(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
                  alignment: Alignment.center,
                  child: ElevatedButton(
                      style: ElevatedButton.styleFrom(
                          enableFeedback: true,
                          minimumSize: const Size(double.infinity, 45)),
                      onPressed: () {
                        _submit();
                      },
                      child: const Text('Release Payment'))),

Overlay widget

import 'package:flutter/material.dart';

class OverlayLoadingProgress {
  static OverlayEntry? _overlay;

  static start(
    BuildContext context, {
    Color? barrierColor = Colors.black54,
    Widget? widget,
    Color color = Colors.black38,
    String? gifOrImagePath,
    bool barrierDismissible = true,
  }) async {
    if (_overlay != null) return;
    _overlay = OverlayEntry(builder: (BuildContext context) {
      return _LoadingWidget(
        color: color,
        barrierColor: barrierColor,
        widget: widget,
        gifOrImagePath: gifOrImagePath,
        barrierDismissible: barrierDismissible,
      );
    });
    Overlay.of(context)!.insert(_overlay!);
  }

  static stop(BuildContext context, [bool rootNavigator = true]) {
    if (_overlay == null) return;
    _overlay!.remove();
    _overlay = null;
  }
}

    class _LoadingWidget extends StatelessWidget {
  final Widget? widget;
  final Color? color;
  final Color? barrierColor;
  final String? gifOrImagePath;
  final bool barrierDismissible;

  const _LoadingWidget({
    Key? key,
    this.widget,
    this.color,
    this.barrierColor,
    this.gifOrImagePath,
    required this.barrierDismissible,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: barrierDismissible
          ? () {
              OverlayLoadingProgress.stop(context);
            }
          : null,
      child: Container(
        constraints: const BoxConstraints.expand(),
        color: barrierColor,
        child: GestureDetector(
          onTap: () {},
          child: Center(
            child: widget ??
                SizedBox(
                  width: MediaQuery.of(context).size.width / 9,
                  child: AspectRatio(
                    aspectRatio: 1,
                    child: gifOrImagePath != null
                        ? Image.asset(gifOrImagePath!)
                        : const CircularProgressIndicator(
                            strokeWidth: 3,
                          ),
                  ),
                ),
          ),
        ),
      ),
    );
  }
}


来源: stackexchange

问:
SQL check if list parameter is null in different RDBMS
I am creating an app which performs raw queries across different databases and I am struggling with list parameters (IN).

I use SQLAlchemy for performing these queries.

I want to perform a query that accepts list parameter and that parameter might be NULL, which means I don't have to filter by field.

```<code>from sqlalchemy import create_engine, text

SQL = """SELECT group, count(1) cnt
         FROM some_table
         WHERE group IN :groups OR :groups IS NULL
         GROUP BY group
"""
params = {'groups': ('group1', 'group2')}

engine = create_engine(connection_string)
query = text(SQL).bindparams(**params)
cursor = engine.execute(query)
</code>```

Currently I'm testing it on PostgreSQL, MySQL and SQLite, but in production mode it is also supposed to work with SQL Server and Oracle.

The code above works only on PostgreSQL, however if I change params with None

```<code>params = {'groups': None}
</code>```

The code wouldn't work on any databases.

Is there workaround for this problem?

I understand that solution might be specific for each RDBMS.

ContentLicense: CC BY-SA 4.0

Body:
I am creating an app which performs raw queries across different databases and I am struggling with list parameters (IN).

I use SQLAlchemy for performing these queries.

I want to perform a query that accepts list parameter and that parameter might be NULL, which means I don't have to filter by field.

from sqlalchemy import create_engine, text

SQL = """SELECT group, count(1) cnt
         FROM some_table
         WHERE group IN :groups OR :groups IS NULL
         GROUP BY group
"""
params = {'groups': ('group1', 'group2')}

engine = create_engine(connection_string)
query = text(SQL).bindparams(**params)
cursor = engine.execute(query)

Currently I'm testing it on PostgreSQL, MySQL and SQLite, but in production mode it is also supposed to work with SQL Server and Oracle.

The code above works only on PostgreSQL, however if I change params with None

params = {'groups': None}

The code wouldn't work on any databases.

Is there workaround for this problem?

I understand that solution might be specific for each RDBMS.


问:
Adding a new stored procedure to data flow task of existing SSIS project
I want to replace one of the old stored procedures of a data flow task of existing SSIS project by a new procedure.

Can I do it without creating another new project? My internal guideline only describes the steps to create a new project instead of updating an existing one.

I know how to add new stored procedure but how to I change the SQL command to execute the new stored procedure instead of the old one? Is it enough to change the SQL command of the sln file using visual studio? I don't know whether the sln file is only a visual flowchart. Or all I have to do is change the SqlCommand property of the data flow component of the data flow task and then save the sln file?

Can someone please provide more details?
Thank you.


问:
What is the maximum size of data can be pass along with angular navigation
I'm passing data along with the route in angular in the below format

```<code>this.router.navigate(['/home'],{state:{title:'Example code'}});
</code>```

I'm able to access the data from the corresponding home page. Does navigation have a size limit for sending data?

Body:
I'm passing data along with the route in angular in the below format

this.router.navigate(['/home'],{state:{title:'Example code'}});

I'm able to access the data from the corresponding home page. Does navigation have a size limit for sending data?


问:
I got symfony/console errors when installed botman/botman into new laravel app?
I try to add botman/botman into my new laravel app, which I created with command :

```<code>laravel new    LrBtmn
</code>```

But I got error :

```<code>master@master-at-home:/_wwwroot/lar/LrBtmn$ php artisan --version
Laravel Framework 9.47.0
master@master-at-home:/_wwwroot/lar/LrBtmn$ composer global require "botman/installer"
Changed current directory to /home/master/.config/composer
Using version ^1.0 for botman/installer
./composer.json has been updated
Running composer update botman/installer
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- botman/installer[1.0.0, ..., 1.0.3] require symfony/console ~2.3|~3.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but the package is fixed to v6.2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- botman/installer 1.0.4 requires symfony/console ~2.3|~3.0|~4.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.49] but the package is fixed to v6.2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires botman/installer ^1.0 -> satisfiable by botman/installer[1.0.0, ..., 1.0.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require botman/installer:*" to figure out if any version is installable, or "composer require botman/installer:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
</code>```

I tried to add "-W" key :

```<code>master@master-at-home:/_wwwroot/lar/LrBtmn$ composer global require "botman/installer" -W
Changed current directory to /home/master/.config/composer
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^1.0 for botman/installer
./composer.json has been updated
Running composer update botman/installer --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- botman/installer[1.0.0, ..., 1.0.3] require symfony/console ~2.3|~3.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but these were not loaded, likely because it conflicts with another require.
- botman/installer 1.0.4 requires symfony/console ~2.3|~3.0|~4.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.49] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires botman/installer ^1.0 -> satisfiable by botman/installer[1.0.0, ..., 1.0.4].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require botman/installer:*" to figure out if any version is installable, or "composer require botman/installer:^2.1" if you know which you need.
</code>```

In composer.json of new project there are no any "symfony/console" packages:

```<code>{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "botman/botman": "^2.7",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.19",
        "laravel/sanctum": "^3.0",
        "laravel/tinker": "^2.7"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
</code>```

Which steps have I to take to run this app?

Thanks!

Body:
I try to add botman/botman into my new laravel app, which I created with command :

laravel new    LrBtmn

But I got error :

master@master-at-home:/_wwwroot/lar/LrBtmn$ php artisan --version
Laravel Framework 9.47.0
master@master-at-home:/_wwwroot/lar/LrBtmn$ composer global require "botman/installer"
Changed current directory to /home/master/.config/composer
Using version ^1.0 for botman/installer
./composer.json has been updated
Running composer update botman/installer
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- botman/installer[1.0.0, ..., 1.0.3] require symfony/console ~2.3|~3.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but the package is fixed to v6.2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- botman/installer 1.0.4 requires symfony/console ~2.3|~3.0|~4.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.49] but the package is fixed to v6.2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires botman/installer ^1.0 -> satisfiable by botman/installer[1.0.0, ..., 1.0.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require botman/installer:*" to figure out if any version is installable, or "composer require botman/installer:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I tried to add "-W" key :

master@master-at-home:/_wwwroot/lar/LrBtmn$ composer global require "botman/installer" -W
Changed current directory to /home/master/.config/composer
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^1.0 for botman/installer
./composer.json has been updated
Running composer update botman/installer --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- botman/installer[1.0.0, ..., 1.0.3] require symfony/console ~2.3|~3.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but these were not loaded, likely because it conflicts with another require.
- botman/installer 1.0.4 requires symfony/console ~2.3|~3.0|~4.0 -> found symfony/console[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.49] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires botman/installer ^1.0 -> satisfiable by botman/installer[1.0.0, ..., 1.0.4].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require botman/installer:*" to figure out if any version is installable, or "composer require botman/installer:^2.1" if you know which you need.

In composer.json of new project there are no any "symfony/console" packages:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "botman/botman": "^2.7",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.19",
        "laravel/sanctum": "^3.0",
        "laravel/tinker": "^2.7"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Which steps have I to take to run this app?

Thanks!


问:
align to different space of comments on sql in vscode
I'd like to reorganize the comments in vscode to be at the same line.

as is

```<code>Select * From grocery as G   --TODO update "G" to "GG"
   Join Store as S on G.prodcode = S.prodcode  --TODO add more relations
Where G.name = "banana"
</code>```

to be

```<code>Select * From grocery as G                     --TODO update "G" to "GG"
   Join Store as S on G.prodcode = S.prodcode  --TODO add more relations
Where G.name = "banana"
</code>```

Actuall i've tried many of extensions but they works just specific comment command such as ( //, /* */ )

but my case is '--' so it's not working well.

is there any other extensions or advise?

Thanks in advice.
Cheers

i've tried to use "Cursor Align", "multi-command" with some property change

Body:
I'd like to reorganize the comments in vscode to be at the same line.

as is

Select * From grocery as G   --TODO update "G" to "GG"
   Join Store as S on G.prodcode = S.prodcode  --TODO add more relations
Where G.name = "banana"

to be

Select * From grocery as G                     --TODO update "G" to "GG"
   Join Store as S on G.prodcode = S.prodcode  --TODO add more relations
Where G.name = "banana"

Actuall i've tried many of extensions but they works just specific comment command such as ( //, /* */ )

but my case is '--' so it's not working well.

is there any other extensions or advise?

Thanks in advice.
Cheers

i've tried to use "Cursor Align", "multi-command" with some property change


问:
Replacing keyword in word.docx-file header by officer R package
I cannot access my code via phone (laptop out of order)... I have a basic question:
I have a word.docx template where I want to replace a keyword in the header by a new word.
Is "headers_replace_all_text()" command the one I should go for?

Cheers,
Nadine


问:
Why is 4/3 not the same as 4.0/3.0?
This code gives me the correct volume of a sphere:

```<code>public static double CalculateBallVolume(double aRadius)
{
    double volume = (4.0 / 3.0) * Math.PI * Math.Pow(aRadius,3);

    return volume;
}
</code>```

but if I write it like this, I get a different result:

```<code>public static double CalculateBallVolume(double aRadius)
{
    double volume = (4 / 3) * Math.PI * Math.Pow(aRadius,3);

    return volume;
}
</code>```

In particular, it appears that 4 / 3 does not give the same result as 4.0 / 3.0. Why not?

Title: Why is 4/3 not the same as 4.0/3.0?

Body:
This code gives me the correct volume of a sphere:

public static double CalculateBallVolume(double aRadius)
{
    double volume = (4.0 / 3.0) * Math.PI * Math.Pow(aRadius,3);

    return volume;
}

but if I write it like this, I get a different result:

public static double CalculateBallVolume(double aRadius)
{
    double volume = (4 / 3) * Math.PI * Math.Pow(aRadius,3);

    return volume;
}

In particular, it appears that 4 / 3 does not give the same result as 4.0 / 3.0. Why not?


问:
Android: Get and Open Email and remove Bluetooth
i want to choice a app to send email:only email app to send my email,i have read  How to open Email program via Intents (but only an Email program)   i used intent.setType("message/rfc822") ,it very well,but Bluetooth and email give me to choice,i want to remove Bluetooth,and want to Leave only email.can you tell me how to send email not to show Bluetooth to give mo choice;

edit: if i used Intent intent = new Intent(Intent.ACTION_SENDTO); the bluetooth is remove but add  Text messages t0 give me choice.i also used

```<code>Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:?subject=" + subject + "&body=" + body);
intent.setData(data);
startActivity(intent);
</code>```

the bluetooth also remove  but also add  add  Text messages t0 give me choice.is there i way to only email app to send email?

ContentLicense: CC BY-SA 3.0

Body:
i want to choice a app to send email:only email app to send my email,i have read  How to open Email program via Intents (but only an Email program)   i used intent.setType("message/rfc822") ,it very well,but Bluetooth and email give me to choice,i want to remove Bluetooth,and want to Leave only email.can you tell me how to send email not to show Bluetooth to give mo choice;

edit: if i used Intent intent = new Intent(Intent.ACTION_SENDTO); the bluetooth is remove but add  Text messages t0 give me choice.i also used

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:?subject=" + subject + "&body=" + body);
intent.setData(data);
startActivity(intent);

the bluetooth also remove  but also add  add  Text messages t0 give me choice.is there i way to only email app to send email?


问:
XLSXWriter can one use xl_rowcol_to_cell as the cell to act on in conditional formating using type formula?
and thanks in advance for any assistance.

Based on the code snippet below, I'm trying to take the information from SUMMARY_LIST and add it to an xlsx worksheet. I'm then trying to colorize the cells based on 3 conditional formats,

green, text in cell in column A is equal to PASS
yellow, text in cell in column A contains the word PARTIAL and the value in column B of the same row is greater or equal to 6; or the text in cell in column B is equal to CRITICAL
red, text in cell in column A contains the word FAIL and the value in column B if the same row is greater than or equal to 6; or the text in cell in column B is equal to EMERGENCY.

If I hard code the cell in the condition to either $A1 or $B1, I get the desired result, which is that the if my condition passes, then both cells in the row that match either condition will get the appropriate background color.

If I substitute xl_rowcol_to_cell(0,0,col_abs=True) for $A1 and/or xl_rowcol_to_cell(0,1,col_abs=True) for $B1, the cells in my row doesn't get colorized.

In the snippet, I'm trying to colorize the background red if either my cell in column A contains the word "FAIL" and the value in column B is >= 6; OR the cell in column B contains the word "EMERGENCY".

When I run the script, neither the cells in the row containing the word FAIL or the row containing the word EMERGENCY are changed to a red background.

Is there an error in my conditional formatting statement for formatting in red or is it not possible to use the xl_rowcol_to_cell as an input to the condition?

```<code>import xlsxwriter
from xlsxwriter.utility import xl_range
from xlsxwriter.utility import xl_range_abs
from xlsxwriter.utility import xl_rowcol_to_cell

SUMMARY_LIST = [{'Item': 'Date', 'Value': '2023-01-11 14:09:16'}, {'Item': 'O/S Version', 'Value': '18.04.6 LTS (Bionic Beaver)'}, {'Item': 'CRITICAL EXPIRY THRESHOLD', 'Value': '6700'}, {'Item': 'EMERGENCY EXPIRY THRESHOLD', 'Value': '720'}, {'Item': 'TOTAL', 'Value': 6}, {'Item': 'PASS', 'Value': 6}, {'Item': 'PARTIAL PASS', 'Value': 6}, {'Item': 'FAIL', 'Value': 6}, {'Item': 'cert1', 'Value': 'EMERGENCY'}, {'Item': 'cert2', 'Value': 'CRITICAL'}]

wb = xlsxwriter.Workbook('myTest.xlsx')
ws = wb.add_worksheet()
row = 0
col = 0
inc = 0
formatEmerg = wb.add_format({'bg_color': 'red'})
formatCrit = wb.add_format({'bg_color': 'yellow'})
formatOk = wb.add_format({'bg_color': 'green'})

for item in SUMMARY_LIST:

    inc = 0
    for x in item.values():
        ws.write(row,col + inc,x )
        inc += 1
    last_row = row
    row += 1
    col = 0

ws.conditional_format(xl_range(0,0,last_row,1),
{
    'type':'formula',
    'criteria':'=OR(and(left(xl_rowcol_to_cell(0,0,col_abs=True),4)="FAIL",(xl_rowcol_to_cell(0,1,col_abs=True)>=6)),left(xl_rowcol_to_cell(0,1,col_abs=True),9)="EMERGENCY")',
    'format': formatEmerg
})
ws.conditional_format(xl_range(0,0,last_row,1),
{
    'type':'formula',
    'criteria':'=OR(and(left($A1,7)="PARTIAL",($B1>=6)),left($B1,8)="CRITICAL")',
    'format': formatCrit
})
ws.conditional_format(xl_range(0,0,last_row,1),
{
    'type':'formula',
    'criteria':'=OR(and(left($A1,4)="PASS",($B1>=6)),left($B1,8)="CRITICAL")',
    'format': formatOk
})

wb.close()
</code>```

I haven't tried anything other than hardcoding the cell, or using the xl_rowcol_to_cell function.

My expectation is that the absolute column, represented by $A1, generated by xl_rowcol_to_cell(0,1,col_abs=True) would be substituted and the condition would evaluate the same as hardcoding the column as $A1. Same for column $B1.

Body:
and thanks in advance for any assistance.

Based on the code snippet below, I'm trying to take the information from SUMMARY_LIST and add it to an xlsx worksheet. I'm then trying to colorize the cells based on 3 conditional formats,

green, text in cell in column A is equal to PASS
yellow, text in cell in column A contains the word PARTIAL and the value in column B of the same row is greater or equal to 6; or the text in cell in column B is equal to CRITICAL
red, text in cell in column A contains the word FAIL and the value in column B if the same row is greater than or equal to 6; or the text in cell in column B is equal to EMERGENCY.

If I hard code the cell in the condition to either $A1 or $B1, I get the desired result, which is that the if my condition passes, then both cells in the row that match either condition will get the appropriate background color.

If I substitute xl_rowcol_to_cell(0,0,col_abs=True) for $A1 and/or xl_rowcol_to_cell(0,1,col_abs=True) for $B1, the cells in my row doesn't get colorized.

In the snippet, I'm trying to colorize the background red if either my cell in column A contains the word "FAIL" and the value in column B is >= 6; OR the cell in column B contains the word "EMERGENCY".

When I run the script, neither the cells in the row containing the word FAIL or the row containing the word EMERGENCY are changed to a red background.

Is there an error in my conditional formatting statement for formatting in red or is it not possible to use the xl_rowcol_to_cell as an input to the condition?

import xlsxwriter
from xlsxwriter.utility import xl_range
from xlsxwriter.utility import xl_range_abs
from xlsxwriter.utility import xl_rowcol_to_cell

SUMMARY_LIST = [{'Item': 'Date', 'Value': '2023-01-11 14:09:16'}, {'Item': 'O/S Version', 'Value': '18.04.6 LTS (Bionic Beaver)'}, {'Item': 'CRITICAL EXPIRY THRESHOLD', 'Value': '6700'}, {'Item': 'EMERGENCY EXPIRY THRESHOLD', 'Value': '720'}, {'Item': 'TOTAL', 'Value': 6}, {'Item': 'PASS', 'Value': 6}, {'Item': 'PARTIAL PASS', 'Value': 6}, {'Item': 'FAIL', 'Value': 6}, {'Item': 'cert1', 'Value': 'EMERGENCY'}, {'Item': 'cert2', 'Value': 'CRITICAL'}]

wb = xlsxwriter.Workbook('myTest.xlsx')
ws = wb.add_worksheet()
row = 0
col = 0
inc = 0
formatEmerg = wb.add_format({'bg_color': 'red'})
formatCrit = wb.add_format({'bg_color': 'yellow'})
formatOk = wb.add_format({'bg_color': 'green'})

for item in SUMMARY_LIST:

    inc = 0
    for x in item.values():
        ws.write(row,col + inc,x )
        inc += 1
    last_row = row
    row += 1
    col = 0

ws.conditional_format(xl_range(0,0,last_row,1),
{
    'type':'formula',
    'criteria':'=OR(and(left(xl_rowcol_to_cell(0,0,col_abs=True),4)="FAIL",(xl_rowcol_to_cell(0,1,col_abs=True)>=6)),left(xl_rowcol_to_cell(0,1,col_abs=True),9)="EMERGENCY")',
    'format': formatEmerg
})
ws.conditional_format(xl_range(0,0,last_row,1),
{
    'type':'formula',
    'criteria':'=OR(and(left($A1,7)="PARTIAL",($B1>=6)),left($B1,8)="CRITICAL")',
    'format': formatCrit
})
ws.conditional_format(xl_range(0,0,last_row,1),
{
    'type':'formula',
    'criteria':'=OR(and(left($A1,4)="PASS",($B1>=6)),left($B1,8)="CRITICAL")',
    'format': formatOk
})

wb.close()

I haven't tried anything other than hardcoding the cell, or using the xl_rowcol_to_cell function.

My expectation is that the absolute column, represented by $A1, generated by xl_rowcol_to_cell(0,1,col_abs=True) would be substituted and the condition would evaluate the same as hardcoding the column as $A1. Same for column $B1.


问:
Borrowed value doesn't live long enough for trait, but does for concrete impl?
I'm trying to build a simple ECS storage structure that can be queried for iteration based on type combinations, with both &T and &mut T access patterns.

use std::cell::{Ref, RefCell, RefMut};

#[derive(Default)]
pub struct SimpleWorld {
    column_1: RefCell<Vec<u8>>,
    _column_2: RefCell<Vec<u16>>,
    column_3: RefCell<Vec<u32>>,
    _column_4: RefCell<Vec<u64>>,
}

trait World {
    fn column<'w, T: Param<'w, Self>>(&'w self) -> T::Column<'w>
    where
        T::Column<'w>: 'w,
    {
        <T as Param<Self>>::column(self)
    }
}

impl World for SimpleWorld {}

trait Param<'p, W: World + ?Sized>: Sized {
    type Underlying;
    type Column<'c>: 'c;
    type Unpacked<'u>;

    fn column(world: &'p W) -> Self::Column<'p>;
    fn unpack<'a>(column: &'a mut Self::Column<'_>) -> Self::Unpacked<'a>;
}

impl<'p> Param<'p, SimpleWorld> for &'p u8 {
    type Underlying = u8;
    type Column<'c> = Ref<'c, [u8]>;
    type Unpacked<'u> = &'u [u8];

    fn column(world: &'p SimpleWorld) -> Self::Column<'_> {
        Ref::map(world.column_1.borrow(), |c| c.as_slice())
    }

    fn unpack<'a>(column: &'a mut Self::Column<'_>) -> Self::Unpacked<'a> {
        column.as_ref()
    }
}

impl<'p> Param<'p, SimpleWorld> for &'p mut u32 {
    type Underlying = u32;
    type Column<'c> = RefMut<'c, [u32]>;
    type Unpacked<'u> = &'u mut [u32];

    fn column(world: &'p SimpleWorld) -> Self::Column<'_> {
        RefMut::map(world.column_3.borrow_mut(), |c| c.as_mut_slice())
    }

    fn unpack<'a>(column: &'a mut Self::Column<'_>) -> Self::Unpacked<'a> {
        column.as_mut()
    }
}

trait System<'p, W: World, Input> {
    fn run(&mut self, world: &'p W);
}

impl<'p, F> System<'p, SimpleWorld, (&u8, &mut u32)> for F
where
    F: FnMut(&u8, &mut u32),
{
    fn run(&mut self, world: &'p SimpleWorld) {
        let mut p1 = <&u8 as Param<'p, SimpleWorld>>::column(world);
        let mut p2 = <&mut u32 as Param<'p, SimpleWorld>>::column(world);

        let p1_slice = <&u8 as Param<'_, SimpleWorld>>::unpack(&mut p1);
        let p2_slice = <&mut u32 as Param<'_, SimpleWorld>>::unpack(&mut p2);

        for (a, b) in p1_slice.into_iter().zip(p2_slice.into_iter()) {
            self(a, b)
        }
    }
}

fn main() {
    let world = SimpleWorld {
        column_1: vec![1, 2, 3].into(),
        _column_2: vec![4, 5, 6].into(),
        column_3: vec![7, 8, 9].into(),
        _column_4: vec![10, 11, 12].into(),
    };

    (|a: &u8, b: &mut u32| println!("{} {}", *a, *b)).run(&world);
}
```
<p>This code works fine when <code>System</code> is implemented for functions with concrete types, but when I go to generalize it by replacing that <code>impl</code> with this one:</p>
```impl<'p, F, T1, T2> System<'p, SimpleWorld, (T1, T2)> for F
where
    F: FnMut(T1, T2),
    T1: Param<'p, SimpleWorld> + 'p,
    T2: Param<'p, SimpleWorld> + 'p,
    <T1 as Param<'p, SimpleWorld>>::Unpacked<'p>: IntoIterator<Item = T1>,
    <T2 as Param<'p, SimpleWorld>>::Unpacked<'p>: IntoIterator<Item = T2>,
{
    fn run(&mut self, world: &'p SimpleWorld) {
        let mut p1 = <T1 as Param<'p, SimpleWorld>>::column(world);
        let mut p2 = <T2 as Param<'p, SimpleWorld>>::column(world);

        let p1_slice = <T1 as Param<'_, SimpleWorld>>::unpack(&mut p1);
        let p2_slice = <T2 as Param<'_, SimpleWorld>>::unpack(&mut p2);

        for (a, b) in p1_slice.into_iter().zip(p2_slice.into_iter()) {
            self(a, b)
        }
    }
}
```
<p>I get the following error about the lifetimes of <code>p1</code> (and <code>p2</code>):</p>
```error[E0597]: `p1` does not live long enough
  --> <source>:75:63
   |
63 | impl<'p, F, T1, T2> System<'p, SimpleWorld, (T1, T2)> for F
   |      -- lifetime `'p` defined here
...
75 |         let p1_slice = <T1 as Param<'_, SimpleWorld>>::unpack(&mut p1);
   |                        ---------------------------------------^^^^^^^-
   |                        |                                      |
   |                        |                                      borrowed value does not live long enough
   |                        argument requires that `p1` is borrowed for `'p`
...
81 |     }
   |     - `p1` dropped here while still borrowed
```

Is there something I can do with these where clauses to preserve the lifetimes here? It seems to me like p1 should live long enough as a Ref or RefMut, but for whatever reason I can't enforce that. Failing trait clauses, is there an unsafe way to get around this lifetime definition limitation without UB?

Body:
I'm trying to build a simple ECS storage structure that can be queried for iteration based on type combinations, with both &T and &mut T access patterns.

use std::cell::{Ref, RefCell, RefMut};

#[derive(Default)]
pub struct SimpleWorld {
    column_1: RefCell<Vec<u8>>,
    _column_2: RefCell<Vec<u16>>,
    column_3: RefCell<Vec<u32>>,
    _column_4: RefCell<Vec<u64>>,
}

trait World {
    fn column<'w, T: Param<'w, Self>>(&'w self) -> T::Column<'w>
    where
        T::Column<'w>: 'w,
    {
        <T as Param<Self>>::column(self)
    }
}

impl World for SimpleWorld {}

trait Param<'p, W: World + ?Sized>: Sized {
    type Underlying;
    type Column<'c>: 'c;
    type Unpacked<'u>;

    fn column(world: &'p W) -> Self::Column<'p>;
    fn unpack<'a>(column: &'a mut Self::Column<'_>) -> Self::Unpacked<'a>;
}

impl<'p> Param<'p, SimpleWorld> for &'p u8 {
    type Underlying = u8;
    type Column<'c> = Ref<'c, [u8]>;
    type Unpacked<'u> = &'u [u8];

    fn column(world: &'p SimpleWorld) -> Self::Column<'_> {
        Ref::map(world.column_1.borrow(), |c| c.as_slice())
    }

    fn unpack<'a>(column: &'a mut Self::Column<'_>) -> Self::Unpacked<'a> {
        column.as_ref()
    }
}

impl<'p> Param<'p, SimpleWorld> for &'p mut u32 {
    type Underlying = u32;
    type Column<'c> = RefMut<'c, [u32]>;
    type Unpacked<'u> = &'u mut [u32];

    fn column(world: &'p SimpleWorld) -> Self::Column<'_> {
        RefMut::map(world.column_3.borrow_mut(), |c| c.as_mut_slice())
    }

    fn unpack<'a>(column: &'a mut Self::Column<'_>) -> Self::Unpacked<'a> {
        column.as_mut()
    }
}

trait System<'p, W: World, Input> {
    fn run(&mut self, world: &'p W);
}

impl<'p, F> System<'p, SimpleWorld, (&u8, &mut u32)> for F
where
    F: FnMut(&u8, &mut u32),
{
    fn run(&mut self, world: &'p SimpleWorld) {
        let mut p1 = <&u8 as Param<'p, SimpleWorld>>::column(world);
        let mut p2 = <&mut u32 as Param<'p, SimpleWorld>>::column(world);

        let p1_slice = <&u8 as Param<'_, SimpleWorld>>::unpack(&mut p1);
        let p2_slice = <&mut u32 as Param<'_, SimpleWorld>>::unpack(&mut p2);

        for (a, b) in p1_slice.into_iter().zip(p2_slice.into_iter()) {
            self(a, b)
        }
    }
}

fn main() {
    let world = SimpleWorld {
        column_1: vec![1, 2, 3].into(),
        _column_2: vec![4, 5, 6].into(),
        column_3: vec![7, 8, 9].into(),
        _column_4: vec![10, 11, 12].into(),
    };

    (|a: &u8, b: &mut u32| println!("{} {}", *a, *b)).run(&world);
}

This code works fine when System is implemented for functions with concrete types, but when I go to generalize it by replacing that impl with this one:

impl<'p, F, T1, T2> System<'p, SimpleWorld, (T1, T2)> for F
where
    F: FnMut(T1, T2),
    T1: Param<'p, SimpleWorld> + 'p,
    T2: Param<'p, SimpleWorld> + 'p,
    <T1 as Param<'p, SimpleWorld>>::Unpacked<'p>: IntoIterator<Item = T1>,
    <T2 as Param<'p, SimpleWorld>>::Unpacked<'p>: IntoIterator<Item = T2>,
{
    fn run(&mut self, world: &'p SimpleWorld) {
        let mut p1 = <T1 as Param<'p, SimpleWorld>>::column(world);
        let mut p2 = <T2 as Param<'p, SimpleWorld>>::column(world);

        let p1_slice = <T1 as Param<'_, SimpleWorld>>::unpack(&mut p1);
        let p2_slice = <T2 as Param<'_, SimpleWorld>>::unpack(&mut p2);

        for (a, b) in p1_slice.into_iter().zip(p2_slice.into_iter()) {
            self(a, b)
        }
    }
}

I get the following error about the lifetimes of p1 (and p2):

error[E0597]: `p1` does not live long enough
  --> <source>:75:63
   |
63 | impl<'p, F, T1, T2> System<'p, SimpleWorld, (T1, T2)> for F
   |      -- lifetime `'p` defined here
...
75 |         let p1_slice = <T1 as Param<'_, SimpleWorld>>::unpack(&mut p1);
   |                        ---------------------------------------^^^^^^^-
   |                        |                                      |
   |                        |                                      borrowed value does not live long enough
   |                        argument requires that `p1` is borrowed for `'p`
...
81 |     }
   |     - `p1` dropped here while still borrowed

Is there something I can do with these where clauses to preserve the lifetimes here? It seems to me like p1 should live long enough as a Ref or RefMut, but for whatever reason I can't enforce that. Failing trait clauses, is there an unsafe way to get around this lifetime definition limitation without UB?


问:
Can't get prior version of pprofile to install in miniconda
I have an M1 MacBook Air and I'm trying to install a previous version of pprofile in miniconda and I'm running into this error:

```<code>(mt) bin: $ pip install pprofile==2.0.2
Collecting pprofile==2.0.2
  Using cached pprofile-2.0.2.tar.gz (35 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/dfg/miniconda3/envs/mt/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-install-fnwm_ln5/pprofile_138821cbfeaf40d98bf1716762b7216d/setup.py'"'"'; __file__='"'"'/private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-install-fnwm_ln5/pprofile_138821cbfeaf40d98bf1716762b7216d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-pip-egg-info-drtrq3xd
         cwd: /private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-install-fnwm_ln5/pprofile_138821cbfeaf40d98bf1716762b7216d/
    Complete output (1 lines):
    error in pprofile setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/35/d9/360f4483f735cbd4f1ac7316f3bdbee06b5872355963b913f1a53871ac72/pprofile-2.0.2.tar.gz#sha256=3469102f462f9fc2d889970afcf73d89c0d89a36c49a4c262c3edc302b4a22da (from https://pypi.org/simple/pprofile/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pprofile==2.0.2 (from versions: 1.0, 1.0.1, 1.1, 1.2, 1.2.1, 1.3, 1.4, 1.4.1, 1.5, 1.6, 1.6.1, 1.6.2, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.9, 1.9.1, 1.9.2, 1.10.0, 1.10.1, 1.11.0, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1.0)
ERROR: No matching distribution found for pprofile==2.0.2
</code>```

I can install the latest version just fine. Can anyone assist with resolving this issue?

Body:
I have an M1 MacBook Air and I'm trying to install a previous version of pprofile in miniconda and I'm running into this error:

(mt) bin: $ pip install pprofile==2.0.2
Collecting pprofile==2.0.2
  Using cached pprofile-2.0.2.tar.gz (35 kB)
    ERROR: Command errored out with exit status 1:
     command: /Users/dfg/miniconda3/envs/mt/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-install-fnwm_ln5/pprofile_138821cbfeaf40d98bf1716762b7216d/setup.py'"'"'; __file__='"'"'/private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-install-fnwm_ln5/pprofile_138821cbfeaf40d98bf1716762b7216d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-pip-egg-info-drtrq3xd
         cwd: /private/var/folders/2y/xs2qf7ms04xbg9lyv_7s49c00000gn/T/pip-install-fnwm_ln5/pprofile_138821cbfeaf40d98bf1716762b7216d/
    Complete output (1 lines):
    error in pprofile setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/35/d9/360f4483f735cbd4f1ac7316f3bdbee06b5872355963b913f1a53871ac72/pprofile-2.0.2.tar.gz#sha256=3469102f462f9fc2d889970afcf73d89c0d89a36c49a4c262c3edc302b4a22da (from https://pypi.org/simple/pprofile/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pprofile==2.0.2 (from versions: 1.0, 1.0.1, 1.1, 1.2, 1.2.1, 1.3, 1.4, 1.4.1, 1.5, 1.6, 1.6.1, 1.6.2, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.9, 1.9.1, 1.9.2, 1.10.0, 1.10.1, 1.11.0, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1.0)
ERROR: No matching distribution found for pprofile==2.0.2

I can install the latest version just fine. Can anyone assist with resolving this issue?


问:
Firebase authentication problem with Apple sign in
I'm using firebase authentication in a flutter app.

I've set up apple authentication and I'm building for both web and for ios.

In the apple developer console, I have an app id (com.crossology.ios) and an associated services id (com.crossology.auth)

In the firebase console, if I set authentication > apple > services id to "com.crossology.ios", authentication works in my flutter app.

If I set it to "com.crossology.auth", authentication works on my flutter web interface.

I don't see a way to configure apple authentication to work for both web and app at the same time.


问:
how to mock the react navigation inside the react native using jest testing framework
when i am trying to mock the react navigation container, inside they have sore that throw me the error.

I am expecting that the mock the navigation successfully using jest.


问:
Can we connect ADB via ethernet if the Android board does not have adb via USB?
I have a custom imx8mp board in which I can flash the Android. But I am not able to connect adb via USB. The ethernet is enabled and I can check ip address via debug UART.

Is there any way to connect to the board with ADB via Ethernet?


问:
Getting empty data field at backend when parsing formData using fetch
I am trying to send input fields' data to back end using fetch. I used formData.append to combine the data. when the fetch runs on backend I am getting empty list.

```<code>async function autosave()
{
    let formdata =new FormData();
    let blogImage = document.querySelector("#blog_image").files[0];
    let imageName = document.querySelector("#blog_image").files[0].name;
    let blogTitle = blog_title.value.trim();
    let contentType = document.querySelector("#content_type").checked;
    let blogId = document.querySelector("#id_val").value;
    let blogContent = editorbody.innerHTML;

    // console.log(document.querySelector("#blog_image").files[0])
    formdata.append("blog_image", blogImage, imageName)
    formdata.append("blog_title", blogTitle);
    formdata.append("content_type", contentType)
    formdata.append("blog_id", blogId);
    formdata.append("content",blogContent)
    await fetch("/blog/autosave/",{
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'mode':'no-cors'
        },
        method: "POST",
        body:JSON.stringify(formdata)
    }).then((res) => {return res.json()})
    .then((data) => {
        if (data.status == 200){
            // function savesuccessFun();
            console.log("Blog saved successfully");
        }
        else{
            // savefailFun();
             console.log("Opps blog can not be saved");
        }
    }).catch(err => console.log(err));
</code>```

I know only front end. at back end we are getting data using data = json.loads(request.body)

NOTE: I mage should not be send in base64 format.
All variables are taking data from form fields.

Body:
I am trying to send input fields' data to back end using fetch. I used formData.append to combine the data. when the fetch runs on backend I am getting empty list.

async function autosave()
{
    let formdata =new FormData();
    let blogImage = document.querySelector("#blog_image").files[0];
    let imageName = document.querySelector("#blog_image").files[0].name;
    let blogTitle = blog_title.value.trim();
    let contentType = document.querySelector("#content_type").checked;
    let blogId = document.querySelector("#id_val").value;
    let blogContent = editorbody.innerHTML;

    // console.log(document.querySelector("#blog_image").files[0])
    formdata.append("blog_image", blogImage, imageName)
    formdata.append("blog_title", blogTitle);
    formdata.append("content_type", contentType)
    formdata.append("blog_id", blogId);
    formdata.append("content",blogContent)
    await fetch("/blog/autosave/",{
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'mode':'no-cors'
        },
        method: "POST",
        body:JSON.stringify(formdata)
    }).then((res) => {return res.json()})
    .then((data) => {
        if (data.status == 200){
            // function savesuccessFun();
            console.log("Blog saved successfully");
        }
        else{
            // savefailFun();
             console.log("Opps blog can not be saved");
        }
    }).catch(err => console.log(err));

I know only front end. at back end we are getting data using data = json.loads(request.body)

NOTE: I mage should not be send in base64 format.
All variables are taking data from form fields.


问:
browser isn't downloading file sent by flask send_file
I'm trying to send a .csv file from flask to the front end using flask_send. In the front end, I'm calling a fetch to a route, which in turn triggers an async celery job to create the .csv file. So it returns an empty json to the fetch request so that the user doesn't have to wait for the task to be completed. The .csv file gets created, but when i try to send it back through another route call, it returns a successful http request with 200, but the file doesn't download.

Here's my front end triggering the route:

```<code>exportList(){
            fetch(`http://localhost:8080/getLists/${this.user_id}`)
            .then(r => r.json())
            .then(d => {
                console.log(d);
            })
        }
</code>```

Here's my flask route that gets called by the frontend:

```<code>@app.route("/getLists/<user_id>", methods=["GET"])
@login_required
def getLists(user_id):
    tasks.exportLists.delay(user_id)
    return {}, 200
</code>```

Here's my celery task function:

```<code>@celery.task()
def exportLists(user_id):
    #creates csv file
    requests.get("http://localhost:8080/getListsExport")
</code>```

And the final route that the celery task calls to send the file:

```<code>@app.route("/getListsExport")
def sendCsvListFile():
    return send_file("listExport.csv", as_attachment=True)
</code>```

The csv file gets saved in the root folder of the application itself.

Any idea where I'm going wrong?

Body:
I'm trying to send a .csv file from flask to the front end using flask_send. In the front end, I'm calling a fetch to a route, which in turn triggers an async celery job to create the .csv file. So it returns an empty json to the fetch request so that the user doesn't have to wait for the task to be completed. The .csv file gets created, but when i try to send it back through another route call, it returns a successful http request with 200, but the file doesn't download.

Here's my front end triggering the route:

exportList(){
            fetch(`http://localhost:8080/getLists/${this.user_id}`)
            .then(r => r.json())
            .then(d => {
                console.log(d);
            })
        }

Here's my flask route that gets called by the frontend:

@app.route("/getLists/<user_id>", methods=["GET"])
@login_required
def getLists(user_id):
    tasks.exportLists.delay(user_id)
    return {}, 200

Here's my celery task function:

@celery.task()
def exportLists(user_id):
    #creates csv file
    requests.get("http://localhost:8080/getListsExport")

And the final route that the celery task calls to send the file:

@app.route("/getListsExport")
def sendCsvListFile():
    return send_file("listExport.csv", as_attachment=True)

The csv file gets saved in the root folder of the application itself.

Any idea where I'm going wrong?


问:
java.lang.UnsupportedClassVersionError when deploying Spring Boot server on App Engine
I am getting an error when deploying a server that is using spring boot. The logic works locally, but I get a 500 error when I deploy to gCloud using App Engine. I am on MacOS.

Any ideas what is misconfigured here? Thank you!

The error looks like this:

```<code>Exception in thread "main" java.lang.UnsupportedClassVersionError: com/modernmail/ModernMailApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
</code>```

From searching around, it seems that the root cause is that I'm compiling with a version that isn't supported with app engine (if I understand correctly, 55.0 = java 11 and 61.0 = java 17). I do think app engine supports java 11 now from: https://cloud.google.com/appengine/docs/standard/java-gen2/runtime.

I'm trying to configure my app and environment to use java11 but something must be misconfigured somewhere?

In my appengine/app.yaml:

```<code>env: standard
service: server
runtime: java11
</code>```

In my pom.xml:

```<code><properties>
  <maven.compiler.target>11</maven.compiler.target>
  <maven.compiler.source>11</maven.compiler.source>
</properties>
</code>```

The output of my java version command is:

```<code>➜  ~ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment OpenLogic-OpenJDK (build 11.0.17+8-adhoc.admin.jdk11u)
OpenJDK 64-Bit Server VM OpenLogic-OpenJDK (build 11.0.17+8-adhoc.admin.jdk11u, mixed mode)
</code>```

And my JAVA_HOME matches:

```<code> ~ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/openlogic-openjdk-11.jre/Contents/Home
</code>```

I'm deploying the server using:

```<code>./mvnw -DskipTests package appengine:deploy
</code>```

I'm not exactly clear how to apply the solution from a question like this because java 11 doesn't have a separation between JDK and JRE anymore? My JDK is using java 11, but I'm not sure how check JRE for java11.

Body:
I am getting an error when deploying a server that is using spring boot. The logic works locally, but I get a 500 error when I deploy to gCloud using App Engine. I am on MacOS.

Any ideas what is misconfigured here? Thank you!

The error looks like this:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/modernmail/ModernMailApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

From searching around, it seems that the root cause is that I'm compiling with a version that isn't supported with app engine (if I understand correctly, 55.0 = java 11 and 61.0 = java 17). I do think app engine supports java 11 now from: https://cloud.google.com/appengine/docs/standard/java-gen2/runtime.

I'm trying to configure my app and environment to use java11 but something must be misconfigured somewhere?

In my appengine/app.yaml:

env: standard
service: server
runtime: java11

In my pom.xml:

<properties>
  <maven.compiler.target>11</maven.compiler.target>
  <maven.compiler.source>11</maven.compiler.source>
</properties>

The output of my java version command is:

➜  ~ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment OpenLogic-OpenJDK (build 11.0.17+8-adhoc.admin.jdk11u)
OpenJDK 64-Bit Server VM OpenLogic-OpenJDK (build 11.0.17+8-adhoc.admin.jdk11u, mixed mode)

And my JAVA_HOME matches:

 ~ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/openlogic-openjdk-11.jre/Contents/Home

I'm deploying the server using:

./mvnw -DskipTests package appengine:deploy

I'm not exactly clear how to apply the solution from a question like this because java 11 doesn't have a separation between JDK and JRE anymore? My JDK is using java 11, but I'm not sure how check JRE for java11.


问:
C++ Podofo PDF table generation
To create tables for PDF documents. I'm working with podofo C++. Would someone kindly give me an example of code to generate tables in PDF?

An example code which generates PDF using podofo c++ open source library , the pdf should include heading, tables and the table has at least 100 rows.

Title: C++ Podofo PDF table generation


问:
Possible to configure Swift RegexBuilder DSL Capture '.url' to work with a Markdown link?
Is it possible to configure the Swift RegexBuilder DSL Capture .url(…) to precisely capture the URL within standard Markdown link syntax? If yes, then how?

Minimal Pattern Attemp

let inputMD = "[Markdown link text](https://example.com)"

let regexMD = Regex {
    Capture { .url() }
}
let matchMD = inputMD.firstMatch(of: regexMD)
print("matchMD →", matchMD?.output ?? "nil")
// matchMD → ("https://example.com)", https://example.com))
```
<p>The Minimal Pattern Attempt fails since the result <code>https://example.com)</code> includes the trailing <code>)</code> of the Markdown link syntax.</p>
<p><strong>Closing Paren Pattern Attempt</strong></p>
<p>The Markdown closing paren <code>)</code> is added to the following Regex:</p>
<pre class="lang-swift prettyprint-override"><code>let regexMD_2 = Regex {
    Capture { .url() }
    ")" // :ADDED:
}
let matchMD_2 = inputMD.firstMatch(of: regexMD_2)
print("matchMD_2 →", matchMD_2?.output ?? "nil")
// matchMD_2 → nil
</code>```

let regexMD_3 = Regex {
    "(" // :ADDED:
    Capture { .url() }
    ")" // :ADDED:
}
let matchMD_3 = inputMD.firstMatch(of: regexMD_3)
print("matchMD_3 →", matchMD_3?.output ?? "nil")
// matchMD_3 → nil
```
<p>The Closing Paren Pattern Attempt fails by returning <code>nil</code>.</p>
<p><strong>Observation:</strong></p>
<p>Here is another markdown test case:</p>
<pre class="lang-markdown prettyprint-override"><code>[Bracket_(architecture) ⇗](https://en.wikipedia.org/wiki/Bracket_(architecture))
</code>```

The markdown link with multiple () pairs does preview and link OK via markdown-preview-enhanced. However, the StackOverflow syntax highlighter does is not quite accurate. And, the basic .url() "as-is" is not successful.

Note: I have other regex approaches which successfully capture the URL from a Markdown link. This question is specific to the use of .url() within the RegexBuilder Capture construct.

Body:
Is it possible to configure the Swift RegexBuilder DSL Capture .url(…) to precisely capture the URL within standard Markdown link syntax? If yes, then how?

Minimal Pattern Attemp

let inputMD = "[Markdown link text](https://example.com)"

let regexMD = Regex {
    Capture { .url() }
}
let matchMD = inputMD.firstMatch(of: regexMD)
print("matchMD →", matchMD?.output ?? "nil")
// matchMD → ("https://example.com)", https://example.com))

The Minimal Pattern Attempt fails since the result https://example.com) includes the trailing ) of the Markdown link syntax.

Closing Paren Pattern Attempt

The Markdown closing paren ) is added to the following Regex:

let regexMD_2 = Regex {
    Capture { .url() }
    ")" // :ADDED:
}
let matchMD_2 = inputMD.firstMatch(of: regexMD_2)
print("matchMD_2 →", matchMD_2?.output ?? "nil")
// matchMD_2 → nil

let regexMD_3 = Regex {
    "(" // :ADDED:
    Capture { .url() }
    ")" // :ADDED:
}
let matchMD_3 = inputMD.firstMatch(of: regexMD_3)
print("matchMD_3 →", matchMD_3?.output ?? "nil")
// matchMD_3 → nil

The Closing Paren Pattern Attempt fails by returning nil.

Observation:

Here is another markdown test case:

[Bracket_(architecture) ⇗](https://en.wikipedia.org/wiki/Bracket_(architecture))

The markdown link with multiple () pairs does preview and link OK via markdown-preview-enhanced. However, the StackOverflow syntax highlighter does is not quite accurate. And, the basic .url() "as-is" is not successful.

Note: I have other regex approaches which successfully capture the URL from a Markdown link. This question is specific to the use of .url() within the RegexBuilder Capture construct.


问:
Retrieve Data from Flask Server returning multipart data
Suppose you have a simple Flask server, as below:

```<code># Importing flask module in the project is mandatory
# An object of Flask class is our WSGI application.
from flask import Flask
import urllib3

# Flask constructor takes the name of
# current module (__name__) as argument.
app = Flask(__name__)

@app.route('/', methods = ['POST'])
def hello_world():
        fields = {
            "return_data" : open('test.zip', 'rb').read(),
            "type1" : 'job',
            "count" : 1,
            "done" : True,
        }

        res, headers = urllib3.encode_multipart_formdata(fields)
        response = Response(res, headers={"Content-Type" : headers})
        return response , 200

    return 'Hello World'

# main driver function
if __name__ == '__main__':
    # run() method of Flask class runs the application
    # on the local development server.
    app.run(host= '0.0.0.0', debug=False)
</code>```

The goal is to access this API from Node / Express.js, retrieve the multipart data by making a POST request, extracting the non-zip attributes (type1, count, done) into a dictionary, and keep a stream object of the zip.

I've tried using fetch() and .formData() to access / obtain the data

```<code>fetch('http://localhost:5000/', {
    method: 'post',
    body: {},
}).then (res => res.formData())
</code>```

But an error is thrown: Response.formData: Could not parse content as FormData.

How can I retrieve and parse the multipart data sent by the flask server using Node / Express?

Body:
Suppose you have a simple Flask server, as below:

# Importing flask module in the project is mandatory
# An object of Flask class is our WSGI application.
from flask import Flask
import urllib3

# Flask constructor takes the name of
# current module (__name__) as argument.
app = Flask(__name__)

@app.route('/', methods = ['POST'])
def hello_world():
        fields = {
            "return_data" : open('test.zip', 'rb').read(),
            "type1" : 'job',
            "count" : 1,
            "done" : True,
        }

        res, headers = urllib3.encode_multipart_formdata(fields)
        response = Response(res, headers={"Content-Type" : headers})
        return response , 200

    return 'Hello World'

# main driver function
if __name__ == '__main__':
    # run() method of Flask class runs the application
    # on the local development server.
    app.run(host= '0.0.0.0', debug=False)

The goal is to access this API from Node / Express.js, retrieve the multipart data by making a POST request, extracting the non-zip attributes (type1, count, done) into a dictionary, and keep a stream object of the zip.

I've tried using fetch() and .formData() to access / obtain the data

fetch('http://localhost:5000/', {
    method: 'post',
    body: {},
}).then (res => res.formData())

But an error is thrown: Response.formData: Could not parse content as FormData.

How can I retrieve and parse the multipart data sent by the flask server using Node / Express?


问:
Breakpoints inside the button click even is not getting hit while debugging apex code with VS Code
I am using VS code. Trying to render a button with a button click event. The code is as below

```<code><apex:page controller="OnAuthorizeController">
    <apex:form>
        <apex:commandButton value="Get token" action="{!getToken}" />
    </apex:form>
</apex:page>
</code>```
```<code>public with sharing class OnAuthorizeController {

    public void getToken(){
        string str = 'dummy code'; // break point here is never triggered
        string str2 ='dummy code2';
    }

}
</code>```

I am trying to debug the codes inside a button-click event. Generated Apex debug logs and tried to debug but the breakpoints are only getting hit in the page load event. Once the page is rendered, it is impossible to debug the code inside the button click event. Trying to debug as described in this 4 mins video https://www.youtube.com/watch?v=dNBsYLfI1nk

I tried all the possible googling to debug the apex code with VS code. I expect to debug the code inside a button click event in apex page

Body:
I am using VS code. Trying to render a button with a button click event. The code is as below

<apex:page controller="OnAuthorizeController">
    <apex:form>
        <apex:commandButton value="Get token" action="{!getToken}" />
    </apex:form>
</apex:page>

public with sharing class OnAuthorizeController {

    public void getToken(){
        string str = 'dummy code'; // break point here is never triggered
        string str2 ='dummy code2';
    }

}

I am trying to debug the codes inside a button-click event. Generated Apex debug logs and tried to debug but the breakpoints are only getting hit in the page load event. Once the page is rendered, it is impossible to debug the code inside the button click event. Trying to debug as described in this 4 mins video https://www.youtube.com/watch?v=dNBsYLfI1nk

I tried all the possible googling to debug the apex code with VS code. I expect to debug the code inside a button click event in apex page


问:
vcpkg installed catch2 not detected in cmake project
I am building unit test software for my library. I am using Catch2 Testing Framework Version 3.1.0

When I am trying to include the catch_all file in my aml_vector3_test.cpp but it is giving file not found error.

```<code>#include <catch2/catch_all.hpp> //Error in this line
#include "aml.h"
</code>```

I had referred the link for integration of vcpkg with my cmake prokect

I have tried both set (CMAKE_TOOLCHAIN_FILE "D:/vcpkg/scripts/buildsystems/vcpkg.cmake") and include ("D:/vcpkg/scripts/buildsystems/vcpkg.cmake") in both my global CMake file and  test project cmake file but it still didn't help. I tried all permutation and combination with this.

Kindly note I have zero exposure to cmake and have no idea what I am doing.

Project Structure

```<code>aml
 |--CMakeLists.txt (CMake File 1)
 |--CMakeSettings.json
 |--aml
 |   |--CMakeLists.txt (CMake File 2)
 |   |--aml.h
 |   |--aml_vector3.cpp
 |   |--aml_vector3.h
 |--example
 |   |--CMakeLists.txt (CMake File 3)
 |   |--main.cpp
 |--test
 |   |--CMakeLists.txt (CMake File 4)
 |   |--main.cpp
 |   |--aml_vector3_test.cpp
</code>```

CMake1 (Global CMake)

```<code># CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

set (CMAKE_C_STANDARD 17)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_TOOLCHAIN_FILE "D:/vcpkg/scripts/buildsystems/vcpkg.cmake")
project ("AttitudeMathLibrary")

# Include sub-projects.
add_subdirectory ("aml")
add_subdirectory ("test")
add_subdirectory ("example")

#enable_testing()
#add_test(test_all aml_vector3_test/aml_test)
</code>```

Cmake2 (Main Library CMake)

```<code># CMakeList.txt : CMake project for aml_vector3, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project(aml)
# Add source to this project's executable.
# add_executable (aml_vector3 "aml_vector3.cpp" "aml_vector3.h" "aml.h")
# target_sources ("aml_vector3.cpp" "aml_vector3.h" "aml.h")
set (SRC_CPP_AML "aml_vector3.cpp" "aml_vector3.h" "aml.h")
# TODO: Add tests and install targets if needed.

add_library (${PROJECT_NAME} STATIC ${SRC_CPP_AML})

target_include_directories (${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
</code>```

CMake3 (Example Project CMake)

```<code># CMakeList.txt : CMake project for aml_vector3, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project (aml_example)
# Add source to this project's executable.
add_executable (${PROJECT_NAME} "main.cpp")

# TODO: Add tests and install targets if needed.
target_link_libraries(${PROJECT_NAME} aml)

install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_BINARY_DIR}/bin)
</code>```

CMake 4 (Unit Test Camke)

```<code># CMakeList.txt : CMake project for aml_vector3, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
#set (CMAKE_TOOLCHAIN_FILE "D:/vcpkg/scripts/buildsystems/vcpkg.cmake")
include ("D:/vcpkg/scripts/buildsystems/vcpkg.cmake")
project (aml_test)

find_package(catch2 CONFIG REQUIRED)
# Add source to this project's executable.
add_executable (${PROJECT_NAME}  "main.cpp" "aml_vector3_test.cpp")
include_directories(${CATCH2_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} aml)
target_link_libraries(${PROJECT_NAME} catch2)
# TODO: Add tests and install targets if needed.
</code>```

CMakeSettings.json

```<code>{
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "CMAKE_BUILD_TYPE",
          "value": "Debug",
          "type": "STRING"
        },
        {
          "name": "CMAKE_INSTALL_PREFIX",
          "value": "C:/Users/darksorrow/source/repos/aml_vector3/out/install/x64-Debug",
          "type": "PATH"
        },
        {
          "name": "CMAKE_MAKE_PROGRAM",
          "value": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe",
          "type": "FILEPATH"
        },
        {
          "name": "CMAKE_TOOLCHAIN_FILE",
          "value": "D:/vcpkg/scripts/buildsystems/vcpkg.cmake"
        }
      ]
    }
  ]
}
</code>```
```<code>message ("CATCH2_INCLUDE_DIRS : ${CATCH2_INCLUDE_DIRS}")
</code>```

prints

[CMake] CATCH2_INCLUDE_DIRS : D:/vcpkg/installed/x64-windows/include
```
<p>Other Codes:</p>
<p>aml.h</p>
```#pragma once
// Helper file - Imports all Attitude Math Library Files in a single file.
// This is a convenience file for the user

#include "aml_vector3.h"
```
<p>aml_vector.h</p>
```#include <iostream>

namespace aml
{
    class Vector3
    {
    public:
        union
        {
            double data[3];
            struct
            {
                double x, y, z;
            };
        };
        //Constructors
        Vector3();
        Vector3(double value);
        Vector3(double x, double y, double z);
        Vector3(double data[3]);

        //Operator Assignment (Vector)
        Vector3& operator+=(const Vector3& rhs);
        Vector3& operator-=(const Vector3& rhs);
        Vector3& operator*=(const Vector3& rhs);
        Vector3& operator/=(const Vector3& rhs);

        //Operator Assignment (Scalar)
        Vector3& operator+=(double s);
        Vector3& operator-=(double s);
        Vector3& operator*=(double s);
        Vector3& operator/=(double s);

    };
}
```
<p>aml_vector.cpp</p>
```aml
 |--CMakeLists.txt (CMake File 1)
 |--CMakeSettings.json
 |--aml
 |   |--CMakeLists.txt (CMake File 2)
 |   |--aml.h
 |   |--aml_vector3.cpp
 |   |--aml_vector3.h
 |--example
 |   |--CMakeLists.txt (CMake File 3)
 |   |--main.cpp
 |--test
 |   |--CMakeLists.txt (CMake File 4)
 |   |--main.cpp
 |   |--aml_vector3_test.cpp
```0
<p>example - main.cpp</p>
```aml
 |--CMakeLists.txt (CMake File 1)
 |--CMakeSettings.json
 |--aml
 |   |--CMakeLists.txt (CMake File 2)
 |   |--aml.h
 |   |--aml_vector3.cpp
 |   |--aml_vector3.h
 |--example
 |   |--CMakeLists.txt (CMake File 3)
 |   |--main.cpp
 |--test
 |   |--CMakeLists.txt (CMake File 4)
 |   |--main.cpp
 |   |--aml_vector3_test.cpp
```1
<p>test - main.cpp</p>
```aml
 |--CMakeLists.txt (CMake File 1)
 |--CMakeSettings.json
 |--aml
 |   |--CMakeLists.txt (CMake File 2)
 |   |--aml.h
 |   |--aml_vector3.cpp
 |   |--aml_vector3.h
 |--example
 |   |--CMakeLists.txt (CMake File 3)
 |   |--main.cpp
 |--test
 |   |--CMakeLists.txt (CMake File 4)
 |   |--main.cpp
 |   |--aml_vector3_test.cpp
```2
<p>aml_vector3_test.cpp</p>
```#include <catch2/catch_all.hpp>
#include "aml.h"
```

Final Update (Solution)

I solved the problem by reinstalling vcpkg package manager and cmake tool.

Body:
I am building unit test software for my library. I am using Catch2 Testing Framework Version 3.1.0

When I am trying to include the catch_all file in my aml_vector3_test.cpp but it is giving file not found error.

#include <catch2/catch_all.hpp> //Error in this line
#include "aml.h"

I had referred the link for integration of vcpkg with my cmake prokect

I have tried both set (CMAKE_TOOLCHAIN_FILE "D:/vcpkg/scripts/buildsystems/vcpkg.cmake") and include ("D:/vcpkg/scripts/buildsystems/vcpkg.cmake") in both my global CMake file and  test project cmake file but it still didn't help. I tried all permutation and combination with this.

Kindly note I have zero exposure to cmake and have no idea what I am doing.

Project Structure

aml
 |--CMakeLists.txt (CMake File 1)
 |--CMakeSettings.json
 |--aml
 |   |--CMakeLists.txt (CMake File 2)
 |   |--aml.h
 |   |--aml_vector3.cpp
 |   |--aml_vector3.h
 |--example
 |   |--CMakeLists.txt (CMake File 3)
 |   |--main.cpp
 |--test
 |   |--CMakeLists.txt (CMake File 4)
 |   |--main.cpp
 |   |--aml_vector3_test.cpp

CMake1 (Global CMake)

# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

set (CMAKE_C_STANDARD 17)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_TOOLCHAIN_FILE "D:/vcpkg/scripts/buildsystems/vcpkg.cmake")
project ("AttitudeMathLibrary")

# Include sub-projects.
add_subdirectory ("aml")
add_subdirectory ("test")
add_subdirectory ("example")

#enable_testing()
#add_test(test_all aml_vector3_test/aml_test)

Cmake2 (Main Library CMake)

# CMakeList.txt : CMake project for aml_vector3, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project(aml)
# Add source to this project's executable.
# add_executable (aml_vector3 "aml_vector3.cpp" "aml_vector3.h" "aml.h")
# target_sources ("aml_vector3.cpp" "aml_vector3.h" "aml.h")
set (SRC_CPP_AML "aml_vector3.cpp" "aml_vector3.h" "aml.h")
# TODO: Add tests and install targets if needed.

add_library (${PROJECT_NAME} STATIC ${SRC_CPP_AML})

target_include_directories (${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})

CMake3 (Example Project CMake)

# CMakeList.txt : CMake project for aml_vector3, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project (aml_example)
# Add source to this project's executable.
add_executable (${PROJECT_NAME} "main.cpp")

# TODO: Add tests and install targets if needed.
target_link_libraries(${PROJECT_NAME} aml)

install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_BINARY_DIR}/bin)

CMake 4 (Unit Test Camke)

# CMakeList.txt : CMake project for aml_vector3, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
#set (CMAKE_TOOLCHAIN_FILE "D:/vcpkg/scripts/buildsystems/vcpkg.cmake")
include ("D:/vcpkg/scripts/buildsystems/vcpkg.cmake")
project (aml_test)

find_package(catch2 CONFIG REQUIRED)
# Add source to this project's executable.
add_executable (${PROJECT_NAME}  "main.cpp" "aml_vector3_test.cpp")
include_directories(${CATCH2_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} aml)
target_link_libraries(${PROJECT_NAME} catch2)
# TODO: Add tests and install targets if needed.

CMakeSettings.json

{
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "CMAKE_BUILD_TYPE",
          "value": "Debug",
          "type": "STRING"
        },
        {
          "name": "CMAKE_INSTALL_PREFIX",
          "value": "C:/Users/darksorrow/source/repos/aml_vector3/out/install/x64-Debug",
          "type": "PATH"
        },
        {
          "name": "CMAKE_MAKE_PROGRAM",
          "value": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe",
          "type": "FILEPATH"
        },
        {
          "name": "CMAKE_TOOLCHAIN_FILE",
          "value": "D:/vcpkg/scripts/buildsystems/vcpkg.cmake"
        }
      ]
    }
  ]
}

message ("CATCH2_INCLUDE_DIRS : ${CATCH2_INCLUDE_DIRS}")

prints

[CMake] CATCH2_INCLUDE_DIRS : D:/vcpkg/installed/x64-windows/include

Other Codes:

aml.h

#pragma once
// Helper file - Imports all Attitude Math Library Files in a single file.
// This is a convenience file for the user

#include "aml_vector3.h"

aml_vector.h

#include <iostream>

namespace aml
{
    class Vector3
    {
    public:
        union
        {
            double data[3];
            struct
            {
                double x, y, z;
            };
        };
        //Constructors
        Vector3();
        Vector3(double value);
        Vector3(double x, double y, double z);
        Vector3(double data[3]);

        //Operator Assignment (Vector)
        Vector3& operator+=(const Vector3& rhs);
        Vector3& operator-=(const Vector3& rhs);
        Vector3& operator*=(const Vector3& rhs);
        Vector3& operator/=(const Vector3& rhs);

        //Operator Assignment (Scalar)
        Vector3& operator+=(double s);
        Vector3& operator-=(double s);
        Vector3& operator*=(double s);
        Vector3& operator/=(double s);

    };
}

aml_vector.cpp

#include <cmath>
#include "aml_vector3.h"

namespace aml
{
    Vector3::Vector3() : x(0.0), y(0.0), z(0.0)
    {
    }

    Vector3::Vector3(double value) : x(value), y(value), z(value)
    {
    }

    Vector3::Vector3(double x, double y, double z) : x(x), y(y), z(z)
    {
    }

    Vector3::Vector3(double data[3]) : x(data[0]), y(data[1]), z(data[2])
    {
    }

    Vector3& Vector3::operator+=(const Vector3& rhs)
    {
        this->x += rhs.x;
        this->y += rhs.y;
        this->z += rhs.z;
        return *this;
    }

    Vector3& Vector3::operator-=(const Vector3& rhs)
    {
        this->x -= rhs.x;
        this->y -= rhs.y;
        this->z -= rhs.z;
        return *this;
    }

    Vector3& Vector3::operator*=(const Vector3& rhs)
    {
        this->x *= rhs.x;
        this->y *= rhs.y;
        this->z *= rhs.z;
        return *this;
    }

    Vector3& Vector3::operator/=(const Vector3& rhs)
    {
        this->x /= rhs.x;
        this->y /= rhs.y;
        this->z /= rhs.z;
        return *this;
    }

    Vector3& Vector3::operator+=(double s)
    {
        this->x += s;
        this->y += s;
        this->z += s;
        return *this;
    }

    Vector3& Vector3::operator-=(double s)
    {
        this->x -= s;
        this->y -= s;
        this->z -= s;
        return *this;
    }

    Vector3& Vector3::operator*=(double s)
    {
        this->x *= s;
        this->y *= s;
        this->z *= s;
        return *this;
    }

    Vector3& Vector3::operator/=(double s)
    {
        this->x /= s;
        this->y /= s;
        this->z /= s;
        return *this;
    }
}

example - main.cpp

#include "aml.h"

int main(int argc, char** argv)
{
    aml::Vector3 v1(1.0, 2.0, 3.0);
    aml::Vector3 v2(4.0, 5.0, 6.0);

    aml::Vector3 v3 = v1 + v2;

    aml::Vector3 v4 = v1 * v2;

    std::cout << "v1 : " << v1 << std::endl;
    std::cout << "v2 : " << v2 << std::endl;
    std::cout << "v3 : " << v3 << std::endl;
    std::cout << "v4 : " << v4 << std::endl;
}

test - main.cpp

//File is empty

aml_vector3_test.cpp

#include <catch2/catch_all.hpp>
#include "aml.h"

Final Update (Solution)

I solved the problem by reinstalling vcpkg package manager and cmake tool.


问:
Connection reset by peer while reading response header from upstream (NGINX)
Im trying to run the local project (php phalcon) using nginx on macOS but it seems nginx can't load the project correctly.

Here is my nginx log given :

```<code>2023/01/12 11:38:04 [error] 6170#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: bahana.front, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9074", host: "127.0.0.1:7002"
2023/01/12 11:38:05 [error] 6170#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: bahana.front, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9074", host: "127.0.0.1:7002", referrer: "http://127.0.0.1:7002/"
</code>```

and here is my site nginx config : (for loading the php phalcon project)

```<code>server {
   listen 7002;

   root /Applications/XAMPP/xamppfiles/htdocs/bahana-front/bahana/public;
   index index.php;

   server_name  bahana.front;

   location / {
      try_files $uri $uri/ /index.php;
   }

   location ~ \.php$ {
      try_files $uri =404;
      fastcgi_pass 127.0.0.1:9074;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
   }
 }
</code>```

also the php-fpm work well in the background (port 9074) :

So, what did i miss for the configuration, im little stuck and keep getting closed connection at nginx log and HTTP Error 502 (Bad Gateway) when accessing the site at http://127.0.0.1:7002, Gonna need your help, thanks.

Body:
Im trying to run the local project (php phalcon) using nginx on macOS but it seems nginx can't load the project correctly.

Here is my nginx log given :

2023/01/12 11:38:04 [error] 6170#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: bahana.front, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9074", host: "127.0.0.1:7002"
2023/01/12 11:38:05 [error] 6170#0: *1 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: bahana.front, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9074", host: "127.0.0.1:7002", referrer: "http://127.0.0.1:7002/"

and here is my site nginx config : (for loading the php phalcon project)

server {
   listen 7002;

   root /Applications/XAMPP/xamppfiles/htdocs/bahana-front/bahana/public;
   index index.php;

   server_name  bahana.front;

   location / {
      try_files $uri $uri/ /index.php;
   }

   location ~ \.php$ {
      try_files $uri =404;
      fastcgi_pass 127.0.0.1:9074;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
   }
 }

also the php-fpm work well in the background (port 9074) :

So, what did i miss for the configuration, im little stuck and keep getting closed connection at nginx log and HTTP Error 502 (Bad Gateway) when accessing the site at http://127.0.0.1:7002, Gonna need your help, thanks.


问:
How to use Streams instead of do while loop?
How to avoid imperative loops and use the Java's Streaming API for the below mentioned implementation for the google directory API?</p>
```<code>List<GroupMember> groupMemberList = new ArrayList<>();
Directory.Members.List listRequest = getDirectoryApi().members().list(groupEmailAddress);
Members members;
do {
    members = listRequest.execute();
    members.getMembers().forEach(member -> groupMemberList.add(new
        GroupMember(member.getId(), member.getEmail())));
} while (null != members.getNextPageToken());
return groupMemberList;
</code>```

Body:
How to avoid imperative loops and use the Java's Streaming API for the below mentioned implementation for the google directory API?

List<GroupMember> groupMemberList = new ArrayList<>();
Directory.Members.List listRequest = getDirectoryApi().members().list(groupEmailAddress);
Members members;
do {
    members = listRequest.execute();
    members.getMembers().forEach(member -> groupMemberList.add(new
        GroupMember(member.getId(), member.getEmail())));
} while (null != members.getNextPageToken());
return groupMemberList;


问:
How to connect Django web socket with the third-Party Web Sockets?
I want to connect my Django WebSocket with a third-party web socket. This program is one I wrote, and it functions properly. To avoid having to re-login with the third-party API, I have now added the code to check whether the same room is present in my database. if we use the same API KEY to re-connect to the third-party API. It gives the following error:

{"event":"login","status":401,"message":"Connected from another location"}

I want to see if the same cryptocurrency coin is already connected or not. We don't want to logon with the same API KEY once we're connected. I have two issues here:

Don't send the login request to that web socket again.

Don't send the subscribe request, if the same coin already exists. Let's say BTCUSD already connected and giving me the data. I want to just connect to the next user to same room and get the data on next request.

```<code>import websocket
import time
import ssl
from channels.generic.websocket import AsyncWebsocketConsumer
from .models import Room

login = {
    "event": "login",
    "data": {
        "apiKey": "API_KEY",
    },
}

class CryptoConsumer(AsyncWebsocketConsumer):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE})
        self.ws.connect("wss://crypto.financialmodelingprep.com")

    async def connect(self):
        self.room_name = self.scope["url_route"]["kwargs"]["room_name"]
        self.room_group_name = "crypto_%s" % self.room_name

        # ****** Code Block ******
        subscribe = {
            "event": "subscribe",
            "data": {
                "ticker": self.room_name,
            },
        }
        room = await Room.add(self.room_name)  # Method in models.py to add the user and return True
        if room is False:
            self.ws.send(json.dumps(login))
            print("The group with the name %s doesn't exist" % self.room_group_name)
            time.sleep(1)
            self.ws.send(json.dumps(subscribe))

        # ****** End Code Block ******

        # Join room group
        await self.channel_layer.group_add(self.room_group_name, self.channel_name)

        await self.accept()

    async def disconnect(self, close_code):
        unsubscribe = {
            "event": "unsubscribe",
            "data": {
                "ticker": self.room_name,
            },
        }
        self.ws.send(json.dumps(unsubscribe))
        self.ws.close()
        # Leave room group
        await self.channel_layer.group_discard(self.room_group_name, self.channel_name)

    # Receive message from WebSocket
    async def receive(self, text_data="{'text': 'Dummy Text'}"):
        text_data_json = json.loads(text_data)
        message = text_data_json["message"]
        message = str(self.ws.recv())
        # Send message to room group
        await self.channel_layer.group_send(
            self.room_group_name, {"type": "chat_message", "message": message}
        )

    # Receive message from room group
    async def chat_message(self, event):
        message = event["message"]

        # Send message to WebSocket
        await self.send(text_data=json.dumps({"message": message}))
</code>```

Note: Why I want to do this entire step because we don't want the API KEY made public.
So, the code coming from the front end will connect to our Django web socket, and then we'll connect to the third-party web socket and return the data that was sent by them.

Body:
I want to connect my Django WebSocket with a third-party web socket. This program is one I wrote, and it functions properly. To avoid having to re-login with the third-party API, I have now added the code to check whether the same room is present in my database. if we use the same API KEY to re-connect to the third-party API. It gives the following error:

{"event":"login","status":401,"message":"Connected from another location"}

I want to see if the same cryptocurrency coin is already connected or not. We don't want to logon with the same API KEY once we're connected. I have two issues here:

Don't send the login request to that web socket again.

Don't send the subscribe request, if the same coin already exists. Let's say BTCUSD already connected and giving me the data. I want to just connect to the next user to same room and get the data on next request.

import websocket
import time
import ssl
from channels.generic.websocket import AsyncWebsocketConsumer
from .models import Room

login = {
    "event": "login",
    "data": {
        "apiKey": "API_KEY",
    },
}

class CryptoConsumer(AsyncWebsocketConsumer):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE})
        self.ws.connect("wss://crypto.financialmodelingprep.com")

    async def connect(self):
        self.room_name = self.scope["url_route"]["kwargs"]["room_name"]
        self.room_group_name = "crypto_%s" % self.room_name

        # ****** Code Block ******
        subscribe = {
            "event": "subscribe",
            "data": {
                "ticker": self.room_name,
            },
        }
        room = await Room.add(self.room_name)  # Method in models.py to add the user and return True
        if room is False:
            self.ws.send(json.dumps(login))
            print("The group with the name %s doesn't exist" % self.room_group_name)
            time.sleep(1)
            self.ws.send(json.dumps(subscribe))

        # ****** End Code Block ******

        # Join room group
        await self.channel_layer.group_add(self.room_group_name, self.channel_name)

        await self.accept()

    async def disconnect(self, close_code):
        unsubscribe = {
            "event": "unsubscribe",
            "data": {
                "ticker": self.room_name,
            },
        }
        self.ws.send(json.dumps(unsubscribe))
        self.ws.close()
        # Leave room group
        await self.channel_layer.group_discard(self.room_group_name, self.channel_name)

    # Receive message from WebSocket
    async def receive(self, text_data="{'text': 'Dummy Text'}"):
        text_data_json = json.loads(text_data)
        message = text_data_json["message"]
        message = str(self.ws.recv())
        # Send message to room group
        await self.channel_layer.group_send(
            self.room_group_name, {"type": "chat_message", "message": message}
        )

    # Receive message from room group
    async def chat_message(self, event):
        message = event["message"]

        # Send message to WebSocket
        await self.send(text_data=json.dumps({"message": message}))

Note: Why I want to do this entire step because we don't want the API KEY made public.
So, the code coming from the front end will connect to our Django web socket, and then we'll connect to the third-party web socket and return the data that was sent by them.


问:
Can open react-bootstrap modal but closing
I am trying to let modal screen to disappear when I click close or save & close button. But I cannot find which line prevent close feature to work.

What could be wrong? I really want to let modal to disappear when I click button inside of it.

note: I use latest react-bootstrap (bootstrap 5)

```<code>function MemberMgt() {
    const [showModal, setShowModal] = useState(false);

    const handleCloseClick = () => {
        setShowModal(false);
    };
    const handleEditClick = () => {
        setShowModal(true);
    };
</code>```
```<code>...
<tr onClick={handleEditClick}>
                        <Modal show={showModal} onHide={handleCloseClick}>
                            <Modal.Header closeButton>
                                <Modal.Title>Edit Screen</Modal.Title>
                            </Modal.Header>
                            <Modal.Body>
                                <li>ID</li>
                            </Modal.Body>
                            <Modal.Footer>
                                <Button variant="secondary" onClick={handleCloseClick}>
                                    Close
                                </Button>
                                <Button variant="primary" onClick={handleCloseClick}>
                                    Save & Close
                                </Button>
                            </Modal.Footer>
                        </Modal>
...
</code>```

Body:
I am trying to let modal screen to disappear when I click close or save & close button. But I cannot find which line prevent close feature to work.

What could be wrong? I really want to let modal to disappear when I click button inside of it.

note: I use latest react-bootstrap (bootstrap 5)

function MemberMgt() {
    const [showModal, setShowModal] = useState(false);

    const handleCloseClick = () => {
        setShowModal(false);
    };
    const handleEditClick = () => {
        setShowModal(true);
    };

...

                        <Modal show={showModal} onHide={handleCloseClick}>
                            <Modal.Header closeButton>
                                <Modal.Title>Edit Screen</Modal.Title>
                            </Modal.Header>
                            <Modal.Body>

ID

                            </Modal.Body>
                            <Modal.Footer>
                                <Button variant="secondary" onClick={handleCloseClick}>
                                    Close
                                </Button>
                                <Button variant="primary" onClick={handleCloseClick}>
                                    Save & Close
                                </Button>
                            </Modal.Footer>
                        </Modal>
...


问:
Purchased new flex tokens, but Forge still reports "Developer Status is not Active."
My previous tokens expired on their one year anniversary.   I was notified, and I purchased 100 more.

These new tokens are showing up in my account page when I log into

```<code>https://manage.autodesk.com/billing/subscriptions/?product=FLEXACCESS
</code>```

Yet, when I try to connect to the Forge Oauth server programmatically:

```<code>curl -s $FORGE_URL/authentication/v1/authenticate \
    -d client_id=$CLIENT_ID \
    -d client_secret=$CLIENT_SECRET \
    -d grant_type=client_credentials \
    -d scope=data:read+data:write
</code>```

Forge is still not allowing me to run models and is reporting to me:

```<code>{"fault":{"faultstring":"Developer Status is not Active","detail":{"errorcode":"keymanagement.service.DeveloperStatusNotActive"}}}
</code>```

Is there a new client_id, client_secret or some kind of additional application I need to change to begin using my new credits?

Body:
My previous tokens expired on their one year anniversary.   I was notified, and I purchased 100 more.

These new tokens are showing up in my account page when I log into

https://manage.autodesk.com/billing/subscriptions/?product=FLEXACCESS

Yet, when I try to connect to the Forge Oauth server programmatically:

curl -s $FORGE_URL/authentication/v1/authenticate \
    -d client_id=$CLIENT_ID \
    -d client_secret=$CLIENT_SECRET \
    -d grant_type=client_credentials \
    -d scope=data:read+data:write

Forge is still not allowing me to run models and is reporting to me:

{"fault":{"faultstring":"Developer Status is not Active","detail":{"errorcode":"keymanagement.service.DeveloperStatusNotActive"}}}

Is there a new client_id, client_secret or some kind of additional application I need to change to begin using my new credits?


问:
can not active click event after animation of the view
this is the structure of my view

```
linearlayout  orientate = horizontal
    listview1
    listview2
    listview3
```

and I set listview1.start(animation)
but, after animation the click event can not work.but it will effect on its origin position.
I also ```animation.setFillAfter(true)  animation.setFillEnable(true).```
And, what's more I use the delegate to move the effective position. but failed.

```<code>for(int i = 0; i<mViews.size();i++){
        mViews.get(i).startAnimation(moveLeftAnimation);
        Rect rect = new Rect();
        mViews.get(i).getHitRect(rect);
        rect.left -= 413;
        rect.right -= 413;
        Log.e("filebrowser view move left", "rect left =  "+rect.left +" right = "+rect.right);
        setTouchDelegate(new TouchDelegate(rect, mViews.get(i)));
    }
</code>```

mViews is a arraylist, which stores listview1 listview2 listview3.Can anyone help me.thanks for any help.

Body:
this is the structure of my view

linearlayout  orientate = horizontal
    listview1
    listview2
    listview3

and I set listview1.start(animation)
but, after animation the click event can not work.but it will effect on its origin position.
I also
animation.setFillAfter(true)  animation.setFillEnable(true).

And, what's more I use the delegate to move the effective position. but failed.

for(int i = 0; i<mViews.size();i++){
        mViews.get(i).startAnimation(moveLeftAnimation);
        Rect rect = new Rect();
        mViews.get(i).getHitRect(rect);
        rect.left -= 413;
        rect.right -= 413;
        Log.e("filebrowser view move left", "rect left =  "+rect.left +" right = "+rect.right);
        setTouchDelegate(new TouchDelegate(rect, mViews.get(i)));
    }

mViews is a arraylist, which stores listview1 listview2 listview3.Can anyone help me.thanks for any help.