问:
TypeError: Cannot set property 'kind' of undefined
trying to run NextJS build I got this error
I am using NextJS version 12.1.6, I tried to remove node_module and package.lock.json but it did not work
any suggestion, please</p>
```<code>TypeError: Cannot set property 'kind' of undefined
    at transformBlockScopedVariable (/application/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:122:41)
    at PluginPass.VariableDeclaration (/application/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:81:9)
    at i (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:373015)
    at NodePath._call (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:292626)
    at NodePath.call (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:292450)
    at NodePath.visit (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:293401)
    at TraversalContext.visitQueue (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:286761)
    at TraversalContext.visitMultiple (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:286362)
    at TraversalContext.visit (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:287032)
    at Function.traverse.node (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:288552)
</code>```

Body:
trying to run NextJS build I got this error
I am using NextJS version 12.1.6, I tried to remove node_module and package.lock.json but it did not work
any suggestion, please

TypeError: Cannot set property 'kind' of undefined
    at transformBlockScopedVariable (/application/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:122:41)
    at PluginPass.VariableDeclaration (/application/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:81:9)
    at i (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:373015)
    at NodePath._call (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:292626)
    at NodePath.call (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:292450)
    at NodePath.visit (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:293401)
    at TraversalContext.visitQueue (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:286761)
    at TraversalContext.visitMultiple (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:286362)
    at TraversalContext.visit (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:287032)
    at Function.traverse.node (/application/node_modules/next/dist/compiled/babel/bundle.js:1890:288552)


来源: stackexchange

问:
Migrate only woocommerce data to another woocommerce website
i have a woocommerce website which is up and running, i've made a new installation of woocommerce website on another server, and migrating products/orders/customers/product categories, I've tried all plugins and options, the issue is, that I'm using a plugin namely Extra product option by "WooCommerce Extra Product Options By ThemeComplete" while migrating products it doesn't migrate Extra product options data with it, there are almost 10,000 products on my website, i want to migrate all the images and data to another website, not willing to migrate wordpress data, but only the Woocommerce data, Thanks

ContentLicense: CC BY-SA 4.0


问:
Exporting ggplot with extrafont using ggsave
To have my plot match the font used for my writing, I added the font via the extrafont package. Thus, I performed the following procedure:

```<code>library(extrafont)
font_import()
loadfonts(device = "win")
</code>```

This allowed me to change the font of my plot via a change of the theme. So far, so good. Now I want to export the plot using the ggsave() function. Unfortunately, the plot is exported without the new font, looking like this:
Output without font

However, I want it to look like this:
Wanted look

Now, I read up and found some people with similar issues. However, none of the proposed solutions worked for me. I tried to use the jpeg() and png() functions, however, the resulting quality is extremely bad; even when changing size and dpi manually, it does not seem to have an effect.
Also, exporting as a pdf is not an option for me.

Body:
To have my plot match the font used for my writing, I added the font via the extrafont package. Thus, I performed the following procedure:

library(extrafont)
font_import()
loadfonts(device = "win")

This allowed me to change the font of my plot via a change of the theme. So far, so good. Now I want to export the plot using the ggsave() function. Unfortunately, the plot is exported without the new font, looking like this:
Output without font

However, I want it to look like this:
Wanted look

Now, I read up and found some people with similar issues. However, none of the proposed solutions worked for me. I tried to use the jpeg() and png() functions, however, the resulting quality is extremely bad; even when changing size and dpi manually, it does not seem to have an effect.
Also, exporting as a pdf is not an option for me.


问:
SPRING DATA JPA - I need to fetch data based on timestamp column where month (int) as a parameter in native query
UI sends month parameter as int

@GetMapping("/{Monthnumber}")
Public List<FunctionList> getByMonth(@pathvariable("MonthNumber") int month)
```
<p>Using the above API</p>
<p>For example, if my month is Feb the parameter value would be 2 but in my oracle db the column contains timestamp data <code>22-FEB-22 11.00.00.00000000 AM</code></p>
<p>Tried below IN REPO</p>
<pre class="lang-java prettyprint-override"><code>@QUERY("SELECT * FROM Table_name WHERE month(timestamp_date) = ?1)
List<Functionlist> getByMonth(int month number)
</code>```

How to correctly query this

Body:
UI sends month parameter as int

@GetMapping("/{Monthnumber}")
Public List<FunctionList> getByMonth(@pathvariable("MonthNumber") int month)

Using the above API

For example, if my month is Feb the parameter value would be 2 but in my oracle db the column contains timestamp data 22-FEB-22 11.00.00.00000000 AM

Tried below IN REPO

@QUERY("SELECT * FROM Table_name WHERE month(timestamp_date) = ?1)
List<Functionlist> getByMonth(int month number)

How to correctly query this


问:
Alternative to sprintf() for bytes buffer in C
Hello guys I have an issue when i try to put my bytes buffer into a sql buffer for sqlite3.c.

For example, I have this buffer:

```<code>static unsigned char bytes_buffer[] = {
        0x30, 0x82, 0x01, 0x4b, 0x30, 0x82, 0x01, 0x03, 0x06, 0x07, 0x2a, 0x86,
        0x48, 0xce, 0x3d, 0x02, 0x01, 0x30, 0x81, 0xf7, 0x02, 0x01, 0x01, 0x30,
        0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21,
        0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00}
</code>```

My function to add this info into a sqlite3 query and insert into my database is the following:

```<code>    unsigned char *sql=(unsigned char *)malloc((size_t)(sizeof(unsigned char)*SQL_SIZE));
    sprintf(sql,"UPDATE table SET buffer='%s', WHERE id=%d",bytes_buffer,id);
    printf("SQL: %s\n",sql);
    if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK)
    {
        return SQLITE_ERROR;
    }
    else
        return SQLITE_OK;
}
</code>```

The problem is when i try to show the query content, because in the buffer parameter sprintf() stops when a null character (0x00) appears. I need a function similar to sprintf() where I can manage the parameters size. I tried snprintf() and also fails. Thank you so much.

Body:
Hello guys I have an issue when i try to put my bytes buffer into a sql buffer for sqlite3.c.

For example, I have this buffer:

static unsigned char bytes_buffer[] = {
        0x30, 0x82, 0x01, 0x4b, 0x30, 0x82, 0x01, 0x03, 0x06, 0x07, 0x2a, 0x86,
        0x48, 0xce, 0x3d, 0x02, 0x01, 0x30, 0x81, 0xf7, 0x02, 0x01, 0x01, 0x30,
        0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21,
        0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00}

My function to add this info into a sqlite3 query and insert into my database is the following:

    unsigned char *sql=(unsigned char *)malloc((size_t)(sizeof(unsigned char)*SQL_SIZE));
    sprintf(sql,"UPDATE table SET buffer='%s', WHERE id=%d",bytes_buffer,id);
    printf("SQL: %s\n",sql);
    if (sqlite3_exec(db, sql, NULL, NULL, NULL) != SQLITE_OK)
    {
        return SQLITE_ERROR;
    }
    else
        return SQLITE_OK;
}

The problem is when i try to show the query content, because in the buffer parameter sprintf() stops when a null character (0x00) appears. I need a function similar to sprintf() where I can manage the parameters size. I tried snprintf() and also fails. Thank you so much.


问:
Error deploying a function from vscode cloud run extension
I am new to cloud computing and I'm trying to use google cloud to run some python codes. I use the vscode extension Cloud Run to deploy one function and run it on the cloud but I am getting the following error:

```<code>Could not create or update Cloud Run service scraping, Container Healthcheck failed. Revision 'scraping-00002-puv' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

</code>```

Here are the steps I followed:

I created an application folder with my .py codes (scraping_functions.py) and the automatic launch.json that contains the following configurations:

```<code>{
  "configurations": [
    {
      "name": "Deploy Cloud Function",
      "type": "cloudcode.cloudfunctions",
      "request": "launch",
      "functionName": "scraping",
      "gen": "GEN_2",
      "revision": "scraping-00001-biy",
      "entryPoint": "hello_get",
      "testInput": "",
      "region": "europe-west1",
      "runtime": "python310"
    },
    {
      "name": "Cloud Run: Run/Debug Locally",
      "type": "cloudcode.cloudrun",
      "request": "launch",
      "build": {
        "docker": {
          "path": "Dockerfile"
        }
      },
      "image": "scraping",
      "service": {
        "name": "scraping",
        "containerPort": 8080,
        "resources": {
          "limits": {
            "memory": "256Mi"
          }
        }
      },
      "target": {
        "minikube": {}
      },
      "watch": true,
      "internalConsoleOptions": "neverOpen"
    },
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "justMyCode": true
    },
    {
      "name": "Deploy Cloud Function",
      "type": "cloudcode.cloudfunctions",
      "request": "launch",
      "functionName": "function-scrape",
      "gen": "GEN_2",
      "entryPoint": "hello_get",
      "revision": "function-scrape-00003-vuh",
      "testInput": "",
      "region": "europe-west1",
      "runtime": "python310"
    },
    {
      "name": "Docker: Python - General",
      "type": "docker",
      "request": "launch",
      "preLaunchTask": "docker-run: debug",
      "python": {
        "pathMappings": [
          {
            "localRoot": "${workspaceFolder}",
            "remoteRoot": "/app"
          }
        ],
        "projectType": "general"
      }
    }
  ]
}
</code>```

-I also have a dockerfile that was generated automatically from the vscode extension.
-On the cloud run extension, I go to Cloud Functions and click deploy function. I also tried to run and debug but the same error appears...

The log file indicated in the error message does not seem to contain much more interesting information so I am not sure what can be causing the error.

Body:
I am new to cloud computing and I'm trying to use google cloud to run some python codes. I use the vscode extension Cloud Run to deploy one function and run it on the cloud but I am getting the following error:

Could not create or update Cloud Run service scraping, Container Healthcheck failed. Revision 'scraping-00002-puv' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

Here are the steps I followed:

I created an application folder with my .py codes (scraping_functions.py) and the automatic launch.json that contains the following configurations:

{
  "configurations": [
    {
      "name": "Deploy Cloud Function",
      "type": "cloudcode.cloudfunctions",
      "request": "launch",
      "functionName": "scraping",
      "gen": "GEN_2",
      "revision": "scraping-00001-biy",
      "entryPoint": "hello_get",
      "testInput": "",
      "region": "europe-west1",
      "runtime": "python310"
    },
    {
      "name": "Cloud Run: Run/Debug Locally",
      "type": "cloudcode.cloudrun",
      "request": "launch",
      "build": {
        "docker": {
          "path": "Dockerfile"
        }
      },
      "image": "scraping",
      "service": {
        "name": "scraping",
        "containerPort": 8080,
        "resources": {
          "limits": {
            "memory": "256Mi"
          }
        }
      },
      "target": {
        "minikube": {}
      },
      "watch": true,
      "internalConsoleOptions": "neverOpen"
    },
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "justMyCode": true
    },
    {
      "name": "Deploy Cloud Function",
      "type": "cloudcode.cloudfunctions",
      "request": "launch",
      "functionName": "function-scrape",
      "gen": "GEN_2",
      "entryPoint": "hello_get",
      "revision": "function-scrape-00003-vuh",
      "testInput": "",
      "region": "europe-west1",
      "runtime": "python310"
    },
    {
      "name": "Docker: Python - General",
      "type": "docker",
      "request": "launch",
      "preLaunchTask": "docker-run: debug",
      "python": {
        "pathMappings": [
          {
            "localRoot": "${workspaceFolder}",
            "remoteRoot": "/app"
          }
        ],
        "projectType": "general"
      }
    }
  ]
}

-I also have a dockerfile that was generated automatically from the vscode extension.
-On the cloud run extension, I go to Cloud Functions and click deploy function. I also tried to run and debug but the same error appears...

The log file indicated in the error message does not seem to contain much more interesting information so I am not sure what can be causing the error.


问:
Can't connect to Database via SSH with Nodejs
I try to connect my node.js backend with my mysql database running on Debian server.
With Dbeaver everything works finde. Connection with SSH and my database with username and password.
Now I try to connect with my Application via SSH and I get the following error:

```<code>Error: All configured authentication methods failed
</code>```

The credentials are exactly the same like in Dbeaver.

This is my code:

```<code>   const mysql = require('mysql2');
const { Client } = require('ssh2');
const sshClient = new Client();
const dbServer = {
    host: process.env.DB_HOST,
    port: process.env.DB_PORT,
    user: process.env.DB_USERNAME,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_DATABASE
}
const tunnelConfig = {
    host: process.env.DB_SSH_HOST,
    port: 22,
    username: process.env.DB_SSH_USER,
    password: process.env.DB_SSH_PASSWORD
}
const forwardConfig = {
    srcHost: '127.0.0.1',
    srcPort: 3306,
    dstHost: dbServer.host,
    dstPort: dbServer.port
};
const SSHConnection = new Promise((resolve, reject) => {
    console.log(dbServer);
    console.log(tunnelConfig);
    console.log(forwardConfig)
    sshClient.on('ready', () => {
        sshClient.forwardOut(
        forwardConfig.srcHost,
        forwardConfig.srcPort,
        forwardConfig.dstHost,
        forwardConfig.dstPort,
        (err, stream) => {
             if (err) reject(err);
             const updatedDbServer = {
                 ...dbServer,
                 stream
            };
            console.log(updatedDbServer)
            const connection =  mysql.createConnection(updatedDbServer);
           connection.connect((error) => {
            if (error) {
                reject(error);
            }
            resolve(connection);
            });
        });
    }).connect(tunnelConfig);
});
</code>```

Do you have any suggestions?
Thank you very much!

Body:
I try to connect my node.js backend with my mysql database running on Debian server.
With Dbeaver everything works finde. Connection with SSH and my database with username and password.
Now I try to connect with my Application via SSH and I get the following error:

Error: All configured authentication methods failed

The credentials are exactly the same like in Dbeaver.

This is my code:

   const mysql = require('mysql2');
const { Client } = require('ssh2');
const sshClient = new Client();
const dbServer = {
    host: process.env.DB_HOST,
    port: process.env.DB_PORT,
    user: process.env.DB_USERNAME,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_DATABASE
}
const tunnelConfig = {
    host: process.env.DB_SSH_HOST,
    port: 22,
    username: process.env.DB_SSH_USER,
    password: process.env.DB_SSH_PASSWORD
}
const forwardConfig = {
    srcHost: '127.0.0.1',
    srcPort: 3306,
    dstHost: dbServer.host,
    dstPort: dbServer.port
};
const SSHConnection = new Promise((resolve, reject) => {
    console.log(dbServer);
    console.log(tunnelConfig);
    console.log(forwardConfig)
    sshClient.on('ready', () => {
        sshClient.forwardOut(
        forwardConfig.srcHost,
        forwardConfig.srcPort,
        forwardConfig.dstHost,
        forwardConfig.dstPort,
        (err, stream) => {
             if (err) reject(err);
             const updatedDbServer = {
                 ...dbServer,
                 stream
            };
            console.log(updatedDbServer)
            const connection =  mysql.createConnection(updatedDbServer);
           connection.connect((error) => {
            if (error) {
                reject(error);
            }
            resolve(connection);
            });
        });
    }).connect(tunnelConfig);
});

Do you have any suggestions?
Thank you very much!


问:
jest error "Cannot use import statement outside" with esm package?
I was using this package https://auto-animate.formkit.com, everything was doing fine but I got this error running jest

repo: https://github.com/ming2024/boilerplate-vite-react

I have no idea what's wrong. Can someone point me to a direction for the error?


问:
How to select Arrow keys command in shell script to automate a deployment process?
I am trying to automate the deployment process in Netlify using a Shell script, I do get prompted with certain choices during the process. How can I select arrow keys choices using shell command for the same ??


问:
Dependency tree doesn't give versions-maven-plugin source
I am using below command to identify versions-maven-plugin source, since the specified plugin has not been directly defined in the project. But it doesn't show any details related to the said plugin.

```<code>mvn dependency:tree
</code>```

However below command gives the plugin info

```<code>mvn -Dplugin=org.codehaus.mojo:versions-maven-plugin help:describe
</code>```

Results:

```<code>Name: Versions Maven Plugin
Description: The Versions Maven Plugin is used when you want to manage the
  versions of artifacts in a project's POM.
Group Id: org.codehaus.mojo
Artifact Id: versions-maven-plugin
Version: 2.14.1
Goal Prefix: versions
</code>```

Further I was trying to override the version by adding below into the project main pom. However same previous version (i.e. 2.14.1) shows plugin describe results.

```<code>    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.13.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
...
</code>```

Body:
I am using below command to identify versions-maven-plugin source, since the specified plugin has not been directly defined in the project. But it doesn't show any details related to the said plugin.

mvn dependency:tree

However below command gives the plugin info

mvn -Dplugin=org.codehaus.mojo:versions-maven-plugin help:describe

Results:

Name: Versions Maven Plugin
Description: The Versions Maven Plugin is used when you want to manage the
  versions of artifacts in a project's POM.
Group Id: org.codehaus.mojo
Artifact Id: versions-maven-plugin
Version: 2.14.1
Goal Prefix: versions

Further I was trying to override the version by adding below into the project main pom. However same previous version (i.e. 2.14.1) shows plugin describe results.

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.13.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
...


问:
jQuery UI: selectable for nested elements (with parent container draggable)
I combined jQuery draggable, selectable and droppable and it's working fine, but I encountered the following problem (see image below):

I want to use selectable for the nested items for dragging them around inside the container. But as the container is also draggable (which is fine), selectable won't be triggered as it will be dragged.

So I want to trigger selectable for the container by pressing an extra key first, eg. ctrl - how would this work? Do I need to apply .selectable() on the container?


问:
kubernetes cannot find ephemeral storage
I have cache ephemeral storage defined as below, however I get the following warning

Warning  FailedScheduling        108s  default-scheduler        0/15 nodes are available: 15 persistentvolumeclaim "sas-cas-server-default-controller-cas-cache-vsan0" not found.

```<code>apiVersion: builtin
kind: PatchTransformer
metadata:
  name: cas-cache-hostpath
patch: |-
  - op: add
    path: /spec/controllerTemplate/spec/volumes/-
    value:
      name: cas-cache-vsan0
      ephemeral:
        volumeClaimTemplate:
          spec:
           accessModes: [ "ReadWriteOnce" ]
           storageClassName: "standard"
           resources:
             requests:
               storage: 930Gi
  - op: add
    path: /spec/controllerTemplate/spec/containers/0/volumeMounts/-
    value:
      name: cas-cache-vsan0
      mountPath: /cas/cache-vsan0 # # mountPath is the path inside the pod that CAS will reference
  - op: add
    path: /spec/controllerTemplate/spec/containers/0/env/-
    value:
      name: CASENV_CAS_DISK_CACHE
      value: "/cas/cache-vsan0" # # This has to match the value that is inside the pod
</code>```

I am trying to create ephemeral generic volume for cas disc cache.However when I try to change something is cas configuration, it cannot find the ephemeral volume.

Body:
I have cache ephemeral storage defined as below, however I get the following warning

Warning  FailedScheduling        108s  default-scheduler        0/15 nodes are available: 15 persistentvolumeclaim "sas-cas-server-default-controller-cas-cache-vsan0" not found.

apiVersion: builtin
kind: PatchTransformer
metadata:
  name: cas-cache-hostpath
patch: |-
  - op: add
    path: /spec/controllerTemplate/spec/volumes/-
    value:
      name: cas-cache-vsan0
      ephemeral:
        volumeClaimTemplate:
          spec:
           accessModes: [ "ReadWriteOnce" ]
           storageClassName: "standard"
           resources:
             requests:
               storage: 930Gi
  - op: add
    path: /spec/controllerTemplate/spec/containers/0/volumeMounts/-
    value:
      name: cas-cache-vsan0
      mountPath: /cas/cache-vsan0 # # mountPath is the path inside the pod that CAS will reference
  - op: add
    path: /spec/controllerTemplate/spec/containers/0/env/-
    value:
      name: CASENV_CAS_DISK_CACHE
      value: "/cas/cache-vsan0" # # This has to match the value that is inside the pod

I am trying to create ephemeral generic volume for cas disc cache.However when I try to change something is cas configuration, it cannot find the ephemeral volume.


