问:
Problem with the IntelliJ version in the plug-in
When I set an IntelliJ version as described below I have the following error

```<code>intellij {
    version '2022.3'
}
</code>```

A problem occurred configuring root project 'brs-plugin'.

Failed to notify project evaluation listener.
Failed to query the value of extension 'intellij' property 'version'.
> The value for the 'intellij.version' property was not specified, see:
https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-version

But if I add the equal operator have the following

```<code>intellij {
    version = '2022.3'
}
</code>```

Caused by: org.gradle.internal.exceptions.DefaultMultiCauseException:
Could not resolve com.jetbrains.intellij.idea:ideaIC:2022.3.

This is my full version of the build.gradle. As you can see I have added several repos, but it's not helped. Full version of the project you can found on this link
How to fix my problem? Regards

```<code>buildscript {

    repositories {
        mavenCentral()

        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }

        maven {
            url "https://plugins.gradle.org/m2/"
        }

        maven {
            url "https://www.jetbrains.com/intellij-repository/releases"
        }
        maven {
            url "https://www.jetbrains.com/intellij-repository/snapshots"
        }

        maven {
            url "https://cache-redirector.jetbrains.com/intellij-dependencies"
        }

    }

}

plugins {
    id "org.jetbrains.intellij" version "1.11.0"
    id "org.jetbrains.grammarkit" version "2020.1"

}

configurations {
    configurations.compileOnly.setCanBeResolved(true)
}

group 'com.interfaced'
version = '0.2.7'

apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.intellij'

sourceSets {
    all {
        java.srcDirs += ['src/main/gen']
        kotlin.srcDirs += ['src/main/kotlin']
        resources.srcDirs = ['src/main/resources']
    }
}

intellij {
    version = '2022.3'
}

grammarKit {
    jflexRelease = '1.7.0-2'
}

repositories {
    mavenCentral()
    maven {
        url "https://cache-redirector.jetbrains.com/intellij-dependencies"
    }
}

dependencies {
    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.7.22'

    implementation files('jars/grammar-kit.jar')
    implementation group: 'junit', name: 'junit', version: '4.12'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: '1.6.0'

}

import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.grammarkit.tasks.GenerateParser

def GENERATE_GROUP = 'Generate'

task setConfiguration() {
    configurations.compileOnly.setCanBeResolved(true)
}
task generateLexer(type: GenerateLexer) {
    source = "src/main/grammar/BrightScript.flex"
    targetDir = "src/main/gen/com/interfaced/brs/lang/lexer"
    targetClass = "_BrsLexer"
    skeleton = "src/main/grammar/idea-flex.skeleton"
    purgeOldFiles = true

    description = 'Generate Lexer Java sources for BrightScript'
    group = GENERATE_GROUP
}

task generateParser(type: GenerateParser) {
    source = "src/main/grammar/BrightScript.bnf"
    targetRoot = 'src/main/gen'
    pathToParser = 'src/main/gen/com/interfaced/brs/lang/BrsParser.java'
    pathToPsiRoot = 'src/main/gen/com/interfaced/brs/lang/psi'
    purgeOldFiles = true

    description = 'Generate Parser Java sources for BrightScript'
    group = GENERATE_GROUP

    // patch up to date check
    outputs.upToDateWhen { false }
}

compileKotlin {
    kotlinOptions.jvmTarget = "17"
}

compileKotlin.dependsOn(setConfiguration, generateLexer, generateParser)
</code>```

Body:
When I set an IntelliJ version as described below I have the following error

intellij {
    version '2022.3'
}

A problem occurred configuring root project 'brs-plugin'.

Failed to notify project evaluation listener.
Failed to query the value of extension 'intellij' property 'version'.
> The value for the 'intellij.version' property was not specified, see:
https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-version

But if I add the equal operator have the following

intellij {
    version = '2022.3'
}

Caused by: org.gradle.internal.exceptions.DefaultMultiCauseException:
Could not resolve com.jetbrains.intellij.idea:ideaIC:2022.3.

This is my full version of the build.gradle. As you can see I have added several repos, but it's not helped. Full version of the project you can found on this link
How to fix my problem? Regards

buildscript {

    repositories {
        mavenCentral()

        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }

        maven {
            url "https://plugins.gradle.org/m2/"
        }

        maven {
            url "https://www.jetbrains.com/intellij-repository/releases"
        }
        maven {
            url "https://www.jetbrains.com/intellij-repository/snapshots"
        }

        maven {
            url "https://cache-redirector.jetbrains.com/intellij-dependencies"
        }

    }

}

plugins {
    id "org.jetbrains.intellij" version "1.11.0"
    id "org.jetbrains.grammarkit" version "2020.1"

}

configurations {
    configurations.compileOnly.setCanBeResolved(true)
}

group 'com.interfaced'
version = '0.2.7'

apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.intellij'

sourceSets {
    all {
        java.srcDirs += ['src/main/gen']
        kotlin.srcDirs += ['src/main/kotlin']
        resources.srcDirs = ['src/main/resources']
    }
}

intellij {
    version = '2022.3'
}

grammarKit {
    jflexRelease = '1.7.0-2'
}

repositories {
    mavenCentral()
    maven {
        url "https://cache-redirector.jetbrains.com/intellij-dependencies"
    }
}

dependencies {
    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.7.22'

    implementation files('jars/grammar-kit.jar')
    implementation group: 'junit', name: 'junit', version: '4.12'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: '1.6.0'

}

import org.jetbrains.grammarkit.tasks.GenerateLexer
import org.jetbrains.grammarkit.tasks.GenerateParser

def GENERATE_GROUP = 'Generate'

task setConfiguration() {
    configurations.compileOnly.setCanBeResolved(true)
}
task generateLexer(type: GenerateLexer) {
    source = "src/main/grammar/BrightScript.flex"
    targetDir = "src/main/gen/com/interfaced/brs/lang/lexer"
    targetClass = "_BrsLexer"
    skeleton = "src/main/grammar/idea-flex.skeleton"
    purgeOldFiles = true

    description = 'Generate Lexer Java sources for BrightScript'
    group = GENERATE_GROUP
}

task generateParser(type: GenerateParser) {
    source = "src/main/grammar/BrightScript.bnf"
    targetRoot = 'src/main/gen'
    pathToParser = 'src/main/gen/com/interfaced/brs/lang/BrsParser.java'
    pathToPsiRoot = 'src/main/gen/com/interfaced/brs/lang/psi'
    purgeOldFiles = true

    description = 'Generate Parser Java sources for BrightScript'
    group = GENERATE_GROUP

    // patch up to date check
    outputs.upToDateWhen { false }
}

compileKotlin {
    kotlinOptions.jvmTarget = "17"
}

compileKotlin.dependsOn(setConfiguration, generateLexer, generateParser)


来源: stackexchange

问:
How can I distinguish between multiple instances of the same fragment in Android navigation component?
I've created a navigation graph that includes a fragment that includes an action to navigate to another instance of itself for the purposes of setting up a multiple choice question survey like this:

```<code>    <fragment
        android:id="@+id/multipleChoiceFragment"
        android:name="com.example.MultipleChoiceFragment"
        android:label="MultipleChoiceFragment"
        tools:layout="@layout/fragment_multiple_choice_question">
        <action
            android:id="@+id/action_multipleChoiceFragment_to_multipleChoiceFragment"
            app:destination="@id/multipleChoiceFragment" />
        <argument
            android:name="questionId"
            app:argType="string"
            app:nullable="false" />
    </fragment>
</code>```

and I have a parent fragment implementation, SurveyFragment, that is responsible for navigating through the instances of MultipleChoiceFragment via the NavController and setting different questionId values for each MultipleChoiceFragment depending on the answers given to previous MultipleChoiceFragment instances.

I can't seem to find a way to have the parent fragment, SurveyFragment, tell which MultipleChoiceFragment instance is currently visible. I am using a single ViewModel for all instances of MultipleChoiceFragment and SurveyFragment, but if I can I'd like all the navigation logic to be contained entirely within SurveyFragment and not split between all the different classes. I'd like to be able to use the questionId value to distinguish between instances. How can I do that?

I'd like to have something setup in the SurveyFragment that looks something like this:

```<code>navController.addOnDestinationChangedListener { _, destination, _ ->
            when (destination.questionId) {
                // do stuff depending on what question has been navigated to
            }
        }
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I've created a navigation graph that includes a fragment that includes an action to navigate to another instance of itself for the purposes of setting up a multiple choice question survey like this:

    <fragment
        android:id="@+id/multipleChoiceFragment"
        android:name="com.example.MultipleChoiceFragment"
        android:label="MultipleChoiceFragment"
        tools:layout="@layout/fragment_multiple_choice_question">
        <action
            android:id="@+id/action_multipleChoiceFragment_to_multipleChoiceFragment"
            app:destination="@id/multipleChoiceFragment" />
        <argument
            android:name="questionId"
            app:argType="string"
            app:nullable="false" />
    </fragment>

and I have a parent fragment implementation, SurveyFragment, that is responsible for navigating through the instances of MultipleChoiceFragment via the NavController and setting different questionId values for each MultipleChoiceFragment depending on the answers given to previous MultipleChoiceFragment instances.

I can't seem to find a way to have the parent fragment, SurveyFragment, tell which MultipleChoiceFragment instance is currently visible. I am using a single ViewModel for all instances of MultipleChoiceFragment and SurveyFragment, but if I can I'd like all the navigation logic to be contained entirely within SurveyFragment and not split between all the different classes. I'd like to be able to use the questionId value to distinguish between instances. How can I do that?

I'd like to have something setup in the SurveyFragment that looks something like this:

navController.addOnDestinationChangedListener { _, destination, _ ->
            when (destination.questionId) {
                // do stuff depending on what question has been navigated to
            }
        }


问:
Pipe exact output from Git command to stdout
I'm trying to print out tags with dates. Running git tag -l --format='%(committerdate:short):  %(refname:short)' gives me:

```<code>2016-09-29:  sometag
2021-11-01:  othertag
2019-04-02:  v1.2
</code>```

I'd like to search those for tags with a version number, but when I pipe to grep I find the custom formatting (with the dates, which I need) is gone:

```<code>:  v2.1
:  v2.3
:  v2.1.1
</code>```

It looks like this question is similar, but the answers there suggest --decorate, which is not an argument for git tag.

(In the end I found a different way to do what I was doing, but still wondering about my original question - is there a way to pipe the output displayed to the user to another program?)

Body:
I'm trying to print out tags with dates. Running git tag -l --format='%(committerdate:short):  %(refname:short)' gives me:

2016-09-29:  sometag
2021-11-01:  othertag
2019-04-02:  v1.2

I'd like to search those for tags with a version number, but when I pipe to grep I find the custom formatting (with the dates, which I need) is gone:

:  v2.1
:  v2.3
:  v2.1.1

It looks like this question is similar, but the answers there suggest --decorate, which is not an argument for git tag.

(In the end I found a different way to do what I was doing, but still wondering about my original question - is there a way to pipe the output displayed to the user to another program?)


问:
Torchvision output when inconclusive
I'm learning torch and I was trying to get a prediction when the model can't exactly predict what type of flower is testing.

```<code>if (prediction == 0):
    print ('daisy')
if (prediction == 1):
    print ('dandelion')
if (prediction == 2):
    print ('rose')
if (prediction == 3):
    print ('sunflower')
if (prediction == 4):
    print ('tulip')
</code>```

Currently I have this code but is it even possible to do what I asked?
Earlier today I loaded an image of a car and it told me that it was a tulip, how can I stop this from happening?

Title: Torchvision output when inconclusive

Body:
I'm learning torch and I was trying to get a prediction when the model can't exactly predict what type of flower is testing.

if (prediction == 0):
    print ('daisy')
if (prediction == 1):
    print ('dandelion')
if (prediction == 2):
    print ('rose')
if (prediction == 3):
    print ('sunflower')
if (prediction == 4):
    print ('tulip')

Currently I have this code but is it even possible to do what I asked?
Earlier today I loaded an image of a car and it told me that it was a tulip, how can I stop this from happening?


问:
Task Killing the Force Quit window on Mac OSX
I am trying to Task kill the Force Quit window with Python

On this Wikipedia page (https://en.wikipedia.org/wiki/List_of_macOS_built-in_apps#loginwindow), I saw that a system app called "loginwindow" controls the lock screen, as well as the Force Quit Window.
So I tried Task Killing that app:

```<code>  import os

  while True:
      os.system("killall loginwindow")
</code>```

But it tells me that the process doesn't exist...
Does anyone know what is happening here?

Body:
I am trying to Task kill the Force Quit window with Python

On this Wikipedia page (https://en.wikipedia.org/wiki/List_of_macOS_built-in_apps#loginwindow), I saw that a system app called "loginwindow" controls the lock screen, as well as the Force Quit Window.
So I tried Task Killing that app:

  import os

  while True:
      os.system("killall loginwindow")

But it tells me that the process doesn't exist...
Does anyone know what is happening here?


问:
Is there a way to set a css rule according to a javascript variable?
for context since I'm doing this in a pretty specific scenario:
I am making a style editor for open.spotify.com (unfinished but working here), and I want to make a text color changer using the jscolor colorpicker (irrelevent to this question I can implement it just fine), but nothing I've tried to change the color has worked. When I change the color using the stylebot extension in css, it works perfectly fine.

I know that I can't just put something like

```<code>element {
color: jsVariable;
}
</code>```

but is there a way to dynamically create a css rule using javascript? I have a function already made called addGlobalStyle that I can use like this: addGlobalStyle("element{color: red;}"), can I create a rule like this with javascript and append it? I have already tried using setAttribute, and tried getting help here, but nothing tried there works.

Things I've tried (mostly pasted from my previous question linked above):
h1 and #ffff00 are used as examples, the elements with text I would like to change are h1-3, div, span, and a

```<code>let hexValue = "#ffff00"
document.getElementsByTagName("h1").style.color = hexValue;
</code>```
```<code>let h1 = document.getElementsByTagName("h1")
h1.style.color = "#ffff00"
</code>```

and here is the original code I was trying at the beginning which takes hex code from a user input

```<code>let tc1 = document.getElementsByTagName("h1");
let btn = document.createElement("button")
btn.textContent = 'update'
btn.addEventListener('click', changeTextColor)
let jsc = document.createElement("input");
jsc.setAttribute('id', 'hexInput');
jsc.setAttribute("data-jscolor", "{}")

