问:
How to resolve red screen error in React Native
After getting Build successful, I'm getting this error

This is a node error I'm getting

Package.json

```<code>{
  "name": "Fastlane",
  "version": "1.3.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.15.15",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/drawer": "^6.1.8",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "axios": "^0.24.0",
    "moment": "^2.29.1",
    "react": "17.0.2",
    "react-native": "0.66.5",
    "react-native-barcode-builder": "^2.0.0",
    "react-native-camera": "^4.2.1",
    "react-native-collapsible": "^1.6.0",
    "react-native-date-picker": "^4.1.3",
    "react-native-device-info": "^8.7.1",
    "react-native-flash-message": "^0.2.0",
    "react-native-fs": "^2.18.0",
    "react-native-gesture-handler": "^2.0.0",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-marquee": "^0.3.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-permissions": "^3.2.0",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-qrcode-scanner": "^1.5.4",
    "react-native-reanimated": "^2.2.4",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.0",
    "react-native-share": "^7.3.5",
    "react-native-splash-screen": "^3.2.0",
    "react-native-uuid": "^2.0.1",
    "xlsx": "^0.18.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

</code>```

android/build.gradle

```<code>buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
      configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + "0.66.5"
          }
    }
    repositories {

        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
        maven { url "https://maven.google.com" }
    }
}
</code>```

android/app/build.gradle

```<code>android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.fastlane"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        missingDimensionStrategy 'react-native-camera', 'general'

    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

</code>```

what I have done...

Revert back all the changes I have made after that (if you changed versions of sdk, gradle, java, react-native etc)
2.Delete node_modules

Delete build folders (android/build & android/app/build)

Recheck the package.json if the react-native version is as which was worked before

Run npm install or yarn to install packages

Clean (remove gradle cache like mentioned here : https://stackoverflow.com/a/30450020/10657559) and rebuild the app by adding the below changes to your
**android/build.gradle file
**

```<code>def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

buildscript {
     // ...
}

allprojects {
    configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
          }
    }
    // ...
}
</code>```

Ref: Fix and updates on Android build failures happening since Nov 4th 2022 #35210

Body:
After getting Build successful, I'm getting this error

This is a node error I'm getting

Package.json

{
  "name": "Fastlane",
  "version": "1.3.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.15.15",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/drawer": "^6.1.8",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "axios": "^0.24.0",
    "moment": "^2.29.1",
    "react": "17.0.2",
    "react-native": "0.66.5",
    "react-native-barcode-builder": "^2.0.0",
    "react-native-camera": "^4.2.1",
    "react-native-collapsible": "^1.6.0",
    "react-native-date-picker": "^4.1.3",
    "react-native-device-info": "^8.7.1",
    "react-native-flash-message": "^0.2.0",
    "react-native-fs": "^2.18.0",
    "react-native-gesture-handler": "^2.0.0",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-marquee": "^0.3.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-permissions": "^3.2.0",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-qrcode-scanner": "^1.5.4",
    "react-native-reanimated": "^2.2.4",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.0",
    "react-native-share": "^7.3.5",
    "react-native-splash-screen": "^3.2.0",
    "react-native-uuid": "^2.0.1",
    "xlsx": "^0.18.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
      configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + "0.66.5"
          }
    }
    repositories {

        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
        maven { url "https://maven.google.com" }
    }
}

android/app/build.gradle

android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.fastlane"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        missingDimensionStrategy 'react-native-camera', 'general'

    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

what I have done...

Revert back all the changes I have made after that (if you changed versions of sdk, gradle, java, react-native etc)
2.Delete node_modules

Delete build folders (android/build & android/app/build)

Recheck the package.json if the react-native version is as which was worked before

Run npm install or yarn to install packages

Clean (remove gradle cache like mentioned here : https://stackoverflow.com/a/30450020/10657559) and rebuild the app by adding the below changes to your
**android/build.gradle file
**

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

buildscript {
     // ...
}

allprojects {
    configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
          }
    }
    // ...
}

Ref: Fix and updates on Android build failures happening since Nov 4th 2022 #35210


来源: stackexchange

问:
I want to know about server communication principles
Looking at the process of communicating between the server and the client with "fiddler," it was seen that dozens of times of communication with the server was made with a single click in Chrome.

In some cases, the response by the first request may be included in the second request, and I wonder how the information is extracted and included in the next request.

ContentLicense: CC BY-SA 4.0


问:
How to keep window refresh after login with root token in Hishcorp vault UI
After logging in with the root token in the UI, if I refresh the screen with F5,
the login screen appears again. Is there a way to keep it?

After logging in, I want to keep the login even if I refresh the screen.


问:
Apache Ignite data distribution issue
I am trying to load data into an Apache Ignite cluster using a Java thin client, but the data is not getting loaded evenly. I see that only one machine's memory is increased.

I followed this, added a custom affinity mapper. Version is 2.14.0
https://ignite.apache.org/docs/2.14.0/thin-clients/java-thin-client#partition-awareness

Update1: Adding code

```<code>
ClientConfiguration cfg = new ClientConfiguration()
                .setAddresses("host1:10800","host2:10800",......)
                .setTimeout(10*60*1000)
                .setPartitionAwarenessEnabled(true)
                .setPartitionAwarenessMapperFactory(new ClientPartitionAwarenessMapperFactory() {
                    @Override public ClientPartitionAwarenessMapper create(String cacheName, int partitions) {
                        final AffinityFunction aff = new MyAffinityFunction(partitions);

                        return new ClientPartitionAwarenessMapper() {
                            @Override
                            public int partition(Object key) {
                                return aff.partition(key);
                            }
                        };
                    }
                });

ignite = Ignition.startClient(cfg)

kmvpCache = ignite.cache(s"cacheName")

val kmvpBatch = new java.util.HashMap[java.lang.Long, Array[Byte]](params.batchSize)

for(....){
    for(....){
        kmvpBatch.put(<Key>, <value>)
    }
    kmvpCache.putAll(kmvpBatch)
    kmvpBatch.clear()
}
</code>```

Title: Apache Ignite data distribution issue

Body:
I am trying to load data into an Apache Ignite cluster using a Java thin client, but the data is not getting loaded evenly. I see that only one machine's memory is increased.

I followed this, added a custom affinity mapper. Version is 2.14.0
https://ignite.apache.org/docs/2.14.0/thin-clients/java-thin-client#partition-awareness

Update1: Adding code

