问:
Django haystack with AWS open search (elastic search compatible)
Im trying to use AWS open search with Django Haystacks, which is fully compatible (Amazon have suggested). However when I try launch "./manage.py rebuild_index" when pointing a connection at the platform I am met with the error

```<code>Traceback (most recent call last):
  File "/data/app/myapp/./manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/site-packages/haystack/management/commands/rebuild_index.py", line 64, in handle
    call_command("clear_index", **clear_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 198, in call_command
    return command.execute(*args, **defaults)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/site-packages/haystack/management/commands/clear_index.py", line 64, in handle
    backend.clear(commit=self.commit)
  File "/usr/local/lib/python3.10/site-packages/haystack/backends/elasticsearch7_backend.py", line 117, in clear
    self.conn.indices.delete(index=self.index_name, ignore=404)
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/client/utils.py", line 347, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/client/indices.py", line 334, in delete
    return self.transport.perform_request(
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/transport.py", line 421, in perform_request
    _ProductChecker.raise_error(self._verified_elasticsearch)
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/transport.py", line 638, in raise_error
    raise UnsupportedProductError(message)
elasticsearch.exceptions.UnsupportedProductError: The client noticed that the server is not a supported distribution of Elasticsearch
</code>```

when we've dug into this by looking in "site-packages/elasticsearch/transport.py" and the differences between the amazon headers and an elastic search header the only differences between the two is that amazon openserach "build_flavour" in it. Build flavour is used in the check_product function from transport.py

```<code>@classmethod
    def check_product(cls, headers, response):
        # type: (dict[str, str], dict[str, str]) -> int
        """Verifies that the server we're talking to is Elasticsearch.
        Does this by checking HTTP headers and the deserialized
        response to the 'info' API. Returns one of the states above.
        """
    try:
        version = response.get("version", {})
        version_number = tuple(
            int(x) if x is not None else 999
            for x in re.search(
                r"^([0-9]+)\.([0-9]+)(?:\.([0-9]+))?", version["number"]
            ).groups()
        )
    except (KeyError, TypeError, ValueError, AttributeError):
        # No valid 'version.number' field, effectively 0.0.0
        version = {}
        version_number = (0, 0, 0)

    # Check all of the fields and headers for missing/valid values.
    try:
        bad_tagline = response.get("tagline", None) != "You Know, for Search"
        bad_build_flavor = version.get("build_flavor", None) != "default"
        bad_product_header = (
            headers.get("x-elastic-product", None) != "Elasticsearch"
        )
    except (AttributeError, TypeError):
        bad_tagline = True
        bad_build_flavor = True
        bad_product_header = True

    # 7.0-7.13 and there's a bad 'tagline' or unsupported 'build_flavor'
    if (7, 0, 0) <= version_number < (7, 14, 0):
        if bad_tagline:
            return cls.UNSUPPORTED_PRODUCT
        elif bad_build_flavor:
            return cls.UNSUPPORTED_DISTRIBUTION

    elif (
        # No version or version less than 6.x
        version_number < (6, 0, 0)
        # 6.x and there's a bad 'tagline'
        or ((6, 0, 0) <= version_number < (7, 0, 0) and bad_tagline)
        # 7.14+ and there's a bad 'X-Elastic-Product' HTTP header
        or ((7, 14, 0) <= version_number and bad_product_header)
    ):
        return cls.UNSUPPORTED_PRODUCT

    return True
</code>```

I commented out the build flavour checks in this function, and then the index built successfully! So I went to post it as an issue on the haystacks GitHub and I was going to fork it so I could remove those lines, but the file "elasticsearch/transport.py" and the code "def check_product" doesn't exist in that repo (when I search the repo via GitHub), its pulled from somewhere else, and I can't find it online anywhere.

hopefully someone can point me in the right direction?

Thanks

Body:
Im trying to use AWS open search with Django Haystacks, which is fully compatible (Amazon have suggested). However when I try launch "./manage.py rebuild_index" when pointing a connection at the platform I am met with the error