function changeTextColor() {
jsc.addEventListener('change', function() {
let hexValue = this.value; //in this line, i have also tried document.getElementById('hexInput').value
tc1.style.color = hexValue;

}
document.body.insertAdjacentElement('beforebegin', jsc)
document.body.insertAdjacentElement('beforebegin', btn)
jscolor.install()
</code>```

Body:
for context since I'm doing this in a pretty specific scenario:
I am making a style editor for open.spotify.com (unfinished but working here), and I want to make a text color changer using the jscolor colorpicker (irrelevent to this question I can implement it just fine), but nothing I've tried to change the color has worked. When I change the color using the stylebot extension in css, it works perfectly fine.

I know that I can't just put something like

element {
color: jsVariable;
}

but is there a way to dynamically create a css rule using javascript? I have a function already made called addGlobalStyle that I can use like this: addGlobalStyle("element{color: red;}"), can I create a rule like this with javascript and append it? I have already tried using setAttribute, and tried getting help here, but nothing tried there works.

Things I've tried (mostly pasted from my previous question linked above):
h1 and #ffff00 are used as examples, the elements with text I would like to change are h1-3, div, span, and a

let hexValue = "#ffff00"
document.getElementsByTagName("h1").style.color = hexValue;

let h1 = document.getElementsByTagName("h1")
h1.style.color = "#ffff00"

and here is the original code I was trying at the beginning which takes hex code from a user input

let tc1 = document.getElementsByTagName("h1");
let btn = document.createElement("button")
btn.textContent = 'update'
btn.addEventListener('click', changeTextColor)
let jsc = document.createElement("input");
jsc.setAttribute('id', 'hexInput');
jsc.setAttribute("data-jscolor", "{}")

function changeTextColor() {
jsc.addEventListener('change', function() {
let hexValue = this.value; //in this line, i have also tried document.getElementById('hexInput').value
tc1.style.color = hexValue;

}
document.body.insertAdjacentElement('beforebegin', jsc)
document.body.insertAdjacentElement('beforebegin', btn)
jscolor.install()


问:
BigCommerce global variable %%GLOBAL_ProductId%% has different values on the same page
I use %%GLOBAL_ProductId%% global variable in 2 my templates:

\product.html

\Panels\ProductDetails.html

The problem is that on any product page in template 1 this global variable has wrong value (another product id), while it's always right in template 2.

How can I access the actual product id in any template?


问:
OSError: dlopen(libclang.dylib, 6): image not found
My python code:

```<code>from clang.cindex import Index, CursorKind
</code>```

Error thrown:

```<code>Traceback (most recent call last):
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 4174, in get_cindex_library
    library = cdll.LoadLibrary(self.get_filename())
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/ctypes/__init__.py", line 447, in LoadLibrary
    return self._dlltype(name)
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/ctypes/__init__.py", line 369, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libclang.dylib, 6): image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../../CppAmalgamator/comment_out_function.py", line 47, in <module>
    comment_out_function(input_filename, output_filename, function_name)
  File "../../CppAmalgamator/comment_out_function.py", line 7, in comment_out_function
    index = Index.create()
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 2700, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 212, in __get__
    value = self.wrapped(instance)
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 4148, in lib
    lib = self.get_cindex_library()
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 4179, in get_cindex_library
    raise LibclangError(msg)
clang.cindex.LibclangError: dlopen(libclang.dylib, 6): image not found. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
</code>```

I am on OSX 10.13.6 (Sierra)
My python version is 3.8.0

I am expecting it run without any issues.

Body:
My python code:

from clang.cindex import Index, CursorKind

Error thrown:

Traceback (most recent call last):
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 4174, in get_cindex_library
    library = cdll.LoadLibrary(self.get_filename())
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/ctypes/__init__.py", line 447, in LoadLibrary
    return self._dlltype(name)
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/ctypes/__init__.py", line 369, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libclang.dylib, 6): image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../../CppAmalgamator/comment_out_function.py", line 47, in <module>
    comment_out_function(input_filename, output_filename, function_name)
  File "../../CppAmalgamator/comment_out_function.py", line 7, in comment_out_function
    index = Index.create()
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 2700, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 212, in __get__
    value = self.wrapped(instance)
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 4148, in lib
    lib = self.get_cindex_library()
  File "/Users/sibillalazzerini/.pyenv/versions/3.8.0/lib/python3.8/site-packages/clang/cindex.py", line 4179, in get_cindex_library
    raise LibclangError(msg)
clang.cindex.LibclangError: dlopen(libclang.dylib, 6): image not found. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().

I am on OSX 10.13.6 (Sierra)
My python version is 3.8.0

I am expecting it run without any issues.


问:
The named parameter 'selectedOption' is required, but there's no corresponding argument. Required named parameter 'selectedOption' must be provided
I am getting "The named parameter 'selectedOption' is required, but there's no corresponding argument error" in flutter. I tried some things but it did not work. There are some other questions as well but I copied just 2 of them to show the error.It seems like I need to add selectedoption key for some reason.Could you help?

```<code>final questions = [
  Question(
    text: 'Which planet is the hottest in the solar system?',
    options: [
      Option(code: 'A', text: 'Earth', isCorrect: false),
      Option(code: 'B', text: 'Venus', isCorrect: true),
      Option(code: 'C', text: 'Jupiter', isCorrect: false),
      Option(code: 'D', text: 'Saturn', isCorrect: false),
    ],
    solution: 'Venus is the hottest planet in the solar system',
  ),
  Question(
    text: 'How many molecules of oxygen does ozone have?',
    options: [
      Option(code: 'A', text: '1', isCorrect: false),
      Option(code: 'B', text: '2', isCorrect: false),
      Option(code: 'C', text: '5', isCorrect: false),
      Option(code: 'D', text: '3', isCorrect: true),
    ],
    solution: 'Ozone have 3 molecules of oxygen',
  ),
];

class OptionsWidget extends StatelessWidget {
  final Question question;
  final ValueChanged<Option> onClickedOption;

  const OptionsWidget({
    required this.question,
    required this.onClickedOption,
  });

  @override
  Widget build(BuildContext context) => ListView(
        physics: BouncingScrollPhysics(),
        children: Utils.heightBetween(
          question.options
              .map((option) => buildOption(context, option))
              .toList(),
          height: 8,
        ),
      );

      Widget buildOption(BuildContext context, Option option) {
        final color = getColorForOption(option, question);

        return GestureDetector(
          onTap: () => onClickedOption(option),
          child: Container(
            padding: EdgeInsets.all(12),
            decoration: BoxDecoration(
              color: color,
              borderRadius: BorderRadius.circular(16),
            ),
            child: Column(
              children: [
                buildAnswer(option),
                buildSolution(question.selectedOption, option),
              ],
            ),
          ),
        );
      }

      Widget buildAnswer(Option option) => Container(
            height: 50,
            child: Row(children: [
              Text(
                option.code,
                style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24),
              ),
              SizedBox(width: 12),
              Text(
                option.text,
                style: TextStyle(fontSize: 20),
              )
            ]),
          );

      Widget buildSolution(Option solution, Option answer) {
        if (solution == answer) {
          return Text(
            question.solution,
            style: TextStyle(fontSize: 16, fontStyle: FontStyle.italic),
          );
        } else {
          return Container();
        }
      }

      Color getColorForOption(Option option, Question question) {
        final isSelected = option == question.selectedOption;

        if (!isSelected) {
          return Colors.grey.shade200;
        } else {
          return option.isCorrect ? Colors.green : Colors.red;
        }
      }
    }
</code>```

Body:
I am getting "The named parameter 'selectedOption' is required, but there's no corresponding argument error" in flutter. I tried some things but it did not work. There are some other questions as well but I copied just 2 of them to show the error.It seems like I need to add selectedoption key for some reason.Could you help?

final questions = [
  Question(
    text: 'Which planet is the hottest in the solar system?',
    options: [
      Option(code: 'A', text: 'Earth', isCorrect: false),
      Option(code: 'B', text: 'Venus', isCorrect: true),
      Option(code: 'C', text: 'Jupiter', isCorrect: false),
      Option(code: 'D', text: 'Saturn', isCorrect: false),
    ],
    solution: 'Venus is the hottest planet in the solar system',
  ),
  Question(
    text: 'How many molecules of oxygen does ozone have?',
    options: [
      Option(code: 'A', text: '1', isCorrect: false),
      Option(code: 'B', text: '2', isCorrect: false),
      Option(code: 'C', text: '5', isCorrect: false),
      Option(code: 'D', text: '3', isCorrect: true),
    ],
    solution: 'Ozone have 3 molecules of oxygen',
  ),
];

class OptionsWidget extends StatelessWidget {
  final Question question;
  final ValueChanged<Option> onClickedOption;

  const OptionsWidget({
    required this.question,
    required this.onClickedOption,
  });

  @override
  Widget build(BuildContext context) => ListView(
        physics: BouncingScrollPhysics(),
        children: Utils.heightBetween(
          question.options
              .map((option) => buildOption(context, option))
              .toList(),
          height: 8,
        ),
      );

      Widget buildOption(BuildContext context, Option option) {
        final color = getColorForOption(option, question);

        return GestureDetector(
          onTap: () => onClickedOption(option),
          child: Container(
            padding: EdgeInsets.all(12),
            decoration: BoxDecoration(
              color: color,
              borderRadius: BorderRadius.circular(16),
            ),
            child: Column(
              children: [
                buildAnswer(option),
                buildSolution(question.selectedOption, option),
              ],
            ),
          ),
        );
      }

      Widget buildAnswer(Option option) => Container(
            height: 50,
            child: Row(children: [
              Text(
                option.code,
                style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24),
              ),
              SizedBox(width: 12),
              Text(
                option.text,
                style: TextStyle(fontSize: 20),
              )
            ]),
          );

      Widget buildSolution(Option solution, Option answer) {
        if (solution == answer) {
          return Text(
            question.solution,
            style: TextStyle(fontSize: 16, fontStyle: FontStyle.italic),
          );
        } else {
          return Container();
        }
      }

      Color getColorForOption(Option option, Question question) {
        final isSelected = option == question.selectedOption;

        if (!isSelected) {
          return Colors.grey.shade200;
        } else {
          return option.isCorrect ? Colors.green : Colors.red;
        }
      }
    }


问:
Making All possible combinations list from a smaller list in python
While making an app I tried to think in a way to collect all the possible orders and combinations of an unknown length list in python.
As an example, I have a list

[1, 2]

I want a way to make as an example list like this

[[1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 2, 2], [2, 1, 1], [2, 1, 2], [2, 2, 1] [2, 2, 2]]

Yes I want a a bigger combination of list with all possible order and all with the same length as the example above

I was trying to find a way to do that but almost all of my ways ends in time run error So it would be helpful if anyone could help me and thanks


问:
customize message response when @QueryValue is not specified
I am working on a controller using micronaut, and I set the @QueryValue with no defautValue. When setting it up like this, it is my understanding that it is a required value.
I want to customize the response when I don't send this query value, and can't find where to set this.

mycontroller.java
`

```<code>@Get("/$expand")
public Sample<SampleConcept> find(@QueryValue(value = "filter") String filter,
                                      @QueryValue(value = "sample", defaultValue = "") String nomenclador,
                                      @QueryValue(value = "offset", defaultValue = "0") int offset,
                                      @QueryValue(value = "count", defaultValue = "10") int count) {
    String channel = (String) getObjectFromContext(RequestContextAttribute.CHANNEL);

    return service.find(filter, sample, channel, offset, count);
}
</code>```

`
response in postman when not sending "filter"

```<code>{
    "message": "Bad Request",
    "_links": {
        "self": {
            "href": "/$expand",
            "templated": false
        }
    },
    "_embedded": {
        "errors": [
            {
                "message": "Required QueryValue [filter] not specified",
                "path": "/filter"
            }
        ]
    }
}
</code>```

Body:
I am working on a controller using micronaut, and I set the @QueryValue with no defautValue. When setting it up like this, it is my understanding that it is a required value.
I want to customize the response when I don't send this query value, and can't find where to set this.

mycontroller.java
`

@Get("/$expand")
public Sample<SampleConcept> find(@QueryValue(value = "filter") String filter,
                                      @QueryValue(value = "sample", defaultValue = "") String nomenclador,
                                      @QueryValue(value = "offset", defaultValue = "0") int offset,
                                      @QueryValue(value = "count", defaultValue = "10") int count) {
    String channel = (String) getObjectFromContext(RequestContextAttribute.CHANNEL);

    return service.find(filter, sample, channel, offset, count);
}

`
response in postman when not sending "filter"

{
    "message": "Bad Request",
    "_links": {
        "self": {
            "href": "/$expand",
            "templated": false
        }
    },
    "_embedded": {
        "errors": [
            {
                "message": "Required QueryValue [filter] not specified",
                "path": "/filter"
            }
        ]
    }
}


问:
Install different python version on Anaconda
I am needing to install Python 3.7

Tried the command conda install python=3.7

I get:
`

```<code>C:\Users\USER>conda install python 3.7
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - 3.7

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch
</code>```

`
Any idea why this isn't working? I'm able to select the python version in pycharm so not sure what's going on.

Body:
I am needing to install Python 3.7

Tried the command conda install python=3.7

I get:
`

C:\Users\USER>conda install python 3.7
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - 3.7

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

`
Any idea why this isn't working? I'm able to select the python version in pycharm so not sure what's going on.


问:
Call external API and store data in sql database (daily refresh or so) .NET integration
I have an external API that I can't make it work using basic authentication (It works perfectly using Postman) I can't find any tutorial regarding this matter. Basically, I want to be able to call an API that requires Basic Authentication and store the data in sql database. It can be refreshed every day or every 2 hs, whatever is easier.
Do you have any practical example I can see from...I'm lost right now and quite new in .NET by the way!

Thanks heaps!!!!

Daniela

I tried using Basic authentication from Microsoft Learning Platform but I'm still getting:
"System.Net.Http.HttpRequestException: 'Response status code does not indicate success: 401 (Unauthorized)."
It works fine in Postman calls.


问:
How to get the MessageFragment from ChatFragment (bottomNavigationView)
I have a little problem with the Fragments. When I want to recover the Fragment named MessageFragment who works like a list of message for use to my webservice. To more understand, I have a bottomNavigationView to control the pages named "Home", "Profile" and "Chat" in reality every page is a Fragment:

The Fragment named ChatFragment has other fragment MessageFragment to show a list of Message:

When I want to use my WebService to recover a list of Message from Server side, I muse use the MessageFragment which is in ChatFragment. But when I try to get the Fragment with this:

messageFragment = childFragmentManager.findFragmentById(R.id.messageFragment) as MessageFragment?
```
<p>I precise the code above is executed in a Fragment Class and so I can't use <code>supportFragmentManager</code>.</p>
<p>To solve this problem, I try to put an instance of <code>MessageFragment</code> class in <code>childFragmentManager</code> of <code>ChatFragment</code> with this code :</p>
<pre class="lang-kotlin prettyprint-override"><code>childFragmentManager.beginTransaction().add(R.id.chatFragment, MessageFragment()).commit()
Log.d("childFragments = ", childFragmentManager.fragments.toString())
</code>```

But I don't have any Fragments in my childFragmentManager.

I try to use setPrimaryNavigationFragment during the replacement fragments of bottomNavigationView:

private fun replaceFragment(fragment : Fragment) {
    val fragmentManager : FragmentManager = supportFragmentManager;
    val fragmentTransaction : FragmentTransaction = fragmentManager.beginTransaction()
    fragmentTransaction.replace(R.id.frame_layout, fragment).setPrimaryNavigationFragment(fragment);
    fragmentTransaction.commit();
}
```
<p><strong>ChatFragment XML:</strong></p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"
    android:orientation="vertical"
    android:layout_height="match_parent"
    android:id="@+id/fragmentChat"
    tools:context=".ChatFragment">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragmentMessage"
        android:name="com.sueezen.lesnettoyeurs.MessageFragment"
        android:layout_width="378dp"
        android:layout_height="656dp" />
</FrameLayout>
</code>```

ChatFragment Class :

package com.sueezen.lesnettoyeurs

import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors

/**
 * A simple [Fragment] subclass.
 * Use the [ChatFragment.newInstance] factory method to
 * create an instance of this Fragment.
 */
class ChatFragment(session: String?, signature: String?) : Fragment() {
    // TODO: Rename and change types of parameters.
    var messageFragment: MessageFragment? = null
    var session = session
    var signature = signature

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        //childFragmentManager.beginTransaction().add(R.id.fragmentChat, MessageFragment(), "MessageFragment").commit()

        messageFragment = childFragmentManager.findFragmentById(R.id.messageFragment) as MessageFragment?

        val pool_last : ExecutorService = Executors.newFixedThreadPool(1);
        val wb_last = WebServiceLastMessage("http://51.68.124.144/nettoyeurs_srv/last_msgs.php?session=$session&signature=$signature", messageFragment?.getMessages())
        val obj_last = pool_last.submit(wb_last)
        val status = obj_last.get()["Status"]
        Log.d("Last Messages = ", status.toString())
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        // Inflate the layout for this Fragment.
        return inflater.inflate(R.layout.fragment_chat, container, false)
    }
}
```

Body:
I have a little problem with the Fragments. When I want to recover the Fragment named MessageFragment who works like a list of message for use to my webservice. To more understand, I have a bottomNavigationView to control the pages named "Home", "Profile" and "Chat" in reality every page is a Fragment:

The Fragment named ChatFragment has other fragment MessageFragment to show a list of Message:

When I want to use my WebService to recover a list of Message from Server side, I muse use the MessageFragment which is in ChatFragment. But when I try to get the Fragment with this:

messageFragment = childFragmentManager.findFragmentById(R.id.messageFragment) as MessageFragment?

I precise the code above is executed in a Fragment Class and so I can't use supportFragmentManager.

To solve this problem, I try to put an instance of MessageFragment class in childFragmentManager of ChatFragment with this code :

childFragmentManager.beginTransaction().add(R.id.chatFragment, MessageFragment()).commit()
Log.d("childFragments = ", childFragmentManager.fragments.toString())

But I don't have any Fragments in my childFragmentManager.

I try to use setPrimaryNavigationFragment during the replacement fragments of bottomNavigationView:

private fun replaceFragment(fragment : Fragment) {
    val fragmentManager : FragmentManager = supportFragmentManager;
    val fragmentTransaction : FragmentTransaction = fragmentManager.beginTransaction()
    fragmentTransaction.replace(R.id.frame_layout, fragment).setPrimaryNavigationFragment(fragment);
    fragmentTransaction.commit();
}

ChatFragment XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"
    android:orientation="vertical"
    android:layout_height="match_parent"
    android:id="@+id/fragmentChat"
    tools:context=".ChatFragment">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragmentMessage"
        android:name="com.sueezen.lesnettoyeurs.MessageFragment"
        android:layout_width="378dp"
        android:layout_height="656dp" />
</FrameLayout>

ChatFragment Class :

package com.sueezen.lesnettoyeurs

import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors

/**
 * A simple [Fragment] subclass.
 * Use the [ChatFragment.newInstance] factory method to
 * create an instance of this Fragment.
 */
class ChatFragment(session: String?, signature: String?) : Fragment() {
    // TODO: Rename and change types of parameters.
    var messageFragment: MessageFragment? = null
    var session = session
    var signature = signature

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        //childFragmentManager.beginTransaction().add(R.id.fragmentChat, MessageFragment(), "MessageFragment").commit()

        messageFragment = childFragmentManager.findFragmentById(R.id.messageFragment) as MessageFragment?

        val pool_last : ExecutorService = Executors.newFixedThreadPool(1);
        val wb_last = WebServiceLastMessage("http://51.68.124.144/nettoyeurs_srv/last_msgs.php?session=$session&signature=$signature", messageFragment?.getMessages())
        val obj_last = pool_last.submit(wb_last)
        val status = obj_last.get()["Status"]
        Log.d("Last Messages = ", status.toString())
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        // Inflate the layout for this Fragment.
        return inflater.inflate(R.layout.fragment_chat, container, false)
    }
}


