问:
NoSuchElementException - completely unable to fix
I'm busy developing a relatively simply program.

The program involves the use of a main menu that is created and displayed by a method called: "mainMenu()"; the code for which is contained within in my "Main" class (itself containing the main() method). This method takes input via the scanner and depending upon which option the user inputs, a corresponding method is called.

One of these options is "quit" (option q) which, if the scanner picks up Q as the user input, the mainMenu() method then calls a corresponding method called: "quitProgram().

The quitProgram() method also uses a scanner object (albeit a different one to the one the mainMenu() method uses). It does so becuase, via a prompt, the user is asked: "do you want to quit this program? Yes/No?" and the input to that question is captured by the scanner.

Hopefully you're following all of this ...

It is with respect to the quitProgram() method that I'm having problems. Specifically, a NonSuchElementException is being thrown and if "n" or "no" is inputed. The code excutes perfectly if "yes" or "y" is inputed.

Inputting "no" or "n" should (if I could ever fix this bug), call the mainMenu() method again and take the user back to the main menu except, it doesn't. As intimated, it  throws a NoSuchElementException.

I'm hoping that by showing you the code for both methods, you can tell me how to fix the problem.

The mainMenu() method:

```<code>     public static void mainMenu() {

         Scanner sc = new Scanner(System.in);   // Create a Scanner object.

         boolean userInputCorrect = false;      // initialise boolean flag.

         String choice;                         // initialise String for holding user input.

        // start do ... while loop
        do {

                    // ask user to input their choice of option:
                    System.out.println("*********************************************************************************************************" + "\r"
                    + "PROGRAMMING ASSIGNMENT:" + "\r"
                    + "----------------------" + "\r\n" + "\r\n"
                    + "STUDENT ID: 2136272" + "\r"
                    + "NAME: William van Zwanenberg" + "\r"
                    + "MODULE NAME: LAAM39 - Introduction to Programming" + "\r"
                    + "MODULE TUTOR: Dr. Livio Robaldo" + "\r\n" + "\r\n"
                    + "DESCRIPTION:" + "\r\n"
                    + "------------" + "\r\n"
                    + "Program to manage a desk and the items on it as per assignment for LAAM39 - Intro to Programming Module." + "\r\n"  + "\r\n"
                    + "ASSIGNMENT TITLE:"  + "\r\n"
                    + "-----------------" + "\r\n"
                    + "Implement a Java class \"Desk\" with suitable attributes and methods to put and remove items on the desk " + "\r"
                    + "and, optionally, other methods to move the desk, buy&sell the desk, etc. Items are instances of another " + "\r"
                    + "Java class \"Item\". By using inheritance among classes, you can then optionally distinguish different " + "\r"
                    + "kinds of items (notebooks, pens, pencils, etc.)" + "\r\n" + "\r\n"
                    + "**********************************************************************************************************"  + "\r\n" + "\r\n"
                    + "Please enter the corresponding number for the specific action you'd like the program to perfom." + "\r\n" + "\r\n"
                    + "YOUR CHOICE OF OPTIONS ARE:" + "\r\n" + "\r\n"
                    + "(1) Create a new desk object;" + "\r\n"
                    + "(2) Change the properties of an existing desk object;" + "\r\n"
                    + "(3) Add a new stationery item to the desk;" + "\r\n"
                    + "(4) Remove an existing stationery item from the desk;" + "\r\n"
                    + "(5) Change the properties of an existing stationery item;" + "\r\n"
                    + "(6) Move the desk" + "\r\n"
                    + "(7) Sell the desk and assign it a new owner." + "\r\n" + "\r\n"
                    + "To quit the program, type \"q\"." + "\r\n");

                 choice = sc.nextLine();

                 // now instigate switch
                 switch (choice.toLowerCase()) {
                        case "1":
                        case "2":
                        case "3":
                        case "4":
                        case "5":
                        case "6":
                        case "7":
                        case "q":
                        case "quit":
                        case "Quit":
                        case "QUIT":

                        // change flag becuase user will have made a valid choice
                            userInputCorrect = true;

                        // BREAK OUT OF SWITCH
                        break;

                        default:

                            // clear console
                            clearConsole();

                            // include countdown delay. Here the for loop merely interates. Nothing more.
                            for (double i = 1; i<=1000000; i=i+ .01);

                            // print out error msg:
                            System.out.println("\r\n" + "ERROR! " + "\""+ choice +"\"" + " is not a valid choice. Please try again." + "\r\n");

                 } // end of switch

         // end the do .. while loop
         } while (!userInputCorrect);

                // close the Scanner class as we no longer need it.
                sc.close();

                // flush the content of the buffer to the output stream
                System.out.flush();

              /*
               * If 'q', Q', 'quit', 'Quit', or 'QUIT' is inputed, then quit the program.
               * NB: For some reason (UNKNOWN) despite using the 'toLowerCase()'
               * String method, the code does not execute
               * correctly if "Q" is entered by the user. Therefore, the
               * "||" Comparator has been used alongisde the 'equalsIgnoreCase' method in
               * to avoid producing an error and forcing the program to quit. This is
               * obviously a workaround.
               */
             if (choice.equalsIgnoreCase("Q") || choice.equalsIgnoreCase("QUIT")) {

                 // call quit program method:
                 quitProgram();

             } else {

                 clearConsole();

                 System.out.println("\r\n" + "You selected: " + choice);

                 // now include switch to pass flow to corresponding classes/methods/ depending on the user's selection.

             }

     } // end of mainMenu() method.
</code>```

This is the code for the quitProgram() method:

```<code>public static void quitProgram() {

        //clear console:
        clearConsole();

        // create a new scanner:
        Scanner scan = new Scanner(System.in);

        // ask user if thwy wish to quit:
        System.out.println("Do you want to quit this program? Yes/no?");

        // assign user input to a new String:
        String options = scan.nextLine();

        // initialise boolean for use in while loop:
        boolean matchFound = false;

        String regex =  "yes|no|y|n";  // searches for "yes", "no", "y", and "n" - CASE INSENSITIVE.

        while (matchFound == false) {

            Pattern pt = Pattern.compile(regex , Pattern.CASE_INSENSITIVE);
            Matcher mt = pt.matcher(options);

            if (mt.find() == true) {

                // match found, therefore set the boolean to true:
                matchFound = true;

            } else {

                // print out error msg:
                System.out.println("Invalid entry. Please try again. Do you want to quit this program? Yes/no?");

                // get next entry:
                options = scan.next();
            }

        } // end while loop.

        // NOW ACT DEPENDING ON SPECIFIC CHOICE:

        // close the scanner:
        scan.close();

        // flush the content of the buffer to the output stream
        System.out.flush();

        if (options.equalsIgnoreCase("yes") || options.equalsIgnoreCase("y")) {

            // clear the Console
             clearConsole();

             // print out goodbye message:
             System.out.println("GOODBYE :-) This program will now quit");

             // wait a short while ...
             for (double i = 1; i<=10000000; i=i+ .01);  // include countdown delay. Here, the for loop merely interates. Nothing more.

             // clear console again:
             clearConsole();

             // now definitely quit.
             System.exit(0);

        } else if(options.equalsIgnoreCase("no") || options.equalsIgnoreCase("n")) {

            // clear console:
             clearConsole();

            // flush the content of the buffer to the output stream
            System.out.flush();

             // print out take to main menu message:
             System.out.println("OK. Returning you to the main menu ...");

            // clear console again:
             clearConsole();

            // wait a short while ...
             for (double i = 1; i<=100000; i=i+ .01);  // include countdown delay. Here, the for loop merely interates. Nothing more.

            // return to the main menu.
            mainMenu();

        }

    } // end of quitProgram() method.
</code>```

Body:
I'm busy developing a relatively simply program.

The program involves the use of a main menu that is created and displayed by a method called: "mainMenu()"; the code for which is contained within in my "Main" class (itself containing the main() method). This method takes input via the scanner and depending upon which option the user inputs, a corresponding method is called.

One of these options is "quit" (option q) which, if the scanner picks up Q as the user input, the mainMenu() method then calls a corresponding method called: "quitProgram().

The quitProgram() method also uses a scanner object (albeit a different one to the one the mainMenu() method uses). It does so becuase, via a prompt, the user is asked: "do you want to quit this program? Yes/No?" and the input to that question is captured by the scanner.

Hopefully you're following all of this ...

It is with respect to the quitProgram() method that I'm having problems. Specifically, a NonSuchElementException is being thrown and if "n" or "no" is inputed. The code excutes perfectly if "yes" or "y" is inputed.

Inputting "no" or "n" should (if I could ever fix this bug), call the mainMenu() method again and take the user back to the main menu except, it doesn't. As intimated, it  throws a NoSuchElementException.

I'm hoping that by showing you the code for both methods, you can tell me how to fix the problem.