Traceback (most recent call last):
  File "/data/app/myapp/./manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/site-packages/haystack/management/commands/rebuild_index.py", line 64, in handle
    call_command("clear_index", **clear_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 198, in call_command
    return command.execute(*args, **defaults)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/site-packages/haystack/management/commands/clear_index.py", line 64, in handle
    backend.clear(commit=self.commit)
  File "/usr/local/lib/python3.10/site-packages/haystack/backends/elasticsearch7_backend.py", line 117, in clear
    self.conn.indices.delete(index=self.index_name, ignore=404)
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/client/utils.py", line 347, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/client/indices.py", line 334, in delete
    return self.transport.perform_request(
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/transport.py", line 421, in perform_request
    _ProductChecker.raise_error(self._verified_elasticsearch)
  File "/usr/local/lib/python3.10/site-packages/elasticsearch/transport.py", line 638, in raise_error
    raise UnsupportedProductError(message)
elasticsearch.exceptions.UnsupportedProductError: The client noticed that the server is not a supported distribution of Elasticsearch

when we've dug into this by looking in "site-packages/elasticsearch/transport.py" and the differences between the amazon headers and an elastic search header the only differences between the two is that amazon openserach "build_flavour" in it. Build flavour is used in the check_product function from transport.py

@classmethod
    def check_product(cls, headers, response):
        # type: (dict[str, str], dict[str, str]) -> int
        """Verifies that the server we're talking to is Elasticsearch.
        Does this by checking HTTP headers and the deserialized
        response to the 'info' API. Returns one of the states above.
        """
    try:
        version = response.get("version", {})
        version_number = tuple(
            int(x) if x is not None else 999
            for x in re.search(
                r"^([0-9]+)\.([0-9]+)(?:\.([0-9]+))?", version["number"]
            ).groups()
        )
    except (KeyError, TypeError, ValueError, AttributeError):
        # No valid 'version.number' field, effectively 0.0.0
        version = {}
        version_number = (0, 0, 0)

    # Check all of the fields and headers for missing/valid values.
    try:
        bad_tagline = response.get("tagline", None) != "You Know, for Search"
        bad_build_flavor = version.get("build_flavor", None) != "default"
        bad_product_header = (
            headers.get("x-elastic-product", None) != "Elasticsearch"
        )
    except (AttributeError, TypeError):
        bad_tagline = True
        bad_build_flavor = True
        bad_product_header = True

    # 7.0-7.13 and there's a bad 'tagline' or unsupported 'build_flavor'
    if (7, 0, 0) <= version_number < (7, 14, 0):
        if bad_tagline:
            return cls.UNSUPPORTED_PRODUCT
        elif bad_build_flavor:
            return cls.UNSUPPORTED_DISTRIBUTION

    elif (
        # No version or version less than 6.x
        version_number < (6, 0, 0)
        # 6.x and there's a bad 'tagline'
        or ((6, 0, 0) <= version_number < (7, 0, 0) and bad_tagline)
        # 7.14+ and there's a bad 'X-Elastic-Product' HTTP header
        or ((7, 14, 0) <= version_number and bad_product_header)
    ):
        return cls.UNSUPPORTED_PRODUCT

    return True

I commented out the build flavour checks in this function, and then the index built successfully! So I went to post it as an issue on the haystacks GitHub and I was going to fork it so I could remove those lines, but the file "elasticsearch/transport.py" and the code "def check_product" doesn't exist in that repo (when I search the repo via GitHub), its pulled from somewhere else, and I can't find it online anywhere.

hopefully someone can point me in the right direction?

Thanks


来源: stackexchange

问:
What should the publicPath in webpack config be for a dynamic port?
I'm currently building a microfrontend using webpack's module federation, however when I create a deployment in kubernetes it's not resolving because of an incorrect publicPath. It's still a bit complex to me and I'm not sure what to set the publicPath to as the localhost port keeps changing every deployment.
So it looks like: http://127.0.0.1:TUNNEL_PORT, whereby TUNNEL_PORT is dynamic. How would I account for this when defining my output.publicPath?

Webpack.config.js

const HtmlWebPackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");

const deps = require("./package.json").dependencies;
module.exports = {
  output: {
    publicPath: "http://localhost:3000/",
    // publicPath: 'auto',
  },

  resolve: {
    extensions: [".tsx", ".ts", ".jsx", ".js", ".json"],
  },

  devServer: {
    port: 3000,
    historyApiFallback: true,
  },

  module: {
    rules: [
      {
        test: /\.m?js/,
        type: "javascript/auto",
        resolve: {
          fullySpecified: false,
        },
      },
      {
        test: /\.(css|s[ac]ss)$/i,
        use: ["style-loader", "css-loader", "postcss-loader"],
      },
      {
        test: /\.(ts|tsx|js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
    ],
  },

  plugins: [
    new ModuleFederationPlugin({
      name: "microfrontend1",
      filename: "remoteEntry.js",
      remotes: {},
      exposes: {
        "./Header": "./src/Header.tsx",
        "./Footer": "./src/Footer.tsx",
      },
      shared: {
        ...deps,
        react: {
          singleton: true,
          eager: true,
          requiredVersion: deps.react,
        },
        "react-dom": {
          singleton: true,
          eager: true,
          requiredVersion: deps["react-dom"],
        },
      },
    }),
    new HtmlWebPackPlugin({
      template: "./src/index.html",
    }),
  ],
};

```

ContentLicense: CC BY-SA 4.0


问:
Avalonia .xaml can't go to definition, F12 also don't work, why?
```<code><editor:DrawingNode.ContextFlyout>
  <MenuFlyout>
    <MenuItem Header="Cu_t" Command="{Binding CutCommand}" InputGesture="Ctrl+X" />
    <MenuItem Header="_Copy" Command="{Binding CopyCommand}" InputGesture="Ctrl+C" />
    <MenuItem Header="_Paste" Command="{Binding PasteCommand}" InputGesture="Ctrl+V" />
    <MenuItem Header="_Delete" Command="{Binding DeleteCommand}" InputGesture="Delete" />
    <MenuItem Header="-" />
    <MenuItem Header="Select _All" Command="{Binding SelectAllCommand, FallbackValue={x:Null}}" InputGesture="Ctrl+A" />
    <MenuItem Header="De_select All" Command="{Binding DeselectAllCommand, FallbackValue={x:Null}}" InputGesture="Escape" />
  </MenuFlyout>
</editor:DrawingNode.ContextFlyout>
</code>```

I want to go to the definition of cut command, but pressing F12 did not go to the definition/source of avalonia. Does avalonia support navigation to the definition of their elements in xaml?

Body:
<editor:DrawingNode.ContextFlyout>
  <MenuFlyout>
    <MenuItem Header="Cu_t" Command="{Binding CutCommand}" InputGesture="Ctrl+X" />
    <MenuItem Header="_Copy" Command="{Binding CopyCommand}" InputGesture="Ctrl+C" />
    <MenuItem Header="_Paste" Command="{Binding PasteCommand}" InputGesture="Ctrl+V" />
    <MenuItem Header="_Delete" Command="{Binding DeleteCommand}" InputGesture="Delete" />
    <MenuItem Header="-" />
    <MenuItem Header="Select _All" Command="{Binding SelectAllCommand, FallbackValue={x:Null}}" InputGesture="Ctrl+A" />
    <MenuItem Header="De_select All" Command="{Binding DeselectAllCommand, FallbackValue={x:Null}}" InputGesture="Escape" />
  </MenuFlyout>
</editor:DrawingNode.ContextFlyout>

I want to go to the definition of cut command, but pressing F12 did not go to the definition/source of avalonia. Does avalonia support navigation to the definition of their elements in xaml?


问:
How to convert hex to longi and lati?
Recently I got a GPS to receive data as hexadecimal values and I want to get the data from hex to dec directly.
For example:

```<code>Lati: DB0A51FC = 22.3368658
Long: FCBD003B = 114.1758175
Alti: 6A3DFF9E = 16.844
</code>```

The above conversion may not be exact as I run 2 different programs to get the data in the same place, which should be only slightly different. However, I want to get the GPS data in degree from hex directly for further usage.
I would like to know how the conversion works as the hex numbers give -ve values for direct conversion to decimal.
Thanks for all the help!

Title: How to convert hex to longi and lati?

Body:
Recently I got a GPS to receive data as hexadecimal values and I want to get the data from hex to dec directly.
For example:

Lati: DB0A51FC = 22.3368658
Long: FCBD003B = 114.1758175
Alti: 6A3DFF9E = 16.844

The above conversion may not be exact as I run 2 different programs to get the data in the same place, which should be only slightly different. However, I want to get the GPS data in degree from hex directly for further usage.
I would like to know how the conversion works as the hex numbers give -ve values for direct conversion to decimal.
Thanks for all the help!


问:
How can I 'reset' the browser anchor after expanding a div a second time?
I have an element that expands based on a expandedActive value, and a link that toggles the value. The first time you click the link to expand the element, the page stays put and the content expands below. If I then toggle it off and on again without scrolling, the content expands upwards (or rather, the whole page is pushed up) and the browser seems anchored to the expand toggle. If I scroll any amount in any direction, it will expand below as desired.

How can I force the content to always expand down?

I have tried using a tags with and without href, buttons, and a span. I have tried using anchors and scrolling to them, but it is not the desired behaviour.

Below is the basic vue template.

```<code><span v-if="!expandedActive" v-html="longText.length > charLimit ? longText.slice(0, charLimit) + '...' : longText"></span>
            <a v-if="!expandedActive && longText.length > charLimit" @click.prevent="toggleExpandedActive()" href="#">Expand</a>
            <span v-if="expandedActive" v-html="longText"></span>
            <a v-if="expandedActive" @click.prevent="toggleExpandedActive()" href="#">Collapse</a>
</code>```

Body:
I have an element that expands based on a expandedActive value, and a link that toggles the value. The first time you click the link to expand the element, the page stays put and the content expands below. If I then toggle it off and on again without scrolling, the content expands upwards (or rather, the whole page is pushed up) and the browser seems anchored to the expand toggle. If I scroll any amount in any direction, it will expand below as desired.

How can I force the content to always expand down?

I have tried using a tags with and without href, buttons, and a span. I have tried using anchors and scrolling to them, but it is not the desired behaviour.

Below is the basic vue template.

 charLimit ? longText.slice(0, charLimit) + '...' : longText">
             charLimit" @click.prevent="toggleExpandedActive()" href="#">Expand

            Collapse


问:
problem to set permission with mkdir in php
I know my question is similar to old ones answered many times. But stil, I don't understand why the following behavior. I'm on centos 7.9 with php 5.4.16.
Being the user, I can execute mkdir('/tmp/mydir', 0775) correctly

drwxrwxr-x 3 john john      60 20 déc.  09:30 mydir

When excuting as apache with sudo -u apache the php script either on CLI or with as an http request, I end up with

drwxr-xr-x 3 apache  apache       60 20 déc.  09:22 mydir

And a sudo -u apache with chmod('./depth1',0775); works. The behaviour is similar when I do this is a directory that I own where apache has write mode or even in a directory belonging to apache. The fact that I belong to apache group, and apache belongs to my group does'nt change either when making the test in a directory I own and where group has write rights.


问:
Determine the exact problem point of calling AWS Backup to AWS KMS in order to decrypt S3 bucket
Here is a log in AWS CloudTrail presumably indicating that

the AWS Backup service ("userAgent": "backup.amazonaws.com",)

tries to call the AWS KMS service("eventSource": "kms.amazonaws.com",)

in order to decrypt("eventName": "Decrypt",)

some S3 bucket("principalId": "AROAY6JAXY37VKF726QCA:AWS_BACKUP_S3_71C3048C",) and fails.

But there are no clues as to which particular bucket or KMS key caused the problem, I'd appreciate any advice on how to determine the exact problem point, thanks.

BTW the account contains hundreds of keys and buckets that are being back-up, so to determine the problem point in some manual way like, like researching each bucket/key, is very undesirable:)

```<code>{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "AROAY6JAXY37VKF726QCA:AWS_BACKUP_S3_71C3048C",
        "arn": "arn:aws:sts::****:assumed-role/AWSBackupDefaultServiceRole/AWS_BACKUP_S3_71C3048C",
        "accountId": "****",
        "accessKeyId": "ASIAY6JAXY37WHC7VFWN",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "AROAY6JAXY37VKF726QCA",
                "arn": "arn:aws:iam::****:role/service-role/AWSBackupDefaultServiceRole",
                "accountId": "****",
                "userName": "AWSBackupDefaultServiceRole"
            },
            "webIdFederationData": {},
            "attributes": {
                "creationDate": "2022-12-18T05:54:35Z",
                "mfaAuthenticated": "false"
            }
        },
        "invokedBy": "backup.amazonaws.com"
    },
    "eventTime": "2022-12-18T05:54:35Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "Decrypt",
    "awsRegion": "eu-central-1",
    "sourceIPAddress": "backup.amazonaws.com",
    "userAgent": "backup.amazonaws.com",
    "errorCode": "AccessDenied",
    "errorMessage": "The ciphertext refers to a customer master key that does not exist, does not exist in this region, or you are not allowed to access.",
    "requestParameters": null,
    "responseElements": null,
    "requestID": "660b1b90-66d9-4a2b-9ab1-4af4e195b71f",
    "eventID": "ef6fe50b-67f9-46c6-bbf5-057de88c3c1c",
    "readOnly": true,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "****",
    "eventCategory": "Management"
}
</code>```

Body:
Here is a log in AWS CloudTrail presumably indicating that

the AWS Backup service ("userAgent": "backup.amazonaws.com",)

tries to call the AWS KMS service("eventSource": "kms.amazonaws.com",)

in order to decrypt("eventName": "Decrypt",)

some S3 bucket("principalId": "AROAY6JAXY37VKF726QCA:AWS_BACKUP_S3_71C3048C",) and fails.

But there are no clues as to which particular bucket or KMS key caused the problem, I'd appreciate any advice on how to determine the exact problem point, thanks.

BTW the account contains hundreds of keys and buckets that are being back-up, so to determine the problem point in some manual way like, like researching each bucket/key, is very undesirable:)

{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "AROAY6JAXY37VKF726QCA:AWS_BACKUP_S3_71C3048C",
        "arn": "arn:aws:sts::****:assumed-role/AWSBackupDefaultServiceRole/AWS_BACKUP_S3_71C3048C",
        "accountId": "****",
        "accessKeyId": "ASIAY6JAXY37WHC7VFWN",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "AROAY6JAXY37VKF726QCA",
                "arn": "arn:aws:iam::****:role/service-role/AWSBackupDefaultServiceRole",
                "accountId": "****",
                "userName": "AWSBackupDefaultServiceRole"
            },
            "webIdFederationData": {},
            "attributes": {
                "creationDate": "2022-12-18T05:54:35Z",
                "mfaAuthenticated": "false"
            }
        },
        "invokedBy": "backup.amazonaws.com"
    },
    "eventTime": "2022-12-18T05:54:35Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "Decrypt",
    "awsRegion": "eu-central-1",
    "sourceIPAddress": "backup.amazonaws.com",
    "userAgent": "backup.amazonaws.com",
    "errorCode": "AccessDenied",
    "errorMessage": "The ciphertext refers to a customer master key that does not exist, does not exist in this region, or you are not allowed to access.",
    "requestParameters": null,
    "responseElements": null,
    "requestID": "660b1b90-66d9-4a2b-9ab1-4af4e195b71f",
    "eventID": "ef6fe50b-67f9-46c6-bbf5-057de88c3c1c",
    "readOnly": true,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "****",
    "eventCategory": "Management"
}


问:
How to fix Blat email having wrong timestamp?
The email I sent using blat is showing wrong time at the receivers end. The time is shown one hour earlier than actual sent time. I verified it by sending to my own email. I saw this thread where another user faced similar issue but no fix.

My guess is that you are in US Eastern Timezone, your system is configured
to GMT, while your managers' systems are all configured for Easter Time.
Blat tries to get the local time in your system, plus the time zone
difference from GMT, and put the correction into the outgoing header

from link

If Anybody know how to properly give timezone details to blat or fix this please let me know how.


问:
How to write Pandas Dataframe as a table to PDF using fpdf python
I want to create a pdf that contains customized tables. For that I have converted a text file into dataframe using pandas as this text file contains some string and numerical data ( abc = 1234 format).

```<code> with open(input2_filename,"rt") as ip1:
        for line in ip1:
            for i in patterns:
                match1 = re.match(i,line)
                if match1 != None:
                    er4.append(match1.groups())

df4 = pd.DataFrame(er4, columns =['Attribute', 'Values'])
</code>```

Issues:

How to convert dataframe into customized table that is presentable?

How to add this table directly in the PDF without saving as an image?

Do anyone have solution for this? If anyone knows how to do it in a better way, that would be appreciated.

I have tried tabulate module for converting dataframe into table, but I was unable to add it directly to the pdf. I also tried to save this table as an image and then adding it to the pdf, but it also doesn't work for me.

Body:
I want to create a pdf that contains customized tables. For that I have converted a text file into dataframe using pandas as this text file contains some string and numerical data ( abc = 1234 format).

 with open(input2_filename,"rt") as ip1:
        for line in ip1:
            for i in patterns:
                match1 = re.match(i,line)
                if match1 != None:
                    er4.append(match1.groups())

df4 = pd.DataFrame(er4, columns =['Attribute', 'Values'])

Issues:

How to convert dataframe into customized table that is presentable?

How to add this table directly in the PDF without saving as an image?

Do anyone have solution for this? If anyone knows how to do it in a better way, that would be appreciated.

I have tried tabulate module for converting dataframe into table, but I was unable to add it directly to the pdf. I also tried to save this table as an image and then adding it to the pdf, but it also doesn't work for me.


问:
Include interface definition table in namespace page directly
I want the table of interface definition include directly in the namespace page, not in global & not in it's single page

Here my code

```<code>// example.d.ts
/**
 * Examples
 * @category Types Definitions
 * @namespace example
 */
export default {}

/**
 * @interface IType
 * @memberof example
 * @property {string} id -
 */
export interface IType {
    id: string
}
</code>```

{
    "_comment": "jsdoc.json",
    "plugins": [
        "node_modules/better-docs/typescript",
        "node_modules/better-docs/category",
        "node_modules/jsdoc-vuejs"
    ],
    "tags": {
        "allowUnknownTags": true
    },
    "opts": {
        "template": "node_modules/better-docs",
        "destination": "docs"
    },
    "templates": {
        "default": {
            "outputSourceFiles": false
        },
        "better-docs": {
            "name": "Example"
        }
    },
    "sourceType": "module",
    "source": {
        "include": ["./types/example.d.ts"],
        "includePattern": ".(md|vue|ts)$",
        "exclude": ["node_modules"]
    }
  }
```

"jsdoc": "^4.0.0"

"better-docs": "^2.7.2"

"jsdoc-vuejs": "^4.0.0"

"typescript": "~4.4.4"

And it rendered like this now

Screenshot1

Screenshot2

How can I make it?

Maybe some annotations, some code, or other plugin with new setting.

Thanks.

Body:
I want the table of interface definition include directly in the namespace page, not in global & not in it's single page

Here my code

// example.d.ts
/**
 * Examples
 * @category Types Definitions
 * @namespace example
 */
export default {}

/**
 * @interface IType
 * @memberof example
 * @property {string} id -
 */
export interface IType {
    id: string
}

{
    "_comment": "jsdoc.json",
    "plugins": [
        "node_modules/better-docs/typescript",
        "node_modules/better-docs/category",
        "node_modules/jsdoc-vuejs"
    ],
    "tags": {
        "allowUnknownTags": true
    },
    "opts": {
        "template": "node_modules/better-docs",
        "destination": "docs"
    },
    "templates": {
        "default": {
            "outputSourceFiles": false
        },
        "better-docs": {
            "name": "Example"
        }
    },
    "sourceType": "module",
    "source": {
        "include": ["./types/example.d.ts"],
        "includePattern": ".(md|vue|ts)$",
        "exclude": ["node_modules"]
    }
  }

"jsdoc": "^4.0.0"

"better-docs": "^2.7.2"

"jsdoc-vuejs": "^4.0.0"

"typescript": "~4.4.4"

And it rendered like this now

Screenshot1

Screenshot2

How can I make it?

Maybe some annotations, some code, or other plugin with new setting.

Thanks.


问:
How to set cell value using rowupdating event before query execution C#?
I am using table adapter in my WinForms application to load data from database to gridview. Things work fine except I need to set one field value to be updated too in the database.

Here is my code:

```<code>//Fill dataset from database:
attendanceTypeTableAdapter.Fill(dsDataset.attendanceType);

//add rowUpdating event
attendanceTableAdapter.Adapter.RowUpdating += new OleDbRowUpdatingEventHandler(tableAdapter_RowUpdating);
</code>```

Set modifiedBy field before query executed against database

```<code>private void tableAdapter_RowUpdating(object sender, OleDbRowUpdatingEventArgs e)
{
    if (e.Status == UpdateStatus.Continue && e.StatementType == StatementType.Update)
    {
        //set modifiedBy field to current userId
        e.Row["modifiedBy"] = globals.userId;
        e.Row.AcceptChanges();
    }
}
</code>```

'modifiedBy' field using above code appears in the gridview but unfortunately does not get updated in the database!
What am I missing here?

Body:
I am using table adapter in my WinForms application to load data from database to gridview. Things work fine except I need to set one field value to be updated too in the database.

Here is my code:

//Fill dataset from database:
attendanceTypeTableAdapter.Fill(dsDataset.attendanceType);

//add rowUpdating event
attendanceTableAdapter.Adapter.RowUpdating += new OleDbRowUpdatingEventHandler(tableAdapter_RowUpdating);

Set modifiedBy field before query executed against database

private void tableAdapter_RowUpdating(object sender, OleDbRowUpdatingEventArgs e)
{
    if (e.Status == UpdateStatus.Continue && e.StatementType == StatementType.Update)
    {
        //set modifiedBy field to current userId
        e.Row["modifiedBy"] = globals.userId;
        e.Row.AcceptChanges();
    }
}

'modifiedBy' field using above code appears in the gridview but unfortunately does not get updated in the database!
What am I missing here?


问:
How to test a viewChild on Angular with Jest - Unit test?
I am having problems trying to test a viewChild on Angular with Jest.

Here my .ts component:

```<code>import { MurQueryViewComponent } from '../../shared/components/mur-query-view/mur-query-view.component';

@ViewChild(MurQueryViewComponent) private consultQuery!: MurQueryViewComponent;
</code>```

This is the method Im trying to test. The method I can not access is applyTransaction

```<code>newVolatility() {
this.dialogSrv
  .setDialogAction({
    component: VolatilityActionComponent,
    data: {
      actionType: 'Alta',
    },
  })
  .subscribe((res) => {
    if (!res) return;
    res.attributes.id = res.id;
    this.consultQuery.agGrid.api.applyTransaction({
      add: [res.attributes],
    });
    this.dialogSrv.setAlert({ type: 'success', msg: 'message_new_success' });
  });
</code>```

}