问:
Chef knife is asking for password
I cannot use knife ssh through a jumphost without entering password manually. When using ssh command with same jumphost and same endpoint server all works well.

This is the ssh command that works :

```<code>C:\> C:\Windows\System32\OpenSSH\ssh.exe -F "config" -o ProxyCommand="C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p JUMPHOST_IP -i C:\users\admin\.ssh\id_rsa" -i "C:\users\admin\.ssh\id_rsa" TARGET_HOSTNAME "uname -n"
</code>```

This is the knife ssh command that fails

```<code>C:\> knife ssh -G JUMPHOST_IP -x admin -A -i "C:\users\admin\.ssh\id_rsa" --ssh-gateway-identity "C:\users\admin\.ssh\id_rsa" -m TARGET_HOSTNAME "uname -n"
Enter the password for admin@JUMPHOST_IP:
</code>```

This is the ssh config file on origin windows server

```<code>Host *
    StrictHostKeyChecking no
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedKeyTypes +ssh-rsa
</code>```

Chef Infra Client version is : 17.10.0

OpenSSH version on origin server is OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

OpenSSH version on jumphost and target server is OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022

Edit :

I checked on another environment starting from the same windows server and knife ssh works with older OpenSSH versions, namely

```<code>OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016
</code>```

Title: Chef knife is asking for password

Body:
I cannot use knife ssh through a jumphost without entering password manually. When using ssh command with same jumphost and same endpoint server all works well.

This is the ssh command that works :

C:\> C:\Windows\System32\OpenSSH\ssh.exe -F "config" -o ProxyCommand="C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p JUMPHOST_IP -i C:\users\admin\.ssh\id_rsa" -i "C:\users\admin\.ssh\id_rsa" TARGET_HOSTNAME "uname -n"

This is the knife ssh command that fails

C:\> knife ssh -G JUMPHOST_IP -x admin -A -i "C:\users\admin\.ssh\id_rsa" --ssh-gateway-identity "C:\users\admin\.ssh\id_rsa" -m TARGET_HOSTNAME "uname -n"
Enter the password for admin@JUMPHOST_IP:

This is the ssh config file on origin windows server

Host *
    StrictHostKeyChecking no
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedKeyTypes +ssh-rsa

Chef Infra Client version is : 17.10.0

OpenSSH version on origin server is OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

OpenSSH version on jumphost and target server is OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022

Edit :

I checked on another environment starting from the same windows server and knife ssh works with older OpenSSH versions, namely

OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016


问:
Image Detect App Which upload dynamiclly from admin app in Flutter
I want to make an app for my university project that upload image from the Admin App to the server &  In the User App User Scan Image From the Camera & check whether the image exists on the server or not & get the image description which is also uploaded from the admin App.

I found some plugins in a flutter

google_mlkit_object_detection

flutter_tflite


问:
Why Jaeger Opentelemetry traces does not show correct Database Query execution Time?
I am using Spring JdbcTemplate and SybaseDB along with OpenTelemetry traces enabled. I am using an aspect logger around JdbcTemplate query and execute method that logs time taken to execute those methods.

What I observed that the time that the time logged by the aspect is significantly huge than the time observed in OpenTelemetry Jaegar UI Span.

For an instance, the time logged by the aspect was 556ms and the observed time in Jaegar UI is 225.6ms

Why is there such a huge difference in the logged and the observed time?

Ideally the observed time taken by query to execute in logs and Jaegar traces should be same


问:
Public variabes are unable to fetch its values after using @Refreshscope
I was able to get the public variable assigned in my one of configuration class.
But after using the annotation @Refreshscope Im getting null value instead of actual.
Im getting the value when using the getter but not getting while accessing like

```<code>PropConfigs.name
</code>```

My class is looks like below,

```<code>@Configuration
@RefreshScope
@Getter
public class PropConfigs {

    @Value("${config.name}")
    public name;

    @Value("${config.salary}")
    public salary;

}
</code>```

The issue is comes only when annoting the class with @RefreshScope for Spring Config Client.
Thank u very much for help in advance.

Body:
I was able to get the public variable assigned in my one of configuration class.
But after using the annotation @Refreshscope Im getting null value instead of actual.
Im getting the value when using the getter but not getting while accessing like

PropConfigs.name

My class is looks like below,

@Configuration
@RefreshScope
@Getter
public class PropConfigs {

    @Value("${config.name}")
    public name;

    @Value("${config.salary}")
    public salary;

}

The issue is comes only when annoting the class with @RefreshScope for Spring Config Client.
Thank u very much for help in advance.


问:
Detect whether Shift is presses with ncurses
I am writing a ncurses program in C++, which allows the user to press keybindings to execute tasks. However, because there are too many keybindings, I decided to add some modifier keys. One of the most used modifiers is the Shift key. However, I have to implement a way to detect whether Shift is pressed or not.

This is a sample program I've been trying:

#include <ncurses.h>

int main() {
    initscr();

    raw();
    noecho();

    char ch = getch();
    printw("%c", ch);
    refresh();

    getch();
    endwin();
}
```

When I press Ctrl-a, it shows ^A. Then, I tried Ctrl-Shift-a, but I still got ^A. I also tried a bunch of other keys, but it seemed like my program cannot distinguish between Ctrl-key and Ctrl-Shift-key events.

Is there a way to detect the Shift key? Thanks in advance!

Body:
I am writing a ncurses program in C++, which allows the user to press keybindings to execute tasks. However, because there are too many keybindings, I decided to add some modifier keys. One of the most used modifiers is the Shift key. However, I have to implement a way to detect whether Shift is pressed or not.

This is a sample program I've been trying:

#include <ncurses.h>

int main() {
    initscr();

    raw();
    noecho();

    char ch = getch();
    printw("%c", ch);
    refresh();

    getch();
    endwin();
}

When I press Ctrl-a, it shows ^A. Then, I tried Ctrl-Shift-a, but I still got ^A. I also tried a bunch of other keys, but it seemed like my program cannot distinguish between Ctrl-key and Ctrl-Shift-key events.

Is there a way to detect the Shift key? Thanks in advance!


问:
Django dropdown menu with nested classes not showing form-field in template
Django (4.1.4): I´m trying to display a dropdown-menu for changing the status of "MyModel" in a table using a form, bot the fields are not shown in the template. I also tried to use javascript to enable the change of the status dynamically. Both approaches failed.
Changing the status trough the admin page is working properly, as well as displaying the current status in the template.
The project is based on the Visual Studio Django Webapp template. The following stylesheets and scripts are included:
bootstrap 3.0.0,
jquery-1.10.2
jquery-2.2.4
ajax/libs/bootstrap-fileinput/4.4.7

Is MyModel correctly structured and are choices properly used?

Where are the mistakes? I assume, they might be in the forms.py-file, but I cannot find them. Following many tutorials, none of them worked for me. Also checking other posts did not help me further, like this one:
Django form not showing up in template

models.py:

```<code>import uuid

class MyModel(models.Model):
        id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
        title = models.CharField(max_length=100, unique=True, verbose_name='Name')

        class Status(models.Choices):
                IN_ARBEIT = 'Modell in Arbeit'
                BEREIT = 'Bereit'
                DOKUMENTATION = 'Dokumentation'
                FERTIGGESTELLT = 'Fertiggestellt'
                ZU_AKTUALISIEREN = 'Zu aktualisieren'
                REVISION = 'In Revision'

        status = models.CharField(
                max_length=30,
                choices=Status.choices,
                default=Status.IN_ARBEIT,
                verbose_name ='Bearbeitungsstatus'
                )
</code>```

I would apprappreciate your help!

1ST approach without javascript:
forms.py:

```<code>from .models import MyModel
class StatuChoicesForm(forms.ModelForm):
    # Specify the 'status' field as a ChoiceField with the MyModel.Status choices
    status = forms.ChoiceField(choices=MyModel.Status.choices)
    class Meta:
        model = MyModel
        fields = ['status']
</code>```

views.py:

```<code>from .forms import StatusChoicesForm
def change_model_status(request, model_id):
    if request.method == 'POST':
        form = StatuChoicesForm(request.POST)
        if form.is_valid():
            # Get the selected value for the 'status' field
            status = form.cleaned_data['status']
            # Do something with the selected value (e.g. update a model instance)
            model = MyModel.objects.get(id=model_id)
            model.status = status
            model.save()
            return redirect('model_info.html')
        else:
            status_form = StatuChoicesForm()

        return render(request, 'models.html', {'status_form': status_form})
</code>```

models.html:

    {% csrf_token %}
    {{ status_form.as_p }}

2nd approach using javascript/AJAX:

model.js:

```<code>  // Function to update the status field in the MyModel object
  function updateStatus(status) {
    // Send an AJAX request to the server to update the status field
    $.ajax({
      url: '/update-status/',
      type: 'POST',
      data: {'status': status},
      success: function(response) {
        // Update the status field in the UI
        $('#current-status').text(status);
      },
      error: function(error) {
        console.log(error);
      }
    });
  }

  // Bind the updateStatus function to the change event of the dropdown menu
  $('#status-dropdown').change(function() {
    var selectedStatus = $(this).val();
    updateStatus(selectedStatus);
  });
</code>```

view.py:

```<code>
from django.http import JsonResponse

def update_status(request):
  if request.method == 'POST':
    # Get the new status from the request data
    new_status = request.POST.get('status')

</code>```

models.html:

```<code><!-- Dropdown menu for the Status class -->
<!-- Dropdown menu for the Status class -->
{% block content %}
<select id="status-dropdown" class="form-control">
  {% for status in custom_model.SystemType.choices %}
    <option value="{{ status.0 }}">{{ status.1 }}</option>
  {% endfor %}
</select>
{% endblock %}

{% block scripts %}
    <script src="{% static 'app/scripts/model.js' %}"></script>
{% endblock %}

