问:
Argo Workflow use podSpecPatch to dynamically increase memory resource request in retries
I'm looking for a way to dynamically increase memory resource requests in Argo Workflow retries, based on what is described here.
However, in my case, the original memory request parameters need to be taken from input parameters.
I have input parameters memreqnum (e.g. 250) and memrequnit  (e.g. Mi), and I'm trying to define a podSpecPatch
that will enable me to specify the memory request as a multiple of memreqnum (based on retries) with the original
memrequnit.
I have made all kinds of attempts, such as the following, but none seem to work:

```<code>podSpecPatch: |
  containers:
    - name: main
      resources:
        requests:
          memory: "{{={{=(asInt{{retries}} + 1)}} * {{inputs.parameters.memreqnum}}}}{{inputs.parameters.memrequnit}}"

</code>```

The above podSpecPatch gives me the following error:

```<code>invalid podSpecPatch "{\"containers\":[{\"name\":\"main\",\"resources\":{\"requests\":{\"memory\":\"{{={{=(asInt{{retries}} + 1)}} * 250}}Mi\"}}}]}": quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'
</code>```

Can someone please point me in the right direction?
Many thanks!

Body:
I'm looking for a way to dynamically increase memory resource requests in Argo Workflow retries, based on what is described here.
However, in my case, the original memory request parameters need to be taken from input parameters.
I have input parameters memreqnum (e.g. 250) and memrequnit  (e.g. Mi), and I'm trying to define a podSpecPatch
that will enable me to specify the memory request as a multiple of memreqnum (based on retries) with the original
memrequnit.
I have made all kinds of attempts, such as the following, but none seem to work:

podSpecPatch: |
  containers:
    - name: main
      resources:
        requests:
          memory: "{{={{=(asInt{{retries}} + 1)}} * {{inputs.parameters.memreqnum}}}}{{inputs.parameters.memrequnit}}"

The above podSpecPatch gives me the following error:

invalid podSpecPatch "{\"containers\":[{\"name\":\"main\",\"resources\":{\"requests\":{\"memory\":\"{{={{=(asInt{{retries}} + 1)}} * 250}}Mi\"}}}]}": quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'

Can someone please point me in the right direction?
Many thanks!


来源: stackexchange

问:
Elasticsearch No old data in developer tool, but data are present in discover
When I use the elastic api, via curl or the developer tool. I cannot got data from some old indice.

But if I use the discover feature of Kibana, it can get those data.

Moreover, if I go from discover, got some datas, the with the inspect option I click on "Open in dev tools", the the copied request don't work.

Have you any idea?

I also try to get /_cout api, it says count:0.  But with /_stats I have some counts

it works
not working

ContentLicense: CC BY-SA 4.0


问:
How to test a page that requires going through other page with Selenium
I am new to selenium. It's all setup but I am unable to test some pages.

For example, if I want to test my gmail page where I see all my emails I'd have to go through gmail.com then login and only after that could I test it.

How can I make sure the tests only run after having all the information needed to access the page?

For example I want to test https://mail.google.com/mail/#inbox

await driver.get("https://mail.google.com/mail/#inbox");

but I need to go through gmail.com first.


问:
Impact of different storage locations on global template functionality in Word
have a bit of a debate regarding where to store global .dotm templates used by the workgroup.

My assumption was always that global .dotm templates (shared or not) should be in the (Office) Startup folder. However I've recently been told that other users in the workgroup have been storing theirs in the Templates folder instead.

Both folders are in a (Group Policy-defined) folder in Program Files, and the Locations setting in Word reflects this.

Does the different storage location impact template loading/usage in Word? E.g. if a document is first authored by me (using the template in the Startup folder), and is then edited by someone with the same template (but in the Templates folder), would that cause issues?


问:
How can the "you cannot use the "renderView" method if the Twig bundle is not available" error in symfony 6 be debugged?
I just recently upgraded my project from symfony 4 to 6, without much problems. The current online version is using symfony6 without problem.

I am now trying to clean the code, removing some useless parts and other little modifications, and I just met a strange problem. All my pages are now giving me the error:

You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".

Problem is: the package is present, so the recommended command does nothing.

I tried to check the code triggering the exception:

```<code>   protected function renderView(string $view, array $parameters = []): string
    {
        if (!$this->container->has('twig')) {
            throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
        }

    ...
    }
</code>```

So I checked the twig service with bin/console debug:container twig, which gives me the same output as with the current working version.

There is a note:

"! [NOTE] The "twig" service or alias has been removed or inlined when the container was compiled."

But this note is also present in my production code without problem.

I brought no real modification to the controller files between the two versions, the main difference being files moved and namespaces adapted to this change.

I don't have any ideas other than doing all these changes all over again, but I fear I'll fall on the same result.

Edit:

The problem look larger that I thought, as I get the same problem with the security bundle.

I tried to inject \Twig\Environment in the controller method, and it autowired with no problems.

I tried to update all the recipes with composer recipes, with no interesting result.

I tried to compare it to a newly created Symfony6 controller with twig, but found no significant differences, except the use of php attributes, which I tried to use in my project, with no result either.

Result of bin/console debug:container HomeController:

```<code>Option             Value
----------------- -------------------------------
Service ID         App\Controller\HomeController
Class              App\Controller\HomeController
Tags               controller.service_arguments
                   container.service_subscriber
Calls              setContainer
Public             yes
Synthetic          no
Lazy               no
Shared             yes
Abstract           no
Autowired          yes
Autoconfigured     yes
Usages             none
</code>```

Edit:

To be honest, if twig is now a private service, not accessible through the container, why is the AbstractController still using this line:

```<code>        if (!$this->container->has('twig')) {
            throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
        }
</code>```

Wouldn't that just cause an error for everyone ? Then why not, and only now for me while it doesn't for my current version (my production is operational with the same Symfony 6 packages)

Edit:

By playing in the vendors, I managed to find that in my original code, the ServiceLocator is used in the AbstractController, but in my bugged one, it seems to be a cached Container class that is used (as $this->container).

So the has() method called in not the same...

Body:
I just recently upgraded my project from symfony 4 to 6, without much problems. The current online version is using symfony6 without problem.

I am now trying to clean the code, removing some useless parts and other little modifications, and I just met a strange problem. All my pages are now giving me the error:

You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".

Problem is: the package is present, so the recommended command does nothing.

I tried to check the code triggering the exception:

   protected function renderView(string $view, array $parameters = []): string
    {
        if (!$this->container->has('twig')) {
            throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
        }

    ...
    }

So I checked the twig service with bin/console debug:container twig, which gives me the same output as with the current working version.

There is a note:

"! [NOTE] The "twig" service or alias has been removed or inlined when the container was compiled."

But this note is also present in my production code without problem.

I brought no real modification to the controller files between the two versions, the main difference being files moved and namespaces adapted to this change.

I don't have any ideas other than doing all these changes all over again, but I fear I'll fall on the same result.

Edit:

The problem look larger that I thought, as I get the same problem with the security bundle.

I tried to inject \Twig\Environment in the controller method, and it autowired with no problems.

I tried to update all the recipes with composer recipes, with no interesting result.

I tried to compare it to a newly created Symfony6 controller with twig, but found no significant differences, except the use of php attributes, which I tried to use in my project, with no result either.

Result of bin/console debug:container HomeController:

Option             Value
----------------- -------------------------------
Service ID         App\Controller\HomeController
Class              App\Controller\HomeController
Tags               controller.service_arguments
                   container.service_subscriber
Calls              setContainer
Public             yes
Synthetic          no
Lazy               no
Shared             yes
Abstract           no
Autowired          yes
Autoconfigured     yes
Usages             none

Edit:

To be honest, if twig is now a private service, not accessible through the container, why is the AbstractController still using this line:

        if (!$this->container->has('twig')) {
            throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
        }

Wouldn't that just cause an error for everyone ? Then why not, and only now for me while it doesn't for my current version (my production is operational with the same Symfony 6 packages)

Edit:

By playing in the vendors, I managed to find that in my original code, the ServiceLocator is used in the AbstractController, but in my bugged one, it seems to be a cached Container class that is used (as $this->container).

So the has() method called in not the same...


问:
Pass a parameters to stateful class
How can I pass a parameters to a stateful class in flutter?

I couldn't pass a parameter in the class as I'm a beginner and don't know the method.

I want to pass data from a list to build the class x times, and display the data in a container.

The text I want to pass is labeled tH.

I hope if someone can pass the argument for me.

My class:

```<code>

class Thkr extends StatefulWidget {

  @override
  State<StatefulWidget> createState() {
    return _ThkrState();
  }
}

class _ThkrState extends State<Thkr> {
  int Thkr_count = 3;

  void _incrementCounter() {
    setState(() {
      Thkr_count--;
    });
  }

  @override
  Widget build(BuildContext) {
    return (Column(children: [
      Container(
        padding: EdgeInsets.all(35),
        margin: EdgeInsets.all(20),
        decoration: BoxDecoration(
          border: Border.all(color: Colors.black, width: 3),
          borderRadius: BorderRadius.circular(8),
          boxShadow: [
            BoxShadow(
              color: Colors.lightGreen,
              offset: Offset(6.0, 6.0),
            ),
          ],
        ),
        child: Text({here I want to pass the data},
            style: TextStyle(fontSize: textSize, color: themeli[themei])),
      ),
      Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          Card(
            child: SizedBox(
              width: 100,
              height: 30,
              child: Center(
                  child: ElevatedButton(
                    style: ElevatedButton.styleFrom(
                      backgroundColor: Colors.lightGreen,
                      minimumSize: Size.fromHeight(40), //
                    ),
                    onPressed: () {
                      _incrementCounter();
                    },
                    child: Text(
                      'Count',
                      style: TextStyle(color: themeli[themei]),
                    ),
                  )),
            ),
          ),
          Card(
            child: SizedBox(
              width: 100,
              height: 30,
              child: Center(
                  child: Text("$Thkr_count left",
                      style: TextStyle(
                        backgroundColor: Colors.white12,
                      ))),
            ),
          ),
        ],
      )
    ]));
  }
}
</code>```
```<code></code>```

Title: Pass a parameters to stateful class

Body:
How can I pass a parameters to a stateful class in flutter?

I couldn't pass a parameter in the class as I'm a beginner and don't know the method.

I want to pass data from a list to build the class x times, and display the data in a container.

The text I want to pass is labeled tH.

I hope if someone can pass the argument for me.

My class:

class Thkr extends StatefulWidget {

  @override
  State<StatefulWidget> createState() {
    return _ThkrState();
  }
}