Here my .spec.ts:

This is the test that try to prove that previous methos is been call with same arguments:

```<code>it('Method newVolatility',  () => {

const sonDebugElement = fixture.debugElement.query(By.directive(MurQueryViewComponent));
const sonComponent: MurQueryViewComponent  = sonDebugElement.componentInstance;
component['consultQuery'] = sonComponent;

const SpySetItems= jest.spyOn(component['consultQuery'].agGrid.api, 'applyTransaction');
const SpyDialogAlert= jest.spyOn(component['dialogSrv'], 'setAlert');

component['dialogSrv'].setDialogAction  =  () => {
  return of(mockRow);
}

component.newVolatility();
expect(SpySetItems).toBeCalledWith({add: [mockNewRow]});
expect(SpyDialogAlert).toBeCalledWith({ type: 'success', msg: 'message_new_success' });
</code>```

});

Here the error on terminal:

Anyone could please let me know how to access a viewChild, witch is a whole component and access to its methos?

Body:
I am having problems trying to test a viewChild on Angular with Jest.

Here my .ts component:

import { MurQueryViewComponent } from '../../shared/components/mur-query-view/mur-query-view.component';

@ViewChild(MurQueryViewComponent) private consultQuery!: MurQueryViewComponent;

This is the method Im trying to test. The method I can not access is applyTransaction

newVolatility() {
this.dialogSrv
  .setDialogAction({
    component: VolatilityActionComponent,
    data: {
      actionType: 'Alta',
    },
  })
  .subscribe((res) => {
    if (!res) return;
    res.attributes.id = res.id;
    this.consultQuery.agGrid.api.applyTransaction({
      add: [res.attributes],
    });
    this.dialogSrv.setAlert({ type: 'success', msg: 'message_new_success' });
  });

}

Here my .spec.ts:

This is the test that try to prove that previous methos is been call with same arguments:

it('Method newVolatility',  () => {

const sonDebugElement = fixture.debugElement.query(By.directive(MurQueryViewComponent));
const sonComponent: MurQueryViewComponent  = sonDebugElement.componentInstance;
component['consultQuery'] = sonComponent;

const SpySetItems= jest.spyOn(component['consultQuery'].agGrid.api, 'applyTransaction');
const SpyDialogAlert= jest.spyOn(component['dialogSrv'], 'setAlert');

component['dialogSrv'].setDialogAction  =  () => {
  return of(mockRow);
}

component.newVolatility();
expect(SpySetItems).toBeCalledWith({add: [mockNewRow]});
expect(SpyDialogAlert).toBeCalledWith({ type: 'success', msg: 'message_new_success' });

});

Here the error on terminal:

Anyone could please let me know how to access a viewChild, witch is a whole component and access to its methos?


问:
How to find out which package version has the required nested version?
I need to install jsdom@19 because it has a bugfix that I need, and I don't have it installed directly in package.json, it's a nested dependency.

To find out which dependency is installing it I ran npm list jsdom and got this:

@my-package@1.0.0 /Volumes/workplace/my-package
└─┬ react-scripts@3.4.4
  ├─┬ jest@24.9.0
  │ └─┬ jest-cli@24.9.0
  │   └─┬ jest-config@24.9.0
  │     └─┬ jest-environment-jsdom@24.9.0
  │       └── jsdom@11.12.0
  └─┬ jest-environment-jsdom-fourteen@1.0.1
    └── jsdom@14.1.0