ClientConfiguration cfg = new ClientConfiguration()
                .setAddresses("host1:10800","host2:10800",......)
                .setTimeout(10*60*1000)
                .setPartitionAwarenessEnabled(true)
                .setPartitionAwarenessMapperFactory(new ClientPartitionAwarenessMapperFactory() {
                    @Override public ClientPartitionAwarenessMapper create(String cacheName, int partitions) {
                        final AffinityFunction aff = new MyAffinityFunction(partitions);

                        return new ClientPartitionAwarenessMapper() {
                            @Override
                            public int partition(Object key) {
                                return aff.partition(key);
                            }
                        };
                    }
                });

ignite = Ignition.startClient(cfg)

kmvpCache = ignite.cache(s"cacheName")

val kmvpBatch = new java.util.HashMap[java.lang.Long, Array[Byte]](params.batchSize)

for(....){
    for(....){
        kmvpBatch.put(<Key>, <value>)
    }
    kmvpCache.putAll(kmvpBatch)
    kmvpBatch.clear()
}


问:
Failed to load Json File in Kaggle Kernel using load_dataset(), but works in Google Colab and Local System
I am trying to load a json file using the load_dataset method in the Huggingface Datasets library in the Kaggle Kernel. This is the code:

```<code>data=load_dataset("json",data_files="/kaggle/input/dataset/gold_summaries_test.json")
</code>```

I get the following error only when I am working in the Kaggle Kernel.

```<code>AttributeError: 'list' object has no attribute 'keys'
</code>```

Below is a preview of the json file I am trying to load.

gold_summaries_test.json

This error does not occur when loading the file in Google Colab, or on a python console in my local system.

Body:
I am trying to load a json file using the load_dataset method in the Huggingface Datasets library in the Kaggle Kernel. This is the code:

data=load_dataset("json",data_files="/kaggle/input/dataset/gold_summaries_test.json")

I get the following error only when I am working in the Kaggle Kernel.

AttributeError: 'list' object has no attribute 'keys'

Below is a preview of the json file I am trying to load.

gold_summaries_test.json

This error does not occur when loading the file in Google Colab, or on a python console in my local system.


问:
get a specific serial number of one of my servers from AD using ADcomputer and Get-CimInstance commands on powershell
I got all servers serial numbers using the below command:

```<code>Get-ADComputer -Filter * | Select-Object Name |
Foreach-Object {
Get-CimInstance Win32_Bios -ComputerName $_.Name -ErrorAction SilentlyContinue |
Select-Object PSComputerName,SerialNumber
}
</code>```

but I failed to get s specific serial number of one server only

I tried to get a specific serial number but I failed , I expected to get serial number for one server I want

Body:
I got all servers serial numbers using the below command:

Get-ADComputer -Filter * | Select-Object Name |
Foreach-Object {
Get-CimInstance Win32_Bios -ComputerName $_.Name -ErrorAction SilentlyContinue |
Select-Object PSComputerName,SerialNumber
}

but I failed to get s specific serial number of one server only

I tried to get a specific serial number but I failed , I expected to get serial number for one server I want


问:
Terraform 403 error using Azure DevOps self-hosted agent
We currently have a Azure DevOps pipeline that deploys and maintains our infrastructure. We provision and maintain using Terraform.

All of the resources are integrated in a virtual network, this includes the storage accounts. The storage accounts have the subnets whitelisted and all of the resources can access the storage without issues.

We have been having trouble deploying new resources or even just running terraform plan due to 403 errors that occur while trying to refresh the state of the containers.

At first we used an az cli task that whitelisted the Azure provided DevOps agent, however as of lately that didn't work anymore as the 403 kept coming.

We deployed a Ubuntu VM and configured with the required packages; pwsh, az cli, terraform etc.. The NIC associated with the VM has been integrated in the subnet as our other VM's, this subnet is whitelisted from the storage.
However, we still get the same 403 errors as before, even now the VM is in the same vnet and the subnet is whitelisted.

I am trying to think of other possible solutions, perhaps any of you know how we can solve this. Thank you.

We tried to integrate a self-hosted Azure DevOps agent into our virtual network to be able to run our infrastructure as code pipelines to provision and maintain resources. However we keep getting 403 unauthorized errors.


问:
Create an object with instance method from a form with input
I want to create an object with class Article and instance method createArticle in javascript.

Nothing appear in my console, even the error message.

Ty for your help !

```<code>class Article {
    constructor (nameArticle, price, image, description, type){
        this.nameArticle = nameArticle;
        this.price = price;
        this.image = image;
        this.description = description;
        this.type = type;
    }
    createArticle (){
        if (nameCreateArticle.value && priceCreateArticle.value && urlCreateArticle.value && descriptionCreateArticle.value && radioCreateArticle.value){
            nameArticle = nameCreateArticle.value;
            price = priceCreateArticle.value;
            image = urlCreateArticle.value;
            description = descriptionCreateArticle.value;
            type = radioCreateArticle.value;
            let newArticle = new Article (nameArticle, price, image, description, type);
            popUp.style.display = 'inline';
            popUpMessage.innerText = 'Article has been created.';
            console.log ('toto')
            console.log (newArticle);
        } else if (nameCreateArticle.value === '' || priceCreateArticle.value === '0'){
            console.log ('Error');
        }
    }
    deleteArticle(){

    }
}
formCreateArticle.addEventListener ('submit', (e) => {
    e.preventDefault();
    newArticle.createArticle();
})```
This is what i tried and my console still empty, no 'toto' message and no 'Error' message is here. I thought i forget preventDefault but i didnt so i dont understand what's going wrong
```

Body:
I want to create an object with class Article and instance method createArticle in javascript.

Nothing appear in my console, even the error message.

Ty for your help !

class Article {
    constructor (nameArticle, price, image, description, type){
        this.nameArticle = nameArticle;
        this.price = price;
        this.image = image;
        this.description = description;
        this.type = type;
    }
    createArticle (){
        if (nameCreateArticle.value && priceCreateArticle.value && urlCreateArticle.value && descriptionCreateArticle.value && radioCreateArticle.value){
            nameArticle = nameCreateArticle.value;
            price = priceCreateArticle.value;
            image = urlCreateArticle.value;
            description = descriptionCreateArticle.value;
            type = radioCreateArticle.value;
            let newArticle = new Article (nameArticle, price, image, description, type);
            popUp.style.display = 'inline';
            popUpMessage.innerText = 'Article has been created.';
            console.log ('toto')
            console.log (newArticle);
        } else if (nameCreateArticle.value === '' || priceCreateArticle.value === '0'){
            console.log ('Error');
        }
    }
    deleteArticle(){

    }
}
formCreateArticle.addEventListener ('submit', (e) => {
    e.preventDefault();
    newArticle.createArticle();
})```
This is what i tried and my console still empty, no 'toto' message and no 'Error' message is here. I thought i forget preventDefault but i didnt so i dont understand what's going wrong