class _ThkrState extends State<Thkr> {
  int Thkr_count = 3;

  void _incrementCounter() {
    setState(() {
      Thkr_count--;
    });
  }

  @override
  Widget build(BuildContext) {
    return (Column(children: [
      Container(
        padding: EdgeInsets.all(35),
        margin: EdgeInsets.all(20),
        decoration: BoxDecoration(
          border: Border.all(color: Colors.black, width: 3),
          borderRadius: BorderRadius.circular(8),
          boxShadow: [
            BoxShadow(
              color: Colors.lightGreen,
              offset: Offset(6.0, 6.0),
            ),
          ],
        ),
        child: Text({here I want to pass the data},
            style: TextStyle(fontSize: textSize, color: themeli[themei])),
      ),
      Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          Card(
            child: SizedBox(
              width: 100,
              height: 30,
              child: Center(
                  child: ElevatedButton(
                    style: ElevatedButton.styleFrom(
                      backgroundColor: Colors.lightGreen,
                      minimumSize: Size.fromHeight(40), //
                    ),
                    onPressed: () {
                      _incrementCounter();
                    },
                    child: Text(
                      'Count',
                      style: TextStyle(color: themeli[themei]),
                    ),
                  )),
            ),
          ),
          Card(
            child: SizedBox(
              width: 100,
              height: 30,
              child: Center(
                  child: Text("$Thkr_count left",
                      style: TextStyle(
                        backgroundColor: Colors.white12,
                      ))),
            ),
          ),
        ],
      )
    ]));
  }
}


问:
GOAWAY http/2 frame intermittently observed on running high traffic after idleTimeout
While sending the high traffic(same message and payload) we observed some 503 intermittently.
Further we collected tcpdump in the same time interval and observed a GOAWAY http/2 frame sent by netty server after every 10 min.
We have set idleTimeout = 600000 using below mentioned addServerCustomizers

```<code>factory.addServerCustomizers(httpServer -> httpServer.idleTimeout(Duration.ofMillis(idleTimeout)));
</code>```

In the next test we changed idleTimeout idleTimeout = 420000 and observed GOAWAY http/2 frame in tcpdump after every 3 min 23 sec and 3 min 37 sec alternately.
In the next test we disabled idleTimeout by commenting the addServerCustomizers and 503 was not observed further.

Netty send a GOAWAY http/2 frame in running traffic after idleTimeout in running traffic.

```<code>* Reactor version(s) used: 1.0.23
* Other relevant libraries versions (eg. `netty`, ...): (spring-boot-starter-webflux:2.7.4, spring-boot-starter:2.7.4 (*), spring-boot-starter-json:2.7.4 (*), spring-boot-starter-reactor-netty:2.7.4)
+--- org.springframework.boot:spring-boot-starter-webflux:2.7.4
|    +--- org.springframework.boot:spring-boot-starter:2.7.4 (*)
|    +--- org.springframework.boot:spring-boot-starter-json:2.7.4 (*)
|    +--- org.springframework.boot:spring-boot-starter-reactor-netty:2.7.4
|    |    \--- io.projectreactor.netty:reactor-netty-http:1.0.23
* JVM version (`java -version`): 17.0.5
* OS and version (eg. `uname -a`): Linux
</code>```

Why Netty is sending a GOAWAY http/2 frame after idleTimeout since we have running traffic.
Also need some help on how to debug this issue, whether I can enable some logs or peg some metric.

Body:
While sending the high traffic(same message and payload) we observed some 503 intermittently.
Further we collected tcpdump in the same time interval and observed a GOAWAY http/2 frame sent by netty server after every 10 min.
We have set idleTimeout = 600000 using below mentioned addServerCustomizers

factory.addServerCustomizers(httpServer -> httpServer.idleTimeout(Duration.ofMillis(idleTimeout)));

In the next test we changed idleTimeout idleTimeout = 420000 and observed GOAWAY http/2 frame in tcpdump after every 3 min 23 sec and 3 min 37 sec alternately.
In the next test we disabled idleTimeout by commenting the addServerCustomizers and 503 was not observed further.

Netty send a GOAWAY http/2 frame in running traffic after idleTimeout in running traffic.

* Reactor version(s) used: 1.0.23
* Other relevant libraries versions (eg. `netty`, ...): (spring-boot-starter-webflux:2.7.4, spring-boot-starter:2.7.4 (*), spring-boot-starter-json:2.7.4 (*), spring-boot-starter-reactor-netty:2.7.4)
+--- org.springframework.boot:spring-boot-starter-webflux:2.7.4
|    +--- org.springframework.boot:spring-boot-starter:2.7.4 (*)
|    +--- org.springframework.boot:spring-boot-starter-json:2.7.4 (*)
|    +--- org.springframework.boot:spring-boot-starter-reactor-netty:2.7.4
|    |    \--- io.projectreactor.netty:reactor-netty-http:1.0.23
* JVM version (`java -version`): 17.0.5
* OS and version (eg. `uname -a`): Linux

Why Netty is sending a GOAWAY http/2 frame after idleTimeout since we have running traffic.
Also need some help on how to debug this issue, whether I can enable some logs or peg some metric.


问:
Which analyzer to use on specific strings?
I have a document in my collection with a property name like this:

```<code>name: [{Value: "steel 0.8x1000x2000mm"}]
</code>```

Now I'm trying to create a search index for it, so far looks like this:

```<code>...
"name": {
        "fields": {
          "Value": [
            {
              "analyzer": "lucene.finnish",
              "searchAnalyzer": "lucene.finnish",
              "type": "string"
            },
            {
              "dynamic": true,
              "type": "document"
            }
          ]
        },
        "type": "document"
      },
...
</code>```

And it works pretty fine except for such documents. The issue is that the query 0.8x1000x2000 doesn't match anything, though 0.8x1000x2000mm works fine.

I guess I'm using the wrong analyzer, but can't really figure out which one should I. Or I should make a custom one?

Body:
I have a document in my collection with a property name like this:

name: [{Value: "steel 0.8x1000x2000mm"}]

Now I'm trying to create a search index for it, so far looks like this:

...
"name": {
        "fields": {
          "Value": [
            {
              "analyzer": "lucene.finnish",
              "searchAnalyzer": "lucene.finnish",
              "type": "string"
            },
            {
              "dynamic": true,
              "type": "document"
            }
          ]
        },
        "type": "document"
      },
...

And it works pretty fine except for such documents. The issue is that the query 0.8x1000x2000 doesn't match anything, though 0.8x1000x2000mm works fine.

I guess I'm using the wrong analyzer, but can't really figure out which one should I. Or I should make a custom one?


问:
How setup Cntr+E to go to the end of the line in Jupyter?
I don't want to press End all the time to go to the end of the line in jupyter. I looked in jupyter notebook shortcuts, but didn't find where to replace the 'go to end of the line' that is Ctrl + End to Ctrl + E.

Anyone know how to do it?

Replace Ctrl+End to Ctrl+E


问:
Is it possible to use the .astype function to pass value name to my column that has mixed datatype?

num_cols = ['Complaint Type', 'City']

for i in range(0,len(num_cols),2):
    plt.figure(figsize=(10,4))
    plt.subplot(121)
    sns.distplot(citynan_df[num_cols[i]], hist=True, kde=False)
    plt.subplot(122)
    sns.distplot(citynan_df[num_cols[i+1]], hist=True, kde=False)
    plt.tight_layout()
    plt.show()
```


问:
Problem with ForeignKeys in sqlalchemy Python
When I then send the query, neither the BSM_ID nor the employee field are displayed.

I have the following models:

class Bprojpod(db.Model):
     __tablename__ = 'BPROJPOD'
  ID = db.Column(db.Integer, primary_key=True)
  ZEIT_VON = db.Column(db.String)
  ZEIT_BIS = db.Column(db.String)
  PAUSE = db.Column(db.String)
  BSM_ID = db.Column(db.Integer, ForeignKey("BSM.ID"))
  EMPLOYEE = relationship("Bsm", foreign_keys=[BSM_ID])
  BTICK_ID = db.Column(db.Integer)

class Bsm(db.Model):
  __tablename__ = "BSM"
  ID = db.Column(db.Integer, primary_key=True)
  NAME = db.Column(db.String)

class BprojpodSchema(ma.SQLAlchemyAutoSchema):
  class Meta:
    model = Bprojpod
    load_instance = True
    sqla_session = db.session

bprojpod_schema = BprojpodSchema()
abprojpod_schema = BprojpodSchema(many=True)
```
<p>This is how I call the query:</p>
<pre class="lang-py prettyprint-override"><code>def getBprojpod(btick_id):
      abprojpod = Bprojpod.query.filter(Bprojpod.BTICK_ID == btick_id).all()
      return abprojpod_schema.dump(abprojpod)
</code>```

Can someone explain to me what I'm doing wrong?

Body:
When I then send the query, neither the BSM_ID nor the employee field are displayed.

I have the following models:

class Bprojpod(db.Model):
     __tablename__ = 'BPROJPOD'
  ID = db.Column(db.Integer, primary_key=True)
  ZEIT_VON = db.Column(db.String)
  ZEIT_BIS = db.Column(db.String)
  PAUSE = db.Column(db.String)
  BSM_ID = db.Column(db.Integer, ForeignKey("BSM.ID"))
  EMPLOYEE = relationship("Bsm", foreign_keys=[BSM_ID])
  BTICK_ID = db.Column(db.Integer)

class Bsm(db.Model):
  __tablename__ = "BSM"
  ID = db.Column(db.Integer, primary_key=True)
  NAME = db.Column(db.String)

class BprojpodSchema(ma.SQLAlchemyAutoSchema):
  class Meta:
    model = Bprojpod
    load_instance = True
    sqla_session = db.session

bprojpod_schema = BprojpodSchema()
abprojpod_schema = BprojpodSchema(many=True)

This is how I call the query:

def getBprojpod(btick_id):
      abprojpod = Bprojpod.query.filter(Bprojpod.BTICK_ID == btick_id).all()
      return abprojpod_schema.dump(abprojpod)

Can someone explain to me what I'm doing wrong?


问:
Flutter (IOS) SqfliteDatabaseException: DatabaseException(open_failed only on IOS 16.2
After upgrading to IOS 16.2 getting below exception when trying to access database.

on IOS version 16.1 and below everything works fine.

```<code>SqfliteDatabaseException: DatabaseException(open_failed /var/mobile/Containers/Data/Application/494EB596-3835-462C-8164-2B773A19A1C4/Documents/main.db)
File "exception_impl.dart", line 11, in wrapDatabaseException
File "database_mixin.dart", line 737, in SqfliteDatabaseMixin.openDatabase
File "database_mixin.dart", line 839, in SqfliteDatabaseMixin.doOpen
File "database.dart", line 46, in SqfliteDatabaseOpenHelper.openDatabase
File "factory_mixin.dart", line 110, in SqfliteDatabaseFactoryMixin.openDatabase.\<fn\>
...
20 additional frame(s) were not displayed)
</code>```

Platform: IOS
IOS version: 16.2
Device: iPhone 13 pro max.
flutter: 3.3.3

Code: databaseFactory.openDatabase(path, options: options);

Plugin: sqflite

On first launch this exception is thrown,  but if I close app and relaunch it then it works fine.

I checked if database exists also I added additional catch to get database path from both path_provider and sqflite plugin.

```<code>var documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "main.db");

    try
    {
      await databaseFactory.openDatabase(path, options: options);
    } catch(_) {
      try
      {
        var databasesPath = await getDatabasesPath();
        String path = join(databasesPath, 'main.db');
        return await databaseFactory.openDatabase(path, options: options);
      } catch(e, stackTrace){
        reportException(e, stackTrace);
      }
    }