</code>```

Body:
Django (4.1.4): I´m trying to display a dropdown-menu for changing the status of "MyModel" in a table using a form, bot the fields are not shown in the template. I also tried to use javascript to enable the change of the status dynamically. Both approaches failed.
Changing the status trough the admin page is working properly, as well as displaying the current status in the template.
The project is based on the Visual Studio Django Webapp template. The following stylesheets and scripts are included:
bootstrap 3.0.0,
jquery-1.10.2
jquery-2.2.4
ajax/libs/bootstrap-fileinput/4.4.7

Is MyModel correctly structured and are choices properly used?

Where are the mistakes? I assume, they might be in the forms.py-file, but I cannot find them. Following many tutorials, none of them worked for me. Also checking other posts did not help me further, like this one:
Django form not showing up in template

models.py:

import uuid

class MyModel(models.Model):
        id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
        title = models.CharField(max_length=100, unique=True, verbose_name='Name')

        class Status(models.Choices):
                IN_ARBEIT = 'Modell in Arbeit'
                BEREIT = 'Bereit'
                DOKUMENTATION = 'Dokumentation'
                FERTIGGESTELLT = 'Fertiggestellt'
                ZU_AKTUALISIEREN = 'Zu aktualisieren'
                REVISION = 'In Revision'

        status = models.CharField(
                max_length=30,
                choices=Status.choices,
                default=Status.IN_ARBEIT,
                verbose_name ='Bearbeitungsstatus'
                )

I would apprappreciate your help!

1ST approach without javascript:
forms.py:

from .models import MyModel
class StatuChoicesForm(forms.ModelForm):
    # Specify the 'status' field as a ChoiceField with the MyModel.Status choices
    status = forms.ChoiceField(choices=MyModel.Status.choices)
    class Meta:
        model = MyModel
        fields = ['status']

views.py:

from .forms import StatusChoicesForm
def change_model_status(request, model_id):
    if request.method == 'POST':
        form = StatuChoicesForm(request.POST)
        if form.is_valid():
            # Get the selected value for the 'status' field
            status = form.cleaned_data['status']
            # Do something with the selected value (e.g. update a model instance)
            model = MyModel.objects.get(id=model_id)
            model.status = status
            model.save()
            return redirect('model_info.html')
        else:
            status_form = StatuChoicesForm()

        return render(request, 'models.html', {'status_form': status_form})

models.html:

    {% csrf_token %}
    {{ status_form.as_p }}

2nd approach using javascript/AJAX:

model.js:

  // Function to update the status field in the MyModel object
  function updateStatus(status) {
    // Send an AJAX request to the server to update the status field
    $.ajax({
      url: '/update-status/',
      type: 'POST',
      data: {'status': status},
      success: function(response) {
        // Update the status field in the UI
        $('#current-status').text(status);
      },
      error: function(error) {
        console.log(error);
      }
    });
  }

  // Bind the updateStatus function to the change event of the dropdown menu
  $('#status-dropdown').change(function() {
    var selectedStatus = $(this).val();
    updateStatus(selectedStatus);
  });

view.py:

from django.http import JsonResponse

def update_status(request):
  if request.method == 'POST':
    # Get the new status from the request data
    new_status = request.POST.get('status')

models.html:

{% block content %}
<select id="status-dropdown" class="form-control">
  {% for status in custom_model.SystemType.choices %}
    <option value="{{ status.0 }}">{{ status.1 }}</option>
  {% endfor %}
</select>
{% endblock %}

{% block scripts %}

{% endblock %}


问:
Laravel batches for execution
I am fairly new with Laravel and I am planning to use massively the queues and batches. Today, while I was working on massing data import for performance testing, I found an issue with what we build and I need your help.

On the app, we will have queue jobs that will be running in queues, that part is clear. We have also batches for operations like data import or data export. I realised today that batches will just create jobs, but then, each job will be execute by the queue system (SQS for production), like any other queue job.

For us, that is an issue because that would mean that if we have a lot of elements in the queue, if a user start data import, he will need to wait for all the queue job before him to be executed.

I understand that I could create a queue "batch" and could give this queue a higher priority, but I have hoping a find a way to execute batch "on its own process", so that when a user start its import, it starts right away.

I am sorry if I am not clear, I can re-explain if required.

Thanks a lot for your help,

Ed

Title: Laravel batches for execution


问:
Laravel 9 PostTooLargeException exception handle
I'm trying to handle PostTooLargeException in laravel 9 without updating php.ini file.

In app/Exceptions/Hndler.php I have call below renderable function

```<code>use Illuminate\Http\Exceptions\PostTooLargeException as PostTooLargeException;

public function register()
{
    $this->renderable(function (PostTooLargeException $e, $request) {
        return response()->view('errors.custom', [], 500);
    });
}
</code>```

Controller add action

```<code>public function add( \App\Http\Requests\AuthorFormRequest $request )
{
        dd($request)
}
</code>```

AuthorFormRequest Is like below

```<code>public function rules()
{
        return [
            'user_icon' => 'image|mimes:jpg,png,jpeg,gif,svg|max:2048|dimensions:min_width=100,min_height=100',
            'name' => 'required|string|max:30',
            'group' => 'nullable|string|max:30',
            'position' => 'nullable|string|max:30',
            'category' => 'nullable|string|max:30',
            'description' => 'nullable|string|max:200',
            'stripe_id' => 'email',
            'image_tmp' => 'nullable|string'
        ];
}
</code>```

Every time I'm getting below image if image size is 1gb.

My expectation is display the error message as a session message in upload page.
How will handel this error ?

Body:
I'm trying to handle PostTooLargeException in laravel 9 without updating php.ini file.

In app/Exceptions/Hndler.php I have call below renderable function

use Illuminate\Http\Exceptions\PostTooLargeException as PostTooLargeException;

public function register()
{
    $this->renderable(function (PostTooLargeException $e, $request) {
        return response()->view('errors.custom', [], 500);
    });
}

Controller add action

public function add( \App\Http\Requests\AuthorFormRequest $request )
{
        dd($request)
}

AuthorFormRequest Is like below

public function rules()
{
        return [
            'user_icon' => 'image|mimes:jpg,png,jpeg,gif,svg|max:2048|dimensions:min_width=100,min_height=100',
            'name' => 'required|string|max:30',
            'group' => 'nullable|string|max:30',
            'position' => 'nullable|string|max:30',
            'category' => 'nullable|string|max:30',
            'description' => 'nullable|string|max:200',
            'stripe_id' => 'email',
            'image_tmp' => 'nullable|string'
        ];
}

Every time I'm getting below image if image size is 1gb.

My expectation is display the error message as a session message in upload page.
How will handel this error ?


问:
How to setup a TCP listener in rust ( tauri app )
I'm trying to add a TCP listener in tauri app using rust .
this is how I'm doing it :

```<code>fn main() {
    let context = tauri::generate_context!();
    tauri::Builder::default()
        .setup(|app| {
            let listener = TcpListener::bind("0.0.0.0::5557").unwrap();
            ...

            }
            Ok(())
        })
        .run(context)
        .expect("error while running tauri application");
}
</code>```

I'm getting this error on listener line called Result::unwrap() on an Err value: Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }'

Body:
I'm trying to add a TCP listener in tauri app using rust .
this is how I'm doing it :

fn main() {
    let context = tauri::generate_context!();
    tauri::Builder::default()
        .setup(|app| {
            let listener = TcpListener::bind("0.0.0.0::5557").unwrap();
            ...

            }
            Ok(())
        })
        .run(context)
        .expect("error while running tauri application");
}

I'm getting this error on listener line called Result::unwrap() on an Err value: Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }'


问:
How to add quotation mark to a string in VBA?
I am storing a folder path as a string in macro. It is dynamic, macro takes path of folder that was specified by user. I want to open it using Shell line, but it needs folder path between quotation marks to work.

I tried to add it using:

```<code>FPath = " " " & FPath " " "
</code>```

but, clearly, it is not a thing in VBA.

Body:
I am storing a folder path as a string in macro. It is dynamic, macro takes path of folder that was specified by user. I want to open it using Shell line, but it needs folder path between quotation marks to work.

I tried to add it using:

FPath = " " " & FPath " " "

but, clearly, it is not a thing in VBA.


问:
Does Android Studio Emulator support OpenGL ES 3.2?
I am going to start mobile game development with Unreal Engine 5.1
It is required to use only devices that support GLES 3.2+. Early versions deprecated already starting from UE5.0
On my own phone, the build of my game deploys (via USB Debug) and runs correctly. But in reason that it`s too old and slow and has small storage, I want to use Android Emulator on my PC to test my game
But, if I understood correctly, AVD doesn't support it with standard methods, and it gives me only choose between GLES2.0/GLES3.1

I already trying to find information from the Unreal Engine side, and since I found that GLES3.1 and lower is deprecated, i understood that the only way to solve this- its Android Studio Emulator and its options
I already tried answer from this post, about configuration

```<code>/.android/advancedFeatures.ini
</code>```

And it's don't work for me (only give me a chance to set GLES version SW2.0/HW2.0 on device creation, not in the emulation setting)
SO, my question is:
Is it possible for this moment to simulate an AVD device with OpenGL ES3.2?

Body:
I am going to start mobile game development with Unreal Engine 5.1
It is required to use only devices that support GLES 3.2+. Early versions deprecated already starting from UE5.0
On my own phone, the build of my game deploys (via USB Debug) and runs correctly. But in reason that it`s too old and slow and has small storage, I want to use Android Emulator on my PC to test my game
But, if I understood correctly, AVD doesn't support it with standard methods, and it gives me only choose between GLES2.0/GLES3.1

I already trying to find information from the Unreal Engine side, and since I found that GLES3.1 and lower is deprecated, i understood that the only way to solve this- its Android Studio Emulator and its options
I already tried answer from this post, about configuration

/.android/advancedFeatures.ini

And it's don't work for me (only give me a chance to set GLES version SW2.0/HW2.0 on device creation, not in the emulation setting)
SO, my question is:
Is it possible for this moment to simulate an AVD device with OpenGL ES3.2?


问:
Editable JComboBox Background color
I have a editable combobox, but I am not able to change its background color. Tried

```<code>((JTextField) myJComboBox.getEditor().getEditorComponent())
#setBackground(Color.xxxx);
</code>```

ref:
  Change JComboBox colours WITHOUT renderer

But it doesn't seem to work

Any ideas?

ContentLicense: CC BY-SA 3.0

Title: Editable JComboBox Background color

Body:
I have a editable combobox, but I am not able to change its background color. Tried

((JTextField) myJComboBox.getEditor().getEditorComponent())
#setBackground(Color.xxxx);

ref:
  Change JComboBox colours WITHOUT renderer

But it doesn't seem to work

Any ideas?


问:
Generate a class based on user input using annotation processor at compile time
I have annotation processor which need to generate the code based on the user input at compile time.

For example suppose I have a custom annotation, based on user input I need to generate the code.

```<code>    @Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface MTAMPFieldProperty {

    String name() default "";

    String value() default "";

    String type() default "";

    boolean nullable() default false;

    int length() default 32;

    String mappedBy() default "";

    String cascade()  default "";

}

    @MTAMPEntity(value = "country")