问:
Quarkus @CacheResult is not working properly
I am trying to use quarkus-cache by following the appropriate quarkus doc. I have the below code setup

```<code>@ApplicationScoped
class MyClass {
 public result doSomething() {
     String remoteData = getRemoteData(url);
}

@CacheResult(cacheName = "myCacheName")
public String getRemoteData(String url) {
   return remoteCall(url);
}
}
</code>```

Usage

```<code>// Grpc impl class
// call to Myclass.doSomething()
</code>```

Execution is not proceeding further when getRemoteData() is called the first time. Also, not getting any error.
Am I missing something?

Body:
I am trying to use quarkus-cache by following the appropriate quarkus doc. I have the below code setup

@ApplicationScoped
class MyClass {
 public result doSomething() {
     String remoteData = getRemoteData(url);
}

@CacheResult(cacheName = "myCacheName")
public String getRemoteData(String url) {
   return remoteCall(url);
}
}

Usage

// Grpc impl class
// call to Myclass.doSomething()

Execution is not proceeding further when getRemoteData() is called the first time. Also, not getting any error.
Am I missing something?


问:
C programming find the second positive number in the second half of an array
My code is this:

```<code>#include <stdio.h>

int array_second_positive(int A[], int size) {
    int j, i;

    for (i = 0; i < size / 2; ++i) {
        A[i] = A[0];
        for (j = 0; j < size; ++j) {
            A[j] = A[j + 1];
        }
    }

    for (i = 0; i < size; ++i) {
        int z = 0;
        int counter = 0;
        while (z < size) {
            if (A[z] > 0) {
                counter++;
            }
            if (counter == 2) {
                return A[z];
            }
            z++;
        }
    }
}

int main(void) {
    int size = 6;
    int array[] = { 3, -14, 15, 2, 6, 5 };

    int result = array_second_positive(array, size);
}
</code>```

I am trying to find the second positive number in the second half of an array. If we assume array size is even and we have definitely at least two positive number in the second half but I get no results.

Body:
My code is this:

#include <stdio.h>

int array_second_positive(int A[], int size) {
    int j, i;

    for (i = 0; i < size / 2; ++i) {
        A[i] = A[0];
        for (j = 0; j < size; ++j) {
            A[j] = A[j + 1];
        }
    }

    for (i = 0; i < size; ++i) {
        int z = 0;
        int counter = 0;
        while (z < size) {
            if (A[z] > 0) {
                counter++;
            }
            if (counter == 2) {
                return A[z];
            }
            z++;
        }
    }
}

int main(void) {
    int size = 6;
    int array[] = { 3, -14, 15, 2, 6, 5 };

    int result = array_second_positive(array, size);
}

I am trying to find the second positive number in the second half of an array. If we assume array size is even and we have definitely at least two positive number in the second half but I get no results.


问:
Android Background Location Permissions
While asking for location permission in the background, it keeps asking me to open the settings menu and allow it, even though I say allow only this time. (Android 11)
I want to get permission on my login activity's init function.
I just don't want it to ask for permission again when I select only this time and start the app again.</p>
```<code>        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){

            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
                    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                    } else {
                        askPermissionForBackgroundUsage();
                    }
                }
            } else {
                askForLocationPermission();
            }

        }
         private void askForLocationPermission() {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
        new AlertDialog.Builder(this)
                .setTitle("Permission Needed!")
                .setMessage("Location Permission Needed!")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        ActivityCompat.requestPermissions(LoginActivity.this,
                                new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 101);
                    }
                })
                .setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Permission is denied by the user
                    }
                })
                .create().show();
    } else {
        ActivityCompat.requestPermissions(this,
                new String[]{
        Manifest.permission.ACCESS_COARSE_LOCATION,
        Manifest.permission.ACCESS_FINE_LOCATION,

}, 101);
    }
}

private void askPermissionForBackgroundUsage() {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION)) {
        new AlertDialog.Builder(this)
                .setTitle("Permission Needed!")
                .setMessage("Background Location Permission Needed!, tap \"Allow all time in the next screen\"")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        ActivityCompat.requestPermissions(LoginActivity.this,
                                new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION}, 101);
                    }
                })
                .setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // User declined for Background Location Permission.
                    }
                })
                .create().show();
    } else {
        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION}, 101);
    }
}
</code>```

Title: Android Background Location Permissions

Body:
While asking for location permission in the background, it keeps asking me to open the settings menu and allow it, even though I say allow only this time. (Android 11)
I want to get permission on my login activity's init function.
I just don't want it to ask for permission again when I select only this time and start the app again.

        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){

            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
                    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                    } else {
                        askPermissionForBackgroundUsage();
                    }
                }
            } else {
                askForLocationPermission();
            }

        }
         private void askForLocationPermission() {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
        new AlertDialog.Builder(this)
                .setTitle("Permission Needed!")
                .setMessage("Location Permission Needed!")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        ActivityCompat.requestPermissions(LoginActivity.this,
                                new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 101);
                    }
                })
                .setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Permission is denied by the user
                    }
                })
                .create().show();
    } else {
        ActivityCompat.requestPermissions(this,
                new String[]{
        Manifest.permission.ACCESS_COARSE_LOCATION,
        Manifest.permission.ACCESS_FINE_LOCATION,

}, 101);
    }
}

private void askPermissionForBackgroundUsage() {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION)) {
        new AlertDialog.Builder(this)
                .setTitle("Permission Needed!")
                .setMessage("Background Location Permission Needed!, tap \"Allow all time in the next screen\"")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        ActivityCompat.requestPermissions(LoginActivity.this,
                                new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION}, 101);
                    }
                })
                .setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // User declined for Background Location Permission.
                    }
                })
                .create().show();
    } else {
        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION}, 101);
    }
}


问:
How to deprecate methods with Thrift?
What is the proper way to deprecate RPC calls when we are using Thrift?