</code>```

Body:
After upgrading to IOS 16.2 getting below exception when trying to access database.

on IOS version 16.1 and below everything works fine.

SqfliteDatabaseException: DatabaseException(open_failed /var/mobile/Containers/Data/Application/494EB596-3835-462C-8164-2B773A19A1C4/Documents/main.db)
File "exception_impl.dart", line 11, in wrapDatabaseException
File "database_mixin.dart", line 737, in SqfliteDatabaseMixin.openDatabase
File "database_mixin.dart", line 839, in SqfliteDatabaseMixin.doOpen
File "database.dart", line 46, in SqfliteDatabaseOpenHelper.openDatabase
File "factory_mixin.dart", line 110, in SqfliteDatabaseFactoryMixin.openDatabase.\<fn\>
...
20 additional frame(s) were not displayed)

Platform: IOS
IOS version: 16.2
Device: iPhone 13 pro max.
flutter: 3.3.3

Code: databaseFactory.openDatabase(path, options: options);

Plugin: sqflite

On first launch this exception is thrown,  but if I close app and relaunch it then it works fine.

I checked if database exists also I added additional catch to get database path from both path_provider and sqflite plugin.

var documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "main.db");

    try
    {
      await databaseFactory.openDatabase(path, options: options);
    } catch(_) {
      try
      {
        var databasesPath = await getDatabasesPath();
        String path = join(databasesPath, 'main.db');
        return await databaseFactory.openDatabase(path, options: options);
      } catch(e, stackTrace){
        reportException(e, stackTrace);
      }
    }


问:
Nifi + executeGroovyScript : jar libs version conflicts in cluster
i am running an ExecuteGroovyScript that is working on my Nifi sandbox VM. This script is using apache POI Version 5.2.2, that use commons-io version 2.11, among other ones.
I need it to work on a cluster. The infrastructure person who build the cluster put 65 other jar files of  the commons-io library, version, 2.5, 2.6... many of them are duplicates.
Results : my script is validated on the cluster but once it is run, i got a "java.lang.nosuchmethoderror org.apache.commons.io.ioutils.bytearray(i)".
Internet is telling me that there is a version conflict.
After checking the commons-io documentation, it appears that the 2.6 version of it doesn't have the byteArray() method, so i guess nifi is getting the V2.6 instead of V2.11 and try to find a method that doesn't exist.

Deleting all these 65 jar files doesn't seem to be a solution right now because some nifi flow probably works on those versions.
Another solution would be to downgrade apache poi to reach a version that doesn't use commons-io but this is costly and need some testing before.
My best solution would be to force Nifi to run the proper version of commons-io. Is there a way to tell nifi and especially a groovy script to run a specific versions of a library?

My imports are:

```<code>import org.apache.poi.ss.usermodel.*
import java.nio.charset.*
import java.io.*
import groovy.json.*
</code>```

Body:
i am running an ExecuteGroovyScript that is working on my Nifi sandbox VM. This script is using apache POI Version 5.2.2, that use commons-io version 2.11, among other ones.
I need it to work on a cluster. The infrastructure person who build the cluster put 65 other jar files of  the commons-io library, version, 2.5, 2.6... many of them are duplicates.
Results : my script is validated on the cluster but once it is run, i got a "java.lang.nosuchmethoderror org.apache.commons.io.ioutils.bytearray(i)".
Internet is telling me that there is a version conflict.
After checking the commons-io documentation, it appears that the 2.6 version of it doesn't have the byteArray() method, so i guess nifi is getting the V2.6 instead of V2.11 and try to find a method that doesn't exist.

Deleting all these 65 jar files doesn't seem to be a solution right now because some nifi flow probably works on those versions.
Another solution would be to downgrade apache poi to reach a version that doesn't use commons-io but this is costly and need some testing before.
My best solution would be to force Nifi to run the proper version of commons-io. Is there a way to tell nifi and especially a groovy script to run a specific versions of a library?

My imports are:

import org.apache.poi.ss.usermodel.*
import java.nio.charset.*
import java.io.*
import groovy.json.*


问:
Is it possible to display BOTH git branch and anaconda virtual environment name in the Powershell prompt?
I have set up my Powershell so it displays name of the current git branch while I'm working in VS Code.

Then, I installed Anaconda to manage my virtual environments. When I activate my virtual environment the prompt doesn't show the name of the environment. Most likely due to conflict with the display script for git branch.

I can see PS C:\Users\User1\Desktop\Python\Projects\myp (git_branch_name)

but I would like to see

(conda_env_name) C:\Users\User1\Desktop\Python\Projects\myp (git_branch_name)

My Microsoft.PowerShell_profile file:

```<code>Set-Alias rc Edit-PowershellProfile

function prompt {
    $base = "PS "
    $path = "$($executionContext.SessionState.Path.CurrentLocation)"
    $userPrompt = "$('>' * ($nestedPromptLevel + 1)) "

    Write-Host "`n$base" -NoNewline

    if (Test-Path .git) {
        Write-Host $path -NoNewline -ForegroundColor "green"
        Write-BranchName
    }
    else {
        # we're not in a repo so don't bother displaying branch name/sha
        Write-Host $path -ForegroundColor "green"
    }

    return $userPrompt
}

function Edit-PowershellProfile
{
    notepad $Profile
}

function Write-BranchName () {
    try {
        $branch = git rev-parse --abbrev-ref HEAD

        if ($branch -eq "HEAD") {
            # we're probably in detached HEAD state, so print the SHA
            $branch = git rev-parse --short HEAD
            Write-Host " ($branch)" -ForegroundColor "red"
        }
        else {
            # we're on an actual branch, so print it
            Write-Host " ($branch)" -ForegroundColor "blue"
        }
    } catch {
        # we'll end up here if we're in a newly initiated git repo
        Write-Host " (no branches yet)" -ForegroundColor "yellow"
    }
}

</code>```

Body:
I have set up my Powershell so it displays name of the current git branch while I'm working in VS Code.

Then, I installed Anaconda to manage my virtual environments. When I activate my virtual environment the prompt doesn't show the name of the environment. Most likely due to conflict with the display script for git branch.

I can see PS C:\Users\User1\Desktop\Python\Projects\myp (git_branch_name)

but I would like to see

(conda_env_name) C:\Users\User1\Desktop\Python\Projects\myp (git_branch_name)

My Microsoft.PowerShell_profile file:

Set-Alias rc Edit-PowershellProfile

function prompt {
    $base = "PS "
    $path = "$($executionContext.SessionState.Path.CurrentLocation)"
    $userPrompt = "$('>' * ($nestedPromptLevel + 1)) "

    Write-Host "`n$base" -NoNewline

    if (Test-Path .git) {
        Write-Host $path -NoNewline -ForegroundColor "green"
        Write-BranchName
    }
    else {
        # we're not in a repo so don't bother displaying branch name/sha
        Write-Host $path -ForegroundColor "green"
    }

    return $userPrompt
}

function Edit-PowershellProfile
{
    notepad $Profile
}

function Write-BranchName () {
    try {
        $branch = git rev-parse --abbrev-ref HEAD

        if ($branch -eq "HEAD") {
            # we're probably in detached HEAD state, so print the SHA
            $branch = git rev-parse --short HEAD
            Write-Host " ($branch)" -ForegroundColor "red"
        }
        else {
            # we're on an actual branch, so print it
            Write-Host " ($branch)" -ForegroundColor "blue"
        }
    } catch {
        # we'll end up here if we're in a newly initiated git repo
        Write-Host " (no branches yet)" -ForegroundColor "yellow"
    }
}