The mainMenu() method:

     public static void mainMenu() {

         Scanner sc = new Scanner(System.in);   // Create a Scanner object.

         boolean userInputCorrect = false;      // initialise boolean flag.

         String choice;                         // initialise String for holding user input.

        // start do ... while loop
        do {

                    // ask user to input their choice of option:
                    System.out.println("*********************************************************************************************************" + "\r"
                    + "PROGRAMMING ASSIGNMENT:" + "\r"
                    + "----------------------" + "\r\n" + "\r\n"
                    + "STUDENT ID: 2136272" + "\r"
                    + "NAME: William van Zwanenberg" + "\r"
                    + "MODULE NAME: LAAM39 - Introduction to Programming" + "\r"
                    + "MODULE TUTOR: Dr. Livio Robaldo" + "\r\n" + "\r\n"
                    + "DESCRIPTION:" + "\r\n"
                    + "------------" + "\r\n"
                    + "Program to manage a desk and the items on it as per assignment for LAAM39 - Intro to Programming Module." + "\r\n"  + "\r\n"
                    + "ASSIGNMENT TITLE:"  + "\r\n"
                    + "-----------------" + "\r\n"
                    + "Implement a Java class \"Desk\" with suitable attributes and methods to put and remove items on the desk " + "\r"
                    + "and, optionally, other methods to move the desk, buy&sell the desk, etc. Items are instances of another " + "\r"
                    + "Java class \"Item\". By using inheritance among classes, you can then optionally distinguish different " + "\r"
                    + "kinds of items (notebooks, pens, pencils, etc.)" + "\r\n" + "\r\n"
                    + "**********************************************************************************************************"  + "\r\n" + "\r\n"
                    + "Please enter the corresponding number for the specific action you'd like the program to perfom." + "\r\n" + "\r\n"
                    + "YOUR CHOICE OF OPTIONS ARE:" + "\r\n" + "\r\n"
                    + "(1) Create a new desk object;" + "\r\n"
                    + "(2) Change the properties of an existing desk object;" + "\r\n"
                    + "(3) Add a new stationery item to the desk;" + "\r\n"
                    + "(4) Remove an existing stationery item from the desk;" + "\r\n"
                    + "(5) Change the properties of an existing stationery item;" + "\r\n"
                    + "(6) Move the desk" + "\r\n"
                    + "(7) Sell the desk and assign it a new owner." + "\r\n" + "\r\n"
                    + "To quit the program, type \"q\"." + "\r\n");

                 choice = sc.nextLine();

                 // now instigate switch
                 switch (choice.toLowerCase()) {
                        case "1":
                        case "2":
                        case "3":
                        case "4":
                        case "5":
                        case "6":
                        case "7":
                        case "q":
                        case "quit":
                        case "Quit":
                        case "QUIT":

                        // change flag becuase user will have made a valid choice
                            userInputCorrect = true;

                        // BREAK OUT OF SWITCH
                        break;

                        default:

                            // clear console
                            clearConsole();

                            // include countdown delay. Here the for loop merely interates. Nothing more.
                            for (double i = 1; i<=1000000; i=i+ .01);

                            // print out error msg:
                            System.out.println("\r\n" + "ERROR! " + "\""+ choice +"\"" + " is not a valid choice. Please try again." + "\r\n");

                 } // end of switch

         // end the do .. while loop
         } while (!userInputCorrect);

                // close the Scanner class as we no longer need it.
                sc.close();

                // flush the content of the buffer to the output stream
                System.out.flush();

              /*
               * If 'q', Q', 'quit', 'Quit', or 'QUIT' is inputed, then quit the program.
               * NB: For some reason (UNKNOWN) despite using the 'toLowerCase()'
               * String method, the code does not execute
               * correctly if "Q" is entered by the user. Therefore, the
               * "||" Comparator has been used alongisde the 'equalsIgnoreCase' method in
               * to avoid producing an error and forcing the program to quit. This is
               * obviously a workaround.
               */
             if (choice.equalsIgnoreCase("Q") || choice.equalsIgnoreCase("QUIT")) {

                 // call quit program method:
                 quitProgram();

             } else {

                 clearConsole();

                 System.out.println("\r\n" + "You selected: " + choice);

                 // now include switch to pass flow to corresponding classes/methods/ depending on the user's selection.

             }

     } // end of mainMenu() method.

This is the code for the quitProgram() method:

public static void quitProgram() {

        //clear console:
        clearConsole();

        // create a new scanner:
        Scanner scan = new Scanner(System.in);

        // ask user if thwy wish to quit:
        System.out.println("Do you want to quit this program? Yes/no?");

        // assign user input to a new String:
        String options = scan.nextLine();

        // initialise boolean for use in while loop:
        boolean matchFound = false;

        String regex =  "yes|no|y|n";  // searches for "yes", "no", "y", and "n" - CASE INSENSITIVE.

        while (matchFound == false) {

            Pattern pt = Pattern.compile(regex , Pattern.CASE_INSENSITIVE);
            Matcher mt = pt.matcher(options);

            if (mt.find() == true) {

                // match found, therefore set the boolean to true:
                matchFound = true;

            } else {

                // print out error msg:
                System.out.println("Invalid entry. Please try again. Do you want to quit this program? Yes/no?");

                // get next entry:
                options = scan.next();
            }

        } // end while loop.

        // NOW ACT DEPENDING ON SPECIFIC CHOICE:

        // close the scanner:
        scan.close();

        // flush the content of the buffer to the output stream
        System.out.flush();

        if (options.equalsIgnoreCase("yes") || options.equalsIgnoreCase("y")) {

            // clear the Console
             clearConsole();

             // print out goodbye message:
             System.out.println("GOODBYE :-) This program will now quit");

             // wait a short while ...
             for (double i = 1; i<=10000000; i=i+ .01);  // include countdown delay. Here, the for loop merely interates. Nothing more.

             // clear console again:
             clearConsole();

             // now definitely quit.
             System.exit(0);

        } else if(options.equalsIgnoreCase("no") || options.equalsIgnoreCase("n")) {

            // clear console:
             clearConsole();

            // flush the content of the buffer to the output stream
            System.out.flush();

             // print out take to main menu message:
             System.out.println("OK. Returning you to the main menu ...");

            // clear console again:
             clearConsole();

            // wait a short while ...
             for (double i = 1; i<=100000; i=i+ .01);  // include countdown delay. Here, the for loop merely interates. Nothing more.

            // return to the main menu.
            mainMenu();

        }

    } // end of quitProgram() method.


来源: stackexchange

问:
How can I combine this filters
How can I combine this 2 isotope filters?

I try to make textsearch filter

```<code><input type="text" class="quicksearch" placeholder="Search" />
</code>```

https://codepen.io/desandro/pen/YzPMBx

Combined with a selectbox

```<code><select class="filters-select">
</code>```

https://codepen.io/desandro/pen/gOrVQa

This code for select seems my problem. After select a option, the text search did no longer work

```<code>$grid.isotope({ filter: filterValue });
</code>```

ContentLicense: CC BY-SA 4.0

Title: How can I combine this filters

Body:
How can I combine this 2 isotope filters?

I try to make textsearch filter

<input type="text" class="quicksearch" placeholder="Search" />

https://codepen.io/desandro/pen/YzPMBx

Combined with a selectbox

<select class="filters-select">

https://codepen.io/desandro/pen/gOrVQa

This code for select seems my problem. After select a option, the text search did no longer work

$grid.isotope({ filter: filterValue });


问:
Trying to download a video then convert the video to an mp3, I end up getting a Attribute error
I get a 'streams has no endswith attribute'

```<code># Download function MP3
def download():
    try:
        mp3_file = "audio.mp3"
        url = YouTube(str(link.get()))
        video = url.streams.first()
        VideoClip = VideoFileClip(video)
        audioclip = VideoClip.audio
        audioclip.write_audiofile(mp3_file)
        audioclip.close()
        VideoClip.close()
        mp3_file.download(Path.home() / "Downloads")
        Label(root, text = "Downloaded",).place(relx = .5, rely = .6, anchor = CENTER)
        link_enter.delete(0,END)
    except AttributeError:
        print("No")
</code>```

What's supposed to happen is I click a button and the mp4 is converted to mp3 and downloaded, but I get the AttributeError

Body:
I get a 'streams has no endswith attribute'

# Download function MP3
def download():
    try:
        mp3_file = "audio.mp3"
        url = YouTube(str(link.get()))
        video = url.streams.first()
        VideoClip = VideoFileClip(video)
        audioclip = VideoClip.audio
        audioclip.write_audiofile(mp3_file)
        audioclip.close()
        VideoClip.close()
        mp3_file.download(Path.home() / "Downloads")
        Label(root, text = "Downloaded",).place(relx = .5, rely = .6, anchor = CENTER)
        link_enter.delete(0,END)
    except AttributeError:
        print("No")

What's supposed to happen is I click a button and the mp4 is converted to mp3 and downloaded, but I get the AttributeError


问:
Extend type after it has been defined
I have a type definition in a core-store.ts file like this:

```<code>const store = configureStore({ ... });
export default store;
export type RootState = ReturnType<typeof store.getState>;

export function mapStateToProps<C extends R, R, S extends RootState>(component: C, mapState: (state: S) => R): Unsubscribe {
  ...
};
</code>```

This is defined in a standard file that defines some core reducers, which I would like to keep untouched. Later on, I define new reducers in other files. Is it possible to extend the store reducers and also the RootState type, so when calling mapStateToProps it has all the reducers available in intellisense?

Actually what I'm doing is that core-store.ts imports from src/store/reducers.ts, which must export all reducers defined outside core, and I think this is a very ugly design, for someone who doesn't know the design it seems like a kind of black magic...:

core-store.ts:

```<code>import { coreReducers } from './reducers';
import { appReducers } from 'src/store/reducers.ts`;

const store = configureStore({
    reducer: combineReducers({
        ...coreReducers,
        ...appReducers,
    }),
});
</code>```

Title: Extend type after it has been defined

Body:
I have a type definition in a core-store.ts file like this:

const store = configureStore({ ... });
export default store;
export type RootState = ReturnType<typeof store.getState>;

export function mapStateToProps<C extends R, R, S extends RootState>(component: C, mapState: (state: S) => R): Unsubscribe {
  ...
};

This is defined in a standard file that defines some core reducers, which I would like to keep untouched. Later on, I define new reducers in other files. Is it possible to extend the store reducers and also the RootState type, so when calling mapStateToProps it has all the reducers available in intellisense?

Actually what I'm doing is that core-store.ts imports from src/store/reducers.ts, which must export all reducers defined outside core, and I think this is a very ugly design, for someone who doesn't know the design it seems like a kind of black magic...:

core-store.ts:

import { coreReducers } from './reducers';
import { appReducers } from 'src/store/reducers.ts`;