In grpc-java, once we set the
option deprecated = true; The generated code would automatically include the deprecated label in the code generated. (
https://github.com/grpc/grpc-java/commit/0d4051ca6ee0c0240d79f88082831c22c26c4844#diff-cbc2d12e56678ec0074444b2f71fd184ee85877c94208f68f8e9c7728bd2426e )

I want to deprecate entire method calls not just the fields within. What is the standard way to deprecated rpc methods when we are using thrift?

For me, I have tried to deprecate it by added this field

```<code>999: optional bool deprecated = true;
</code>```

I wanted to know the best way to deprecate methods when using Thrift.

Title: How to deprecate methods with Thrift?

Body:
What is the proper way to deprecate RPC calls when we are using Thrift?

In grpc-java, once we set the
option deprecated = true; The generated code would automatically include the deprecated label in the code generated. (
https://github.com/grpc/grpc-java/commit/0d4051ca6ee0c0240d79f88082831c22c26c4844#diff-cbc2d12e56678ec0074444b2f71fd184ee85877c94208f68f8e9c7728bd2426e )

I want to deprecate entire method calls not just the fields within. What is the standard way to deprecated rpc methods when we are using thrift?

For me, I have tried to deprecate it by added this field

999: optional bool deprecated = true;

I wanted to know the best way to deprecate methods when using Thrift.


问:
How to get all parametrs from get request in Param in their sequence
I have such get request: localhost:8080/check?id=10&id=1&num=2&id=13

I get params like this:

```<code>@GetMapping("/check")
@ResponseBody
public void getCheck(@RequestParam LinkedMultiValueMap<String,Long> ex){
    System.out.println(ex);
}
</code>```

Console: {id=[10, 1, 13], num=[2]}

But I need to get all data in its sequence like this:
{id=[10],id=[1],num=[2],id=[13]}

How can I do this?

Body:
I have such get request: localhost:8080/check?id=10&id=1&num=2&id=13

I get params like this:

@GetMapping("/check")
@ResponseBody
public void getCheck(@RequestParam LinkedMultiValueMap<String,Long> ex){
    System.out.println(ex);
}

Console: {id=[10, 1, 13], num=[2]}

But I need to get all data in its sequence like this:
{id=[10],id=[1],num=[2],id=[13]}

How can I do this?


问:
Host name check in Custom Trust Manager
We have a java client that allows both secure and non-secure connections to LDAP hosts.
It comes as part of a software suite which
has its own server component.
We are good with non-secure connections but need to switch to secure only.

The trusted public certificates are maintained (root+intermediate+host are copy pasted into one PEM file) in a
central location with the server component external to the clients.
The custom trust manager downloads the externally held trusted certificates on demand
and builds the trusted certificate chain. This way, I guess, it avoids pre-saving the trusted certicate chain in each client.

Our LDAP hosts are load balanced and that setup has not gone well with the trust manager. When we investigated, we found two questionable lines
in the code.

An environment variable to by-pass the host name verification.

```<code>if ("T".equals(System.getenv("IGNORE_HOSTNAME_CHECK"))) return true;
</code>```

It seems like doing something similar to below which I have seen elsewhere.

```<code>        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        };
        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
</code>```

Host name check relies on CN value of subject alone.

```<code>         if (this.tgtHostname.equalsIgnoreCase(leafCn)) return true;
</code>```

I have skimmed through some RFCs related to TLS and have come across SNI, SAN:DNSName and MITM warnings
but my rudimentary knowledge is not enough to make a case one way or the other.

Any advice on improvements (or against the use of it altogether) around commented out lines labelled H1 and H2 will be greatly valued.
I intend to pass them on to the right entity later.

The cut-down version of checkServerTrusted() of the custom trust manager is pasted below.

```<code>   public void checkServerTrusted(X509Certificate[] certsRcvdFromTgt, String authType) throws CertificateException
   {
      // Some stuff

      // Verify that the last certificate in the chain corresponds to the tgt server we want to access.
      checkLastCertificate(certsRcvdFromTgt[certsRcvdFromTgt.length - 1]);

      // Some more stuff
   }

   private boolean checkLastCertificate(X509Certificate leafCert) throws CertificateException
   {
      // need some advice here ... (H1)
      if ("T".equals(System.getenv("IGNORE_HOSTNAME_CHECK"))) return true;

      try
      {
         String leafCn = null;
         X500Principal subject = leafCert.getSubjectX500Principal();
         String dn = subject.getName();
         LdapName ldapDN = new LdapName(dn);
         for (Rdn rdn : ldapDN.getRdns())
         {
            if (rdn.getType().equalsIgnoreCase("cn"))
            {
               leafCn = rdn.getValue().toString();
               break;
            }
         }

         // need some advice here ... (H2)
         if (this.tgtHostname.equalsIgnoreCase(leafCn)) return true;

      }
      catch (InvalidNameException e){/*error handling*/}

      throw new CertificateException("Failed to verify that the last certificate in the chain is for target " + this.tgtHostname);
   }
</code>```

Title: Host name check in Custom Trust Manager

Body:
We have a java client that allows both secure and non-secure connections to LDAP hosts.
It comes as part of a software suite which
has its own server component.
We are good with non-secure connections but need to switch to secure only.

The trusted public certificates are maintained (root+intermediate+host are copy pasted into one PEM file) in a
central location with the server component external to the clients.
The custom trust manager downloads the externally held trusted certificates on demand
and builds the trusted certificate chain. This way, I guess, it avoids pre-saving the trusted certicate chain in each client.

Our LDAP hosts are load balanced and that setup has not gone well with the trust manager. When we investigated, we found two questionable lines
in the code.

An environment variable to by-pass the host name verification.

if ("T".equals(System.getenv("IGNORE_HOSTNAME_CHECK"))) return true;

It seems like doing something similar to below which I have seen elsewhere.

        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        };
        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);

Host name check relies on CN value of subject alone.

         if (this.tgtHostname.equalsIgnoreCase(leafCn)) return true;

I have skimmed through some RFCs related to TLS and have come across SNI, SAN:DNSName and MITM warnings
but my rudimentary knowledge is not enough to make a case one way or the other.

Any advice on improvements (or against the use of it altogether) around commented out lines labelled H1 and H2 will be greatly valued.
I intend to pass them on to the right entity later.

The cut-down version of checkServerTrusted() of the custom trust manager is pasted below.

   public void checkServerTrusted(X509Certificate[] certsRcvdFromTgt, String authType) throws CertificateException
   {
      // Some stuff

      // Verify that the last certificate in the chain corresponds to the tgt server we want to access.
      checkLastCertificate(certsRcvdFromTgt[certsRcvdFromTgt.length - 1]);

      // Some more stuff
   }

   private boolean checkLastCertificate(X509Certificate leafCert) throws CertificateException
   {
      // need some advice here ... (H1)
      if ("T".equals(System.getenv("IGNORE_HOSTNAME_CHECK"))) return true;

      try
      {
         String leafCn = null;
         X500Principal subject = leafCert.getSubjectX500Principal();
         String dn = subject.getName();
         LdapName ldapDN = new LdapName(dn);
         for (Rdn rdn : ldapDN.getRdns())
         {
            if (rdn.getType().equalsIgnoreCase("cn"))
            {
               leafCn = rdn.getValue().toString();
               break;
            }
         }

         // need some advice here ... (H2)
         if (this.tgtHostname.equalsIgnoreCase(leafCn)) return true;

      }
      catch (InvalidNameException e){/*error handling*/}

      throw new CertificateException("Failed to verify that the last certificate in the chain is for target " + this.tgtHostname);
   }