问:
How to code a random letter generator in cloudbot?
(Original subject line: I don't know much about coding, however I am trying to learn the script for cloudbot (SLOBS Bot for twitch). How do i code a random letter generator?)

I am trying to set a command that generates a random number and letter, i have found that {randnum.1-100} works to pick a random number 1-100, however I am struggling to find a way to have it generate a random letter.

(This is not the direct command i am adding, however it is an example to get the idea of it)
Example:

```<code>Mod: !addcommand !gpa {touser.name} has a GPA of {randnum.1-4}. They recieved all {RANDOMLETTERVARIABLE}'s this year!

JohnDoe: !gpa

Streamlabs: JohnDoe has a GPA of 3. They recieved all A's this year!
</code>```

I attempted a few different suggestions, some of which included:

Attempt:

```<code>making a pastebin of every letter and typing {readapi.PASTEBINLINKHERE}
</code>```

Bad Result:
It read every letter in the pastebin, not a random one.
Attempts:

```<code>{randlet.A-Z}
{random.pick "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
{random.pick "A" 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'L' 'K' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'}
</code>```

Result:
Nothing in place of the variable.

Thank you in advance for any help! I personally use nightbot, and its super simple to find ways to work around it's script, but ive been struggling in learning how to work around the variables in cloudbot :/

Body:
(Original subject line: I don't know much about coding, however I am trying to learn the script for cloudbot (SLOBS Bot for twitch). How do i code a random letter generator?)

I am trying to set a command that generates a random number and letter, i have found that {randnum.1-100} works to pick a random number 1-100, however I am struggling to find a way to have it generate a random letter.

(This is not the direct command i am adding, however it is an example to get the idea of it)
Example:

Mod: !addcommand !gpa {touser.name} has a GPA of {randnum.1-4}. They recieved all {RANDOMLETTERVARIABLE}'s this year!

JohnDoe: !gpa

Streamlabs: JohnDoe has a GPA of 3. They recieved all A's this year!

I attempted a few different suggestions, some of which included:

Attempt:

making a pastebin of every letter and typing {readapi.PASTEBINLINKHERE}

Bad Result:
It read every letter in the pastebin, not a random one.
Attempts:

{randlet.A-Z}
{random.pick "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
{random.pick "A" 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'L' 'K' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'}

Result:
Nothing in place of the variable.

Thank you in advance for any help! I personally use nightbot, and its super simple to find ways to work around it's script, but ive been struggling in learning how to work around the variables in cloudbot :/


问:
Is there way to fill cross inside polygon in Google maps reactjs application
I am not able to show a cross or any kind of pattern inside a polygon which I want to show Google maps using reactjs. there are not as such properties of polygon available.

I tried to use svg with OverlayView component to show in polygon Google maps in reactjs. I am expecting when i see polygon it's show pattern inside polygon

https://i.stack.imgur.com/n21p5.png


问:
NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator while running springboot project
I am getting this error when I am using JSTL Tags in .jsp file.

My JSTL Core lib is:

```<code><%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
</code>```

and my pom.xml is:

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.marketingapp</groupId>
    <artifactId>marketingapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>marketingapp</name>
    <description>Demo project for Hibernate marketing</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
            </dependency>
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
</code>```

Body:
I am getting this error when I am using JSTL Tags in .jsp file.

My JSTL Core lib is:

<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>

and my pom.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.1</version>
        <relativePath/>
    </parent>
    <groupId>com.marketingapp</groupId>
    <artifactId>marketingapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>marketingapp</name>
    <description>Demo project for Hibernate marketing</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
            </dependency>
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


问:
Pandas: calculate time passed based on aonther column value
In my pandas DataFrame's column "ms" I have the milliseconds passed and in the "button" column the  keyboard character that was pressed.
I'd like to know how many seconds the "up" was pressed and how many second the "down" was pressed.
This is my df:

```<code>    time    direction
0   31033      up
1   31174      up
2   31207     down
3   31324      up
4   31353      up
5   31383     down
6   31410      up
7   31440     down
8   31473     down
9   31501     down
</code>```

I've tried this:

```<code>
self.df_grouped = self.df.groupby("button").agg({"ms": [min, max]})
self.df_grouped["ms", "duration"] = (
self.df_grouped["ms", "max"] - self.df_grouped["ms", "min"]
                )
</code>```

And it seems to works, but I need an output more like this:

```<code>      s      button
0   .174      up
1   .033      down
2   .029      up
3   .03       down
4   .027      up
5   .061      down
</code>```

How can I do that?

Body:
In my pandas DataFrame's column "ms" I have the milliseconds passed and in the "button" column the  keyboard character that was pressed.
I'd like to know how many seconds the "up" was pressed and how many second the "down" was pressed.
This is my df:

    time    direction
0   31033      up
1   31174      up
2   31207     down
3   31324      up
4   31353      up
5   31383     down
6   31410      up
7   31440     down
8   31473     down
9   31501     down

I've tried this:

self.df_grouped = self.df.groupby("button").agg({"ms": [min, max]})
self.df_grouped["ms", "duration"] = (
self.df_grouped["ms", "max"] - self.df_grouped["ms", "min"]
                )

And it seems to works, but I need an output more like this:

      s      button
0   .174      up
1   .033      down
2   .029      up
3   .03       down
4   .027      up
5   .061      down

How can I do that?


问:
How to use foreign key as a distinct value and sort the queryset with a timestamp field first in Django?
I am using Postgres in my django project and I want to get all the tickets based on a customer full_name search with distinct customer_id and sort the ticket queryset based on card_timestamp field in Ticket model.

I have two models like the following:

```<code>class Ticket(BaseTimeClass, BaseDeletedClass):
    customer=models.ForeignKey(Customer,on_delete=models.CASCADE,
related_name="generated_tickets")
    is_replied = models.BooleanField(default=False)
    is_resolved = models.BooleanField(default=False)
    card_timestamp = models.DateTimeField(blank=True, null=True)

class Customer(BaseDeletedClass):
    created_at = models.DateTimeField(auto_now_add=True, blank=True, null=True, db_index=True)
    modified_at = models.DateTimeField(auto_now=True, blank=True, null=True)
    first_name = models.CharField(max_length=64, default="")
    last_name = models.CharField(max_length=64, default="")
    full_name = models.CharField(max_length=256, default="")

</code>```

I have tried with this:

```<code>Ticket.objects.filter(Q(customer__full_name__icontains="shuvo"))
            .select_related("customer")
        .order_by("customer_id", "-card_timestamp")
        .distinct("customer_id")
        )
</code>```

the problem with this query is, it is returning the queryset sorted by the customer_id 1st then using the card_timestamp. for better scenario, e.g. there can be multiple customer named with "shuvo":  customer_id can be 1870, 1120, 3210, and their card_timestamp value is "13 january 2023", "28 december 2022" and "14 december 2022". expected scenario, the queryset should return customer_id 1870, 1120 and 3210 sequentially but it is returning customer_id 3210,1870, 1120. how to solve this problem using django-orm? thanks in advance!

Body:
I am using Postgres in my django project and I want to get all the tickets based on a customer full_name search with distinct customer_id and sort the ticket queryset based on card_timestamp field in Ticket model.

I have two models like the following:

class Ticket(BaseTimeClass, BaseDeletedClass):
    customer=models.ForeignKey(Customer,on_delete=models.CASCADE,
related_name="generated_tickets")
    is_replied = models.BooleanField(default=False)
    is_resolved = models.BooleanField(default=False)
    card_timestamp = models.DateTimeField(blank=True, null=True)

class Customer(BaseDeletedClass):
    created_at = models.DateTimeField(auto_now_add=True, blank=True, null=True, db_index=True)
    modified_at = models.DateTimeField(auto_now=True, blank=True, null=True)
    first_name = models.CharField(max_length=64, default="")
    last_name = models.CharField(max_length=64, default="")
    full_name = models.CharField(max_length=256, default="")

I have tried with this:

Ticket.objects.filter(Q(customer__full_name__icontains="shuvo"))
            .select_related("customer")
        .order_by("customer_id", "-card_timestamp")
        .distinct("customer_id")
        )

the problem with this query is, it is returning the queryset sorted by the customer_id 1st then using the card_timestamp. for better scenario, e.g. there can be multiple customer named with "shuvo":  customer_id can be 1870, 1120, 3210, and their card_timestamp value is "13 january 2023", "28 december 2022" and "14 december 2022". expected scenario, the queryset should return customer_id 1870, 1120 and 3210 sequentially but it is returning customer_id 3210,1870, 1120. how to solve this problem using django-orm? thanks in advance!


问:
Trying to get push notifications work in foreground
Am trying to make push notifications (FCM) show up when app is in Foreground. Multiple manuals are referring to the below method. I can confirm it is being called when message is received, but notifications do not show up when app is in foreground (only background).

//To show a notification when the app is in foreground
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
  NSLog(@"completion handler, which is called but does not work");
  completionHandler(UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
}
```


问:
why it causes an error (TypeError: unhashable type: 'list') by using cache from python's functools
The code is following.if I delete the line which includes cache function,it can run.But when I use it,it will read"TypeError: unhashable type: 'list'".

```<code>    def wordBreak(s: str, wordDict: list[str]) -> list[str]:
        @cache
        wordSet = set(wordDict)
        def dfs(temp,pos):
            if pos == len(s):
                res.append(" ".join(temp))
                return
            for i in range(pos,len(s)+1):
                if s[pos:i] in wordSet:
                    temp.append(s[pos:i])
                    dfs(temp,i)
                    temp.pop()
        res = []
        dfs([],0)
        return res
</code>```

Hope to get a reply to deal with my trouble.If I express not clearly,please ask me.I will give more details.

Body:
The code is following.if I delete the line which includes cache function,it can run.But when I use it,it will read"TypeError: unhashable type: 'list'".

    def wordBreak(s: str, wordDict: list[str]) -> list[str]:
        @cache
        wordSet = set(wordDict)
        def dfs(temp,pos):
            if pos == len(s):
                res.append(" ".join(temp))
                return
            for i in range(pos,len(s)+1):
                if s[pos:i] in wordSet:
                    temp.append(s[pos:i])
                    dfs(temp,i)
                    temp.pop()
        res = []
        dfs([],0)
        return res

Hope to get a reply to deal with my trouble.If I express not clearly,please ask me.I will give more details.


问:
Cannot implement `particles.js`
I am trying to use particle-js for my website. My code is quite simple, since it is the very first thing I tried to implement.

My project consists of 4 files: code.html, particles-config.json, particles.js and style.css. With the last one still being empty.

The code.html file:

```<code><!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>My Website</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="particles.js"></script>

  </head>
  <body>
    <header>
        <p>Test 1</p>
        <div id="particle-div"></div>
        <button id="particle-button">Start</button>
        <p>Test 2</p>
        <script>
            $("#particle-button").click(function(){
                particlesJS.load('particle-div', 'particles-config.json')
            });

        </script>
    </header>

  </body>
</html>
</code>```

And the config file is just with the content from the one provided on this github under particle.json. And the particle.js is the exact same file from the github.

However when I run the code, I dont see the particles. It just opens up an empty white space between Test 1 and test2. I amlso not getting any error messages in the browser console (I use Firefox).

Could anyone tell me what am I doing wrong?

EDIT:

Here is a screen shot of the network tab:

Title: Cannot implement `particles.js`

Body:
I am trying to use particle-js for my website. My code is quite simple, since it is the very first thing I tried to implement.

My project consists of 4 files: code.html, particles-config.json, particles.js and style.css. With the last one still being empty.

The code.html file:

<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>My Website</title>
    <link rel="stylesheet" type="text/css" href="style.css">

Test 1

        <button id="particle-button">Start</button>

Test 2

And the config file is just with the content from the one provided on this github under particle.json. And the particle.js is the exact same file from the github.

However when I run the code, I dont see the particles. It just opens up an empty white space between Test 1 and test2. I amlso not getting any error messages in the browser console (I use Firefox).

Could anyone tell me what am I doing wrong?

EDIT:

Here is a screen shot of the network tab:


问:
Teachable machine 20 or more classes
Im new in Machine learning, It is possoble to create 20 or more classes in teachable machine？I experienced problem when i convert it in quantized model tflite , but when i convert 5 classes there is no error</p>

Title: Teachable machine 20 or more classes


问:
When the Hazelcast support Jakarta EE migration to run on Tomcat 10 web server?
Our application needs to support Tomcat 10.
We are migrating the code to Jakarka EE 9, but due to HazelCast we are blocked.
When can we expect the HazelCast jakarta EE migration??

Details:
We are evaluating to support Tomcat 10 in our product. To start it, we initially try to use Servlet 5.0 spec as Tomcat 10 supports Servlet 5.0 specification.

The Servlet 5.0 version migrated the classes to Jakarta.servlet.* from javax.servlet.. So, most of our java code have been migrated to Jakarta EE9.
But, in the middle we come to know that the HazelCast versions not compatible with Jakarta EE.
The internal classes of HazelCast still references to javax.servlet. from Servlet 3.0 specification.
So as a result, we got compile time issues as well.

Does the HazelCast compatible with Tomcat 10??


问:
How to replace entity in LQC?
I have Lazy Query Container (LQC) + hibernate connected to table. I don't want to display some collections at the table so some collections are lazy loaded.

When user select item (row) in table I want to open edit form with all data available. I have to initialize selected item - I get entity from Item, merge it back to context and call hibernate.initialize. it works fine, collections are initialized. But it is another instace then instance in container (because merge returns new instance)

How can I replace non-initialzied item with this new one?

Or how can I refresh the container and the table (how to select
previously selected row in table after refresh?)

ContentLicense: CC BY-SA 3.0

Title: How to replace entity in LQC?


问:
How to configure nginx as development proxy to avoid CORS errors
for the past 3 days i've being searching the internet for solutions to CORS error to no success, i'm building a react app that access data from remote resource the remote resource is built with yii2 rest API, after alot search the suggestion was that i should configure nginx as a proxy ser and below is what I got so far

```<code>server {
     set $project_root /var/www/html/
     set $root /usr/share/nginx/html;
     charset utf-8;
     server_name api.checkstall.com;
     root $project_root;
     index index.html index.htm index.php;

    add_header 'Access-Control-Allow-Origin' 'https://checkstall.com';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';

     location / {

        if (-f $root/api_maintenance_on.html) {
            return 503;
        }
         rewrite ^/(.*)$ /index.php?$args&request_filename=$1 last;
         try_files $uri $uri/ @rewrite;

        if ($request_method = 'OPTIONS') {
          add_header 'Access-Control-Max-Age' 86400;
          add_header 'Content-Type' 'text/plain charset=UTF-8';
          add_header 'Content-Length' 0;
          return 204;
        }
        proxy_redirect off;
        proxy_set_header host $host;
        proxy_set_header X-real-ip $remote_addr;
        proxy_set_header X-forward-for $proxy_add_x_forwarded_for;
        proxy_pass https://api.checkstall.com;
     }
  }
}
</code>```

After this set up few things changes:

The unauthenticated request with GET method works

The login method with post didn't work

signup methos with post on different controller with lodin didn't work either

without this setup nothing works at all
My observation was that for the /auth/login route no response header infortion was received, the server didn't hadd any response to the header

The above Images is before and after implementing proxy pass  in nginx

I'm open to solutions either from both frontend, backend or server side and help would be appreciated

Body:
for the past 3 days i've being searching the internet for solutions to CORS error to no success, i'm building a react app that access data from remote resource the remote resource is built with yii2 rest API, after alot search the suggestion was that i should configure nginx as a proxy ser and below is what I got so far

server {
     set $project_root /var/www/html/
     set $root /usr/share/nginx/html;
     charset utf-8;
     server_name api.checkstall.com;
     root $project_root;
     index index.html index.htm index.php;

    add_header 'Access-Control-Allow-Origin' 'https://checkstall.com';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';

     location / {

        if (-f $root/api_maintenance_on.html) {
            return 503;
        }
         rewrite ^/(.*)$ /index.php?$args&request_filename=$1 last;
         try_files $uri $uri/ @rewrite;

        if ($request_method = 'OPTIONS') {
          add_header 'Access-Control-Max-Age' 86400;
          add_header 'Content-Type' 'text/plain charset=UTF-8';
          add_header 'Content-Length' 0;
          return 204;
        }
        proxy_redirect off;
        proxy_set_header host $host;
        proxy_set_header X-real-ip $remote_addr;
        proxy_set_header X-forward-for $proxy_add_x_forwarded_for;
        proxy_pass https://api.checkstall.com;
     }
  }
}

After this set up few things changes:

The unauthenticated request with GET method works

The login method with post didn't work

signup methos with post on different controller with lodin didn't work either

without this setup nothing works at all
My observation was that for the /auth/login route no response header infortion was received, the server didn't hadd any response to the header

The above Images is before and after implementing proxy pass  in nginx

I'm open to solutions either from both frontend, backend or server side and help would be appreciated


问:
How to save conversation state on storage more then one in one on_turn() run?
I am trying to block possibility that user send two requests at near same time to chatbot (ex. click button of chatbot twice quickly). I have used THIS example code as base.

I have attached Azure storage.

config.py

```<code>    BLOB_CONNECTION_STRING = os.environ.get("BlobConnectiongString", "<connection string>")
    BLOB_CONTAINER_NAME = os.environ.get("BlobContainerName", "<container name>")
</code>```

app.py

```<code>blob_settings = BlobStorageSettings(
    connection_string=CONFIG.BLOB_CONNECTION_STRING,
    container_name=CONFIG.BLOB_CONTAINER_NAME
)
MEMORY = BlobStorage(blob_settings)
</code>```

conversation_flow.py

```<code>class ConversationFlow:
    def __init__(
        self, last_question_asked: Question = Question.NONE,
    ):
        self.last_question_asked = last_question_asked
        self.i_am_busy = False
</code>```

custom_promt_bot.py

```<code>   async def on_turn(self, turn_context: TurnContext):
        # Get the state properties from the turn context.
        # profile = await self.profile_accessor.get(turn_context, UserProfile)
        # flow = await self.flow_accessor.get(turn_context, ConversationFlow)

        await super().on_turn(turn_context)

        # Save any state changes that might have occurred during the turn.
        # ToDo Here code fail !
        await self.conversation_state.save_changes(turn_context)
        await self.user_state.save_changes(turn_context)

    async def on_message_activity(self, turn_context: TurnContext):
        # Get the state properties from the turn context.
        profile = await self.profile_accessor.get(turn_context, UserProfile)
        flow = await self.flow_accessor.get(turn_context, ConversationFlow)

        flow.i_am_busy = True

        await self.conversation_state.save_changes(turn_context)

        await self._fill_out_user_profile(flow, profile, turn_context)

        flow.i_am_busy = False
</code>```

I have tried many combination of solution. Set eTag manually, refresh flow with await self.flow_accessor.get(turn_context, ConversationFlow), different order of save commend.
Still i got:
[on_turn_error] unhandled error: The specified blob already exists.

Expect to save twice conversation flow with update in one run of on_message_activity().

Body:
I am trying to block possibility that user send two requests at near same time to chatbot (ex. click button of chatbot twice quickly). I have used THIS example code as base.

I have attached Azure storage.

config.py

    BLOB_CONNECTION_STRING = os.environ.get("BlobConnectiongString", "<connection string>")
    BLOB_CONTAINER_NAME = os.environ.get("BlobContainerName", "<container name>")

app.py

blob_settings = BlobStorageSettings(
    connection_string=CONFIG.BLOB_CONNECTION_STRING,
    container_name=CONFIG.BLOB_CONTAINER_NAME
)
MEMORY = BlobStorage(blob_settings)

conversation_flow.py

class ConversationFlow:
    def __init__(
        self, last_question_asked: Question = Question.NONE,
    ):
        self.last_question_asked = last_question_asked
        self.i_am_busy = False

custom_promt_bot.py

   async def on_turn(self, turn_context: TurnContext):
        # Get the state properties from the turn context.
        # profile = await self.profile_accessor.get(turn_context, UserProfile)
        # flow = await self.flow_accessor.get(turn_context, ConversationFlow)

        await super().on_turn(turn_context)

        # Save any state changes that might have occurred during the turn.
        # ToDo Here code fail !
        await self.conversation_state.save_changes(turn_context)
        await self.user_state.save_changes(turn_context)

    async def on_message_activity(self, turn_context: TurnContext):
        # Get the state properties from the turn context.
        profile = await self.profile_accessor.get(turn_context, UserProfile)
        flow = await self.flow_accessor.get(turn_context, ConversationFlow)

        flow.i_am_busy = True

        await self.conversation_state.save_changes(turn_context)

        await self._fill_out_user_profile(flow, profile, turn_context)

        flow.i_am_busy = False

I have tried many combination of solution. Set eTag manually, refresh flow with await self.flow_accessor.get(turn_context, ConversationFlow), different order of save commend.
Still i got:
[on_turn_error] unhandled error: The specified blob already exists.

Expect to save twice conversation flow with update in one run of on_message_activity().


问:
Some questions about writing 2D array with assignment and stack
I'm now writing a spec which needs a 2D array and a stack,
and I need to assign the 2D array with some values in initial state,
also give this 2D array a range of possible values in typeinvariant,
like a function.

So I write some part of my spec like this because I don't know how to assign 2D array in initial state ,
in which variable predict_table is the 2D array :

```<code>TypeInvariant ==  /\ stack \in Seq(all_syntax_symbol)
                  /\ token_pointer \in 1..Len(input_token)+1
                  /\ predict_table \in [ grammar_symbol_set -> [ terminal_symbol_set -> Seq(all_syntax_symbol)]]
                  /\ parsing_status \in 0..3

Init == /\ stack = <<13,-1>>
        /\ token_pointer = 1
        /\ predict_table = [x \in grammar_symbol_set,y \in terminal_symbol_set |-> <<>>]
        /\ parsing_status = 0

Action_1 == /\ parsing_status = 0
            /\ parsing_status' = 1
            /\ predict_table' = [predict_table EXCEPT ![-1][12] = <<-9,-3,-2>>,![-2][12] = <<11,4,12>>,![-3][4]= <<-4,10,4>>,![-4][7]= <<-7>>,![-4][8]= <<-6>>,![-4][9]= <<-5>>,![-5][9]= <<-8,-8,9>>,![-6][8]= <<-8,-8,8>>,![-7][7]= <<-8,-8,7>>,![-8][4]= <<4>>,![-8][6]= <<5,-4,6>>,![-9][3]= <<1,-10,-3,2,3>>,![-10][7]= <<-7>>,![-10][8]= <<-6>>,![-10][9]= <<-5>>]
            /\ UNCHANGED <<stack,token_pointer>>
</code>```

However TLC told me that the way I assign in init(and maybe in Action_1?) and make it invariant in TypeInvariant is not OK.
And I don't know how to make it correct.

================================================================

Another question is about push and pop action of stack in my spec.
I write them in this way,in which variable stack just means my FILO stack:

```<code>Action_2 == /\ parsing_status = 1
            /\ (stack[Len(stack)] = input_token[token_pointer]) /\ (stack[Len(stack)] \in terminal_symbol_set)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) ELSE <<>>
            /\ parsing_status' = IF Len(stack) = 1 THEN 3 ELSE 1
            /\ token_pointer' = token_pointer+1
            /\ UNCHANGED <<predict_table>>

Action_5 == /\ parsing_status = 1
            /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<>>) /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<0>>)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) \o predict_table[stack[Len(stack)]][input_token[token_pointer]] ELSE predict_table[stack[Len(stack)]][input_token[token_pointer]]
            /\ UNCHANGED <<parsing_status,token_pointer,predict_table>>
</code>```

I wonder whether the pop action in Action_2 and push action in Action_5 of my stack is good in functionality.

================================================================

And here is my full spec,
imitating the predictive parsing algorithm,
while the grammar making up the predict table is in LL(1).
I wonder if there're more TLA+ syntax errors in it
, and it'd be grateful if you could tell me:

```<code>----------------------------- MODULE Parser_DFA -----------------------------
EXTENDS Integers,Naturals,Reals,Sequences
CONSTANTS input_token
VARIABLES stack,token_pointer,predict_table,parsing_status

vars == <<stack,token_pointer,predict_table,parsing_status>>

grammar_symbol_set == -10..-1
\* non-terminal symbol set

terminal_symbol_set == 1..13
\* terminal symbol set, 13 stands for EOF($)

all_syntax_symbol == grammar_symbol_set \union terminal_symbol_set \union {0}
\* 0 stands for epslion( ε )

TypeInvariant ==  /\ stack \in Seq(all_syntax_symbol)
                  /\ token_pointer \in 1..Len(input_token)+1
                  /\ predict_table \in [ grammar_symbol_set -> [ terminal_symbol_set -> Seq(all_syntax_symbol)]]
                  /\ parsing_status \in 0..3

Init == /\ stack = <<13,-1>>
        /\ token_pointer = 1
        /\ predict_table = [x \in grammar_symbol_set,y \in terminal_symbol_set |-> <<>>]
        /\ parsing_status = 0
\*init state of predictive parsing

Action_1 == /\ parsing_status = 0
            /\ parsing_status' = 1
            /\ predict_table' = [predict_table EXCEPT ![-1][12] = <<-9,-3,-2>>,![-2][12] = <<11,4,12>>,![-3][4]= <<-4,10,4>>,![-4][7]= <<-7>>,![-4][8]= <<-6>>,![-4][9]= <<-5>>,![-5][9]= <<-8,-8,9>>,![-6][8]= <<-8,-8,8>>,![-7][7]= <<-8,-8,7>>,![-8][4]= <<4>>,![-8][6]= <<5,-4,6>>,![-9][3]= <<1,-10,-3,2,3>>,![-10][7]= <<-7>>,![-10][8]= <<-6>>,![-10][9]= <<-5>>]
            /\ UNCHANGED <<stack,token_pointer>>
\*still init state of predictive parsing,but for predictive table assignment.

Action_2 == /\ parsing_status = 1
            /\ (stack[Len(stack)] = input_token[token_pointer]) /\ (stack[Len(stack)] \in terminal_symbol_set)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) ELSE <<>>
            /\ parsing_status' = IF Len(stack) = 1 THEN 3 ELSE 1
            /\ token_pointer' = token_pointer+1
            /\ UNCHANGED <<predict_table>>
\* detects a terminal symbol and matchs in input_token and stack,pop and pointer++
 \* parsing_status = 1 means OK, 2 means error, 3 means finished without error

Action_2_null == /\ parsing_status = 1
                 /\ predict_table[stack[Len(stack)]][input_token[token_pointer]] = <<0>>
                 /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) ELSE <<>>
                 /\ parsing_status' = IF Len(stack) = 1 THEN 3 ELSE 1
                 /\ UNCHANGED <<parsing_status,predict_table>>
    \* detects a epslion( ε ) in predictive table, just pop in stack is OK

Action_3 == /\ parsing_status = 1
            /\ stack[Len(stack)] \in terminal_symbol_set
            /\ stack[Len(stack)] # input_token[token_pointer]
            /\ parsing_status' = 2
            /\ UNCHANGED <<stack,token_pointer,predict_table>>
  \* detects a terminal symbol and not match in input_token and stack, means error.

Action_4 == /\ parsing_status = 1
            /\ predict_table[stack[Len(stack)]][input_token[token_pointer]] = <<>>
            /\ parsing_status' = 2
            /\ UNCHANGED <<stack,token_pointer,predict_table>>
\* parsing error(predictive table of this pair of symbol is empty)

Action_5 == /\ parsing_status = 1
            /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<>>) /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<0>>)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) \o predict_table[stack[Len(stack)]][input_token[token_pointer]] ELSE predict_table[stack[Len(stack)]][input_token[token_pointer]]
            /\ UNCHANGED <<parsing_status,token_pointer,predict_table>>
\* detects a non-terminal symbol and  update the stack.

Next == Action_1 \/ Action_2 \/ Action_2_null \/ Action_3 \/ Action_4 \/ Action_5

Spec == Init /\ [][Next]_vars

Invariant_1 == parsing_status = 3 => token_pointer = Len(input_token)
\*means parsing finished

Invariant_2 == parsing_status = 2 => Len(stack) # 0
\*means parsing error and not finished

=============================================================================
</code>```

Thank you for your reading.
I know it's quite long but this's the best I can describe my question.
I'm sorry for that.

Body:
I'm now writing a spec which needs a 2D array and a stack,
and I need to assign the 2D array with some values in initial state,
also give this 2D array a range of possible values in typeinvariant,
like a function.

So I write some part of my spec like this because I don't know how to assign 2D array in initial state ,
in which variable predict_table is the 2D array :

TypeInvariant ==  /\ stack \in Seq(all_syntax_symbol)
                  /\ token_pointer \in 1..Len(input_token)+1
                  /\ predict_table \in [ grammar_symbol_set -> [ terminal_symbol_set -> Seq(all_syntax_symbol)]]
                  /\ parsing_status \in 0..3

Init == /\ stack = <<13,-1>>
        /\ token_pointer = 1
        /\ predict_table = [x \in grammar_symbol_set,y \in terminal_symbol_set |-> <<>>]
        /\ parsing_status = 0

Action_1 == /\ parsing_status = 0
            /\ parsing_status' = 1
            /\ predict_table' = [predict_table EXCEPT ![-1][12] = <<-9,-3,-2>>,![-2][12] = <<11,4,12>>,![-3][4]= <<-4,10,4>>,![-4][7]= <<-7>>,![-4][8]= <<-6>>,![-4][9]= <<-5>>,![-5][9]= <<-8,-8,9>>,![-6][8]= <<-8,-8,8>>,![-7][7]= <<-8,-8,7>>,![-8][4]= <<4>>,![-8][6]= <<5,-4,6>>,![-9][3]= <<1,-10,-3,2,3>>,![-10][7]= <<-7>>,![-10][8]= <<-6>>,![-10][9]= <<-5>>]
            /\ UNCHANGED <<stack,token_pointer>>

However TLC told me that the way I assign in init(and maybe in Action_1?) and make it invariant in TypeInvariant is not OK.
And I don't know how to make it correct.

================================================================

Another question is about push and pop action of stack in my spec.
I write them in this way,in which variable stack just means my FILO stack:

Action_2 == /\ parsing_status = 1
            /\ (stack[Len(stack)] = input_token[token_pointer]) /\ (stack[Len(stack)] \in terminal_symbol_set)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) ELSE <<>>
            /\ parsing_status' = IF Len(stack) = 1 THEN 3 ELSE 1
            /\ token_pointer' = token_pointer+1
            /\ UNCHANGED <<predict_table>>

Action_5 == /\ parsing_status = 1
            /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<>>) /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<0>>)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) \o predict_table[stack[Len(stack)]][input_token[token_pointer]] ELSE predict_table[stack[Len(stack)]][input_token[token_pointer]]
            /\ UNCHANGED <<parsing_status,token_pointer,predict_table>>