const store = configureStore({
    reducer: combineReducers({
        ...coreReducers,
        ...appReducers,
    }),
});


问:
Pygame.mixer.sndarray.make_sound not working
I am doing some simple DSP and playing the original and the filtered. I am using librosa to load the mp3 files in as arrays.

Here is the code of me loading the files in.

PATH = os.getcwd() + "/audio files"
    to_load_array = os.listdir(PATH)
    random_mp3 = to_load_array[randint(0, len(to_load_array) - 1)]
    random_mp3_path = "audio files/" + random_mp3

    data, sr = librosa.load(random_mp3_path, duration = MP3(random_mp3_path).info.length, mono = False, sr = 44100)
```
<p>Else where in my program I have a GUI with a button that allows you to switch between playing the filtered version and and the unfiltered version. I am doing this by using different channels in <code>pygame.mixer</code> playing them both at the same time but alternating which one is being muted. I am using <code>pygame.mixer</code> because it allows for this simultaneous playing feature.</p>
<p>Currently I am filtering and then exporting the filtered file as an mp3 and then playing the mp3. This feels like too many I/O operations and I would like to speed up the program a little bit by playing the filtered and unfiltered arrays directly from within python.</p>
<p>I found the function <code>pygame.mixer.sndarray.make_sound</code> which is suppused to turn your array into a sound object that can be played on the <code>mixer.play() </code> function.</p>
<p>This is how I am using the function:</p>
```  def setSoundObjects(self, original, filtered):

        print('orignal data shape: ',original.shape)
        print('format (From get_init): ', pygame.mixer.get_init()[2])
        print("this is the original data: ", original)

        original = numpy.int16(original * (2 ** 15))
        filtered = numpy.int16(filtered * (2 ** 15))

        print("this is the data after numpy conversion: ", original)

        #set the sound objects
        print("Number of channels: ", pygame.mixer.get_num_channels())
        self.original = pygame.sndarray.make_sound(original)
        self.filtered = pygame.sndarray.make_sound(filtered)
```
<p>However, whenever I try to use it I keep getting this error:</p>
```self.original = pygame.mixer.Sound(array = original)
ValueError: Array depth must match number of mixer channels
```
<p>here is the output from what I am printing to the terminal to try and debug this:</p>
```format (From get_init):  2
this is the original data:  [[ 0.          0.          0.         ... -0.00801174 -0.00784447
  -0.01003712]
 [ 0.          0.          0.         ... -0.00695544 -0.00674583
  -0.00865676]]
this is the data after numpy conversion:  [[   0    0    0 ... -262 -257 -328]
 [   0    0    0 ... -227 -221 -283]]
Number of channels:  8
```

I was trying the numpy conversion because of this post but it didn't help.

Any help would be greatly appreciated thank you!

let me know if I should add anything else to help clarify what im doing. I did not include the entire code because the program is quite large already.

This question is different than this question because I am already changing the format of the array. I have tried this solution and it does not work in my code. I get the same error if I try and pass the size = 32 parameter into the init.

Body:
I am doing some simple DSP and playing the original and the filtered. I am using librosa to load the mp3 files in as arrays.

Here is the code of me loading the files in.

PATH = os.getcwd() + "/audio files"
    to_load_array = os.listdir(PATH)
    random_mp3 = to_load_array[randint(0, len(to_load_array) - 1)]
    random_mp3_path = "audio files/" + random_mp3

    data, sr = librosa.load(random_mp3_path, duration = MP3(random_mp3_path).info.length, mono = False, sr = 44100)

Else where in my program I have a GUI with a button that allows you to switch between playing the filtered version and and the unfiltered version. I am doing this by using different channels in pygame.mixer playing them both at the same time but alternating which one is being muted. I am using pygame.mixer because it allows for this simultaneous playing feature.

Currently I am filtering and then exporting the filtered file as an mp3 and then playing the mp3. This feels like too many I/O operations and I would like to speed up the program a little bit by playing the filtered and unfiltered arrays directly from within python.

I found the function pygame.mixer.sndarray.make_sound which is suppused to turn your array into a sound object that can be played on the mixer.play()  function.

This is how I am using the function:

  def setSoundObjects(self, original, filtered):

        print('orignal data shape: ',original.shape)
        print('format (From get_init): ', pygame.mixer.get_init()[2])
        print("this is the original data: ", original)

        original = numpy.int16(original * (2 ** 15))
        filtered = numpy.int16(filtered * (2 ** 15))

        print("this is the data after numpy conversion: ", original)

        #set the sound objects
        print("Number of channels: ", pygame.mixer.get_num_channels())
        self.original = pygame.sndarray.make_sound(original)
        self.filtered = pygame.sndarray.make_sound(filtered)

However, whenever I try to use it I keep getting this error:

self.original = pygame.mixer.Sound(array = original)
ValueError: Array depth must match number of mixer channels

here is the output from what I am printing to the terminal to try and debug this:

format (From get_init):  2
this is the original data:  [[ 0.          0.          0.         ... -0.00801174 -0.00784447
  -0.01003712]
 [ 0.          0.          0.         ... -0.00695544 -0.00674583
  -0.00865676]]
this is the data after numpy conversion:  [[   0    0    0 ... -262 -257 -328]
 [   0    0    0 ... -227 -221 -283]]
Number of channels:  8

I was trying the numpy conversion because of this post but it didn't help.

Any help would be greatly appreciated thank you!

let me know if I should add anything else to help clarify what im doing. I did not include the entire code because the program is quite large already.

This question is different than this question because I am already changing the format of the array. I have tried this solution and it does not work in my code. I get the same error if I try and pass the size = 32 parameter into the init.


问:
Sending contact form data from docker container website to host mail server
I have a WordPress website in a Docker container which is running on linux server, the problem is I can't send the contact form data to my email address in the same server. According to my knowledge, WordPress uses mail() php function.

Server informations :

Debian 8

php 5.6

MTA: Postfix (dkim, spf, dmarc, ssl etc. done)

The server is working and sending emails since years, deliverability 10/10.
I am using the Outlook mobile app to access to my e-mails on my phone to this server, which means that the remote access to the SMTP server is working well. (port 587 on tls)

Docker container informations:

Ip address: 172.18.0.1

network mode: Bridge

Interface name: br-61b941dec29d

The website in the container is using WP 6.1.1 and the problem is (I know it's normal) that no emails are sent from the website, neither by clicking on WP reset password link, nor the contact form of the website, which was created with contact form 7 plugin.

Solutions tried:

I tried with a WP plugin that allows to set up external SMTP host, I set up the IP address of the host server, the port 587 and STARTTLS protocol, it did not work, the plugin has a "send test email" button, but at every try the plugin returns an error from the host server:

Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

But since I can configure mobile app to access the SMTP server, and that the certificate (let's encrypt) is valid (I checked with a ssllabs.com) I don't understand this error.

I tried manually by editing the php.ini file in the container which is located at

```<code>/usr/local/etc/php/php.ini-production
</code>```
```<code>SMTP = host_ip_address
smtp_port = 587 and then 25
sendmail_from = myaddress@domain.com
</code>```

I also edited the /etc/postfix/main.cf by adding 172.18.0.0/24 to mynetworks  the inet_interfaces was already set to "all"

```<code>mynetworks = xxx.xxx.xxx.0/24 [::ffff:127.0.0.0]/104 [::1]/128 172.18.0.0/24
inet_interfaces = all
</code>```

None of these worked. I tried sending emails with a simple php script using mail() function, it failed with no error log, at least, the logs are not shown in docker logs.

What I'm looking for

Send the data from the contact form to an email address in this host server. It is not mandatory to use internet, since the container and the MTA are on the same host server.

Body:
I have a WordPress website in a Docker container which is running on linux server, the problem is I can't send the contact form data to my email address in the same server. According to my knowledge, WordPress uses mail() php function.

Server informations :

Debian 8

php 5.6

MTA: Postfix (dkim, spf, dmarc, ssl etc. done)

The server is working and sending emails since years, deliverability 10/10.
I am using the Outlook mobile app to access to my e-mails on my phone to this server, which means that the remote access to the SMTP server is working well. (port 587 on tls)

Docker container informations:

Ip address: 172.18.0.1

network mode: Bridge

Interface name: br-61b941dec29d

The website in the container is using WP 6.1.1 and the problem is (I know it's normal) that no emails are sent from the website, neither by clicking on WP reset password link, nor the contact form of the website, which was created with contact form 7 plugin.

Solutions tried:

I tried with a WP plugin that allows to set up external SMTP host, I set up the IP address of the host server, the port 587 and STARTTLS protocol, it did not work, the plugin has a "send test email" button, but at every try the plugin returns an error from the host server:

Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

But since I can configure mobile app to access the SMTP server, and that the certificate (let's encrypt) is valid (I checked with a ssllabs.com) I don't understand this error.

I tried manually by editing the php.ini file in the container which is located at

/usr/local/etc/php/php.ini-production

SMTP = host_ip_address
smtp_port = 587 and then 25
sendmail_from = myaddress@domain.com

I also edited the /etc/postfix/main.cf by adding 172.18.0.0/24 to mynetworks  the inet_interfaces was already set to "all"

mynetworks = xxx.xxx.xxx.0/24 [::ffff:127.0.0.0]/104 [::1]/128 172.18.0.0/24
inet_interfaces = all

None of these worked. I tried sending emails with a simple php script using mail() function, it failed with no error log, at least, the logs are not shown in docker logs.

What I'm looking for

Send the data from the contact form to an email address in this host server. It is not mandatory to use internet, since the container and the MTA are on the same host server.


问:
Next.js not friendly when checking with google mobile-friendly
My site is not mobile friendly when testing with Google Mobile friendly. But actually when accessing it, it is mobile friendly.

What should I do to fix it? I am using Next.js.

Result when I test: https://search.google.com/test/mobile-friendly/result?id=zwleJJ0VXRiIwFagHtBHuA

My package.json:

{
  "name": "tintuc",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev -p 8080",
    "build": "next build",
    "start": "next start -p 8080",
    "sitemap": "next-sitemap",
    "analyze": "cross-env ANALYZE=true next build",
    "analyze:server": "cross-env BUNDLE_ANALYZE=server next build",
    "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build",
    "find:unused": "next-unused",
    "depcheck": "npx depcheck"
  },
  "dependencies": {
    "@apollo/client": "^3.3.19",
    "@headlessui/react": "^1.4.1",
    "@heroicons/react": "^1.0.4",
    "date-fns": "^2.25.0",
    "deepmerge": "^4.2.2",
    "graphql": "^15.5.0",
    "highlight.js": "^11.6.0",
    "html-react-parser": "^3.0.4",
    "lodash": "^4.17.21",
    "next": "^12.2.5",
    "next-seo": "^4.28.1",
    "node-html-parser": "^5.0.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-loading-skeleton": "^2.2.0",
    "replace-special-characters": "^1.2.6"
  },
  "devDependencies": {
    "@next/bundle-analyzer": "^11.1.4",
    "@types/node": "^18.11.0",
    "@types/react": "^18.0.21",
    "autoprefixer": "^10.3.6",
    "next-pwa": "^5.6.0",
    "next-sitemap": "^3.1.29",
    "next-unused": "^0.0.6",
    "postcss": "^8.3.8",
    "tailwindcss": "^2.2.16"
  }
}
```


