问:
How to deploy freqtrade on Azure Container Instances
I want to deploy freqtrade on Azure Container Instances

What I did:

Azure Storage account

I created one "Storage account" with name "csb100320024b4ab12f".

Created one "File shares" with name "home"

Created a directory with name "user_data" and placed the configuration file there (config.json - the file for freqtrade)

Deploy container and mount volume - YAML
I created the following YAML file with name "docker-compose2.yml"

```<code>    apiVersion: '2022-09-01'
    location: West Europe
    name: test10
    properties:
      containers:
      - name: containerstest10
        properties:
          environmentVariables: []
          image: freqtradeorg/freqtrade:stable
          ports:
          - port: 80
          resources:
            requests:
              cpu: 1.0
              memoryInGB: 1.5
          volumeMounts:
          - mountPath: /home/user_data
            name: home
      osType: Linux
      restartPolicy: OnFailure
      ipAddress:
        type: Public
        ports:
          - port: 80
        dnsNameLabel: test10-test
      volumes:
      - name: home
        azureFile:
          sharename: home
          storageAccountName: csb100320024b4ab12f
          storageAccountKey: ***
    tags: {}
    type: Microsoft.ContainerInstance/freqtrade
</code>```

3) Created a container using the Azure CLI

```<code>az container create --resource-group freqtrade --file docker-compose2.yml
</code>```

As a result, I received this message

```<code>{
  "extendedLocation": null,
  "id": "/subscriptions/053eaf81-0ddb-4f40-bf4a-89259fc75ec3/resourceGroups/freqtrade/providers/Microsoft.ContainerInstance/containerGroups/test10",
  "identity": null,
  "kind": null,
  "location": "West Europe",
  "managedBy": null,
  "name": "test10",
  "plan": null,
  "properties": {
    "containers": [
      {
        "name": "containerstest10",
        "properties": {
          "environmentVariables": [],
          "image": "freqtradeorg/freqtrade:stable",
          "instanceView": {
            "currentState": {
              "detailStatus": "Completed",
              "exitCode": 0,
              "finishTime": "2022-12-16T11:47:15.349Z",
              "startTime": "2022-12-16T11:47:04.299Z",
              "state": "Terminated"
            },
            "events": [
              {
                "count": 1,
                "firstTimestamp": "2022-12-16T11:46:16Z",
                "lastTimestamp": "2022-12-16T11:46:16Z",
                "message": "pulling image \"freqtradeorg/freqtrade@sha256:8fce42919108433c1ea5920c363b6b6877f52b0756ffcd23f13360402adfc8b9\"",
                "name": "Pulling",
                "type": "Normal"
              },
              {
                "count": 1,
                "firstTimestamp": "2022-12-16T11:46:47Z",
                "lastTimestamp": "2022-12-16T11:46:47Z",
                "message": "Successfully pulled image \"freqtradeorg/freqtrade@sha256:8fce42919108433c1ea5920c363b6b6877f52b0756ffcd23f13360402adfc8b9\"",
                "name": "Pulled",
                "type": "Normal"
              },
              {
                "count": 1,
                "firstTimestamp": "2022-12-16T11:47:04Z",
                "lastTimestamp": "2022-12-16T11:47:04Z",
                "message": "Started container",
                "name": "Started",
                "type": "Normal"
              }
            ],
            "restartCount": 0
          },
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1.0,
              "memoryInGB": 1.5
            }
          },
          "volumeMounts": [
            {
              "mountPath": "/home/user_data",
              "name": "home"
            }
          ]
        }
      }
    ],
    "initContainers": [],
    "instanceView": {
      "events": [
        {
          "count": 1,
          "firstTimestamp": "2022-12-16T11:47:03.306Z",
          "lastTimestamp": "2022-12-16T11:47:03.306Z",
          "message": "Successfully mounted Azure File Volume.",
          "name": "SuccessfulMountAzureFileVolume",
          "type": "Normal"
        }
      ],
      "state": "Succeeded"
    },
    "ipAddress": {
      "autoGeneratedDomainNameLabelScope": "Unsecure",
      "dnsNameLabel": "test10-test",
      "fqdn": "test10-test.westeurope.azurecontainer.io",
      "ports": [
        {
          "port": 80
        }
      ],
      "type": "Public"
    },
    "osType": "Linux",
    "provisioningState": "Succeeded",
    "restartPolicy": "OnFailure",
    "sku": "Standard",
    "volumes": [
      {
        "azureFile": {
          "shareName": "home",
          "storageAccountName": "csb100320024b4ab12f"
        },
        "name": "home"
      }
    ]
  },
  "resourceGroup": "freqtrade",
  "sku": null,
  "tags": {},
  "type": "Microsoft.ContainerInstance/containerGroups"
}
</code>```

The error in logs:

```<code>2022-12-16 11:56:56,991 - freqtrade - INFO - freqtrade 2022.11
2022-12-16 11:56:57,615 - freqtrade.worker - INFO - Starting worker 2022.11
2022-12-16 11:56:57,616 - freqtrade.configuration.load_config - INFO - Using config: config.json ...
2022-12-16 11:56:57,616 - freqtrade.commands.trade_commands - ERROR - Config file "config.json" not found! Please create a config file or check whether it exists.
2022-12-16 11:56:57,617 - freqtrade.commands.trade_commands - ERROR - Fatal exception!
Traceback (most recent call last):
  File "/freqtrade/freqtrade/configuration/load_config.py", line 61, in load_config_file
    with open(path) if path != '-' else sys.stdin as file:
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/freqtrade/freqtrade/commands/trade_commands.py", line 18, in start_trading
    worker = Worker(args)
  File "/freqtrade/freqtrade/worker.py", line 37, in __init__
    self._init(False)
  File "/freqtrade/freqtrade/worker.py", line 50, in _init
    self._config = Configuration(self._args, None).get_config()
  File "/freqtrade/freqtrade/configuration/configuration.py", line 42, in get_config
    self.config = self.load_config()
  File "/freqtrade/freqtrade/configuration/configuration.py", line 68, in load_config
    config: Config = load_from_files(self.args.get("config", []))
  File "/freqtrade/freqtrade/configuration/load_config.py", line 101, in load_from_files
    config_tmp = load_config_file(str(file))
  File "/freqtrade/freqtrade/configuration/load_config.py", line 64, in load_config_file
    raise OperationalException(
freqtrade.exceptions.OperationalException: Config file "config.json" not found! Please create a config file or check whether it exists.
</code>```

Why is the error occurring? Why can't find the "config.json" file? Please help me to deploy freqtrade on Azure Container Instances

Body:
I want to deploy freqtrade on Azure Container Instances

What I did:

Azure Storage account

I created one "Storage account" with name "csb100320024b4ab12f".

Created one "File shares" with name "home"

Created a directory with name "user_data" and placed the configuration file there (config.json - the file for freqtrade)

Deploy container and mount volume - YAML
I created the following YAML file with name "docker-compose2.yml"

    apiVersion: '2022-09-01'
    location: West Europe
    name: test10
    properties:
      containers:
      - name: containerstest10
        properties:
          environmentVariables: []
          image: freqtradeorg/freqtrade:stable
          ports:
          - port: 80
          resources:
            requests:
              cpu: 1.0
              memoryInGB: 1.5
          volumeMounts:
          - mountPath: /home/user_data
            name: home
      osType: Linux
      restartPolicy: OnFailure
      ipAddress:
        type: Public
        ports:
          - port: 80
        dnsNameLabel: test10-test
      volumes:
      - name: home
        azureFile:
          sharename: home
          storageAccountName: csb100320024b4ab12f
          storageAccountKey: ***
    tags: {}
    type: Microsoft.ContainerInstance/freqtrade

3) Created a container using the Azure CLI

az container create --resource-group freqtrade --file docker-compose2.yml

As a result, I received this message

{
  "extendedLocation": null,
  "id": "/subscriptions/053eaf81-0ddb-4f40-bf4a-89259fc75ec3/resourceGroups/freqtrade/providers/Microsoft.ContainerInstance/containerGroups/test10",
  "identity": null,
  "kind": null,
  "location": "West Europe",
  "managedBy": null,
  "name": "test10",
  "plan": null,
  "properties": {
    "containers": [
      {
        "name": "containerstest10",
        "properties": {
          "environmentVariables": [],
          "image": "freqtradeorg/freqtrade:stable",
          "instanceView": {
            "currentState": {
              "detailStatus": "Completed",
              "exitCode": 0,
              "finishTime": "2022-12-16T11:47:15.349Z",
              "startTime": "2022-12-16T11:47:04.299Z",
              "state": "Terminated"
            },
            "events": [
              {
                "count": 1,
                "firstTimestamp": "2022-12-16T11:46:16Z",
                "lastTimestamp": "2022-12-16T11:46:16Z",
                "message": "pulling image \"freqtradeorg/freqtrade@sha256:8fce42919108433c1ea5920c363b6b6877f52b0756ffcd23f13360402adfc8b9\"",
                "name": "Pulling",
                "type": "Normal"
              },
              {
                "count": 1,
                "firstTimestamp": "2022-12-16T11:46:47Z",
                "lastTimestamp": "2022-12-16T11:46:47Z",
                "message": "Successfully pulled image \"freqtradeorg/freqtrade@sha256:8fce42919108433c1ea5920c363b6b6877f52b0756ffcd23f13360402adfc8b9\"",
                "name": "Pulled",
                "type": "Normal"
              },
              {
                "count": 1,
                "firstTimestamp": "2022-12-16T11:47:04Z",
                "lastTimestamp": "2022-12-16T11:47:04Z",
                "message": "Started container",
                "name": "Started",
                "type": "Normal"
              }
            ],
            "restartCount": 0
          },
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1.0,
              "memoryInGB": 1.5
            }
          },
          "volumeMounts": [
            {
              "mountPath": "/home/user_data",
              "name": "home"
            }
          ]
        }
      }
    ],
    "initContainers": [],
    "instanceView": {
      "events": [
        {
          "count": 1,
          "firstTimestamp": "2022-12-16T11:47:03.306Z",
          "lastTimestamp": "2022-12-16T11:47:03.306Z",
          "message": "Successfully mounted Azure File Volume.",
          "name": "SuccessfulMountAzureFileVolume",
          "type": "Normal"
        }
      ],
      "state": "Succeeded"
    },
    "ipAddress": {
      "autoGeneratedDomainNameLabelScope": "Unsecure",
      "dnsNameLabel": "test10-test",
      "fqdn": "test10-test.westeurope.azurecontainer.io",
      "ports": [
        {
          "port": 80
        }
      ],
      "type": "Public"
    },
    "osType": "Linux",
    "provisioningState": "Succeeded",
    "restartPolicy": "OnFailure",
    "sku": "Standard",
    "volumes": [
      {
        "azureFile": {
          "shareName": "home",
          "storageAccountName": "csb100320024b4ab12f"
        },
        "name": "home"
      }
    ]
  },
  "resourceGroup": "freqtrade",
  "sku": null,
  "tags": {},
  "type": "Microsoft.ContainerInstance/containerGroups"
}