I wonder whether the pop action in Action_2 and push action in Action_5 of my stack is good in functionality.

================================================================

And here is my full spec,
imitating the predictive parsing algorithm,
while the grammar making up the predict table is in LL(1).
I wonder if there're more TLA+ syntax errors in it
, and it'd be grateful if you could tell me:

----------------------------- MODULE Parser_DFA -----------------------------
EXTENDS Integers,Naturals,Reals,Sequences
CONSTANTS input_token
VARIABLES stack,token_pointer,predict_table,parsing_status

vars == <<stack,token_pointer,predict_table,parsing_status>>

grammar_symbol_set == -10..-1
\* non-terminal symbol set

terminal_symbol_set == 1..13
\* terminal symbol set, 13 stands for EOF($)

all_syntax_symbol == grammar_symbol_set \union terminal_symbol_set \union {0}
\* 0 stands for epslion( ε )

TypeInvariant ==  /\ stack \in Seq(all_syntax_symbol)
                  /\ token_pointer \in 1..Len(input_token)+1
                  /\ predict_table \in [ grammar_symbol_set -> [ terminal_symbol_set -> Seq(all_syntax_symbol)]]
                  /\ parsing_status \in 0..3

Init == /\ stack = <<13,-1>>
        /\ token_pointer = 1
        /\ predict_table = [x \in grammar_symbol_set,y \in terminal_symbol_set |-> <<>>]
        /\ parsing_status = 0