问:
running multiple api calls (dependent on one's output) in parallel to speed up output
I am trying to run a series of Wikipedia API calls and the output of some of the calls are used in another function(for another API call). the individual API calls are fast(>1 minute) but the function that utilizes these API calls together takes approx. 1 hour.

first API call:

```<code>def img(cat_title) -> list:

    url="https://co.media.org/w/api.php"
    params = {
                "action": "query",
                "format": "json",
        }
    resp = requests.get(url, params)
    response = resp.json()
    files_list = [response['query']['pages'][str(pageid)]['title'] for pageid in list(response['query']['pages'].keys())]
    while response: #continuation for response length greater than 500
        try:
            params.update(response['continue'])
            resp = requests.get(url, params)
            response = resp.json()
            files_list += [response['query']['pages'][str(pageid)]['title'] for pageid in list(response['query']['pages'].keys())]
        except:
            break

    return files_list

img('Category:...')
</code>```

second API call:

```<code>def user(title) -> str:

    url="https://co.media.org/w/api.php"

    params = {
            "action": "gpquery",
            "format": "json",
    }

    resp = requests.get(url, params)
    response = resp.json()

    response_pages = response['query']['pages']
    page_id = list(response_pages.keys())[0]  # automates the pageid for each file/a file
    userinfo = response_pages[page_id]['imageinfo'][0]['user'] # retrieves the value of item imageinfo
    return userinfo

user("File:..)

</code>```

count function: this uses a list comprehension for the above functions. the output is an integer.

```<code>def count(name) -> int:

    files_list = ['Category:.', 'Category:...', 'Category:...', 'Category:...', 'Category:...', 'Category:...', 'Category:..']

    for cat_name in files_list:

        users = [user(files) for files in img(cat_name) if name in user(files)]
        print(len(users))

count('cute')
</code>```

Body:
I am trying to run a series of Wikipedia API calls and the output of some of the calls are used in another function(for another API call). the individual API calls are fast(>1 minute) but the function that utilizes these API calls together takes approx. 1 hour.

first API call:

def img(cat_title) -> list:

    url="https://co.media.org/w/api.php"
    params = {
                "action": "query",
                "format": "json",
        }
    resp = requests.get(url, params)
    response = resp.json()
    files_list = [response['query']['pages'][str(pageid)]['title'] for pageid in list(response['query']['pages'].keys())]
    while response: #continuation for response length greater than 500
        try:
            params.update(response['continue'])
            resp = requests.get(url, params)
            response = resp.json()
            files_list += [response['query']['pages'][str(pageid)]['title'] for pageid in list(response['query']['pages'].keys())]
        except:
            break

    return files_list

img('Category:...')

second API call:

def user(title) -> str:

    url="https://co.media.org/w/api.php"

    params = {
            "action": "gpquery",
            "format": "json",
    }

    resp = requests.get(url, params)
    response = resp.json()

    response_pages = response['query']['pages']
    page_id = list(response_pages.keys())[0]  # automates the pageid for each file/a file
    userinfo = response_pages[page_id]['imageinfo'][0]['user'] # retrieves the value of item imageinfo
    return userinfo

user("File:..)

count function: this uses a list comprehension for the above functions. the output is an integer.

def count(name) -> int:

    files_list = ['Category:.', 'Category:...', 'Category:...', 'Category:...', 'Category:...', 'Category:...', 'Category:..']

    for cat_name in files_list:

        users = [user(files) for files in img(cat_name) if name in user(files)]
        print(len(users))

count('cute')


问:
How to create a filled 3d shaped enclosed by list of points in a numpy array?
A python novice here, so I am sorry if the question seems stupid. I am trying to create a 3D binary mask using a list of contour points. Basically, I want to take an empty 3-dimensional numpy array of a fixed shape and fill the region (all the pixels) enclosed by some points in a list (list of cartesian coordinates) as 1 and everything outside as 0. I will then write this array out into a volume file to use for some other things.

I haven't been able to find a package that can do this for a 3D array; I could only either find fill inside polygons for 2D arrays (using OpenCV). I would appreciate if you could point me to a package/approach that I can use for this.


问:
Scroll buttons not showing on select element with custom css
I've styled the scrollbars in my web app with the following CSS.  I've specifically styled it to show the buttons at the top and bottom of the scrollbar.

::-webkit-scrollbar{
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-thumb {
    background-color:rgba(155, 155, 155, 0.5);
}

::-webkit-scrollbar-button:single-button {
  background-color: rgba(155, 155, 155, 0.5);
  display: block;
  background-size: 10px;
  background-repeat: no-repeat;
}

::-webkit-scrollbar-button:single-button:vertical:increment{
 border-radius:0px 0px 10px 10px;
}

::-webkit-scrollbar-button:single-button:vertical:decrement{
 border-radius:10px 10px 0px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:increment{
 border-radius:0px 10px 10px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:decrement{
 border-radius:10px 0px 0px 10px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div></code>```

Works great on regular pages and scrollable divs, as you can see (when you run the code snippet) the scrollbar is styled and the buttons appear at the top and bottom of the bar. On select elements on the other hand, the top and bottom buttons do not appear.  Is it possible to show the buttons in a select?  If so, how?

::-webkit-scrollbar{
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-thumb {
    background-color:rgba(155, 155, 155, 0.5);
}

::-webkit-scrollbar-button:single-button {
  background-color: rgba(155, 155, 155, 0.5);
  display: block;
  background-size: 10px;
  background-repeat: no-repeat;
}

::-webkit-scrollbar-button:single-button:vertical:increment{
 border-radius:0px 0px 10px 10px;
}

::-webkit-scrollbar-button:single-button:vertical:decrement{
 border-radius:10px 10px 0px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:increment{
 border-radius:0px 10px 10px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:decrement{
 border-radius:10px 0px 0px 10px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><select>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
</select></code>```

Body:
I've styled the scrollbars in my web app with the following CSS.  I've specifically styled it to show the buttons at the top and bottom of the scrollbar.

::-webkit-scrollbar{
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-thumb {
    background-color:rgba(155, 155, 155, 0.5);
}

::-webkit-scrollbar-button:single-button {
  background-color: rgba(155, 155, 155, 0.5);
  display: block;
  background-size: 10px;
  background-repeat: no-repeat;
}

::-webkit-scrollbar-button:single-button:vertical:increment{
 border-radius:0px 0px 10px 10px;
}

::-webkit-scrollbar-button:single-button:vertical:decrement{
 border-radius:10px 10px 0px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:increment{
 border-radius:0px 10px 10px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:decrement{
 border-radius:10px 0px 0px 10px;
}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Works great on regular pages and scrollable divs, as you can see (when you run the code snippet) the scrollbar is styled and the buttons appear at the top and bottom of the bar. On select elements on the other hand, the top and bottom buttons do not appear.  Is it possible to show the buttons in a select?  If so, how?

::-webkit-scrollbar{
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-thumb {
    background-color:rgba(155, 155, 155, 0.5);
}

::-webkit-scrollbar-button:single-button {
  background-color: rgba(155, 155, 155, 0.5);
  display: block;
  background-size: 10px;
  background-repeat: no-repeat;
}

::-webkit-scrollbar-button:single-button:vertical:increment{
 border-radius:0px 0px 10px 10px;
}

::-webkit-scrollbar-button:single-button:vertical:decrement{
 border-radius:10px 10px 0px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:increment{
 border-radius:0px 10px 10px 0px;
}

::-webkit-scrollbar-button:single-button:horizontal:decrement{
 border-radius:10px 0px 0px 10px;
}

<select>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
<option>Why no scroll buttons?</option>
</select>


问:
Shell expansion
I have a question about how shell expands names in any directory/folder. Let's imagine we have two files called Docker.dmg and Docker (1).dmg (note the escape).

If I'd want to check if I have the file with the parentheses, I'd run a ls -la Docker\ [\(0-9\)]* and it'll show me the file (at least works in my Mac). The thing I'm not really understanding is why it doesn't work when I explicitly put the name like this:

```<code>ls -la Docker\ [\(0-9\)]\.dmg
</code>```

If I understand correctly how Regex work and how shell expansion works, the latter should work fine as I'm escaping every metacharacter as the name have multiple of these.

Like always, thank you.

Title: Shell expansion

Body:
I have a question about how shell expands names in any directory/folder. Let's imagine we have two files called Docker.dmg and Docker (1).dmg (note the escape).

If I'd want to check if I have the file with the parentheses, I'd run a ls -la Docker\ [\(0-9\)]* and it'll show me the file (at least works in my Mac). The thing I'm not really understanding is why it doesn't work when I explicitly put the name like this:

ls -la Docker\ [\(0-9\)]\.dmg

If I understand correctly how Regex work and how shell expansion works, the latter should work fine as I'm escaping every metacharacter as the name have multiple of these.

Like always, thank you.


问:
Springboot + Jersey 3 + Swagger-core - Nested @Beanparam not rendering correctly
I'm in a journey to upgrade swagger-jaxrs2-jakarta 1.6.8 to 2.2.7, I got almost everything working except some object parameters that should be exploded as inputs in the Swagger-ui and them still be interpreted as JSON input... and not as 2 distinct inputs

Java: 17 Springboot: 3.0.0

Jersey: 3.1.0

swagger-jaxrs2-jakarta: 2.2.7

Resource Interface

```<code>@Tag(name = "MyResource", description = "MyResource enpoint")
@Path("/")
@RequestMapping
public interface MyResourceAPI {

  @GET
  @Path("/get/{name}/something")
  @Produces(MediaType.APPLICATION_JSON)
  @Operation(summary = "MyResource")
  @GetMapping(value = "/get/{name}/something")
  @ApiResponses(value = {
      @ApiResponse(responseCode = "404", description = "Not found"),
      @ApiResponse(responseCode = "400", description = "Bad request"),
      @ApiResponse(responseCode = "200", description = "Sucesso", content = @Content(schema = @Schema(implementation = MyResourcehResponse.class)))
  })
  Response search(@Context HttpServletRequest servletRequest, @BeanParam MyCustomRequest myRequest);
}
</code>```

Resource Impl

```<code>@Component
public class MyResourceAPIImpl extends implements MyResourceAPI {

  @Override
  public Response search(HttpServletRequest servletRequest, MyCustomRequest myRequest) {
    #hidden logic
    return Response.ok().entity(myResponse).build();
  }
}
</code>```

Request's classes

```<code>public class MyCustomRequest extends Request {

}

public class Request {
  @BeanParam
  @Builder.Default
  private Pagination pagination = new Pagination();
}

public class Pagination {

  @QueryParam("limit")
  @DefaultValue("200")
  private Integer limit = 200;

  @QueryParam("offset")
  @DefaultValue("0")
  private Integer offset = 0;
}
</code>```

Using the version: 1.6.8, swagger-ui shows

After upgrade:

If I remove @QueryParam from Pagination items, they disappear, and if I remove @BeanParam from Pagination declaration, it works as a single JSON input.

I'm without any clue to fix this... anyone already got this issue or something similar and can help me?

Body:
I'm in a journey to upgrade swagger-jaxrs2-jakarta 1.6.8 to 2.2.7, I got almost everything working except some object parameters that should be exploded as inputs in the Swagger-ui and them still be interpreted as JSON input... and not as 2 distinct inputs

Java: 17 Springboot: 3.0.0

Jersey: 3.1.0

swagger-jaxrs2-jakarta: 2.2.7

Resource Interface

@Tag(name = "MyResource", description = "MyResource enpoint")
@Path("/")
@RequestMapping
public interface MyResourceAPI {

  @GET
  @Path("/get/{name}/something")
  @Produces(MediaType.APPLICATION_JSON)
  @Operation(summary = "MyResource")
  @GetMapping(value = "/get/{name}/something")
  @ApiResponses(value = {
      @ApiResponse(responseCode = "404", description = "Not found"),
      @ApiResponse(responseCode = "400", description = "Bad request"),
      @ApiResponse(responseCode = "200", description = "Sucesso", content = @Content(schema = @Schema(implementation = MyResourcehResponse.class)))
  })
  Response search(@Context HttpServletRequest servletRequest, @BeanParam MyCustomRequest myRequest);
}

Resource Impl

@Component
public class MyResourceAPIImpl extends implements MyResourceAPI {

  @Override
  public Response search(HttpServletRequest servletRequest, MyCustomRequest myRequest) {
    #hidden logic
    return Response.ok().entity(myResponse).build();
  }
}

Request's classes

public class MyCustomRequest extends Request {

}

public class Request {
  @BeanParam
  @Builder.Default
  private Pagination pagination = new Pagination();
}

public class Pagination {

  @QueryParam("limit")
  @DefaultValue("200")
  private Integer limit = 200;

  @QueryParam("offset")
  @DefaultValue("0")
  private Integer offset = 0;
}

Using the version: 1.6.8, swagger-ui shows

After upgrade:

If I remove @QueryParam from Pagination items, they disappear, and if I remove @BeanParam from Pagination declaration, it works as a single JSON input.

I'm without any clue to fix this... anyone already got this issue or something similar and can help me?


问:
Styled component not being respected between files?
For whatever reason, the buttons (defined by AboutItem) are displaying light blue backgrounds when I hover over them. I want to make it #282828.

In a separate file I define some styled components for Buttons:

```<code>export const Button = styled.button`
  display: inline-block;
  font-size: 1em;
  margin: 1em;
  padding: 0em 1em;
`;

export const InfoButton = styled(Button)`
  color: grey;
  &:hover {
    background-color: lightblue;
  }
`;
</code>```

which I then use:

```<code>interface AboutNavProps {
  selected: boolean;
}

const AboutItem = styled(InfoButton) <AboutNavProps>`
  color: grey;
  background-color: ${props => props.selected ? "#282828" : "transparent"};
  text-align: center;
  &:hover {
    background-color: #282828;
  }
`;

export function AboutNavbar() {
  const router = useRouter()
  useEffect(() => {
    router.prefetch("/method");
  }, [])

  return (
    <AboutNav aria-label="Navbar">
      <AboutItem as="a" href="method" selected={router.pathname == "/method"}>How It Works</AboutItem>
      <AboutItem as="a" href="about" selected={router.pathname == "/about"}>About</AboutItem>
      <Logo />
    </AboutNav>
  );
}
</code>```

Is there a reason for this? I don't understand why the light blue overrides the color I define for the hover.

Body:
For whatever reason, the buttons (defined by AboutItem) are displaying light blue backgrounds when I hover over them. I want to make it #282828.

In a separate file I define some styled components for Buttons:

export const Button = styled.button`
  display: inline-block;
  font-size: 1em;
  margin: 1em;
  padding: 0em 1em;
`;

export const InfoButton = styled(Button)`
  color: grey;
  &:hover {
    background-color: lightblue;
  }
`;

which I then use:

interface AboutNavProps {
  selected: boolean;
}

const AboutItem = styled(InfoButton) <AboutNavProps>`
  color: grey;
  background-color: ${props => props.selected ? "#282828" : "transparent"};
  text-align: center;
  &:hover {
    background-color: #282828;
  }
`;

export function AboutNavbar() {
  const router = useRouter()
  useEffect(() => {
    router.prefetch("/method");
  }, [])

  return (
    <AboutNav aria-label="Navbar">
      <AboutItem as="a" href="method" selected={router.pathname == "/method"}>How It Works</AboutItem>
      <AboutItem as="a" href="about" selected={router.pathname == "/about"}>About</AboutItem>
      <Logo />
    </AboutNav>
  );
}

Is there a reason for this? I don't understand why the light blue overrides the color I define for the hover.


问:
Adding the enumeration string name to enumeration value in clang, and then retrieve it in LLVM IR
I would like to add the enumeration string for enumeration value in the clang side and then retrieve it in llvm IR. Could anyone advise me about some tutorial or related data structures in clang? I appreciate any help here.

The example would be:
enum EnumType {ONE, TWO, THREE};
if there is a comparison instruction in IR : "icmp i32 %x, i32 2",  instead of knowing that x is compared with 2, I would like to know that this 2 is a pre-defined enumeration "TWO".


问:
Nginx: protect all but one url
I have try a few examples but all return almost the same, I want to password protect everything after .com/, problem is there are no "static" files, the server is Tomcat with nginx, the app is build on play framework.

The whole idea is that everything has to be password protected except for one url.

.com/service/contact {has to be protected}

.com/categories/service/contact {protected}

.com/service/jp/ {protected}

.com/service/jp/allo {Public not protected}

```<code>server {
...
auth_basic "Restricted Access"
auth_basic_user_file path_to_basic/password_protection

location ~^/service/jp/allo/ {
 auth_basic off;
 allow all;
 satisfy all;
 try_files $uri $uri/ =404;
}

}
</code>```

With that the first part is working which is to protect everything, but not the second part which to leave one url as public, in my case is returning a 404 error, not a custom 404 but an internal default 404.
The url's are "virtal" no actual folder exist, the server is using rewrite for seo url.

Title: Nginx: protect all but one url

Body:
I have try a few examples but all return almost the same, I want to password protect everything after .com/, problem is there are no "static" files, the server is Tomcat with nginx, the app is build on play framework.

The whole idea is that everything has to be password protected except for one url.

.com/service/contact {has to be protected}

.com/categories/service/contact {protected}

.com/service/jp/ {protected}

.com/service/jp/allo {Public not protected}

server {
...
auth_basic "Restricted Access"
auth_basic_user_file path_to_basic/password_protection

location ~^/service/jp/allo/ {
 auth_basic off;
 allow all;
 satisfy all;
 try_files $uri $uri/ =404;
}

}

With that the first part is working which is to protect everything, but not the second part which to leave one url as public, in my case is returning a 404 error, not a custom 404 but an internal default 404.
The url's are "virtal" no actual folder exist, the server is using rewrite for seo url.


问:
MissingLast is not working on Sorting using Nest Elastic Search
I am trying to sort on nested field "pricingscore" based on 2 conditions. I have this mapping with my Index

```<code>"mappings": {
    "doc": {
      "dynamic": "false",
      "properties": {
        "providerid": {
          "type": "long"
        },
        "pricingbytrade": {
          "type": "nested",
          "properties": {
            "name": {
              "type": "text",
              "fields": {
                "analyzed": {
                  "type": "text",
                  "analyzer": "standard",
                  "search_analyzer": "synonym_analyzer"
                },
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256,
                  "normalizer": "lowercase"
                }
              }
            },
            "pricingbycbsa": {
              "type": "nested",
              "properties": {
                "cbsaid": {
                  "type": "integer"
                },
                "cbsaname": {
                  "type": "text"
                },
                "pricingscore": {
                  "type": "float"
                }
              }
            }
          }
        }
      }
    }
  }

</code>```

I want all documents sorted on PricingScore Desc where pricingbytrade.name = X and pricingbytrade.pricingbycbsa.cbsaId = Y But all documents with missing pricingbytrade or inner properties should be shown last. I tried to use MissingLast() as below but It doesn't seem to work.

```<code>  "Pricing" => new SortDescriptor<Provider>().Field(so => so
                   .Field(f => f.PricingByTrades.First().PricingByCbsas.First().PricingScore)
                   .Order(SortOrder.Descending)
                   .MissingLast()
                   .Nested(n => n
                       .Path(p => p.PricingByTrades)
                        .Filter(q => q.Term(m => m
                            .Field(f => f.PricingByTrades.First().Name.Suffix("keyword"))
                            .Value(_searchTerm?.ToLower())
                            .Field(f => f.PricingByTrades.First().PricingByCbsas.First().CbsaId)
                             .Value(_cbsaId)))))
</code>```

I am sure I must be missing something with index configuration or code. Anyone can help solve this? Thank you!

EDIT :

I changed dynamic to  true in mapping to index pricingbytrade field but still it shows as not indexed filed. Does that make any difference for sorting?

Body:
I am trying to sort on nested field "pricingscore" based on 2 conditions. I have this mapping with my Index

"mappings": {
    "doc": {
      "dynamic": "false",
      "properties": {
        "providerid": {
          "type": "long"
        },
        "pricingbytrade": {
          "type": "nested",
          "properties": {
            "name": {
              "type": "text",
              "fields": {
                "analyzed": {
                  "type": "text",
                  "analyzer": "standard",
                  "search_analyzer": "synonym_analyzer"
                },
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256,
                  "normalizer": "lowercase"
                }
              }
            },
            "pricingbycbsa": {
              "type": "nested",
              "properties": {
                "cbsaid": {
                  "type": "integer"
                },
                "cbsaname": {
                  "type": "text"
                },
                "pricingscore": {
                  "type": "float"
                }
              }
            }
          }
        }
      }
    }
  }

I want all documents sorted on PricingScore Desc where pricingbytrade.name = X and pricingbytrade.pricingbycbsa.cbsaId = Y But all documents with missing pricingbytrade or inner properties should be shown last. I tried to use MissingLast() as below but It doesn't seem to work.

  "Pricing" => new SortDescriptor<Provider>().Field(so => so
                   .Field(f => f.PricingByTrades.First().PricingByCbsas.First().PricingScore)
                   .Order(SortOrder.Descending)
                   .MissingLast()
                   .Nested(n => n
                       .Path(p => p.PricingByTrades)
                        .Filter(q => q.Term(m => m
                            .Field(f => f.PricingByTrades.First().Name.Suffix("keyword"))
                            .Value(_searchTerm?.ToLower())
                            .Field(f => f.PricingByTrades.First().PricingByCbsas.First().CbsaId)
                             .Value(_cbsaId)))))

I am sure I must be missing something with index configuration or code. Anyone can help solve this? Thank you!

EDIT :

I changed dynamic to  true in mapping to index pricingbytrade field but still it shows as not indexed filed. Does that make any difference for sorting?


问:
Sample Mobile App for Testing Push Marketing
I am a mobile app development virgin. We just want to test our Marketing App with a push notification service and was wondering if I can install a sample mobile app on my phone and configure it with a Push Notification Service so that my marketing app is able to send notifications to the installed mobile app through the push notification service.
Can you please let me know if this is possible? If yes, which sample mobile app should I use and which Restful push notification service should I use for my demo?
Thanks a lot in advance.</p>


问:
Heuristic function for Pylos game
Pylos is a game constituted of a 4x4 pyramid board (4x4 below a 3x3 below a 2x2 below a 1). There are two players, one with White marbles and the other with Black marbles.

Each player has 15 marbles initially and takes turns placing a marble on the board on a free square (or if it is on a higher level, the 4 'support' squares of the lower level must be occupied).
The goal is that the opponent has no more marbles in his stock.
If you complete a square of marbles of the same color, you can remove two of your marbles from the board.
If you can move a marble to a higher level, you can do so (you save putting down a marble).

In short, my goal is to implement the best possible strategy for this game. For that, I have implemented a MinMax and I need a heuristic evaluation function. I can't go deeper than depth 4 in MinMax.

The naive heuristic returns the difference between my number of marbles in stock and that of my opponent.

I have tried to improve the heuristic by implementing same-color square detection, and upward movement detection, and also by giving importance to constraining an opponent's move, but the naive strategy sometimes still wins if it plays 2nd.

If you have any ideas for improvement, I would be grateful.

Title: Heuristic function for Pylos game


问:
Swiftui app having 2 different FCM tokens
I am trying to get the fcm token with:

```<code>let token = Messaging.messaging().fcmToken
</code>```

I get the token, but this is not the same token as what the application has. I am using Swift ui.

The way that I am trying to get my fcm token:

```<code>@main
struct iOSApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

    var body: some Scene {
        WindowGroup {

            let isLogin = UserDefaults.standard.bool(forKey: "isLogin")
            let isUser = UserDefaults.standard.bool(forKey: "isUser")

            let token = Messaging.messaging().fcmToken// here I should get the same token

            if(isLogin == false){
                LoginView(myFCMToken: token ?? "fcmioserrordan")
            }else
            {
                if(isUser == true){
                    UsersView(myFCMToken: token ?? "fcmioserrordan")
                }else{
                    RestaurantView(myFCMToken: token ?? "fcmioserrordan")
                }
            }
        }
    }
}
</code>```

My app delegate with the methods that add the token.
The extension AppDelegate:

```<code>extension AppDelegate: MessagingDelegate {
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {

      let deviceToken:[String: String] = ["token": fcmToken ?? ""]
        print("Device token: ", deviceToken) // This token can be used for testing notifications on FCM
    }
}
</code>```

Somehow this fcmToken is different from the above Messaging.messaging().fcmToken, how is this possible?

The AppDelegate:

```<code>class AppDelegate: NSObject, UIApplicationDelegate {
    let gcmMessageIDKey = "gcm.message_id"

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        FirebaseApp.configure()

        Messaging.messaging().delegate = self

        if #available(iOS 10.0, *) {
          // For iOS 10 display notification (sent via APNS)
          UNUserNotificationCenter.current().delegate = self

          let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
          UNUserNotificationCenter.current().requestAuthorization(
            options: authOptions,
            completionHandler: {_, _ in })
        } else {
          let settings: UIUserNotificationSettings =
          UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
          application.registerUserNotificationSettings(settings)
        }

        application.registerForRemoteNotifications()
        return true
    }

    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                     fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

      if let messageID = userInfo[gcmMessageIDKey] {
        print("Message ID: \(messageID)")
      }

      print(userInfo)

      completionHandler(UIBackgroundFetchResult.newData)
    }
}

</code>```

The rest of the implementation:

```<code>@available(iOS 10, *)
extension AppDelegate : UNUserNotificationCenterDelegate {

  // Receive displayed notifications for iOS 10 devices.
  func userNotificationCenter(_ center: UNUserNotificationCenter,
                              willPresent notification: UNNotification,
    withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    let userInfo = notification.request.content.userInfo

    if let messageID = userInfo[gcmMessageIDKey] {
        print("Message ID: \(messageID)")
    }

    print(userInfo)

    // Change this to your preferred presentation option
    completionHandler([[.banner, .badge, .sound]])
  }

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

    }

    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

    }

  func userNotificationCenter(_ center: UNUserNotificationCenter,
                              didReceive response: UNNotificationResponse,
                              withCompletionHandler completionHandler: @escaping () -> Void) {
    let userInfo = response.notification.request.content.userInfo

    if let messageID = userInfo[gcmMessageIDKey] {
      print("Message ID from userNotificationCenter didReceive: \(messageID)")
    }

    print(userInfo)

    completionHandler()
  }
}

</code>```

Body:
I am trying to get the fcm token with:

let token = Messaging.messaging().fcmToken

I get the token, but this is not the same token as what the application has. I am using Swift ui.

The way that I am trying to get my fcm token:

@main
struct iOSApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

    var body: some Scene {
        WindowGroup {

            let isLogin = UserDefaults.standard.bool(forKey: "isLogin")
            let isUser = UserDefaults.standard.bool(forKey: "isUser")

            let token = Messaging.messaging().fcmToken// here I should get the same token

            if(isLogin == false){
                LoginView(myFCMToken: token ?? "fcmioserrordan")
            }else
            {
                if(isUser == true){
                    UsersView(myFCMToken: token ?? "fcmioserrordan")
                }else{
                    RestaurantView(myFCMToken: token ?? "fcmioserrordan")
                }
            }
        }
    }
}

My app delegate with the methods that add the token.
The extension AppDelegate:

extension AppDelegate: MessagingDelegate {
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {

      let deviceToken:[String: String] = ["token": fcmToken ?? ""]
        print("Device token: ", deviceToken) // This token can be used for testing notifications on FCM
    }
}

Somehow this fcmToken is different from the above Messaging.messaging().fcmToken, how is this possible?

The AppDelegate:

class AppDelegate: NSObject, UIApplicationDelegate {
    let gcmMessageIDKey = "gcm.message_id"

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        FirebaseApp.configure()

        Messaging.messaging().delegate = self

        if #available(iOS 10.0, *) {
          // For iOS 10 display notification (sent via APNS)
          UNUserNotificationCenter.current().delegate = self

          let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
          UNUserNotificationCenter.current().requestAuthorization(
            options: authOptions,
            completionHandler: {_, _ in })
        } else {
          let settings: UIUserNotificationSettings =
          UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
          application.registerUserNotificationSettings(settings)
        }

        application.registerForRemoteNotifications()
        return true
    }

    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                     fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

      if let messageID = userInfo[gcmMessageIDKey] {
        print("Message ID: \(messageID)")
      }

      print(userInfo)

      completionHandler(UIBackgroundFetchResult.newData)
    }
}

The rest of the implementation:

@available(iOS 10, *)
extension AppDelegate : UNUserNotificationCenterDelegate {

  // Receive displayed notifications for iOS 10 devices.
  func userNotificationCenter(_ center: UNUserNotificationCenter,
                              willPresent notification: UNNotification,
    withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    let userInfo = notification.request.content.userInfo

    if let messageID = userInfo[gcmMessageIDKey] {
        print("Message ID: \(messageID)")
    }

    print(userInfo)

    // Change this to your preferred presentation option
    completionHandler([[.banner, .badge, .sound]])
  }

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

    }

    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

    }

  func userNotificationCenter(_ center: UNUserNotificationCenter,
                              didReceive response: UNNotificationResponse,
                              withCompletionHandler completionHandler: @escaping () -> Void) {
    let userInfo = response.notification.request.content.userInfo

    if let messageID = userInfo[gcmMessageIDKey] {
      print("Message ID from userNotificationCenter didReceive: \(messageID)")
    }

    print(userInfo)

    completionHandler()
  }
}


问:
Jackson - Deserializing after changing the data type of a class
I am making a data type change to an existing class A which is consumed by another client. Any changes to classA that are not updated on the client side will cause deserialization failures on the client side as its an incompatible change

ex:

```<code>public class classA {
    String id;
    List<String> names;
}
</code>```

Changing names to the following will cause failures on the client side when deserializing as client will look for List<String> names

```<code>public class classA {
    String id;
    Map<String, List<String>> names;

}
</code>```

What is the best practice to handle incompatible changes like these? I have referred a related question. Is there any cleaner way to handle this?

Body:
I am making a data type change to an existing class A which is consumed by another client. Any changes to classA that are not updated on the client side will cause deserialization failures on the client side as its an incompatible change

ex:

public class classA {
    String id;
    List<String> names;
}

Changing names to the following will cause failures on the client side when deserializing as client will look for List<String> names

public class classA {
    String id;
    Map<String, List<String>> names;

}

What is the best practice to handle incompatible changes like these? I have referred a related question. Is there any cleaner way to handle this?


问:
Unknown error when using JSON_ARRAY_APPEND()
This query works fine:

```<code>UPDATE `images` SET additional_images=JSON_ARRAY_APPEND(additional_images, '$', '{image.jpg}') WHERE `Item ID`=00352799
</code>```

But now I'm required to convert it to INSERT ON DUPLICATE KEY UPDATE for bulk updates using multiple VALUES().

I ended up converting my query to this:

```<code>INSERT INTO `images` (`Item ID`, `additional_images`) VALUES (00352799, 'image.jpg') ON DUPLICATE KEY UPDATE additional_images=JSON_ARRAY_APPEND(additional_images, '$', '{image.jpg}')
</code>```

But now I'm getting an error and I can't find any solution, was Googling for hours.

```<code>SQLSTATE[22032]: <<Unknown error>>: 3140 Invalid JSON text: "The document root must not be followed by other values." at position 1 in value for column 'images.additional_images'.
</code>```

Please help.

Body:
This query works fine:

UPDATE `images` SET additional_images=JSON_ARRAY_APPEND(additional_images, '$', '{image.jpg}') WHERE `Item ID`=00352799

But now I'm required to convert it to INSERT ON DUPLICATE KEY UPDATE for bulk updates using multiple VALUES().

I ended up converting my query to this:

INSERT INTO `images` (`Item ID`, `additional_images`) VALUES (00352799, 'image.jpg') ON DUPLICATE KEY UPDATE additional_images=JSON_ARRAY_APPEND(additional_images, '$', '{image.jpg}')

But now I'm getting an error and I can't find any solution, was Googling for hours.

SQLSTATE[22032]: <<Unknown error>>: 3140 Invalid JSON text: "The document root must not be followed by other values." at position 1 in value for column 'images.additional_images'.

Please help.


问:
Should debugging with VSCode + Local + Xdebug throw 14K+ Problems?
Disclaimer: I'm new to development, so it's possible this is normal.

I've written some code I'd like to debug. I've followed like five tutorials on integrating Xdebug, local, and VSCode to all play nice.

When I try to debug, it's debugging the entire site, not just the one file I want it to look at. Furthermore, I'm getting 14K+ errors in a single site installation, and they seem to be more because VSCode doesn't understand WordPress than actual problems?

I've tried installing a couple of snippet extensions, and added WordPress to my stubs. Here is my launch.json file:

Two questions:

How do I only debug what I'm interested in rather than the whole damn site, and

why the heck do I have 14K+ problems and how can I make them go away?


问:
Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found
I have a pom.xml file where I get this message Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found. I recently started using Maven and been looking around without any answer

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Declarations</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.9.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>19</source>
                    <target>19</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
</code>```

My issue is with

```<code><plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>19</source>
                    <target>19</target>
                </configuration>
            </plugin>
</code>```

maven-compiler-plugin says Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found.

Body:
I have a pom.xml file where I get this message Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found. I recently started using Maven and been looking around without any answer

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Declarations</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.9.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>19</source>
                    <target>19</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

My issue is with

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>19</source>
                    <target>19</target>
                </configuration>
            </plugin>

maven-compiler-plugin says Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found.


问:
TypeError: Class extends value undefined is not a constructor or null when using yarn pnp and typescript4
I am trying antlr4ts-sql in my project, which is part of monorepo using jazelle, typescript, yarn pnp.

Versions are:

```<code>% jz version
actual: 0.0.0-standalone.82
system: 0.0.0-standalone.74

% yarn -v
3.3.0
</code>```

My codes (from antlr4ts-sql repo):

```<code>import { antlr4tsSQL, SQLDialect } from 'antlr4ts-sql';

export class Experiment {
  public exp() {
    const antlr4tssql = new antlr4tsSQL(SQLDialect.MYSQL);
    const query = 'SELECT * FROM table1';
    const parseTree = antlr4tssql.getParseTreeFromSQL(query);
    console.log(parseTree);
  }
}
</code>```

but I got the following errors:

```<code>    TypeError: Class extends value undefined is not a constructor or null

    > 1 | import { antlr4tsSQL, SQLDialect } from 'antlr4ts-sql';
        | ^
      2 |
      3 |
      4 | export class Experiment {

      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/XPathLexer.ts:18:33)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/XPath.ts:16:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/index.ts:6:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/index.ts:18:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/index.ts:9:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-sql-npm-1.1.0-d18d4988c9-79289d09ea.zip/node_modules/antlr4ts-sql/index.ts:1:1)
      at Object.<anonymous> (src/autocomplete/experiments.ts:1:1)
      at Object.<anonymous> (src/autocomplete/index.ts:2:1)
      at Object.<anonymous> (src/index.ts:1:1)
      at Object.<anonymous> (__tests__/autocomplete/antlr4ts-sql.test.ts:1:1)
at module.exports (../../../../../common/@company/jest-config-utils/test-runner.js:19:44)
</code>```

when I unzip antlr4ts-sql-npm-1.1.0-d18d4988c9-79289d09ea.zip from .yarn/cache, I got the following:

enter image description here

it seems that there are XPathLexer.js and XPathLexer.d.ts in the unzip node_modules/dist/tree/xpath (which are Generated from XPathLexer.g4 by ANTLR 4.7.3-SNAPSHOT). but from the error message, test-runner.js is looking for at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/XPathLexer.ts:18:33) but XPathLexer.ts does not exist in the source code and does not exist in the antlr4ts-sql-npm-1.1.0-d18d4988c9-79289d09ea.zip of .yarn/cache

I am new to yarn pnp, not sure whether this is expected. My understanding is that jest should read antlr4ts-sql and antlr4ts from the zip file, but the errors means that they are not reading the zip files.

I guess something wrong with my deps and config.

tsconfig.json is

```<code>{
  "compilerOptions": {
    "noEmit": true,
    "target": "ES6",
    "module": "CommonJS",
    "lib": [
      "es6"
    ],
    "isolatedModules": true,
    "allowJs": true,
    "checkJs": true,
    "jsx": "react",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": ".",
    "resolveJsonModule": true,
    "declaration": true,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "importHelpers": true
  },
  "include": [
    "src/**/*.*",
    "__tests__/**/*.ts"
  ]
}
</code>```

package.json is

```<code>...
  "dependencies": {
    "antlr4ts-sql": "^1.1.0",
    "assert": "1.5.0",
    "tslib": "^2.1.0",
    "jest-pnp-resolver": "1.2.3"
  },
  "devDependencies": {
    "@types/jest": "^26.0.24",
    "babel-eslint": "10.1.0",
    "babel-jest": "28.1.3",
    "jest": "28.1.3",
    "jest-environment-jsdom": "28.1.3",
    "jest-environment-jsdom-global": "3.1.2",
    "patch-package": "6.2.2",
    "prettier": "^2.8.0",
  },
...
</code>```

I am stuck in this question for several days. Any comments welcomed. thanks

Body:
I am trying antlr4ts-sql in my project, which is part of monorepo using jazelle, typescript, yarn pnp.

Versions are:

% jz version
actual: 0.0.0-standalone.82
system: 0.0.0-standalone.74

% yarn -v
3.3.0

My codes (from antlr4ts-sql repo):

import { antlr4tsSQL, SQLDialect } from 'antlr4ts-sql';

export class Experiment {
  public exp() {
    const antlr4tssql = new antlr4tsSQL(SQLDialect.MYSQL);
    const query = 'SELECT * FROM table1';
    const parseTree = antlr4tssql.getParseTreeFromSQL(query);
    console.log(parseTree);
  }
}

but I got the following errors:

    TypeError: Class extends value undefined is not a constructor or null

    > 1 | import { antlr4tsSQL, SQLDialect } from 'antlr4ts-sql';
        | ^
      2 |
      3 |
      4 | export class Experiment {

      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/XPathLexer.ts:18:33)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/XPath.ts:16:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/index.ts:6:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/index.ts:18:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/index.ts:9:1)
      at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-sql-npm-1.1.0-d18d4988c9-79289d09ea.zip/node_modules/antlr4ts-sql/index.ts:1:1)
      at Object.<anonymous> (src/autocomplete/experiments.ts:1:1)
      at Object.<anonymous> (src/autocomplete/index.ts:2:1)
      at Object.<anonymous> (src/index.ts:1:1)
      at Object.<anonymous> (__tests__/autocomplete/antlr4ts-sql.test.ts:1:1)
at module.exports (../../../../../common/@company/jest-config-utils/test-runner.js:19:44)

when I unzip antlr4ts-sql-npm-1.1.0-d18d4988c9-79289d09ea.zip from .yarn/cache, I got the following:

enter image description here

it seems that there are XPathLexer.js and XPathLexer.d.ts in the unzip node_modules/dist/tree/xpath (which are Generated from XPathLexer.g4 by ANTLR 4.7.3-SNAPSHOT). but from the error message, test-runner.js is looking for at Object.<anonymous> (../../../../../../.yarn/cache/antlr4ts-npm-0.5.0-dev-7e0fc8988a-640dae2229.zip/node_modules/src/tree/xpath/XPathLexer.ts:18:33) but XPathLexer.ts does not exist in the source code and does not exist in the antlr4ts-sql-npm-1.1.0-d18d4988c9-79289d09ea.zip of .yarn/cache

I am new to yarn pnp, not sure whether this is expected. My understanding is that jest should read antlr4ts-sql and antlr4ts from the zip file, but the errors means that they are not reading the zip files.

I guess something wrong with my deps and config.

tsconfig.json is

{
  "compilerOptions": {
    "noEmit": true,
    "target": "ES6",
    "module": "CommonJS",
    "lib": [
      "es6"
    ],
    "isolatedModules": true,
    "allowJs": true,
    "checkJs": true,
    "jsx": "react",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": ".",
    "resolveJsonModule": true,
    "declaration": true,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "importHelpers": true
  },
  "include": [
    "src/**/*.*",
    "__tests__/**/*.ts"
  ]
}

package.json is

...
  "dependencies": {
    "antlr4ts-sql": "^1.1.0",
    "assert": "1.5.0",
    "tslib": "^2.1.0",
    "jest-pnp-resolver": "1.2.3"
  },
  "devDependencies": {
    "@types/jest": "^26.0.24",
    "babel-eslint": "10.1.0",
    "babel-jest": "28.1.3",
    "jest": "28.1.3",
    "jest-environment-jsdom": "28.1.3",
    "jest-environment-jsdom-global": "3.1.2",
    "patch-package": "6.2.2",
    "prettier": "^2.8.0",
  },
...

I am stuck in this question for several days. Any comments welcomed. thanks


问:
publish TypeScript source files to npm, not compiled Javascript
I am writing a library in Typescript and I want its users to be able access the source code. How to publish it to npm in original Typescript format?

Btw, why does the official TypeScript Publishing guide only publishes bundling of declaration files with the compiled .js files, no inclusion of .ts files.


问:
Initialization of an interface of Strings in Groovy
```<code>interface PRINT {
  def LN = '\n\n'
  def BREAK = '='*80
}
println PRINT.BREAK
</code>```

I'm getting this error while trying to initialize BREAK:

java.lang.NoClassDefFoundError: PRINT$1

There's an issue with  '='*80, what could be the reason and what would be a better approach for this?
It works without the multiplication.

Thanks for helping out.

Body:
interface PRINT {
  def LN = '\n\n'
  def BREAK = '='*80
}
println PRINT.BREAK

I'm getting this error while trying to initialize BREAK:

java.lang.NoClassDefFoundError: PRINT$1

There's an issue with  '='*80, what could be the reason and what would be a better approach for this?
It works without the multiplication.

Thanks for helping out.


问:
Error in eval(parse(text = paste0("list(", x, ")")), envir = envir) : attempt to apply non-function
i'm new in R
Error message : "

```<code>> modcop <- mread("copieAlirucumab.txt", "model")
Error in eval(parse(text = paste0("list(", x, ")")), envir = envir) :
  attempt to apply non-function
</code>```

i had this error message when i was writing a script to do simulation in mrgsolve

Body:
i'm new in R
Error message : "

> modcop <- mread("copieAlirucumab.txt", "model")
Error in eval(parse(text = paste0("list(", x, ")")), envir = envir) :
  attempt to apply non-function

i had this error message when i was writing a script to do simulation in mrgsolve


问:
tbl_merge keeps saying All objects in `tbls=` must be class 'gtsummary'
Using the tbl_merge function im trying to merge two linear regression tables together- one univariate and one multivariate. When I tried that, I keep getting an error message saying

Error: All objects in tbls= must be class 'gtsummary'

Looked for hours for answer and couldn't! Please help!

```<code>#--------------------------------------------------------------------
# Multivariate Linear regression
lm1<-lm(x1~y+z +a+ b + c1 , data = finaldata)

exp(coef(lm1))
exp(confint(lm1))

tbl_regression(lm1))%>%

  as_flex_table(lm1, include = everything(), return_calls = FALSE)%>%
  save_as_docx(path= "BLAH/BLAH/BLAH/BLAH.docx")
#-------------------------------------------------------------------------------------------------------
#Univariate Linear regression

Univariate_regression <-subset(finaldata, select = c(x1, y, z ,a ,b,c1))

tbl_uvregression( Univariate_regression %>% select(y, z ,a ,b,c1), y= x1, method= lm, exponentiate = FALSE) %>%

  as_flex_table(Univariate_regression, include = everything(), return_calls = FALSE)%>%
  save_as_docx(path= "BLAH/BLAH/BLAH/BLAH_REGRESSION.docx")

#-------------------------------------------------------------------------------------------------------
#Table Merges

tbl_merge(list(lm1,Univariate_regression),tab_spanner = c("Univariate", "Multivariate"))
</code>```

ERROR MESSAGE:

Error: All objects in tbls= must be class 'gtsummary'

Body:
Using the tbl_merge function im trying to merge two linear regression tables together- one univariate and one multivariate. When I tried that, I keep getting an error message saying

Error: All objects in tbls= must be class 'gtsummary'

Looked for hours for answer and couldn't! Please help!

#--------------------------------------------------------------------
# Multivariate Linear regression
lm1<-lm(x1~y+z +a+ b + c1 , data = finaldata)

exp(coef(lm1))
exp(confint(lm1))

tbl_regression(lm1))%>%

  as_flex_table(lm1, include = everything(), return_calls = FALSE)%>%
  save_as_docx(path= "BLAH/BLAH/BLAH/BLAH.docx")
#-------------------------------------------------------------------------------------------------------
#Univariate Linear regression

Univariate_regression <-subset(finaldata, select = c(x1, y, z ,a ,b,c1))

tbl_uvregression( Univariate_regression %>% select(y, z ,a ,b,c1), y= x1, method= lm, exponentiate = FALSE) %>%

  as_flex_table(Univariate_regression, include = everything(), return_calls = FALSE)%>%
  save_as_docx(path= "BLAH/BLAH/BLAH/BLAH_REGRESSION.docx")

#-------------------------------------------------------------------------------------------------------
#Table Merges

tbl_merge(list(lm1,Univariate_regression),tab_spanner = c("Univariate", "Multivariate"))

ERROR MESSAGE:

Error: All objects in tbls= must be class 'gtsummary'