问:
Python function returning "function" word pre-fix and "at 0x110257760" post-fix
I'm using python selenium to return a session name with driver.execute_script

```<code>    def session_name(func_name):
        return driver.execute_script('browserstack_executor: {"action": "setSessionName", "arguments": { "name": " %s " } }' % func_name)

    session_name(my_function_name)
</code>```

it gives me function my_function_name at 0x110257760 as output. I was just expecting my_function_name.

I can't understand why? I searched for answers but can't seem to find them. What is a concept I'm missing here?

Body:
I'm using python selenium to return a session name with driver.execute_script

    def session_name(func_name):
        return driver.execute_script('browserstack_executor: {"action": "setSessionName", "arguments": { "name": " %s " } }' % func_name)

    session_name(my_function_name)

it gives me function my_function_name at 0x110257760 as output. I was just expecting my_function_name.

I can't understand why? I searched for answers but can't seem to find them. What is a concept I'm missing here?


问:
Microsoft SSIS - XML integration reject format
My first post :) Here's my issue :
I'm integrating an XML file using SSIS. I've generated a XSD and import is fine. However, if the XML format is not correct, i'm getting an error and the package execution stops. I'd like to manage this by logging the issue (message like 'Xml format incorrect') and make the package continue.
[incorrect format in xml]
(https://i.stack.imgur.com/2QYWD.png)
Any help on this ?
Thanks in advance for your help

Tried using the redirect n error but the error happens before the load (xml readin incorrect).


问:
How to enable JFrog Xray for a react native project?
I have a react native project which artifacts are stored in JFrog  Now I want to enable JFrog Xray in it to scan all of my dependencies used in artifacts so my question is do I need to use a generic build type package or different for iOS and android like gradle package repo for android and CocoaPods package repo for iOS?

I want some refrerence or gudance how to enable JFrog Xray ?


问:
Flutter: AdMob Banner-Ad is loaded at first, after one day the ad is gone
My problem is, that when i build my apk-file in flutter to test it on a real device my ads are here and are loaded at first, but after one day (overnight) my ads aren't getting loaded anymore.
The first image is from my android emulator, that is running a test-ad. This ad is working fine right now. The second picture is a real phone, with the same appversion installed that isn't working right now.
I hope someone can help me with this issue, my Google AdMob account was set up correctly.

Code:

startscreen.dart

```<code>  @override
  static const routeName = "/startmenu";
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  BannerAd? _banner;

  bool? isSwitchedFT = false;
  bool? newEssensplanFT = false;
  bool showWerbungFT = true;

  @override
  void initState() {
    // ignore: todo
    // TODO: implement initState
    super.initState();
    getSwitchValues();

    _createBannerAd();
  }

  void _createBannerAd() {
    _banner = BannerAd(
      size: AdSize.fullBanner,
      adUnitId: AdModService.bannerAdUnitId!,
      listener: AdModService.bannerListener,
      request: AdRequest(),

    )..load();
  }

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 2.0,
        centerTitle: true,
        backgroundColor: Color.fromARGB(255, 1, 88, 17),
        title: Text('Home',
            style: isSwitchedFT == true
                ? TextStyle(
                    foreground: Paint()..shader = linearGradient,
                  )
                : TextStyle(color: Colors.white)),

      ),
      drawer: AppDrawer(),
      bottomNavigationBar: showWerbungFT == true
          ? Container(
              child: _banner == null
                  ? Container()
                  : Container(
                      margin: const EdgeInsets.only(bottom: 12),
                      height: 52,
                      child: AdWidget(ad: _banner!),
                    ),
            )
          : null,
body: ...
</code>```

admod_servide.dart

```<code>
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

class AdModService {
  static String? get bannerAdUnitId {
    if (Platform.isAndroid) {
      return 'ca-app-pub-3763091317735423/2898880134';
    }
    if (Platform.isIOS) {
      return 'ca-app-pub-3763091317735423/2431173942';
    }
    return null;
  }

  static final BannerAdListener bannerListener = BannerAdListener(
      onAdLoaded: (ad) => debugPrint("Werbung geladen!"),
      onAdFailedToLoad: ((ad, error) {
        ad.dispose();
        debugPrint("Werbung konnte nicht geladen werden.");
      }),
      onAdOpened: ((ad) => debugPrint("Werbung wurde geöffnet")),
      onAdClosed: ((ad) => debugPrint("Werbung wurde geschlossen")));

}
</code>```

Pictures:

At first:

After one night:

Body:
My problem is, that when i build my apk-file in flutter to test it on a real device my ads are here and are loaded at first, but after one day (overnight) my ads aren't getting loaded anymore.
The first image is from my android emulator, that is running a test-ad. This ad is working fine right now. The second picture is a real phone, with the same appversion installed that isn't working right now.
I hope someone can help me with this issue, my Google AdMob account was set up correctly.

Code:

startscreen.dart

  @override
  static const routeName = "/startmenu";
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  BannerAd? _banner;

  bool? isSwitchedFT = false;
  bool? newEssensplanFT = false;
  bool showWerbungFT = true;

  @override
  void initState() {
    // ignore: todo
    // TODO: implement initState
    super.initState();
    getSwitchValues();

    _createBannerAd();
  }

  void _createBannerAd() {
    _banner = BannerAd(
      size: AdSize.fullBanner,
      adUnitId: AdModService.bannerAdUnitId!,
      listener: AdModService.bannerListener,
      request: AdRequest(),

    )..load();
  }

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 2.0,
        centerTitle: true,
        backgroundColor: Color.fromARGB(255, 1, 88, 17),
        title: Text('Home',
            style: isSwitchedFT == true
                ? TextStyle(
                    foreground: Paint()..shader = linearGradient,
                  )
                : TextStyle(color: Colors.white)),

      ),
      drawer: AppDrawer(),
      bottomNavigationBar: showWerbungFT == true
          ? Container(
              child: _banner == null
                  ? Container()
                  : Container(
                      margin: const EdgeInsets.only(bottom: 12),
                      height: 52,
                      child: AdWidget(ad: _banner!),
                    ),
            )
          : null,