\*init state of predictive parsing

Action_1 == /\ parsing_status = 0
            /\ parsing_status' = 1
            /\ predict_table' = [predict_table EXCEPT ![-1][12] = <<-9,-3,-2>>,![-2][12] = <<11,4,12>>,![-3][4]= <<-4,10,4>>,![-4][7]= <<-7>>,![-4][8]= <<-6>>,![-4][9]= <<-5>>,![-5][9]= <<-8,-8,9>>,![-6][8]= <<-8,-8,8>>,![-7][7]= <<-8,-8,7>>,![-8][4]= <<4>>,![-8][6]= <<5,-4,6>>,![-9][3]= <<1,-10,-3,2,3>>,![-10][7]= <<-7>>,![-10][8]= <<-6>>,![-10][9]= <<-5>>]
            /\ UNCHANGED <<stack,token_pointer>>
\*still init state of predictive parsing,but for predictive table assignment.

Action_2 == /\ parsing_status = 1
            /\ (stack[Len(stack)] = input_token[token_pointer]) /\ (stack[Len(stack)] \in terminal_symbol_set)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) ELSE <<>>
            /\ parsing_status' = IF Len(stack) = 1 THEN 3 ELSE 1
            /\ token_pointer' = token_pointer+1
            /\ UNCHANGED <<predict_table>>