The error in logs:

2022-12-16 11:56:56,991 - freqtrade - INFO - freqtrade 2022.11
2022-12-16 11:56:57,615 - freqtrade.worker - INFO - Starting worker 2022.11
2022-12-16 11:56:57,616 - freqtrade.configuration.load_config - INFO - Using config: config.json ...
2022-12-16 11:56:57,616 - freqtrade.commands.trade_commands - ERROR - Config file "config.json" not found! Please create a config file or check whether it exists.
2022-12-16 11:56:57,617 - freqtrade.commands.trade_commands - ERROR - Fatal exception!
Traceback (most recent call last):
  File "/freqtrade/freqtrade/configuration/load_config.py", line 61, in load_config_file
    with open(path) if path != '-' else sys.stdin as file:
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/freqtrade/freqtrade/commands/trade_commands.py", line 18, in start_trading
    worker = Worker(args)
  File "/freqtrade/freqtrade/worker.py", line 37, in __init__
    self._init(False)
  File "/freqtrade/freqtrade/worker.py", line 50, in _init
    self._config = Configuration(self._args, None).get_config()
  File "/freqtrade/freqtrade/configuration/configuration.py", line 42, in get_config
    self.config = self.load_config()
  File "/freqtrade/freqtrade/configuration/configuration.py", line 68, in load_config
    config: Config = load_from_files(self.args.get("config", []))
  File "/freqtrade/freqtrade/configuration/load_config.py", line 101, in load_from_files
    config_tmp = load_config_file(str(file))
  File "/freqtrade/freqtrade/configuration/load_config.py", line 64, in load_config_file
    raise OperationalException(
freqtrade.exceptions.OperationalException: Config file "config.json" not found! Please create a config file or check whether it exists.

Why is the error occurring? Why can't find the "config.json" file? Please help me to deploy freqtrade on Azure Container Instances


来源: stackexchange

问:
ResponseEntity to return String as response not working in Spring Boot with Rest controller
I am trying to return the response as string from Rest API using ResponeEntity.ok("success"). But it is throwing below error saying inbuilt StringHttpMessageConvertors not able to convert the response to appropriate format. But, when i return the string as java object it works. PaymentStatus paymentStatus = new PaymentStatus(); paymentStatus.setStatus("success"); return new ResponseEntity(paymentStatus, HttpStatus.OK);
i have included all the necessary jackson dependencies in place.

Method signature:

```<code>@RequestMapping(value = "/test",
        produces = MediaType.APPLICATION_JSON_VALUE,
        method = RequestMethod.POST)
</code>```

How to return the string as response from Spring Rest?

Error trace:at org.springframework.http.server.ServletServerHttpResponse.writeHeaders(ServletServerHttpResponse.java:130) at org.springframework.http.server.ServletServerHttpResponse.getBody(ServletServerHttpResponse.java:96) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:227) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:293) at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:219) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:135)

ContentLicense: CC BY-SA 4.0

Body:
I am trying to return the response as string from Rest API using ResponeEntity.ok("success"). But it is throwing below error saying inbuilt StringHttpMessageConvertors not able to convert the response to appropriate format. But, when i return the string as java object it works. PaymentStatus paymentStatus = new PaymentStatus(); paymentStatus.setStatus("success"); return new ResponseEntity(paymentStatus, HttpStatus.OK);
i have included all the necessary jackson dependencies in place.

Method signature:

@RequestMapping(value = "/test",
        produces = MediaType.APPLICATION_JSON_VALUE,
        method = RequestMethod.POST)

How to return the string as response from Spring Rest?

Error trace:at org.springframework.http.server.ServletServerHttpResponse.writeHeaders(ServletServerHttpResponse.java:130) at org.springframework.http.server.ServletServerHttpResponse.getBody(ServletServerHttpResponse.java:96) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:227) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:293) at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:219) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:135)


问:
Python mysql.connector select without locked rows from transactions
I'm currently working on a Project with MySQL-based Jobworkers. In order for them to fetch a new Job i ran into a problem with row locking:

On Native MySQL (ran 2 terminals and executed following):

```<code>SELECT id FROM `data` WHERE `status`=0 ORDER BY `created_at` LIMIT 20 FOR UPDATE SKIP LOCKED;
</code>```

The Select does not lock the rows what so ever (intended to be this way & what I want)

But running the exact same in Python:

```<code>import mysql.connector

class DB:
    def __init__(self):
        self.conn = mysql.connector.MySQLConnection(
            host     = "localhost",
            database = "test"
        )

-------------------------

db = DB()
cursor = db.conn.cursor()
cursor.execute("SELECT id FROM `data` WHERE `status`=0 ORDER BY `created_at` LIMIT 20 FOR UPDATE SKIP LOCKED")
</code>```

Locks all selected Rows even tho no Transaction was ever started for all other Python connections + Native selects in Terminal.

What am I missing here?
Basically all I want is a select to skip locked rows from Python.
Cheers.

Tried enabling autocommit with:

```<code>db = DB()
db.autocommit = True
</code>```

Also tried:

```<code>mysql.connector.MySQLConnection
mysql.connector.connect
</code>```

Body:
I'm currently working on a Project with MySQL-based Jobworkers. In order for them to fetch a new Job i ran into a problem with row locking:

On Native MySQL (ran 2 terminals and executed following):

SELECT id FROM `data` WHERE `status`=0 ORDER BY `created_at` LIMIT 20 FOR UPDATE SKIP LOCKED;

The Select does not lock the rows what so ever (intended to be this way & what I want)

But running the exact same in Python:

import mysql.connector

class DB:
    def __init__(self):
        self.conn = mysql.connector.MySQLConnection(
            host     = "localhost",
            database = "test"
        )

-------------------------

db = DB()
cursor = db.conn.cursor()
cursor.execute("SELECT id FROM `data` WHERE `status`=0 ORDER BY `created_at` LIMIT 20 FOR UPDATE SKIP LOCKED")

Locks all selected Rows even tho no Transaction was ever started for all other Python connections + Native selects in Terminal.

What am I missing here?
Basically all I want is a select to skip locked rows from Python.
Cheers.

Tried enabling autocommit with:

db = DB()
db.autocommit = True

Also tried:

mysql.connector.MySQLConnection
mysql.connector.connect


问:
NodeJS OracleDB connection string
I am running Oracle XE 21c in a Docker container and I can connect to it with a JDBC thin connection using the JDBC url jdbc:oracle:thin:@localhost:1521:XE using the SYSTEM account. I can also log into the terminal Docker instance and connect to the database fine.

When I try to connect to it using NodeJS OracleDB example code described here:

https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html, I cannot get the client to connect using either:

```<code>connection = await oracledb.getConnection({
      user          : "hr",
      password      : mypw
      connectString : "localhost/XEPDB1"
    });
</code>```

or

```<code>connection = await oracledb.getConnection({
          user          : "SYSTEM",
          password      : "MyPassword",
          connectString : "localhost/XE"
        });
</code>```

I get an error ORA-01017: invalid username/password; logon denied.

I can connect to Oracle XE using sqlplus either by logging into the Docker container or from the host Mac using:

sqlplus SYSTEM/Password@localhost:1521/XE

if I change the nodejs code to:

```<code>const connection = await oracledb.getConnection({
                    //user: "SYSTEM",
                    //password: "Password42",
                    //connectString: connectionURI.url
                    connectString: "SYSTEM/Password@localhost:1521/XE"
                });
</code>```

I get the error:

ORA-12154: TNS:could not resolve the connect identifier specified

Any ideas why I can connect with sqlplus but not NodeJS OracleDB?

Title: NodeJS OracleDB connection string

Body:
I am running Oracle XE 21c in a Docker container and I can connect to it with a JDBC thin connection using the JDBC url jdbc:oracle:thin:@localhost:1521:XE using the SYSTEM account. I can also log into the terminal Docker instance and connect to the database fine.

When I try to connect to it using NodeJS OracleDB example code described here:

https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html, I cannot get the client to connect using either:

connection = await oracledb.getConnection({
      user          : "hr",
      password      : mypw
      connectString : "localhost/XEPDB1"
    });

or

connection = await oracledb.getConnection({
          user          : "SYSTEM",
          password      : "MyPassword",
          connectString : "localhost/XE"
        });

I get an error ORA-01017: invalid username/password; logon denied.

I can connect to Oracle XE using sqlplus either by logging into the Docker container or from the host Mac using:

sqlplus SYSTEM/Password@localhost:1521/XE

if I change the nodejs code to:

const connection = await oracledb.getConnection({
                    //user: "SYSTEM",
                    //password: "Password42",
                    //connectString: connectionURI.url
                    connectString: "SYSTEM/Password@localhost:1521/XE"
                });

I get the error:

ORA-12154: TNS:could not resolve the connect identifier specified

Any ideas why I can connect with sqlplus but not NodeJS OracleDB?