body: ...

admod_servide.dart

import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

class AdModService {
  static String? get bannerAdUnitId {
    if (Platform.isAndroid) {
      return 'ca-app-pub-3763091317735423/2898880134';
    }
    if (Platform.isIOS) {
      return 'ca-app-pub-3763091317735423/2431173942';
    }
    return null;
  }

  static final BannerAdListener bannerListener = BannerAdListener(
      onAdLoaded: (ad) => debugPrint("Werbung geladen!"),
      onAdFailedToLoad: ((ad, error) {
        ad.dispose();
        debugPrint("Werbung konnte nicht geladen werden.");
      }),
      onAdOpened: ((ad) => debugPrint("Werbung wurde geöffnet")),
      onAdClosed: ((ad) => debugPrint("Werbung wurde geschlossen")));

}

Pictures:

At first:

After one night:


问:
Not able to grant access to root user after installing MYSQL with brew in MAC OS
I installed MySQL with brew using the command brew install mysql and it installed MySQL correctly, but it gave me instructions that say:

We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation
```
<p>So I ran the command <code>mysql_secure_installation</code>, and it asked me for a password for the user root, and when I entered the password, it gave me this error:</p>
<pre class="lang-none prettyprint-override"><code>The user provided does not have enough permissions to continue.
mysql_secure_installation is exiting.
</code>```

I tried running mysql -u root -p and entering in the sql terminal, but I am not able to run any query because I don't have access to do anything. Also, not able to grant any access to the root user.

I also tried to uninstall MySQL from my laptop and install it again, but again the same problem occurs.

Does anyone have a solution for this?

Body:
I installed MySQL with brew using the command brew install mysql and it installed MySQL correctly, but it gave me instructions that say:

We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

So I ran the command mysql_secure_installation, and it asked me for a password for the user root, and when I entered the password, it gave me this error:

The user provided does not have enough permissions to continue.
mysql_secure_installation is exiting.

I tried running mysql -u root -p and entering in the sql terminal, but I am not able to run any query because I don't have access to do anything. Also, not able to grant any access to the root user.

I also tried to uninstall MySQL from my laptop and install it again, but again the same problem occurs.

Does anyone have a solution for this?


问:
How do i use Implicit relations for update in Prisma upsert
The following code should create a new id if id is not found, if id is found it should update.
for that i have used upsert function function.

in the model (prisma) i am using https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/working-with-many-to-many-relations my model has an Implicit relations.
how do i use update in Implicit relations

```<code>const data = await PRISMA.ref_types.upsert({
                    where: { id: id },
                    update: {
                        business_name: business_name,
                        business_logo: business_logo,
                        business_type: business_type,
                        timezone: timezone,
                        location_contact_details: { update: { contact: contact, email: email, } },
                        location_addresses: { update: { address: address, location_id: req.body.location_id, } },
                        languages: { create: { languages: languages } },
                        ref: headerData?.ref,
                    },
                    create: {
                        business_name: business_name,
                        business_logo: business_logo,
                        business_type: business_type,
                        timezone: timezone,
                        location_contact_details: { create: { contact: contact, email: email, } },
                        location_addresses: { create: { address: address, location_id: req.body.location_id, } },
                        languages: { create: { languages: languages } },
                        ref: headerData?.ref,
                    },
                })

</code>```

Body:
The following code should create a new id if id is not found, if id is found it should update.
for that i have used upsert function function.

in the model (prisma) i am using https://www.prisma.io/docs/guides/database/troubleshooting-orm/help-articles/working-with-many-to-many-relations my model has an Implicit relations.
how do i use update in Implicit relations

const data = await PRISMA.ref_types.upsert({
                    where: { id: id },
                    update: {
                        business_name: business_name,
                        business_logo: business_logo,
                        business_type: business_type,
                        timezone: timezone,
                        location_contact_details: { update: { contact: contact, email: email, } },
                        location_addresses: { update: { address: address, location_id: req.body.location_id, } },
                        languages: { create: { languages: languages } },
                        ref: headerData?.ref,
                    },
                    create: {
                        business_name: business_name,
                        business_logo: business_logo,
                        business_type: business_type,
                        timezone: timezone,
                        location_contact_details: { create: { contact: contact, email: email, } },
                        location_addresses: { create: { address: address, location_id: req.body.location_id, } },
                        languages: { create: { languages: languages } },
                        ref: headerData?.ref,
                    },
                })


问:
DATA-DOG/go-sqlmock ExpectExec not working when expecting ID insertion
I am working with DATA-DOG/go-sqlmock to test my repository insert method.
I noticed that everything works just fine when expecting any fields but ID.
Once I want to test my entity insertion with ID i receive call to Query ... was not expected

Example of working code:

```<code>type Some struct {
    SomeField string
}

some := Some{
              SomeField: "123",
            }

sqlMock.ExpectExec(regexp.QuoteMeta(`INSERT INTO "some"`)).
    WithArgs(some.SomeField).
    WillReturnResult(sqlmock.NewResult(1, 1))

err := repository.Insert(&some)
</code>```

Not working code:

```<code>type Some struct {
        ID string
        SomeField string
    }

some := Some{
              ID: "12345"
              SomeField: "123",
            }

sqlMock.ExpectExec(regexp.QuoteMeta(`INSERT INTO "some"`)).
    WithArgs(some.ID, some.SomeField).
    WillReturnResult(sqlmock.NewResult(1, 1))

err := repository.Insert(&some)
</code>```

repository.Insert wraps gorm.Create(some)

What I am missing here?

Body:
I am working with DATA-DOG/go-sqlmock to test my repository insert method.
I noticed that everything works just fine when expecting any fields but ID.
Once I want to test my entity insertion with ID i receive call to Query ... was not expected

Example of working code:

type Some struct {
    SomeField string
}

some := Some{
              SomeField: "123",
            }

sqlMock.ExpectExec(regexp.QuoteMeta(`INSERT INTO "some"`)).
    WithArgs(some.SomeField).
    WillReturnResult(sqlmock.NewResult(1, 1))

err := repository.Insert(&some)

Not working code:

type Some struct {
        ID string
        SomeField string
    }

some := Some{
              ID: "12345"
              SomeField: "123",
            }

sqlMock.ExpectExec(regexp.QuoteMeta(`INSERT INTO "some"`)).
    WithArgs(some.ID, some.SomeField).
    WillReturnResult(sqlmock.NewResult(1, 1))

err := repository.Insert(&some)

repository.Insert wraps gorm.Create(some)

What I am missing here?