问:
When I try to load audio and images from the API into the media player and image view in ViewPager2, they do not appear in the order they were loaded
When I try to load audio and images from the API into ViewPager2's media player and image view, they don't load in the correct order; audio is sometimes different from their image and text when loaded in ViewPager2 (for example, if I slide down or up, music is different from their order, but image and text are in their order).

Watch this video for a better explanation. "Video Url"

So I want to create a feature similar to Resso Music App (sliding up and down to change music, similar to how we change videos on TikTok).

For this functionality, I use ViewPager2, an array list, an adapter, and Retrofit.

MusicFragment.java

```<code>public class MusicFragment extends Fragment {
    View v;
    List<AllMusicModel.Data> musicItems;
    ViewPager2 musicsViewPager;
    private MusicAdapter musicAdapter;

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        v = inflater.inflate(R.layout.fragment_music, container, false);
        musicsViewPager = v.findViewById(R.id.viewPagerVideos);
        musicsViewPager.setUserInputEnabled(true);
        musicItems = new ArrayList<>();
        musicAdapter = new MusicAdapter(getActivity(), musicItems);
        musicsViewPager.setAdapter(musicAdapter);
        call_music_list_api();
        return v;
    }

    private void call_music_list_api() {

        // Api implementation
        String Token = "Bearer " + Config.getToken(requireContext());
        String APIChannel = "App";
        String AppVersion = BuildConfig.VERSION_NAME;
        Call<AllMusicModel> mCall = RetrofitClient.getAdapter().GetAllMusic(APIChannel, AppVersion, Token);
        mCall.enqueue(new Callback<AllMusicModel>() {
            @SuppressLint("NotifyDataSetChanged")
            @Override
            public void onResponse(@NonNull Call<AllMusicModel> call, @NonNull Response<AllMusicModel> response) {
                if (response.isSuccessful()) {
                    AllMusicModel alldata = response.body();

                    String code;
//                    String message;
                    String status;

                    if (alldata != null) {
                        code = String.valueOf(alldata.getStatuscode());
//                        message = String.valueOf(alldata.getMessage());
                        status = String.valueOf(alldata.getStatus());
                        if (code.equals("200")) {
                            musicItems.clear();
                            musicItems.addAll(alldata.getData());
                            musicAdapter.notifyDataSetChanged();
                        } else if (Objects.equals(code, "401")) {
                            Log.e("MusicFragment", "onResponse: " + status);
                        }
                    }
                } else {
                    Toast.makeText(getContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
                }
            }

            @Override
            public void onFailure(@NonNull Call<AllMusicModel> call, @NonNull Throwable t) {
                Log.e("Error", String.valueOf(t));

            }
        });
    }

}
</code>```

