问:
Linking to static build of QT and QSvgPlugin from conancenter repository. QSvgPlugin is not found
I have qt/6.4.1 as a dependancy in my project.

My conanfile.py looks like this:

```<code>class RainEditorConan(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    requires = "qt/6.4.1" # comma-separated list of requirements
    default_options = {"qt:shared": False, "qt:opengl": "desktop", "qt:qtsvg": True}
</code>```

Since these set of options are not present on the qt repository on conancenter, I build qt from source using the --build=qt flag

Now, my CMakeLists.txt looks like this:

```<code>cmake_minimum_required(VERSION 3.16)

project(helloworld VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(helloworld
src/main.cpp
src/res.qrc
)
target_include_directories(helloworld PRIVATE src)

# Link to Qt
find_package(Qt6 REQUIRED COMPONENTS Widgets QWindowsIntegrationPlugin Svg QSvgPlugin)
qt_standard_project_setup()

target_link_libraries(helloworld PRIVATE Qt6::Widgets Qt6::QWindowsIntegrationPlugin Qt6::Svg Qt6::QSvgPlugin)
</code>```

Now, my main.cpp tries to display an SVG resource (defined in the qrc file):

```<code>#include <QtWidgets>
#include <iostream>
#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QSvgPlugin)

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Create a window.
    QMainWindow mainWindow;
    mainWindow.setWindowTitle("Example");
    mainWindow.resize(800, 600);

    QLabel* l = new QLabel();
    QPixmap pixmap(":/close.svg");
    l->setPixmap(pixmap);

    // Add label to the window.
    mainWindow.setCentralWidget(l);

    mainWindow.show();

    return app.exec();
}
</code>```

When I configure my cmake project, I get the following error:

```<code>Target "helloworld" links to:
[cmake]
[cmake]     Qt6::QSvgPlugin
[cmake]
[cmake]   but the target was not found.
</code>```

If I remove the linking to QSvgPlugin, then it configures correctly but I get the following error while building my project:

```<code>error LNK2019: unresolved external symbol "struct QStaticPlugin const __cdecl qt_static_plugin_QSvgPlugin(void)"
</code>```

Now, this symbol is defined in the plugin library qsvgd.lib which is inside the conan installation, so if I link to this manually by writing out the full path, it builds and runs correctly:

```<code>target_link_libraries(helloworld PRIVATE Qt6::Widgets Qt6::QWindowsIntegrationPlugin Qt6::Svg "C://.conan//8126c6//1//res//archdatadir//plugins//imageformats//qsvgd.lib")
</code>```

If I don't link to this plugin, and remove the Q_IMPORT_PLUGIN(QSvgPlugin) line from my source code, then it configures and builds correctly but cannot display the SVG when run

Which target should I link to, to link to the correct svg plugin library? It seems that the conan qt repository's exported cmake files do not expose this library as a target.

Body:
I have qt/6.4.1 as a dependancy in my project.

My conanfile.py looks like this:

class RainEditorConan(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    requires = "qt/6.4.1" # comma-separated list of requirements
    default_options = {"qt:shared": False, "qt:opengl": "desktop", "qt:qtsvg": True}

Since these set of options are not present on the qt repository on conancenter, I build qt from source using the --build=qt flag

Now, my CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.16)

project(helloworld VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(helloworld
src/main.cpp
src/res.qrc
)
target_include_directories(helloworld PRIVATE src)

# Link to Qt
find_package(Qt6 REQUIRED COMPONENTS Widgets QWindowsIntegrationPlugin Svg QSvgPlugin)
qt_standard_project_setup()

target_link_libraries(helloworld PRIVATE Qt6::Widgets Qt6::QWindowsIntegrationPlugin Qt6::Svg Qt6::QSvgPlugin)

Now, my main.cpp tries to display an SVG resource (defined in the qrc file):

#include <QtWidgets>
#include <iostream>
#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QSvgPlugin)

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Create a window.
    QMainWindow mainWindow;
    mainWindow.setWindowTitle("Example");
    mainWindow.resize(800, 600);

    QLabel* l = new QLabel();
    QPixmap pixmap(":/close.svg");
    l->setPixmap(pixmap);

    // Add label to the window.
    mainWindow.setCentralWidget(l);

    mainWindow.show();

    return app.exec();
}

When I configure my cmake project, I get the following error:

Target "helloworld" links to:
[cmake]
[cmake]     Qt6::QSvgPlugin
[cmake]
[cmake]   but the target was not found.

If I remove the linking to QSvgPlugin, then it configures correctly but I get the following error while building my project:

error LNK2019: unresolved external symbol "struct QStaticPlugin const __cdecl qt_static_plugin_QSvgPlugin(void)"

Now, this symbol is defined in the plugin library qsvgd.lib which is inside the conan installation, so if I link to this manually by writing out the full path, it builds and runs correctly:

target_link_libraries(helloworld PRIVATE Qt6::Widgets Qt6::QWindowsIntegrationPlugin Qt6::Svg "C://.conan//8126c6//1//res//archdatadir//plugins//imageformats//qsvgd.lib")

If I don't link to this plugin, and remove the Q_IMPORT_PLUGIN(QSvgPlugin) line from my source code, then it configures and builds correctly but cannot display the SVG when run

Which target should I link to, to link to the correct svg plugin library? It seems that the conan qt repository's exported cmake files do not expose this library as a target.


来源: stackexchange

问:
Error while restarting the Tkinter program dynamically by destroying root and recreating again by calling functions
```<code>import configparser
from tkinter import *
from tkinter import filedialog,messagebox
from tkinter.filedialog import asksaveasfile
from customtkinter import *
import os
import time
import wikipedia
config=configparser.ConfigParser()
config.read("config.ini")
def change_config():
    messagebox.showinfo("Information","App is going to restart in few seconds")
    print(mode.get())
    print(color.get())
    global location
    config.set("THEME","mode",str(mode.get()))
    config.set("VOICE","voice",str(gender.get()))
    if color.get() =="pink":
        location="C:/Users/DELL/Documents/python programs/notepad/custom_theme.json"
        config.set("THEME","color",location)
    else :
        config.set("THEME","color",color.get())
    with open("config.ini","w") as configfile:
        config.write(configfile)
    restart()

def main():
    global root,label,frame1,config_color,config_mode,config_gender
    root=CTk()
    root.geometry("700x600")
    root.resizable(0,0)
    root.title("Notepad")
    frame1=CTkFrame(root,width=150,height=580)
    frame1.pack_propagate(False)
    frame1.place(x=10,y=10)
    config_color=config.get("THEME","color")
    config_mode=config.get("THEME","mode")
    config_gender=config.get("VOICE","voice")
    set_appearance_mode(config_mode)
    set_default_color_theme(config_color)

    label=CTkLabel(root,text="File",width=520,height=40,font=("Algerian",30))
    label.place(x=170,y=10)

    global S
    global text_area
    text_area=CTkTextbox(root,height=580,width=520,)
    text_area.place(x=170,y=60)

    global button,commands,button_text
    button_text="Settings"
    commands=settings
    button=CTkButton(frame1,text=button_text,command=settings)
        button.pack(padx=10,pady=10)

    root.mainloop()

def settings():
    global submit,mode,color,config_color,config_mode,gender
    window=CTkToplevel(root)
    window.title("Settings")
    window.geometry("200x300")
    label1=CTkLabel(window,text="Mode").pack(pady=5)
    mode=CTkOptionMenu(window,values=["light","dark"])
    mode.pack(pady=5,padx=5,anchor=CENTER)
    label2=CTkLabel(window,text="Color").pack(pady=5)

    color=CTkOptionMenu(window,values=["pink","blue","green","dark-blue"])
    color.pack(pady=5)
    label3=CTkLabel(window,text="speech-gender").pack(pady=5)
    gender=CTkOptionMenu(window,values=["male","female"])
    gender.pack(pady=5)
    submit=CTkButton(window,text="Submit",command=change_config)
    submit.pack(pady=20)
    window.mainloop()

if __name__=="__main__":
    def restart():
        time.sleep(5)
        root.destroy()
        main()

    main()
</code>```

I want to create a notepad , where we can change themes and colors.
I have made config.ini file where i save the current mode, color and the voice type for the notepad ( voicetype is for text-to-speech functionality that i have added here ) becuase while using customtkinter we can set default color theme and cannot change it once initialized in a program.
The program now save the selected preferences in config.ini file and grab it when run again.
I want the program to run again itself without having the need to explicitly run it again.

Though program is running i am still getting this error at backend:

```<code>invalid command name "2912423726080check_dpi_scaling"
    while executing
"2912423726080check_dpi_scaling"
    ("after" script)
invalid command name "2912423728512update"
    while executing
"2912423728512update"
    ("after" script)
invalid command name "2912423728448<lambda>"
    while executing
"2912423728448<lambda>"
    ("after" script)
</code>```

I want to know what this error means so that the users might not face problem in future while using this app.
Thanks in advance for helping.

ContentLicense: CC BY-SA 4.0

Body:
import configparser
from tkinter import *
from tkinter import filedialog,messagebox
from tkinter.filedialog import asksaveasfile
from customtkinter import *
import os
import time
import wikipedia
config=configparser.ConfigParser()
config.read("config.ini")
def change_config():
    messagebox.showinfo("Information","App is going to restart in few seconds")
    print(mode.get())
    print(color.get())
    global location
    config.set("THEME","mode",str(mode.get()))
    config.set("VOICE","voice",str(gender.get()))
    if color.get() =="pink":
        location="C:/Users/DELL/Documents/python programs/notepad/custom_theme.json"
        config.set("THEME","color",location)
    else :
        config.set("THEME","color",color.get())
    with open("config.ini","w") as configfile:
        config.write(configfile)
    restart()

def main():
    global root,label,frame1,config_color,config_mode,config_gender
    root=CTk()
    root.geometry("700x600")
    root.resizable(0,0)
    root.title("Notepad")
    frame1=CTkFrame(root,width=150,height=580)
    frame1.pack_propagate(False)
    frame1.place(x=10,y=10)
    config_color=config.get("THEME","color")
    config_mode=config.get("THEME","mode")
    config_gender=config.get("VOICE","voice")
    set_appearance_mode(config_mode)
    set_default_color_theme(config_color)

    label=CTkLabel(root,text="File",width=520,height=40,font=("Algerian",30))
    label.place(x=170,y=10)

    global S
    global text_area
    text_area=CTkTextbox(root,height=580,width=520,)
    text_area.place(x=170,y=60)

    global button,commands,button_text
    button_text="Settings"
    commands=settings
    button=CTkButton(frame1,text=button_text,command=settings)
        button.pack(padx=10,pady=10)

    root.mainloop()

