问:
Can't enable "Manage your WhatsApp Accounts" option in facebook embedded signup
I am trying to integrate whatsapp embedded signup as business solution provider. I have implemented the embedded signup following their documentation. I can enable and disable the "Manage your WhatsApp Accounts" option from other 3rd party bsp. So I have created a whatsapp business account and added a whatsapp number. Here is a embedded signup flow:

[[Embedded signup flow](https://i.stack.imgur.com/6NPrH.png)](https://i.stack.imgur.com/ULv7B.png)

Here is the code we followed:

`

```<code>$_Company_WHATSAPP_OPENAPI = {
    APP_ID: "xxxxxxxxxxxxxxxxx",
    system_user_access_token : "token",
    getOpenAPiPage: function () {
            $_Company_WHATSAPP_OPENAPI.loadAPI();
    },

    getBtnHtml: function () {
        return '<button id="loginButtonWhatsApp" onClick="$_Company_WHATSAPP_OPENAPI.launchWhatsAppSignup()" style="background-color: #1877f2; border: 0; border-radius: 4px; color: #fff; cursor: pointer; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; height: 40px; padding: 0 24px;">Login with Facebook</button>';
    },

    loadAPI: function () {
        window.fbAsyncInit = function () {
            // JavaScript SDK configuration and setup
            FB.init({
                appId: $_Company_WHATSAPP_OPENAPI.APP_ID, // Facebook App ID
                cookie: true, // enable cookies
                xfbml: true, // parse social plugins on this page
                version: 'v15.0' //Graph API version
            });
        };
        // Load the JavaScript SDK asynchronously
        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s);
            js.id = id;
            js.src = "https://connect.facebook.net/en_US/sdk.js";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    },

    launchWhatsAppSignup: function () {
        function waitForFbq(callback){
            if(typeof fbq !== 'undefined'){
                callback()
            } else {
                setTimeout(function () {
                    waitForFbq(callback)
                }, 100)
            }
        }
        waitForFbq(function () {
           fbq && fbq('track', 'WhatsAppOnboardingStart', {
                appId: $_Company_WHATSAPP_OPENAPI.APP_ID,
                feature: 'whatsapp_embedded_signup'
            });
        })

        // Launch Facebook login
        FB.login(function (response) {
            if (response.authResponse) {
                const accessToken = response.authResponse.accessToken;
                if (response.status === 'connected') {
                    console.log("FB login access token : ",accessToken);
                }
            }
            else {
                console.log('User cancelled login or did not fully authorize.');
            }
        }, {
            scope: 'business_management,whatsapp_business_management,email,public_profile,whatsapp_business_messaging',
            extras: {
                feature: 'whatsapp_embedded_signup',
                setup: {
                    business: {
                        name: 'Some company.',
                        email: 'rupen@company.com',
                        phone: {
                            code: 1,
                            number: '6505551234'
                        },
                        website: 'https://www.company.com',
                        address: {
                            streetAddress1: '1 Acme Way',
                            city: 'Acme Town',
                            state: 'CA',
                            zipPostal: '94000',
                            country: 'BD'
                        },
                        timezone: 'UTC-08:00'
                    },
                    phone: {
                        displayName: 'Acme Inc.',
                        category: 'ENTERTAIN',
                        description: ''
                    }
                }
            }
        });
    },
}
</code>```

`

Is there any permission that I am missing?

I have added whatsapp_business_management permission in the scope.As it is responsible for managing whatsapp accounts, I have expected that it will enable "Manage your WhatApp accounts" option.

Body:
I am trying to integrate whatsapp embedded signup as business solution provider. I have implemented the embedded signup following their documentation. I can enable and disable the "Manage your WhatsApp Accounts" option from other 3rd party bsp. So I have created a whatsapp business account and added a whatsapp number. Here is a embedded signup flow:

[[Embedded signup flow](https://i.stack.imgur.com/6NPrH.png)](https://i.stack.imgur.com/ULv7B.png)

Here is the code we followed:

`

$_Company_WHATSAPP_OPENAPI = {
    APP_ID: "xxxxxxxxxxxxxxxxx",
    system_user_access_token : "token",
    getOpenAPiPage: function () {
            $_Company_WHATSAPP_OPENAPI.loadAPI();
    },

    getBtnHtml: function () {
        return '<button id="loginButtonWhatsApp" onClick="$_Company_WHATSAPP_OPENAPI.launchWhatsAppSignup()" style="background-color: #1877f2; border: 0; border-radius: 4px; color: #fff; cursor: pointer; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; height: 40px; padding: 0 24px;">Login with Facebook</button>';
    },

    loadAPI: function () {
        window.fbAsyncInit = function () {
            // JavaScript SDK configuration and setup
            FB.init({
                appId: $_Company_WHATSAPP_OPENAPI.APP_ID, // Facebook App ID
                cookie: true, // enable cookies
                xfbml: true, // parse social plugins on this page
                version: 'v15.0' //Graph API version
            });
        };
        // Load the JavaScript SDK asynchronously
        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s);
            js.id = id;
            js.src = "https://connect.facebook.net/en_US/sdk.js";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    },

    launchWhatsAppSignup: function () {
        function waitForFbq(callback){
            if(typeof fbq !== 'undefined'){
                callback()
            } else {
                setTimeout(function () {
                    waitForFbq(callback)
                }, 100)
            }
        }
        waitForFbq(function () {
           fbq && fbq('track', 'WhatsAppOnboardingStart', {
                appId: $_Company_WHATSAPP_OPENAPI.APP_ID,
                feature: 'whatsapp_embedded_signup'
            });
        })

        // Launch Facebook login
        FB.login(function (response) {
            if (response.authResponse) {
                const accessToken = response.authResponse.accessToken;
                if (response.status === 'connected') {
                    console.log("FB login access token : ",accessToken);
                }
            }
            else {
                console.log('User cancelled login or did not fully authorize.');
            }
        }, {
            scope: 'business_management,whatsapp_business_management,email,public_profile,whatsapp_business_messaging',
            extras: {
                feature: 'whatsapp_embedded_signup',
                setup: {
                    business: {
                        name: 'Some company.',
                        email: 'rupen@company.com',
                        phone: {
                            code: 1,
                            number: '6505551234'
                        },
                        website: 'https://www.company.com',
                        address: {
                            streetAddress1: '1 Acme Way',
                            city: 'Acme Town',
                            state: 'CA',
                            zipPostal: '94000',
                            country: 'BD'
                        },
                        timezone: 'UTC-08:00'
                    },
                    phone: {
                        displayName: 'Acme Inc.',
                        category: 'ENTERTAIN',
                        description: ''
                    }
                }
            }
        });
    },
}

`

Is there any permission that I am missing?

I have added whatsapp_business_management permission in the scope.As it is responsible for managing whatsapp accounts, I have expected that it will enable "Manage your WhatApp accounts" option.


来源: stackexchange

问:
Yocto : How to make opkg aware of deletion of a file during pkg_postinst_ontarget_${PN}()
I have the following procedure to install a firmware on the target filesystem so this firmware can be flashed onto an external MCU :

```<code>SRC_URI = " \
    file://${FIRMWARE_NAME} \
"

FILES_${PN} += " \
    /home/root/${FIRMWARE_NAME} \
"

do_install() {
    install -d ${D}${FIRMWARE_INSTALL_DIR}
    install -m 0644 ${WORKDIR}/${FIRMWARE_NAME} ${D}/${FIRMWARE_INSTALL_DIR}/${FIRMWARE_NAME}
}
</code>```

Once flashed onto the MCU, the firmware.bin is useless and deleted by pkg_postinst_ontarget() :

```<code>pkg_postinst_ontarget_${PN}() {
    < Flashing procedure of MCU with firmware.bin >
    rm -f ${FIRMWARE_INSTALL_DIR}/${FIRMWARE_NAME}
    echo "Deleted ${FIRMWARE_NAME} from filesystem."
}
</code>```

If I upgrade my package, opkg warns me about this :

```<code>Collected errors:
 * remove_obsolesced_files: unlinking /home/root/firmware_old_version.bin failed: No such file or directory.
 * opkg_install_pkg: Failed to determine obsolete files from previously installed firmware-zephyr
</code>```

How to modify my recipe so opkg would be aware that pkg_postinst_ontarget_${PN}() has deleted the file?

I've tried to search for documentation but no success.

ContentLicense: CC BY-SA 4.0

Body:
I have the following procedure to install a firmware on the target filesystem so this firmware can be flashed onto an external MCU :

SRC_URI = " \
    file://${FIRMWARE_NAME} \
"

FILES_${PN} += " \
    /home/root/${FIRMWARE_NAME} \
"

do_install() {
    install -d ${D}${FIRMWARE_INSTALL_DIR}
    install -m 0644 ${WORKDIR}/${FIRMWARE_NAME} ${D}/${FIRMWARE_INSTALL_DIR}/${FIRMWARE_NAME}
}

Once flashed onto the MCU, the firmware.bin is useless and deleted by pkg_postinst_ontarget() :

pkg_postinst_ontarget_${PN}() {
    < Flashing procedure of MCU with firmware.bin >
    rm -f ${FIRMWARE_INSTALL_DIR}/${FIRMWARE_NAME}
    echo "Deleted ${FIRMWARE_NAME} from filesystem."
}

If I upgrade my package, opkg warns me about this :

Collected errors:
 * remove_obsolesced_files: unlinking /home/root/firmware_old_version.bin failed: No such file or directory.
 * opkg_install_pkg: Failed to determine obsolete files from previously installed firmware-zephyr

How to modify my recipe so opkg would be aware that pkg_postinst_ontarget_${PN}() has deleted the file?

I've tried to search for documentation but no success.


问:
ODBC npm package breaks angular project on macbook m1 chips
I'm trying to query data from a serverless sql endpoint using ODBC, and this piece of code:

```<code>try {
          const result = odbc.connect(this.connectionString).then((conn) => {
              const queryResult = conn.query("SELECT * FROM MyTable")
              console.log(queryResult)
          })
        } catch (error) {
          console.log("an error has occured")
        }
</code>```

The output in my terminal looks like this:

```<code>./node_modules/tar/node_modules/mkdirp/lib/path-arg.js:5:4-19 - Error: Module not found: Error: Can't resolve 'path' in '/Users/myName/workspace/myDir/myProject/node_modules/tar/node_modules/mkdirp/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }

./node_modules/tar/node_modules/mkdirp/lib/use-native.js:1:11-24 - Error: Module not found: Error: Can't resolve 'fs' in '/Users/myName/workspace/myDir/myProject/node_modules/tar/node_modules/mkdirp/lib'

./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html:1:0 - Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>

./node_modules/node-gyp/lib/Find-VisualStudio.cs:9:6 - Error: Module parse failed: Unexpected token (9:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| // This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.
|
> using System;
| using System.Text;
| using System.Runtime.InteropServices;
</code>```

I've tried googling this problem and clicked on about every link I found. I figured this is a problem related to the m1 chip from macbooks. People claim to have fixed this problem but I have not had any success trying to fix it.

Body:
I'm trying to query data from a serverless sql endpoint using ODBC, and this piece of code:

try {
          const result = odbc.connect(this.connectionString).then((conn) => {
              const queryResult = conn.query("SELECT * FROM MyTable")
              console.log(queryResult)
          })
        } catch (error) {
          console.log("an error has occured")
        }

The output in my terminal looks like this:

./node_modules/tar/node_modules/mkdirp/lib/path-arg.js:5:4-19 - Error: Module not found: Error: Can't resolve 'path' in '/Users/myName/workspace/myDir/myProject/node_modules/tar/node_modules/mkdirp/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }

./node_modules/tar/node_modules/mkdirp/lib/use-native.js:1:11-24 - Error: Module not found: Error: Can't resolve 'fs' in '/Users/myName/workspace/myDir/myProject/node_modules/tar/node_modules/mkdirp/lib'

./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html:1:0 - Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
|
|

./node_modules/node-gyp/lib/Find-VisualStudio.cs:9:6 - Error: Module parse failed: Unexpected token (9:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| // This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.
|
> using System;
| using System.Text;
| using System.Runtime.InteropServices;

I've tried googling this problem and clicked on about every link I found. I figured this is a problem related to the m1 chip from macbooks. People claim to have fixed this problem but I have not had any success trying to fix it.


问:
I am having the following error when trying to run the pipeline on gitlab runner
rm: cannot remove ‘/home/mangat/builds/bPsmAsMu/0/media/learning-project.tmp/CI_SERVER_TLS_CA_FILE’: Permission denied
17ERROR: Job failed: exit status 1

My gitlab-ci.yml file is

```<code>stages:
  - build
  - deploy
build:
  stage: build
  script:
    - apt update -y
    - apt install npm -y
    - npm install

deploy:
  stage: deploy
  script:
    - apt update -y
    - apt install nodejs -y
    - node index.js
</code>```

I have tried using sudo; that also didn't work. The pipeline does work when i am not doing anything that requires sudo permissions.

Body:
rm: cannot remove ‘/home/mangat/builds/bPsmAsMu/0/media/learning-project.tmp/CI_SERVER_TLS_CA_FILE’: Permission denied
17ERROR: Job failed: exit status 1

My gitlab-ci.yml file is

stages:
  - build
  - deploy
build:
  stage: build
  script:
    - apt update -y
    - apt install npm -y
    - npm install

deploy:
  stage: deploy
  script:
    - apt update -y
    - apt install nodejs -y
    - node index.js

I have tried using sudo; that also didn't work. The pipeline does work when i am not doing anything that requires sudo permissions.


问:
Need an automatic ARM to Thumb code translator
I need to build an application for CPU cortex-m0plus, which (if I understand right) doesn't support ARM instruction set. According to docs, it supports  ARMv6-M Thumb instruction set.

I'm using a 3rd-party library, which has some code written in ARM assembler. (Specifically, I use a libsecp256k1 library, and it has an assembler code for ARM for the most critical parts).
It uses unified syntax, but nevertheless some instructions are not supported by the cpu I need (such as stmfd).

Is there a way to automatically work this around, i.e. a sort of a compiler that automatically can emulate those instructions in terms of what is available?


问:
Copy crossrates value from matrix in book to 1:1 array in another book
I am looking for a solution to a VBA issue. I've checked the web for a solution to this but have not yet found one that does what I want it to do.

In simple terms, we want to populate an array in a column which represents a period, with the cross rates for a certain set of FX. The cross rates are found in a workbook which is located in a given year. The workbook in which the cross rates are specified is named the same as the period that we want to populate, i.e. 2105 for May 2021.

A given FX is stated in a non-table two dimensional matrix sent out by the HQ. The VBA code needs to find the cross rates, copy the cell value where the dimensions meet the criteria (i.e. "USD" for x-axis and "EUR" for y-axis") and paste it in the corresponding FX row in the correct period column.

What I have, is the code below. Please feel free to comment and add feedback.

Best Regards,
Tom

```<code>Sub GetCurrency()

    Call FunctionalityOff

Dim wbRapportdata As Workbook
Dim wsCurrency As Worksheet
Dim wsDashboard As Worksheet

Dim StrActPeriod As String
Dim strActYear As String
Dim strPeriod As String
Dim strPath As String
Dim strFile As String

    Set wbRapportdata = ThisWorkbook
    Set wsCurrency = wbRapportdata.Worksheets("Valutakurser")
    Set wsDashboard = wbRapportdata.Worksheets("DASHBOARD")

    StrActPeriod = wsDashboard.Range("K3").Value
    strActYear = 2000 + Left(StrActPeriod, 2)
    strPeriod = wsCurrency.Range("rngCurrencyPeriod").Address
    strPath = "E:\Z Rapportdata\1 Data\X Valutakurser\" & strActYear & "\"
    strFile = Dir(strPath & StrActPeriod & ".xl*")

Dim cPeriod As Range
Dim fPeriod As Integer

    Set cPeriod = wsCurrency.Range(strPeriod).Cells.Find(What:=StrActPeriod, LookIn:=xlValues, LookAt _
    :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
        If cPeriod Is Nothing Then
            MsgBox "Something went wrong"
            Else
            fPeriod = cPeriod.Column
        End If

 'foundcell = Selection.Find(What:=costType, After:=ActiveCell, LookIn:=xlValues, LookAt
                            ':=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
                            False, SearchFormat:=False)

Dim wbCurrency As Workbook
Dim wsCurrencyGet As Worksheet

    Set wbCurrency = Workbooks.Open(strPath & strFile, ReadOnly:=True)
        wbCurrency.Activate

    Set wsCurrencyGet = wbCurrency.Worksheets("Cross Rates")
        wsCurrencyGet.Activate

Dim cCurrency As String
Dim rCurrency As String
Dim rngCurrency As String
Dim strCurrency As String

Dim i As Integer

    cCurrency = wsCurrencyGet.Range("13:13").Address
    rCurrency = wsCurrencyGet.Range("A:A").Address
    rngCurrency = wsCurrencyGet.Range("A13").CurrentRegion.Address

    For i = 10 To 15
        wsCurrency.Activate
        strCurrency = wsCurrency.Range("A" & i).Value
        wsCurrency.Cells(i, fPeriod).Value =
        WorksheetFunction.Index(wsCurrencyGet.Range(rngCurrency),WorksheetFunction.Match(strCurrency,
        wsCurrencyGet.Range(rCurrency)), WorksheetFunction.Match("SEK", wsCurrencyGet.Range(cCurrency)))
    Next i

    Call FunctionalityOn

End Sub

</code>```

Body:
I am looking for a solution to a VBA issue. I've checked the web for a solution to this but have not yet found one that does what I want it to do.

In simple terms, we want to populate an array in a column which represents a period, with the cross rates for a certain set of FX. The cross rates are found in a workbook which is located in a given year. The workbook in which the cross rates are specified is named the same as the period that we want to populate, i.e. 2105 for May 2021.

A given FX is stated in a non-table two dimensional matrix sent out by the HQ. The VBA code needs to find the cross rates, copy the cell value where the dimensions meet the criteria (i.e. "USD" for x-axis and "EUR" for y-axis") and paste it in the corresponding FX row in the correct period column.

What I have, is the code below. Please feel free to comment and add feedback.

Best Regards,
Tom

Sub GetCurrency()

    Call FunctionalityOff

Dim wbRapportdata As Workbook
Dim wsCurrency As Worksheet
Dim wsDashboard As Worksheet

Dim StrActPeriod As String
Dim strActYear As String
Dim strPeriod As String
Dim strPath As String
Dim strFile As String

    Set wbRapportdata = ThisWorkbook
    Set wsCurrency = wbRapportdata.Worksheets("Valutakurser")
    Set wsDashboard = wbRapportdata.Worksheets("DASHBOARD")

    StrActPeriod = wsDashboard.Range("K3").Value
    strActYear = 2000 + Left(StrActPeriod, 2)
    strPeriod = wsCurrency.Range("rngCurrencyPeriod").Address
    strPath = "E:\Z Rapportdata\1 Data\X Valutakurser\" & strActYear & "\"
    strFile = Dir(strPath & StrActPeriod & ".xl*")

Dim cPeriod As Range
Dim fPeriod As Integer

    Set cPeriod = wsCurrency.Range(strPeriod).Cells.Find(What:=StrActPeriod, LookIn:=xlValues, LookAt _
    :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
        If cPeriod Is Nothing Then
            MsgBox "Something went wrong"
            Else
            fPeriod = cPeriod.Column
        End If

 'foundcell = Selection.Find(What:=costType, After:=ActiveCell, LookIn:=xlValues, LookAt
                            ':=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
                            False, SearchFormat:=False)

Dim wbCurrency As Workbook
Dim wsCurrencyGet As Worksheet

    Set wbCurrency = Workbooks.Open(strPath & strFile, ReadOnly:=True)
        wbCurrency.Activate

    Set wsCurrencyGet = wbCurrency.Worksheets("Cross Rates")
        wsCurrencyGet.Activate

Dim cCurrency As String
Dim rCurrency As String
Dim rngCurrency As String
Dim strCurrency As String

Dim i As Integer

    cCurrency = wsCurrencyGet.Range("13:13").Address
    rCurrency = wsCurrencyGet.Range("A:A").Address
    rngCurrency = wsCurrencyGet.Range("A13").CurrentRegion.Address

    For i = 10 To 15
        wsCurrency.Activate
        strCurrency = wsCurrency.Range("A" & i).Value
        wsCurrency.Cells(i, fPeriod).Value =
        WorksheetFunction.Index(wsCurrencyGet.Range(rngCurrency),WorksheetFunction.Match(strCurrency,
        wsCurrencyGet.Range(rCurrency)), WorksheetFunction.Match("SEK", wsCurrencyGet.Range(cCurrency)))
    Next i

    Call FunctionalityOn

End Sub


问:
Linkify react with mentions: https://linkify.js.org/docs/plugin-mention.html
Im trying to display the mention in my react app but it seems to not work at all.

The part with the URL's is working great.

```<code>"linkify-plugin-mention": "^4.0.2",
"linkify-react": "^4.0.2",
"linkifyjs": "^4.0.2",
</code>```

Here is what I have tried:

```<code>const LinkifyWrapper = ({ children }: ILinkifyWrapper) => {
  const options: import("linkifyjs").Opts = {
    render: {
      url: ({ attributes, content }) => {
        return (
          <Link target={"_blank"} href={attributes.href} rel="noopener">
            {content}
          </Link>
        );
      },
      // doesn't want to work, unfortunalelly
      mention: ({ attributes, content }) => {
        return <Link href={attributes.href}>{content}</Link>;
      },
    },
    // formatHref: {
    //   mention: (href) => {
    //     console.log(href);

    //     return "";
    //   },
    // },
    // attributes: (href, type) => {
    //   if (type === "mention") {
    //     return {
    //       to: "/profile" + href,
    //     };
    //   }
    //   return {};
    // },
  };

  return <Linkify options={options}>{children}</Linkify>;
};
</code>```

Body:
Im trying to display the mention in my react app but it seems to not work at all.

The part with the URL's is working great.

"linkify-plugin-mention": "^4.0.2",
"linkify-react": "^4.0.2",
"linkifyjs": "^4.0.2",

Here is what I have tried:

const LinkifyWrapper = ({ children }: ILinkifyWrapper) => {
  const options: import("linkifyjs").Opts = {
    render: {
      url: ({ attributes, content }) => {
        return (
          <Link target={"_blank"} href={attributes.href} rel="noopener">
            {content}
          </Link>
        );
      },
      // doesn't want to work, unfortunalelly
      mention: ({ attributes, content }) => {
        return <Link href={attributes.href}>{content}</Link>;
      },
    },
    // formatHref: {
    //   mention: (href) => {
    //     console.log(href);

    //     return "";
    //   },
    // },
    // attributes: (href, type) => {
    //   if (type === "mention") {
    //     return {
    //       to: "/profile" + href,
    //     };
    //   }
    //   return {};
    // },
  };

  return <Linkify options={options}>{children}</Linkify>;
};


问:
Yum Cache failed. Error : amzn2-core/2/x86_64/group_gz FAILED
Can anyone help here when I deploy an EC2 instance on aws
when yum makecache:

```<code>amzn2-core                                                                                | 3.7 kB  00:00:00
amzn2extra-docker                                                                                | 3.0 kB  00:00:00
amzn2extra-nginx1                                                                                | 3.0 kB  00:00:00
amzn2extra-postgresql11                                                                                | 3.0 kB  00:00:00
amzn2extra-python3.8                                                                                | 3.0 kB  00:00:00
amzn2-core/2/x86_64/group_gz   FAILED
https://amazonlinux-2-repos-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/2/core/2.0/x86_64/da64f79d533a70e6036c814aff5d1e823eeeb815054a7a3785d2d5198ff2eabc/repodata/comps.xml.gz?instance_id=i-08792031e5dac83de&region=eu-central-1: [Errno 14] curl#6 - "getaddrinfo() thread failed to start"
Trying other mirror.
amzn2-core/2/x86_64/filelists_ FAILED
https://amazonlinux-2-repos-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/2/core/2.0/x86_64/da64f79d533a70e6036c814aff5d1e823eeeb815054a7a3785d2d5198ff2eabc/repodata/filelists.sqlite.gz?instance_id=i-08792031e5dac83de&region=eu-central-1: [Errno 14] curl#6 - "getaddrinfo() thread failed to start"
Trying other mirror.
amzn2-core/2/x86_64/updateinfo FAILED
https://amazonlinux-2-repos-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/2/core/2.0/x86_64/da64f79d533a70e6036c814aff5d1e823eeeb815054a7a3785d2d5198ff2eabc/repodata/updateinfo.xml.gz?instance_id=i-08792031e5dac83de&region=eu-central-1: [Errno 14] curl#6 - "getaddrinfo() thread failed to start"
Trying other mirror.
(1/21): amzn2-core/2/x86_64/primary_db                                                                                |  66 MB  00:00:03
(2/21): amzn2-core/2/x86_64/other_db                                                                                |  505 B  00:00:00
no mem for new parser
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
    from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 543, in <module>
    import urllib
  File "/usr/lib64/python2.7/urllib.py", line 1225, in <module>
    for a in _hexdig for b in _hexdig)
MemoryError
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
        from urlgrabber.grabber import \
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
from urlgrabber.grabber import \
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
        from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 544, in <module>
from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 544, in <module>
    import urllib2
  File "/usr/lib64/python2.7/urllib2.py", line 93, in <module>
    import urllib2
  File "/usr/lib64/python2.7/urllib2.py", line 93, in <module>
    import hashlib
  File "/usr/lib64/python2.7/hashlib.py", line 116, in <module>
    import hashlib
  File "/usr/lib64/python2.7/hashlib.py", line 116, in <module>
    import _hashlib
ImportError: /usr/lib64/python2.7/lib-dynload/_hashlib.so: failed to map segment from shared object
    import _hashlib
ImportError: /usr/lib64/python2.7/lib-dynload/_hashlib.so: failed to map segment from shared object
</code>```

I've tried with  rm -rf /var/cache/yum

and it still fails

How to troubleshoot that ?

I usually deploy the app with eb deploy commands, and it works

Body:
Can anyone help here when I deploy an EC2 instance on aws
when yum makecache:

amzn2-core                                                                                | 3.7 kB  00:00:00
amzn2extra-docker                                                                                | 3.0 kB  00:00:00
amzn2extra-nginx1                                                                                | 3.0 kB  00:00:00
amzn2extra-postgresql11                                                                                | 3.0 kB  00:00:00
amzn2extra-python3.8                                                                                | 3.0 kB  00:00:00
amzn2-core/2/x86_64/group_gz   FAILED
https://amazonlinux-2-repos-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/2/core/2.0/x86_64/da64f79d533a70e6036c814aff5d1e823eeeb815054a7a3785d2d5198ff2eabc/repodata/comps.xml.gz?instance_id=i-08792031e5dac83de&region=eu-central-1: [Errno 14] curl#6 - "getaddrinfo() thread failed to start"
Trying other mirror.
amzn2-core/2/x86_64/filelists_ FAILED
https://amazonlinux-2-repos-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/2/core/2.0/x86_64/da64f79d533a70e6036c814aff5d1e823eeeb815054a7a3785d2d5198ff2eabc/repodata/filelists.sqlite.gz?instance_id=i-08792031e5dac83de&region=eu-central-1: [Errno 14] curl#6 - "getaddrinfo() thread failed to start"
Trying other mirror.
amzn2-core/2/x86_64/updateinfo FAILED
https://amazonlinux-2-repos-eu-central-1.s3.dualstack.eu-central-1.amazonaws.com/2/core/2.0/x86_64/da64f79d533a70e6036c814aff5d1e823eeeb815054a7a3785d2d5198ff2eabc/repodata/updateinfo.xml.gz?instance_id=i-08792031e5dac83de&region=eu-central-1: [Errno 14] curl#6 - "getaddrinfo() thread failed to start"
Trying other mirror.
(1/21): amzn2-core/2/x86_64/primary_db                                                                                |  66 MB  00:00:03
(2/21): amzn2-core/2/x86_64/other_db                                                                                |  505 B  00:00:00
no mem for new parser
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
    from urlgrabber.grabber import \
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
    from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 543, in <module>
    import urllib
  File "/usr/lib64/python2.7/urllib.py", line 1225, in <module>
    for a in _hexdig for b in _hexdig)
MemoryError
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
        from urlgrabber.grabber import \
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
from urlgrabber.grabber import \
  File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
        from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 544, in <module>
from grabber import urlgrab, urlopen, urlread
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 544, in <module>
    import urllib2
  File "/usr/lib64/python2.7/urllib2.py", line 93, in <module>
    import urllib2
  File "/usr/lib64/python2.7/urllib2.py", line 93, in <module>
    import hashlib
  File "/usr/lib64/python2.7/hashlib.py", line 116, in <module>
    import hashlib
  File "/usr/lib64/python2.7/hashlib.py", line 116, in <module>
    import _hashlib
ImportError: /usr/lib64/python2.7/lib-dynload/_hashlib.so: failed to map segment from shared object
    import _hashlib
ImportError: /usr/lib64/python2.7/lib-dynload/_hashlib.so: failed to map segment from shared object

I've tried with  rm -rf /var/cache/yum

and it still fails

How to troubleshoot that ?

I usually deploy the app with eb deploy commands, and it works


问:
How can I see how many items in my list are looked through for, before terminating, using any()?
I'm  checking a string against a large list of strings (approx. 400k+). It seems to be running far quicker than I thought it would to check against these. As such, I want to count how many strings are being iterated through to check if it is functioning properly or not, checking against the full list before confirming a non-match.

My function operates like so:

```<code>if any(string_to_check in string for string in list_of_strings):
        print("String Matched:" + string_to_check)
        return True
    else:
        print("String Not Matched:" + string_to_check)
        return False
</code>```

How could I add to this, to see how many strings in the list_of_strings are iterated through before matching or not matching?

Thanks in advance.

Body:
I'm  checking a string against a large list of strings (approx. 400k+). It seems to be running far quicker than I thought it would to check against these. As such, I want to count how many strings are being iterated through to check if it is functioning properly or not, checking against the full list before confirming a non-match.

My function operates like so:

if any(string_to_check in string for string in list_of_strings):
        print("String Matched:" + string_to_check)
        return True
    else:
        print("String Not Matched:" + string_to_check)
        return False

How could I add to this, to see how many strings in the list_of_strings are iterated through before matching or not matching?

Thanks in advance.


问:
Google Translate set default to French is not working
I have added this code to change my web page default language as 'fr' but it is not changing the content in 'fr' and showing in English.</p>
```<code><div id="google_translate_element" style="height: 0px !important;" ></div>

function googleTranslateElementInit() {
    new google.translate.TranslateElement({
                                            pageLanguage: 'fr',
                                            includedLanguages : 'en,fr',
                                        }, 'google_translate_element');
}
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</code>```

Body:
I have added this code to change my web page default language as 'fr' but it is not changing the content in 'fr' and showing in English.

function googleTranslateElementInit() {
    new google.translate.TranslateElement({
                                            pageLanguage: 'fr',
                                            includedLanguages : 'en,fr',
                                        }, 'google_translate_element');
}


问:
how to install muilti-dapr in one k8s cluster
I'm trying to use dapr as our micrservices's foundamatial framework, but I'm confused by the guildline of how to deploy dapr in k8s;
we have three enviroment (DEV/PPE/PROD)in out release pipeline in one K8s cluster, I think I need to deploy three dapr in each namespace,first we test our services in DEV namespace and next step test in PPE namespace,finally publish to PROD namespace.
But when I try to deploy dapr with helm in second namespace I got an error: "Error: INSTALLATION FAILED: rendered manifests contain a resource that already exists"; It seems that dapr is prefer to be installed once in one k8s cluster, that makes me confused.

Is there some document or guildlines that could help me to deply multi dapr in one k8s cluster? thanks !


问:
How to add a game over function in this Doodle Jump game in sfml?
How to add a game over? If you are not familiar with the Doodle Jump game, it is where a character will need to bounce off a platform to progress. But if the  player doesnt land on the platform, the game is over.

But in my case, even if I dont land on a platform, the game still continues.

`

```<code>    #include <SFML/Graphics.hpp>
    #include <time.h>
    using namespace sf;

    struct point
    {
        int x, y;
    };

    int main()
    {
        srand(time(0));

        RenderWindow app(VideoMode(400, 533), "Doodle Game!");
        app.setFramerateLimit(60);

        Texture t1, t2, t3;
        t1.loadFromFile("C:/Users/Dani/Documents/GAMES SFML/16_Games/02 Doodle Jump/images/background.png");
        t2.loadFromFile("C:/Users/Dani/Documents/GAMES SFML/16_Games/02 Doodle Jump/images/platform.png");
        t3.loadFromFile("C:/Users/Dani/Documents/GAMES SFML/16_Games/02 Doodle Jump/images/mark.png");

        Sprite sBackground(t1), sPlat(t2), sPers(t3);

        point plat[20];

        for (int i = 0; i < 10; i++)
        {
            plat[i].x = rand() % 400;
            plat[i].y = rand() % 533;
        }

        int x = 100, y = 100, h = 200;
        float dx = 0, dy = 0;

        while (app.isOpen())
        {
            Event e;
            while (app.pollEvent(e))
            {
                if (e.type == Event::Closed)
                    app.close();
            }

            if (Keyboard::isKeyPressed(Keyboard::Right)) x += 3;
            if (Keyboard::isKeyPressed(Keyboard::Left)) x -= 3;

            dy += 0.2;
            y += dy;
            if (y > 500)  dy = -10;

            if (y < h)
                for (int i = 0; i < 10; i++)
                {
                    y = h;
                    plat[i].y = plat[i].y - dy;
                    if (plat[i].y > 533) { plat[i].y = 0; plat[i].x = rand() % 400; }
                }

            for (int i = 0; i < 10; i++)
                if ((x + 50 > plat[i].x) && (x + 20 < plat[i].x + 68)
                    && (y + 70 > plat[i].y) && (y + 70 < plat[i].y + 14) && (dy > 0))  dy = -10;

            sPers.setPosition(x, y);

            app.draw(sBackground);
            app.draw(sPers);
            for (int i = 0; i < 10; i++)
            {
                sPlat.setPosition(plat[i].x, plat[i].y);
                app.draw(sPlat);
            }

            app.display();
        }

        return 0;
    }

</code>```

`

Thank you, all of your answers will be appreciated.

Body:
How to add a game over? If you are not familiar with the Doodle Jump game, it is where a character will need to bounce off a platform to progress. But if the  player doesnt land on the platform, the game is over.

But in my case, even if I dont land on a platform, the game still continues.

`

    #include <SFML/Graphics.hpp>
    #include <time.h>
    using namespace sf;

    struct point
    {
        int x, y;
    };

    int main()
    {
        srand(time(0));

        RenderWindow app(VideoMode(400, 533), "Doodle Game!");
        app.setFramerateLimit(60);

        Texture t1, t2, t3;
        t1.loadFromFile("C:/Users/Dani/Documents/GAMES SFML/16_Games/02 Doodle Jump/images/background.png");
        t2.loadFromFile("C:/Users/Dani/Documents/GAMES SFML/16_Games/02 Doodle Jump/images/platform.png");
        t3.loadFromFile("C:/Users/Dani/Documents/GAMES SFML/16_Games/02 Doodle Jump/images/mark.png");

        Sprite sBackground(t1), sPlat(t2), sPers(t3);

        point plat[20];

        for (int i = 0; i < 10; i++)
        {
            plat[i].x = rand() % 400;
            plat[i].y = rand() % 533;
        }

        int x = 100, y = 100, h = 200;
        float dx = 0, dy = 0;

        while (app.isOpen())
        {
            Event e;
            while (app.pollEvent(e))
            {
                if (e.type == Event::Closed)
                    app.close();
            }

            if (Keyboard::isKeyPressed(Keyboard::Right)) x += 3;
            if (Keyboard::isKeyPressed(Keyboard::Left)) x -= 3;

            dy += 0.2;
            y += dy;
            if (y > 500)  dy = -10;

            if (y < h)
                for (int i = 0; i < 10; i++)
                {
                    y = h;
                    plat[i].y = plat[i].y - dy;
                    if (plat[i].y > 533) { plat[i].y = 0; plat[i].x = rand() % 400; }
                }

            for (int i = 0; i < 10; i++)
                if ((x + 50 > plat[i].x) && (x + 20 < plat[i].x + 68)
                    && (y + 70 > plat[i].y) && (y + 70 < plat[i].y + 14) && (dy > 0))  dy = -10;

            sPers.setPosition(x, y);

            app.draw(sBackground);
            app.draw(sPers);
            for (int i = 0; i < 10; i++)
            {
                sPlat.setPosition(plat[i].x, plat[i].y);
                app.draw(sPlat);
            }

            app.display();
        }

        return 0;
    }

`

Thank you, all of your answers will be appreciated.


问:
Application Insights RemoteDependency stores resultCode=0 and success=false for failed requests that had resultcode
Here you can see our application failing a POST to GA:

The next track of Application Insights has the following content:

As you can see the resultCode is 0 even thought the resulcode was 403. Any reason for that?

It is not a consistent error, some times it records the right resultCode while some times it does not. Well, it consistently fails on some requests but consistently succeeds on some others, it it not a random issue.

You can get the HAR from here: HAR file


问:
Cloudfront and S3 folder problems
I have created one bucket and one cloudfront distribution.
I followed this resource https://opsdocks.com/posts/multiple-websites-one-s3/ because I am going to host 3 different domains with only one bucket.

I have this folder structure in my bucket:

```<code>folder1 (domain1)
--- index
--- web1
--- web2

folder2 (domain2)
--- index
--- web1
--- web2

folder3 (domain3)
--- index
--- web1
--- web2

</code>```

I used the lambda@edge function of the resource:

```<code>
def lambda_handler(event, context):
    request = event['Records'][0]['cf']['request']
    request['origin']['s3']['path'] = "/"+request['headers']['host'][0]['value']
    request['headers']['host'][0]['value'] = request['origin']['s3']['domainName']
    return request

</code>```

It works correctly with the path of the following type: folder1/web1.
However, I have tried so hard to include in the script a behavior when accessing to folder1/ gets a redirection to folder1/index but it downloads an empty file all of the time.

I have made a lot of tests changing the function in so many ways but I do not know why is still doing the same behavior.
Thank you

Title: Cloudfront and S3 folder problems

Body:
I have created one bucket and one cloudfront distribution.
I followed this resource https://opsdocks.com/posts/multiple-websites-one-s3/ because I am going to host 3 different domains with only one bucket.

I have this folder structure in my bucket:

folder1 (domain1)
--- index
--- web1
--- web2

folder2 (domain2)
--- index
--- web1
--- web2

folder3 (domain3)
--- index
--- web1
--- web2

I used the lambda@edge function of the resource:

def lambda_handler(event, context):
    request = event['Records'][0]['cf']['request']
    request['origin']['s3']['path'] = "/"+request['headers']['host'][0]['value']
    request['headers']['host'][0]['value'] = request['origin']['s3']['domainName']
    return request

It works correctly with the path of the following type: folder1/web1.
However, I have tried so hard to include in the script a behavior when accessing to folder1/ gets a redirection to folder1/index but it downloads an empty file all of the time.

I have made a lot of tests changing the function in so many ways but I do not know why is still doing the same behavior.
Thank you


问:
How to replace Flux elements when an exception is thrown?
How to replace Flux element and continue stream when an exception is thrown?

```<code>public class TEST {
    public static void main(String[] args) {
        Flux.just(1, 2, 3, 4, 5)
                .map(i -> {
                    if (i == 3) {
                        throw new RuntimeException();
                    }
                    return i;
                })
                .onErrorResume(e -> Mono.just(-1))
                .subscribe(System.out::println);
    }
}
</code>```

output:

```<code>1
2
-1
</code>```

as you see the stream is terminated after exception.

what I want:

```<code>1
2
-1
4
5
</code>```

is this possible in Reactor? I do not want to handle this in map operator!

Body:
How to replace Flux element and continue stream when an exception is thrown?

public class TEST {
    public static void main(String[] args) {
        Flux.just(1, 2, 3, 4, 5)
                .map(i -> {
                    if (i == 3) {
                        throw new RuntimeException();
                    }
                    return i;
                })
                .onErrorResume(e -> Mono.just(-1))
                .subscribe(System.out::println);
    }
}

output:

1
2
-1

as you see the stream is terminated after exception.

what I want:

1
2
-1
4
5

is this possible in Reactor? I do not want to handle this in map operator!


问:
postMessage sent from extension has non-null source, indistinguishable from self-sent message
Chrome extensions are able to postMessage with a source and origin that matches the current window and origin, thereby making it impossible to distinguish between a self-sent message and a message sent by an extension.

Dragon web extension is creating the problem for other Gmail chrome extensions. Without installing the dragon extension, the extension that I am working on is going fine but as soon as the dragon extension is installed it conflicts with the mine Gmail extension and many others are also facing this problem.

the console has the following received message:

```<code>{"protocol":"nuanria_messaging","type":"request","messageId":0,"action":"requestSpeechHostStatus","responseRequired":false}
</code>```

Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=585335

Body:
Chrome extensions are able to postMessage with a source and origin that matches the current window and origin, thereby making it impossible to distinguish between a self-sent message and a message sent by an extension.

Dragon web extension is creating the problem for other Gmail chrome extensions. Without installing the dragon extension, the extension that I am working on is going fine but as soon as the dragon extension is installed it conflicts with the mine Gmail extension and many others are also facing this problem.

the console has the following received message:

{"protocol":"nuanria_messaging","type":"request","messageId":0,"action":"requestSpeechHostStatus","responseRequired":false}

Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=585335


问:
Is it possible to ignore certain exception types in Android Studio logcat?
Some Exceptions are repeatedly occurring and making it harder to debug actual cause of error. So looking for any way to filter them from logs.</p>


问:
could not build arguments for function: missing dependencies for function: missing type
I'm trying to build a Go server using Echo, but I'm stuck with this error. I can't figure out what the problem is here.

This is my code.

// internal/app/start.go
package app

func Start(di *dig.Container, cfg *infra.App, e *echo.Echo) (err error) {
    if err := di.Invoke(func(e *echo.Echo, hc HealthCheck, httpCtrl httpCtrl.HttpCtrl,
    ) {
        // Set route
        httpCtrl.HttpRoutes(e)
    }); err != nil {
        return err
    }
}
```
<pre class="lang-golang prettyprint-override"><code>// internal/app/service/user.impl.go
package service

type (
  UserSvcImpl struct {
    dig.In
    NotificationsRepo   grpc.NotificationsRepository
  }
)

func NewUserSvc(impl UserSvcImpl) UserSvc {
  return &impl
}
</code>```

// internal/app/repo/grpc/notifications.go
package grpc

type NotificationsRepository interface {
  SendNotifications(ctx context.Context, params models.Notifications) (err error)
}
```
<pre class="lang-golang prettyprint-override"><code>// internal/app/repo/grpc/notifications.contract.go
package grpc

type (
  NotificationsRepositoryImpl struct {
    Registry grpc.RegistryGrpcConnection
    Client   packets.NotificationsClient
    Connected bool
  }
)

func NewNotificationsRepository(impl NotificationsRepositoryImpl) (r NotificationsRepository, err error) {
  return &impl, nil
}
</code>```

The error itself happens on the last code on line  func NewNotificationsRepository(impl NotificationsRepositoryImpl) (r NotificationsRepository, err error)

This is the error code

FATA[0000] could not build arguments for function "github.com/project/user-svc/internal/app".Start.func1:
failed to build service.UserSvc: could not build arguments for function "github.com/project/user-svc/internal/app/service".NewUserSvc:
failed to build grpc.NotificationsRepository: missing dependencies for function "github.com/project/user-svc/internal/app/repository/grpc/activity".NewNotificationsRepository:
missing type: grpc.NotificationsRepositoryImpl; close tcp [::]:30504: use of closed network connection
```

I don't understand why it's unable to detect the type. There's no compilation or syntax error, it only happens on runtime. Anyone knows why this happens?

I've been stuck with this error for days because I don't know why this error happens in the first place. It's just so weird that the type is considered missing. I've refactored the code but they also throw this error.

I also import other repository from the same package besides the NotificationsRepositoryImpl, and this error also happens to all of them too.

Body:
I'm trying to build a Go server using Echo, but I'm stuck with this error. I can't figure out what the problem is here.

This is my code.

// internal/app/start.go
package app

func Start(di *dig.Container, cfg *infra.App, e *echo.Echo) (err error) {
    if err := di.Invoke(func(e *echo.Echo, hc HealthCheck, httpCtrl httpCtrl.HttpCtrl,
    ) {
        // Set route
        httpCtrl.HttpRoutes(e)
    }); err != nil {
        return err
    }
}

// internal/app/service/user.impl.go
package service

type (
  UserSvcImpl struct {
    dig.In
    NotificationsRepo   grpc.NotificationsRepository
  }
)

func NewUserSvc(impl UserSvcImpl) UserSvc {
  return &impl
}

// internal/app/repo/grpc/notifications.go
package grpc

type NotificationsRepository interface {
  SendNotifications(ctx context.Context, params models.Notifications) (err error)
}

// internal/app/repo/grpc/notifications.contract.go
package grpc

type (
  NotificationsRepositoryImpl struct {
    Registry grpc.RegistryGrpcConnection
    Client   packets.NotificationsClient
    Connected bool
  }
)

func NewNotificationsRepository(impl NotificationsRepositoryImpl) (r NotificationsRepository, err error) {
  return &impl, nil
}

The error itself happens on the last code on line  func NewNotificationsRepository(impl NotificationsRepositoryImpl) (r NotificationsRepository, err error)

This is the error code

FATA[0000] could not build arguments for function "github.com/project/user-svc/internal/app".Start.func1:
failed to build service.UserSvc: could not build arguments for function "github.com/project/user-svc/internal/app/service".NewUserSvc:
failed to build grpc.NotificationsRepository: missing dependencies for function "github.com/project/user-svc/internal/app/repository/grpc/activity".NewNotificationsRepository:
missing type: grpc.NotificationsRepositoryImpl; close tcp [::]:30504: use of closed network connection

I don't understand why it's unable to detect the type. There's no compilation or syntax error, it only happens on runtime. Anyone knows why this happens?

I've been stuck with this error for days because I don't know why this error happens in the first place. It's just so weird that the type is considered missing. I've refactored the code but they also throw this error.

I also import other repository from the same package besides the NotificationsRepositoryImpl, and this error also happens to all of them too.


问:
FileUpload in Postman

I need to upload file with array data.When tried to hit API call,getting as value cant be null[parameter 'input']

I have given all the require parameters but still not resolved.Error screen is attached...

Thanks in advance.

Title: FileUpload in Postman


问:
Two Factor Authentication using Asp.net identity framework in ASP.NET MVC 5 application
I am implementing two factor authentication in my ASP.NET MVC 5 application for all users. I have already implemented single factor (username and password) authentication using ASP.NET Identity.

Here is how I implemented single factor authentication:

Step 1: I created the startup.cs file to know application should use cookie authentication

```<code>public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseCookieAuthentication(new CookieAuthenticationOptions()
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                LogoutPath = new PathString("/Account/LogOut")
            });
    }
}
</code>```

Step 2: User makes post request to login to application by sending username and password. Once username and password are verified, I used sign method from Owin Authentication Manager to sign in the user. This sign in method creates cookie and helps the authentication.

```<code>public ActionResult Login(LoginViewModel model)
{
    Session.Clear();

    if (!ModelState.IsValid)
    {
        return View(model);
    }

    var userManager = new ApplicationUserManager(new ApplicationUserStore(new ApplicationDbContext()));
    var user = userManager.Find(model.Username,model.Password);

    if (user != null)
    {
        var userIdentity = userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);

        var authenticationManager = HttpContext.GetOwinContext().Authentication;

        authenticationManager.SignIn(new AuthenticationProperties(), userIdentity);
    }
}
</code>```

But now I want to introduce OTP authentication after username and password login.I know how to generate OPT and I have SMS provider to send OTP to the user. I can easily put authenticationManager.SignIn() method after OTP verification. But my question is, is there any separate configuration we need provide during signIn to know application that we are doing two factor authentication.

If yes can somebody provide the code where to make such configuration?

Body:
I am implementing two factor authentication in my ASP.NET MVC 5 application for all users. I have already implemented single factor (username and password) authentication using ASP.NET Identity.

Here is how I implemented single factor authentication:

Step 1: I created the startup.cs file to know application should use cookie authentication

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseCookieAuthentication(new CookieAuthenticationOptions()
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                LogoutPath = new PathString("/Account/LogOut")
            });
    }
}

Step 2: User makes post request to login to application by sending username and password. Once username and password are verified, I used sign method from Owin Authentication Manager to sign in the user. This sign in method creates cookie and helps the authentication.

public ActionResult Login(LoginViewModel model)
{
    Session.Clear();

    if (!ModelState.IsValid)
    {
        return View(model);
    }

    var userManager = new ApplicationUserManager(new ApplicationUserStore(new ApplicationDbContext()));
    var user = userManager.Find(model.Username,model.Password);

    if (user != null)
    {
        var userIdentity = userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);

        var authenticationManager = HttpContext.GetOwinContext().Authentication;

        authenticationManager.SignIn(new AuthenticationProperties(), userIdentity);
    }
}

But now I want to introduce OTP authentication after username and password login.I know how to generate OPT and I have SMS provider to send OTP to the user. I can easily put authenticationManager.SignIn() method after OTP verification. But my question is, is there any separate configuration we need provide during signIn to know application that we are doing two factor authentication.

If yes can somebody provide the code where to make such configuration?


问:
How to communicate between two different applications (Web Application and Console Application) using Ctr+c , Ctr+v , Entre
I have two application one is a web application and the onther one is a console application,
the Console application generates a Data and that Data must be transfered to the webapplication, i tried to use the APIs to communicate between them but I find that I have Many users of my webapplication so I have many destinations and in this case I can't use APIs.

The only solution is that I need to use the Key events;
My question is : how I can use Ctr+c in my console application to copy my data, and how my Webapplication can Ctr+v + Entre : to get that Data from my console application


问:
How to limit a Git branch name to 50 characters
I am currently trying to make a script using groovy to implement as a Pre-Hook for Jira using ScriptRunner. The script is supposed to block branch if they are more than 50 characteres long. I am new to Grrovy and stack overflow and i am quite lost.

```<code>def branchName = currentBuild.rawBuild.getEnvironment(listener).get('GIT_BRANCH')
def branchNameLength = branchName.length()
def branchNameLimit = 50