```

I'm not sure which jsdom is actually responsible for running my tests, I don't have any runner set in the jest config file.

how do I know what is the minimum upgrade that I need to do in order to get to jsdom@19?

I tried looking at npm versions but there's no clear way to see the nested dependencies for each version.

I thought there might be a magic npm command that I don't know about that does exactly this?

I don't want to update the package to the latest because that would hugely increase the scope of my change.

Body:
I need to install jsdom@19 because it has a bugfix that I need, and I don't have it installed directly in package.json, it's a nested dependency.

To find out which dependency is installing it I ran npm list jsdom and got this:

@my-package@1.0.0 /Volumes/workplace/my-package
└─┬ react-scripts@3.4.4
  ├─┬ jest@24.9.0
  │ └─┬ jest-cli@24.9.0
  │   └─┬ jest-config@24.9.0
  │     └─┬ jest-environment-jsdom@24.9.0
  │       └── jsdom@11.12.0
  └─┬ jest-environment-jsdom-fourteen@1.0.1
    └── jsdom@14.1.0

I'm not sure which jsdom is actually responsible for running my tests, I don't have any runner set in the jest config file.

how do I know what is the minimum upgrade that I need to do in order to get to jsdom@19?

I tried looking at npm versions but there's no clear way to see the nested dependencies for each version.

I thought there might be a magic npm command that I don't know about that does exactly this?

I don't want to update the package to the latest because that would hugely increase the scope of my change.


问:
image not loading with react-native-web and webpack
```<code>import logo from '../assets/images/logo.png';

<Image source={logo} resizeMode={'contain'}   style={styles.image}   />
</code>```

console.log(logo);
prints http://0.0.0.0:8080/src/assets/images/logo..png but image not loading in browser, webpack configuration is as below

```<code>/**
 * Load file imports
 */
const imageFilesLoader = {
  test: /\.(png|jpe?g|gif|mp4)$/i,
  dependency: { not: ['url'] },
  use: {
    loader: 'file-loader',
    options: {
      name: '[path][name].[query].[ext]',
    },
  },
};

/**
 * Transforms files into base64 URIs.
 */