问:
ASP.NET MVC: after adding this specific static content mime map not loading any other static file in localhost
I've added mime map for mp4 video to play in published in app service because it was causing an error "file not found".

Then I added mime map for mp4 now video is playing, but when I run in local, then none of the static content is getting loaded.

My web.config changes for mp4:

```<code><staticContent>
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
</code>```

When I comment this line in local, then it's working, but then I won't be able to play mp4 videos in app service publish.

Body:
I've added mime map for mp4 video to play in published in app service because it was causing an error "file not found".

Then I added mime map for mp4 now video is playing, but when I run in local, then none of the static content is getting loaded.

My web.config changes for mp4:

<staticContent>
    <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>

When I comment this line in local, then it's working, but then I won't be able to play mp4 videos in app service publish.


问:
how to pass ClaimsIdentity when page redirect to another ASP.Net mvc 4.7
it seems like User.Identity is not persistent and only valid in one HttpContext, so when the application site redirect to another page (example from "/" to "/events") the User.Identity is lost and i need to recreate it or access from session/cookie.

However im kind of new to ASP.NET MVC, so i have no idea how to pass ClaimsIdentity across sessions, i used OpenId connection with 3rd party provider, and i created/set the ClaimsPrincipal mysel.

Any suggestion how to do this?


问:
Cascading dropdowns in DataTables
I have defined my datatables editor as follows :

```<code>editor = new $.fn.dataTable.Editor({
    ajax: "./DataServlet",
    table: "#example",
    legacyAjax: true,
    idSrc: "rowID",
    fields: [{
        label: "Data Id",
        name: "dataId",
        type: "readonly"
    },{
        label: "Name",
        name: "name",
        type: "readonly"
    },{
        label: "Field L1",
        name: "fieldL1",
        type: "selectize",
        options: getFieldL1()
    },{
        label: "Field L2",
        name: "fieldL2",
        type: "selectize",
        options: getFieldL2()
    },{
        label: "Field L3",
        name: "fieldL3",
        type: "selectize",
        options: getFieldL3()
    },{
        label: "User Name",
        name: "userName",
        type: "readonly"
    }],
});
</code>```

The fieldL3 value is dependent on fieldL2 which is dependent on fieldL1.
The dependency is as shown in the table below :

So, initially the fieldL1 dropdown values would be [A,B,C] and if value I select is 'A', then fieldL2 dropdown values should only be [Q,W,R] and if I select 'Q' for fieldL2, the fieldL3 dropdown should only have [T,U].

So, far I have tried the following :

```<code>$("#DTE_Field_fieldL1").on('change', function(data) {
    let c1_value = data.currentTarget.value;
    let c2_opts = $(".DTE_Field_Name_fieldL2 .selectize-dropdown-content")[0].children;
    let valid_c2_opts = Object.keys(json[c1_value]);
    for(let i = 0; i < c2_opts.length; i++) {
        if(valid_c2_opts.includes(c2_opts[i].dataset.value))
        {
            c2_opts[i].className = "option";
        }
        else {
            c2_opts[i].className = "option d-none";
        }
    }
    editor.enable('fieldL2');
});

$("#DTE_Field_fieldL2").on('change', function(data) {
    let c1_value = $("#DTE_Field_fieldL1")[0].value;
    let c2_value = data.currentTarget.value;
    let c3_opts = $(".DTE_Field_Name_fieldL3 .selectize-dropdown-content")[0].children;
    let valid_c3_opts = Object.values(json[c1_value][c2_value]);
    for(let i = 0; i < c3_opts.length; i++) {
        if(valid_c3_opts.includes(c3_opts[i].dataset.value ))
        {
            c3_opts[i].className = "option";
        }
        else {
            c3_opts[i].className = "option d-none";
        }
    }
    editor.enable('fieldL3');
});
</code>```

So, the json has the data separated in JSON format and I am trying to hide/show the values based on what is selected.
The issue I am facing with the above approach is whenever I try to change a value, the onChange function doesn't get called.

How do I achieve it in the datatables editor?

Title: Cascading dropdowns in DataTables

Body:
I have defined my datatables editor as follows :

editor = new $.fn.dataTable.Editor({
    ajax: "./DataServlet",
    table: "#example",
    legacyAjax: true,
    idSrc: "rowID",
    fields: [{
        label: "Data Id",
        name: "dataId",
        type: "readonly"
    },{
        label: "Name",
        name: "name",
        type: "readonly"
    },{
        label: "Field L1",
        name: "fieldL1",
        type: "selectize",
        options: getFieldL1()
    },{
        label: "Field L2",
        name: "fieldL2",
        type: "selectize",
        options: getFieldL2()
    },{
        label: "Field L3",
        name: "fieldL3",
        type: "selectize",
        options: getFieldL3()
    },{
        label: "User Name",
        name: "userName",
        type: "readonly"
    }],
});

The fieldL3 value is dependent on fieldL2 which is dependent on fieldL1.
The dependency is as shown in the table below :

So, initially the fieldL1 dropdown values would be [A,B,C] and if value I select is 'A', then fieldL2 dropdown values should only be [Q,W,R] and if I select 'Q' for fieldL2, the fieldL3 dropdown should only have [T,U].

So, far I have tried the following :

$("#DTE_Field_fieldL1").on('change', function(data) {
    let c1_value = data.currentTarget.value;
    let c2_opts = $(".DTE_Field_Name_fieldL2 .selectize-dropdown-content")[0].children;
    let valid_c2_opts = Object.keys(json[c1_value]);
    for(let i = 0; i < c2_opts.length; i++) {
        if(valid_c2_opts.includes(c2_opts[i].dataset.value))
        {
            c2_opts[i].className = "option";
        }
        else {
            c2_opts[i].className = "option d-none";
        }
    }
    editor.enable('fieldL2');
});

$("#DTE_Field_fieldL2").on('change', function(data) {
    let c1_value = $("#DTE_Field_fieldL1")[0].value;
    let c2_value = data.currentTarget.value;
    let c3_opts = $(".DTE_Field_Name_fieldL3 .selectize-dropdown-content")[0].children;
    let valid_c3_opts = Object.values(json[c1_value][c2_value]);
    for(let i = 0; i < c3_opts.length; i++) {
        if(valid_c3_opts.includes(c3_opts[i].dataset.value ))
        {
            c3_opts[i].className = "option";
        }
        else {
            c3_opts[i].className = "option d-none";
        }
    }
    editor.enable('fieldL3');
});

So, the json has the data separated in JSON format and I am trying to hide/show the values based on what is selected.
The issue I am facing with the above approach is whenever I try to change a value, the onChange function doesn't get called.