if (branchNameLength > branchNameLimit) {
error("branch name too long; limited at: ${branchNameLimit} characteres. Actual name lenght: ${branchNameLength} caracteres.")
}
</code>```

This is the code I did but it doesn't seems to work, do you have any tips or solution to help resolve this problem?

I tried doing it using a RegEx but I failed too. What I want is to limit the number of characteres whenever you try to create a branch.

Body:
I am currently trying to make a script using groovy to implement as a Pre-Hook for Jira using ScriptRunner. The script is supposed to block branch if they are more than 50 characteres long. I am new to Grrovy and stack overflow and i am quite lost.

def branchName = currentBuild.rawBuild.getEnvironment(listener).get('GIT_BRANCH')
def branchNameLength = branchName.length()
def branchNameLimit = 50

if (branchNameLength > branchNameLimit) {
error("branch name too long; limited at: ${branchNameLimit} characteres. Actual name lenght: ${branchNameLength} caracteres.")
}

This is the code I did but it doesn't seems to work, do you have any tips or solution to help resolve this problem?

I tried doing it using a RegEx but I failed too. What I want is to limit the number of characteres whenever you try to create a branch.


问:
Why does R freeze when I initialize SpacyR?
Every time I successfully install spacyR with spacy_install(), but whenever I run spacy_initialize, my R console shows that it registers the code, but absolutely nothing happens and subsequently I cannot run any other code. How do I get spacyR to run properly?

I have tried to search for reasons why this would happen, to no avail. I have also tried redownloading and installing newer versions of Python and R.


问:
Is there any solution for error problems when uploading csv file like this one I experienced?
So I already write code like this :

```<code>-- SCHEMA: Portofolio2