public class Country {

    @MTAMPFieldProperty(name = "country_id", value = "country_id_sequence")
    private Long countryId;

    @MTAMPFieldProperty(name = "isd")
    private String isd;

    @MTAMPFieldProperty(mappedBy = "countries")
    private List<Person> persons;

    @MTAMPFieldProperty(name = "state_id")
    private States states;

}
</code>```

I need to process the above Country class and generate the output class based on user input.

Suppose I am passing a value a customer1 as maven argument, then the output class should be generated based on customer 1 need. If I pass as customer2 as maven argument, then the output class should be generated based on customer 2 need.

Body:
I have annotation processor which need to generate the code based on the user input at compile time.

For example suppose I have a custom annotation, based on user input I need to generate the code.

    @Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface MTAMPFieldProperty {

    String name() default "";

    String value() default "";

    String type() default "";

    boolean nullable() default false;

    int length() default 32;

    String mappedBy() default "";

    String cascade()  default "";

}

    @MTAMPEntity(value = "country")
public class Country {

    @MTAMPFieldProperty(name = "country_id", value = "country_id_sequence")
    private Long countryId;

    @MTAMPFieldProperty(name = "isd")
    private String isd;

    @MTAMPFieldProperty(mappedBy = "countries")
    private List<Person> persons;

    @MTAMPFieldProperty(name = "state_id")
    private States states;

}

I need to process the above Country class and generate the output class based on user input.

Suppose I am passing a value a customer1 as maven argument, then the output class should be generated based on customer 1 need. If I pass as customer2 as maven argument, then the output class should be generated based on customer 2 need.


问:
Big Object in Salesforce
I'm curious because I have a scenario in which I want to move big object records from one big object in production to another big object, because there have been some changes made to the index field.

I want to transfer the records from the first big object to another big object without removing the records from the first big object even though I have 5 million records in the first big object.
In Salesforce, then, an asynchronous procedure would be appropriate.

Because the Big Object has a single ID and I am unable to distinguish the entries based on the index columns, if I use Queueable, it will not work. Because I don't want to delete the records from the First Big Object, there is a limit issue if I pick the records and how I will know which records have been sent.

Second, since Big Object only has one ID and it appears that Batch operates based on ID, I can use the batch class to shift the Big Object records from one to another or may be Database.querylocator does not support big objects as count() is not available.
Because of the Limit issue, we are unable to use Data Loader.

The Iterator batch is supported, but how does it maintain millions of records in Next and HasNext?

So if you know of any asynchronous scenarios that allow us to transfer records from one big object to another without erasing them, please let us know.

Please inform us of the reason why we are unable to generate records for big objects in test class since I am unable to do so.

need help on this scenario

Title: Big Object in Salesforce


问:
Order of 301 redirects
When I add the redirects

```<code>Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/
Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/prospekthalter-prospektstaender/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/
</code>```

The second redirect does not work it will redirect as follows:

```<code>https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/point-of-sale-und-messebedarf/prospekthalter-prospektstaender/
</code>```

As you can see it redirects correctly but adds
 /point-of-sale-und-messebedarf/prospekthalter-prospektstaender/ to the end which is a part of the original URL

But when I change the order to

```<code>Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/prospekthalter-prospektstaender/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/
Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/
</code>```

The redirect works

Can somebody explain me why this happens?

I use an .htaccess file in a Linux environment on a windows server - as I was told

Thanks

Title: Order of 301 redirects

Body:
When I add the redirects

Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/
Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/prospekthalter-prospektstaender/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/

The second redirect does not work it will redirect as follows:

https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/point-of-sale-und-messebedarf/prospekthalter-prospektstaender/

As you can see it redirects correctly but adds
 /point-of-sale-und-messebedarf/prospekthalter-prospektstaender/ to the end which is a part of the original URL

But when I change the order to

Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/prospekthalter-prospektstaender/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/
Redirect 301 /leistungen/werbetechnik/point-of-sale-und-messebedarf/ https://mywebsite.com/werbetechnik-wird-jesto-werbetechnik-gmbh/

The redirect works

Can somebody explain me why this happens?

I use an .htaccess file in a Linux environment on a windows server - as I was told

Thanks


问:
Facebook Business Verification - UK based freelancer
A wild adventurer trying to create an app for Facebook here! I tried asking this question in the meta developer forums but those seem to be quite abandoned... I feel that this is more of a law / business related question, but I'm hoping someone here has faced/solved a similar issue...!

The Problem

I am a freelance software developer in the UK. I have developed an app to automatically retreive some data for one of my client's Facebook Page - which until now they retrieved manually. While it is a simple app, it does ask for some data that is only given to Business Verified apps. I'd like to verify it but, as a freelancer, I do not have a business registered - just to clarify, in case it works different elsewehre, this is not ilegal. I am registered as a freelancer and pay tax, but in the UK this does not mean registering as a business.

The Possible Solution

After giving it some thought, the only solution that I can find to this is to register a new business and leave it dormant. I am not going to trade with that business, as it would be created just for the sake of this app - which I want to leave open for anyone to use with no cost. According to gov.uk Corporation Tax page, as long as a business is not trading it is considered dormant and therefore you shouldn't pay any tax. At the same time, it seems that I'd still have to do some annual paperwork which is not ideal.

The Question(s)

Has anyone done this? Could this become too complicated for what I am trying to achieve?


问:
Is it possible to log on with a user with an application that is started on windows starup?
In a computer, I have a gRPC service that is hosted in a console application.

This console application is started when the system starts. For that, I used a schedule task thas starts the console application with the user A and I set to start on startup, no need the user log on. So the console application starts when system starts, not when the log on of the user.

Then, the state of the computer is in the log on screen and the gRPC service started. I would like to know if there is some way in C# to log on into the user A, perhaps with a command line or powershell command.

The idea it is log on in the user remotely from a mobile application.

Thanks.


问:
Passport: Example with passport-local for RESTful APIs
I'm new with passport and I'm trying to implement a simple email/password authentication in an express server. I have express-session and passport-local strategy setups and I can see the session is authenticated after the login request but it's not clear to me what happens after that.

For instance, I'm not seeing the serialize/deserialize passport function in action and the response doesn't contain any cookie in the header. I'm probably doing something wrong. Since all documentation that I could find uses the redirect approach which is not ok for a RESTful API, would someone have a code example?

I'm using express-session and passport-local strategies.


问:
CORS troubles on production environment
I'm having some issues on EC2 instance, where I'm trying to deploy app.

BE:

```<code>app = FastAPI(title="App", openapi_url="/openapi.json")
    origins = ['http://localhost']
    app.add_middleware(
        CORSMiddleware,
        allow_origins=origins,
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"]
    )
</code>```

FE:

```<code>axios.get('http://localhost:8000/search/?' + searchQuery)
          .then((res) => {
            setData(JSON.parse(res.data));
          });
</code>```

I'm using also Ngnix with following config:

```<code>server {
  listen 80;

  location / {
    root /usr/share/nginx/html/;
    include /etc/nginx/mime.types;
    try_files $uri $uri/ /index.html;
  }
}
</code>```

So if launch the prod version locally, everything works fine, but on EC2 I'm getting CORS error while trying to fetch data with axios:

Chrome: Cross-Origin Resource Sharing error: InsecurePrivateNetwork

Firefox: CORS Missing Allow Origin

Not sure, what am I missing, should I configure nginx proxy so that public IP of EC2 will be sending requests as localhost? (I was trying also to set origins=[*] but that didn't help)

@Edit:
Docker-compose:

Title: CORS troubles on production environment

Body:
I'm having some issues on EC2 instance, where I'm trying to deploy app.

BE:

app = FastAPI(title="App", openapi_url="/openapi.json")
    origins = ['http://localhost']
    app.add_middleware(
        CORSMiddleware,
        allow_origins=origins,
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"]
    )

FE:

axios.get('http://localhost:8000/search/?' + searchQuery)
          .then((res) => {
            setData(JSON.parse(res.data));
          });

I'm using also Ngnix with following config:

server {
  listen 80;

  location / {
    root /usr/share/nginx/html/;
    include /etc/nginx/mime.types;
    try_files $uri $uri/ /index.html;
  }
}

So if launch the prod version locally, everything works fine, but on EC2 I'm getting CORS error while trying to fetch data with axios:

Chrome: Cross-Origin Resource Sharing error: InsecurePrivateNetwork

Firefox: CORS Missing Allow Origin

Not sure, what am I missing, should I configure nginx proxy so that public IP of EC2 will be sending requests as localhost? (I was trying also to set origins=[*] but that didn't help)

@Edit:
Docker-compose:


问:
go-generics : convert list of objects implements client.Object to a list
We have the following type which is generic resource list,
the struct has 4 generic parameters (all related to the object list pointer type) but I couldn't find a way to reduce it.

```<code>import(
  ...
   "sigs.k8s.io/controller-runtime/pkg/client"
)

type GenResourceLister[OBJ any, OBJPTR interface {
    client.Object
    *OBJ
}, LIST interface {
    GetItems() []OBJ
}, LISTPTR interface {
    client.ObjectList
    *LIST
}] struct{}
</code>```

The following function has 2 generic parameters, one of them is the element type of a slice parameter, but I think the other one (its pointer type) prevents the type inference so the parameters have to be specified on each call. I couldn't find a way to get rid of either of them.

```<code>// itemsToObjectList converts a list of objects whose pointer
// type implements client.Object to a list of client.Object

func itemsToObjectList[T any, TPTR interface {
    client.Object
    *T
}](items []T) []client.Object {
    objs := make([]client.Object, 0, len(items))
    for _, resource := range items {
        resource := resource
        objs = append(objs, TPTR(&resource))
    }
    return objs
}