问:
User_Authorization VueJs
How to write a condition for allowing the access to the current loggedIn user, user array which consist of teams array with set of permissions array.current loggedIn user details</p>
```<code>  {
    path: "/administration",
    name: "Administration",
    component: PageAdministration,
    meta: { requiresAuth: true,
    haveAccess:true,
      hasPermissions:[1,2,3,4,5,6,7,8,9,10,11]
  },

router.beforeEach(()=>{
 const currentUser=store.getters["auth/isCurrentUser"]

    console.log(currentUser.teams);
    currentUser.teams.forEach(element => {
      element.permissions.forEach((p)=>{
        console.log('print permissions',p.permissionType);
      // How to acccess the 'hasPermissions' from route and compare with p.permissionType??

      })
    });
})
</code>```

Title: User_Authorization VueJs

Body:
How to write a condition for allowing the access to the current loggedIn user, user array which consist of teams array with set of permissions array.current loggedIn user details

  {
    path: "/administration",
    name: "Administration",
    component: PageAdministration,
    meta: { requiresAuth: true,
    haveAccess:true,
      hasPermissions:[1,2,3,4,5,6,7,8,9,10,11]
  },

router.beforeEach(()=>{
 const currentUser=store.getters["auth/isCurrentUser"]

    console.log(currentUser.teams);
    currentUser.teams.forEach(element => {
      element.permissions.forEach((p)=>{
        console.log('print permissions',p.permissionType);
      // How to acccess the 'hasPermissions' from route and compare with p.permissionType??

      })
    });
})


问:
MS Teams Invalid tab settings provided: url while saving the customs configurableTabs
I got this above error while adding configurableTabs into teams app."Invalid tab settings provided: url". I tried to to add domain into validDomains. but still i got the same error.

I tried different ways and google it but id did not get the answer.

Manifest

```<code>{
    "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
    "manifestVersion": "1.7",
    "version": "1.2.1",
    "id": "54dg3445-34d4-dfg456-sdfsdfsd-sadfsdf",
    "packageName": "com.test.app",
    "developer": {
        "name": "test",
        "websiteUrl": "https://test.se",
        "privacyUrl": "https://test.se/test1/gdpr/",
        "termsOfUseUrl": "https://test.se"
    },
    "icons": {
        "color": "color.png",
        "outline": "outline.png"
    },
    "name": {
        "short": "Test Name",
        "full": "Test Name"
    },
    "description": {
        "short": "Handle your",
        "full": "Test NameTest NameTest NameTest NameTest NameTest NameTest NameTest NameTest NameTest Name."
    },
    "accentColor": "#EA5B0C",
    "configurableTabs": [
        {
            "configurationUrl": "https://test.se/check/config",
            "canUpdateConfiguration": true,
            "scopes": [
                "team"
            ]
        }
    ],
    "permissions": [
        "identity",
        "messageTeamMembers"
    ],
    "validDomains": [
        "test.se",
    ]
}
</code>```

config

```<code>app.getContext().then(async (context) => {
                await (window as any).microsoftTeams.app.initialize();
saveQueue = (id: any) => {
                    (window as any).microsoftTeams.pages.config.registerOnSaveHandler((saveEvent: any) => {
                        const configPromise = (window as any).microsoftTeams.pages.config.setConfig({
                            websiteUrl: "https://test.se",
                            contentUrl: `https://test.se/collaborative/${id}`,
                            entityId: "grayIconTab",
                            suggestedDisplayName: "test"
                        });
                        configPromise.
                            then((result: any) => {saveEvent.notifySuccess()}).
                            catch((error: any) => {saveEvent.notifyFailure("failure message")});
                    });
                }
})
</code>```

Body:
I got this above error while adding configurableTabs into teams app."Invalid tab settings provided: url". I tried to to add domain into validDomains. but still i got the same error.

I tried different ways and google it but id did not get the answer.

Manifest

{
    "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
    "manifestVersion": "1.7",
    "version": "1.2.1",
    "id": "54dg3445-34d4-dfg456-sdfsdfsd-sadfsdf",
    "packageName": "com.test.app",
    "developer": {
        "name": "test",
        "websiteUrl": "https://test.se",
        "privacyUrl": "https://test.se/test1/gdpr/",
        "termsOfUseUrl": "https://test.se"
    },
    "icons": {
        "color": "color.png",
        "outline": "outline.png"
    },
    "name": {
        "short": "Test Name",
        "full": "Test Name"
    },
    "description": {
        "short": "Handle your",
        "full": "Test NameTest NameTest NameTest NameTest NameTest NameTest NameTest NameTest NameTest Name."
    },
    "accentColor": "#EA5B0C",
    "configurableTabs": [
        {
            "configurationUrl": "https://test.se/check/config",
            "canUpdateConfiguration": true,
            "scopes": [
                "team"
            ]
        }
    ],
    "permissions": [
        "identity",
        "messageTeamMembers"
    ],
    "validDomains": [
        "test.se",
    ]
}

config

app.getContext().then(async (context) => {
                await (window as any).microsoftTeams.app.initialize();
saveQueue = (id: any) => {
                    (window as any).microsoftTeams.pages.config.registerOnSaveHandler((saveEvent: any) => {
                        const configPromise = (window as any).microsoftTeams.pages.config.setConfig({
                            websiteUrl: "https://test.se",
                            contentUrl: `https://test.se/collaborative/${id}`,
                            entityId: "grayIconTab",
                            suggestedDisplayName: "test"
                        });
                        configPromise.
                            then((result: any) => {saveEvent.notifySuccess()}).
                            catch((error: any) => {saveEvent.notifyFailure("failure message")});
                    });
                }
})


问:
How to set default value of Enum type property using Swagger Codegen Maven plugin
I am using swagger-codegen-maven-plugin(version 3.0.35) in my spring boot project, for generating the model classes based on the yaml files. But the auto generated model classes does not set the default value of ENUM type property and always set it as null. I tried with simple string property and there default is working correctly. Is there any known issue with swagger codegen for default value of enum type properties.

```<code>language:
  default: 'en'
  enum:
    - 'en'
    - 'fr'
    - 'it'
    - 'de'
</code>```

After running code generation

Expected

```<code>@JsonProperty("language")
private Language language = Language.EN;
</code>```

Actual

```<code>@JsonProperty("language")
private Language language = null;
</code>```

Body:
I am using swagger-codegen-maven-plugin(version 3.0.35) in my spring boot project, for generating the model classes based on the yaml files. But the auto generated model classes does not set the default value of ENUM type property and always set it as null. I tried with simple string property and there default is working correctly. Is there any known issue with swagger codegen for default value of enum type properties.

language:
  default: 'en'
  enum:
    - 'en'
    - 'fr'
    - 'it'
    - 'de'

After running code generation

Expected

@JsonProperty("language")
private Language language = Language.EN;

Actual

@JsonProperty("language")
private Language language = null;


问:
mysql quey to export specific posts with posts id and meta_key
inside wp_postmeta i need to export as CSV a table that includes all posts with meta_key="my_meta_key" and these posts should have the following post_id
5454 65654 4854 7874 45654 5654 32321 45498 54545 7787 4121 546554 88787 784987 498787 498787 87878
note that these are just demo numbers, the real case includes like 600 numbers with no orders needs to be filtered from 2000 posts

i tried to export the whole table and search for posts with required posts id this will take very long time


问:
Woocommerce: Refund amount – set to “readonly”
I need to limit refunds to full refunds (= no partial refunds). How can I set the refund amount field to readonly and automatically set it to the order amount?

I already modified