\* detects a terminal symbol and matchs in input_token and stack,pop and pointer++
 \* parsing_status = 1 means OK, 2 means error, 3 means finished without error

Action_2_null == /\ parsing_status = 1
                 /\ predict_table[stack[Len(stack)]][input_token[token_pointer]] = <<0>>
                 /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) ELSE <<>>
                 /\ parsing_status' = IF Len(stack) = 1 THEN 3 ELSE 1
                 /\ UNCHANGED <<parsing_status,predict_table>>
    \* detects a epslion( ε ) in predictive table, just pop in stack is OK

Action_3 == /\ parsing_status = 1
            /\ stack[Len(stack)] \in terminal_symbol_set
            /\ stack[Len(stack)] # input_token[token_pointer]
            /\ parsing_status' = 2
            /\ UNCHANGED <<stack,token_pointer,predict_table>>
  \* detects a terminal symbol and not match in input_token and stack, means error.

Action_4 == /\ parsing_status = 1
            /\ predict_table[stack[Len(stack)]][input_token[token_pointer]] = <<>>
            /\ parsing_status' = 2
            /\ UNCHANGED <<stack,token_pointer,predict_table>>
\* parsing error(predictive table of this pair of symbol is empty)

Action_5 == /\ parsing_status = 1
            /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<>>) /\ (predict_table[stack[Len(stack)]][input_token[token_pointer]] # <<0>>)
            /\ stack' = IF Len(stack)>1 THEN SubSeq(stack,1,Len(stack)-1) \o predict_table[stack[Len(stack)]][input_token[token_pointer]] ELSE predict_table[stack[Len(stack)]][input_token[token_pointer]]
            /\ UNCHANGED <<parsing_status,token_pointer,predict_table>>
\* detects a non-terminal symbol and  update the stack.

Next == Action_1 \/ Action_2 \/ Action_2_null \/ Action_3 \/ Action_4 \/ Action_5

Spec == Init /\ [][Next]_vars

Invariant_1 == parsing_status = 3 => token_pointer = Len(input_token)
\*means parsing finished

Invariant_2 == parsing_status = 2 => Len(stack) # 0
\*means parsing error and not finished

=============================================================================

Thank you for your reading.
I know it's quite long but this's the best I can describe my question.
I'm sorry for that.


问:
How to print out the cell value from excel using pandas?
Below is the code im using to diff two dataframes, but not sure how i can get the mismatched values cell location.

```<code>file=[random1.csv,random2.csv]

li=[]
for filename in file:
    df = pd.read_csv(filename, index_col=None, header=0)
    li.append(df)

df1=li[0]
df2=li[1]

print("{} comparing with {}".format(file[0],file[1]))
df3 = df2[df1.ne(df2).any(axis=1)]
print(df3)

print("{} comparing with {}".format(file[1],file[0]))
df4 = df1[df2.ne(df1).any(axis=1)]
print(df4)

output
random1.csv comparing with random2.csv
   name  age  address
1     2   22        2
4     5    6        3
9    10   89       10
random2.csv comparing with random1.csv
   name  age  address
1     2   22        1
4     5    6        2
9    10   89       11
</code>```

kindly help on this!!
p.s : Im a newbie :)

Body:
Below is the code im using to diff two dataframes, but not sure how i can get the mismatched values cell location.

file=[random1.csv,random2.csv]

li=[]
for filename in file:
    df = pd.read_csv(filename, index_col=None, header=0)
    li.append(df)

df1=li[0]
df2=li[1]

print("{} comparing with {}".format(file[0],file[1]))
df3 = df2[df1.ne(df2).any(axis=1)]
print(df3)

print("{} comparing with {}".format(file[1],file[0]))
df4 = df1[df2.ne(df1).any(axis=1)]
print(df4)

output
random1.csv comparing with random2.csv
   name  age  address
1     2   22        2
4     5    6        3
9    10   89       10
random2.csv comparing with random1.csv
   name  age  address
1     2   22        1
4     5    6        2
9    10   89       11

kindly help on this!!
p.s : Im a newbie :)


问:
What kind of transformation is applied in the demo apps in on mesh files CGAL?
I have a mesh, which is shown below, that I want to use for path planning. I am following this tutorial for that. https://doc.cgal.org/latest/Surface_mesh_shortest_path/index.html

When I use the provided demo and calculate the path between two vertices, its demo console shows selected vertices as

```<code> [11:56:42] INFO: Shortest Paths: Selected Face: 5428; Barycentric coordinates: 0.0669871 0.0131695 0.919843

 [11:56:49] INFO: Shortest Paths: Selected Face: 4813; Barycentric coordinates: 0.00400777 0.983581 0.0124108
</code>```

However, vertices in the mesh file are not in this range, for example, {334746, 1165, 66225}, i.e., values of vertices are really large.

Question: In the demo app, what kind of transformation is applied to the input mesh file?

```<code>#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>

#include <CGAL/Surface_mesh_shortest_path.h>

#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_tree.h>

#include <cstdlib>
#include <iostream>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel             Kernel;
typedef Kernel::Point_3                                                 Point_3;
typedef Kernel::Ray_3                                                   Ray_3;

typedef CGAL::Surface_mesh<Point_3>                                     Triangle_mesh;
typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Triangle_mesh>  Traits;
typedef CGAL::Surface_mesh_shortest_path<Traits>                        Surface_mesh_shortest_path;

typedef boost::graph_traits<Triangle_mesh>                              Graph_traits;
typedef Graph_traits::vertex_iterator                                   vertex_iterator;
typedef Graph_traits::face_iterator                                     face_iterator;

typedef typename Surface_mesh_shortest_path::Barycentric_coordinates    Barycentric_coordinates;
typedef typename Surface_mesh_shortest_path::Face_location              Face_location;

typedef CGAL::AABB_face_graph_triangle_primitive<Triangle_mesh>         AABB_face_graph_primitive;
typedef CGAL::AABB_traits<Kernel, AABB_face_graph_primitive>            AABB_face_graph_traits;
typedef CGAL::AABB_tree<AABB_face_graph_traits>                         AABB_tree;

typedef CGAL::Surface_mesh<Point_3> Mesh;
typedef Mesh::Vertex_index vertex_descriptor;

int main(int argc, char** argv)
{
  const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off");

  Triangle_mesh tmesh;
  if(!CGAL::IO::read_polygon_mesh(filename, tmesh) ||
     !CGAL::is_triangle_mesh(tmesh))
  {
    std::cerr << "Invalid input file." << std::endl;
    return EXIT_FAILURE;
  }

  // or the C++11 for loop. Note that there is a ':' and not a ',' as in BOOST_FOREACH
  for(vertex_descriptor vd : tmesh.vertices()){
    std::cout << tmesh.point(vd) << std::endl;
  }

  Surface_mesh_shortest_path shortest_paths(tmesh);
  const Point_3 source_pt(334746, 1165, 66225);
  Face_location source_loc = shortest_paths.locate<AABB_face_graph_traits>(source_pt); // this builds an AABB tree of the mesh
  shortest_paths.add_source_point(source_loc.first, source_loc.second);
  AABB_tree tree;
  shortest_paths.build_aabb_tree(tree);

  const Point_3 target_pt(370364, 809, 66265.6);
  Face_location target_loc = shortest_paths.locate<AABB_face_graph_traits>(target_pt);

  std::vector<Point_3> points;
  shortest_paths.shortest_path_points_to_source_points(target_loc.first, target_loc.second, std::back_inserter(points));

  // Print the points
  std::cout << points.size() << " ";
  for (std::size_t i = 0; i < points.size(); ++i)
    std::cout << " |----| " << points[i] << "\n";
  std::cout << std::endl;

  return EXIT_SUCCESS;
}
</code>```

Body:
I have a mesh, which is shown below, that I want to use for path planning. I am following this tutorial for that. https://doc.cgal.org/latest/Surface_mesh_shortest_path/index.html

When I use the provided demo and calculate the path between two vertices, its demo console shows selected vertices as

 [11:56:42] INFO: Shortest Paths: Selected Face: 5428; Barycentric coordinates: 0.0669871 0.0131695 0.919843

 [11:56:49] INFO: Shortest Paths: Selected Face: 4813; Barycentric coordinates: 0.00400777 0.983581 0.0124108

However, vertices in the mesh file are not in this range, for example, {334746, 1165, 66225}, i.e., values of vertices are really large.

Question: In the demo app, what kind of transformation is applied to the input mesh file?

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>

#include <CGAL/Surface_mesh_shortest_path.h>

#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_tree.h>

#include <cstdlib>
#include <iostream>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel             Kernel;
typedef Kernel::Point_3                                                 Point_3;
typedef Kernel::Ray_3                                                   Ray_3;

typedef CGAL::Surface_mesh<Point_3>                                     Triangle_mesh;
typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Triangle_mesh>  Traits;
typedef CGAL::Surface_mesh_shortest_path<Traits>                        Surface_mesh_shortest_path;

typedef boost::graph_traits<Triangle_mesh>                              Graph_traits;
typedef Graph_traits::vertex_iterator                                   vertex_iterator;
typedef Graph_traits::face_iterator                                     face_iterator;

typedef typename Surface_mesh_shortest_path::Barycentric_coordinates    Barycentric_coordinates;
typedef typename Surface_mesh_shortest_path::Face_location              Face_location;

typedef CGAL::AABB_face_graph_triangle_primitive<Triangle_mesh>         AABB_face_graph_primitive;
typedef CGAL::AABB_traits<Kernel, AABB_face_graph_primitive>            AABB_face_graph_traits;
typedef CGAL::AABB_tree<AABB_face_graph_traits>                         AABB_tree;

typedef CGAL::Surface_mesh<Point_3> Mesh;
typedef Mesh::Vertex_index vertex_descriptor;