const imageBase64Loader = {
  test: /\.(gif|jpe?g|png|svg)$/,
  use: {
    loader: 'url-loader',
    options: {
      name: '[name].[ext]',
      esModule: false,
    },
  },
};
</code>```

If I use svg file instead of png it works, png files not working
Why it's not working, any ideas?

Body:
import logo from '../assets/images/logo.png';

<Image source={logo} resizeMode={'contain'}   style={styles.image}   />

console.log(logo);
prints http://0.0.0.0:8080/src/assets/images/logo..png but image not loading in browser, webpack configuration is as below

/**
 * Load file imports
 */
const imageFilesLoader = {
  test: /\.(png|jpe?g|gif|mp4)$/i,
  dependency: { not: ['url'] },
  use: {
    loader: 'file-loader',
    options: {
      name: '[path][name].[query].[ext]',
    },
  },
};

/**
 * Transforms files into base64 URIs.
 */
const imageBase64Loader = {
  test: /\.(gif|jpe?g|png|svg)$/,
  use: {
    loader: 'url-loader',
    options: {
      name: '[name].[ext]',
      esModule: false,
    },
  },
};

If I use svg file instead of png it works, png files not working
Why it's not working, any ideas?


问:
How to resolve a Zlib issue — Java migration from 8 to 11
I am working on upgrading Java version from 8 to 11 for an application (maven/spring-framework- no spring boot). The code compiles fine, war is deployed, and application is up and running.

But, it is unable to process incoming client requests. It's throwing java.io.EOFException unexpected end of zlib input stream java.

Below is the request the client sends to the Tomcat server where the Java application is deployed:

```<code>Hypertext Transfer Protocol
    POST /xxxx/clients/events/inventory HTTP/1.1\r\n
    content-encoding: deflate\r\n
    User-Agent: Java/1.8.0_131\r\n
    Host: xx.xx.xxx.xx:81\r\n
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n
    Connection: keep-alive\r\n
    Content-type: application/x-www-form-urlencoded\r\n
    Transfer-Encoding: chunked\r\n
    \r\n
    [Full request URI: http://xx.xx.xxx.xx:81/xxxx/clients/events/inventory]
    [HTTP request 1/1]
    [Response in frame: 10]
    HTTP chunked response
    Content-encoded entity body (deflate): 147 bytes -> 183 bytes
    File Data: 183 byte

HTML Form URL Encoded: application/x-www-form-urlencoded
    Form item: "b4
{"Number":"1","EventType":"Inventory","ID":"3c65ec84-cfeb-4ab1-959d-ce8da7b5907c","EquipmentType":"Train","Timestamp":"1671523655021","Train":[{"SystemType":"Train"}],"System":"1"}" = ""
</code>```

On the server side we have InflaterFilter and InflaterRequestWrapper around HttpServletRequestWrapper to handle the compressed data, and in the controller we have this method below:

```<code>@RequestMapping(value = { "inventory", "alarms" }, method = RequestMethod.POST)
    @ResponseBody public ResponseEntity<HttpStatus> handleInventoryOrAlarmEvents(ServletInputStream is) {
        return new ResponseEntity<HttpStatus>(service.handleEvents(is) ? HttpStatus.OK
                                                                       : HttpStatus.INTERNAL_SERVER_ERROR);
    }
</code>```

handleEvents method:

```<code>@Override public boolean handleEvents(InputStream is) {
        ThreadLocal<Boolean> success =
            new ThreadLocal<Boolean>() {

                /**
                 * @see  ThreadLocal#initialValue()
                 */
                @Override protected Boolean initialValue() {
                    return true;
                }
            };

        DispatchMessageExceptionListener exceptionListener = new DispatchMessageExceptionListener(success);
        StringInputStream sis = new StringInputStream(is);

        try {
            String string = null;

            while ((string = sis.readString()) != null) {
                ClientEvent event = null;

                try {
                    event = parser.parse(string);

                    if (event == null) {
                        LOGGER.error("-handleEvents, could not parse event={}", string);
                        continue;
                    }

                    LOGGER.debug("+handleEvents, incoming event={}", event);
                    if(event.hasProperty("BandwidthEconomyQuota")){
                        LOGGER.info("Received Fleet Counter for Train Id: {}", event.getString("System"));
                    }
                    eventManager.send(event, exceptionListener);
                }
                catch (Exception e) {
                    LOGGER.debug("Failed to handle event={}", event, e);
                    success.set(false);
                }
            } // end while
        }
        catch (Exception e) {
            LOGGER.debug("Failed to handle all events.", e);
            success.set(false);
        }
        finally {
            IOUtil.close(is);
        }

        return exceptionListener.isSuccess();
    } // end method handleEvents
</code>```

The StringInputStream class:

```<code>import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Reads strings from an underlying input stream.
 *
 * @author   <a href="mailto:marco.soeima@nsn.com">Marco Soeima</a>
 * @version  2013/11/13
 */
public class StringInputStream extends FilterInputStream {

    /**
     * Creates a new {@link StringInputStream} object.
     *
     * @param  is  The input stream to wrap.
     */
    public StringInputStream(InputStream is) {
        super(is);
    }

    /**
     * Reads the string size from the backing input stream.
     *
     * @return  The string size.
     *
     * @throws  IOException  If an I/O error occurs.
     */
    private int readSize() throws IOException {
        int c = in.read();

        if (c < 0) {
            return -1;
        }

        StringBuilder buf = new StringBuilder();

        while ((c != -1) && (c != '\n')) {
            buf.append((char)c);
            c = in.read();
        }

        return Integer.parseInt(buf.toString(), 16);
    }

    /**
     * Fully reads the <code>size</code> number of bytes into a byte array.
     *
     * @param   size  The number of bytes to read.
     *
     * @return  The byte array with the given bytes.
     *
     * @throws  IOException  If an I/O error occurs.
     */
    private byte[] readFully(int size) throws IOException {
        int read = 0;
        int count = 0;
        byte[] buf = new byte[size];

        while ((count >= 0) && (read < size)) {
            count = in.read(buf, read, size - read);
            read += count;
        }

        return buf;
    }

    /**
     * Reads a string from the underlying input stream.
     *
     * @return  A string or <code>null</code> if no more string are available for reading.
     *
     * @throws  IOException  If an I/O error occurs.
     */
    public String readString() throws IOException {
        int size = readSize();

        if (size < 0) {
            return null;
        }

        return new String(readFully(size), "UTF-8");
    }
}
</code>```

I have googled many solutions. However I have not resolved the issue. Please help me with what is causing the issue and how to resolve this.

Note: I upgraded Tomcat from 7 to 9 along with Java from 8 to 11.

Thanks in advance.

Body:
I am working on upgrading Java version from 8 to 11 for an application (maven/spring-framework- no spring boot). The code compiles fine, war is deployed, and application is up and running.

But, it is unable to process incoming client requests. It's throwing java.io.EOFException unexpected end of zlib input stream java.

Below is the request the client sends to the Tomcat server where the Java application is deployed:

Hypertext Transfer Protocol
    POST /xxxx/clients/events/inventory HTTP/1.1\r\n
    content-encoding: deflate\r\n
    User-Agent: Java/1.8.0_131\r\n
    Host: xx.xx.xxx.xx:81\r\n
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n
    Connection: keep-alive\r\n
    Content-type: application/x-www-form-urlencoded\r\n
    Transfer-Encoding: chunked\r\n
    \r\n
    [Full request URI: http://xx.xx.xxx.xx:81/xxxx/clients/events/inventory]
    [HTTP request 1/1]
    [Response in frame: 10]
    HTTP chunked response
    Content-encoded entity body (deflate): 147 bytes -> 183 bytes
    File Data: 183 byte

HTML Form URL Encoded: application/x-www-form-urlencoded
    Form item: "b4
{"Number":"1","EventType":"Inventory","ID":"3c65ec84-cfeb-4ab1-959d-ce8da7b5907c","EquipmentType":"Train","Timestamp":"1671523655021","Train":[{"SystemType":"Train"}],"System":"1"}" = ""

On the server side we have InflaterFilter and InflaterRequestWrapper around HttpServletRequestWrapper to handle the compressed data, and in the controller we have this method below:

@RequestMapping(value = { "inventory", "alarms" }, method = RequestMethod.POST)
    @ResponseBody public ResponseEntity<HttpStatus> handleInventoryOrAlarmEvents(ServletInputStream is) {
        return new ResponseEntity<HttpStatus>(service.handleEvents(is) ? HttpStatus.OK
                                                                       : HttpStatus.INTERNAL_SERVER_ERROR);
    }

handleEvents method:

@Override public boolean handleEvents(InputStream is) {
        ThreadLocal<Boolean> success =
            new ThreadLocal<Boolean>() {

                /**
                 * @see  ThreadLocal#initialValue()
                 */
                @Override protected Boolean initialValue() {
                    return true;
                }
            };

        DispatchMessageExceptionListener exceptionListener = new DispatchMessageExceptionListener(success);
        StringInputStream sis = new StringInputStream(is);

        try {
            String string = null;

            while ((string = sis.readString()) != null) {
                ClientEvent event = null;

                try {
                    event = parser.parse(string);

                    if (event == null) {
                        LOGGER.error("-handleEvents, could not parse event={}", string);
                        continue;
                    }

                    LOGGER.debug("+handleEvents, incoming event={}", event);
                    if(event.hasProperty("BandwidthEconomyQuota")){
                        LOGGER.info("Received Fleet Counter for Train Id: {}", event.getString("System"));
                    }
                    eventManager.send(event, exceptionListener);
                }
                catch (Exception e) {
                    LOGGER.debug("Failed to handle event={}", event, e);
                    success.set(false);
                }
            } // end while
        }
        catch (Exception e) {
            LOGGER.debug("Failed to handle all events.", e);
            success.set(false);
        }
        finally {
            IOUtil.close(is);
        }

        return exceptionListener.isSuccess();
    } // end method handleEvents

The StringInputStream class:

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Reads strings from an underlying input stream.
 *
 * @author   Marco Soeima
 * @version  2013/11/13
 */
public class StringInputStream extends FilterInputStream {

    /**
     * Creates a new {@link StringInputStream} object.
     *
     * @param  is  The input stream to wrap.
     */
    public StringInputStream(InputStream is) {
        super(is);
    }

    /**
     * Reads the string size from the backing input stream.
     *
     * @return  The string size.
     *
     * @throws  IOException  If an I/O error occurs.
     */
    private int readSize() throws IOException {
        int c = in.read();

        if (c < 0) {
            return -1;
        }

        StringBuilder buf = new StringBuilder();

        while ((c != -1) && (c != '\n')) {
            buf.append((char)c);
            c = in.read();
        }

        return Integer.parseInt(buf.toString(), 16);
    }

    /**
     * Fully reads the size number of bytes into a byte array.
     *
     * @param   size  The number of bytes to read.
     *
     * @return  The byte array with the given bytes.
     *
     * @throws  IOException  If an I/O error occurs.
     */
    private byte[] readFully(int size) throws IOException {
        int read = 0;
        int count = 0;
        byte[] buf = new byte[size];

        while ((count >= 0) && (read < size)) {
            count = in.read(buf, read, size - read);
            read += count;
        }

        return buf;
    }

    /**
     * Reads a string from the underlying input stream.
     *
     * @return  A string or null if no more string are available for reading.
     *
     * @throws  IOException  If an I/O error occurs.
     */
    public String readString() throws IOException {
        int size = readSize();

        if (size < 0) {
            return null;
        }

        return new String(readFully(size), "UTF-8");
    }
}

I have googled many solutions. However I have not resolved the issue. Please help me with what is causing the issue and how to resolve this.

Note: I upgraded Tomcat from 7 to 9 along with Java from 8 to 11.

Thanks in advance.


问:
Selenium driver collapses when display is switched off (Ubuntu, Nvidia Driver)
I'm using Ubuntu and Selenium driver for page testing for a while. I used to switch off my monitor to reduce energy consumption while the tests were running. After the installation of the Nvidia OpenCL driver, an error appeared which was not there before. Switching off the display leads to driver collapse. Sometimes even the whole display is blocked. Do you have an idea how to fix that error and keep the Nvidia driver installed?</p>


问:
Login page is fetching the data from sign up page in ASP.Net MVC
Firstly, I created a class named User in Account folder in Model. and then created 2 class named LoginSignUpViewModel and SignuserViewModel in ViewModel folder. these 2 models are fetching the required properties from User class. Then 2 razor views Login and SignUp named in Account folder of View. Lastly made the accountController. made the User named table in pgadmin 4. When I register the Sign up page it is successfully storing the data in the table but when I try to login it is not fetching the UserName and Password from the Sign up Page.

Controller (Login)

```<code>//GET LOGIN
public IActionResult Login()
{
  return View();
}

//POST LOGIN
[ValidateAntiForgeryToken]
[HttpPost]
public IActionResult Login(LoginSignUpViewModel model)
{
      if (ModelState.IsValid) {
         var data = _DbContext.Users.Where(e => e.UserName == model.UserName).SingleOrDefault();
         if (data != null) {
                bool isvalid = (data.UserName == model.UserName && data.password == model.password);
          if (isvalid) {
                  var identity = new ClaimsIdentity(new [] {
                      new Claim(ClaimTypes.Name, model.UserName)
                    },
                    CookieAuthenticationDefaults.AuthenticationScheme);
                  var Principal = new ClaimsPrincipal(identity);
                  HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, Principal);
                  HttpContext.Session.SetString("UserName", model.UserName); //Session is used to store senstive information like username and password

                  return RedirectToAction("Index", "Home");
                } else {
                  TempData["errorpassword"] = "Invalid Password";
                  return View(model);
                }
              } else {
                TempData["errorUserName"] = "UserName not found!";
                return View(model);
              }
            } else {
    return View(model);
}
</code>```

LoginSignUpViewModel.cs (View Model)

```<code>namespace MyMVCapplication.Models.ViewModel
{
    [Table("User", Schema ="public")]

    public class LoginSignUpViewModel
    {

        [Required(ErrorMessage ="User Name is Required!")]
        [Display(Name ="User Name")]
        public string? UserName{ get; set; }

        [Display(Name ="Password")]
        [Required(ErrorMessage ="Password is required!")]
        public string? password { get; set; }

        [Display(Name ="Remember Me")]
        public bool IsRemember { get; set; }
    }
}
</code>```

I tried only 1 class for both login and sign up page but it didn't worked. Login page was not fetching the data from Sign up page.

I want login page to fetch the username and password from Sign up page.

Body:
Firstly, I created a class named User in Account folder in Model. and then created 2 class named LoginSignUpViewModel and SignuserViewModel in ViewModel folder. these 2 models are fetching the required properties from User class. Then 2 razor views Login and SignUp named in Account folder of View. Lastly made the accountController. made the User named table in pgadmin 4. When I register the Sign up page it is successfully storing the data in the table but when I try to login it is not fetching the UserName and Password from the Sign up Page.

Controller (Login)

//GET LOGIN
public IActionResult Login()
{
  return View();
}

//POST LOGIN
[ValidateAntiForgeryToken]
[HttpPost]
public IActionResult Login(LoginSignUpViewModel model)
{
      if (ModelState.IsValid) {
         var data = _DbContext.Users.Where(e => e.UserName == model.UserName).SingleOrDefault();
         if (data != null) {
                bool isvalid = (data.UserName == model.UserName && data.password == model.password);
          if (isvalid) {
                  var identity = new ClaimsIdentity(new [] {
                      new Claim(ClaimTypes.Name, model.UserName)
                    },
                    CookieAuthenticationDefaults.AuthenticationScheme);
                  var Principal = new ClaimsPrincipal(identity);
                  HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, Principal);
                  HttpContext.Session.SetString("UserName", model.UserName); //Session is used to store senstive information like username and password

                  return RedirectToAction("Index", "Home");
                } else {
                  TempData["errorpassword"] = "Invalid Password";
                  return View(model);
                }
              } else {
                TempData["errorUserName"] = "UserName not found!";
                return View(model);
              }
            } else {
    return View(model);
}

LoginSignUpViewModel.cs (View Model)

namespace MyMVCapplication.Models.ViewModel
{
    [Table("User", Schema ="public")]

    public class LoginSignUpViewModel
    {

        [Required(ErrorMessage ="User Name is Required!")]
        [Display(Name ="User Name")]
        public string? UserName{ get; set; }

        [Display(Name ="Password")]
        [Required(ErrorMessage ="Password is required!")]
        public string? password { get; set; }

        [Display(Name ="Remember Me")]
        public bool IsRemember { get; set; }
    }
}

I tried only 1 class for both login and sign up page but it didn't worked. Login page was not fetching the data from Sign up page.

I want login page to fetch the username and password from Sign up page.


问:
Error appears when trying to execute node-gyp configure
Hello I wanted to run the node-gyp configure command after setting up the binding.gyp file with electron to add some C code to the backend. But the command didn't work and I can't figure out where this could come from.

```<code>gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.12.0 | win32 | x64
gyp info find Python using Python version 3.10.7 found at "C:\Users\cantr\AppData\Local\Programs\Python\Python310\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:420:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\cantr\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\cantr\Desktop\Stage ingénieur KOMILFO SPORT\Sail Vision\Dashboard
gyp ERR! node -v v18.12.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
</code>```

Regards,

Body:
Hello I wanted to run the node-gyp configure command after setting up the binding.gyp file with electron to add some C code to the backend. But the command didn't work and I can't figure out where this could come from.

gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.12.0 | win32 | x64
gyp info find Python using Python version 3.10.7 found at "C:\Users\cantr\AppData\Local\Programs\Python\Python310\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\cantr\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:420:5)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\cantr\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\cantr\Desktop\Stage ingénieur KOMILFO SPORT\Sail Vision\Dashboard
gyp ERR! node -v v18.12.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok

Regards,


问:
All possible path from any starting point in a 4x4 grid [Python]
Trying to solve a problem where I need to find all the possible path in a 4x4 grid.

df = [[1,1,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,1]]

Possible moves are left, right, top, down, top right, top left, down right, down left and no repeats in the coordinates.
I tried to start small with 2x2 but I'm not sure even with how to convert my thought into code.
All help appreciated. Thank you

I tried to convert all data into cords and the code below, however this would only get me from top to corner in the right bottom.

```<code>dp = [[1, 1, 1, 1],
      [1, 1, 1, 1],
      [1, 1, 1, 1],
      [1, 1, 1, 1]]

n, m = len(dp), len(dp[0])

paths = []
curpath = []
def getPath(r, c):
    if r < 0 or c < 0:
        return
    curpath.append((r, c))
    if r == 0 and c == 0:
        paths.append(list(reversed(curpath)))
    getPath(r - 1, c)
    getPath(r, c - 1)
    curpath.pop()

getPath(n - 1, m - 1)
print(paths)
</code>```

Body:
Trying to solve a problem where I need to find all the possible path in a 4x4 grid.

df = [[1,1,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,1]]

Possible moves are left, right, top, down, top right, top left, down right, down left and no repeats in the coordinates.
I tried to start small with 2x2 but I'm not sure even with how to convert my thought into code.
All help appreciated. Thank you

I tried to convert all data into cords and the code below, however this would only get me from top to corner in the right bottom.

dp = [[1, 1, 1, 1],
      [1, 1, 1, 1],
      [1, 1, 1, 1],
      [1, 1, 1, 1]]

n, m = len(dp), len(dp[0])

paths = []
curpath = []
def getPath(r, c):
    if r < 0 or c < 0:
        return
    curpath.append((r, c))
    if r == 0 and c == 0:
        paths.append(list(reversed(curpath)))
    getPath(r - 1, c)
    getPath(r, c - 1)
    curpath.pop()

getPath(n - 1, m - 1)
print(paths)


问:
Tab completion in mandatory parameter
I'm probably missing something very obvious since I hadn't come across this question or an answer...but is it possible to allow for tab completion when a user is prompted to enter a mandatory parameter value, when they forgot to include the mandatory parameter?

Take the below sample code, if a user runs Test-TabComplete -number tab completion obviously works as expected.  But, if the user runs Test-TabComplete without -number and they're prompted to enter a number, tab completion won't work.  The HelpMessage will at least give the user some assistance, but tab completion would be great.  I'm assuming I'm meant to do something with argumentcompleter?  But the ultimate goal is to accomplish tab completion in a dynamic parameter, so I'm not too sure how to use argumentcompleter there, either.

```<code>function Test-TabComplete
{
    param
    (
        [Parameter(
            Mandatory,
            Position = 1,
            HelpMessage = "Enter: 1, 2, 3"
        )]
        [validateset(1,2,3)]
        [int]$number
    )
}
</code>```

Title: Tab completion in mandatory parameter

Body:
I'm probably missing something very obvious since I hadn't come across this question or an answer...but is it possible to allow for tab completion when a user is prompted to enter a mandatory parameter value, when they forgot to include the mandatory parameter?

Take the below sample code, if a user runs Test-TabComplete -number tab completion obviously works as expected.  But, if the user runs Test-TabComplete without -number and they're prompted to enter a number, tab completion won't work.  The HelpMessage will at least give the user some assistance, but tab completion would be great.  I'm assuming I'm meant to do something with argumentcompleter?  But the ultimate goal is to accomplish tab completion in a dynamic parameter, so I'm not too sure how to use argumentcompleter there, either.

function Test-TabComplete
{
    param
    (
        [Parameter(
            Mandatory,
            Position = 1,
            HelpMessage = "Enter: 1, 2, 3"
        )]
        [validateset(1,2,3)]
        [int]$number
    )
}


问:
How do we post multiple query data into multiple tables in mysql databse using nodejs and express js
```<code>type here
const express=require('express');
const bodyparser=require('body-parser');
const conn=require('./db');
const { urlencoded } = require('express');
const port=process.env.PORT || 3400;
const app=express();

app.use(bodyparser.json());
app.use(bodyparser.urlencoded({extended:true}));

app.get("/form.html",function(req,res){
    res.sendFile(__dirname+"/form.html");
});

app.post("/form.html",function(req,res){
    //console.log(req.body);
    var img=req.body.img;
    var gender=req.body.gender;
    var name=req.body.sname;
    var clss=req.body.class;
    var DOB=req.body.DOB;
    var blood_group=req.body.blood_group;
    var category=req.body.category;
    var fname=req.body.fname;
    var mname=req.body.mname;
    var nationality=req.body.nationality;
    var occupation=req.body.occupation;
    var address=req.body.address;
    var phno=req.body.phno;
    var income=req.body.income;
    var qualification=req.body.qualification;
    conn.connect(function(error){
        if(error) throw error;
        var sqldb="INSERT INTO student(s_class,s_name,s_gender,s_DOB,s_Blood_Group,s_category,s_img) VALUES('"+clss+"','"+name+"','"+gender+"','"+DOB+"','"+blood_group+"','"+category+"','"+img+"');INSERT INTO fatherDetails(f_nationality,f_occupation,address,f_PhNO,f_income,f_qualification,f_name) VALUES('"+nationality+"','"+occupation+"','"+address+"','"+phno+"','"+income+"','"+qualification+"','"+fname+"');INSERT INTO motherDetails(m_name,m_nationality,m_occupation,address,m_PhNO,m_income,m_qualification) VALUES('"+mname+"','"+nationality+"','"+occupation+"','"+address+"','"+phno+"','"+income+"','"+qualification+"')";
        conn.query(sqldb,function(error,result){
            if(error) throw err;
            res.send("Student register successful "+result.insertId);
        });
    })
});
app.listen(port,function(){
    console.log(`server is successfully connected to ${port}`);
});

</code>```

I tried writing three queries into one single, but its not able to post the data into database,no feilds are getting the data.IS there any solution to post data into multiple tables at once .the feilds is related to a student admisssion form details.```</p>
```
```

Body:
type here
const express=require('express');
const bodyparser=require('body-parser');
const conn=require('./db');
const { urlencoded } = require('express');
const port=process.env.PORT || 3400;
const app=express();

app.use(bodyparser.json());
app.use(bodyparser.urlencoded({extended:true}));

app.get("/form.html",function(req,res){
    res.sendFile(__dirname+"/form.html");
});

app.post("/form.html",function(req,res){
    //console.log(req.body);
    var img=req.body.img;
    var gender=req.body.gender;
    var name=req.body.sname;
    var clss=req.body.class;
    var DOB=req.body.DOB;
    var blood_group=req.body.blood_group;
    var category=req.body.category;
    var fname=req.body.fname;
    var mname=req.body.mname;
    var nationality=req.body.nationality;
    var occupation=req.body.occupation;
    var address=req.body.address;
    var phno=req.body.phno;
    var income=req.body.income;
    var qualification=req.body.qualification;
    conn.connect(function(error){
        if(error) throw error;
        var sqldb="INSERT INTO student(s_class,s_name,s_gender,s_DOB,s_Blood_Group,s_category,s_img) VALUES('"+clss+"','"+name+"','"+gender+"','"+DOB+"','"+blood_group+"','"+category+"','"+img+"');INSERT INTO fatherDetails(f_nationality,f_occupation,address,f_PhNO,f_income,f_qualification,f_name) VALUES('"+nationality+"','"+occupation+"','"+address+"','"+phno+"','"+income+"','"+qualification+"','"+fname+"');INSERT INTO motherDetails(m_name,m_nationality,m_occupation,address,m_PhNO,m_income,m_qualification) VALUES('"+mname+"','"+nationality+"','"+occupation+"','"+address+"','"+phno+"','"+income+"','"+qualification+"')";
        conn.query(sqldb,function(error,result){
            if(error) throw err;
            res.send("Student register successful "+result.insertId);
        });
    })
});
app.listen(port,function(){
    console.log(`server is successfully connected to ${port}`);
});

I tried writing three queries into one single, but its not able to post the data into database,no feilds are getting the data.IS there any solution to post data into multiple tables at once .the feilds is related to a student admisssion form details.```


问:
disable automatic font ligatures
There’s a Qt5 application that I use to render text on screen and to PDF.

I’ve been having trouble with newer fonts automatically creating ligatures from e.g. ff (which is plain wrong, ① because U+FB00 ﬀ exists for this purpose, and ② because this will also wrongly convert e.g. compound-word boundaries). I get this is the new fancy thing to do, but I would like to disable it, either by setting an environment variable, a fontconfig fonts.conf(5) setting or similar, or by patching the application. (Modifying the font is no option for most due to licencing issues.)

I cannot find any documentation for this, though. Other people are writing text editors and have similar problems due to the rise of “coding ligatures” in fonts, but so far nobody has provided a workable solution to disable them.

Title: disable automatic font ligatures


问:
Mass Assignment insecure binder configuration newtonsoft
Fortify scan is reporting a vulnerability with our code even though we have separate Database models. Below is the class which is being reported as a vulnerability - Mass assignment insecure binder configuration.

```<code>public class StepDefinition
    {
        public Guid StepDefinitionId { get; set; }
        public Guid TenantId { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public bool IsAutomated { get; set; }
        public bool IsArchived { get; set; }
        public bool IsReadOnly { get; set; }
        public string ActionName { get; set; }
        public bool CanDelete { get; set; }
        public bool HasParameters { get; set; }
        public Guid UserId { get; set; }
        public virtual ICollection<StepOutcome> StepOutComes { get; set; }
        [JsonIgnore]
        public string Dummy { get; set; }
    }
</code>```

The controller action looks like below.

```<code> [HttpPost]
        [Route("")]
        public async Task<IActionResult> PostAsync(Guid tenantId, StepDefinition model)
</code>```

How can we prevent this vulnerability. We are using newtonsoft json for serialization/deserialization purposes. WHat I have noticed is if I just add a dummy param and mark it with JsonIgnore attribute this error goes away. But not getting the logic for that. Any help will be appreciated. None of the other questions were of help.

Body:
Fortify scan is reporting a vulnerability with our code even though we have separate Database models. Below is the class which is being reported as a vulnerability - Mass assignment insecure binder configuration.

public class StepDefinition
    {
        public Guid StepDefinitionId { get; set; }
        public Guid TenantId { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public bool IsAutomated { get; set; }
        public bool IsArchived { get; set; }
        public bool IsReadOnly { get; set; }
        public string ActionName { get; set; }
        public bool CanDelete { get; set; }
        public bool HasParameters { get; set; }
        public Guid UserId { get; set; }
        public virtual ICollection<StepOutcome> StepOutComes { get; set; }
        [JsonIgnore]
        public string Dummy { get; set; }
    }

The controller action looks like below.

 [HttpPost]
        [Route("")]
        public async Task<IActionResult> PostAsync(Guid tenantId, StepDefinition model)

How can we prevent this vulnerability. We are using newtonsoft json for serialization/deserialization purposes. WHat I have noticed is if I just add a dummy param and mark it with JsonIgnore attribute this error goes away. But not getting the logic for that. Any help will be appreciated. None of the other questions were of help.


问:
PluginResolutionException: Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact
I am trying to run mvnw clean compile on a rather old project.
The whole line is

```<code>../mvnw clean compile -Dflyway.url=jdbc:postgresql://localhost:5431/my_database -Dflyway.user=some_user -Dlyway.password=xxx -Dflyway.outOfOrder=true flyway:migrate -f pom.xml -U -X
</code>```

This gives me the following error

BUILD FAILURE

[ERROR] Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2) -> [Help 1]

org.apache.maven.plugin.PluginResolutionException: Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2)

And then further down

Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2)

This is the part of the pom.xml where I add the dependency (which is what I can find on Maven https://mvnrepository.com/artifact/org.postgresql/postgresql/42.2.19)

```<code><dependency>
   <groupId>org.postgresql</groupId>
   <artifactId>postgresql</artifactId>
   <version>42.2.19</version>
</dependency>
</code>```

And for what its worth, this is defined in the Wildfly properties for the database (database.properties)

```<code>database.test.url=jdbc:postgresql://localhost:5431/my_database_test
database.test.username=some_user
database.test.password=xxx

database.url=jdbc:postgresql://localhost:5431/my_database
database.username=some_user
database.password=xxx
</code>```

Body:
I am trying to run mvnw clean compile on a rather old project.
The whole line is

../mvnw clean compile -Dflyway.url=jdbc:postgresql://localhost:5431/my_database -Dflyway.user=some_user -Dlyway.password=xxx -Dflyway.outOfOrder=true flyway:migrate -f pom.xml -U -X

This gives me the following error

BUILD FAILURE

[ERROR] Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2) -> [Help 1]

org.apache.maven.plugin.PluginResolutionException: Plugin .url=jdbc:postgresql://localhost or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2)

And then further down

Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact .url=jdbc:postgresql:jar://localhost in central (https://repo.maven.apache.org/maven2)

This is the part of the pom.xml where I add the dependency (which is what I can find on Maven https://mvnrepository.com/artifact/org.postgresql/postgresql/42.2.19)

<dependency>
   <groupId>org.postgresql</groupId>
   <artifactId>postgresql</artifactId>
   <version>42.2.19</version>
</dependency>

And for what its worth, this is defined in the Wildfly properties for the database (database.properties)

database.test.url=jdbc:postgresql://localhost:5431/my_database_test
database.test.username=some_user
database.test.password=xxx

database.url=jdbc:postgresql://localhost:5431/my_database
database.username=some_user
database.password=xxx


问:
Conda enviroment activated but doesn't seem able to use any package installed inside in offline machine, enviroment folder copy from another machine
So I have 2 servers, one with internet(multiple user) and one without (multiple users). One have anaconda and one have miniconda, both installed and tested succesfully with local base enviroment. I created a conda enviroment name 'tf26-openvino' in the server with the internet and copy the envs folder in $PATH/anaconda3/envs/tf26-openvino to folder $PATH/miniconda3/envs/ in the server without the internet.

I've activated the enviroment successfully using "conda activate tf26-openvino" but can't use any of the package installed in the folder. For example, if I type "which python" while being inside the "tf26-openvino", it return "~miniconda3/bin/python" not the desired "~miniconda3/envs/tf26-openvino/bin/python". When I try to acccess specifically python3.8 in the bin folder of tf26-openvino it return:

```<code>(tf26-openvino) [user@server_name bin]$ python3.8 --version: -bash $PATH/miniconda3/envs/tf26-openvino/bin/python3.8: Permission Denied
</code>```

Server without internet:

- conda info:

```<code>     active environment : tf26_openvino
    active env location : /home/hoangth34/miniconda3/envs/tf26_openvino
            shell level : 2
       user config file : /home/hoangth34/.condarc
 populated config files :
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __linux=3.10.0=0
                          __glibc=2.17=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/hoangth34/miniconda3  (writable)
      conda av data dir : /home/hoangth34/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/hoangth34/miniconda3/pkgs
                          /home/hoangth34/.conda/pkgs
       envs directories : /home/hoangth34/miniconda3/envs
                          /home/hoangth34/.conda/envs
               platform : linux-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Linux/3.10.0-1127.19.1.el7.x86_64 centos/7.8.2003 glibc/2.17
                UID:GID : 1043:1044
             netrc file : None
           offline mode : False
</code>```

- echo $PATH: while inside tf26_openvino enviroment

```<code>/home/hoangth34/miniconda3/envs/tf26_openvino/bin:/home/hoangth34/miniconda3/condabin:~/miniconda3/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hoangth34/.local/bin:/home/hoangth34/bin
</code>```

I have tried export the PATH specfically to "~miniconda3/envs/tf26-openvino/bin"  in .bashrc with no avail

Use another type of conda (miniforge with same problem)

Complete install and reinstall of conda

Changing installation location

Please help!, English is not my first language so I apologize for anything that seems hard to understand.

Body:
So I have 2 servers, one with internet(multiple user) and one without (multiple users). One have anaconda and one have miniconda, both installed and tested succesfully with local base enviroment. I created a conda enviroment name 'tf26-openvino' in the server with the internet and copy the envs folder in $PATH/anaconda3/envs/tf26-openvino to folder $PATH/miniconda3/envs/ in the server without the internet.

I've activated the enviroment successfully using "conda activate tf26-openvino" but can't use any of the package installed in the folder. For example, if I type "which python" while being inside the "tf26-openvino", it return "~miniconda3/bin/python" not the desired "~miniconda3/envs/tf26-openvino/bin/python". When I try to acccess specifically python3.8 in the bin folder of tf26-openvino it return:

(tf26-openvino) [user@server_name bin]$ python3.8 --version: -bash $PATH/miniconda3/envs/tf26-openvino/bin/python3.8: Permission Denied

Server without internet:

- conda info:

     active environment : tf26_openvino
    active env location : /home/hoangth34/miniconda3/envs/tf26_openvino
            shell level : 2
       user config file : /home/hoangth34/.condarc
 populated config files :
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __linux=3.10.0=0
                          __glibc=2.17=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/hoangth34/miniconda3  (writable)
      conda av data dir : /home/hoangth34/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/hoangth34/miniconda3/pkgs
                          /home/hoangth34/.conda/pkgs
       envs directories : /home/hoangth34/miniconda3/envs
                          /home/hoangth34/.conda/envs
               platform : linux-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Linux/3.10.0-1127.19.1.el7.x86_64 centos/7.8.2003 glibc/2.17
                UID:GID : 1043:1044
             netrc file : None
           offline mode : False

- echo $PATH: while inside tf26_openvino enviroment

/home/hoangth34/miniconda3/envs/tf26_openvino/bin:/home/hoangth34/miniconda3/condabin:~/miniconda3/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hoangth34/.local/bin:/home/hoangth34/bin

I have tried export the PATH specfically to "~miniconda3/envs/tf26-openvino/bin"  in .bashrc with no avail

Use another type of conda (miniforge with same problem)

Complete install and reinstall of conda

Changing installation location

Please help!, English is not my first language so I apologize for anything that seems hard to understand.


问:
Handlebar js and Express - after deploying the application in server, the UI are inconsistent to render the css, images on somestimes
We deploy our application into the RHEL linux server. The application is working in my local system(linux) but in server the UI not render the css and images and few js files properly.
All the css, images, js script files are under the Public folder.
All the hbs are under Views folder.

in app.js

folder structure

Code is completely working fine in my local system. But not working in Linux server(css and images are rendering sometimes correctly and sometimes not)

Error: Failed to Load resources: the server responded with status 404 image.png
Failed to Load resources: the server responded with status 404 bootstrap.min.js

Trying to changing the static file code in app.js but no use. Anyone help on this?


问:
Disable javascript when going back
I'm using a Chrome extension, is it possible to disable this script when I go back in the browser?

```<code>clickme = document.querySelector('[title="Stampa etichette"]');
if (clickme) {clickme.click()};
</code>```

Thanks very much!

I tried in vain this feature, however deprecated:

```<code>if (performance.navigation.type != 2){
   clickme = document.querySelector('[title="Stampa etichette"]');
   if (clickme) {clickme.click()};
}
</code>```

Title: Disable javascript when going back

Body:
I'm using a Chrome extension, is it possible to disable this script when I go back in the browser?

clickme = document.querySelector('[title="Stampa etichette"]');
if (clickme) {clickme.click()};

Thanks very much!

I tried in vain this feature, however deprecated:

if (performance.navigation.type != 2){
   clickme = document.querySelector('[title="Stampa etichette"]');
   if (clickme) {clickme.click()};
}


问:
Why Linux device driver execute unmap to clean cache after DMA transmission
When writing standalone driver, I flush/clean cache before I use DMA to transmit data to peripheral device, I need not flush/invalidate/clean cache after the transmission is completed.

But for Linux kernel device driver, we call dma_map_single() before transmission, and call dma_unmap_single() after transmission.  I think it is not necessary to call dma_unmap_single() to clean cache after transmission. Does it do some job for MMU?

For example， here is the code block for transmission in drivers\net\ethernet\cadence\macb_main.c.

```<code>macb_tx_map( )
{
.......
    mapping = dma_map_single(&bp->pdev->dev,
             skb->data + offset,
             size, DMA_TO_DEVICE);
    .......
}

macb_tx_unmap( )
{
    .......

    dma_unmap_single(&bp->pdev->dev, tx_skb->mapping,
             tx_skb->size, DMA_TO_DEVICE);
    .......
}
</code>```

I check the code and find they both call __dma_clean_area in arch\arm64\mm\cache.S.

Body:
When writing standalone driver, I flush/clean cache before I use DMA to transmit data to peripheral device, I need not flush/invalidate/clean cache after the transmission is completed.

But for Linux kernel device driver, we call dma_map_single() before transmission, and call dma_unmap_single() after transmission.  I think it is not necessary to call dma_unmap_single() to clean cache after transmission. Does it do some job for MMU?

For example， here is the code block for transmission in drivers\net\ethernet\cadence\macb_main.c.

macb_tx_map( )
{
.......
    mapping = dma_map_single(&bp->pdev->dev,
             skb->data + offset,
             size, DMA_TO_DEVICE);
    .......
}

macb_tx_unmap( )
{
    .......

    dma_unmap_single(&bp->pdev->dev, tx_skb->mapping,
             tx_skb->size, DMA_TO_DEVICE);
    .......
}

I check the code and find they both call __dma_clean_area in arch\arm64\mm\cache.S.


问:
EPERM: operation not permitted, copyfile. In a Docker dev-environment
Trying to build a github repo locally using the docker dev environment and getting an EPERM error.

➤ YN0001: │ Error: esbuild-linux-arm64@npm:0.14.54: EPERM: operation not permitted, copyfile '/root/.yarn/berry/cache/esbuild-linux-arm64-npm-0.14.54-494e5f1b94-8.zip' -> '/com.docker.devenvironments.code/.yarn/cache/esbuild-linux-arm64-npm-0.14.54-494e5f1b94-8.zip-5d136c97b7bea2c4.tmp'

Tried updating docker and changing the node versions to higher minor versions other than that mentioned in the package.json(16.13).
Running through sudo doesn't seem to make a difference.


问:
Netlogo-Why does storing data from turtles into the global variable matrix crash
My program has an array for each turtle, and when I want to store the data in this array to the global variable matrix, the program does not work properly
I want to be able to implement an array for each turtle that stores data into a global variable matrix................................................................................................
The problem arises in：

``
let n 0 while [n < 40][ let tmp_num1 (array:item get_k n) matrix:set col_k CatNum n tmp_num

```<code>

Here is my full code

</code>```
```<code>`extensions [
  array
  matrix]
globals[
  i
  v
  col_k
]

breed[cats cat]
breed[rats rat]
cats-own [
  CatNum
  data_from_rat
  a_array
  GetRatNum
  get_k
  k ;;
]

rats-own[
  kg
  num
]

to setup
  clear-all
  reset-ticks
  set i 0
  set v 0
  creat-animals
  creat-world
  set col_k matrix:make-constant 40 40 0
  ask cats[
    set k 0
    set a_array array:from-list n-values 20 [0]
    set get_k array:from-list n-values 20 [0]
  ]

end

to go
    ask n-of 20 rats[   ;;
    if i < 20 [
   set num i
   set i i + 1
    ]
  ]
  ask rats[
    update
    creat-ratnum
    fd 3
    rt random 90
  ]

  ask n-of 40 cats[
   if v < 40 [
     set CatNum v
     set v v + 1

    ]

  ]
  ask cats[

    let agsets other turtles-here with [breed = rats]
    if count agsets >= 1
    [
      interaction(one-of agsets)
    ]
    fd 3
    lt random 90
    ;;print_array

  ]
  tick
end

to creat-animals

  create-cats 40[
    set shape "cat"
    set size 2
    set color orange
    setxy random-xcor random-ycor
  ]
  create-rats 20[
    set shape "mouse side"
    set size 2
    set color pink
    setxy random-xcor random-ycor
  ]
end
to creat-world
  ask patches[
    set pcolor white
  ]
end
to creat-ratnum

 loop[
    if i >= 20 [stop]
   set num i
  set i i + 1

  ]
end
to update
  set kg random-float 1

end

to interaction[provider]

    set data_from_rat([kg] of provider)
    set GetRatNum ([num] of provider)
    let tmp_num (array:item get_k GetRatNum)  ;;
    ifelse tmp_num >= 1 [
     set tmp_num tmp_num + 1
     array:set get_k GetRatNum tmp_num  ;;
     ;print (word "this is:" tmp_num)
  ][
    set tmp_num tmp_num + 1
    array:set get_k GetRatNum tmp_num
  ]
    array:set a_array GetRatNum data_from_rat   ;;
  ;;
   let n 0
    while [n < 40][
    let tmp_num1 (array:item get_k n)
    matrix:set col_k CatNum n tmp_num
  ]
end`
</code>```

``

Body:
My program has an array for each turtle, and when I want to store the data in this array to the global variable matrix, the program does not work properly
I want to be able to implement an array for each turtle that stores data into a global variable matrix................................................................................................
The problem arises in：

``
let n 0 while [n < 40][ let tmp_num1 (array:item get_k n) matrix:set col_k CatNum n tmp_num

Here is my full code

`extensions [
  array
  matrix]
globals[
  i
  v
  col_k
]

breed[cats cat]
breed[rats rat]
cats-own [
  CatNum
  data_from_rat
  a_array
  GetRatNum
  get_k
  k ;;
]

rats-own[
  kg
  num
]

to setup
  clear-all
  reset-ticks
  set i 0
  set v 0
  creat-animals
  creat-world
  set col_k matrix:make-constant 40 40 0
  ask cats[
    set k 0
    set a_array array:from-list n-values 20 [0]
    set get_k array:from-list n-values 20 [0]
  ]

end

to go
    ask n-of 20 rats[   ;;
    if i < 20 [
   set num i
   set i i + 1
    ]
  ]
  ask rats[
    update
    creat-ratnum
    fd 3
    rt random 90
  ]

  ask n-of 40 cats[
   if v < 40 [
     set CatNum v
     set v v + 1

    ]

  ]
  ask cats[

    let agsets other turtles-here with [breed = rats]
    if count agsets >= 1
    [
      interaction(one-of agsets)
    ]
    fd 3
    lt random 90
    ;;print_array

  ]
  tick
end

to creat-animals

  create-cats 40[
    set shape "cat"
    set size 2
    set color orange
    setxy random-xcor random-ycor
  ]
  create-rats 20[
    set shape "mouse side"
    set size 2
    set color pink
    setxy random-xcor random-ycor
  ]
end
to creat-world
  ask patches[
    set pcolor white
  ]
end
to creat-ratnum

 loop[
    if i >= 20 [stop]
   set num i
  set i i + 1

  ]
end
to update
  set kg random-float 1

end

to interaction[provider]

    set data_from_rat([kg] of provider)
    set GetRatNum ([num] of provider)
    let tmp_num (array:item get_k GetRatNum)  ;;
    ifelse tmp_num >= 1 [
     set tmp_num tmp_num + 1
     array:set get_k GetRatNum tmp_num  ;;
     ;print (word "this is:" tmp_num)
  ][
    set tmp_num tmp_num + 1
    array:set get_k GetRatNum tmp_num
  ]
    array:set a_array GetRatNum data_from_rat   ;;
  ;;
   let n 0
    while [n < 40][
    let tmp_num1 (array:item get_k n)
    matrix:set col_k CatNum n tmp_num
  ]
end`

``


问:
How to refresh Widget in CupertinoTabScaffold tabBuilder Flutter?
I have a tabBuilder with switch case, I have a tab that needs to be refreshed after authorization or logout. I have a token variable which is assigned a value after authorization. I need to update the widget every time my variable is assigned a value, how can i make it? I also have a way to update the tab every time you go to it, but it will not work here

```<code>@override
  Widget build(BuildContext context) {
    setState(() {
      Constants.USER_TOKEN; // my token variable
    });
    return CupertinoTabScaffold(
        controller: _controller,
        key: myKey,
        backgroundColor: Colors.black87,
        tabBar: CupertinoTabBar(
          iconSize: 30,
          currentIndex: currentIndex,
          onTap: onItemTapped,
          items: const [
            BottomNavigationBarItem(icon: Icon(Icons.home, size: 25)),
            BottomNavigationBarItem(icon: Icon(Icons.store, size: 25,)),
            BottomNavigationBarItem(icon: Icon(Icons.shopping_bag, size: 25)),
            BottomNavigationBarItem(icon: Icon(Icons.person, size: 25)),
          ],
        ),
        tabBuilder: (BuildContext context, int index) {
          print(currentIndex);
          switch (index) {
            case 0:
             // The page that should be updated when the variable changes
              return
                CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: HomePage(),
                  );
                },
              );
            case 1:
              return CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: CatalogPage(),
                  );
                },
              );
            case 2:
              return currentIndex == 2 ?    // my always refresh method
               CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: ShoppingBag(),
                  );
                },
              ) : Container();
            case 3:
              return CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: UserProfileScaffold(),
                  );
                },
              );
            default:
              return Container();
          }
        });
  }