def settings():
    global submit,mode,color,config_color,config_mode,gender
    window=CTkToplevel(root)
    window.title("Settings")
    window.geometry("200x300")
    label1=CTkLabel(window,text="Mode").pack(pady=5)
    mode=CTkOptionMenu(window,values=["light","dark"])
    mode.pack(pady=5,padx=5,anchor=CENTER)
    label2=CTkLabel(window,text="Color").pack(pady=5)

    color=CTkOptionMenu(window,values=["pink","blue","green","dark-blue"])
    color.pack(pady=5)
    label3=CTkLabel(window,text="speech-gender").pack(pady=5)
    gender=CTkOptionMenu(window,values=["male","female"])
    gender.pack(pady=5)
    submit=CTkButton(window,text="Submit",command=change_config)
    submit.pack(pady=20)
    window.mainloop()

if __name__=="__main__":
    def restart():
        time.sleep(5)
        root.destroy()
        main()

    main()

I want to create a notepad , where we can change themes and colors.
I have made config.ini file where i save the current mode, color and the voice type for the notepad ( voicetype is for text-to-speech functionality that i have added here ) becuase while using customtkinter we can set default color theme and cannot change it once initialized in a program.
The program now save the selected preferences in config.ini file and grab it when run again.
I want the program to run again itself without having the need to explicitly run it again.

Though program is running i am still getting this error at backend:

invalid command name "2912423726080check_dpi_scaling"
    while executing
"2912423726080check_dpi_scaling"
    ("after" script)
invalid command name "2912423728512update"
    while executing
"2912423728512update"
    ("after" script)
invalid command name "2912423728448<lambda>"
    while executing
"2912423728448<lambda>"
    ("after" script)

I want to know what this error means so that the users might not face problem in future while using this app.
Thanks in advance for helping.


问:
youtube_dl with progress bar and tkinter
Last week I asked this question and get an answer that advanced me to this code:

```<code>def progress_Check():
    return f"Current Progress: {pb['value']}%"

def Download_Songs():
    links=LinkText.get("1.0",'end-1c').split()
    directory=SaveEntry.get()

    # importing packages
    import youtube_dl
    import shutil
    import os

    ydl_opts = {'progress_hooks': [my_hook],
                'postprocessors': [{'key': 'FFmpegExtractAudio',
                                    'preferredcodec': 'mp3',
                                    'preferredquality': '192'}]}

    for link in links:
        with youtube_dl.YoutubeDL(ydl_opts) as ydl:
            ydl.download([link])

    for file in os.listdir("."):
        if file.endswith(".mp3"):
            newfile = file[:-16]+".mp3"
            shutil.move(file, os.path.join(directory, newfile))   # move the file without the search title

def my_hook(d):
    if d['status'] == 'finished':
        print('Done downloading, now converting ...')
    if d['status'] == 'downloading':
        if pb['value'] < 100:
            pb['value'] = 100 - (((d['total_bytes'] - d['downloaded_bytes']) / d['total_bytes']) * 100)
            value_label['text'] = progress_Check()

def SearchDir():
    location = filedialog.askdirectory()
    directory.set(location)

from tkinter import filedialog
from tkinter import ttk
import tkinter as tk

root = tk.Tk()
# Label for the links to download
LinksFrame = tk.Frame(root)
LinkLabel = tk.Label(LinksFrame, text="Enter links here")
LinkText = tk.Text(LinksFrame, width=65, height=15)
LinksFrame.pack(pady=6)
LinkLabel.pack(side=tk.LEFT)
LinkText.pack(side=tk.RIGHT)

# This frame is for the downloaded directory.
directory = tk.StringVar()
directory.set("")
LocationFrame = tk.Frame(root)
SaveLabel = tk.Label(LocationFrame, text=" Download to:", padx=3)
SaveEntry = tk.Entry(LocationFrame, text=directory, width=80)
SaveButton = tk.Button(LocationFrame, text="Browse", command=SearchDir)
LocationFrame.pack(pady=3)
SaveLabel.pack(side=tk.LEFT)
SaveEntry.pack(side=tk.LEFT)
SaveButton.pack(side=tk.RIGHT, padx=5)

# Progress bar settings
pb = ttk.Progressbar(root, orient='horizontal', mode='determinate', length=280)
pb.pack()
# Progress bar label
value_label = ttk.Label(root, text=progress_Check)
value_label.pack()

# download button
DownloadButton = tk.Button(root, text="Download", command=Download_Songs)
DownloadButton.pack(pady=7)

root.mainloop()
</code>```

The issue is that the progress bar just appear and don't progress as there is no call for the progress bar.... but how I link the youtube_dl information to the progress bar?

(need to write some lines to be able to post the question....)

Body:
Last week I asked this question and get an answer that advanced me to this code:

def progress_Check():
    return f"Current Progress: {pb['value']}%"

def Download_Songs():
    links=LinkText.get("1.0",'end-1c').split()
    directory=SaveEntry.get()

    # importing packages
    import youtube_dl
    import shutil
    import os

    ydl_opts = {'progress_hooks': [my_hook],
                'postprocessors': [{'key': 'FFmpegExtractAudio',
                                    'preferredcodec': 'mp3',
                                    'preferredquality': '192'}]}

    for link in links:
        with youtube_dl.YoutubeDL(ydl_opts) as ydl:
            ydl.download([link])

    for file in os.listdir("."):
        if file.endswith(".mp3"):
            newfile = file[:-16]+".mp3"
            shutil.move(file, os.path.join(directory, newfile))   # move the file without the search title

def my_hook(d):
    if d['status'] == 'finished':
        print('Done downloading, now converting ...')
    if d['status'] == 'downloading':
        if pb['value'] < 100:
            pb['value'] = 100 - (((d['total_bytes'] - d['downloaded_bytes']) / d['total_bytes']) * 100)
            value_label['text'] = progress_Check()

def SearchDir():
    location = filedialog.askdirectory()
    directory.set(location)

from tkinter import filedialog
from tkinter import ttk
import tkinter as tk

root = tk.Tk()
# Label for the links to download
LinksFrame = tk.Frame(root)
LinkLabel = tk.Label(LinksFrame, text="Enter links here")
LinkText = tk.Text(LinksFrame, width=65, height=15)
LinksFrame.pack(pady=6)
LinkLabel.pack(side=tk.LEFT)
LinkText.pack(side=tk.RIGHT)

# This frame is for the downloaded directory.
directory = tk.StringVar()
directory.set("")
LocationFrame = tk.Frame(root)
SaveLabel = tk.Label(LocationFrame, text=" Download to:", padx=3)
SaveEntry = tk.Entry(LocationFrame, text=directory, width=80)
SaveButton = tk.Button(LocationFrame, text="Browse", command=SearchDir)
LocationFrame.pack(pady=3)
SaveLabel.pack(side=tk.LEFT)
SaveEntry.pack(side=tk.LEFT)
SaveButton.pack(side=tk.RIGHT, padx=5)

# Progress bar settings
pb = ttk.Progressbar(root, orient='horizontal', mode='determinate', length=280)
pb.pack()
# Progress bar label
value_label = ttk.Label(root, text=progress_Check)
value_label.pack()

# download button
DownloadButton = tk.Button(root, text="Download", command=Download_Songs)
DownloadButton.pack(pady=7)

root.mainloop()

The issue is that the progress bar just appear and don't progress as there is no call for the progress bar.... but how I link the youtube_dl information to the progress bar?

(need to write some lines to be able to post the question....)


问:
Setting the Apache 404 redirect for error page based on the language locale
We are trying to set the error page redirection on apache based on the language . we are using the same virtual host for all the languages and all 404 pages are redirecting to only en_us language page . we want to redirect based on the language like ja_jp and de_de

We have tried setting the redirection rules and also location match . None of them are worked

using the locationmatch

```<code>  ErrorDocument 404 /ja_jp/error/404.html
</LocationMatch>

<LocationMatch “^/en_us/(.*)”>
  ErrorDocument 404 /en_us/error/404.html
</LocationMatch>

2) using the rewrite rule
RewriteCond %{ENV:REDIRECT_STATUS} 404
RewriteCond %{REQUEST_URI} ^/de_de/* [NC]
RewriteRule ^ /content/splunkcom/de_de/error/404.html [R=404,L]````
```

Body:
We are trying to set the error page redirection on apache based on the language . we are using the same virtual host for all the languages and all 404 pages are redirecting to only en_us language page . we want to redirect based on the language like ja_jp and de_de

We have tried setting the redirection rules and also location match . None of them are worked

using the locationmatch

  ErrorDocument 404 /ja_jp/error/404.html
</LocationMatch>

<LocationMatch “^/en_us/(.*)”>
  ErrorDocument 404 /en_us/error/404.html
</LocationMatch>