int main(int argc, char** argv)
{
  const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off");

  Triangle_mesh tmesh;
  if(!CGAL::IO::read_polygon_mesh(filename, tmesh) ||
     !CGAL::is_triangle_mesh(tmesh))
  {
    std::cerr << "Invalid input file." << std::endl;
    return EXIT_FAILURE;
  }

  // or the C++11 for loop. Note that there is a ':' and not a ',' as in BOOST_FOREACH
  for(vertex_descriptor vd : tmesh.vertices()){
    std::cout << tmesh.point(vd) << std::endl;
  }

  Surface_mesh_shortest_path shortest_paths(tmesh);
  const Point_3 source_pt(334746, 1165, 66225);
  Face_location source_loc = shortest_paths.locate<AABB_face_graph_traits>(source_pt); // this builds an AABB tree of the mesh
  shortest_paths.add_source_point(source_loc.first, source_loc.second);
  AABB_tree tree;
  shortest_paths.build_aabb_tree(tree);

  const Point_3 target_pt(370364, 809, 66265.6);
  Face_location target_loc = shortest_paths.locate<AABB_face_graph_traits>(target_pt);

  std::vector<Point_3> points;
  shortest_paths.shortest_path_points_to_source_points(target_loc.first, target_loc.second, std::back_inserter(points));

  // Print the points
  std::cout << points.size() << " ";
  for (std::size_t i = 0; i < points.size(); ++i)
    std::cout << " |----| " << points[i] << "\n";
  std::cout << std::endl;

  return EXIT_SUCCESS;
}


问:
Error while using pywhatkit to make handwriting says "unable to access api"
I am getting this error while using pywhatkit:

pywhatkit.core.exceptions.UnableToAccessApi: Unable to access Pywhatkit api right now

This is my code:

```<code>import pywhatkit as pw
txt = """it is demo text"""

pw.text_to_handwriting(txt, "hand1.png", [0, 0, 138])
print("End")
</code>```

I was trying to convert my normal text into handwriting and got this error.

Body:
I am getting this error while using pywhatkit:

pywhatkit.core.exceptions.UnableToAccessApi: Unable to access Pywhatkit api right now

This is my code:

import pywhatkit as pw
txt = """it is demo text"""

pw.text_to_handwriting(txt, "hand1.png", [0, 0, 138])
print("End")

I was trying to convert my normal text into handwriting and got this error.


问:
How to change the format "N2" from DataTable and Show in DataGridView in vb.net
How to change the DataTable format to "N2" and Show in DataGridView in vb.net?. I want to change the format of the DataTable without going through the DataGridView format and displaying in the DataGridView. Please recommend the best solution. I tried but the result is still in the datagridview has not changed.

Thanks

Private Sub ImprovedCode()
    Dim dt As New DataTable("tbl")
    Dim dtColumn As New DataColumn With {.DataType = GetType(DateOnly), .ColumnName = "CreatedDate"}
    dt.Columns.Add(dtColumn)
    Dim dtColumn2 As New DataColumn With {.DataType = GetType(Double), .ColumnName = "Price"}
    dt.Columns.Add(dtColumn2)
    Dim dr As DataRow = dt.NewRow()
    dr(dtColumn) = DateOnly.FromDateTime(Date.Now)
    dr(dtColumn2) = 120000
    Dim dr1 As DataRow = dt.NewRow()
    dr1(dtColumn) = DateOnly.FromDateTime(Date.Now)
    dr1(dtColumn2) = 130000
    dt.Rows.Add(dr)
    dt.Rows.Add(dr1)
    DataGridView1.DataSource = dt
End Sub
```

RESULT DATAGRIDVIEW

DESIRED RESULT DATAGRIDVIEW

Body:
How to change the DataTable format to "N2" and Show in DataGridView in vb.net?. I want to change the format of the DataTable without going through the DataGridView format and displaying in the DataGridView. Please recommend the best solution. I tried but the result is still in the datagridview has not changed.

Thanks

Private Sub ImprovedCode()
    Dim dt As New DataTable("tbl")
    Dim dtColumn As New DataColumn With {.DataType = GetType(DateOnly), .ColumnName = "CreatedDate"}
    dt.Columns.Add(dtColumn)
    Dim dtColumn2 As New DataColumn With {.DataType = GetType(Double), .ColumnName = "Price"}
    dt.Columns.Add(dtColumn2)
    Dim dr As DataRow = dt.NewRow()
    dr(dtColumn) = DateOnly.FromDateTime(Date.Now)
    dr(dtColumn2) = 120000
    Dim dr1 As DataRow = dt.NewRow()
    dr1(dtColumn) = DateOnly.FromDateTime(Date.Now)
    dr1(dtColumn2) = 130000
    dt.Rows.Add(dr)
    dt.Rows.Add(dr1)
    DataGridView1.DataSource = dt
End Sub

RESULT DATAGRIDVIEW

DESIRED RESULT DATAGRIDVIEW


问:
Error compiling minimal OpenCL example from LLVM documentation using clang
My goal is to use C++ code in OpenCL kernels, which has been, as far as I can tell, supported by clang for quite a while.

I am using clang 15.0.6 on my Ubuntu machine 22.04 and am trying to compile the examples found in the LLVM documentation here, the compiler is installed via the "official" script found here.

clang -v shows:

```<code>Ubuntu clang version 15.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
</code>```

Just like in the LLVM manual, I am trying to compile an empty kernel (kernel void k(){}) using this clang version, but it always throws a linker error:

```<code>$ clang test.cl
ld: error: undefined symbol: main
referenced by /lib/x86_64-linux-gnu/Scrt1.o:(\_start)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code>```

Surely I am missing something absolutely basic, but what it is?

Thanks in advance for any help!

Body:
My goal is to use C++ code in OpenCL kernels, which has been, as far as I can tell, supported by clang for quite a while.

I am using clang 15.0.6 on my Ubuntu machine 22.04 and am trying to compile the examples found in the LLVM documentation here, the compiler is installed via the "official" script found here.

clang -v shows:

Ubuntu clang version 15.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64

Just like in the LLVM manual, I am trying to compile an empty kernel (kernel void k(){}) using this clang version, but it always throws a linker error:

$ clang test.cl
ld: error: undefined symbol: main
referenced by /lib/x86_64-linux-gnu/Scrt1.o:(\_start)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Surely I am missing something absolutely basic, but what it is?

Thanks in advance for any help!


问:
How can I use Gnuplot as a library in CLion?
I'm trying to use gnuplot on my m1 Mac. I installed Gnuplot with homebrew. Now I am trying to add Gnuplot as a library to my C code but I don't now how? Another problem is that I have no idea how the library file from Gnuplot is called

I have searched for the library file but couldn't find it.


问:
xterm' is not recognized as an internal or external command in windows (Python tkinter)
I have a script that I want to run from os.system but it's working fine in Linux but it's not working in Windows as it is not recognizing 'xterm'.

I want to display the output in both terminal and in GUI. If I remove 'xterm' it will work on both Linux and Windows but output will display in terminal not in GUI.
Is there any alternative of 'xterm' for windows?? I want to execute this command in Windows.

```<code>from tkinter import *
import os
root = Tk()
root.title("WIndows")
termf = Frame(root, height=1000, width=1000)
termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()
os.system('xterm -into %d -geometry 1000x1000 -e python3 test.py &' % wid )
root.mainloop()
</code>```

Above Code is working fine in Linux but not in windows because of 'xterm'

Body:
I have a script that I want to run from os.system but it's working fine in Linux but it's not working in Windows as it is not recognizing 'xterm'.

I want to display the output in both terminal and in GUI. If I remove 'xterm' it will work on both Linux and Windows but output will display in terminal not in GUI.
Is there any alternative of 'xterm' for windows?? I want to execute this command in Windows.

from tkinter import *
import os
root = Tk()
root.title("WIndows")
termf = Frame(root, height=1000, width=1000)
termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()
os.system('xterm -into %d -geometry 1000x1000 -e python3 test.py &' % wid )
root.mainloop()

Above Code is working fine in Linux but not in windows because of 'xterm'


问:
Changing cursor in SpiteKit
Is there a way to change cursor for a custom in SpriteKit?

I've tried with NSImage, but nowadays there's no way to implement it in SpriteKit.

```<code>   if let image = NSImage(named:NSImage.Name("cursorImage.png") {
            print("\(image.size)")
        }
</code>```

Title: Changing cursor in SpiteKit

Body:
Is there a way to change cursor for a custom in SpriteKit?

I've tried with NSImage, but nowadays there's no way to implement it in SpriteKit.

   if let image = NSImage(named:NSImage.Name("cursorImage.png") {
            print("\(image.size)")
        }


问:
Openssl Configuration on Windows nmake error
I'm trying to install openssl 3.0.7 on Windows with perl. I'm using Micorsoft visual studio 2022
And I'm getting this error with nmake:

OpenSSL_3.0.7\openssl-openssl-3.0.7\include\openssl/crypto.h(25): fatal error C1083: Can't Open thsi file include : 'stdlib.h' : No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\cl.EXE"' : code retour '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\nmake.exe"' : code retour '0x2'

Can Someone Help me?


问:
Get example file from doctest by path
I have some doctests in my sphinx documentation, outside the package. For those documentation examples, I would like to use file paths which don't confuse the documentation reader, so ideally I would like to include some example files in the docs/ folder and access them from my doctests.

```<code>docs/
  example_for_module_including_doctest.rst
  example_data/
    example.json
src/
  my_package/
    __init__.py
    module.py
tests/
  test_module.py
pyproject.toml
</code>```

Obviously, as the working directory of a test runner (pytest, tox) changes, the relative path to docs/example_data/example.json changes, and an absolute path is also not a solution. If this was a Python file, I could get its location by the magic __file__ variable and then find the example data using pathlib.Path(__file__).parent / "example_data/example.json" (but inside the doctest, __file__ is not defined), and if I was willing to stuff my example data into the package, I could use with importlib.resources.path("my_package", "example.json"). But I would prefer not to do that.

How can I ‘know myself’ inside a doctest reST file?

Title: Get example file from doctest by path

Body:
I have some doctests in my sphinx documentation, outside the package. For those documentation examples, I would like to use file paths which don't confuse the documentation reader, so ideally I would like to include some example files in the docs/ folder and access them from my doctests.

docs/
  example_for_module_including_doctest.rst
  example_data/
    example.json
src/
  my_package/
    __init__.py
    module.py
tests/
  test_module.py
pyproject.toml

Obviously, as the working directory of a test runner (pytest, tox) changes, the relative path to docs/example_data/example.json changes, and an absolute path is also not a solution. If this was a Python file, I could get its location by the magic __file__ variable and then find the example data using pathlib.Path(__file__).parent / "example_data/example.json" (but inside the doctest, __file__ is not defined), and if I was willing to stuff my example data into the package, I could use with importlib.resources.path("my_package", "example.json"). But I would prefer not to do that.

How can I ‘know myself’ inside a doctest reST file?