-- DROP SCHEMA IF EXISTS "Portofolio2" ;

CREATE SCHEMA IF NOT EXISTS "Portofolio2"
    AUTHORIZATION postgres;

-- Table: Portofolio2.vidgames

-- DROP TABLE IF EXISTS "Portofolio2"."vidgames";

CREATE TABLE IF NOT EXISTS "Portofolio2"."vidgames"
(
    index character varying COLLATE pg_catalog."default",
    Rank character varying COLLATE pg_catalog."default",
    Game_Title character varying COLLATE pg_catalog."default",
    Platform character varying COLLATE pg_catalog."default",
    Year character varying COLLATE pg_catalog."default",
    Genre character varying COLLATE pg_catalog."default",
    Publisher character varying COLLATE pg_catalog."default",
    North_America character varying COLLATE pg_catalog."default",
    Europe character varying COLLATE pg_catalog."default",
    Japan character varying COLLATE pg_catalog."default",
    Rest_of_World character varying COLLATE pg_catalog."default",
    Global character varying COLLATE pg_catalog."default",
    Review character varying COLLATE pg_catalog."default"
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE IF EXISTS "Portofolio2"."vidgames"
    OWNER to postgres;

Copy "Portofolio2"."vidgames" ("index","rank","game_title","platform","year","genre","publisher","north_america","europe","japan","rest_of_world","global","review") from 'C:\Users\Admin\Downloads\Portofolio\Video Games Sales\Video Games Sales.csv' WITH DELIMITER ',' CSV HEADER QUOTE '''' ;
</code>```

But the error exist :

NOTICE:  schema "Portofolio2" already exists, skipping
NOTICE:  relation "vidgames" already exists, skipping

ERROR:  extra data after last expected column
CONTEXT:  COPY vidgames, line 1261: ""1259,1260,""WarioWare, Inc.: Mega MicroGame$"",GBA,2003.0,Puzzle,Nintendo,0.4,0.11,0.7,0.02,1.23,76..."
SQL state: 22P04

Anyone can explain why ?

Body:
So I already write code like this :

-- SCHEMA: Portofolio2

-- DROP SCHEMA IF EXISTS "Portofolio2" ;

CREATE SCHEMA IF NOT EXISTS "Portofolio2"
    AUTHORIZATION postgres;

-- Table: Portofolio2.vidgames

-- DROP TABLE IF EXISTS "Portofolio2"."vidgames";

CREATE TABLE IF NOT EXISTS "Portofolio2"."vidgames"
(
    index character varying COLLATE pg_catalog."default",
    Rank character varying COLLATE pg_catalog."default",
    Game_Title character varying COLLATE pg_catalog."default",
    Platform character varying COLLATE pg_catalog."default",
    Year character varying COLLATE pg_catalog."default",
    Genre character varying COLLATE pg_catalog."default",
    Publisher character varying COLLATE pg_catalog."default",
    North_America character varying COLLATE pg_catalog."default",
    Europe character varying COLLATE pg_catalog."default",
    Japan character varying COLLATE pg_catalog."default",
    Rest_of_World character varying COLLATE pg_catalog."default",
    Global character varying COLLATE pg_catalog."default",
    Review character varying COLLATE pg_catalog."default"
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE IF EXISTS "Portofolio2"."vidgames"
    OWNER to postgres;

Copy "Portofolio2"."vidgames" ("index","rank","game_title","platform","year","genre","publisher","north_america","europe","japan","rest_of_world","global","review") from 'C:\Users\Admin\Downloads\Portofolio\Video Games Sales\Video Games Sales.csv' WITH DELIMITER ',' CSV HEADER QUOTE '''' ;

But the error exist :

NOTICE:  schema "Portofolio2" already exists, skipping
NOTICE:  relation "vidgames" already exists, skipping

ERROR:  extra data after last expected column
CONTEXT:  COPY vidgames, line 1261: ""1259,1260,""WarioWare, Inc.: Mega MicroGame$"",GBA,2003.0,Puzzle,Nintendo,0.4,0.11,0.7,0.02,1.23,76..."
SQL state: 22P04

Anyone can explain why ?


问:
Selection of dates on react date calendar when on mobile version
I have created an application that has a react date range calendar that works perfectly fine. Problem is when on mobile responsiveness am unable to select the dates. You are not able to select from start date to end date. Can someone please assist with this. Here is sample of the code:

Date Range Calendar code

Selecting dates on mobile view.


问:
can I add other related inputs to Neural Net Time Series in Matlab?
I am trying to design a Neural Network to predict weekly peak load demand.
My input data are the peak load demand from 2 previous years ( it usually follows the same pattern. as well as average temperature and humidity for the past 2 years as well as the predicted ones for the coming year.
i.e:
let us say I'm predicting weekly peak demand for 2022.
I have weekly peak loads for 2021 and 2020, along with the corresponding weekly average temp and humidity for 2020 and 2021.
I also have forecasted average temp and humidity for 2022.

I want my inputs to this Neural Network to be the historical load data for 2020 and 2021 and the historical temp and humidity data, as well as the new predicted average temp and humidity for 2022 in order to get the output of load prediction for 2022.

is there a way I can add this to the NARX model on MATLAB or is there another model I should be using to better fit this application?

This is the code describing what I've done so far, I have used the 2020 and 2021 data to train the network and then tested it with the 2022 with a feedback time delay of 1:2 to accept the previous output as input
is there a way to make it accept 2 feedbacks as input (for example one with 1:2 delay and the other 1:3? to have the last two outputs as feedback)

[WeekNo, Load2020, temp2020, humidity2020, Holiday2020, Population2020] = readvars('LoadData.xlsx','Sheet','2020A','Range','A2:F53');
[WeekNo, Load2021, temp2021, humidity2021, Holiday2021, Population2021] = readvars('LoadData.xlsx','Sheet','2021A','Range','A2:F53');
[WeekNo3, Load2022, temp2022, humidity2022, Holiday2022, Population2022] = readvars('LoadData.xlsx','Sheet','2022A','Range','A2:F49');

% training data

Week=[WeekNo; WeekNo];
WeeklyPeak=[Load2020;Load2021];
Avg_temp=[temp2020;temp2021];
Avg_humidity=[humidity2020;humidity2021];
Holiday=[Holiday2020;Holiday2021];
Population=[Population2020;Population2021];

xtrain=[Week Avg_temp Avg_humidity Holiday Population];
ytrain=[WeeklyPeak];

%testing data

xtest=[WeekNo3 temp2022 humidity2022 Holiday2022 Population2022];
ytest=[Load2022];

%   xtrain - input time series.
%   ytrain - feedback time series.

X = tonndata(xtrain,false,false);
T = tonndata(ytrain,false,false);
trainFcn = 'trainlm';

inputDelays = 1:1;
feedbackDelays = 1:2;
hiddenLayerSize = 3;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
[x,xi,ai,t] = preparets(net,X,{},T);

[net,tr] = train(net,x,t,xi,ai);

% Test the Network

X_test = tonndata(xtest,false,false);
T_test = tonndata(ytest,false,false);
[xn,xin,ain,tn] = preparets(net,X_test,{},T_test);

yn = net(xn,xin,ain);
e = gsubtract(tn,yn);
performance = perform(net,tn,yn)

ynn=[cell2mat(xin(2,:))'; cell2mat(yn)'];
plot(WeekNo3,ytest,'B')
hold
plot(WeekNo3,ynn,'R')

```

I already Have the Actual load for 2022 but it is only for Comparison purposes to test the accuracy of the predictions I am going to generate (the last plot in my code).

with a quick look to me code does making the input delay for x 1:1 and feedback delay 1:2 produce the network I've described? where x are the current inputs and feedback is the time series depandant?

Body:
I am trying to design a Neural Network to predict weekly peak load demand.
My input data are the peak load demand from 2 previous years ( it usually follows the same pattern. as well as average temperature and humidity for the past 2 years as well as the predicted ones for the coming year.
i.e:
let us say I'm predicting weekly peak demand for 2022.
I have weekly peak loads for 2021 and 2020, along with the corresponding weekly average temp and humidity for 2020 and 2021.
I also have forecasted average temp and humidity for 2022.

I want my inputs to this Neural Network to be the historical load data for 2020 and 2021 and the historical temp and humidity data, as well as the new predicted average temp and humidity for 2022 in order to get the output of load prediction for 2022.

is there a way I can add this to the NARX model on MATLAB or is there another model I should be using to better fit this application?

This is the code describing what I've done so far, I have used the 2020 and 2021 data to train the network and then tested it with the 2022 with a feedback time delay of 1:2 to accept the previous output as input
is there a way to make it accept 2 feedbacks as input (for example one with 1:2 delay and the other 1:3? to have the last two outputs as feedback)

[WeekNo, Load2020, temp2020, humidity2020, Holiday2020, Population2020] = readvars('LoadData.xlsx','Sheet','2020A','Range','A2:F53');
[WeekNo, Load2021, temp2021, humidity2021, Holiday2021, Population2021] = readvars('LoadData.xlsx','Sheet','2021A','Range','A2:F53');
[WeekNo3, Load2022, temp2022, humidity2022, Holiday2022, Population2022] = readvars('LoadData.xlsx','Sheet','2022A','Range','A2:F49');

% training data

Week=[WeekNo; WeekNo];
WeeklyPeak=[Load2020;Load2021];
Avg_temp=[temp2020;temp2021];
Avg_humidity=[humidity2020;humidity2021];
Holiday=[Holiday2020;Holiday2021];
Population=[Population2020;Population2021];

xtrain=[Week Avg_temp Avg_humidity Holiday Population];
ytrain=[WeeklyPeak];

%testing data

xtest=[WeekNo3 temp2022 humidity2022 Holiday2022 Population2022];
ytest=[Load2022];

%   xtrain - input time series.
%   ytrain - feedback time series.

X = tonndata(xtrain,false,false);
T = tonndata(ytrain,false,false);
trainFcn = 'trainlm';

inputDelays = 1:1;
feedbackDelays = 1:2;
hiddenLayerSize = 3;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
[x,xi,ai,t] = preparets(net,X,{},T);

[net,tr] = train(net,x,t,xi,ai);

% Test the Network

X_test = tonndata(xtest,false,false);
T_test = tonndata(ytest,false,false);
[xn,xin,ain,tn] = preparets(net,X_test,{},T_test);

yn = net(xn,xin,ain);
e = gsubtract(tn,yn);
performance = perform(net,tn,yn)

ynn=[cell2mat(xin(2,:))'; cell2mat(yn)'];
plot(WeekNo3,ytest,'B')
hold
plot(WeekNo3,ynn,'R')

I already Have the Actual load for 2022 but it is only for Comparison purposes to test the accuracy of the predictions I am going to generate (the last plot in my code).

with a quick look to me code does making the input delay for x 1:1 and feedback delay 1:2 produce the network I've described? where x are the current inputs and feedback is the time series depandant?


问:
Using @DataJpaTest in Spring Boot 3.0.0 Integration test causes Test discovery error
Whenever I add @DataJpaTest to a test test execution fails with the following error:

import com.owino.paginateddata.entities.Tweet;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@DataJpaTest
@ExtendWith(SpringExtension.class)
public class PersistTweetTest {

    @Autowired
    private TestEntityManager entityManager;

    @Test
    public void shouldPersistTweetTest(){
        var entity = entityManager.persistAndFlush(new Tweet(1L,"#goodvibes #sweetypie", "2022-12-11","11:00PM"));

        Assertions.assertThat(entity).isNotNull();
        Assertions.assertThat(entity.getId()).isEqualTo(1L);
        Assertions.assertThat(entity.getContents()).isEqualTo("#goodvibes #sweetypie");
        Assertions.assertThat(entity.getDateString()).isEqualTo("2022-12-11");
        Assertions.assertThat(entity.getTimeString()).isEqualTo("11:00PM");
    }
}
```
<pre class="lang-java prettyprint-override"><code>Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
    at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'com.owino.paginateddata.persistence_test.PersistTweetTest'] resolution failed
    at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
    at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:103)
    at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
    at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
    at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:46)
    at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
    ... 13 more