public function process_refund($order_id, $amount = NULL, $reason = '') {

in several ways but I was unable to achieve a success.

Any ideas?


问:
Unable to fetch data using select query
I have used GCP cloud SQL with dailogflow CX there is one table QuestionPageMapping_test it stored all   padeId and FlowID of questions that asked by bot. It is used for redo activity. If user wants to go back to any question then user can select that question according to that question select query will fetch  pageID of that question and user can start their conversation from that question again. But select query does not work properly at some instance.It work for some questions.

```<code>option=r=re.sub(r'[^\w\s]', ' ', option)
    connection2 = connector.connect(os.environ['DB_Instance_Name'],"pymysql",database='bot_info',user="root",password=os.environ['DB_Password'])
    cursor2 = connection2.cursor(pymysql.cursors.DictCursor)
    query1= f"select * from QuestionPageMapping_test where  questions ='{option}'"
    print(query1)
    cursor2.execute(query1)
    rows = cursor2.fetchall()
    print(rows)
    for row in rows:
      global option2
      option2=row["pageId"]
    connection2.close()
    query="set @row_number=0;"
    cursor.execute(query)
    query = f"select * FROM (select *,(@row_number:=@row_number + 1) AS R_NUM from {session_id} order by timestamp) as a1 where pageId='{option2}'"
    print(query)
</code>```

I tried this code,in that option variable is used for to store question that is present at dailoflow cx's  page. when select query fail then rows is empty that is why it is not entering into for loop and because of that I am getting NameError: name 'option2' is not defined" for next query.
(https://i.stack.imgur.com/559BB.png)

Title: Unable to fetch data using select query

Body:
I have used GCP cloud SQL with dailogflow CX there is one table QuestionPageMapping_test it stored all   padeId and FlowID of questions that asked by bot. It is used for redo activity. If user wants to go back to any question then user can select that question according to that question select query will fetch  pageID of that question and user can start their conversation from that question again. But select query does not work properly at some instance.It work for some questions.

option=r=re.sub(r'[^\w\s]', ' ', option)
    connection2 = connector.connect(os.environ['DB_Instance_Name'],"pymysql",database='bot_info',user="root",password=os.environ['DB_Password'])
    cursor2 = connection2.cursor(pymysql.cursors.DictCursor)
    query1= f"select * from QuestionPageMapping_test where  questions ='{option}'"
    print(query1)
    cursor2.execute(query1)
    rows = cursor2.fetchall()
    print(rows)
    for row in rows:
      global option2
      option2=row["pageId"]
    connection2.close()
    query="set @row_number=0;"
    cursor.execute(query)
    query = f"select * FROM (select *,(@row_number:=@row_number + 1) AS R_NUM from {session_id} order by timestamp) as a1 where pageId='{option2}'"
    print(query)

I tried this code,in that option variable is used for to store question that is present at dailoflow cx's  page. when select query fail then rows is empty that is why it is not entering into for loop and because of that I am getting NameError: name 'option2' is not defined" for next query.
(https://i.stack.imgur.com/559BB.png)


问:
Django template is rendering in Multi-step form, but context data is not visible
I am working on this problem and somehow resolved it to a very great extent and almost everything is done. But the Django is rendering my template but not the Context.
I don't know why I have checked it by debugging and my context is rendering but not showing in frontend.

On this template, there is a form with 4 fieldset , I am submitting data in 1st fieldset and the dynamically show o/p accordingly on the second fieldset.
I am attaching screenshot to show what is rendering in template(2nd fieldset)

edit:
I have debugged this and in code all is working fine but it is not showing up in fornt-end, I dont know why

#views.py

def createQuotePage(request):
    if request.method == "POST":
    # Getting all the value

    # saving in Table
 saveInUnitsTable(-------some code, removed to shorten question ------)

 saveInCustomerTable(-------some code, removed to shorten question ------)

 saveInInquiryTable(-------some code, removed to shorten question ------)

        flight_suggestions =Flight.objects.filter(sourceairportid=1,destinationairportid=51)
        context = {'flight_suggestions':flight_suggestions,"test":"99999999999999999999999999999999999999"}
        return render(request,"Freight/create_quote.html",context=context) # <-- here is the PROBLEM

    if request.method == "GET":
        print("========================GET=======================")
        context = {'airport_data' : list(Airport.objects.all()),
                    'commodity_data':list(Commodity.objects.all()),
                    'customerType_data':list(Entity.objects.all()),
                    }
        return render(request,"Freight/create_quote.html",context=context)
```
<p>#scripts.js</p>
<pre class="lang-js prettyprint-override"><code>(function($) {
    "use strict";
    $.backstretch;
    $('#top-navbar-1').on('shown.bs.collapse', function(){
        $.backstretch("resize");
    });
    $('#top-navbar-1').on('hidden.bs.collapse', function(){
        $.backstretch("resize");
    });
    $('.f1 fieldset:first').fadeIn('slow');

    $('.f1 .btn-next').on('click', function() {
        //
        var parent_fieldset = $(this).parents('fieldset');
        var next_step = true;
        var current_active_step = $(this).parents('.f1').find('.f1-step.active');
        var progress_line = $(this).parents('.f1').find('.f1-progress-line');
        //
        var formData1 = $("#total-shipment-form").serialize();
        var formData2 = $("#units-form").serialize();
        var formData3 = $("#customerDetailForm").serialize();
        var formData4 = $("#firstFieldset").serialize();
        var formData = formData1 + '&' +
                        formData2 + '&' +
                        formData3 + '&' +
                        formData4

        $.post("",formData)
        .done(function(){
            //
            console.log('Success : ');
            // var parent_fieldset = $(this).parents('fieldset');
            // var next_step = true;
            // var current_active_step = $(this).parents('.f1').find('.f1-step.active');
            // var progress_line = $(this).parents('.f1').find('.f1-progress-line');
            if( next_step ) {
                parent_fieldset.fadeOut(400, function() {
                    current_active_step.removeClass('active').addClass('activated').next().addClass('active');
                    bar_progress(progress_line, 'right');
                    $(this).next().fadeIn();
                    scroll_to_class( $('.f1'), 20 );
                });
            }
            //
        })
        .fail(function(){
            console.log('Error : ');
        });
    });
</code>```

Edited:-

Html template

                                        <fieldset id="secondFieldset">

                                                <input class="form-check-input" type="checkbox" value=""
                                                    id="select_all">
                                                Select All

                                            {{test}}

                                                {{test}}

                                                {% for flight in flight_suggestions %}

                                                            <input class="form-check-input" type="checkbox" value=""
                                                                id="flexCheckDefault">

{{flight.flightcompany}}

Air Freight

{{flight.sourceairportid.airportname}}

{{flight.sourceairportid.cityid.cityname}}

{{flight.destinationairportid.airportname}}

{{flight.destinationairportid.cityid.cityname}}

                                                                Transit Time

-- Hrs

{{flight.trasittime}} Hrs

Past Reference

Buy Rate

Sell Rate

USD 5,500.00

USD 7,000.00

 70%
                                                        Winnning Probabilty

                                                {% endfor %}

                                                <button class="btn btn-primary btn-next" type="button">Request Better
                                                    Rates</button>

                                        </fieldset>

```

Body:
I am working on this problem and somehow resolved it to a very great extent and almost everything is done. But the Django is rendering my template but not the Context.
I don't know why I have checked it by debugging and my context is rendering but not showing in frontend.

On this template, there is a form with 4 fieldset , I am submitting data in 1st fieldset and the dynamically show o/p accordingly on the second fieldset.
I am attaching screenshot to show what is rendering in template(2nd fieldset)

edit:
I have debugged this and in code all is working fine but it is not showing up in fornt-end, I dont know why

#views.py

def createQuotePage(request):
    if request.method == "POST":
    # Getting all the value

    # saving in Table
 saveInUnitsTable(-------some code, removed to shorten question ------)

 saveInCustomerTable(-------some code, removed to shorten question ------)

 saveInInquiryTable(-------some code, removed to shorten question ------)

        flight_suggestions =Flight.objects.filter(sourceairportid=1,destinationairportid=51)
        context = {'flight_suggestions':flight_suggestions,"test":"99999999999999999999999999999999999999"}
        return render(request,"Freight/create_quote.html",context=context) # <-- here is the PROBLEM

    if request.method == "GET":
        print("========================GET=======================")
        context = {'airport_data' : list(Airport.objects.all()),
                    'commodity_data':list(Commodity.objects.all()),
                    'customerType_data':list(Entity.objects.all()),
                    }
        return render(request,"Freight/create_quote.html",context=context)

#scripts.js

(function($) {
    "use strict";
    $.backstretch;
    $('#top-navbar-1').on('shown.bs.collapse', function(){
        $.backstretch("resize");
    });
    $('#top-navbar-1').on('hidden.bs.collapse', function(){
        $.backstretch("resize");
    });
    $('.f1 fieldset:first').fadeIn('slow');

    $('.f1 .btn-next').on('click', function() {
        //
        var parent_fieldset = $(this).parents('fieldset');
        var next_step = true;
        var current_active_step = $(this).parents('.f1').find('.f1-step.active');
        var progress_line = $(this).parents('.f1').find('.f1-progress-line');
        //
        var formData1 = $("#total-shipment-form").serialize();
        var formData2 = $("#units-form").serialize();
        var formData3 = $("#customerDetailForm").serialize();
        var formData4 = $("#firstFieldset").serialize();
        var formData = formData1 + '&' +
                        formData2 + '&' +
                        formData3 + '&' +
                        formData4

        $.post("",formData)
        .done(function(){
            //
            console.log('Success : ');
            // var parent_fieldset = $(this).parents('fieldset');
            // var next_step = true;
            // var current_active_step = $(this).parents('.f1').find('.f1-step.active');
            // var progress_line = $(this).parents('.f1').find('.f1-progress-line');
            if( next_step ) {
                parent_fieldset.fadeOut(400, function() {
                    current_active_step.removeClass('active').addClass('activated').next().addClass('active');
                    bar_progress(progress_line, 'right');
                    $(this).next().fadeIn();
                    scroll_to_class( $('.f1'), 20 );
                });
            }
            //
        })
        .fail(function(){
            console.log('Error : ');
        });
    });

Edited:-

Html template

                                        <fieldset id="secondFieldset">

                                                <input class="form-check-input" type="checkbox" value=""
                                                    id="select_all">
                                                Select All

                                            {{test}}

                                                {{test}}

                                                {% for flight in flight_suggestions %}

                                                            <input class="form-check-input" type="checkbox" value=""
                                                                id="flexCheckDefault">

{{flight.flightcompany}}

Air Freight

{{flight.sourceairportid.airportname}}

{{flight.sourceairportid.cityid.cityname}}

{{flight.destinationairportid.airportname}}

{{flight.destinationairportid.cityid.cityname}}

                                                                Transit Time

-- Hrs

{{flight.trasittime}} Hrs

Past Reference

Buy Rate

Sell Rate

USD 5,500.00

USD 7,000.00

 70%
                                                        Winnning Probabilty

                                                {% endfor %}

                                                <button class="btn btn-primary btn-next" type="button">Request Better
                                                    Rates</button>

                                        </fieldset>


问:
Server can not be found using Laravel Valet
I have followed the instructions to install Laravel Valet. No errors during installation and when pinging foo.test it seems to work:

64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.079 ms

Have linked a folder with valet link and secured it. But when trying in the browser I get the "Server not found..." error. But, pinging it works(?):

PING produktbild.test (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.078 ms

Have installed and restarted Valet several times. The output from brew services list is:

```<code>valet restart
Restarting dnsmasq...
Restarting php...
Restarting nginx...
Valet services have been restarted.

brew services list
Name       Status     User File
dnsmasq    error  512 root ~/Library/LaunchAgents/homebrew.mxcl.dnsmasq.plist
nginx      none       root
opensearch none
php        none       root
</code>```

Why is it a "error" status for dnsmasq and "none" on nginx? And most important, how to solve it?

ADDED 1: I previously had MAMP Pro installed. It is uninstalled and settings reverted - I think...

/Magnus

Body:
I have followed the instructions to install Laravel Valet. No errors during installation and when pinging foo.test it seems to work:

64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.079 ms

Have linked a folder with valet link and secured it. But when trying in the browser I get the "Server not found..." error. But, pinging it works(?):

PING produktbild.test (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.078 ms

Have installed and restarted Valet several times. The output from brew services list is:

valet restart
Restarting dnsmasq...
Restarting php...
Restarting nginx...
Valet services have been restarted.

brew services list
Name       Status     User File
dnsmasq    error  512 root ~/Library/LaunchAgents/homebrew.mxcl.dnsmasq.plist
nginx      none       root
opensearch none
php        none       root

Why is it a "error" status for dnsmasq and "none" on nginx? And most important, how to solve it?

ADDED 1: I previously had MAMP Pro installed. It is uninstalled and settings reverted - I think...

/Magnus


问:
Why in OpenCl when I used pipe using two kernels (producer and consumer) input and output arrays values is interchanged
here is my kernel code
Producer Kernel writing input data  into Pipe using pipeWrite function

```<code>__kernel
void pipeWrite(
                __global int *src,
                __write_only pipe int out_pipe)
{
        int gid = get_global_id(0);

        reserve_id_t res_id;
        res_id = reserve_write_pipe(out_pipe, 1);

        if(is_valid_reserve_id(res_id))
        {
                if(write_pipe(out_pipe, res_id, 0, &src[gid]) != 0)
                {
                        return;
                }
                commit_write_pipe(out_pipe, res_id);
        }
}
</code>```

Consumer Kernel reading input data from Pipe using pipeRead function

```<code>__kernel
void pipeRead(
                __read_only pipe int in_pipe,
                __global int *dst)
{
        int gid = get_global_id(0);

        reserve_id_t res_id;
        res_id = reserve_read_pipe(in_pipe, 1);

        if(is_valid_reserve_id(res_id))
        {
                if(read_pipe(in_pipe, res_id, 0, &dst[gid]) != 0)
                {
                        return;
                }
                commit_read_pipe(in_pipe, res_id);
        }
}
</code>```

GPU info

```<code>  Max compute units                               11
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                32
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1900MHz
  Graphics IP (AMD)                               10.1
  Device Partition                                (core)
    Max number of sub-devices                     11
    Supported partition types                     None
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Compiler Available                              Yes
  Linker Available                                Yes
  Preferred work group size multiple              32
  Wavefront width (AMD)                           32
</code>```

but values is ok when I use global size 32 (64) local size 32 (64)
which I guess connected with wavefront which is 32.
My question is how I can get output array which values match with input values.

Body:
here is my kernel code
Producer Kernel writing input data  into Pipe using pipeWrite function

__kernel
void pipeWrite(
                __global int *src,
                __write_only pipe int out_pipe)
{
        int gid = get_global_id(0);

        reserve_id_t res_id;
        res_id = reserve_write_pipe(out_pipe, 1);

        if(is_valid_reserve_id(res_id))
        {
                if(write_pipe(out_pipe, res_id, 0, &src[gid]) != 0)
                {
                        return;
                }
                commit_write_pipe(out_pipe, res_id);
        }
}

Consumer Kernel reading input data from Pipe using pipeRead function

__kernel
void pipeRead(
                __read_only pipe int in_pipe,
                __global int *dst)
{
        int gid = get_global_id(0);

        reserve_id_t res_id;
        res_id = reserve_read_pipe(in_pipe, 1);

        if(is_valid_reserve_id(res_id))
        {
                if(read_pipe(in_pipe, res_id, 0, &dst[gid]) != 0)
                {
                        return;
                }
                commit_read_pipe(in_pipe, res_id);
        }
}

GPU info

  Max compute units                               11
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                32
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1900MHz
  Graphics IP (AMD)                               10.1
  Device Partition                                (core)
    Max number of sub-devices                     11
    Supported partition types                     None
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Compiler Available                              Yes
  Linker Available                                Yes
  Preferred work group size multiple              32
  Wavefront width (AMD)                           32

but values is ok when I use global size 32 (64) local size 32 (64)
which I guess connected with wavefront which is 32.
My question is how I can get output array which values match with input values.


问:
Technical menu to rename create and delete a folder
I created this Technical menu after asking a previous question for help Which is from here (How to add a Function inside a function). Im just asking today if anyone can think of making this more efficient and smaller.

```<code>cls
function rename
{

write-host "------------------------------------

Where Do You Want To Rename a Folder?:

A. Documents
B. Pictures
C. Downloads
"

$choice = read-host "Please Choose A Directory Location"

switch($choice)

{
"A" {cd ~/Documents;$valid = $true}
"B" {cd ~/Pictures;$valid = $true}
"C" {cd ~/Downloads;$valid = $true}
default {"
";$valid = $false}
}

while ($valid -eq $false)
{ if ($valid -eq $true){Break}
}

ls
$name = read-host "
What Folder Do You Want To Rename"

$newname = read-host "Enter The New Folder Name"

Rename-Item $name -NewName $newname

write-host "------------------------------------"
write-host "Refreshed Directory: ------------------------------------"
ls
write-host "------------------------------------"
write-host " $name Has Been Renamed To $newname"}

function remove
{
write-host "
------------------------------------
What Directory Do You Want To Delete A Folder?:

A. Documents
B. Pictures
C. Downloads
"
$choice = read-host "Please Choose A Directory Location"
switch($choice)
{

"A" {cd ~/Documents;$valid = $true}
"B" {cd ~/Pictures;$valid = $true}
"C" {cd ~/Downloads;$valid = $true}
default {"
";$valid = $false}
}

while ($valid -eq $false){

if ($valid -eq $true){Break}
}

ls

$name = read-host "What Folder Do You Want To Delete"

Remove-Item $name
write-host "------------------------------------"
write-host "Refreshed Directory: ------------------------------------"
ls
write-host "------------------------------------"
write-host " $name Has Been Deleted"}

function create
{
write-host "------------------------------------
Where Do You Want To Rename A New Folder?:

A. Documents
B. Pictures
C. Downloads"

$choice = read-host "Please Choose A Directory Location"

switch($choice)
{
"A" {cd ~/Documents;$valid = $true}
"B" {cd ~/Pictures;$valid = $true}
"C" {cd ~/Downloads;$valid = $true}
default {"
";$valid = $false}
}
while ($valid -eq $false){
if ($valid -eq $true){Break}
}
ls

$name = read-host "
What Is The Name Of The Folder You Want to create"

New-Item $name

write-host "------------------------------------"
write-host "Refreshed Directory: ------------------------------------"

ls

write-host "------------------------------------"
write-host " $name Has Been Created!"
}

function Show-Menu
{

    param(
        [string]$Title = 'Directory Technical Menu'
    )
    cls
    Write-Host "========== $Title =========="
    Write-Host "1. Rename a Directory"
    Write-Host "2. Create a New Directory"
    Write-Host "3. Delete a Directory"
    Write-Host "4. Press 'Q or q' to quit"
}

do
 {
    Show-Menu
    $condition = $flase
    $selection = Read-Host "Please Choose an Option"
    switch ($selection)
    {
        '1' {
                rename
       } '2' {
                create
       } '3' {
                remove
       }
    }
 pause
}
until ($selection -eq 'q')
</code>```

The code works perfectly to what i need it to do, was just trying to find a way to make it smaller and more efficient

Body:
I created this Technical menu after asking a previous question for help Which is from here (How to add a Function inside a function). Im just asking today if anyone can think of making this more efficient and smaller.

cls
function rename
{

write-host "------------------------------------

Where Do You Want To Rename a Folder?:

A. Documents
B. Pictures
C. Downloads
"

$choice = read-host "Please Choose A Directory Location"

switch($choice)

{
"A" {cd ~/Documents;$valid = $true}
"B" {cd ~/Pictures;$valid = $true}
"C" {cd ~/Downloads;$valid = $true}
default {"
";$valid = $false}
}

while ($valid -eq $false)
{ if ($valid -eq $true){Break}
}

ls
$name = read-host "
What Folder Do You Want To Rename"

$newname = read-host "Enter The New Folder Name"

Rename-Item $name -NewName $newname

write-host "------------------------------------"
write-host "Refreshed Directory: ------------------------------------"
ls
write-host "------------------------------------"
write-host " $name Has Been Renamed To $newname"}

function remove
{
write-host "
------------------------------------
What Directory Do You Want To Delete A Folder?:

A. Documents
B. Pictures
C. Downloads
"
$choice = read-host "Please Choose A Directory Location"
switch($choice)
{

"A" {cd ~/Documents;$valid = $true}
"B" {cd ~/Pictures;$valid = $true}
"C" {cd ~/Downloads;$valid = $true}
default {"
";$valid = $false}
}

while ($valid -eq $false){

if ($valid -eq $true){Break}
}

ls

$name = read-host "What Folder Do You Want To Delete"

Remove-Item $name
write-host "------------------------------------"
write-host "Refreshed Directory: ------------------------------------"
ls
write-host "------------------------------------"
write-host " $name Has Been Deleted"}

function create
{
write-host "------------------------------------
Where Do You Want To Rename A New Folder?:

A. Documents
B. Pictures
C. Downloads"

$choice = read-host "Please Choose A Directory Location"

switch($choice)
{
"A" {cd ~/Documents;$valid = $true}
"B" {cd ~/Pictures;$valid = $true}
"C" {cd ~/Downloads;$valid = $true}
default {"
";$valid = $false}
}
while ($valid -eq $false){
if ($valid -eq $true){Break}
}
ls

$name = read-host "
What Is The Name Of The Folder You Want to create"

New-Item $name

write-host "------------------------------------"
write-host "Refreshed Directory: ------------------------------------"

ls

write-host "------------------------------------"
write-host " $name Has Been Created!"
}

function Show-Menu
{

    param(
        [string]$Title = 'Directory Technical Menu'
    )
    cls
    Write-Host "========== $Title =========="
    Write-Host "1. Rename a Directory"
    Write-Host "2. Create a New Directory"
    Write-Host "3. Delete a Directory"
    Write-Host "4. Press 'Q or q' to quit"
}

do
 {
    Show-Menu
    $condition = $flase
    $selection = Read-Host "Please Choose an Option"
    switch ($selection)
    {
        '1' {
                rename
       } '2' {
                create
       } '3' {
                remove
       }
    }
 pause
}
until ($selection -eq 'q')

The code works perfectly to what i need it to do, was just trying to find a way to make it smaller and more efficient


问:
Jetpack Compose - SnapshotStateList<T>.clear() of a ViewModel does not worl after a switch to another screen - Error: java.util.NoSuchElementException
Currently i am trying to lern Jetpack Compose. For one part of the App I want to use oen ViewModel for multiple Screens. But the problem described below occures.

I have the following ViewModel:

```<code>
class NewRoomViewModel : ViewModel() {

    private val _floorPlan = mutableStateListOf<FloorPlanWall>()
    var floorPlan: SnapshotStateList<FloorPlanWall> = _floorPlan

    /* ... */

</code>```

In the first screen new elements are added to the list.
In the next screen I want to call newRoomViewModel.floorplan.clear(), but I get the following error: java.util.NoSuchElementException

Both screen fragments access the same instance of the obeject. It is decleared as

```<code>private val newRoomViewModel : NewRoomViewModel by viewModels()
</code>```

in the MainActivity and passed via the NavGraph to the fragments.
It is also possible to delet single Elements of the list.

PS: Sorry for my bad englisch and if my problem is unclear. I can provide more code.

I tried ti find the source of the problem and the only thing I can say certain is that the list cant be cleared after navigating to the next Screen.

For more context my NavGraph look like this:

```<code>@Composable
fun SetupNavGraph(navController: NavHostController, newRoomViewModel : NewRoomViewModel){
    NavHost(
        navController = navController,
        startDestination = Screen.Start.route
    ){
        /* ... */

        composable(
            route = Screen.NewRoom2.route
        ){
            NewRoom2Fragment(navController = navController, newRoomViewModel = newRoomViewModel)
        }
        composable(
            route = Screen.NewRoom3.route
        ){
            NewRoom3Fragment(navController = navController, newRoomViewModel = newRoomViewModel)
        }

    }
}
</code>```

And the screen switch looks like this:

```<code>navController.navigate(route = Screen.NewRoom3.route)
</code>```

Body:
Currently i am trying to lern Jetpack Compose. For one part of the App I want to use oen ViewModel for multiple Screens. But the problem described below occures.

I have the following ViewModel:

class NewRoomViewModel : ViewModel() {

    private val _floorPlan = mutableStateListOf<FloorPlanWall>()
    var floorPlan: SnapshotStateList<FloorPlanWall> = _floorPlan

    /* ... */

In the first screen new elements are added to the list.
In the next screen I want to call newRoomViewModel.floorplan.clear(), but I get the following error: java.util.NoSuchElementException

Both screen fragments access the same instance of the obeject. It is decleared as

private val newRoomViewModel : NewRoomViewModel by viewModels()

in the MainActivity and passed via the NavGraph to the fragments.
It is also possible to delet single Elements of the list.

PS: Sorry for my bad englisch and if my problem is unclear. I can provide more code.

I tried ti find the source of the problem and the only thing I can say certain is that the list cant be cleared after navigating to the next Screen.

For more context my NavGraph look like this:

@Composable
fun SetupNavGraph(navController: NavHostController, newRoomViewModel : NewRoomViewModel){
    NavHost(
        navController = navController,
        startDestination = Screen.Start.route
    ){
        /* ... */

        composable(
            route = Screen.NewRoom2.route
        ){
            NewRoom2Fragment(navController = navController, newRoomViewModel = newRoomViewModel)
        }
        composable(
            route = Screen.NewRoom3.route
        ){
            NewRoom3Fragment(navController = navController, newRoomViewModel = newRoomViewModel)
        }

    }
}

And the screen switch looks like this:

navController.navigate(route = Screen.NewRoom3.route)


问:
How to compare plain array with array of object in JavaScript
I wanted the result like "11" only , i wanted to compare array of object with plain array
whenever am trying to use filter it's show blank result. wanted to avoid map or loops. if that possible with filters only.

```<code> const rows2 = [{
    userId: "a8c26932-2393-4aac-ba03-1314860110c9",
  },
  {
    userId: "4a6fe3d6-8ff1-4488-b7bd-15b033ffa4d1",
  }
]

const arr2 = ["4a6fe3d6-8ff1-4488-b7bd-15b033ffa4d1", "a8c26932-2393-4aac-ba03-1314860110c9", "11"];
</code>```

// expected result : 11

Body:
I wanted the result like "11" only , i wanted to compare array of object with plain array
whenever am trying to use filter it's show blank result. wanted to avoid map or loops. if that possible with filters only.

 const rows2 = [{
    userId: "a8c26932-2393-4aac-ba03-1314860110c9",
  },
  {
    userId: "4a6fe3d6-8ff1-4488-b7bd-15b033ffa4d1",
  }
]

const arr2 = ["4a6fe3d6-8ff1-4488-b7bd-15b033ffa4d1", "a8c26932-2393-4aac-ba03-1314860110c9", "11"];

// expected result : 11


问:
Flutter ColorFilter to invert brightness of a widget / image
currently tried the following filter to invert my picture from light to dark theme.

```<code>ColorFiltered(
  colorFilter: const ColorFilter.mode(
    Colors.white,
    BlendMode.difference,
  ),
  child: Container(
    color: Colors.white,
    child: Text('Invert Me'),
  ),
),
</code>```

and

```<code>    const ColorFilter invert = ColorFilter.matrix(<double>[
    -1,  0,  0, 0, 255,
     0, -1,  0, 0, 255,
     0,  0, -1, 0, 255,
     0,  0,  0, 1,   0,
  ]);
</code>```

unfortunately both also change the color tone.
is it possible to invert only the brightness of an widget / image with Colorfilter?

Body:
currently tried the following filter to invert my picture from light to dark theme.

ColorFiltered(
  colorFilter: const ColorFilter.mode(
    Colors.white,
    BlendMode.difference,
  ),
  child: Container(
    color: Colors.white,
    child: Text('Invert Me'),
  ),
),

and

    const ColorFilter invert = ColorFilter.matrix(<double>[
    -1,  0,  0, 0, 255,
     0, -1,  0, 0, 255,
     0,  0, -1, 0, 255,
     0,  0,  0, 1,   0,
  ]);

unfortunately both also change the color tone.
is it possible to invert only the brightness of an widget / image with Colorfilter?


问:
How to add Python software pre-requisites
I have built my first Python software and made an executable (.exe) file using Pyinstaller. I let my friends to test my software but it did not run on their end because it requires vcredist 2013.

How can I add vcredist 2013 as a pre-requisite of my software? Or how I able to install vcredist alongside with my software (is it possible?).


问:
Spring Security: How to handle a User object with lazy-loaded JPA fields during authentication?
I'm working on a Spring Boot application with spring-data-jpa (hibernate) and spring security. My user object looks like this:

@Entity(name = "User")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public User implements UserDetails {

   @Id
   @Column(name = "ID", nullable = false, unique = true)
   private UUID id;

   @Column(name = "username", nullable = false, unique = true)
   private String username;

   @Column(name = "passwordHash", nullable = false)
   private String passwordHash;

   @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
   @ManyToMany(fetch = FetchType.EAGER)
   @JoinTable(
      name = "User_Roles",
      joinColumns = [JoinColumn(name = "User_ID")],
      inverseJoinColumns = [JoinColumn(name = "Role_ID")]
   )
   private Set<Role> roles;

   // constructor, getters, setters
   // hashCode() & equals() based on id
}
```

This object is fetched in our AuthenticationServletFilter and subsequently stored in the SecurityContext. As you can see, the roles collection is currently fetched in an eager fashion. The Role itself consists of ID and a name.

I'm now faced with the following issue:

Since authentication happens on every request, I need to use the Hibernate Second-Level Cache to cache the user objects.

Hibernate seems to refuse to do that because of the eagerly loaded roles field. In the debug logs, I can see SQL queries which fetch the user object again and again for every authentication.

Loading the roles in a lazy fashion is difficult, because it means that the processing which occurs in the AuthenticationServletFilter would have to be @Transactional. If it's not, any code which accesses user.roles from the SecurityContext later on will receive a LazyInitializationException. But marking a request filter as @Transactional feels wrong from a software architecture point of view.

What's the standard course of action for a situation like this? I could imagine that this is a pretty standard scenario.

I tried to make the roles collection lazy-loaded, but that resulted in LazyInitializationExceptions later down the line. Having it loaded eagerly fixes that, but seems to prevent the hibernate second level cache from caching and/or reusing the user object. Marking the AuthenticationServletFilter as @Transactional feels wrong.

Body:
I'm working on a Spring Boot application with spring-data-jpa (hibernate) and spring security. My user object looks like this:

@Entity(name = "User")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public User implements UserDetails {

   @Id
   @Column(name = "ID", nullable = false, unique = true)
   private UUID id;

   @Column(name = "username", nullable = false, unique = true)
   private String username;

   @Column(name = "passwordHash", nullable = false)
   private String passwordHash;

   @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
   @ManyToMany(fetch = FetchType.EAGER)
   @JoinTable(
      name = "User_Roles",
      joinColumns = [JoinColumn(name = "User_ID")],
      inverseJoinColumns = [JoinColumn(name = "Role_ID")]
   )
   private Set<Role> roles;

   // constructor, getters, setters
   // hashCode() & equals() based on id
}

This object is fetched in our AuthenticationServletFilter and subsequently stored in the SecurityContext. As you can see, the roles collection is currently fetched in an eager fashion. The Role itself consists of ID and a name.

I'm now faced with the following issue:

Since authentication happens on every request, I need to use the Hibernate Second-Level Cache to cache the user objects.

Hibernate seems to refuse to do that because of the eagerly loaded roles field. In the debug logs, I can see SQL queries which fetch the user object again and again for every authentication.

Loading the roles in a lazy fashion is difficult, because it means that the processing which occurs in the AuthenticationServletFilter would have to be @Transactional. If it's not, any code which accesses user.roles from the SecurityContext later on will receive a LazyInitializationException. But marking a request filter as @Transactional feels wrong from a software architecture point of view.

What's the standard course of action for a situation like this? I could imagine that this is a pretty standard scenario.

I tried to make the roles collection lazy-loaded, but that resulted in LazyInitializationExceptions later down the line. Having it loaded eagerly fixes that, but seems to prevent the hibernate second level cache from caching and/or reusing the user object. Marking the AuthenticationServletFilter as @Transactional feels wrong.


问:
Images in DatagridView - Path Source - c#/forms
I Want add images to my dataGridView columns, but i cant find the way to reference my image, or .ico inside of my project.

how i do this reference to inside the project, the path. I want generate my dll with my images.

Example:

```<code>private void createGraphicsColumn()
{
Icon treeIcon = new Icon(this.GetType(), “????????”); // this dude
DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
iconColumn.Image = treeIcon.ToBitmap();
iconColumn.Name = “Tree”;
iconColumn.HeaderText = “Nice tree”;
dataGridView1.Columns.Insert(2, iconColumn);
}
</code>```

https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-display-images-in-cells-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8

i tried a Directory.GetCurrentDirectory(), but they only catch the global path of the desktop. i want reference my project, without pass thrgouth the windows path.

Body:
I Want add images to my dataGridView columns, but i cant find the way to reference my image, or .ico inside of my project.

how i do this reference to inside the project, the path. I want generate my dll with my images.

Example:

private void createGraphicsColumn()
{
Icon treeIcon = new Icon(this.GetType(), “????????”); // this dude
DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
iconColumn.Image = treeIcon.ToBitmap();
iconColumn.Name = “Tree”;
iconColumn.HeaderText = “Nice tree”;
dataGridView1.Columns.Insert(2, iconColumn);
}

https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-display-images-in-cells-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8

i tried a Directory.GetCurrentDirectory(), but they only catch the global path of the desktop. i want reference my project, without pass thrgouth the windows path.


问:
How do I get other sites to the IP address assigned?
I use the phone (android2.2) to create a wifi hotspot. When connected to other devices come in, how do I get the IP address assigned to it.

A mobile phone become a hotspot, other mobile phone connect with it.
And how do i get the device's IP address?

ContentLicense: CC BY-SA 3.0


问:
C# Virtual Network / Loopbackadapter
I got 2 programs that run on the same machine (Windows) and communicate via TCP:
Program A (client) gets testet and needs a TCP communication which Program B (server) simulates, via given user inputs.
The problem is that Program A (client) is hard coded to use a specific IP (192.168.114.101) which I can't change and thereby I can't use localhost. Program B will get used by multiple people on different machines and so I want to simplify it's use as much as possible.
Therefore is there a way to create a Virtual Network or Loopbackadapter, or even temporarily change the Loopbackaddress via C#, so the programs can communicate without the need to change the machine IP or setup the Microsoft Loopbackadapter?

Atm I'm using the Microsoft Loopbackadapter with the IP set to 192.168.114.101, which works perfectly fine, but sadly needs manual setup. I also found this article,, which should work to automate the setup, but I was hoping for a more elegant solution.
Thank you.

Title: C# Virtual Network / Loopbackadapter


问:
react-native-pager-view prevent onPageSelected from running on render
I'm working on a react-native project and i'm looking for a way to execute a function when the user swipes between pages contained inside react-native-pager-view, what react-native-pager-view provides is the "onPageSelected" callback which runs when swiping alright but it also runs on initial render and on any other re-render which is breaking my code's logic and all state changes of the app. i need a way to prevent the onPageSelected from running on renders or another equivalent callback, something like onSwipeEnd which is provided by other packages.

is there such a thing?

my original code and original issue can be found here


问:
Is it possible to determine whether a variable is allocated on the stack or heap in swift (in SIL maybe)?
I want to see if the structure "B" will be stored in the heap or in the stack when mixing value and reference types.

```<code>class A {}
struct B {
    var val = A()
}
var someVar = B()
</code>```

I searched for information in memory graphs, but I didn't find anything.
I was running the command to print SIL representation:
swiftc -emit-silgen -O main.swift

But I don't understand the output

```<code>// B.init()
sil hidden [ossa] @$s4main1BVACycfC : $@convention(method) (@thin B.Type) -> @owned B {
// %0 "$metatype"
bb0(%0 : $@thin B.Type):
  %1 = alloc_box ${ var B }, var, name "self"     // user: %2
</code>```

I thought alloc_box inform about allocating memory in the heap. But for the usual structure alloc_box is also used.

```<code>struct A {}
var someVar = A()
</code>```
```<code>// A.init()
sil hidden [ossa] @$s4main1AVACycfC : $@convention(method) (@thin A.Type) -> A {
// %0 "$metatype"
bb0(%0 : $@thin A.Type):
  %1 = alloc_box ${ var A }, var, name "self"     // user: %2
</code>```

Body:
I want to see if the structure "B" will be stored in the heap or in the stack when mixing value and reference types.

class A {}
struct B {
    var val = A()
}
var someVar = B()

I searched for information in memory graphs, but I didn't find anything.
I was running the command to print SIL representation:
swiftc -emit-silgen -O main.swift

But I don't understand the output

// B.init()
sil hidden [ossa] @$s4main1BVACycfC : $@convention(method) (@thin B.Type) -> @owned B {
// %0 "$metatype"
bb0(%0 : $@thin B.Type):
  %1 = alloc_box ${ var B }, var, name "self"     // user: %2

I thought alloc_box inform about allocating memory in the heap. But for the usual structure alloc_box is also used.

struct A {}
var someVar = A()

// A.init()
sil hidden [ossa] @$s4main1AVACycfC : $@convention(method) (@thin A.Type) -> A {
// %0 "$metatype"
bb0(%0 : $@thin A.Type):
  %1 = alloc_box ${ var A }, var, name "self"     // user: %2


问:
Charts.js callbacks doesn't change regardless of the code
When hovering over a section I want to see the category its in as the title (A, B, C..) and some other data as the label. No matter what code I put in options.tooltip.callbacks nothing changes. The bellow bit is from the official docs here. I don't understand what I'm doing wrong. Advice is very appreciated.

JS:

```<code>    var ctx = document.getElementById('greenhouse').getContext('2d');
    var myChart = new Chart(ctx, {
      type: 'bar',
      data: {
        labels: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10'],
        datasets: [{
            label: "A",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(56, 158, 13, 1)',
          },
          {
            label: "B",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(169, 201, 17, 1)',
          },
          {
            label: "C",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(249, 157, 2, 1)',
          },
          {
            label: "D",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(247, 89, 171, 1)',
          },
          {
            label: "E",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(210, 97, 81, 1)',
          },
        ]
      },
      options: {
        plugins: {
          title: {
            display: true,
            text: 'Greenhouse'
          },
          tooltip: {
            callbacks: {
              label: function(data) {
                let label = data.dataset.label || '';

                if (label) {
                  label += ': ';
                }
                if (data.parsed.y !== null) {
                  label += new Intl.NumberFormat('en-US', {
                    style: 'currency',
                    currency: 'USD'
                  }).format(data.parsed.y);
                }
                return label;
              }
            }
          },

        },
        responsive: true,
        scales: {
          xAxes: [{
            stacked: true,
          }],
          yAxes: [{
            stacked: true,
          }],
        },
      },
    });

</code>```

HTML:

```<code>    <link href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script>
    <div class="container">
      <div class="row">
        <div class="col">
          <canvas id="greenhouse" width="100%"></canvas>
        </div>
      </div>
    </div>
</code>```

jsfiddle - https://jsfiddle.net/o5jp7aqk/

Body:
When hovering over a section I want to see the category its in as the title (A, B, C..) and some other data as the label. No matter what code I put in options.tooltip.callbacks nothing changes. The bellow bit is from the official docs here. I don't understand what I'm doing wrong. Advice is very appreciated.

JS:

    var ctx = document.getElementById('greenhouse').getContext('2d');
    var myChart = new Chart(ctx, {
      type: 'bar',
      data: {
        labels: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10'],
        datasets: [{
            label: "A",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(56, 158, 13, 1)',
          },
          {
            label: "B",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(169, 201, 17, 1)',
          },
          {
            label: "C",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(249, 157, 2, 1)',
          },
          {
            label: "D",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(247, 89, 171, 1)',
          },
          {
            label: "E",
            data: [20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
            backgroundColor: 'rgba(210, 97, 81, 1)',
          },
        ]
      },
      options: {
        plugins: {
          title: {
            display: true,
            text: 'Greenhouse'
          },
          tooltip: {
            callbacks: {
              label: function(data) {
                let label = data.dataset.label || '';

                if (label) {
                  label += ': ';
                }
                if (data.parsed.y !== null) {
                  label += new Intl.NumberFormat('en-US', {
                    style: 'currency',
                    currency: 'USD'
                  }).format(data.parsed.y);
                }
                return label;
              }
            }
          },

        },
        responsive: true,
        scales: {
          xAxes: [{
            stacked: true,
          }],
          yAxes: [{
            stacked: true,
          }],
        },
      },
    });

HTML:

    <link href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css" rel="stylesheet" />

          <canvas id="greenhouse" width="100%"></canvas>

jsfiddle - https://jsfiddle.net/o5jp7aqk/


问:
Some Latex/HTML codes do not work in Rmarkdown
I am writing a PDF report in Rmarkdown. Some Latex codes work (\newpage) but some HTML do not (<'h1>Text
).
For example, if I use ## for headings, it works. But if I want to use , \begin{center} Text \end{center} to centralize the text does not work. I reinstalled R and Rstudio and tinytex package.
If i need to include more details, please let me know.

Example:

```<code>#### Company data:

##### Name: `r d1$name`;
##### Code: `r d1$code`;
##### Size: `r d1$size`;
##### Year: 2021.

This code above works. But if I want to use // to start a new line, "  "(double space) or <h4></h4> it will not work
</code>```

Body:
I am writing a PDF report in Rmarkdown. Some Latex codes work (\newpage) but some HTML do not (<'h1>Text
).
For example, if I use ## for headings, it works. But if I want to use , \begin{center} Text \end{center} to centralize the text does not work. I reinstalled R and Rstudio and tinytex package.
If i need to include more details, please let me know.

Example:

#### Company data:

##### Name: `r d1$name`;
##### Code: `r d1$code`;
##### Size: `r d1$size`;
##### Year: 2021.

This code above works. But if I want to use // to start a new line, "  "(double space) or

 it will not work


问:
Fatal error: Uncaught InvalidArgumentException when trying to upload file to AWS
I have a problem with php 8, the code that I show works perfectly in php5 but in php 8 it shows me an error and I don't know how to solve it.

```<code>    $s3 = S3Client::factory(
                        array(
                            'credentials'   => array(
                                'key'       => IAM_KEY,
                                'secret'    => IAM_SECRET
                            ),
                            'version' => 'latest',
                            'region'  => 'eu-west-1'
                        )
                    );
$s3->putObject(
                    array(
                        'Bucket'        => RUTA_REPOSITORIO,
                        'Key'           => $_FILES['Archivo_'.$i]['name'],
                        'SourceFile'    => $_FILES['Archivo_'.$i]['tmp_name']
                        //'Body'            => $_FILES['Archivo_'.$i]['tmp_name']
                    )
                );
</code>```

An uncaught Exception was encountered
Type: Guzzle\Common\Exception\InvalidArgumentException

Message: Invalid handle provided

Body:
I have a problem with php 8, the code that I show works perfectly in php5 but in php 8 it shows me an error and I don't know how to solve it.

    $s3 = S3Client::factory(
                        array(
                            'credentials'   => array(
                                'key'       => IAM_KEY,
                                'secret'    => IAM_SECRET
                            ),
                            'version' => 'latest',
                            'region'  => 'eu-west-1'
                        )
                    );
$s3->putObject(
                    array(
                        'Bucket'        => RUTA_REPOSITORIO,
                        'Key'           => $_FILES['Archivo_'.$i]['name'],
                        'SourceFile'    => $_FILES['Archivo_'.$i]['tmp_name']
                        //'Body'            => $_FILES['Archivo_'.$i]['tmp_name']
                    )
                );

An uncaught Exception was encountered
Type: Guzzle\Common\Exception\InvalidArgumentException

Message: Invalid handle provided


问:
Selenium Chrome webdriver python. How to make it work with different Existing browser profiles simultaneously?
Problem: for some reason there is a difference at working with temp profiles created by webdriver and already existing profiles.
Existing profiles directories are stored at: c:\Users\myuser\AppData\Local\Google\Chrome\User Data\ while temp profiles folders are created at C:\Users\USERCU~1\AppData\Local\Temp\scoped_dir7144_1693613412\Default

So. While I got my profile launched, c:\Users\myuser\AppData\Local\Google\Chrome\User Data\Profile 1, I exec this code:

```<code>options = Options()

serv = Service(executable_path='resources/chromedriver.exe')
driver = webdriver.Chrome(options=options,
                          service=serv
                          )
url = 'https://www.cloudflare.com/cdn-cgi/trace'
driver.get(url)
time.sleep(4)
</code>```

It works perfectly fine. New Chrome instance is opened with specified url and 4s later it's closed.

However, trying to exec this code:

```<code>options = Options()
profile_number = 23
options.add_argument(r'--user-data-dir=c:\Users\myuser\AppData\Local\Google\Chrome\User Data')
options.add_argument(rf'--profile-directory=Profile {profile_number}')
serv = Service(executable_path='resources/chromedriver.exe')
driver = webdriver.Chrome(options=options,
                          service=serv
                          )
url = 'https://www.cloudflare.com/cdn-cgi/trace'
driver.get(url)
time.sleep(4)
</code>```

result in: desired Chrome profile is launched, Chrome window is free to use, BUT no go to url.
And back to IDE there is a crash:

```<code>Traceback (most recent call last):
    File "C:\Users\myuser\PycharmProjects\selenium_control\test_launch_specific_profile\main2.py", line 89, in <module>
    main()
  File "C:\Users\myuser\PycharmProjects\selenium_control\test_launch_specific_profile\main2.py", line 76, in main
    driver = webdriver.Chrome(options=options,
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    super().__init__(
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
    super().__init__(
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
Backtrace:
    (No symbol) [0x002BF243]
    (No symbol) [0x00247FD1]
    (No symbol) [0x0013D04D]
    (No symbol) [0x0015C24E]
    (No symbol) [0x001582E9]
    (No symbol) [0x0018F056]
    (No symbol) [0x0018EB2A]
    (No symbol) [0x00188386]
    (No symbol) [0x0016163C]
    (No symbol) [0x0016269D]
    GetHandleVerifier [0x00559A22+2655074]
    GetHandleVerifier [0x0054CA24+2601828]
    GetHandleVerifier [0x00368C0A+619850]
    GetHandleVerifier [0x00367830+614768]
    (No symbol) [0x002505FC]
    (No symbol) [0x00255968]
    (No symbol) [0x00255A55]
    (No symbol) [0x0026051B]
    BaseThreadInitThunk [0x75C400F9+25]
    RtlGetAppContainerNamedObjectPath [0x77CF7BBE+286]
    RtlGetAppContainerNamedObjectPath [0x77CF7B8E+238]
    (No symbol) [0x00000000]
    Process finished with exit code 1
</code>```

upd: I found out that chrome://version for any existing profile says

Command Line   "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" --flag-switches-begin --flag-switches-end

For some reason it's always --profile-directory="Profile 1".

Why so and can it be fixed?

I guess this is the problem cuz with 2 existing profiles launched in the same time webdriver can't derive which one to use and like somewhere in its implementation instead of getting single value got list of 2 instead.

Body:
Problem: for some reason there is a difference at working with temp profiles created by webdriver and already existing profiles.
Existing profiles directories are stored at: c:\Users\myuser\AppData\Local\Google\Chrome\User Data\ while temp profiles folders are created at C:\Users\USERCU~1\AppData\Local\Temp\scoped_dir7144_1693613412\Default

So. While I got my profile launched, c:\Users\myuser\AppData\Local\Google\Chrome\User Data\Profile 1, I exec this code:

options = Options()

serv = Service(executable_path='resources/chromedriver.exe')
driver = webdriver.Chrome(options=options,
                          service=serv
                          )
url = 'https://www.cloudflare.com/cdn-cgi/trace'
driver.get(url)
time.sleep(4)

It works perfectly fine. New Chrome instance is opened with specified url and 4s later it's closed.

However, trying to exec this code:

options = Options()
profile_number = 23
options.add_argument(r'--user-data-dir=c:\Users\myuser\AppData\Local\Google\Chrome\User Data')
options.add_argument(rf'--profile-directory=Profile {profile_number}')
serv = Service(executable_path='resources/chromedriver.exe')
driver = webdriver.Chrome(options=options,
                          service=serv
                          )
url = 'https://www.cloudflare.com/cdn-cgi/trace'
driver.get(url)
time.sleep(4)

result in: desired Chrome profile is launched, Chrome window is free to use, BUT no go to url.
And back to IDE there is a crash:

Traceback (most recent call last):
    File "C:\Users\myuser\PycharmProjects\selenium_control\test_launch_specific_profile\main2.py", line 89, in <module>
    main()
  File "C:\Users\myuser\PycharmProjects\selenium_control\test_launch_specific_profile\main2.py", line 76, in main
    driver = webdriver.Chrome(options=options,
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    super().__init__(
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
    super().__init__(
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "C:\Users\myuser\PycharmProjects\crossproject_venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
Backtrace:
    (No symbol) [0x002BF243]
    (No symbol) [0x00247FD1]
    (No symbol) [0x0013D04D]
    (No symbol) [0x0015C24E]
    (No symbol) [0x001582E9]
    (No symbol) [0x0018F056]
    (No symbol) [0x0018EB2A]
    (No symbol) [0x00188386]
    (No symbol) [0x0016163C]
    (No symbol) [0x0016269D]
    GetHandleVerifier [0x00559A22+2655074]
    GetHandleVerifier [0x0054CA24+2601828]
    GetHandleVerifier [0x00368C0A+619850]
    GetHandleVerifier [0x00367830+614768]
    (No symbol) [0x002505FC]
    (No symbol) [0x00255968]
    (No symbol) [0x00255A55]
    (No symbol) [0x0026051B]
    BaseThreadInitThunk [0x75C400F9+25]
    RtlGetAppContainerNamedObjectPath [0x77CF7BBE+286]
    RtlGetAppContainerNamedObjectPath [0x77CF7B8E+238]
    (No symbol) [0x00000000]
    Process finished with exit code 1

upd: I found out that chrome://version for any existing profile says

Command Line   "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" --flag-switches-begin --flag-switches-end

For some reason it's always --profile-directory="Profile 1".

Why so and can it be fixed?

I guess this is the problem cuz with 2 existing profiles launched in the same time webdriver can't derive which one to use and like somewhere in its implementation instead of getting single value got list of 2 instead.


问:
NodeJs doesn't return Persian/Farsi words correctly
The issue is once I console.log() a Persian/Farsi word. Node.js logs it in left to the right direction and it makes the word unreadable.

```<code>console.log("کیان");
</code>```

The terminal logs: ن ای ک instead of کیان

Didn't find any solution in documentaries.

Also, the data which I store in MySQL, saves as a set of question marks.

Guys, I just figured out that the word is okay and in the proper way when it comes to reading it from MySQL and res.send() it to the browser. So my problem is kinda solved but the console.log() bug is still a thing.

Body:
The issue is once I console.log() a Persian/Farsi word. Node.js logs it in left to the right direction and it makes the word unreadable.

console.log("کیان");

The terminal logs: ن ای ک instead of کیان

Didn't find any solution in documentaries.

Also, the data which I store in MySQL, saves as a set of question marks.

Guys, I just figured out that the word is okay and in the proper way when it comes to reading it from MySQL and res.send() it to the browser. So my problem is kinda solved but the console.log() bug is still a thing.


问:
WooCommerce API - Reports call
I’m currently trying to get propper sale reports date from the woocommerce api but so I can build something that basically automates what needs to be ordered again soon.

The connecting to the api works fine like this:

/wp-json/wc/v3/reports/top_sellers?period=month

reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-top-sellers-report

the issue is that that only returns a very small amount of products. I’m trying to get all of the products and their amount of sales in the given period and I can’t seem to get that data over the api anywhere.

Anyone that knows how to get more products?

Title: WooCommerce API - Reports call


问:
why time sharing systems obeys identical environment requirement
I am reading the paper

Formal requirements for virtualizable third generation architectures

, in which the author claimed that: "The identical environment requirement excludes the behavior of the usual time-sharing operating system from being classed as a virtual machine monitor. ". I am wondering what is the difference between the behaviors of a program running on a bare machine and on machine with time sharing system.


问:
Not able to send curl request to ngrok url in ubuntu 20.04
I am trying to send the request from linux server to the ngrok url tunneled in my local pc using below command,

curl -X GET https://mydomain.ngrok.io

But, I am receiving the below error

curl: (7) Failed to connect to mydomain.ngrok.io port 443: Connection refused