func (l *GenResourceLister[OBJ, OBJPTR, LIST, LISTPTR]) ListResources(
    context context.Context,
    cli client.Client,
    listOptions *client.ListOptions
) ([]client.Object, error) {
    resources := new(LIST)
    if err := cli.List(context, LISTPTR(resources), listOptions); err != nil {
        return nil, err
    }
    items := (*resources).GetItems()
    return itemsToObjectList[OBJ, OBJPTR](items), nil
}
</code>```

Btw,
The code is working, we just want to make it simpler and clearer...

Body:
We have the following type which is generic resource list,
the struct has 4 generic parameters (all related to the object list pointer type) but I couldn't find a way to reduce it.

import(
  ...
   "sigs.k8s.io/controller-runtime/pkg/client"
)

type GenResourceLister[OBJ any, OBJPTR interface {
    client.Object
    *OBJ
}, LIST interface {
    GetItems() []OBJ
}, LISTPTR interface {
    client.ObjectList
    *LIST
}] struct{}

The following function has 2 generic parameters, one of them is the element type of a slice parameter, but I think the other one (its pointer type) prevents the type inference so the parameters have to be specified on each call. I couldn't find a way to get rid of either of them.

// itemsToObjectList converts a list of objects whose pointer
// type implements client.Object to a list of client.Object

func itemsToObjectList[T any, TPTR interface {
    client.Object
    *T
}](items []T) []client.Object {
    objs := make([]client.Object, 0, len(items))
    for _, resource := range items {
        resource := resource
        objs = append(objs, TPTR(&resource))
    }
    return objs
}

func (l *GenResourceLister[OBJ, OBJPTR, LIST, LISTPTR]) ListResources(
    context context.Context,
    cli client.Client,
    listOptions *client.ListOptions
) ([]client.Object, error) {
    resources := new(LIST)
    if err := cli.List(context, LISTPTR(resources), listOptions); err != nil {
        return nil, err
    }
    items := (*resources).GetItems()
    return itemsToObjectList[OBJ, OBJPTR](items), nil
}

Btw,
The code is working, we just want to make it simpler and clearer...


问:
Problem in data type declaration while summation of natural numbers
Hello I am relatively new to Java...
For a given a number N. Find the sum of all numbers from 1 to N.
I am getting the output for relatively small numbers but for of greater magnitude i have getting wrong answer.

Input:
989898

Expected Ouput:489949520151

Output of the code below:
323248407

```<code>import java.util.*;
import java.lang.*;
import java.io.*;