</code>```

Body:
I have a tabBuilder with switch case, I have a tab that needs to be refreshed after authorization or logout. I have a token variable which is assigned a value after authorization. I need to update the widget every time my variable is assigned a value, how can i make it? I also have a way to update the tab every time you go to it, but it will not work here

@override
  Widget build(BuildContext context) {
    setState(() {
      Constants.USER_TOKEN; // my token variable
    });
    return CupertinoTabScaffold(
        controller: _controller,
        key: myKey,
        backgroundColor: Colors.black87,
        tabBar: CupertinoTabBar(
          iconSize: 30,
          currentIndex: currentIndex,
          onTap: onItemTapped,
          items: const [
            BottomNavigationBarItem(icon: Icon(Icons.home, size: 25)),
            BottomNavigationBarItem(icon: Icon(Icons.store, size: 25,)),
            BottomNavigationBarItem(icon: Icon(Icons.shopping_bag, size: 25)),
            BottomNavigationBarItem(icon: Icon(Icons.person, size: 25)),
          ],
        ),
        tabBuilder: (BuildContext context, int index) {
          print(currentIndex);
          switch (index) {
            case 0:
             // The page that should be updated when the variable changes
              return
                CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: HomePage(),
                  );
                },
              );
            case 1:
              return CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: CatalogPage(),
                  );
                },
              );
            case 2:
              return currentIndex == 2 ?    // my always refresh method
               CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: ShoppingBag(),
                  );
                },
              ) : Container();
            case 3:
              return CupertinoTabView(
                builder: (BuildContext context) {
                  return const CupertinoPageScaffold(
                    resizeToAvoidBottomInset: false,
                    child: UserProfileScaffold(),
                  );
                },
              );
            default:
              return Container();
          }
        });
  }