fragment_music.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    style="@style/parent.contentLayout"
    android:fitsSystemWindows="false"
    tools:context=".Fragments.MusicFragment">
        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/viewPagerVideos"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>
</code>```

MusicAdapter.java

```<code>public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.MusicViewHolder> {
    private final Context context;
    private final List<AllMusicModel.Data> mMusiclist;
    private MediaPlayer mediaPlayer;

    public MusicAdapter(Context context, List<AllMusicModel.Data> musicItems) {
        this.context = context;
        mMusiclist = musicItems;
    }

    @NonNull
    @Override
    public MusicViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new MusicViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.music_layout, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull MusicViewHolder holder, int position) {
       final MusicViewHolder finalholder = holder;
        finalholder.setMusicData(mMusiclist.get(position));

    }

    @Override
    public int getItemCount() {
        return mMusiclist.size();
    }

    class MusicViewHolder extends RecyclerView.ViewHolder {
        ImageView mImageView, play_pause_image;
        TextView txtTitle, txtDesc;
        ProgressBar mProgressBar;
        ConstraintLayout play_pause_layout, linearLayout;

        public MusicViewHolder(@NonNull View itemView) {
            super(itemView);
            mImageView = itemView.findViewById(R.id.imageView);
            txtTitle = itemView.findViewById(R.id.txtTitle);
            txtDesc = itemView.findViewById(R.id.txtDesc);
            mProgressBar = itemView.findViewById(R.id.progressBar);
            play_pause_layout = itemView.findViewById(R.id.play_pause_layout);
            play_pause_image = itemView.findViewById(R.id.play_pause_image);
            linearLayout = itemView.findViewById(R.id.linearLayout);
        }

        void setMusicData(AllMusicModel.Data musicItem) {

            txtTitle.setText(musicItem.getTitle());
//            txtDesc.setText(musicItem);
            if (mediaPlayer != null) {
                mediaPlayer.stop();
                mediaPlayer.release();
                mediaPlayer = null;
            }
            mImageView.setOnClickListener(v -> {
                if (mediaPlayer.isPlaying()) {
                    //stop or pause your media player mediaPlayer.stop(); or mediaPlayer.pause();
                    play_pause_layout.setVisibility(View.VISIBLE);
                    play_pause_image.setImageResource(R.drawable.ic_round_play);
                    mediaPlayer.pause();
                } else {
                    mediaPlayer.start();
                    play_pause_layout.setVisibility(View.VISIBLE);
                    play_pause_image.setImageResource(R.drawable.ic_round_pause);
                    Handler handler = new Handler();
                    handler.postDelayed(() -> play_pause_layout.setVisibility(View.INVISIBLE), 4000);
                }
            });

            String audioUrl = ApiUrls.Api_LocalHost_Url + musicItem.getAudio();
            mediaPlayer = new MediaPlayer();
            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            try {
                mediaPlayer.setDataSource(audioUrl);
                mediaPlayer.prepareAsync();
                mediaPlayer.setOnPreparedListener(mediaPlayer -> {
                    mProgressBar.setVisibility(View.GONE);
                    mediaPlayer.start();
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
            mediaPlayer.setOnCompletionListener(MediaPlayer::start);
            String imageUrl = ApiUrls.Api_LocalHost_Url + musicItem.getImage();
            Glide.with(context)
                    .load(imageUrl)
                    .placeholder(R.drawable.loading)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .error(R.drawable.loading)
                    .into(mImageView);

        }
    }
}
</code>```

music_layout.xml (Layout for Load Adater Data)

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@color/contentBodyColor"
  >

    <ImageView
        android:id="@+id/imageView"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:scaleType="centerCrop"
        android:layout_width="0dp"
        android:layout_height="0dp"/>
    <ProgressBar
        android:id="@+id/progressBar"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_width="30dp"
        android:layout_height="30dp"/>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/play_pause_layout"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_gravity="center"
        android:visibility="gone"
        android:background="@drawable/music_play_pause_bg"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/play_pause_image"
            android:layout_width="45dp"
            android:layout_height="45dp"
            android:contentDescription="@string/back_button"
            android:src="@drawable/ic_round_play"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>
    <LinearLayout
        android:layout_marginStart="5dp"
        android:layout_marginEnd="5dp"
        android:layout_marginBottom="80dp"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/txtTitle"
            android:paddingStart="5dp"
            android:paddingTop="5dp"
            android:paddingEnd="5dp"
            android:shadowColor="@android:color/black"
            android:shadowDx="0"
            android:shadowDy="0"
            android:shadowRadius="15"
            android:textColor="@android:color/white"
            android:textSize="25sp"
            android:textAlignment="center"
            android:fontFamily="@font/roboto_bold"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <TextView
            android:id="@+id/txtDesc"
            android:paddingStart="5dp"
            android:paddingTop="5dp"
            android:paddingEnd="5dp"
            android:shadowDx="0"
            android:shadowDy="0"
            android:shadowRadius="15"
            android:textColor="@android:color/white"
            android:textSize="10sp"
            android:shadowColor="@android:color/black"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:ignore="SmallSp" />

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

AllMusicModel.java

```<code>public class AllMusicModel {

    @SerializedName("statuscode")
    @Expose
    private Integer statuscode;
    @SerializedName("status")
    @Expose
    private String status;
    @SerializedName("message")
    @Expose
    private String message;
    @SerializedName("data")
    @Expose
    private List<Data> data = null;

    public Integer getStatuscode() {
        return statuscode;
    }

    public void setStatuscode(Integer statuscode) {
        this.statuscode = statuscode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<Data> getData() {
        return data;
    }

    public void setData(List<Data> data) {
        this.data = data;
    }
    public class Data {

        @SerializedName("id")
        @Expose
        private Integer id;
        @SerializedName("title")
        @Expose
        private String title;
        @SerializedName("image")
        @Expose
        private String image;
        @SerializedName("audio")
        @Expose
        private String audio;
        @SerializedName("time")
        @Expose
        private String time;
        @SerializedName("status")
        @Expose
        private String status;
        @SerializedName("createdAt")
        @Expose
        private String createdAt;
        @SerializedName("updatedAt")
        @Expose
        private String updatedAt;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getImage() {
            return image;
        }

        public void setImage(String image) {
            this.image = image;
        }

        public String getAudio() {
            return audio;
        }

        public void setAudio(String audio) {
            this.audio = audio;
        }

        public String getTime() {
            return time;
        }

        public void setTime(String time) {
            this.time = time;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getCreatedAt() {
            return createdAt;
        }

        public void setCreatedAt(String createdAt) {
            this.createdAt = createdAt;
        }

        public String getUpdatedAt() {
            return updatedAt;
        }

        public void setUpdatedAt(String updatedAt) {
            this.updatedAt = updatedAt;
        }

    }
}
</code>```

Json Response From API

```<code>{"statuscode":200,"status":"Success","message":"Music List","data":[{"id":6,"title":"Faded","image":"1156127.jpg","audio":"waha.mp3","time":"Testing","status":"Testing","createdAt":"2022-10-05T20:36:56.000Z","updatedAt":"2022-10-05T20:36:56.000Z"},{"id":7,"title":"Drive Forever","image":"driveforever.jpg","audio":"driveforever.mp3","time":"Testing","status":"Testing","createdAt":"2022-10-05T20:46:51.000Z","updatedAt":"2022-10-05T20:46:51.000Z"}]}
</code>```

Body:
When I try to load audio and images from the API into ViewPager2's media player and image view, they don't load in the correct order; audio is sometimes different from their image and text when loaded in ViewPager2 (for example, if I slide down or up, music is different from their order, but image and text are in their order).

Watch this video for a better explanation. "Video Url"

So I want to create a feature similar to Resso Music App (sliding up and down to change music, similar to how we change videos on TikTok).

For this functionality, I use ViewPager2, an array list, an adapter, and Retrofit.

MusicFragment.java

public class MusicFragment extends Fragment {
    View v;
    List<AllMusicModel.Data> musicItems;
    ViewPager2 musicsViewPager;
    private MusicAdapter musicAdapter;

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        v = inflater.inflate(R.layout.fragment_music, container, false);
        musicsViewPager = v.findViewById(R.id.viewPagerVideos);
        musicsViewPager.setUserInputEnabled(true);
        musicItems = new ArrayList<>();
        musicAdapter = new MusicAdapter(getActivity(), musicItems);
        musicsViewPager.setAdapter(musicAdapter);
        call_music_list_api();
        return v;
    }

    private void call_music_list_api() {

        // Api implementation
        String Token = "Bearer " + Config.getToken(requireContext());
        String APIChannel = "App";
        String AppVersion = BuildConfig.VERSION_NAME;
        Call<AllMusicModel> mCall = RetrofitClient.getAdapter().GetAllMusic(APIChannel, AppVersion, Token);
        mCall.enqueue(new Callback<AllMusicModel>() {
            @SuppressLint("NotifyDataSetChanged")
            @Override
            public void onResponse(@NonNull Call<AllMusicModel> call, @NonNull Response<AllMusicModel> response) {
                if (response.isSuccessful()) {
                    AllMusicModel alldata = response.body();

                    String code;
//                    String message;
                    String status;

                    if (alldata != null) {
                        code = String.valueOf(alldata.getStatuscode());
//                        message = String.valueOf(alldata.getMessage());
                        status = String.valueOf(alldata.getStatus());
                        if (code.equals("200")) {
                            musicItems.clear();
                            musicItems.addAll(alldata.getData());
                            musicAdapter.notifyDataSetChanged();
                        } else if (Objects.equals(code, "401")) {
                            Log.e("MusicFragment", "onResponse: " + status);
                        }
                    }
                } else {
                    Toast.makeText(getContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
                }
            }

            @Override
            public void onFailure(@NonNull Call<AllMusicModel> call, @NonNull Throwable t) {
                Log.e("Error", String.valueOf(t));

            }
        });
    }

}

fragment_music.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    style="@style/parent.contentLayout"
    android:fitsSystemWindows="false"
    tools:context=".Fragments.MusicFragment">
        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/viewPagerVideos"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>

MusicAdapter.java

public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.MusicViewHolder> {
    private final Context context;
    private final List<AllMusicModel.Data> mMusiclist;
    private MediaPlayer mediaPlayer;

    public MusicAdapter(Context context, List<AllMusicModel.Data> musicItems) {
        this.context = context;
        mMusiclist = musicItems;
    }

    @NonNull
    @Override
    public MusicViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new MusicViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.music_layout, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull MusicViewHolder holder, int position) {
       final MusicViewHolder finalholder = holder;
        finalholder.setMusicData(mMusiclist.get(position));

    }

    @Override
    public int getItemCount() {
        return mMusiclist.size();
    }

    class MusicViewHolder extends RecyclerView.ViewHolder {
        ImageView mImageView, play_pause_image;
        TextView txtTitle, txtDesc;
        ProgressBar mProgressBar;
        ConstraintLayout play_pause_layout, linearLayout;

        public MusicViewHolder(@NonNull View itemView) {
            super(itemView);
            mImageView = itemView.findViewById(R.id.imageView);
            txtTitle = itemView.findViewById(R.id.txtTitle);
            txtDesc = itemView.findViewById(R.id.txtDesc);
            mProgressBar = itemView.findViewById(R.id.progressBar);
            play_pause_layout = itemView.findViewById(R.id.play_pause_layout);
            play_pause_image = itemView.findViewById(R.id.play_pause_image);
            linearLayout = itemView.findViewById(R.id.linearLayout);
        }

        void setMusicData(AllMusicModel.Data musicItem) {

            txtTitle.setText(musicItem.getTitle());
//            txtDesc.setText(musicItem);
            if (mediaPlayer != null) {
                mediaPlayer.stop();
                mediaPlayer.release();
                mediaPlayer = null;
            }
            mImageView.setOnClickListener(v -> {
                if (mediaPlayer.isPlaying()) {
                    //stop or pause your media player mediaPlayer.stop(); or mediaPlayer.pause();
                    play_pause_layout.setVisibility(View.VISIBLE);
                    play_pause_image.setImageResource(R.drawable.ic_round_play);
                    mediaPlayer.pause();
                } else {
                    mediaPlayer.start();
                    play_pause_layout.setVisibility(View.VISIBLE);
                    play_pause_image.setImageResource(R.drawable.ic_round_pause);
                    Handler handler = new Handler();
                    handler.postDelayed(() -> play_pause_layout.setVisibility(View.INVISIBLE), 4000);
                }
            });

            String audioUrl = ApiUrls.Api_LocalHost_Url + musicItem.getAudio();
            mediaPlayer = new MediaPlayer();
            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            try {
                mediaPlayer.setDataSource(audioUrl);
                mediaPlayer.prepareAsync();
                mediaPlayer.setOnPreparedListener(mediaPlayer -> {
                    mProgressBar.setVisibility(View.GONE);
                    mediaPlayer.start();
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
            mediaPlayer.setOnCompletionListener(MediaPlayer::start);
            String imageUrl = ApiUrls.Api_LocalHost_Url + musicItem.getImage();
            Glide.with(context)
                    .load(imageUrl)
                    .placeholder(R.drawable.loading)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .error(R.drawable.loading)
                    .into(mImageView);

        }
    }
}

music_layout.xml (Layout for Load Adater Data)

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@color/contentBodyColor"
  >

    <ImageView
        android:id="@+id/imageView"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:scaleType="centerCrop"
        android:layout_width="0dp"
        android:layout_height="0dp"/>
    <ProgressBar
        android:id="@+id/progressBar"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_width="30dp"
        android:layout_height="30dp"/>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/play_pause_layout"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_gravity="center"
        android:visibility="gone"
        android:background="@drawable/music_play_pause_bg"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/play_pause_image"
            android:layout_width="45dp"
            android:layout_height="45dp"
            android:contentDescription="@string/back_button"
            android:src="@drawable/ic_round_play"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>
    <LinearLayout
        android:layout_marginStart="5dp"
        android:layout_marginEnd="5dp"
        android:layout_marginBottom="80dp"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/txtTitle"
            android:paddingStart="5dp"
            android:paddingTop="5dp"
            android:paddingEnd="5dp"
            android:shadowColor="@android:color/black"
            android:shadowDx="0"
            android:shadowDy="0"
            android:shadowRadius="15"
            android:textColor="@android:color/white"
            android:textSize="25sp"
            android:textAlignment="center"
            android:fontFamily="@font/roboto_bold"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <TextView
            android:id="@+id/txtDesc"
            android:paddingStart="5dp"
            android:paddingTop="5dp"
            android:paddingEnd="5dp"
            android:shadowDx="0"
            android:shadowDy="0"
            android:shadowRadius="15"
            android:textColor="@android:color/white"
            android:textSize="10sp"
            android:shadowColor="@android:color/black"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:ignore="SmallSp" />

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

AllMusicModel.java

public class AllMusicModel {

    @SerializedName("statuscode")
    @Expose
    private Integer statuscode;
    @SerializedName("status")
    @Expose
    private String status;
    @SerializedName("message")
    @Expose
    private String message;
    @SerializedName("data")
    @Expose
    private List<Data> data = null;

    public Integer getStatuscode() {
        return statuscode;
    }

    public void setStatuscode(Integer statuscode) {
        this.statuscode = statuscode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<Data> getData() {
        return data;
    }

    public void setData(List<Data> data) {
        this.data = data;
    }
    public class Data {

        @SerializedName("id")
        @Expose
        private Integer id;
        @SerializedName("title")
        @Expose
        private String title;
        @SerializedName("image")
        @Expose
        private String image;
        @SerializedName("audio")
        @Expose
        private String audio;
        @SerializedName("time")
        @Expose
        private String time;
        @SerializedName("status")
        @Expose
        private String status;
        @SerializedName("createdAt")
        @Expose
        private String createdAt;
        @SerializedName("updatedAt")
        @Expose
        private String updatedAt;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getImage() {
            return image;
        }

        public void setImage(String image) {
            this.image = image;
        }

        public String getAudio() {
            return audio;
        }

        public void setAudio(String audio) {
            this.audio = audio;
        }

        public String getTime() {
            return time;
        }

        public void setTime(String time) {
            this.time = time;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getCreatedAt() {
            return createdAt;
        }

        public void setCreatedAt(String createdAt) {
            this.createdAt = createdAt;
        }

        public String getUpdatedAt() {
            return updatedAt;
        }

        public void setUpdatedAt(String updatedAt) {
            this.updatedAt = updatedAt;
        }

    }
}

Json Response From API

{"statuscode":200,"status":"Success","message":"Music List","data":[{"id":6,"title":"Faded","image":"1156127.jpg","audio":"waha.mp3","time":"Testing","status":"Testing","createdAt":"2022-10-05T20:36:56.000Z","updatedAt":"2022-10-05T20:36:56.000Z"},{"id":7,"title":"Drive Forever","image":"driveforever.jpg","audio":"driveforever.mp3","time":"Testing","status":"Testing","createdAt":"2022-10-05T20:46:51.000Z","updatedAt":"2022-10-05T20:46:51.000Z"}]}


问:
returning an NA value using a mean function in R
```<code>._883<-quantmod::getSymbols("0883.HK",from="2022-04-21",to="2022-12-22",auto.assign = FALSE)
._600938<-quantmod::getSymbols("600938.SS",from="2022-04-21",to="2022-12-22",auto.assign = FALSE)

x<-cbind(._883[,6],._600938[,6])
x$diff<-x[,2]-x[,1]
na.omit(x)

> mean(x[,3])
[1] NA
> class(x[,3])
[1] "xts" "zoo"
</code>```

Hi guys, mind taking a look at the data? I try to get the mean value for the third column but NA is returned.

Thanks to Martin Gal, adding na.rm=TRUE does the work perfectly!!

Body:
._883<-quantmod::getSymbols("0883.HK",from="2022-04-21",to="2022-12-22",auto.assign = FALSE)
._600938<-quantmod::getSymbols("600938.SS",from="2022-04-21",to="2022-12-22",auto.assign = FALSE)

x<-cbind(._883[,6],._600938[,6])
x$diff<-x[,2]-x[,1]
na.omit(x)

> mean(x[,3])
[1] NA
> class(x[,3])
[1] "xts" "zoo"

Hi guys, mind taking a look at the data? I try to get the mean value for the third column but NA is returned.

Thanks to Martin Gal, adding na.rm=TRUE does the work perfectly!!


问:
How to organize IntelliJ imports correctly after a refactoring
I was working on a JavaFX Desktop Application and for building reasons, I needed to refactor my project to encapsulate the packages into modules. After that, I realized that my imports were not pointing correctly to the beginning path of the packages.

Exemplifying, one of the imports was like this:
sudoku.constants.GameState

And it should've been like:
com.wissassblog.sudoku.computationlogic.GameState

Note that it adds the com.wissassblog first.

I could set it up manually, but this wouldn't be efficient when working on a larger project. Is there a faster way to correctly point to the right import path?

I've tried the following IntelliJ's tools:

Adding unambiguous imports on the fly;

Optimize imports;

But none of this fixed the path automatically.


问:
display detail page based on id?
I have multiple items coming from database, and I would like to see the details when I click on some of them based on the id.

```<code>if(mysqli_num_rows($result) > 0) {
                            while ($row = $result->fetch_assoc()) {
                            ?>
                                <a href="./pages/detail.php&id=<?php echo $row["id"] ?>"  class="home-card">
                                    <img src="upload/img/<?php echo $row["image"] ?>" alt="<?php echo $row["title"] ?>" class="mb-10">
                                    <div class="home-card__content">
                                        <h3 class="mb-10"><?php echo $row["title"] ?></h3>
                                        <h4 class="mb-10"><?php echo $row["artist"] ?> <?php echo $row["vocal"] ?></h4>
                                        <h4><?php echo $row["label"] ?></h4>
                                    </div>
                                </a>
</code>```

So, I have the correct url when I clicked on an item:

/pages/detail.php&id=2  --> this one doesn't work

But, I have a 404 Not Found when I click on any of these items:
The requested URL was not found on this server.

However if I only redirect to the detail page without the &id= the page is loading correctly

```<code><a href="./pages/detail.php"  class="home-card">
</code>```

/pages/detail.php --> this one works

Here's what I use in detail.php page:

```<code>if(isset($_GET["id"])) {
    $id = $_GET["id"];

    $stmt = $conn->prepare("SELECT m.id,m.artist, m.title, m.label, m.image, m.vocal, m.audio, m.created_at, g.name AS genre
                       FROM music m LEFT JOIN genre g
                       ON m.genre_id = g.id
                       WHERE m.id = :id");

    $stmt->bind_param("i", $id);

    $stmt->execute();

}

// Html code to display detail
</code>```

Any help would be appreciated, thanks!

Title: display detail page based on id?

Body:
I have multiple items coming from database, and I would like to see the details when I click on some of them based on the id.

if(mysqli_num_rows($result) > 0) {
                            while ($row = $result->fetch_assoc()) {
                            ?>
                                <a href="./pages/detail.php&id=<?php echo $row["id"] ?>"  class="home-card">
                                    <img src="upload/img/<?php echo $row["image"] ?>" alt="<?php echo $row["title"] ?>" class="mb-10">

<?php echo $row["title"] ?>

<?php echo $row["artist"] ?> <?php echo $row["vocal"] ?>

<?php echo $row["label"] ?>

So, I have the correct url when I clicked on an item:

/pages/detail.php&id=2  --> this one doesn't work

But, I have a 404 Not Found when I click on any of these items:
The requested URL was not found on this server.

However if I only redirect to the detail page without the &id= the page is loading correctly

/pages/detail.php --> this one works

Here's what I use in detail.php page:

if(isset($_GET["id"])) {
    $id = $_GET["id"];

    $stmt = $conn->prepare("SELECT m.id,m.artist, m.title, m.label, m.image, m.vocal, m.audio, m.created_at, g.name AS genre
                       FROM music m LEFT JOIN genre g
                       ON m.genre_id = g.id
                       WHERE m.id = :id");

    $stmt->bind_param("i", $id);

    $stmt->execute();

}

// Html code to display detail

Any help would be appreciated, thanks!


问:
How to use python inside of shellscript to run a powershell command?
Could anyone please assist me in accomplishing this? I'm trying to figure out if I can run this zowe cli command inside a python file which is inside a shell script file.

```<code>zowe zos-files list all-members "ZZZZ.XXX" -a
</code>```

For example my shell script and python file look like this

```<code>shell_script_file.sh

python3 python_file.py

-----------

python_file.py

import subprocess
subprocess.run(.....)
</code>```

When I run the shell script file, it prompts me for my hostname, userid, and password. However, it is not asked when I run the zowe command in the pwsh terminal. I'm trying to get the same result in the pwsh terminal using Python code.

One more thing, please..

I'm doing this because I need to look up the user of a Dataset member. Is there another way to find it in Python (like, without using subprocess)? I also use the zoautil_py module.

Body:
Could anyone please assist me in accomplishing this? I'm trying to figure out if I can run this zowe cli command inside a python file which is inside a shell script file.

zowe zos-files list all-members "ZZZZ.XXX" -a

For example my shell script and python file look like this

shell_script_file.sh

python3 python_file.py

-----------

python_file.py

import subprocess
subprocess.run(.....)

When I run the shell script file, it prompts me for my hostname, userid, and password. However, it is not asked when I run the zowe command in the pwsh terminal. I'm trying to get the same result in the pwsh terminal using Python code.

One more thing, please..

I'm doing this because I need to look up the user of a Dataset member. Is there another way to find it in Python (like, without using subprocess)? I also use the zoautil_py module.


问:
Spring Data JPA - How do I call a stored procedure that returns multiple out parameters but only need one out parameter
I have the following SQL Server stored procedure definition:

```<code>procedure [dbo].[perf] (
  @endDate date,
  @startDate date,
  @productName varchar(20),
  @endPrice decimal(10,2) output,
  @startPrice decimal(10,2) output,
  @startEv decimal(10,3) output,
  @endEv decimal(10,3) output) as ...
</code>```

I'm interested in only getting the @startPrice. I'm calling this stored procedure from a Spring Data Repository:

```<code>public interface PriceRepository extends Repository<Price, Long> {

    @Procedure(value="perf", outputParameterName = "startPrice")
    BigDecimal getStartPrice(@Param("endDate") LocalDate endDate, @Param("startDate") LocalDate startDate, @Param("productName") String productName);

}
</code>```

I get the following error though:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Procedure
or function 'perf' expects parameter '@startPrice', which was not
supplied.

But I did supply that as an output parameter. Why am I getting this error?

If I include @ i.e., change the outputParameterName to @startPrice, I still get the same error.

I've also tried removing ouptutParameterName and returning Map<String, Object> to get all output parameters. I get the following error in that case:

Caused by: org.hibernate.NotYetImplementedFor6Exception: Support for
JDBC CallableStatement parameter extraction not yet supported for
non-basic types

I'm using the 3.0.0 version of Spring Boot.

Body:
I have the following SQL Server stored procedure definition:

procedure [dbo].[perf] (
  @endDate date,
  @startDate date,
  @productName varchar(20),
  @endPrice decimal(10,2) output,
  @startPrice decimal(10,2) output,
  @startEv decimal(10,3) output,
  @endEv decimal(10,3) output) as ...

I'm interested in only getting the @startPrice. I'm calling this stored procedure from a Spring Data Repository:

public interface PriceRepository extends Repository<Price, Long> {

    @Procedure(value="perf", outputParameterName = "startPrice")
    BigDecimal getStartPrice(@Param("endDate") LocalDate endDate, @Param("startDate") LocalDate startDate, @Param("productName") String productName);

}

I get the following error though:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Procedure
or function 'perf' expects parameter '@startPrice', which was not
supplied.

But I did supply that as an output parameter. Why am I getting this error?

If I include @ i.e., change the outputParameterName to @startPrice, I still get the same error.

I've also tried removing ouptutParameterName and returning Map<String, Object> to get all output parameters. I get the following error in that case:

Caused by: org.hibernate.NotYetImplementedFor6Exception: Support for
JDBC CallableStatement parameter extraction not yet supported for
non-basic types

I'm using the 3.0.0 version of Spring Boot.


问:
Is there any way to imlement a rotating proxy based HttpClient in reactor netty?
As per the available examples and documentation, it seems that the way to use a proxy with an http-client is like so:

```<code>HttpClient.create()
        .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 2_000)
        .doOnConnected(connection ->
                connection
                        .addHandlerLast(new ReadTimeoutHandler(2_000, TimeUnit.MILLISECONDS))
                        .addHandlerLast(new WriteTimeoutHandler(2_000, TimeUnit.MILLISECONDS)))
        .proxy(proxy -> proxy
                .type(ProxyProvider.Proxy.HTTP)
                .host((${host})
                .port(${port})
                .build()));
</code>```

It seems like in this setup, once initialized, it is not possible to change the host of the proxy. So, how would one go about implementing a rotating proxy? like

It is possible to do it apache httpclient4 where one can configure a different proxy per request using RequestConfig in the following manner:

```<code>RequestConfig config = RequestConfig.custom()
.setProxy(new HttpHost(proxyHost, port, "https"))
.build();
</code>```

However, httpclient4 is a blocking client library and i couldn't find any reactive alternative that can work with WebClient in Spring Boot

Body:
As per the available examples and documentation, it seems that the way to use a proxy with an http-client is like so:

HttpClient.create()
        .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 2_000)
        .doOnConnected(connection ->
                connection
                        .addHandlerLast(new ReadTimeoutHandler(2_000, TimeUnit.MILLISECONDS))
                        .addHandlerLast(new WriteTimeoutHandler(2_000, TimeUnit.MILLISECONDS)))
        .proxy(proxy -> proxy
                .type(ProxyProvider.Proxy.HTTP)
                .host((${host})
                .port(${port})
                .build()));

It seems like in this setup, once initialized, it is not possible to change the host of the proxy. So, how would one go about implementing a rotating proxy? like

It is possible to do it apache httpclient4 where one can configure a different proxy per request using RequestConfig in the following manner:

RequestConfig config = RequestConfig.custom()
.setProxy(new HttpHost(proxyHost, port, "https"))
.build();

However, httpclient4 is a blocking client library and i couldn't find any reactive alternative that can work with WebClient in Spring Boot


问:
react native gifted chat with memo
is there a way to put memo with gifted chat and rerender only when new message added ?

```<code>      <GiftedChat
        messages={messages}
        renderMessage={() => }
        onSend={messages => onHandleSend(messages)}
        onPressAvatar={handleNavigateToUser}
        renderActions={renderAction}
        renderChatFooter={renderChatFooter}
        keyboardShouldPersistTaps='handled'
        text={image && ' '}
        alwaysShowSend={true}
        locale='DE'
        user={{
          _id: 1,
        }}
      />
</code>```

if I set a any state all rerenders so that bad with a lot of images

Title: react native gifted chat with memo

Body:
is there a way to put memo with gifted chat and rerender only when new message added ?

      <GiftedChat
        messages={messages}
        renderMessage={() => }
        onSend={messages => onHandleSend(messages)}
        onPressAvatar={handleNavigateToUser}
        renderActions={renderAction}
        renderChatFooter={renderChatFooter}
        keyboardShouldPersistTaps='handled'
        text={image && ' '}
        alwaysShowSend={true}
        locale='DE'
        user={{
          _id: 1,
        }}
      />

if I set a any state all rerenders so that bad with a lot of images


问:
Electron-builder portable app set temp path constant for launch
I am working on a portable electron application which gets triggered by a java process. However, I am seeing a time of approx 20 seconds for the window to come up. Size of the exe is ~80MB

I am looking for ways to speed up the app launch.
One observation, once the app launches, there is a folder inside tmp dir which contains the exploded exe. Can we somehow reuse this folder? This would mean the exe does not need to be exploded again and theoretically it should save some time.

Or is there any other configuration to reduce this start-up time? Maybe something like changing the compression algo, or some flags in config? etc.

Any help appreciated.

I am expecting any kind of configuration settings that can help speedup electron launch


问:
Quarkus Docker App Running Differently Locally vs Kubernetes
Using the generic Dockerfile provided by Quarkus, we try to create a Docker instance of an app to then deploy in our Kubernetes environment:

```<code>FROM registry.access.redhat.com/ubi8/openjdk-11:1.14

ENV LANGUAGE='en_US:en'

COPY --chown=185 ourApp/target/*-runner.jar /deployments/app.jar

EXPOSE 8080
USER 185
ENV AB_JOLOKIA_OFF=""
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/app.jar"

WORKDIR /deployments
</code>```

All of this works great locally - but once deployed to Kubernetes, we suddenly get a vertx.impl error:

```<code>$ kubectl logs -f po/app-11111111-ddddd -n appNamespace
io.quarkus.opentelemetry.runtime.exporter.otlp.LateBoundBatchSpanProcessor logDelegateNotFound
WARN: No BatchSpanProcessor delegate specified, no action taken.
Dec 22, 2022 8:05:03 PM io.quarkus.runtime.StartupContext runAllInReverseOrder
ERROR: Running a shutdown task failed
java.lang.NoClassDefFoundError: Could not initialize class io.vertx.core.impl.VertxImpl
    at io.vertx.core.impl.ContextInternal.current(ContextInternal.java:46)
    at io.vertx.core.Vertx.currentContext(Vertx.java:117)
    at io.quarkus.vertx.runtime.VertxCurrentContextFactory$VertxCurrentContext.get(VertxCurrentContextFactory.java:30)
    at io.quarkus.arc.impl.RequestContext.destroy(RequestContext.java:177)
    at io.quarkus.arc.ManagedContext.terminate(ManagedContext.java:36)
    at io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:382)
    at io.quarkus.arc.Arc.shutdown(Arc.java:58)
    at io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:47)
    at io.quarkus.runtime.StartupContext.runAllInReverseOrder(StartupContext.java:84)
    at io.quarkus.runtime.StartupContext.close(StartupContext.java:73)
    at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
    at io.quarkus.runtime.Application.start(Application.java:101)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:43)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:123)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)

Dec 22, 2022 8:05:03 PM io.quarkus.runtime.ApplicationLifecycleManager run
ERROR: Failed to start application (with profile prod)
java.lang.NoClassDefFoundError: Could not initialize class io.vertx.core.logging.LoggerFactory
    at io.vertx.core.impl.logging.LoggerFactory.getLogger(LoggerFactory.java:26)
    at io.vertx.core.impl.AddressResolver.<clinit>(AddressResolver.java:39)
    at io.vertx.core.dns.AddressResolverOptions.<clinit>(AddressResolverOptions.java:79)
    at io.vertx.core.VertxOptions.<init>(VertxOptions.java:131)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:201)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:610)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:592)
    at io.quarkus.opentelemetry.runtime.OpenTelemetryRecorder.storeVertxOnContextStorage(OpenTelemetryRecorder.java:47)
    at io.quarkus.deployment.steps.OpenTelemetryProcessor$storeVertxOnContextStorage1193902621.deploy_0(Unknown Source)
    at io.quarkus.deployment.steps.OpenTelemetryProcessor$storeVertxOnContextStorage1193902621.deploy(Unknown Source)
    at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
    at io.quarkus.runtime.Application.start(Application.java:101)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:43)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:123)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)
</code>```

This happens no matter what configurations I change - I can't seem to get past it.

Once again, this WORKS LOCALLY with the SAME Docker image.  Once deployed, it suddenly cant find the class definition.

Does anyone have any idea what is going on here?  Is this masking another error that I am not aware of?

Thanks!

Body:
Using the generic Dockerfile provided by Quarkus, we try to create a Docker instance of an app to then deploy in our Kubernetes environment:

FROM registry.access.redhat.com/ubi8/openjdk-11:1.14

ENV LANGUAGE='en_US:en'

COPY --chown=185 ourApp/target/*-runner.jar /deployments/app.jar

EXPOSE 8080
USER 185
ENV AB_JOLOKIA_OFF=""
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/app.jar"

WORKDIR /deployments

All of this works great locally - but once deployed to Kubernetes, we suddenly get a vertx.impl error:

$ kubectl logs -f po/app-11111111-ddddd -n appNamespace
io.quarkus.opentelemetry.runtime.exporter.otlp.LateBoundBatchSpanProcessor logDelegateNotFound
WARN: No BatchSpanProcessor delegate specified, no action taken.
Dec 22, 2022 8:05:03 PM io.quarkus.runtime.StartupContext runAllInReverseOrder
ERROR: Running a shutdown task failed
java.lang.NoClassDefFoundError: Could not initialize class io.vertx.core.impl.VertxImpl
    at io.vertx.core.impl.ContextInternal.current(ContextInternal.java:46)
    at io.vertx.core.Vertx.currentContext(Vertx.java:117)
    at io.quarkus.vertx.runtime.VertxCurrentContextFactory$VertxCurrentContext.get(VertxCurrentContextFactory.java:30)
    at io.quarkus.arc.impl.RequestContext.destroy(RequestContext.java:177)
    at io.quarkus.arc.ManagedContext.terminate(ManagedContext.java:36)
    at io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:382)
    at io.quarkus.arc.Arc.shutdown(Arc.java:58)
    at io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:47)
    at io.quarkus.runtime.StartupContext.runAllInReverseOrder(StartupContext.java:84)
    at io.quarkus.runtime.StartupContext.close(StartupContext.java:73)
    at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
    at io.quarkus.runtime.Application.start(Application.java:101)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:43)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:123)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)

Dec 22, 2022 8:05:03 PM io.quarkus.runtime.ApplicationLifecycleManager run
ERROR: Failed to start application (with profile prod)
java.lang.NoClassDefFoundError: Could not initialize class io.vertx.core.logging.LoggerFactory
    at io.vertx.core.impl.logging.LoggerFactory.getLogger(LoggerFactory.java:26)
    at io.vertx.core.impl.AddressResolver.<clinit>(AddressResolver.java:39)
    at io.vertx.core.dns.AddressResolverOptions.<clinit>(AddressResolverOptions.java:79)
    at io.vertx.core.VertxOptions.<init>(VertxOptions.java:131)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:201)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:610)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:592)
    at io.quarkus.opentelemetry.runtime.OpenTelemetryRecorder.storeVertxOnContextStorage(OpenTelemetryRecorder.java:47)
    at io.quarkus.deployment.steps.OpenTelemetryProcessor$storeVertxOnContextStorage1193902621.deploy_0(Unknown Source)
    at io.quarkus.deployment.steps.OpenTelemetryProcessor$storeVertxOnContextStorage1193902621.deploy(Unknown Source)
    at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
    at io.quarkus.runtime.Application.start(Application.java:101)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:43)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:123)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)

This happens no matter what configurations I change - I can't seem to get past it.

Once again, this WORKS LOCALLY with the SAME Docker image.  Once deployed, it suddenly cant find the class definition.

Does anyone have any idea what is going on here?  Is this masking another error that I am not aware of?

Thanks!