2) using the rewrite rule
RewriteCond %{ENV:REDIRECT_STATUS} 404
RewriteCond %{REQUEST_URI} ^/de_de/* [NC]
RewriteRule ^ /content/splunkcom/de_de/error/404.html [R=404,L]````


问:
IntelliJ:Rest Assured getting missing input or config
Can anyone help me
Project has been cloned from Bitbucket and locally when i am running the project in the intelliJ the error is displayed
Unable to run the scripts-rest assured in the IntelliJ getting missing input or config. Getting build failure if I change the swagger code-gen dependency  also same error is displayed
this is my gradle.build</p>
```<code>Buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath("io.swagger:swagger-codegen:2.3.1")
  }
}

plugins {
  id 'java'
  id 'io.qameta.allure' version '2.8.1'
}
repositories {
  mavenCentral()
}

group 'org.example'
version '1.0-SNAPSHOT'
apply plugin: 'base'

import io.swagger.codegen.DefaultGenerator
import io.swagger.codegen.config.CodegenConfigurator

final def swaggerInput = "swagger.json"
final def swaggerOutputDir = file('build/swagger')

task generateApi {
  inputs.file(swaggerInput)
  outputs.dir(swaggerOutputDir)

  doLast {
    final def config = new CodegenConfigurator()
    config.setInputSpec(swaggerInput)
    config.setOutputDir(swaggerOutputDir.path)
    config.setLang('java')
    config.setAdditionalProperties([

            'dateLibrary' : 'java8'])
    config.setImportMappings([
            'java.time.OffsetDateTime': 'java.time.Instant',])
    config.setTypeMappings([
            OffsetDateTime: 'Instant',])
    new DefaultGenerator().opts(config.toClientOptInput()).generate()
  }
}

clean.doFirst {
  delete(swaggerOutputDir)
}

configurations {
  swagger
}

sourceSets {
  swagger {
    compileClasspath = configurations.swaggerCompile
    java {
      srcDir file("${project.buildDir.path}/swagger/src/main/java")
    }
  }
  main {
    compileClasspath += swagger.output
    runtimeClasspath += swagger.output
  }
  test {
    compileClasspath += swagger.output
    runtimeClasspath += swagger.output
  }
}

compileSwaggerJava.dependsOn generateApi
classes.dependsOn swaggerClasses
compileJava.dependsOn compileSwaggerJava

allure {
  version = '2.7.0'
  downloadLinkFormat = 'https://github.com/allure-framework/allure2/releases/download/2.7.0/allure-2.7.0.zip'
}
dependencies {

  // https://mvnrepository.com/artifact/io.rest-assured/rest-assured
  compile group: 'io.rest-assured', name: 'rest-assured', version: '4.3.0'

  // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
  compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.11.0'

  // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
  compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'

  // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310
  compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.11.0'

  // https://mvnrepository.com/artifact/org.json/json
  compile group: 'org.json', name: 'json', version: '20190722'

  compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.6'
  compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.6'
  compile group: 'com.google.code.gson', name: 'gson', version: '2.1'
  compile group: 'io.gsonfire', name: 'gson-fire', version: '1.7.1'

  // https://mvnrepository.com/artifact/org.testng/testng
  compile group: 'org.testng', name: 'testng', version: '7.0.0'

  // https://mvnrepository.com/artifact/org.assertj/assertj-core
  compile group: 'org.assertj', name: 'assertj-core', version: '3.16.0'

  // https://mvnrepository.com/artifact/io.qameta.allure/allure-rest-assured
  compile group: 'io.qameta.allure', name: 'allure-rest-assured', version: '2.13.5'

  // https://mvnrepository.com/artifact/io.qameta.allure/allure-testng
  compile group: 'io.qameta.allure', name: 'allure-testng', version: '2.13.5'

  // https://mvnrepository.com/artifact/org.aeonbits.owner/owner
  compile group: 'org.aeonbits.owner', name: 'owner', version: '1.0.10'

  // AWS SDK dependencies
  compile 'com.amazonaws:aws-java-sdk:1.12.335'
  compile 'com.amazonaws:aws-java-sdk-core:1.12.335'
  compile 'com.amazonaws:aws-java-sdk-cognitoidp:1.12.335'
  compile 'com.amazonaws:aws-java-sdk-ssm:1.12.335'
  compile 'software.amazon.awssdk:ssm:2.18.10'

  compile 'org.projectlombok:lombok:1.18.12'
  annotationProcessor 'org.projectlombok:lombok:1.18.12'

  compile 'org.projectlombok:lombok:1.18.12'
  annotationProcessor 'org.projectlombok:lombok:1.18.12'

  swaggerCompile 'io.swagger:swagger-annotations:1.5.16'
  swaggerCompile 'com.squareup.okhttp:okhttp:2.7.5'
  swaggerCompile 'com.squareup.okhttp:logging-interceptor:2.7.5'
  swaggerCompile 'com.google.code.gson:gson:2.8.1'
  swaggerCompile 'io.gsonfire:gson-fire:1.7.1'

  compile sourceSets.swagger.output

  testCompile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.2.4'
  testCompile 'org.elasticsearch:elasticsearch:6.2.4'

  compile 'com.squareup.okio:okio:1.8.0'
  compile 'com.squareup.okhttp:okhttp:2.4.0'
}
test() {

  useTestNG() {

    if (project.hasProperty('qa4')) {
      environment 'env', 'qa4'
    }
    if (project.hasProperty('qa5')) {
      environment 'env', 'qa5'
    }
    if (project.hasProperty('qa6')) {
      environment 'env', 'qa6'
    }
    if (project.hasProperty('qa7')) {
      environment 'env', 'qa7'
    }
    if (project.hasProperty('qa8')) {
      environment 'env', 'qa8'
    }
    if (project.hasProperty('qa9')) {
      environment 'env', 'qa9'
    }

    if (project.hasProperty('party_controller')) {
      suites 'src/test/resources/suites/party_controller.xml'
    }
    if (project.hasProperty('account_controller')) {
      suites 'src/test/resources/suites/account_controller.xml'
    }
    if (project.hasProperty('payment_source_controller')) {
      suites 'src/test/resources/suites/payment_source_controller.xml'
    }
    if (project.hasProperty('transaction_controller')) {
      suites 'src/test/resources/suites/transaction_controller.xml'
    }
    if (project.hasProperty('maxmind_controller')) {
      suites 'src/test/resources/suites/maxmind_testing.xml'
    }
    if (project.hasProperty('parallel_execution')) {
      suites 'src/test/resources/suites/parallel_execution.xml'
    }
    if (project.hasProperty('regression')) {
      suites 'src/test/resources/suites/party_controller.xml'
      suites 'src/test/resources/suites/account_controller.xml'
      suites 'src/test/resources/suites/payment_source_controller.xml'
      suites 'src/test/resources/suites/transaction_controller.xml'
      suites 'src/test/resources/suites/maxmind_testing.xml'
      suites 'src/test/resources/suites/parallel_execution.xml'
    }
  }
  afterSuite { final suite, final result ->
    result.exception?.printStackTrace()
  }
}
</code>```

Body:
Can anyone help me
Project has been cloned from Bitbucket and locally when i am running the project in the intelliJ the error is displayed
Unable to run the scripts-rest assured in the IntelliJ getting missing input or config. Getting build failure if I change the swagger code-gen dependency  also same error is displayed
this is my gradle.build

Buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath("io.swagger:swagger-codegen:2.3.1")
  }
}

plugins {
  id 'java'
  id 'io.qameta.allure' version '2.8.1'
}
repositories {
  mavenCentral()
}

group 'org.example'
version '1.0-SNAPSHOT'
apply plugin: 'base'

import io.swagger.codegen.DefaultGenerator
import io.swagger.codegen.config.CodegenConfigurator

final def swaggerInput = "swagger.json"
final def swaggerOutputDir = file('build/swagger')

task generateApi {
  inputs.file(swaggerInput)
  outputs.dir(swaggerOutputDir)

  doLast {
    final def config = new CodegenConfigurator()
    config.setInputSpec(swaggerInput)
    config.setOutputDir(swaggerOutputDir.path)
    config.setLang('java')
    config.setAdditionalProperties([

            'dateLibrary' : 'java8'])
    config.setImportMappings([
            'java.time.OffsetDateTime': 'java.time.Instant',])
    config.setTypeMappings([
            OffsetDateTime: 'Instant',])
    new DefaultGenerator().opts(config.toClientOptInput()).generate()
  }
}

clean.doFirst {
  delete(swaggerOutputDir)
}

configurations {
  swagger
}

sourceSets {
  swagger {
    compileClasspath = configurations.swaggerCompile
    java {
      srcDir file("${project.buildDir.path}/swagger/src/main/java")
    }
  }
  main {
    compileClasspath += swagger.output
    runtimeClasspath += swagger.output
  }
  test {
    compileClasspath += swagger.output
    runtimeClasspath += swagger.output
  }
}

compileSwaggerJava.dependsOn generateApi
classes.dependsOn swaggerClasses
compileJava.dependsOn compileSwaggerJava

allure {
  version = '2.7.0'
  downloadLinkFormat = 'https://github.com/allure-framework/allure2/releases/download/2.7.0/allure-2.7.0.zip'
}
dependencies {

  // https://mvnrepository.com/artifact/io.rest-assured/rest-assured
  compile group: 'io.rest-assured', name: 'rest-assured', version: '4.3.0'

  // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
  compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.11.0'

  // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
  compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'

  // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310
  compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.11.0'

  // https://mvnrepository.com/artifact/org.json/json
  compile group: 'org.json', name: 'json', version: '20190722'

  compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.6'
  compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.6'
  compile group: 'com.google.code.gson', name: 'gson', version: '2.1'
  compile group: 'io.gsonfire', name: 'gson-fire', version: '1.7.1'

  // https://mvnrepository.com/artifact/org.testng/testng
  compile group: 'org.testng', name: 'testng', version: '7.0.0'

  // https://mvnrepository.com/artifact/org.assertj/assertj-core
  compile group: 'org.assertj', name: 'assertj-core', version: '3.16.0'

  // https://mvnrepository.com/artifact/io.qameta.allure/allure-rest-assured
  compile group: 'io.qameta.allure', name: 'allure-rest-assured', version: '2.13.5'

  // https://mvnrepository.com/artifact/io.qameta.allure/allure-testng
  compile group: 'io.qameta.allure', name: 'allure-testng', version: '2.13.5'

  // https://mvnrepository.com/artifact/org.aeonbits.owner/owner
  compile group: 'org.aeonbits.owner', name: 'owner', version: '1.0.10'

  // AWS SDK dependencies
  compile 'com.amazonaws:aws-java-sdk:1.12.335'
  compile 'com.amazonaws:aws-java-sdk-core:1.12.335'
  compile 'com.amazonaws:aws-java-sdk-cognitoidp:1.12.335'
  compile 'com.amazonaws:aws-java-sdk-ssm:1.12.335'
  compile 'software.amazon.awssdk:ssm:2.18.10'

  compile 'org.projectlombok:lombok:1.18.12'
  annotationProcessor 'org.projectlombok:lombok:1.18.12'

  compile 'org.projectlombok:lombok:1.18.12'
  annotationProcessor 'org.projectlombok:lombok:1.18.12'

  swaggerCompile 'io.swagger:swagger-annotations:1.5.16'
  swaggerCompile 'com.squareup.okhttp:okhttp:2.7.5'
  swaggerCompile 'com.squareup.okhttp:logging-interceptor:2.7.5'
  swaggerCompile 'com.google.code.gson:gson:2.8.1'
  swaggerCompile 'io.gsonfire:gson-fire:1.7.1'

  compile sourceSets.swagger.output

  testCompile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.2.4'
  testCompile 'org.elasticsearch:elasticsearch:6.2.4'

  compile 'com.squareup.okio:okio:1.8.0'
  compile 'com.squareup.okhttp:okhttp:2.4.0'
}
test() {

  useTestNG() {

    if (project.hasProperty('qa4')) {
      environment 'env', 'qa4'
    }
    if (project.hasProperty('qa5')) {
      environment 'env', 'qa5'
    }
    if (project.hasProperty('qa6')) {
      environment 'env', 'qa6'
    }
    if (project.hasProperty('qa7')) {
      environment 'env', 'qa7'
    }
    if (project.hasProperty('qa8')) {
      environment 'env', 'qa8'
    }
    if (project.hasProperty('qa9')) {
      environment 'env', 'qa9'
    }

    if (project.hasProperty('party_controller')) {
      suites 'src/test/resources/suites/party_controller.xml'
    }
    if (project.hasProperty('account_controller')) {
      suites 'src/test/resources/suites/account_controller.xml'
    }
    if (project.hasProperty('payment_source_controller')) {
      suites 'src/test/resources/suites/payment_source_controller.xml'
    }
    if (project.hasProperty('transaction_controller')) {
      suites 'src/test/resources/suites/transaction_controller.xml'
    }
    if (project.hasProperty('maxmind_controller')) {
      suites 'src/test/resources/suites/maxmind_testing.xml'
    }
    if (project.hasProperty('parallel_execution')) {
      suites 'src/test/resources/suites/parallel_execution.xml'
    }
    if (project.hasProperty('regression')) {
      suites 'src/test/resources/suites/party_controller.xml'
      suites 'src/test/resources/suites/account_controller.xml'
      suites 'src/test/resources/suites/payment_source_controller.xml'
      suites 'src/test/resources/suites/transaction_controller.xml'
      suites 'src/test/resources/suites/maxmind_testing.xml'
      suites 'src/test/resources/suites/parallel_execution.xml'
    }
  }
  afterSuite { final suite, final result ->
    result.exception?.printStackTrace()
  }
}


问:
Granger causality in statsmodels working worse with more lags range

Describe the bug

Hi
I am trying some Granger Causality with statsmodels, and I have something significant for maxlags = 5, and then non-significant for maxlags = 10. I use them as iterators so in theory,  if I have something valid at lag = 5, even if I start at maxlags = 10, it shuold still work. But no, setting maxlags = 5 gives significant, setting maxlags=10 or 15 not anymore. How is this possible?

Code Sample, a copy-pastable example if possible

!pip install statsmodels
import pandas as pd
import numpy as np

subject_file = "sub-101915_TS.txt"
time_series = np.genfromtxt(subject_file, delimiter='\t')[:,1:]
n_subjects = 1
primary =  time_series[:,7]
supplementary = time_series[:,54]

from statsmodels.tsa.stattools import grangercausalitytests
# Perform Granger-Causality test
max_lags = 10
ROIs = ['primary','supplementary']#['visual','somatomotor','eyes']
causal_mat = np.zeros((len(ROIs), len(ROIs)))

def find_causality(max_lags,seriesto,seriesfrom):
  pvals = []
  for x in range(n_subjects):
    print(x)
    # Check whether the first variable is caused by the second one
    #df = pd.DataFrame(list(zip(seriesto.loc[:,x], seriesfrom.loc[:,x])))
    df = pd.DataFrame(list(zip(seriesto, seriesfrom)))

    gc_res = grangercausalitytests(df, maxlag=max_lags)
    # Remove List and Dict
    gc_res_lags =  (gc_res[max_lags])
    unlisted_gc_res_lags = gc_res_lags[0]
    pval = unlisted_gc_res_lags['ssr_ftest'][1]
    pvals.append(pval)
    #print(pvals)
    avg_pval = np.mean(pvals)
  return avg_pval,pvals

# Use a for loop to iterate over the list
j_ind = 0
for ROI_i in ROIs:
  i_ind = 0
  for ROI_j in ROIs:
     avg_pval,pvals = find_causality(max_lags, locals()[ROI_i] ,locals()[ROI_j])
     causal_mat[i_ind, j_ind] = avg_pval
     i_ind = i_ind + 1
  j_ind = j_ind + 1

print(causal_mat)
causal_mat<0.05

```

If the issue has not been resolved, please file it in the issue tracker.

Expected Output

A clear and concise description of what you expected to happen.

Output of import statsmodels.api as sm; sm.show_versions()

INSTALLED VERSIONS

Python: 3.8.16.final.0
OS: Linux 5.10.147+ #1 SMP Sat Dec 10 16:00:40 UTC 2022 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

statsmodels

Installed: 0.12.2 (/usr/local/lib/python3.8/dist-packages/statsmodels)

Required Dependencies

cython: 0.29.32 (/usr/local/lib/python3.8/dist-packages/Cython)
numpy: 1.21.6 (/usr/local/lib/python3.8/dist-packages/numpy)
scipy: 1.7.3 (/usr/local/lib/python3.8/dist-packages/scipy)
pandas: 1.3.5 (/usr/local/lib/python3.8/dist-packages/pandas)
dateutil: 2.8.2 (/usr/local/lib/python3.8/dist-packages/dateutil)
patsy: 0.5.3 (/usr/local/lib/python3.8/dist-packages/patsy)

Optional Dependencies

matplotlib: 3.2.2 (/usr/local/lib/python3.8/dist-packages/matplotlib)
backend: module://ipykernel.pylab.backend_inline
cvxopt: 1.3.0 (/usr/local/lib/python3.8/dist-packages/cvxopt)
joblib: 1.2.0 (/usr/local/lib/python3.8/dist-packages/joblib)

Developer Tools

IPython: 7.9.0 (/usr/local/lib/python3.8/dist-packages/IPython)
jinja2: 2.11.3 (/usr/local/lib/python3.8/dist-packages/jinja2)
sphinx: 1.8.6 (/usr/local/lib/python3.8/dist-packages/sphinx)
pygments: 2.6.1 (/usr/local/lib/python3.8/dist-packages/pygments)
pytest: 3.6.4 (/usr/local/lib/python3.8/dist-packages)
virtualenv: Not installed

Body:
Describe the bug

Hi
I am trying some Granger Causality with statsmodels, and I have something significant for maxlags = 5, and then non-significant for maxlags = 10. I use them as iterators so in theory,  if I have something valid at lag = 5, even if I start at maxlags = 10, it shuold still work. But no, setting maxlags = 5 gives significant, setting maxlags=10 or 15 not anymore. How is this possible?

Code Sample, a copy-pastable example if possible

!pip install statsmodels
import pandas as pd
import numpy as np

subject_file = "sub-101915_TS.txt"
time_series = np.genfromtxt(subject_file, delimiter='\t')[:,1:]
n_subjects = 1
primary =  time_series[:,7]
supplementary = time_series[:,54]

from statsmodels.tsa.stattools import grangercausalitytests
# Perform Granger-Causality test
max_lags = 10
ROIs = ['primary','supplementary']#['visual','somatomotor','eyes']
causal_mat = np.zeros((len(ROIs), len(ROIs)))

def find_causality(max_lags,seriesto,seriesfrom):
  pvals = []
  for x in range(n_subjects):
    print(x)
    # Check whether the first variable is caused by the second one
    #df = pd.DataFrame(list(zip(seriesto.loc[:,x], seriesfrom.loc[:,x])))
    df = pd.DataFrame(list(zip(seriesto, seriesfrom)))

    gc_res = grangercausalitytests(df, maxlag=max_lags)
    # Remove List and Dict
    gc_res_lags =  (gc_res[max_lags])
    unlisted_gc_res_lags = gc_res_lags[0]
    pval = unlisted_gc_res_lags['ssr_ftest'][1]
    pvals.append(pval)
    #print(pvals)
    avg_pval = np.mean(pvals)
  return avg_pval,pvals

# Use a for loop to iterate over the list
j_ind = 0
for ROI_i in ROIs:
  i_ind = 0
  for ROI_j in ROIs:
     avg_pval,pvals = find_causality(max_lags, locals()[ROI_i] ,locals()[ROI_j])
     causal_mat[i_ind, j_ind] = avg_pval
     i_ind = i_ind + 1
  j_ind = j_ind + 1

print(causal_mat)
causal_mat<0.05

If the issue has not been resolved, please file it in the issue tracker.

Expected Output

A clear and concise description of what you expected to happen.

Output of import statsmodels.api as sm; sm.show_versions()

INSTALLED VERSIONS

Python: 3.8.16.final.0
OS: Linux 5.10.147+ #1 SMP Sat Dec 10 16:00:40 UTC 2022 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

statsmodels

Installed: 0.12.2 (/usr/local/lib/python3.8/dist-packages/statsmodels)

Required Dependencies

cython: 0.29.32 (/usr/local/lib/python3.8/dist-packages/Cython)
numpy: 1.21.6 (/usr/local/lib/python3.8/dist-packages/numpy)
scipy: 1.7.3 (/usr/local/lib/python3.8/dist-packages/scipy)
pandas: 1.3.5 (/usr/local/lib/python3.8/dist-packages/pandas)
dateutil: 2.8.2 (/usr/local/lib/python3.8/dist-packages/dateutil)
patsy: 0.5.3 (/usr/local/lib/python3.8/dist-packages/patsy)

Optional Dependencies

matplotlib: 3.2.2 (/usr/local/lib/python3.8/dist-packages/matplotlib)
backend: module://ipykernel.pylab.backend_inline
cvxopt: 1.3.0 (/usr/local/lib/python3.8/dist-packages/cvxopt)
joblib: 1.2.0 (/usr/local/lib/python3.8/dist-packages/joblib)

Developer Tools

IPython: 7.9.0 (/usr/local/lib/python3.8/dist-packages/IPython)
jinja2: 2.11.3 (/usr/local/lib/python3.8/dist-packages/jinja2)
sphinx: 1.8.6 (/usr/local/lib/python3.8/dist-packages/sphinx)
pygments: 2.6.1 (/usr/local/lib/python3.8/dist-packages/pygments)
pytest: 3.6.4 (/usr/local/lib/python3.8/dist-packages)
virtualenv: Not installed


问:
Invalid hook call - React. (Duplicated React version in app) when i try npm-link. Rollup.config
I've been stuck on this for like two days. I am trying to make a React component. But after I built the package with rollup.js, I tried to test it with the npm link, but it didn't work.
Yes, I tried to use the npm link in node_modules/react in my lib and it didn't work. Thank for any suggestion.

rollup.config.js

```<code>import babel from 'rollup-plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import external from 'rollup-plugin-peer-deps-external';
import pkg from './package.json';
import path from 'path';

export default [
    {
        input: 'src/index.js',
        external: [...Object.keys(pkg.peerDependencies)],
        output: [
            {
                file: 'dist/index.js',
                format: 'cjs',
            },
            {
                file: 'dist/index.es.js',
                format: 'es',
                exports: "named",
            }
        ],
        plugins: [
            babel({
                exclude: "node_modules/**",
                presets: [['@babel/preset-react', {"runtime": "automatic"}]]
            }),
            external(),
            resolve({ dedupe: [...Object.keys(pkg.peerDependencies)] ,moduleDirectory: path.resolve('./node_modules/react'), extensions: ['.js', '.jsx']}),
        ]
    }
]
</code>```

Body:
I've been stuck on this for like two days. I am trying to make a React component. But after I built the package with rollup.js, I tried to test it with the npm link, but it didn't work.
Yes, I tried to use the npm link in node_modules/react in my lib and it didn't work. Thank for any suggestion.

rollup.config.js

import babel from 'rollup-plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import external from 'rollup-plugin-peer-deps-external';
import pkg from './package.json';
import path from 'path';

export default [
    {
        input: 'src/index.js',
        external: [...Object.keys(pkg.peerDependencies)],
        output: [
            {
                file: 'dist/index.js',
                format: 'cjs',
            },
            {
                file: 'dist/index.es.js',
                format: 'es',
                exports: "named",
            }
        ],
        plugins: [
            babel({
                exclude: "node_modules/**",
                presets: [['@babel/preset-react', {"runtime": "automatic"}]]
            }),
            external(),
            resolve({ dedupe: [...Object.keys(pkg.peerDependencies)] ,moduleDirectory: path.resolve('./node_modules/react'), extensions: ['.js', '.jsx']}),
        ]
    }
]


问:
OpenCV VideoCapture object for image stream from camera
When I try to capture image from my webcam, OpenCV throws an exception in following statement:

```<code>new org.opencv.videoio.VideoCapture(0);
</code>```

It says “unknown exception” of type java.lang.Exception. I wonder how to fix this error.

Body:
When I try to capture image from my webcam, OpenCV throws an exception in following statement:

new org.opencv.videoio.VideoCapture(0);

It says “unknown exception” of type java.lang.Exception. I wonder how to fix this error.


问:
Mockito 4.11.0 vararg changes causes test to fail - how to properly test vararg methods?
I recently made a PR to update to Mockito 4.11.0 but noticed some failing tests related to vararg usage.

Here's a sample that is failing now:

The code that is being tested:

```<code>package com.xyz.packagexyz

open class TestService {
    fun doSomethingElse(message: String, vararg args: Any) {
        print("message: $message, args: $args")
    }
}

class TestClass(val service: TestService) {
    fun doSomething(message: String, vararg args: Any) {
        service.doSomethingElse(message, args)
    }
}
</code>```

The test code for this is:

```<code>internal class TestClassTest {
    private val mockService = mock<TestService>()
    private val testClass = TestClass(mockService)

    @Test
    fun test() {
        val message = "message"
        val arg1 = "arg1"
        testClass.doSomething(message, arg1)

        verify(mockService).doSomethingElse(message, arrayOf(arg1))
    }
}
</code>```

The result is:

```<code>Argument(s) are different! Wanted:
testService.doSomethingElse(
    "message",
    ["arg1"]
);
-> at com.xyz.packagexyz.TestService.doSomethingElse(TestClass.kt:5)
Actual invocations have different arguments:
testService.doSomethingElse(
    "message",
    ["arg1"]
);
-> at com.xyz.packagexyz.TestClass.doSomething(TestClass.kt:11)
</code>```

This code works fine with 4.10.0.

I know 4.11.0 changed a lot of vararg handling logic, so I'm wondering what I need to do to get these to pass now.  Any thoughts?

edit1: I've also tried using

```<code>verify(mockService).doSomethingElse(message, arg1)
</code>```

which does not include the array wrapping arg1, but this fails as well:

```<code>Argument(s) are different! Wanted:
testService.doSomethingElse(
    "message",
    "arg1"
);
-> at com.zao.utilcommon.TestService.doSomethingElse(TestClass.kt:5)
Actual invocations have different arguments:
testService.doSomethingElse(
    "message",
    ["arg1"]
);
-> at com.zao.utilcommon.TestClass.doSomething(TestClass.kt:11)
</code>```

edit2: Thanks in part to knittl's comments I found two working solutions, but I still don't "like" them and feel the original code should still work...

Option A:

```<code>@Test
fun test() {
    val message = "message"
    val arg1 = "arg1"
    val argsArgCaptor = argumentCaptor<Any>()

    testClass.doSomething(message, arg1)

    verify(mockService).doSomethingElse(eq("message"), argsArgCaptor.capture())

    val argsArray: Array<*>? = argsArgCaptor.firstValue as? Array<*>
    assertEquals(arg1, argsArray?.firstOrNull())
}
</code>```

Option B:

```<code>@Test
fun test() {
    val message = "message"
    val arg1 = "arg1"

    testClass.doSomething(message, arg1)

    verify(mockService).doSomethingElse(eq("message"), argThat {
        val argsArray: Array<*>? = this as? Array<*>

        Arrays.equals(argsArray, arrayOf(arg1))
    })
}
</code>```

edit3: I opened https://github.com/mockito/mockito/issues/2856 for this

Body:
I recently made a PR to update to Mockito 4.11.0 but noticed some failing tests related to vararg usage.

Here's a sample that is failing now:

The code that is being tested:

package com.xyz.packagexyz

open class TestService {
    fun doSomethingElse(message: String, vararg args: Any) {
        print("message: $message, args: $args")
    }
}

class TestClass(val service: TestService) {
    fun doSomething(message: String, vararg args: Any) {
        service.doSomethingElse(message, args)
    }
}

The test code for this is:

internal class TestClassTest {
    private val mockService = mock<TestService>()
    private val testClass = TestClass(mockService)

    @Test
    fun test() {
        val message = "message"
        val arg1 = "arg1"
        testClass.doSomething(message, arg1)

        verify(mockService).doSomethingElse(message, arrayOf(arg1))
    }
}

The result is:

Argument(s) are different! Wanted:
testService.doSomethingElse(
    "message",
    ["arg1"]
);
-> at com.xyz.packagexyz.TestService.doSomethingElse(TestClass.kt:5)
Actual invocations have different arguments:
testService.doSomethingElse(
    "message",
    ["arg1"]
);
-> at com.xyz.packagexyz.TestClass.doSomething(TestClass.kt:11)

This code works fine with 4.10.0.

I know 4.11.0 changed a lot of vararg handling logic, so I'm wondering what I need to do to get these to pass now.  Any thoughts?

edit1: I've also tried using

verify(mockService).doSomethingElse(message, arg1)

which does not include the array wrapping arg1, but this fails as well:

Argument(s) are different! Wanted:
testService.doSomethingElse(
    "message",
    "arg1"
);
-> at com.zao.utilcommon.TestService.doSomethingElse(TestClass.kt:5)
Actual invocations have different arguments:
testService.doSomethingElse(
    "message",
    ["arg1"]
);
-> at com.zao.utilcommon.TestClass.doSomething(TestClass.kt:11)

edit2: Thanks in part to knittl's comments I found two working solutions, but I still don't "like" them and feel the original code should still work...

Option A:

@Test
fun test() {
    val message = "message"
    val arg1 = "arg1"
    val argsArgCaptor = argumentCaptor<Any>()

    testClass.doSomething(message, arg1)

    verify(mockService).doSomethingElse(eq("message"), argsArgCaptor.capture())

    val argsArray: Array<*>? = argsArgCaptor.firstValue as? Array<*>
    assertEquals(arg1, argsArray?.firstOrNull())
}

Option B:

@Test
fun test() {
    val message = "message"
    val arg1 = "arg1"

    testClass.doSomething(message, arg1)

    verify(mockService).doSomethingElse(eq("message"), argThat {
        val argsArray: Array<*>? = this as? Array<*>

        Arrays.equals(argsArray, arrayOf(arg1))
    })
}

edit3: I opened https://github.com/mockito/mockito/issues/2856 for this


问:
How can we list available Wi-Fi networks in iPhone, flutter?
I am creating a Flutter app for scanning and listing available Wi-Fi networks near a mobile device. I am using the wifi_scan package.

For Android it was working fine but for iOS, it is not showing the list. After searching for listing Wi-Fi networks on an iPhone, I concluded that there is some technical difficulties in implementing the functionality to scan for the Wi-Fi network list in an iPhone.

So, has anyone seen a workaround for this issue?


问:
StepFunctions - Using States.Format with SNS publish
I'm trying to run a StepFunction Step using the SNS integration with the following step definition:

```<code>"HandleError": {
    Type: 'Task',
    Resource: 'arn:aws:states:::sns:publish',
    Parameters: {
        TopicArn: `arn:aws:sns:region:accountid:topic`,
        "Message.$": "States.Format('Message: {}', $.message)",
    }
}
</code>```

message is defined as an input to the step. According to the examples in the intrinsic function documentation and integration documentation, this should be doable. However, it's throwing an error, complaining:

The value for the field 'Message.$' must be a valid JSONPath or a valid intrinsic function call (at /States/HandleError/Parameters)

Did I do something wrong? Can the SNS integration for Step Function use an intrinsic function for the Message body?

Body:
I'm trying to run a StepFunction Step using the SNS integration with the following step definition:

"HandleError": {
    Type: 'Task',
    Resource: 'arn:aws:states:::sns:publish',
    Parameters: {
        TopicArn: `arn:aws:sns:region:accountid:topic`,
        "Message.$": "States.Format('Message: {}', $.message)",
    }
}

message is defined as an input to the step. According to the examples in the intrinsic function documentation and integration documentation, this should be doable. However, it's throwing an error, complaining:

The value for the field 'Message.$' must be a valid JSONPath or a valid intrinsic function call (at /States/HandleError/Parameters)

Did I do something wrong? Can the SNS integration for Step Function use an intrinsic function for the Message body?


问:
Unable to find source for mystery Excel User Defined Functions appearing in the "Insert Function" dialog box
My list of User Defined Functions contains 118 unknown and unidentifiable functions that I can't identify or delete. These UDF's appear to be associate with the Excel Solver, and are named using several different languages (French, Italian, English, German etc.). Even if I start with an fresh and therefore empty PERSONAL.XLSB file, these UDF's show up in the Insert Function... dialog box in Excel. None of these UDF's are supplemented with a Help file.

Where, other than PERSONAL.XLSB, might I go searching for these UDF's so I can delete them and remove them from the Insert Function... dialog box as they clutter up this dialog and make the management and use of actual UDF's I've created very difficult.

I have attached an image that contains the listing of UDF's I am referring to.

Thanks for any and all comments on what might be happening here... it has me stumped.

I have searched the internet without success. The same issue was noted through a question in the Microsoft Tech Community site, but no answers were provided.

text

I expect but can't confirm that this may be a glitch in the Solver Add-in within Excel.


问:
Pub/Sub Bigquery subscriptions schema with GEOGRAPHY fields
I testes pub/sub BigQuery subscriptions with normal string, integer and other typical field types, but I can't find a way to push GEOMETRY field types.
With Streaming I use geoJSON format and send it as string and BigQuery does the conversion to GEOMETRY, but with Pub/Sub when I try to have GEOMETRY on BigQuery and String on AVRO Pub/Sub got an error message:

Incompatible schema type for field 'gps': field is STRING in the topic
schema, but GEOGRAPHY in the BigQuery table schema.

How can this be done? Any suggestion?

Regards,

Rui


问:
Re-run the same R file multiple times with different input values for variables
I have quite a long R-markdown file that I give cost input values to, it runs an analysis (simple mathematics) using these costs, and tells me if a proposed treatment is cost-effective per a threshold value I have supplied.

I would like to apply this code file to 3 different countries, each with country-specific cost values and cost-effective thresholds.

So, I need to update the input values I use in this model 3 times, but I would prefer not to just copy and paste the block of code into a file 3 times and then manually update the input values per the country I study.

Is there an elegant way to create the values at the start of my code, i.e. costs_Ireland, costs_Italy, costs_Taiwan, and then tell R to run the code for all 3 in turn?

I would also like the output values and graphs the code creates to be produced, but with an indication as to what starting values they drew from, i.e., when my code creates a histogram, that it uses the costs_Ireland and is titled histogram_Ireland, or something like that, with this being updated for costs_Italy and costs_Taiwan. A big part of this is that, rather than a mathematical result or graphic being created in the first run, and and being replaced during the second run, that they will all be available at the end of the execution of the code.

Would anyone be able to advise me on how to do this?

Thank you.

I've created an Rmarkdown file that is just the R code repeated 3 times and the input values manually updated each time, but I think that is a very inelegant solution, particularly as my code is already very long.

Update:

A good point was made on including a simple example, below I include one for a simple calculation and histogram, with the question of, if these were Irish cost values, how would I repeat this for Italian and Spanish values, without having to copy out my code twice, and without overwriting the output values I create below?

```<code>cost_drugs <-10
cost_dressing <- 30
cost_consultation <- 50

total_costs <- cost_drugs + cost_dressing + cost_consultation

# Create data for a graph.
hist_data <-  c(10,30,50)

# Create the histogram:
hist(hist_data , xlab = "Costs", col = "yellow", border = "blue")

# Show me total costs:

total_costs
</code>```

Further Update on My Attempts at Parameterized Reporting

Thanks for your input, I think a parameterized report is the best approach. As I said I have 3 countries, Ireland, Italy, and Taiwan. Say for argument's sake that everything in Ireland costs 10 Dollars, everything in Italy costs 30 Dollars and everything in Taiwan costs 50 Dollars. I want to set it up so that I can tell it to run the code in my Rmarkdown file for Ireland, Italy and Taiwan, and to keep the created values.

I do this by adding the params in the YAML as follows:

```<code>---title: 'Study Title'
author: "Author"
output:
  html_document: default
editor_options:
  markdown:
    wrap: sentence
params:country: c(Ireland, Italy, Taiwan)
cost_drugs: c(10, 30, 50)
cost_dressing: c(10, 30, 50)
cost_consultation: c(10, 30, 50)
---
</code>```

Then later in my Rmarkdown code to create total costs per the country I'm looking at via:

```<code>params$country[1]_total_costs <- params$cost_drugs[1] + params$cost_dressing[1] + params$cost_consultation[1]
</code>```

to hopefully create output like:

```<code>Ireland_total_costs = 30
</code>```

I instead get the following error:

```<code>Error: unexpected input in "params$country[1]_"
</code>```

How can I update this to create variables from when I add Irish costs together only, Italian costs together only, and Taiwanese costs together only?
Thank you.

Body:
I have quite a long R-markdown file that I give cost input values to, it runs an analysis (simple mathematics) using these costs, and tells me if a proposed treatment is cost-effective per a threshold value I have supplied.

I would like to apply this code file to 3 different countries, each with country-specific cost values and cost-effective thresholds.

So, I need to update the input values I use in this model 3 times, but I would prefer not to just copy and paste the block of code into a file 3 times and then manually update the input values per the country I study.

Is there an elegant way to create the values at the start of my code, i.e. costs_Ireland, costs_Italy, costs_Taiwan, and then tell R to run the code for all 3 in turn?

I would also like the output values and graphs the code creates to be produced, but with an indication as to what starting values they drew from, i.e., when my code creates a histogram, that it uses the costs_Ireland and is titled histogram_Ireland, or something like that, with this being updated for costs_Italy and costs_Taiwan. A big part of this is that, rather than a mathematical result or graphic being created in the first run, and and being replaced during the second run, that they will all be available at the end of the execution of the code.

Would anyone be able to advise me on how to do this?

Thank you.

I've created an Rmarkdown file that is just the R code repeated 3 times and the input values manually updated each time, but I think that is a very inelegant solution, particularly as my code is already very long.

Update:

A good point was made on including a simple example, below I include one for a simple calculation and histogram, with the question of, if these were Irish cost values, how would I repeat this for Italian and Spanish values, without having to copy out my code twice, and without overwriting the output values I create below?

cost_drugs <-10
cost_dressing <- 30
cost_consultation <- 50

total_costs <- cost_drugs + cost_dressing + cost_consultation

# Create data for a graph.
hist_data <-  c(10,30,50)

# Create the histogram:
hist(hist_data , xlab = "Costs", col = "yellow", border = "blue")

# Show me total costs:

total_costs

Further Update on My Attempts at Parameterized Reporting

Thanks for your input, I think a parameterized report is the best approach. As I said I have 3 countries, Ireland, Italy, and Taiwan. Say for argument's sake that everything in Ireland costs 10 Dollars, everything in Italy costs 30 Dollars and everything in Taiwan costs 50 Dollars. I want to set it up so that I can tell it to run the code in my Rmarkdown file for Ireland, Italy and Taiwan, and to keep the created values.

I do this by adding the params in the YAML as follows:

---title: 'Study Title'
author: "Author"
output:
  html_document: default
editor_options:
  markdown:
    wrap: sentence
params:country: c(Ireland, Italy, Taiwan)
cost_drugs: c(10, 30, 50)
cost_dressing: c(10, 30, 50)
cost_consultation: c(10, 30, 50)
---

Then later in my Rmarkdown code to create total costs per the country I'm looking at via:

params$country[1]_total_costs <- params$cost_drugs[1] + params$cost_dressing[1] + params$cost_consultation[1]

to hopefully create output like:

Ireland_total_costs = 30

I instead get the following error:

Error: unexpected input in "params$country[1]_"

How can I update this to create variables from when I add Irish costs together only, Italian costs together only, and Taiwanese costs together only?
Thank you.


问:
How do I know that Tensor Cores used in PyTorch (for FP16, bFloat16, INT8)?
From PyTorch documentation it is very to know if a model is using Tensor Cores or not (for FP16, bFloat16, INT8)?.

What I know so far:

FP32 will not run on Tensor Cores, since it is not supported

Enabling TF32 for PyTorch will run your model in TF32 on Tensor Cores

Running (Automatic) Mixed Precisio
n will run on Tensor Cores

Converting a model to FP16, bfloat16 it is unclear if it is/will using Tensor Cores or not! According to Pytorch forums:

PyTorch is using Tensor Cores on volta GPU as long as your inputs are
in fp16 and the dimensions of your gemms/convolutions satisfy
conditions for using Tensor Cores (basically, gemm dimensions are
multiple of 8, or, for convolutions, batch size and input and output
number of channels is multiple of 8). For Ampere and newer, fp16, bf16 should use Tensor Cores for common ops and fp32 for convs (via TF32).
So how do I know if CUDA cores are not used?

What about INT8?


问:
Kaggle pip installation warning
When I install a python package on kaggle, the package is successfully installed, but I get the following warning. The notebook is pinned to its original environment. I am running my notebooks on kaggle and don't see a way to use a virtual environment. My questions:

Is this something to be concerned about?

Is there a solution to the warning?

Python version:

```<code>3.7.12
</code>```

The pip version:

```<code>pip 22.1.2
</code>```

The warning:

```<code>WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv class="ansi-yellow-fg">
</code>```

I did see this post WARNING: Running pip as the 'root' user but I'm not clear on any required action, if any.

I posted a similar question on kaggle but never received a response.

Title: Kaggle pip installation warning

Body:
When I install a python package on kaggle, the package is successfully installed, but I get the following warning. The notebook is pinned to its original environment. I am running my notebooks on kaggle and don't see a way to use a virtual environment. My questions:

Is this something to be concerned about?

Is there a solution to the warning?

Python version:

3.7.12

The pip version:

pip 22.1.2

The warning:

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv class="ansi-yellow-fg">

I did see this post WARNING: Running pip as the 'root' user but I'm not clear on any required action, if any.

I posted a similar question on kaggle but never received a response.


问:
Error: tunneling socket could not be established, cause=connect ETIMEDOUT 171.23.64.1:8888 while requesting http request in Postman
While sending requests in postman the above mentioned error is occurred and while the requests are success in browser.

I am unable to send requests in postman. please solve this issue...


问:
tidymodels: f_meas metric_tweak error on metric_set
Using the iris dataset, a knn-classifier was tuned with iterative search for the purpose of multiple classification. However, an error is generated, when the macro-weighted version of f_meas (as created by metric_tweak) is used in metric_set.

I would appreciate any ideas.
Thank you so much for your support!

```<code>library(tidyverse)
library(tidymodels)
tidymodels_prefer()

# function
f_meas_weighted <- metric_tweak("f_meas_weighted", f_meas, estimator = "macro_weighted")

# workflow
set.seed(2023)
df <- iris
splits <- initial_split(df, strata = Species, prop = 4/5)
df_train <- training(splits)
df_test  <- testing(splits)

df_rec <- recipe(Species ~ ., data = df_train)

knn_model <- nearest_neighbor(neighbors = tune()) %>%
  set_engine("kknn") %>%
  set_mode("classification")

df_wflow <- workflow() %>%
  add_model(knn_model) %>%
  add_recipe(df_rec)

set.seed(2023)
knn_cv <-
  df_wflow %>%
  tune_bayes(
      # error here
    metrics = metric_set(f_meas_weighted),
    resamples = vfold_cv(df_train, strata = "Species", v = 2),
    control = control_bayes(verbose = TRUE, save_pred = TRUE)
  )
</code>```
```<code>❯  Generating a set of 5 initial parameter results
x Fold1: internal:
  Error in `metric_set()`:
  ! Failed to compute `f_meas...
  Caused by error in `f_meas.data.f...
  ! formal argument "estimato...
x Fold2: internal:
  Error in `metric_set()`:
  ! Failed to compute `f_meas...
  Caused by error in `f_meas.data.f...
  ! formal argument "estimato...
✓ Initialization complete

Error in `estimate_tune_results()`:
! All of the models failed. See the .notes column.
Run `rlang::last_error()` to see where the error occurred.
Warning message:
All models failed. Run `show_notes(.Last.tune.result)` for more information.
✖ Optimization stopped prematurely; returning current results.
</code>```

Body:
Using the iris dataset, a knn-classifier was tuned with iterative search for the purpose of multiple classification. However, an error is generated, when the macro-weighted version of f_meas (as created by metric_tweak) is used in metric_set.

I would appreciate any ideas.
Thank you so much for your support!

library(tidyverse)
library(tidymodels)
tidymodels_prefer()

# function
f_meas_weighted <- metric_tweak("f_meas_weighted", f_meas, estimator = "macro_weighted")

# workflow
set.seed(2023)
df <- iris
splits <- initial_split(df, strata = Species, prop = 4/5)
df_train <- training(splits)
df_test  <- testing(splits)

df_rec <- recipe(Species ~ ., data = df_train)

knn_model <- nearest_neighbor(neighbors = tune()) %>%
  set_engine("kknn") %>%
  set_mode("classification")

df_wflow <- workflow() %>%
  add_model(knn_model) %>%
  add_recipe(df_rec)

set.seed(2023)
knn_cv <-
  df_wflow %>%
  tune_bayes(
      # error here
    metrics = metric_set(f_meas_weighted),
    resamples = vfold_cv(df_train, strata = "Species", v = 2),
    control = control_bayes(verbose = TRUE, save_pred = TRUE)
  )

❯  Generating a set of 5 initial parameter results
x Fold1: internal:
  Error in `metric_set()`:
  ! Failed to compute `f_meas...
  Caused by error in `f_meas.data.f...
  ! formal argument "estimato...
x Fold2: internal:
  Error in `metric_set()`:
  ! Failed to compute `f_meas...
  Caused by error in `f_meas.data.f...
  ! formal argument "estimato...
✓ Initialization complete

Error in `estimate_tune_results()`:
! All of the models failed. See the .notes column.
Run `rlang::last_error()` to see where the error occurred.
Warning message:
All models failed. Run `show_notes(.Last.tune.result)` for more information.
✖ Optimization stopped prematurely; returning current results.


问:
Asynchronous Recursive AWS Lambda call does not work
I'm trying to call an AWS Lambda function within itself (i.e. recursively). But, unless I block the thread and wait for the response using future.get(), the 2nd invocation does not happen.

I have shown my code for the 2 approaches below. I have implemented the Lambda functions using Java (SDK Version 2).

Am I missing something? Can someone explain the reason for this difference we see here? Thanks.

Non-blocking Approach - HandlerNonBlocking Lambda function (non-blocking)

```<code>public class HandlerNonBlocking {
    public void process(Map<String, Object> event, Context context) {
        context.getLogger().log("HandlerNonBlocking.process() invoked\n");

        Object isSecond = event.get("isSecond");
        if (isSecond == null) {
            context.getLogger().log("First\n");
        } else {
            context.getLogger().log("Second\n");
            return;
        }

        String json = "{\"isSecond\": \"Y\"}";
        SdkBytes payload = SdkBytes.fromUtf8String(json) ;
        InvokeRequest request = InvokeRequest.builder()
                .functionName("recurring-function")
                .invocationType(InvocationType.EVENT)
                .payload(payload)
                .build();

        try (LambdaAsyncClient lambdaClient = LambdaAsyncClient.create()) {
            context.getLogger().log("Calling again\n");
            CompletableFuture<InvokeResponse> future = lambdaClient.invoke(request);
            // Set a callback
            future.thenAccept(response -> context.getLogger().log("Response status code: " + response.statusCode() + "\n"));
        } catch (Exception ex) {
            context.getLogger().log("Error when invoking Lambda function. " +
                    ex.getClass().getSimpleName() + ": " + ex.getMessage() + "\n");
        }

        try {
            Thread.sleep(5_000);
        } catch (InterruptedException ex) {
            context.getLogger().log("Sleep interrupted. " + ex.getMessage() + "\n");
        }
    }
}
</code>```

Log - First invocation

```<code>START RequestId: c44b0384-c159-4954-a241-8d14044f85db Version: $LATEST
HandlerNonBlocking.process() invoked
First
Calling again
END RequestId: c44b0384-c159-4954-a241-8d14044f85db
</code>```

There is no second invocation in CloudWatch logs.

Blocking Approach - HandlerBlocking Lambda function (block and wait for response)

```<code>public class HandlerBlocking {
    public void process(Map<String, Object> event, Context context) {
        context.getLogger().log("HandlerBlocking.process() invoked\n");

        Object isSecond = event.get("isSecond");
        if (isSecond == null) {
            context.getLogger().log("First\n");
        } else {
            context.getLogger().log("Second\n");
            return;
        }

        String json = "{\"isSecond\": \"Y\"}";
        SdkBytes payload = SdkBytes.fromUtf8String(json) ;
        InvokeRequest request = InvokeRequest.builder()
                .functionName("recurring-function")
                .invocationType(InvocationType.EVENT)
                .payload(payload)
                .build();

        try (LambdaAsyncClient lambdaClient = LambdaAsyncClient.create()) {
            context.getLogger().log("Calling again\n");
            CompletableFuture<InvokeResponse> future = lambdaClient.invoke(request);
            // Wait for response
            InvokeResponse response = future.get();
            context.getLogger().log("Response status code: " + response.statusCode() + "\n");
        } catch (Exception ex) {
            context.getLogger().log("Error when invoking Lambda function. " +
                    ex.getClass().getSimpleName() + ": " + ex.getMessage() + "\n");
        }

        try {
            Thread.sleep(5_000);
        } catch (InterruptedException ex) {
            context.getLogger().log("Sleep interrupted. " + ex.getMessage() + "\n");
        }
    }
}
</code>```

Log - First invocation

```<code>START RequestId: 1a70cb3e-6752-4427-a703-69ff6f6c404b Version: $LATEST
HandlerBlocking.process() invoked
First
Calling again
Response status code: 202
END RequestId: 1a70cb3e-6752-4427-a703-69ff6f6c404b
</code>```

Log - Second invocation

```<code>START RequestId: db71eb54-547a-4ee9-9e9d-0d5b689588f8 Version: $LATEST
HandlerBlocking.process() invoked
Second
END RequestId: db71eb54-547a-4ee9-9e9d-0d5b689588f8
</code>```

I have tried the 2 approaches shown above.

Body:
I'm trying to call an AWS Lambda function within itself (i.e. recursively). But, unless I block the thread and wait for the response using future.get(), the 2nd invocation does not happen.

I have shown my code for the 2 approaches below. I have implemented the Lambda functions using Java (SDK Version 2).

Am I missing something? Can someone explain the reason for this difference we see here? Thanks.

Non-blocking Approach - HandlerNonBlocking Lambda function (non-blocking)

public class HandlerNonBlocking {
    public void process(Map<String, Object> event, Context context) {
        context.getLogger().log("HandlerNonBlocking.process() invoked\n");

        Object isSecond = event.get("isSecond");
        if (isSecond == null) {
            context.getLogger().log("First\n");
        } else {
            context.getLogger().log("Second\n");
            return;
        }

        String json = "{\"isSecond\": \"Y\"}";
        SdkBytes payload = SdkBytes.fromUtf8String(json) ;
        InvokeRequest request = InvokeRequest.builder()
                .functionName("recurring-function")
                .invocationType(InvocationType.EVENT)
                .payload(payload)
                .build();

        try (LambdaAsyncClient lambdaClient = LambdaAsyncClient.create()) {
            context.getLogger().log("Calling again\n");
            CompletableFuture<InvokeResponse> future = lambdaClient.invoke(request);
            // Set a callback
            future.thenAccept(response -> context.getLogger().log("Response status code: " + response.statusCode() + "\n"));
        } catch (Exception ex) {
            context.getLogger().log("Error when invoking Lambda function. " +
                    ex.getClass().getSimpleName() + ": " + ex.getMessage() + "\n");
        }

        try {
            Thread.sleep(5_000);
        } catch (InterruptedException ex) {
            context.getLogger().log("Sleep interrupted. " + ex.getMessage() + "\n");
        }
    }
}

Log - First invocation

START RequestId: c44b0384-c159-4954-a241-8d14044f85db Version: $LATEST
HandlerNonBlocking.process() invoked
First
Calling again
END RequestId: c44b0384-c159-4954-a241-8d14044f85db

There is no second invocation in CloudWatch logs.

Blocking Approach - HandlerBlocking Lambda function (block and wait for response)

public class HandlerBlocking {
    public void process(Map<String, Object> event, Context context) {
        context.getLogger().log("HandlerBlocking.process() invoked\n");

        Object isSecond = event.get("isSecond");
        if (isSecond == null) {
            context.getLogger().log("First\n");
        } else {
            context.getLogger().log("Second\n");
            return;
        }

        String json = "{\"isSecond\": \"Y\"}";
        SdkBytes payload = SdkBytes.fromUtf8String(json) ;
        InvokeRequest request = InvokeRequest.builder()
                .functionName("recurring-function")
                .invocationType(InvocationType.EVENT)
                .payload(payload)
                .build();

        try (LambdaAsyncClient lambdaClient = LambdaAsyncClient.create()) {
            context.getLogger().log("Calling again\n");
            CompletableFuture<InvokeResponse> future = lambdaClient.invoke(request);
            // Wait for response
            InvokeResponse response = future.get();
            context.getLogger().log("Response status code: " + response.statusCode() + "\n");
        } catch (Exception ex) {
            context.getLogger().log("Error when invoking Lambda function. " +
                    ex.getClass().getSimpleName() + ": " + ex.getMessage() + "\n");
        }

        try {
            Thread.sleep(5_000);
        } catch (InterruptedException ex) {
            context.getLogger().log("Sleep interrupted. " + ex.getMessage() + "\n");
        }
    }
}

Log - First invocation

START RequestId: 1a70cb3e-6752-4427-a703-69ff6f6c404b Version: $LATEST
HandlerBlocking.process() invoked
First
Calling again
Response status code: 202
END RequestId: 1a70cb3e-6752-4427-a703-69ff6f6c404b

Log - Second invocation

START RequestId: db71eb54-547a-4ee9-9e9d-0d5b689588f8 Version: $LATEST
HandlerBlocking.process() invoked
Second
END RequestId: db71eb54-547a-4ee9-9e9d-0d5b689588f8

I have tried the 2 approaches shown above.


问:
MariaDB-Statement in Bash here-Document of a Procedure-Block throws ERROR 1064 (42000)
I like to write a mysql-procedure via bash-script in a here-document.
EOF is in single-quotes so the bash do not expand variables.

Problem:
If i write a statement in the PROCEDURE BEGIN/END;-Block e.g. SELECT COUNT(*) FROM mysql.user - now it is commented - i get the error:
ERROR 1064 (42000) at line 6: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 4

Does anybody know how to solve it?

Code:

```<code>#!/bin/bash

function cp() {

mysql --verbose --line-numbers -uxxx -pxxx << 'EOF'

use mysql;
SELECT COUNT(*) FROM mysql.user;

drop PROCEDURE if exists test;
create PROCEDURE `test` ()
BEGIN
-- SELECT COUNT(*) FROM mysql.user
END;

EOF
}

</code>```

Output:

```<code>xxx:~# . querylog.sh cp
--------------
SELECT COUNT(*) FROM mysql.user
--------------

COUNT(*)
13
--------------
drop PROCEDURE if exists test
--------------

--------------
create PROCEDURE `test` ()
BEGIN

END
--------------
</code>```

Several tests in modifying the Bash-Script and on MySQL Workbench.
I expect no error.

Body:
I like to write a mysql-procedure via bash-script in a here-document.
EOF is in single-quotes so the bash do not expand variables.

Problem:
If i write a statement in the PROCEDURE BEGIN/END;-Block e.g. SELECT COUNT(*) FROM mysql.user - now it is commented - i get the error:
ERROR 1064 (42000) at line 6: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 4

Does anybody know how to solve it?

Code:

#!/bin/bash

function cp() {

mysql --verbose --line-numbers -uxxx -pxxx << 'EOF'

use mysql;
SELECT COUNT(*) FROM mysql.user;

drop PROCEDURE if exists test;
create PROCEDURE `test` ()
BEGIN
-- SELECT COUNT(*) FROM mysql.user
END;

EOF
}

Output:

xxx:~# . querylog.sh cp
--------------
SELECT COUNT(*) FROM mysql.user
--------------

COUNT(*)
13
--------------
drop PROCEDURE if exists test
--------------

--------------
create PROCEDURE `test` ()
BEGIN

END
--------------

Several tests in modifying the Bash-Script and on MySQL Workbench.
I expect no error.


问:
Kotlin Jetpack Compose BottomNavigation selected page is not been updated
I have BottomNavigation wrapped around as a BottomBar composable and inside my MainScreen composable.

The current implementation renders properly and I am able to navigate between different Pages. However, the issue I am facing is that the selected property in the BottomNavigationItem is not been updated correctly when changing the current page. This causes the UI to be located in the "Profile" page, but the bottom bar highlights the "Home" page.

I am almost sure it is something regarding the state of the composable, and I tried passing the NavHostController all the way down to the BottomBar, but that didn't solved the issue.

enum class Page(
    @StringRes val title: Int,
    val isCorePage: Boolean,
    val icon: ImageVector) {
    Profile(
        title = R.string.profile_page_title,
        isCorePage = true,
        icon = Icons.Filled.Person),
    Home(
        title = R.string.home_page_title,
        isCorePage = true,
        icon = Icons.Filled.Home),
... etc
}

@Composable
fun BottomBar(
    currentPage: Page,
    onClick: (page: Page) -> Unit = { }) {
    BottomNavigation {
        Page.values().forEach { page ->
            if(page.isCorePage) {
                val title = stringResource(page.title);
                BottomNavigationItem(
                    icon = { Icon(
                        imageVector = page.icon,
                        contentDescription = title) },
                    label = { Text(text = title) },
                    selected = page == currentPage,
                    onClick = { onClick(page) }
                )
            }
        }
    }
}

@Composable
fun MainScreen(
    sessionState: State<Session>,
    navController: NavHostController = rememberNavController()) {
    val backStackEntry by navController.currentBackStackEntryAsState()
    val scaffoldState = rememberScaffoldState()
    val scope = rememberCoroutineScope()
    Scaffold(
        scaffoldState = scaffoldState,
        topBar = {
            TopBar(
                title = backStackEntry?.destination?.route ?: "Title",
                menuClick = { scope.launch { scaffoldState.drawerState.open() } },
                searchClick = { navController.navigate(Page.Search) },
                notificationsClick = { navController.navigate(Page.Notifications) })
        },
        drawerContent = { SideDrawer(sessionState = sessionState) },
        bottomBar = {
            BottomBar(
                currentPage = navController.currentPageOrDefault(Page.Home),
                onClick = { page -> navController.navigate(page) })
        }
    ) {
        PageNavHost(navController)
    }
}

fun NavHostController.navigate(page: Page) {
    val navController = this
    navController.navigate(page.name) {
        // Pop up to the start destination of the graph to
        // avoid building up a large stack of destinations
        // on the back stack as users select items
        popUpTo(navController.graph.findStartDestination().id) {
            saveState = true
        }
        // Avoid multiple copies of the same destination when
        // re-selecting the same item
        launchSingleTop = true
        // Restore state when re-selecting a previously selected item
        restoreState = true
    }
}

fun NavHostController.currentPageOrDefault(default: Page): Page {
    return this.currentPage() ?: default
}

fun NavHostController.currentPage(): Page? {
    val currentRoute = this.currentDestination?.route ?: return null;
    Page.values().forEach { page ->
        if(page.name == currentRoute) {
            return page
        }
    }
    return null
}

```


问:
Exception "A non-collectible assembly may not reference a collectible assembly" from PowerShell 7.3.1 when using NLog.dll 4.7.10
I'm getting this exception in PowerShell 7.3.1 sometimes, with some scripts. I have the same problem whether I run the script in Visual Studio Code (1.74.2) or from a PowerShell (PWSH) prompt:

```<code>A non-collectible assembly may not reference a collectible assembly.
StackTrace: at ProcessItems, C:\git\PerfAndMon-Tools\Scripts\AppDynamics\ServerChecks\Modules\UpdateDnaPathsFunctions.psm1: line 210
at <ScriptBlock><Process>, C:\git\PerfAndMon-Tools\Scripts\AppDynamics\ServerChecks\UpdateDNAPaths.ps1: line 227
at <ScriptBlock>, <No file>: line 1
</code>```

The only .NET assembly I'm using directory is NLog version 4.7.10.13013. I load the NLog.DLL directly in the PowerShell code:

```<code>[Reflection.Assembly]::LoadFile($DllPath)
</code>```

OS: Windows 10 Enterprise, Version 21H2, OS Build 19044.2364

Some other .NET items I use are:

System.Diagnostics.Stopwatch

System.Text.StringBuilder

System.Collections.ArrayList

Note that I'm not sure the exception is related to NLog. It just seems likely.

My Pester unit tests for my NLog.psm1 module pass without ever throwing the ICollectible exception.

Body:
I'm getting this exception in PowerShell 7.3.1 sometimes, with some scripts. I have the same problem whether I run the script in Visual Studio Code (1.74.2) or from a PowerShell (PWSH) prompt:

A non-collectible assembly may not reference a collectible assembly.
StackTrace: at ProcessItems, C:\git\PerfAndMon-Tools\Scripts\AppDynamics\ServerChecks\Modules\UpdateDnaPathsFunctions.psm1: line 210
at


问:
Dynamic codding for loop Python
This is an if statment inside a loop that seems inefficient the first loop changes parts of the code to 2nd 3rd and 4th. as you can see I had to manually write q2 names q3 names q4 names for example is there a way that will change without have to write it out like this? thank you

```<code>    if qtr == "2ND":
        Q2_names_e = re.findall(r'^(\d{2,4})\s+\w+\s+\w+', text, re.MULTILINE)
        Q2_names.append(Q2_names_e)
        lines = text.split('\n')
        df1 = pd.DataFrame([line.split() for line in lines])
        for index, row in df1.iterrows():
            if row[1] == 'EARNINGS:':
                Q2_Pay_e =row[3]
                Q2_Pay.append(Q2_Pay_e)
    elif qtr == "3RD":
        Q3_names_e = re.findall(r'^(\d{2,4})\s+\w+\s+\w+', text, re.MULTILINE)
        Q3_names.append(Q3_names_e)
        lines = text.split('\n')
        df2 = pd.DataFrame([line.split() for line in lines])
        for index, row in df2.iterrows():
            if row[1] == 'EARNINGS:':
                Q3_Pay_e =row[3]
                Q3_Pay.append(Q3_Pay_e)
    elif qtr == "4TH":
        Q4_names_e = re.findall(r'^(\d{2,4})\s+\w+\s+\w+', text, re.MULTILINE)
        Q4_names.append(Q4_names_e)
        lines = text.split('\n')
        df3 = pd.DataFrame([line.split() for line in lines])
        for index, row in df3.iterrows():
            if row[1] == 'EARNINGS:':
                Q4_Pay_e =row[3]
                Q4_Pay.append(Q4_Pay_e)
    else:
        break
</code>```

i treid adding {} but will not allow me to do that like in the example i gave Q{qtr} Names within the original loop

Title: Dynamic codding for loop Python

Body:
This is an if statment inside a loop that seems inefficient the first loop changes parts of the code to 2nd 3rd and 4th. as you can see I had to manually write q2 names q3 names q4 names for example is there a way that will change without have to write it out like this? thank you

    if qtr == "2ND":
        Q2_names_e = re.findall(r'^(\d{2,4})\s+\w+\s+\w+', text, re.MULTILINE)
        Q2_names.append(Q2_names_e)
        lines = text.split('\n')
        df1 = pd.DataFrame([line.split() for line in lines])
        for index, row in df1.iterrows():
            if row[1] == 'EARNINGS:':
                Q2_Pay_e =row[3]
                Q2_Pay.append(Q2_Pay_e)
    elif qtr == "3RD":
        Q3_names_e = re.findall(r'^(\d{2,4})\s+\w+\s+\w+', text, re.MULTILINE)
        Q3_names.append(Q3_names_e)
        lines = text.split('\n')
        df2 = pd.DataFrame([line.split() for line in lines])
        for index, row in df2.iterrows():
            if row[1] == 'EARNINGS:':
                Q3_Pay_e =row[3]
                Q3_Pay.append(Q3_Pay_e)
    elif qtr == "4TH":
        Q4_names_e = re.findall(r'^(\d{2,4})\s+\w+\s+\w+', text, re.MULTILINE)
        Q4_names.append(Q4_names_e)
        lines = text.split('\n')
        df3 = pd.DataFrame([line.split() for line in lines])
        for index, row in df3.iterrows():
            if row[1] == 'EARNINGS:':
                Q4_Pay_e =row[3]
                Q4_Pay.append(Q4_Pay_e)
    else:
        break

i treid adding {} but will not allow me to do that like in the example i gave Q{qtr} Names within the original loop


问:
Chrome Extension - chrome.webRequest - Unknown error in requestBody
I'm trying to logout file information that is being uploaded through the browser with a chrome extension. In V3.

Minimal steps to reproduce:

background.js

chrome.webRequest.onBeforeRequest.addListener(
  (details) => {
    if (details.method.toUpperCase() !== "POST") return;
    if (!details.requestBody) return;

    if (details.url.includes("put_block")) {
      console.log(details);
    }
  },
  { urls: ["<all_urls>"] },
  ["requestBody"]
);
```
<p><strong>console.log:</strong></p>
```{
...
requestBody: { error: 'Unknown error.' },
...
}
```

I'm testing my extension by uploading images to dropbox

When looking at the network tab I can see a post-request with this payload to:

https://dl-web.dropbox.com/put_block_returning_token?...

requestBody: { error: 'Unknown error.' },

how come I can't get anything meaningful in the service worker?

Body:
I'm trying to logout file information that is being uploaded through the browser with a chrome extension. In V3.

Minimal steps to reproduce:

background.js

chrome.webRequest.onBeforeRequest.addListener(
  (details) => {
    if (details.method.toUpperCase() !== "POST") return;
    if (!details.requestBody) return;

    if (details.url.includes("put_block")) {
      console.log(details);
    }
  },
  { urls: ["<all_urls>"] },
  ["requestBody"]
);

console.log:

{
...
requestBody: { error: 'Unknown error.' },
...
}

I'm testing my extension by uploading images to dropbox

When looking at the network tab I can see a post-request with this payload to:

https://dl-web.dropbox.com/put_block_returning_token?...

requestBody: { error: 'Unknown error.' },

how come I can't get anything meaningful in the service worker?


问:
Rollup Postcss don't extract CSS
Is there a way to not extract CSS files with rollup?

Current:

```<code>|-assets
|--main.css
|--main.js
</code>```

Desired:

```<code>|-assets
|--main.js
</code>```

Where main.js imports css. I see this working with Vite client where the main js entry file imports CSS and it works in the browser. It's not obvious to me how but I'm wondering if this is an option.

Title: Rollup Postcss don't extract CSS

Body:
Is there a way to not extract CSS files with rollup?

Current:

|-assets
|--main.css
|--main.js

Desired:

|-assets
|--main.js

Where main.js imports css. I see this working with Vite client where the main js entry file imports CSS and it works in the browser. It's not obvious to me how but I'm wondering if this is an option.