How do I achieve it in the datatables editor?


问:
Validation of conditional checkbox in Woocommerce
How can I validate a custom checkbox on the Woocommerce checkout page ONLY if the selected payment method is BACS?

I tried this code:

```<code>add_action( 'woocommerce_checkout_process', 'add_checkout_checkbox_warning' );
function add_checkout_checkbox_warning() {
    $chosen_payment_method = WC()->session->get( 'chosen_payment_method' );
    if ( ! (int) isset( $_POST['my_checkbox'] && $chosen_payment_method == 'bacs' ) ) {
        wc_add_notice( __( 'Please agree to the checkbox.' ), 'error' );
    }
}
</code>```

but it not working, no error message is displayed even when the checkbox is not ticked.

Body:
How can I validate a custom checkbox on the Woocommerce checkout page ONLY if the selected payment method is BACS?

I tried this code:

add_action( 'woocommerce_checkout_process', 'add_checkout_checkbox_warning' );
function add_checkout_checkbox_warning() {
    $chosen_payment_method = WC()->session->get( 'chosen_payment_method' );
    if ( ! (int) isset( $_POST['my_checkbox'] && $chosen_payment_method == 'bacs' ) ) {
        wc_add_notice( __( 'Please agree to the checkbox.' ), 'error' );
    }
}

but it not working, no error message is displayed even when the checkbox is not ticked.


问:
Flutter: conflicting scrolls - PageView inside NestedScrollView
I have PageView inside NestedScrollView, but also I have a problem with this in some cases:

```<code>_AssertionError ('package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 108 pos 12: '_positions.length == 1': ScrollController attached to multiple scroll views.)
</code>```

Also inside PageView I put another PageView for photo slider. How can I resolve it?

code:

```<code>Scaffold(
  backgroundColor: _layout.theme.background,
  body: SafeArea(
    child: NestedScrollView(
      controller: _scrollController,
      key: _homeNestedKey,
      ...
      body: PageView(
        onPageChanged: _onPageChanged,
        controller: _pageController,
        children: [
          RefresherWrapper(
            onRefresh: () => _onRefresh(_feedRefreshController),
            onLoading: () => _onLoading(_feedRefreshController),
            refreshController: _feedRefreshController,
            child: const FeedContent(),
          ),
          RefresherWrapper(
            onRefresh: () => _onRefresh(_promotionsRefreshController),
            onLoading: () => _onLoading(_promotionsRefreshController),
            refreshController: _promotionsRefreshController,
            child: const PromotionsContent(),
          ),
          RefresherWrapper(
            onRefresh: () => _onRefresh(_shopRefreshController),
            onLoading: () => _onLoading(_shopRefreshController),
            refreshController: _shopRefreshController,
            child: const ShopContent(),
          ),
        ],
      ),
    ),
  ),
);
</code>```

Body:
I have PageView inside NestedScrollView, but also I have a problem with this in some cases:

_AssertionError ('package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 108 pos 12: '_positions.length == 1': ScrollController attached to multiple scroll views.)

Also inside PageView I put another PageView for photo slider. How can I resolve it?

code:

Scaffold(
  backgroundColor: _layout.theme.background,
  body: SafeArea(
    child: NestedScrollView(
      controller: _scrollController,
      key: _homeNestedKey,
      ...
      body: PageView(
        onPageChanged: _onPageChanged,
        controller: _pageController,
        children: [
          RefresherWrapper(
            onRefresh: () => _onRefresh(_feedRefreshController),
            onLoading: () => _onLoading(_feedRefreshController),
            refreshController: _feedRefreshController,
            child: const FeedContent(),
          ),
          RefresherWrapper(
            onRefresh: () => _onRefresh(_promotionsRefreshController),
            onLoading: () => _onLoading(_promotionsRefreshController),
            refreshController: _promotionsRefreshController,
            child: const PromotionsContent(),
          ),
          RefresherWrapper(
            onRefresh: () => _onRefresh(_shopRefreshController),
            onLoading: () => _onLoading(_shopRefreshController),
            refreshController: _shopRefreshController,
            child: const ShopContent(),
          ),
        ],
      ),
    ),
  ),
);


问:
Can I create a chat program with IOCP?
I've just entered socket programming.
But I was given homework to implement a simple chat program with IOCP.

WSASend(), which is used in IOCP, forwards data to only one client connected to the socket, and how do I change this to transfer data to all connected clients?

After many attempts, the server was still transferring data only to the client that sent it.

When one client sends data to the server, I want the server to send it to all connected clients.

After many attempts, the server was still transferring data only to the client that sent it.

When one client sends data to the server, I want the server to send it to all connected clients.

This is a function that, in the IOCP program that I am currently dealing with, transfers data received to the client through a connected socket back to the client. I'm thinking about the problem here.

Of course there may be problems elsewhere. I'll show you if you want to see other parts of the code.

```<code>bool Session::SendMsg(int size) { // size : size of send data
    ZeroMemory(&_sio.over, sizeof(_sio.over));
    _sio.wbuf.len = size;
    _sio.wbuf.buf = _sio.mbuf;
    _sio.type = Iotype::Send;

    DWORD trans;

    // It sends data to only one client....
    int ret = WSASend(_sock, &_sio.wbuf, 1, &trans, 0, &_sio.over, NULL);
    if (ret == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING)
        return false;

    return true;
}
</code>```

Title: Can I create a chat program with IOCP?

Body:
I've just entered socket programming.
But I was given homework to implement a simple chat program with IOCP.

WSASend(), which is used in IOCP, forwards data to only one client connected to the socket, and how do I change this to transfer data to all connected clients?

After many attempts, the server was still transferring data only to the client that sent it.

When one client sends data to the server, I want the server to send it to all connected clients.

After many attempts, the server was still transferring data only to the client that sent it.

When one client sends data to the server, I want the server to send it to all connected clients.

This is a function that, in the IOCP program that I am currently dealing with, transfers data received to the client through a connected socket back to the client. I'm thinking about the problem here.

Of course there may be problems elsewhere. I'll show you if you want to see other parts of the code.

bool Session::SendMsg(int size) { // size : size of send data
    ZeroMemory(&_sio.over, sizeof(_sio.over));
    _sio.wbuf.len = size;
    _sio.wbuf.buf = _sio.mbuf;
    _sio.type = Iotype::Send;

    DWORD trans;

    // It sends data to only one client....
    int ret = WSASend(_sock, &_sio.wbuf, 1, &trans, 0, &_sio.over, NULL);
    if (ret == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING)
        return false;

    return true;
}