</code>```

Tests that are not annoted with @DataJpaTest and @ExtendWith(SpringExtension.class) execute smoothly. I have observed this only in Spring Boot 3.0.0, I am running these tests smoothly on 2.7.x.

While Running $ mvn test I noticed maven skips the test.

Running on Intelij 2022.3 leads to the above error being produced.

Body:
Whenever I add @DataJpaTest to a test test execution fails with the following error:

import com.owino.paginateddata.entities.Tweet;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@DataJpaTest
@ExtendWith(SpringExtension.class)
public class PersistTweetTest {

    @Autowired
    private TestEntityManager entityManager;

    @Test
    public void shouldPersistTweetTest(){
        var entity = entityManager.persistAndFlush(new Tweet(1L,"#goodvibes #sweetypie", "2022-12-11","11:00PM"));

        Assertions.assertThat(entity).isNotNull();
        Assertions.assertThat(entity.getId()).isEqualTo(1L);
        Assertions.assertThat(entity.getContents()).isEqualTo("#goodvibes #sweetypie");
        Assertions.assertThat(entity.getDateString()).isEqualTo("2022-12-11");
        Assertions.assertThat(entity.getTimeString()).isEqualTo("11:00PM");
    }
}

Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
    at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'com.owino.paginateddata.persistence_test.PersistTweetTest'] resolution failed
    at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
    at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:103)
    at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
    at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
    at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:46)
    at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
    at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
    ... 13 more

Tests that are not annoted with @DataJpaTest and @ExtendWith(SpringExtension.class) execute smoothly. I have observed this only in Spring Boot 3.0.0, I am running these tests smoothly on 2.7.x.

While Running $ mvn test I noticed maven skips the test.

Running on Intelij 2022.3 leads to the above error being produced.


问:
Computing confidence intervals using scipy
I want to use scipy to compute confidence intervals for my test statistics. I already came acrosss scipy.stats.bootstrap but this function is too narrowly defined for my purpose. It includes a resampling procedure, a computation of the test statistic and then determines the confidence interval. However, I've already done the first two steps (and I can not use the function for the first two steps: I need to include a very specific (hierarchical) resampling procedure, don't want to go into detail here). So I only need the third step. Is there a way to do this with scipy?

Consider an example where we want to compute confidence intervals for 5x5 = 25 test statistics using 100 resampling trials:

import numpy as np
rng = np.random.RandomState(42)

# create a sequence of 2D-arrays
resampling_array = [rng.rand(5,5) for idx in range(100)]

# Optionally: Stack them in the 3rd dimension
resampling_array = np.stack(resampling_array,axis=2)
```