class Summation
{
    public static void main (String[] args) throws java.lang.Exception
    {
        try {
            Scanner input = new Scanner(System.in);
            int n = input.nextInt(); // the code works correct if I put long here
            long sum = (n*(1+n))/2;
            System.out.print(sum);
            input.close();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}
</code>```

I understand where I am going wrong but I cannot understand why I am going wrong.

As per my knowledge int accepts from range -2147483648 to 2147483647, so my input data type of int must not be a problem for the number "989898" right? When I put long as data type for n as input the code gives the expected output.

I know my output is pretty big for my input but I have declared sum as long already.

I understand there is a simple reason but I cant come up with my own :)
Some resources that can help me understand the solution behind this is appreciated.

Already got the correct answer just need a reason for the difference between both outputs.

Body:
Hello I am relatively new to Java...
For a given a number N. Find the sum of all numbers from 1 to N.
I am getting the output for relatively small numbers but for of greater magnitude i have getting wrong answer.

Input:
989898

Expected Ouput:489949520151

Output of the code below:
323248407

import java.util.*;
import java.lang.*;
import java.io.*;

class Summation
{
    public static void main (String[] args) throws java.lang.Exception
    {
        try {
            Scanner input = new Scanner(System.in);
            int n = input.nextInt(); // the code works correct if I put long here
            long sum = (n*(1+n))/2;
            System.out.print(sum);
            input.close();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}

I understand where I am going wrong but I cannot understand why I am going wrong.

As per my knowledge int accepts from range -2147483648 to 2147483647, so my input data type of int must not be a problem for the number "989898" right? When I put long as data type for n as input the code gives the expected output.

I know my output is pretty big for my input but I have declared sum as long already.

I understand there is a simple reason but I cant come up with my own :)
Some resources that can help me understand the solution behind this is appreciated.

Already got the correct answer just need a reason for the difference between both outputs.


问:
how i can get attribute request in service symofny 6
I defined apiVersion globally in for every endpoints.

```<code>#config/routes/annotations.yaml

controllers:
    resource: ../../src/Controller/
    type: annotation
    prefix: api/v{apiVersion}
    requirements:
        apiVersion: '1|2'
    defaults:
        apiVersion: 1
</code>```

and want to have it as parameters in service

```<code>#config/services.yaml
parameters:
    app.apiVersion: ?????
</code>```

What i am trying to get attribute from request and defined it global as parameters in service.

Body:
I defined apiVersion globally in for every endpoints.

#config/routes/annotations.yaml

controllers:
    resource: ../../src/Controller/
    type: annotation
    prefix: api/v{apiVersion}
    requirements:
        apiVersion: '1|2'
    defaults:
        apiVersion: 1

and want to have it as parameters in service

#config/services.yaml
parameters:
    app.apiVersion: ?????

What i am trying to get attribute from request and defined it global as parameters in service.


问:
Python Code to Detect Greetings and Acknownledgments
I am currently coding a program using NLP in Python to analyze the sentiment of a quarterly earnings call by public companies. I calculate the sentiment based on a dictionary approach, meaning that I count the number of positive/ negative words in the call and put that into relation to the total number of words to calculate a sentiment score for each call.

In the Q&A part of the call, some analysts from banks ask questions to the management team of the company.

And usually before asking the analysts say something like "Good Morning." and after they got the answer from the management team they say something like "Perfect, thank you." or "Great, thank you."

But the dictionary approach does count these words like "Good" or "Great" as positive, but they do not belong to the content of the call.

So my goal is to have a program/ algorithm that detects these kinds of non-relevant answers, so that I can remove them from the text. But I have never done something in this kind of direction. So, I don't know at all on how to approach this problem and I also could not find anything like this here on Stackoverflow nor somewhere else.

I was thinking about taking maybe 50 of these kind of sentences that I want to delete and label them with 1, and take 50 sentences that actually contain content and then label them as 0 and train an algorithm to differentiate these two types, but I have no idea how to implement something like this in Python?

Does anybody have an idea? That would be much appreciated!


问:
Accessing treeview from a function, getting "You cannot call a method on a null-valued expression"
My form is not created using in-line script but from reading in an XAML file.

I like to keep my functions in a separate file and call them from the main
script itself.

Two of my functions which address elements on the form work perfectly
but when called, the non-working function reports this:

```<code>You cannot call a method on a null-valued expression.
</code>```

Here's the form ($frmMain) being created:

```<code>$XAML_Reader=(New-Object System.Xml.XmlNodeReader $xmlDoc)

Try {
    $global:frmMain=[Windows.Markup.XamlReader]::Load($XAML_Reader)
} Catch {
    Write-Warning "XML Load failed with error: $($Error[0])"
    Throw
}

#===========================================================================
# Load XAML objects
#===========================================================================
Try {
    $xmlDoc.SelectNodes("//*[@Name]") | ForEach-Object { Set-Variable -Name ($_.Name) -Value $global:frmMain.FindName($_.Name) -Scope Global }
} Catch {
    Write-Warning "XML SelectNodes failed with error: $($Error[0])"
    Throw
}

Get-Variable *
</code>```

Here's the part of the script which works. The array 'arrUserCategories'
gets created by a function in my function block. The listview control
'lisUserCategories' gets created when the XAML file is read in:

```<code>If ($global:arrUserCategories.Count -gt 0)
    {
    for($i = 0; $i -lt $global:arrUserCategories.Count; $i++)
        {
        $Listbox_Item=$global:arrUserCategories[$i].LocalizedCategoryInstanceName
        Write-Host "Adding '$Listbox_Item' to 'User categories' list-box"
        $global:lisUserCategories.Items.Add($Listbox_Item)
        }
    }
</code>```

Another almost identical function/script combo adds 'Administrative categories' to another listbox.
That all works.

Here's what doesn't work. The main script calls this function which is in the function block script:

```<code>Begin-CollectionsTreeview
</code>```

This is the function:

```<code>Function Begin-CollectionsTreeview{
    $global:objNode = New-Object -TypeName System.Windows.Forms.TreeNode
    $global:objNode.Tag = "ROOT"
    $global:objNode.Text    = "ROOT"
    $global:objNode.Name    = "Site: $global:strSCCMSiteCode"
    # || This failed (hence commented-out)  ||
    # \/                    \/
    #$global:tvwCollections.Nodes.Add($global:objNode)

    # || So I tried this, which also failed ||
    # \/                    \/
    $global:objTV_Collections=$global:frmMain.FindName("tvwCollections")
    $global:objTV_Collections.Nodes.Add($global:objNode)
}
</code>```

Once I have the treeview begun, I can move on to adding the nodes.

Notes:

I am a PS newbie.

I am migrating this from an HTA of mine that I've been using for
many years and keeping things the same as far as possible for now
makes that task simpler.

I'm using global variables. Once everything works, I'll update the
package so that variables get passed between script, functions, etc.

By the same token, my naming convention may not be standard PS style.

Yes, I know the PS1s should be PSMs, etc., etc. For now, they're just not, OK?

If you're testing this and don't have either 'SCCM Client' or
'SCCM Endpoint Configuration Manager Console' installed, you'll need to do
some editing to remove a bunch of function calls or edit them so that they
return some data.

Body:
My form is not created using in-line script but from reading in an XAML file.

I like to keep my functions in a separate file and call them from the main
script itself.

Two of my functions which address elements on the form work perfectly
but when called, the non-working function reports this:

You cannot call a method on a null-valued expression.

Here's the form ($frmMain) being created:

$XAML_Reader=(New-Object System.Xml.XmlNodeReader $xmlDoc)

Try {
    $global:frmMain=[Windows.Markup.XamlReader]::Load($XAML_Reader)
} Catch {
    Write-Warning "XML Load failed with error: $($Error[0])"
    Throw
}

#===========================================================================
# Load XAML objects
#===========================================================================
Try {
    $xmlDoc.SelectNodes("//*[@Name]") | ForEach-Object { Set-Variable -Name ($_.Name) -Value $global:frmMain.FindName($_.Name) -Scope Global }
} Catch {
    Write-Warning "XML SelectNodes failed with error: $($Error[0])"
    Throw
}

Get-Variable *

Here's the part of the script which works. The array 'arrUserCategories'
gets created by a function in my function block. The listview control
'lisUserCategories' gets created when the XAML file is read in:

If ($global:arrUserCategories.Count -gt 0)
    {
    for($i = 0; $i -lt $global:arrUserCategories.Count; $i++)
        {
        $Listbox_Item=$global:arrUserCategories[$i].LocalizedCategoryInstanceName
        Write-Host "Adding '$Listbox_Item' to 'User categories' list-box"
        $global:lisUserCategories.Items.Add($Listbox_Item)
        }
    }

Another almost identical function/script combo adds 'Administrative categories' to another listbox.
That all works.

Here's what doesn't work. The main script calls this function which is in the function block script:

Begin-CollectionsTreeview

This is the function:

Function Begin-CollectionsTreeview{
    $global:objNode = New-Object -TypeName System.Windows.Forms.TreeNode
    $global:objNode.Tag = "ROOT"
    $global:objNode.Text    = "ROOT"
    $global:objNode.Name    = "Site: $global:strSCCMSiteCode"
    # || This failed (hence commented-out)  ||
    # \/                    \/
    #$global:tvwCollections.Nodes.Add($global:objNode)

    # || So I tried this, which also failed ||
    # \/                    \/
    $global:objTV_Collections=$global:frmMain.FindName("tvwCollections")
    $global:objTV_Collections.Nodes.Add($global:objNode)
}

Once I have the treeview begun, I can move on to adding the nodes.

Notes:

I am a PS newbie.

I am migrating this from an HTA of mine that I've been using for
many years and keeping things the same as far as possible for now
makes that task simpler.

I'm using global variables. Once everything works, I'll update the
package so that variables get passed between script, functions, etc.

By the same token, my naming convention may not be standard PS style.

Yes, I know the PS1s should be PSMs, etc., etc. For now, they're just not, OK?

If you're testing this and don't have either 'SCCM Client' or
'SCCM Endpoint Configuration Manager Console' installed, you'll need to do
some editing to remove a bunch of function calls or edit them so that they
return some data.


问:
Modal is invisible but its pressable
I have this weird thing going on.I navigate between screens , but when i switch screens i press a button and a modal must shown.Which its not, but the modal is there ... invisible.

So when i press an ivisible button(which i remember where it is) then it navigate to the screen that i want .

Its very tricky i dont understand why this happening .

Edit : i put a console.log for the state of the modal and its true ,it seems to overlay with my home page .When i return from a navigation screen it seems that is not re-renders the state .Why?

```<code> <Modal
          animationType="fade"
          transparent={true}
          visible={ModalBookVisible}
          onRequestClose={() => {
          setModalBookVisible(!ModalBookVisible);
        }}
        >

        <View style = {styles.bookModal}>
          {/* Book title */}
          <Text style = {styles.bookShowTitleText}>{bookShow.title}</Text>

          {/* Book category */}
          <Text style = {styles.bookShowCategoryText}>Category : {bookShow.category}</Text>

           {/* Check if the book is Bought ,so it can show it,also we send the book */}
           <Pressable style = {styles.pressableInsideModal} onPress = {() => { boughtChecker() }}>
             <Text style = {styles.textInsideModal}>Show Book Bought</Text>
           </Pressable>

          {/* Check if the book is Rented ,so it can show it,also we send the book */}
           <Pressable style = {styles.pressableInsideModal} onPress = {() => { rentChecker() }}>
             <Text style = {styles.textInsideModal}>Show Book Rented</Text>
           </Pressable>

          {/* Pressable to Buy the book */}
          <Pressable style = {styles.pressableInsideModal} onPress={ () => {navigation.navigate('Payment',{paramKey:bookShow})}}>
            <Text style = {styles.textInsideModal}>Buy</Text>
          </Pressable>

          {/* Pressable to Rent the book */}
          <Pressable style = {styles.pressableInsideModal} onPress={ () => {navigation.navigate('PaymentRent',{paramKey:bookShow})}}>
            <Text style = {styles.textInsideModal}>Rent</Text>
          </Pressable>

          {/* Pressable to close the modal */}
          <Pressable style = {styles.pressableInsideModal} onPress={ () => {setModalBookVisible(!ModalBookVisible)}}>
            <Text style = {styles.textInsideModal}>Close</Text>
          </Pressable>

           {/* Here we see the book description */}
          <ScrollView style = {styles.scrollViewForDescribeModal}>
            <Text style = {styles.bookShowDescribeText}>Describe : </Text>
            <Text style = {styles.describeText}>{bookShow.describe}</Text>
          </ScrollView>

          </View>

      </Modal>
</code>```

Modal CSS

```<code>//Modal for Books
  bookModal:{
    alignItems:'center',
    height:Platform.OS ==='ios' ? '70%' : '80%',
    width:'80%',
    backgroundColor:'black',
    marginTop:Platform.OS ==='ios' ? '40%' : '19%',
    marginLeft:'10%',
    borderRadius:25,
    borderWidth:1,
    elevation:15,
    padding:'1%'
  },
  //Modal Texts
  bookShowTitleText:{
    textAlign:'center',
    fontWeight:'bold',
    color:'white',
    fontSize: 15
  },
  bookShowCategoryText:{
    textAlign:'center',
    color:'white',
    fontSize : 15
  },
  textInsideModal:{
    textAlign:'center',
    color:'white',
    fontSize : 14
  },
  bookShowDescribeText:{
    textAlign:'center',
    fontWeight:'bold',
    fontSize : 15
  },
  scrollViewForDescribeModal:{
    backgroundColor:'white',
    flexDirection:'column',
    padding:'5%',
    borderRadius:15,
  },
  describeText:{
    fontSize : 15
  },
  //Modal pressables
  pressableInsideModal:{
    borderWidth:6,
    borderRadius:11,
    elevation:5,
    backgroundColor:'grey',
    width:'45%',
    height:Platform.OS ==='ios' ? '7%' : '9%',
    paddingTop:'2%',
    alignItems:'center'
  },
</code>```

Title: Modal is invisible but its pressable

Body:
I have this weird thing going on.I navigate between screens , but when i switch screens i press a button and a modal must shown.Which its not, but the modal is there ... invisible.

So when i press an ivisible button(which i remember where it is) then it navigate to the screen that i want .

Its very tricky i dont understand why this happening .

Edit : i put a console.log for the state of the modal and its true ,it seems to overlay with my home page .When i return from a navigation screen it seems that is not re-renders the state .Why?

 <Modal
          animationType="fade"
          transparent={true}
          visible={ModalBookVisible}
          onRequestClose={() => {
          setModalBookVisible(!ModalBookVisible);
        }}
        >

        <View style = {styles.bookModal}>
          {/* Book title */}
          <Text style = {styles.bookShowTitleText}>{bookShow.title}</Text>

          {/* Book category */}
          <Text style = {styles.bookShowCategoryText}>Category : {bookShow.category}</Text>

           {/* Check if the book is Bought ,so it can show it,also we send the book */}
           <Pressable style = {styles.pressableInsideModal} onPress = {() => { boughtChecker() }}>
             <Text style = {styles.textInsideModal}>Show Book Bought</Text>
           </Pressable>

          {/* Check if the book is Rented ,so it can show it,also we send the book */}
           <Pressable style = {styles.pressableInsideModal} onPress = {() => { rentChecker() }}>
             <Text style = {styles.textInsideModal}>Show Book Rented</Text>
           </Pressable>

          {/* Pressable to Buy the book */}
          <Pressable style = {styles.pressableInsideModal} onPress={ () => {navigation.navigate('Payment',{paramKey:bookShow})}}>
            <Text style = {styles.textInsideModal}>Buy</Text>
          </Pressable>

          {/* Pressable to Rent the book */}
          <Pressable style = {styles.pressableInsideModal} onPress={ () => {navigation.navigate('PaymentRent',{paramKey:bookShow})}}>
            <Text style = {styles.textInsideModal}>Rent</Text>
          </Pressable>

          {/* Pressable to close the modal */}
          <Pressable style = {styles.pressableInsideModal} onPress={ () => {setModalBookVisible(!ModalBookVisible)}}>
            <Text style = {styles.textInsideModal}>Close</Text>
          </Pressable>

           {/* Here we see the book description */}
          <ScrollView style = {styles.scrollViewForDescribeModal}>
            <Text style = {styles.bookShowDescribeText}>Describe : </Text>
            <Text style = {styles.describeText}>{bookShow.describe}</Text>
          </ScrollView>

          </View>

      </Modal>

Modal CSS

//Modal for Books
  bookModal:{
    alignItems:'center',
    height:Platform.OS ==='ios' ? '70%' : '80%',
    width:'80%',
    backgroundColor:'black',
    marginTop:Platform.OS ==='ios' ? '40%' : '19%',
    marginLeft:'10%',
    borderRadius:25,
    borderWidth:1,
    elevation:15,
    padding:'1%'
  },
  //Modal Texts
  bookShowTitleText:{
    textAlign:'center',
    fontWeight:'bold',
    color:'white',
    fontSize: 15
  },
  bookShowCategoryText:{
    textAlign:'center',
    color:'white',
    fontSize : 15
  },
  textInsideModal:{
    textAlign:'center',
    color:'white',
    fontSize : 14
  },
  bookShowDescribeText:{
    textAlign:'center',
    fontWeight:'bold',
    fontSize : 15
  },
  scrollViewForDescribeModal:{
    backgroundColor:'white',
    flexDirection:'column',
    padding:'5%',
    borderRadius:15,
  },
  describeText:{
    fontSize : 15
  },
  //Modal pressables
  pressableInsideModal:{
    borderWidth:6,
    borderRadius:11,
    elevation:5,
    backgroundColor:'grey',
    width:'45%',
    height:Platform.OS ==='ios' ? '7%' : '9%',
    paddingTop:'2%',
    alignItems:'center'
  },


问:
How to solve ArchTest violation of Config Layer accessed from Service Layer
My project violates a given structure test. I don't understand why the "config" layer must not be accessed by any other. Of course, I could use @Value annotation to directly access some K,V from a kind of application.properties file, but it feels like jumping from the frying pan into the fire. Additionally the project I do, has already a lot of @Configuration files clustered in the "config" package and all of them use different *.YML files, so I want to stick to this pattern.

How can I solve the violation problem and access configuration properties nonetheless from another layer that holds a service class and requires configuration data from the conf layer?

As an illustration I'll put my cut and relevant code here, beginning with the TEST:

@AnalyzeClasses(packagesOf = MySecretApp.class, importOptions = DoNotIncludeTests.class)
class TechnicalStructureTest {

    // prettier-ignore
    @ArchTest
    static final ArchRule respectsTechnicalArchitectureLayers = layeredArchitecture()
        .layer("Config").definedBy("..config..")
        .layer("Web").definedBy("..web..")
        .optionalLayer("Service").definedBy("..service..")
        .layer("Security").definedBy("..security..")
        .layer("Persistence").definedBy("..repository..")
        .layer("Domain").definedBy("..domain..")

        .whereLayer("Config").mayNotBeAccessedByAnyLayer()
        .whereLayer("Web").mayOnlyBeAccessedByLayers("Config")
        .whereLayer("Service").mayOnlyBeAccessedByLayers("Web", "Config")
        .whereLayer("Security").mayOnlyBeAccessedByLayers("Config", "Service", "Web")
        .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service", "Security", "Web", "Config")
        .whereLayer("Domain").mayOnlyBeAccessedByLayers("Persistence", "Service", "Security", "Web", "Config")

        .ignoreDependency(belongToAnyOf(MySecretApp.class), alwaysTrue())
        .ignoreDependency(alwaysTrue(), belongToAnyOf(

            dev.spectre.dominance.config.Constants.class,
            dev.spectre.dominance.config.ApplicationProperties.class
        ));
}

```
<p>When I run the IT, I receive ERRORs of which I will give an example here:</p>
<pre class="lang-java prettyprint-override"><code>Constructor <dev.spectre.dominance.service.PrintService.<init>(dev.spectre.dominance.config.PrintServiceProperties)> has parameter of type <dev.spectre.dominance.PrintServiceProperties> in (PrintService.java:0)
</code>```

The SERVICE class which violates the architecture rule has this structure:

@Service
public class PrintService {

    private final PrintServiceProperties printServiceProperties;

    public PrintService(PrintServiceProperties printServiceProperties) {
        this.printServiceProperties = printServiceProperties;
    }

    @Async
    public void sendPrintjob(PrintJob job) {
        log.debug("Will send print job to Kafka with content: {} ", job.toString());
        RestTemplate template = new RestTemplate();
        template.postForEntity(printServiceProperties.getUrl(), job, PrintJobAnswer.class);
    }
}
```
<p>The CONFIGURATION class has this structure:</p>
<pre class="lang-java prettyprint-override"><code>@Configuration
@ConfigurationProperties(prefix = "spring.printer")
public class PrintServiceProperties {

    private String url;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
</code>```

Body:
My project violates a given structure test. I don't understand why the "config" layer must not be accessed by any other. Of course, I could use @Value annotation to directly access some K,V from a kind of application.properties file, but it feels like jumping from the frying pan into the fire. Additionally the project I do, has already a lot of @Configuration files clustered in the "config" package and all of them use different *.YML files, so I want to stick to this pattern.

How can I solve the violation problem and access configuration properties nonetheless from another layer that holds a service class and requires configuration data from the conf layer?

As an illustration I'll put my cut and relevant code here, beginning with the TEST:

@AnalyzeClasses(packagesOf = MySecretApp.class, importOptions = DoNotIncludeTests.class)
class TechnicalStructureTest {

    // prettier-ignore
    @ArchTest
    static final ArchRule respectsTechnicalArchitectureLayers = layeredArchitecture()
        .layer("Config").definedBy("..config..")
        .layer("Web").definedBy("..web..")
        .optionalLayer("Service").definedBy("..service..")
        .layer("Security").definedBy("..security..")
        .layer("Persistence").definedBy("..repository..")
        .layer("Domain").definedBy("..domain..")

        .whereLayer("Config").mayNotBeAccessedByAnyLayer()
        .whereLayer("Web").mayOnlyBeAccessedByLayers("Config")
        .whereLayer("Service").mayOnlyBeAccessedByLayers("Web", "Config")
        .whereLayer("Security").mayOnlyBeAccessedByLayers("Config", "Service", "Web")
        .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service", "Security", "Web", "Config")
        .whereLayer("Domain").mayOnlyBeAccessedByLayers("Persistence", "Service", "Security", "Web", "Config")

        .ignoreDependency(belongToAnyOf(MySecretApp.class), alwaysTrue())
        .ignoreDependency(alwaysTrue(), belongToAnyOf(

            dev.spectre.dominance.config.Constants.class,
            dev.spectre.dominance.config.ApplicationProperties.class
        ));
}

When I run the IT, I receive ERRORs of which I will give an example here:

Constructor <dev.spectre.dominance.service.PrintService.<init>(dev.spectre.dominance.config.PrintServiceProperties)> has parameter of type <dev.spectre.dominance.PrintServiceProperties> in (PrintService.java:0)

The SERVICE class which violates the architecture rule has this structure:

@Service
public class PrintService {

    private final PrintServiceProperties printServiceProperties;

    public PrintService(PrintServiceProperties printServiceProperties) {
        this.printServiceProperties = printServiceProperties;
    }

    @Async
    public void sendPrintjob(PrintJob job) {
        log.debug("Will send print job to Kafka with content: {} ", job.toString());
        RestTemplate template = new RestTemplate();
        template.postForEntity(printServiceProperties.getUrl(), job, PrintJobAnswer.class);
    }
}

The CONFIGURATION class has this structure:

@Configuration
@ConfigurationProperties(prefix = "spring.printer")
public class PrintServiceProperties {

    private String url;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}


问:
How to play Nest Cam webRTC stream into android app?
I wanted to play a Nest Camera stream in an Android app. As google has provided the sample app for web only, I wanted to play the stream in the native Android app using the webRTC SDK, and I am close enough to play the stream.

But though I am able to get the video tracks, these tracks are not rendered by the app, and the stream is not playing.

Could anyone share a sample for it resp. help me with what I have got so far?

I have created the offerSDP, set it on local description, posted into the google APIs, and I am getting the proper answerSDP in return.

Here I am setting it on remoted description:

```<code>try {
    peerConnection.setRemoteDescription(new SdpObserver(){

        @Override
        public void onCreateSuccess(SessionDescription sessionDescription) {}

        @Override
        public void onSetSuccess() {}

        @Override
        public void onCreateFailure(String s) {}

        @Override
        public void onSetFailure(String s) {}
    }, session);
}
catch (JSONException e) {
    e.printStackTrace();
}

@Override
public void onError(ANError anError) {
    Log.e("********", "response: " + anError.getErrorBody());
}
</code>```

Multiple times the AddStream Call back gets hit and it returns an empty array, and after some time, when the iceconnection is connected, I get the tracks properly as well. But still the stream is not playable:

```<code>@Override
public void onAddStream(MediaStream mediaStream) {
    super.onAddStream(mediaStream);
    if (mediaStream.videoTracks != null && mediaStream.videoTracks.size() > 0){
        runOnUiThread(new Runnable(){
            @Override
            public void run() {
                initializeSurfaceView(surfaceViewRenderer);
//                mediaStream.videoTracks.get(0).addSink(surfaceViewRenderer);
                VideoTrack remoteVideoTrack = mediaStream.videoTracks.get(0);
                remoteVideoTrack.setEnabled(true);
                remoteVideoTrack.addSink(surfaceViewRenderer);
//                ProxyVideoSink videoSink = new ProxyVideoSink();
//                videoSink.setTarget(mRemoteSurfaceViewRenderer);
//                remoteVideoTrack.addSink(videoSink);
            }
        });
    }
}
</code>```

Body:
I wanted to play a Nest Camera stream in an Android app. As google has provided the sample app for web only, I wanted to play the stream in the native Android app using the webRTC SDK, and I am close enough to play the stream.

But though I am able to get the video tracks, these tracks are not rendered by the app, and the stream is not playing.

Could anyone share a sample for it resp. help me with what I have got so far?

I have created the offerSDP, set it on local description, posted into the google APIs, and I am getting the proper answerSDP in return.

Here I am setting it on remoted description:

try {
    peerConnection.setRemoteDescription(new SdpObserver(){

        @Override
        public void onCreateSuccess(SessionDescription sessionDescription) {}

        @Override
        public void onSetSuccess() {}

        @Override
        public void onCreateFailure(String s) {}

        @Override
        public void onSetFailure(String s) {}
    }, session);
}
catch (JSONException e) {
    e.printStackTrace();
}

@Override
public void onError(ANError anError) {
    Log.e("********", "response: " + anError.getErrorBody());
}

Multiple times the AddStream Call back gets hit and it returns an empty array, and after some time, when the iceconnection is connected, I get the tracks properly as well. But still the stream is not playable:

@Override
public void onAddStream(MediaStream mediaStream) {
    super.onAddStream(mediaStream);
    if (mediaStream.videoTracks != null && mediaStream.videoTracks.size() > 0){
        runOnUiThread(new Runnable(){
            @Override
            public void run() {
                initializeSurfaceView(surfaceViewRenderer);
//                mediaStream.videoTracks.get(0).addSink(surfaceViewRenderer);
                VideoTrack remoteVideoTrack = mediaStream.videoTracks.get(0);
                remoteVideoTrack.setEnabled(true);
                remoteVideoTrack.addSink(surfaceViewRenderer);
//                ProxyVideoSink videoSink = new ProxyVideoSink();
//                videoSink.setTarget(mRemoteSurfaceViewRenderer);
//                remoteVideoTrack.addSink(videoSink);
            }
        });
    }
}


问:
Error (Xcode): Framework not found DKImagePickerController
I keep running into this error in flutter when trying to run the app:</p>
```<code>Error (Xcode): Framework not found DKImagePickerController
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited
</code>```

Body:
I keep running into this error in flutter when trying to run the app:

Error (Xcode): Framework not found DKImagePickerController
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited