问:
Convert .bib file into a new .acm file
I am trying to convert a .bib that can contains x number of article into a ACM file with said x number of ACM notation. I've written a bit of code but would like help with the rest.

The .bib is formatted this way -->

@ARTICLE{
8249726,
author={N. Khlif and A. Masmoudi and F. Kammoun and N. Masmoudi},
journal={IET Image Processing},
title={Secure chaotic dual encryption scheme for H.264/AVC video conferencing protection},
number={1},
year={2018},
volume={12},
pages={42-52},
keywords={adaptive codes;chaotic communication;cryptography;data compression;data protection;variable length codes;video coding;H.264/AVC video conferencing protection;advanced video coding protection;chaos-based crypto-compression scheme;compression ratio;context adaptive variable length coding;decision module;format compliance;inter-prediction encryption;intra-prediction encryption;piecewise linear chaotic maps;pseudorandom bit generators;secure chaotic dual encryption scheme;selective encryption approach;video compression standards},
doi={10.1049/iet-ipr.2017.0022},
ISSN={1751-9659},
month={Dec},
}

@ARTICLE{
8093611,
author={W. Wu and H. Mao and Y. Wang and J. Wang and W. Wang and C. Tian},
journal={IEEE Access},
title={CoolConferencing: Enabling Robust Peer-to-Peer Multi-Party Video Conferencing},
year={2017},
pages={25474-25486},
number={2},
volume={5},
keywords={Internet;peer-to-peer computing;teleconferencing;video communication;CoolConferencing design;MPVC approach;MPVC platform;any-view support;multirate support;optimal video transmission performance;overlay network;realistic network environments;resilient data-driven principle;robust MPVC system;robust peer-to-peer multiparty video conferencing;robust system;state-of-the-art video;Bandwidth;Delays;Internet;Peer-to-peer computing;Receivers;Robustness;Streaming media;Computer networks;peer to peer computing;streaming media},
doi={10.1109/ACCESS.2017.2768798},
ISSN={1751-9659},
month={Dec},
}
```
<p>Note that the .bib file can have any number of articles, 2 in this case so the .ACM file should have 2 ACM quotation. Also the articles information doesn't have specific line order.
I can't use any library that auto convert.</p>
<p>Here is the code that I have as of now. This code will read each line of 1 latex file and print all the information between { }, and now I need to save each information and then create a method to return the information in ACM format.</p>
<pre class="lang-java prettyprint-override"><code>public static void main(String[] args) {
    List<String> lines = new ArrayList<>();
    try {
        File myFile = new File("Latex1.bib");
        Scanner reader = new Scanner(myFile);
        while (reader.hasNextLine()) {
            Pattern pattern = Pattern.compile("=\\{([^}]*)");
            Matcher matcher = pattern.matcher(reader.nextLine());
            if (matcher.find()) {
                System.out.println(matcher.group(1));
            }
        }
    } catch (FileNotFoundException e) {
        e.getMessage();
    }
}
</code>```

Could you please complete it?

Title: Convert .bib file into a new .acm file

Body:
I am trying to convert a .bib that can contains x number of article into a ACM file with said x number of ACM notation. I've written a bit of code but would like help with the rest.

The .bib is formatted this way -->

@ARTICLE{
8249726,
author={N. Khlif and A. Masmoudi and F. Kammoun and N. Masmoudi},
journal={IET Image Processing},
title={Secure chaotic dual encryption scheme for H.264/AVC video conferencing protection},
number={1},
year={2018},
volume={12},
pages={42-52},
keywords={adaptive codes;chaotic communication;cryptography;data compression;data protection;variable length codes;video coding;H.264/AVC video conferencing protection;advanced video coding protection;chaos-based crypto-compression scheme;compression ratio;context adaptive variable length coding;decision module;format compliance;inter-prediction encryption;intra-prediction encryption;piecewise linear chaotic maps;pseudorandom bit generators;secure chaotic dual encryption scheme;selective encryption approach;video compression standards},
doi={10.1049/iet-ipr.2017.0022},
ISSN={1751-9659},
month={Dec},
}

@ARTICLE{
8093611,
author={W. Wu and H. Mao and Y. Wang and J. Wang and W. Wang and C. Tian},
journal={IEEE Access},
title={CoolConferencing: Enabling Robust Peer-to-Peer Multi-Party Video Conferencing},
year={2017},
pages={25474-25486},
number={2},
volume={5},
keywords={Internet;peer-to-peer computing;teleconferencing;video communication;CoolConferencing design;MPVC approach;MPVC platform;any-view support;multirate support;optimal video transmission performance;overlay network;realistic network environments;resilient data-driven principle;robust MPVC system;robust peer-to-peer multiparty video conferencing;robust system;state-of-the-art video;Bandwidth;Delays;Internet;Peer-to-peer computing;Receivers;Robustness;Streaming media;Computer networks;peer to peer computing;streaming media},
doi={10.1109/ACCESS.2017.2768798},
ISSN={1751-9659},
month={Dec},
}

Note that the .bib file can have any number of articles, 2 in this case so the .ACM file should have 2 ACM quotation. Also the articles information doesn't have specific line order.
I can't use any library that auto convert.

Here is the code that I have as of now. This code will read each line of 1 latex file and print all the information between { }, and now I need to save each information and then create a method to return the information in ACM format.

public static void main(String[] args) {
    List<String> lines = new ArrayList<>();
    try {
        File myFile = new File("Latex1.bib");
        Scanner reader = new Scanner(myFile);
        while (reader.hasNextLine()) {
            Pattern pattern = Pattern.compile("=\\{([^}]*)");
            Matcher matcher = pattern.matcher(reader.nextLine());
            if (matcher.find()) {
                System.out.println(matcher.group(1));
            }
        }
    } catch (FileNotFoundException e) {
        e.getMessage();
    }
}

Could you please complete it?


来源: stackexchange

问:
How can I send audio files from my app to Whatsapp?
I'm working on an app from which you can send audio to whatsapp. However, the codes that I am using are not working.

```<code>//This code returns an error and asks to try again to send the audio file
String sharePath = Environment.getExternalStorageDirectory().getPath()
                                + "android.resource://"
                                + wspActivity.this.getPackageName() + "/raw/" + "increible";
                        Uri uri = Uri.parse(sharePath);
                        Intent share = new Intent(Intent.ACTION_SEND);
                        share.setPackage("com.whatsapp");
                        share.setType("audio/*");
                        share.putExtra(Intent.EXTRA_STREAM, uri);
                        startActivity(Intent.createChooser(share, "Share Sound File"));

//This code indicates that the file is of an incompatible type.
final Intent share = new Intent(Intent.ACTION_SEND);
                        share.setType("audio/mp3");
                        final String path = copyFiletoExternalStorage(R.raw.increible, "increible.mp3");
                        final Uri soundUri = Uri.parse(path);
                        share.putExtra(Intent.EXTRA_STREAM, soundUri);
                        startActivity(Intent.createChooser(share, "Compartiendo..."));
</code>```
```<code>If anyone has any idea why this behaviour, I would appreciate it if you could share it :)
</code>```

I need to improve some of these codes to be able to send audio files from my app through whatsapp

ContentLicense: CC BY-SA 4.0

Body:
I'm working on an app from which you can send audio to whatsapp. However, the codes that I am using are not working.

//This code returns an error and asks to try again to send the audio file
String sharePath = Environment.getExternalStorageDirectory().getPath()
                                + "android.resource://"
                                + wspActivity.this.getPackageName() + "/raw/" + "increible";
                        Uri uri = Uri.parse(sharePath);
                        Intent share = new Intent(Intent.ACTION_SEND);
                        share.setPackage("com.whatsapp");
                        share.setType("audio/*");
                        share.putExtra(Intent.EXTRA_STREAM, uri);
                        startActivity(Intent.createChooser(share, "Share Sound File"));

//This code indicates that the file is of an incompatible type.
final Intent share = new Intent(Intent.ACTION_SEND);
                        share.setType("audio/mp3");
                        final String path = copyFiletoExternalStorage(R.raw.increible, "increible.mp3");
                        final Uri soundUri = Uri.parse(path);
                        share.putExtra(Intent.EXTRA_STREAM, soundUri);
                        startActivity(Intent.createChooser(share, "Compartiendo..."));

If anyone has any idea why this behaviour, I would appreciate it if you could share it :)

I need to improve some of these codes to be able to send audio files from my app through whatsapp


问:
405 during Feign client GET
Im currently trying to perform a GET method on my "Courses" microservice controller. But when i try to fetch i get a 405 error code.

The general idea is that i perform a GET on the "Courses" microservice to get objects by id from the "Purchases" microservice.

Feign class in the purchases where im performing a GET

```<code>@FeignClient(value = "COURSES", configuration = {
        FeignConfig.class
})
public interface CourseService {
    @GetMapping("/courses/all-by-id")
    CoursesByIdResponse getAllByCourseIds(@RequestBody CourseIdsRequest courseIds);
}
</code>```

Course Controller

```<code>@RestController()
@CrossOrigin(origins = "*", maxAge = 3600)
public class CourseController {

    private final CoursePaginatedService courseService;

    public CourseController(@Qualifier("paginatedService") CoursePaginatedService courseService) {
        this.courseService = courseService;
    }

    @GetMapping("/courses/all-by-id")
    public ResponseEntity<CoursesByIdResponse> getAllByCourseIds(@RequestBody CourseIdsRequest       courseIds){
         return ResponseEntity.ok(courseService.getAllByCourseIds(courseIds.getCourseIds()));
    }

}

</code>```

I have more methods in the Course controller that work propperly (200 ok).

```<code>@GetMapping("/courses/course/{id}")
public ResponseEntity<CourseByIdResponse> getCourseById(@PathVariable(value = "id") Long id){
    return ResponseEntity.ok(courseService.getCourseById(id));
}

</code>```

My Request and response classes.

```<code>
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseIdsRequest {
    private List<Long> courseIds;
}

@AllArgsConstructor
@NoArgsConstructor
@Data
public class CoursesByIdResponse {
    List<Course> courses;
}

</code>```

I have no idea what it could be.

Title: 405 during Feign client GET

Body:
Im currently trying to perform a GET method on my "Courses" microservice controller. But when i try to fetch i get a 405 error code.

The general idea is that i perform a GET on the "Courses" microservice to get objects by id from the "Purchases" microservice.

Feign class in the purchases where im performing a GET

@FeignClient(value = "COURSES", configuration = {
        FeignConfig.class
})
public interface CourseService {
    @GetMapping("/courses/all-by-id")
    CoursesByIdResponse getAllByCourseIds(@RequestBody CourseIdsRequest courseIds);
}

Course Controller

@RestController()
@CrossOrigin(origins = "*", maxAge = 3600)
public class CourseController {

    private final CoursePaginatedService courseService;

    public CourseController(@Qualifier("paginatedService") CoursePaginatedService courseService) {
        this.courseService = courseService;
    }

    @GetMapping("/courses/all-by-id")
    public ResponseEntity<CoursesByIdResponse> getAllByCourseIds(@RequestBody CourseIdsRequest       courseIds){
         return ResponseEntity.ok(courseService.getAllByCourseIds(courseIds.getCourseIds()));
    }

}

I have more methods in the Course controller that work propperly (200 ok).

@GetMapping("/courses/course/{id}")
public ResponseEntity<CourseByIdResponse> getCourseById(@PathVariable(value = "id") Long id){
    return ResponseEntity.ok(courseService.getCourseById(id));
}

My Request and response classes.

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseIdsRequest {
    private List<Long> courseIds;
}

@AllArgsConstructor
@NoArgsConstructor
@Data
public class CoursesByIdResponse {
    List<Course> courses;
}

I have no idea what it could be.


问:
Error in function "leveneTest" in shinyapp
I have a shiny app that is using levene's test in one part of the app. It works on Rstudio without any error, but I faced a problem when I transfered it on the web (using shinyapp.io). The app is runing but I can't see the result of levene's test.

Error:

```<code>An error has occurred. Check your logs or contact the app author for clarification.
</code>```

I found the error from Logs :

```<code>Error in leveneTest: could not find function "leveneTest"
</code>```

Why does it happened only on the web?

Body:
I have a shiny app that is using levene's test in one part of the app. It works on Rstudio without any error, but I faced a problem when I transfered it on the web (using shinyapp.io). The app is runing but I can't see the result of levene's test.

Error:

An error has occurred. Check your logs or contact the app author for clarification.

I found the error from Logs :

Error in leveneTest: could not find function "leveneTest"

Why does it happened only on the web?


问:
How does django add to cart with ajax-jquery work?
`
my variable productid from ajax data below returns an empty string
but my aim is to return product id from django sessions when user clicks the add-to-cart
,

```<code><script>
    $(document).on('click', '#add-cart-btn', function (e) {
        e.preventDefault();
        $.ajax({
            type: "POST",
            url: "{% url 'storebasket:add_to_cart'%}",
            data:{
                productid: $("#add-cart-btn").val(),
                csrfmiddlewaretoken: "{{csrf_token}}",
                action: "post"
            },
            success: function(json){

            },
            error: function (xhr, errmsg, err) {}

        });
    })
</script>`
</code>```

`
Here is the error raised:

`

`
File "C:\Users\DELL\Documents\PROGRAMMING\VSCODE\PYTHON\ecommerce\storebasket\views.py", line 19, in add_to_cart

product_id = int(request.POST.get('productid'))
ValueError: invalid literal for int() with base 10: ''
`

The view that raises the error:

```<code># capture ajax data
def add_to_cart(request):
    basket =MySession(request)
    if request.POST.get('action') == 'post':
        product_id = int(request.POST.get('productid'))
        product=get_object_or_404(Product, id=product_id)
        # save to MySession
        basket.add(product=product)
        response=JsonResponse({'test': 'data'})

        return response
</code>```

My session creation code is as follows:

```<code>class MySession():
    def __init__(self,request):
        self.session=request.session
        basket=self.session.get('S_key')

        if 'S_key' not in request.session:
            basket=self.session['S_key']={}
        self.basket=basket
        #request.session.modified = True

    def add(self, product):
        """
        Adding and updating the users basket session data
        """
        product_id = product.id

        if product_id not in self.basket:
            self.basket[product_id] = {'price': str(product.price)}
            # save in the session
        self.session.modified = True

</code>```

Body:
`
my variable productid from ajax data below returns an empty string
but my aim is to return product id from django sessions when user clicks the add-to-cart
,

`

`
Here is the error raised:

`

`
File "C:\Users\DELL\Documents\PROGRAMMING\VSCODE\PYTHON\ecommerce\storebasket\views.py", line 19, in add_to_cart

product_id = int(request.POST.get('productid'))
ValueError: invalid literal for int() with base 10: ''
`

The view that raises the error:

# capture ajax data
def add_to_cart(request):
    basket =MySession(request)
    if request.POST.get('action') == 'post':
        product_id = int(request.POST.get('productid'))
        product=get_object_or_404(Product, id=product_id)
        # save to MySession
        basket.add(product=product)
        response=JsonResponse({'test': 'data'})

        return response

My session creation code is as follows:

class MySession():
    def __init__(self,request):
        self.session=request.session
        basket=self.session.get('S_key')

        if 'S_key' not in request.session:
            basket=self.session['S_key']={}
        self.basket=basket
        #request.session.modified = True

    def add(self, product):
        """
        Adding and updating the users basket session data
        """
        product_id = product.id

        if product_id not in self.basket:
            self.basket[product_id] = {'price': str(product.price)}
            # save in the session
        self.session.modified = True


问:
unknown error: Chrome failed to start: exited normally. (unknown error: DevToolsActivePort file doesn't exist)
I have been trying to figure out an issue I have been experiencing with Selenium + Chrome driver since mid-November where when it tries to start Chrome it gives the following error:

```<code>Exception calling ".ctor" with "2" argument(s): "unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)"
</code>```

The issue just started happening and no updates were made to Chrome, the Chrome driver, or even the Selenium web driver.  I have tried to update to the latest versions of Chrome (currently Version 108.0.5359.99 (Official Build) (32-bit)), Chrome Driver (108.0.5359.71), and Selenium Web Driver (C# 4.7.0) but the issue persists.

Body:
I have been trying to figure out an issue I have been experiencing with Selenium + Chrome driver since mid-November where when it tries to start Chrome it gives the following error:

Exception calling ".ctor" with "2" argument(s): "unknown error: Chrome failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)"

The issue just started happening and no updates were made to Chrome, the Chrome driver, or even the Selenium web driver.  I have tried to update to the latest versions of Chrome (currently Version 108.0.5359.99 (Official Build) (32-bit)), Chrome Driver (108.0.5359.71), and Selenium Web Driver (C# 4.7.0) but the issue persists.


问:
iText 7 PDF custom font not found
I have a problem with loading a font inside a java application/PDF document.
When I run the application through the IDE, the font is loaded. If I compile the code and run the application, I get the error "Font...path..not found"

```<code>public static void createPDF(OrderHeader invoice, ObservableList<OrderItem> invoiceArticles) throws FileNotFoundException {

    String path1 = (CreatePDFInvoice.class.getClassLoader().getResource("css/Montserrat-Regular.ttf").getPath());
    String path2 = (CreatePDFInvoice.class.getClassLoader().getResource("css/Montserrat-Bold.ttf").getPath());
    String path3 = (CreatePDFInvoice.class.getClassLoader().getResource("css/Montserrat-SemiBold.ttf").getPath());

    try {

       PDFFont montserrant_font = PdfFontFactory.createFont(path1, "Identity-H", true);
       PDFFont  montseerantBold = PdfFontFactory.createFont(path2, "Identity-H", true);
       PDFFont  montserrant_Semibold = PdfFontFactory.createFont(path3, "Identity-H", true);

        String path = "invoice.pdf";
        PdfWriter pdfWriter = new PdfWriter(path);
        PdfDocument pdfDocument = new PdfDocument(pdfWriter);
        pdfDocument.setDefaultPageSize(PageSize.A4);
        Document document = new Document(pdfDocument);

        PageXofY event = new PageXofY(CreatePDFInvoice.class, pdfDocument);
        pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, event);

        setHeader(document);
        setCompanyData(document);
        document.add(sp);
        setInvoiceNo(document, invoice);
        setCustomerAndPayment(document, invoice);
        document.add(sp);
        setArticles(document, invoiceArticles);
        document.add(sp);
        setNote(document);
        document.add(sp);
        document.add(sp);
        setSignature(document);

        event.writeTotal(pdfDocument);
        document.close();

        if (Desktop.isDesktopSupported()) {
            try {
                File myFile = new File(path);
                Desktop.getDesktop().open(myFile);
            } catch (IOException ex) {
                // no application registered for PDFs
            }
        }

    } catch (Exception e) {
        System.out.println("Greska " + e.getMessage());
    }
}
</code>```

With the command "jar tf POS_main.jar" I inspect the .jar and see that it contains the file/font Montserrat-Regular.ttf

Error from logs: Greska Font file jar:file:/C:/Users/Armin/Desktop/POS/out/artifacts/POS/bundles/POS_main.jar!/css/Montserrat-Regular.ttf not found.

```<code>An error appears at line:
        montserrant_font = PdfFontFactory.createFont(path1, "Identity-H", true);
</code>```

Title: iText 7 PDF custom font not found

Body:
I have a problem with loading a font inside a java application/PDF document.
When I run the application through the IDE, the font is loaded. If I compile the code and run the application, I get the error "Font...path..not found"

public static void createPDF(OrderHeader invoice, ObservableList<OrderItem> invoiceArticles) throws FileNotFoundException {

    String path1 = (CreatePDFInvoice.class.getClassLoader().getResource("css/Montserrat-Regular.ttf").getPath());
    String path2 = (CreatePDFInvoice.class.getClassLoader().getResource("css/Montserrat-Bold.ttf").getPath());
    String path3 = (CreatePDFInvoice.class.getClassLoader().getResource("css/Montserrat-SemiBold.ttf").getPath());

    try {

       PDFFont montserrant_font = PdfFontFactory.createFont(path1, "Identity-H", true);
       PDFFont  montseerantBold = PdfFontFactory.createFont(path2, "Identity-H", true);
       PDFFont  montserrant_Semibold = PdfFontFactory.createFont(path3, "Identity-H", true);

        String path = "invoice.pdf";
        PdfWriter pdfWriter = new PdfWriter(path);
        PdfDocument pdfDocument = new PdfDocument(pdfWriter);
        pdfDocument.setDefaultPageSize(PageSize.A4);
        Document document = new Document(pdfDocument);

        PageXofY event = new PageXofY(CreatePDFInvoice.class, pdfDocument);
        pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, event);

        setHeader(document);
        setCompanyData(document);
        document.add(sp);
        setInvoiceNo(document, invoice);
        setCustomerAndPayment(document, invoice);
        document.add(sp);
        setArticles(document, invoiceArticles);
        document.add(sp);
        setNote(document);
        document.add(sp);
        document.add(sp);
        setSignature(document);

        event.writeTotal(pdfDocument);
        document.close();

        if (Desktop.isDesktopSupported()) {
            try {
                File myFile = new File(path);
                Desktop.getDesktop().open(myFile);
            } catch (IOException ex) {
                // no application registered for PDFs
            }
        }

    } catch (Exception e) {
        System.out.println("Greska " + e.getMessage());
    }
}

With the command "jar tf POS_main.jar" I inspect the .jar and see that it contains the file/font Montserrat-Regular.ttf

Error from logs: Greska Font file jar:file:/C:/Users/Armin/Desktop/POS/out/artifacts/POS/bundles/POS_main.jar!/css/Montserrat-Regular.ttf not found.

An error appears at line:
        montserrant_font = PdfFontFactory.createFont(path1, "Identity-H", true);


问:
I am unable to show data in my NextJS app using Sanity
Though the data is showing in the console but I am missing something. I am new to NextJS and Sanity.io. So Kindly help. Nextjs code is  not showing data in the frontend.

This is the NextJs code:

```<code>import React from "react";
// import Layout from '../components/Layout';
import client from '../utils/client';

export const TermsAndPolicy = (props) => {
  return (
    <>
      <div className="ease-in">
        <div>
          <h1 className="text-3xl font-medium text-center my-4">Terms and Conditions</h1>
          <h4 className="text-xl mx-8 py-8 ">
            <span>Last Updated:{props.terms.dateUpdated}</span>
          </h4>
        </div>
        <div>
          <div>
            <h2>{props.title}</h2>
          </div>
          <p className="md:text-justify text-center mx-8 py-8">
            {props.body}
          </p>
        </div>
      </div>
    </>
  );
};
export default TermsAndPolicy;
export const getServerSideProps = async () => {
  const query = `*[_type == "terms"]{
    title,
    subHeading,
    dateUpdated,
    url,
    body
  }`;
  const terms = await client.fetch(query)
  console.log(terms);
  return {
    props: {
      terms
    }
  };
}
</code>```

I have added the NextJs code above which shows that I have called the client and connected the app. But somehow I am unable to show the data from the backend into the frontend. Data in the console is showing as you can see below! So therefore it is connected properly. The data below is the data showing in console:

But data is not showing in the website. It is showing blank instead.

Body:
Though the data is showing in the console but I am missing something. I am new to NextJS and Sanity.io. So Kindly help. Nextjs code is  not showing data in the frontend.

This is the NextJs code:

import React from "react";
// import Layout from '../components/Layout';
import client from '../utils/client';

export const TermsAndPolicy = (props) => {
  return (
    <>

Terms and Conditions

            Last Updated:{props.terms.dateUpdated}

{props.title}

            {props.body}

    </>
  );
};
export default TermsAndPolicy;
export const getServerSideProps = async () => {
  const query = `*[_type == "terms"]{
    title,
    subHeading,
    dateUpdated,
    url,
    body
  }`;
  const terms = await client.fetch(query)
  console.log(terms);
  return {
    props: {
      terms
    }
  };
}

I have added the NextJs code above which shows that I have called the client and connected the app. But somehow I am unable to show the data from the backend into the frontend. Data in the console is showing as you can see below! So therefore it is connected properly. The data below is the data showing in console:

But data is not showing in the website. It is showing blank instead.


问:
Accessing a Word COM Add-in ribbon commands using VBA
I am not sure if this is even possible but I have a third-party COM add-in that allows data from our on-line CRM (Maximizer) to be integrated into a Word documents.  The Add-in creates its own menu in the Word Ribbon.

I have been trying to find a way to access the menu commands through VBA and I have searched and searched but can't find an answer.  Albeit, my limited knowledge of the correct terms may be hampering my search.

I was able to get SendKeys to work but everything I have read says to avoid this if at all possible. So I thought I would seek the advice of my Code Guru's here on StackOverflow.

```<code>    SendKeys "%"
    SendKeys "XM8"
    SendKeys "P"

</code>```

Body:
I am not sure if this is even possible but I have a third-party COM add-in that allows data from our on-line CRM (Maximizer) to be integrated into a Word documents.  The Add-in creates its own menu in the Word Ribbon.

I have been trying to find a way to access the menu commands through VBA and I have searched and searched but can't find an answer.  Albeit, my limited knowledge of the correct terms may be hampering my search.

I was able to get SendKeys to work but everything I have read says to avoid this if at all possible. So I thought I would seek the advice of my Code Guru's here on StackOverflow.

    SendKeys "%"
    SendKeys "XM8"
    SendKeys "P"


问:
How to detect mouse events within an HTML element's visual boundaries rather than descendants?
In my application I frequently use a React component that tracks mouse movements within its boundaries (the 'tracking component'). However, I often want it to be bigger than its parent (the 'root'). Therefore, I usually set position: absolute and set the width and height manually.

The problem is that setting position: absolute means that all child elements base their positioning off the tracking component rather the root and I need to write extra CSS to compensate. Elements need to be descendants of the tracking component for mousover events to trigger.

What I would like is to be able to write the tracking component as a sibling of my main content. It would be absolutely positioned to cover sibling content and it would detect mouseover events for any element that is visually within its bounds. It could then be dropped into an existing component tree without breaking any styling.

Here is a simple HTML example:

```<code><html>
    <head>
        <style>
         .pointer {
             position: absolute;
             height: 500px;
             width: 500px;
             border: 2px solid yellow;
             top: 100px;
             left: 0;
         }
         .child {
             height: 200px;
             width: 200px;
             border: 2px solid red;
         }
         .neighbour {
             position: relative;
             top: 0;
             left: 300px;
             height: 200px;
             width: 200px;
             border: 2px solid blue;
         }
        </style>
    </head>
    <body>
        <div class="neighbour"></div>
        <div class="pointer">
            <div class="child"></div>
        </div>
    </body>
</html>
</code>```

In this example (see Code Sandbox) I want mouseover to fire when the mouse enters the part of the neighbour div that is contained within the pointer's visual bounds. However, events only fire for child because it is a descendant of pointer.

Is there any way to have mouseover events respect the element's visual bounds rather than only firing for descendants?

I have tried finding any mouse event that fires even if mouseover does not, but all I can find is mousemove and that would fire too often to be useful. I have also tried to find a way to get child components to ignore their immediate parent's absolute positioning and follow the root's positioning instead, but I am not aware of any way to do that.

Body:
In my application I frequently use a React component that tracks mouse movements within its boundaries (the 'tracking component'). However, I often want it to be bigger than its parent (the 'root'). Therefore, I usually set position: absolute and set the width and height manually.

The problem is that setting position: absolute means that all child elements base their positioning off the tracking component rather the root and I need to write extra CSS to compensate. Elements need to be descendants of the tracking component for mousover events to trigger.

What I would like is to be able to write the tracking component as a sibling of my main content. It would be absolutely positioned to cover sibling content and it would detect mouseover events for any element that is visually within its bounds. It could then be dropped into an existing component tree without breaking any styling.

Here is a simple HTML example:

In this example (see Code Sandbox) I want mouseover to fire when the mouse enters the part of the neighbour div that is contained within the pointer's visual bounds. However, events only fire for child because it is a descendant of pointer.

Is there any way to have mouseover events respect the element's visual bounds rather than only firing for descendants?

I have tried finding any mouse event that fires even if mouseover does not, but all I can find is mousemove and that would fire too often to be useful. I have also tried to find a way to get child components to ignore their immediate parent's absolute positioning and follow the root's positioning instead, but I am not aware of any way to do that.


问:
White bar at top of Jpanel undecorated screen
Image of white bar

```<code>import java.awt.FlowLayout;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class DisplayImage {

    public static void main(String avg[]) throws IOException
    {
        DisplayImage abc=new DisplayImage();
    }

    public DisplayImage() throws IOException
    {

        BufferedImage img=ImageIO.read(new File("SP.jpg"));
        ImageIcon icon=new ImageIcon(img);
        JFrame frame=new JFrame();

        frame.setIconImage (new ImageIcon("SP.jpg").getImage());
        frame.setResizable(false);
        frame.setTitle("Demo");
        frame.setLayout(new FlowLayout());
        frame.setSize(1920, 1080);
        JLabel lbl=new JLabel();
        lbl.setIcon(icon);
        frame.add(lbl);
        frame.setUndecorated(true);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
}
</code>```

I thought this would produce a full screen of the Jpanel image and no white bar. I used the undecorated Jpanel function to try to make this happen but the white line appeared.

Body:
Image of white bar

import java.awt.FlowLayout;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class DisplayImage {

    public static void main(String avg[]) throws IOException
    {
        DisplayImage abc=new DisplayImage();
    }

    public DisplayImage() throws IOException
    {

        BufferedImage img=ImageIO.read(new File("SP.jpg"));
        ImageIcon icon=new ImageIcon(img);
        JFrame frame=new JFrame();

        frame.setIconImage (new ImageIcon("SP.jpg").getImage());
        frame.setResizable(false);
        frame.setTitle("Demo");
        frame.setLayout(new FlowLayout());
        frame.setSize(1920, 1080);
        JLabel lbl=new JLabel();
        lbl.setIcon(icon);
        frame.add(lbl);
        frame.setUndecorated(true);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
}

I thought this would produce a full screen of the Jpanel image and no white bar. I used the undecorated Jpanel function to try to make this happen but the white line appeared.


问:
how to access subject element from the saml request URL?
I would like to access the query parameter from the SAML request from IBM ISAM?  how can I access that parameter?  any suggestions are appreciated?

is it from LOGIN.html or access policy?

as of now, have not done anything as my dev environment is not working..


问:
Error Arguments Required and Given joomla
I have a problem and it is that I have a Joomla page hosted on ionos and I can enter the backend but in the frontend I get an error of 7 arguments are required 3 given. Someone knows what can it be?

Hello, I have a problem and it is that I have a Joomla page hosted on ionos and I can enter the backend but in the frontend I get an error of 7 arguments are required 3 given. Someone knows what can it be?


问:
How to theme remote modules in micro-frontend?
I have an Nx micro-frontend project that uses React and MUI and I am attempting to theme the host/container app and have that provide the theme to all children of the host/container.

However, I have ran into some issues when I attempt to import MUI components certain ways I get warnings in the console or the theme not being shared to the children. This seems to depend on the way I import the ThemeProvider and the MUI components.

If I use the ThemeProvider from "@mui/material/styles" with named MUI imports, the theme doesn't apply! And if use default imports, I get a warning:

You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used.

(and the remote theme isn't affected anyway)

If I use the ThemeProvider from "@mui/material" and use named imports, then everything works as expected.

However I'd prefer not to import all @mui and use default imports for each component.

Is there a correct way to have MUI and MFEs have a single theme AND have default imports?


问:
R Error: package or namespace load failed for ‘DNAcopy’ in dyn.load(file, DLLpath = DLLpath, ...):
I have installed an R package in my Macbook (Big Sur), but I am getting error when I use library(packagename). I have uninstalled the R and then reinstalled it, but it is still giving me same error. I am wondering if there are any PATH settings I need to do.

```<code>> BiocManager::install("DNAcopy", force = TRUE)
Bioconductor version 3.16 (BiocManager 1.30.19), R 4.2.2 (2022-10-31)
Installing package(s) 'DNAcopy'
trying URL 'https://bioconductor.org/packages/3.16/bioc/bin/macosx/contrib/4.2/DNAcopy_1.72.1.tgz'
Content type 'application/x-gzip' length 510684 bytes (498 KB)
==================================================
downloaded 498 KB

The downloaded binary packages are in
    /var/folders/h1/01m4_1gn65g63hvbv15tq7000000gr/T//RtmpEOBgrr/downloaded_packages
> library(DNAcopy)
Error: package or namespace load failed for ‘DNAcopy’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so, 6): Symbol not found: __gfortran_os_error_at
  Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so
  Expected in: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libgfortran.5.dylib
 in /Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so

</code>```

I would really appreciate any help.

I have tried re-insattling the packages as well as R.

Body:
I have installed an R package in my Macbook (Big Sur), but I am getting error when I use library(packagename). I have uninstalled the R and then reinstalled it, but it is still giving me same error. I am wondering if there are any PATH settings I need to do.

> BiocManager::install("DNAcopy", force = TRUE)
Bioconductor version 3.16 (BiocManager 1.30.19), R 4.2.2 (2022-10-31)
Installing package(s) 'DNAcopy'
trying URL 'https://bioconductor.org/packages/3.16/bioc/bin/macosx/contrib/4.2/DNAcopy_1.72.1.tgz'
Content type 'application/x-gzip' length 510684 bytes (498 KB)
==================================================
downloaded 498 KB

The downloaded binary packages are in
    /var/folders/h1/01m4_1gn65g63hvbv15tq7000000gr/T//RtmpEOBgrr/downloaded_packages
> library(DNAcopy)
Error: package or namespace load failed for ‘DNAcopy’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so, 6): Symbol not found: __gfortran_os_error_at
  Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so
  Expected in: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libgfortran.5.dylib
 in /Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so

I would really appreciate any help.

I have tried re-insattling the packages as well as R.


问:
Docker network configuration with GigE camera interface
I'm trying to containerize a program that uses the Vimba SDK to control a GigE camera, which is connected by Ethernet from a secondary network interface on the host system.

Vimba seems to want direct control over the camera network interface. For example, it brings the interface up and configures its MTU. It works to run the container with --network host to give it access to the eth0 interface on the host.

However I was wondering if it would be possible to use Docker networking to:

Allow the hosts on the LAN to access a web service running in the container (i.e., --publish 8080:8080/tcp).

Give the Vimba SDK a network interface it can control.

My attempt was to create a bridge network called net-1-lan and a macvlan network called net-2-cam. (Aside: The names are because when a container is in multiple networks, the network whose name comes first lexicographically gets chosen as the default route.)

```<code>docker network create net-1-lan  # bridge network
docker network create \
    --driver macvlan \
    --opt parent=eth0 \
    --subnet=169.254.1.0/24 \
    net-2-cam
</code>```

After I start my container in the bridge network, I use docker network connect to add the container to the macvlan network. However, the Vimba SDK does not detect the camera.

One thing I note, but am unsure is relevant, is that the container gets IP address 169.254.1.2 on the macvlan interface. When running in --network host mode, the interface claims 169.254.1.1.

Body:
I'm trying to containerize a program that uses the Vimba SDK to control a GigE camera, which is connected by Ethernet from a secondary network interface on the host system.

Vimba seems to want direct control over the camera network interface. For example, it brings the interface up and configures its MTU. It works to run the container with --network host to give it access to the eth0 interface on the host.

However I was wondering if it would be possible to use Docker networking to:

Allow the hosts on the LAN to access a web service running in the container (i.e., --publish 8080:8080/tcp).

Give the Vimba SDK a network interface it can control.

My attempt was to create a bridge network called net-1-lan and a macvlan network called net-2-cam. (Aside: The names are because when a container is in multiple networks, the network whose name comes first lexicographically gets chosen as the default route.)

docker network create net-1-lan  # bridge network
docker network create \
    --driver macvlan \
    --opt parent=eth0 \
    --subnet=169.254.1.0/24 \
    net-2-cam

After I start my container in the bridge network, I use docker network connect to add the container to the macvlan network. However, the Vimba SDK does not detect the camera.

One thing I note, but am unsure is relevant, is that the container gets IP address 169.254.1.2 on the macvlan interface. When running in --network host mode, the interface claims 169.254.1.1.


问:
Changing the tax class on checkout page via dropdown in WooCommerce
Have been trying to solve this for a couple days and decided to just break down and ask for some insight. I'm basing what I have off of these two solutions:

Change items tax rate in WooCommerce checkout based on radio buttons

Add a dynamic fee based on a select field in WooCommerce Checkout

I'm trying to use a drop down/select to change the tax class on the checkout page of WooCommerce.

I've left a lot alone from the two above examples but am still not getting the results expected. I also need to store & place the delivery location in the admin area & emails but need to get this tax class change issue sorted first.

Below is what I have right now. It seems like it should be working but alas, no joy.

```<code>// Add a custom select fields for packing option fee
add_action( 'woocommerce_after_order_notes', 'checkout_shipping_form_packing_addition', 20 );
function checkout_shipping_form_packing_addition( ) {
    $domain = 'woocommerce';

    echo '<tr class="packing-select"><th>' . __('Pickup Location', $domain) . '</th><td>';

    $chosen   = WC()->session->get('chosen_packing');

    // Add a custom checkbox field
    woocommerce_form_field( 'chosen_packing', array(
        'type'      => 'select',
        'class'     => array( 'form-row-wide packing' ),
        'options'   => array(
            ''    => __("Please select a location...", $domain),
            'BELGIUM - LOC' => sprintf( __("BELGIUM - LOC", $domain) ),
            'BROOTEN - LOC' => sprintf( __("BROOTEN - LOC", $domain) ),
            'OWATONNA - LOC' => sprintf( __("OWATONNA - LOC", $domain) ),
        ),
        'required'  => true,
    ), $chosen );

    echo '</td></tr>';
}

// jQuery - Ajax script
add_action( 'wp_footer', 'checkout_shipping_packing_script' );
function checkout_shipping_packing_script() {
    // Only checkout page
    if ( is_checkout() && ! is_wc_endpoint_url() ) :

    WC()->session->__unset('chosen_packing');
    ?>
    <script type="text/javascript">
    jQuery( function($){
        $('form.checkout').on('change', 'select#chosen_packing', function(){
            var p = $(this).val();
            console.log(p);
            $.ajax({
                type: 'POST',
                url: wc_checkout_params.ajax_url,
                data: {
                    'action': 'woo_get_ajax_data',
                    'packing': p,
                },
                success: function (result) {
                    $('body').trigger('update_checkout');
                    console.log('response: '+result); // just for testing | TO BE REMOVED
                },
                error: function(error){
                    console.log(error); // just for testing | TO BE REMOVED
                }
            });
        });
    });
    </script>
    <?php
    endif;
}

// Php Ajax (Receiving request and saving to WC session)
add_action( 'wp_ajax_woo_get_ajax_data', 'woo_get_ajax_data' );
add_action( 'wp_ajax_nopriv_woo_get_ajax_data', 'woo_get_ajax_data' );
function woo_get_ajax_data() {
    if ( isset($_POST['packing']) ){
        $packing = sanitize_key( $_POST['packing'] );
        WC()->session->set('chosen_packing', $packing );
        echo json_encode( $packing );
    }
    die(); // Alway at the end (to avoid server error 500)
}

// Add a custom dynamic packaging fee
add_action( 'woocommerce_before_calculate_totals', 'change_tax_class_conditionally', 1000 );
function change_tax_class_conditionally( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
        return;

    $domain      = "woocommerce";
    $packing_fee = WC()->session->get( 'chosen_packing' ); // Dynamic packing fee

    if ( $packing_fee === 'BELGIUM - LOC' ) {
        //$label = __("Bag packing fee", $domain);
        $tax_class  = '5 Percent';
    }
    if ( $packing_fee === 'BROOTEN - LOC' ) {
        //$label = __("Bag packing fee", $domain);
        $tax_class = '0 Percent';
    }
    if ( $packing_fee === 'CHER-MAKE - LOC' ) {
        //$label = __("Bag packing fee", $domain);
        $tax_class  = 'Reduced Rates';
    }

    // Loop through cart items
    foreach( $cart->get_cart() as $cart_item ){
        if( $choice === $field_value ) {
            $cart_item['data']->set_tax_class($tax_class);
        }
    }
}

// Field validation, as this packing field is required
add_action('woocommerce_checkout_process', 'packing_field_checkout_process');
function packing_field_checkout_process() {
    // Check if set, if its not set add an error.
    if ( isset($_POST['chosen_packing']) && empty($_POST['chosen_packing']) )
        wc_add_notice( __( "Please choose a packing option...", "woocommerce" ), 'error' );
}
</code>```

Body:
Have been trying to solve this for a couple days and decided to just break down and ask for some insight. I'm basing what I have off of these two solutions:

Change items tax rate in WooCommerce checkout based on radio buttons

Add a dynamic fee based on a select field in WooCommerce Checkout

I'm trying to use a drop down/select to change the tax class on the checkout page of WooCommerce.

I've left a lot alone from the two above examples but am still not getting the results expected. I also need to store & place the delivery location in the admin area & emails but need to get this tax class change issue sorted first.

Below is what I have right now. It seems like it should be working but alas, no joy.

// Add a custom select fields for packing option fee
add_action( 'woocommerce_after_order_notes', 'checkout_shipping_form_packing_addition', 20 );
function checkout_shipping_form_packing_addition( ) {
    $domain = 'woocommerce';

    echo '
' . __('Pickup Location', $domain) . '	';

    $chosen   = WC()->session->get('chosen_packing');

    // Add a custom checkbox field
    woocommerce_form_field( 'chosen_packing', array(
        'type'      => 'select',
        'class'     => array( 'form-row-wide packing' ),
        'options'   => array(
            ''    => __("Please select a location...", $domain),
            'BELGIUM - LOC' => sprintf( __("BELGIUM - LOC", $domain) ),
            'BROOTEN - LOC' => sprintf( __("BROOTEN - LOC", $domain) ),
            'OWATONNA - LOC' => sprintf( __("OWATONNA - LOC", $domain) ),
        ),
        'required'  => true,
    ), $chosen );

    echo '
';
}

// jQuery - Ajax script
add_action( 'wp_footer', 'checkout_shipping_packing_script' );
function checkout_shipping_packing_script() {
    // Only checkout page
    if ( is_checkout() && ! is_wc_endpoint_url() ) :

    WC()->session->__unset('chosen_packing');
    ?>

    <?php
    endif;
}

// Php Ajax (Receiving request and saving to WC session)
add_action( 'wp_ajax_woo_get_ajax_data', 'woo_get_ajax_data' );
add_action( 'wp_ajax_nopriv_woo_get_ajax_data', 'woo_get_ajax_data' );
function woo_get_ajax_data() {
    if ( isset($_POST['packing']) ){
        $packing = sanitize_key( $_POST['packing'] );
        WC()->session->set('chosen_packing', $packing );
        echo json_encode( $packing );
    }
    die(); // Alway at the end (to avoid server error 500)
}

// Add a custom dynamic packaging fee
add_action( 'woocommerce_before_calculate_totals', 'change_tax_class_conditionally', 1000 );
function change_tax_class_conditionally( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
        return;

    $domain      = "woocommerce";
    $packing_fee = WC()->session->get( 'chosen_packing' ); // Dynamic packing fee

    if ( $packing_fee === 'BELGIUM - LOC' ) {
        //$label = __("Bag packing fee", $domain);
        $tax_class  = '5 Percent';
    }
    if ( $packing_fee === 'BROOTEN - LOC' ) {
        //$label = __("Bag packing fee", $domain);
        $tax_class = '0 Percent';
    }
    if ( $packing_fee === 'CHER-MAKE - LOC' ) {
        //$label = __("Bag packing fee", $domain);
        $tax_class  = 'Reduced Rates';
    }

    // Loop through cart items
    foreach( $cart->get_cart() as $cart_item ){
        if( $choice === $field_value ) {
            $cart_item['data']->set_tax_class($tax_class);
        }
    }
}

// Field validation, as this packing field is required
add_action('woocommerce_checkout_process', 'packing_field_checkout_process');
function packing_field_checkout_process() {
    // Check if set, if its not set add an error.
    if ( isset($_POST['chosen_packing']) && empty($_POST['chosen_packing']) )
        wc_add_notice( __( "Please choose a packing option...", "woocommerce" ), 'error' );
}


问:
iText PDF library accessing ACRO fields with backslash
I encountered an iText exception writing to PDF form (developed by IRS using Adobe LiveCycle Designer) in particular a field named (topmostSubform[0].Page11[0].Header_SchH_Part2[0].a\.Average[0].c11_1[0])

The "\"  character, hexadecimal value 0x5C, cannot be included in a name.

The backslash is there correctly to escape period “.” in part “a.Average[0]” as opposed to be a path delimiter.

Anybody knows how to fix or avoid the issue?

I tried the name without the backslash but in that case the name cannot be found.


问:
Spring with cucumber tests not found by maven surfire or failsafe
I have project that runs integration tests apart from my main application. The tests are successfully run by IntelliJ but maven plugin isn't recognizing any tests. It is recognizing the BackendTests file.

```<code><build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M7</version>
            <configuration>
                <includes>
                    <include>**/BackendTests.java</include>
                </includes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M7</version>
            <configuration>
                <includes>
                    <include>**/BackendTests.java</include>
                </includes>
                <testFailureIgnore>true</testFailureIgnore>
            </configuration>
        </plugin>
    </plugins>
</build>
</code>```

These are my other dependencies in pom.xml:

```<code>        <!-- Spring boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>3.0.0</version>
            <scope>test</scope>
        </dependency>

        <!-- Lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.24</version>
        </dependency>

        <!-- Cucumber -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-spring</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
</code>```

That is my BackendTests file:

```<code>@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/resources/features",
        glue = {"backendtests.step", "backendtests.table", "backendtests.config"}
)
public class BackendTests {
}
</code>```

I have config directory with two files: AbstractIntegrationTest and SpringCucumberConfiguration.

```<code>@SpringBootTest
public class AbstractIntegrationTest {
}

.............

@CucumberContextConfiguration
@ContextConfiguration(classes = {Application.class, AbstractIntegrationTest.class}, loader = SpringBootContextLoader.class)
public class SpringCucumberConfiguration {
}
</code>```

And my steps are in step.definitions folder. Every step extends AbstractionIntegration test file. When I change <include>**/BackendTests.java</include> to <include>**/Gibberish.java</include> for example I don't see nothing about tests in the console when I run mvn clean install command. But if the filename is correct <include>**/BackendTests.java</include>, I see:

Body:
I have project that runs integration tests apart from my main application. The tests are successfully run by IntelliJ but maven plugin isn't recognizing any tests. It is recognizing the BackendTests file.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M7</version>
            <configuration>
                <includes>
                    <include>**/BackendTests.java</include>
                </includes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M7</version>
            <configuration>
                <includes>
                    <include>**/BackendTests.java</include>
                </includes>
                <testFailureIgnore>true</testFailureIgnore>
            </configuration>
        </plugin>
    </plugins>
</build>

These are my other dependencies in pom.xml:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>3.0.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.24</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-spring</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

That is my BackendTests file:

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/resources/features",
        glue = {"backendtests.step", "backendtests.table", "backendtests.config"}
)
public class BackendTests {
}

I have config directory with two files: AbstractIntegrationTest and SpringCucumberConfiguration.

@SpringBootTest
public class AbstractIntegrationTest {
}

.............

@CucumberContextConfiguration
@ContextConfiguration(classes = {Application.class, AbstractIntegrationTest.class}, loader = SpringBootContextLoader.class)
public class SpringCucumberConfiguration {
}

And my steps are in step.definitions folder. Every step extends AbstractionIntegration test file. When I change <include>**/BackendTests.java</include> to <include>**/Gibberish.java</include> for example I don't see nothing about tests in the console when I run mvn clean install command. But if the filename is correct <include>**/BackendTests.java</include>, I see:


问:
How to check QUOTED_IDENTIFIER value inside of a script?
I'd like to check the value of QUOTED_IDENTIFIER inside of a script I am running.

The script gets put together in a different process and I can't control other parts of it - just mine.  So I want to be able to change it to my preferred value, then reset it to whatever it was before my portion was run.

I tried SELECT * FROM master.dbo.spt_values sv WHERE sv.name = 'quoted_identifier', but it doesn't seem to reflect the current state.  I tried checking @@QUOTED_IDENTIFIER, but it doesn't exist in my version of SQL Server.  I tried to query sys.sysconfigures, but the information isn't there either.

Is it possible to check the current state of QUOTED_IDENTIFIER?


问:
Expo EAS: How do I get users with builds attached to older production release channels to get the latest changes I want?
I have an Expo app and use EAS updates to send over-the-air (OTA) updates to users.
As per the docs, I change the production release channel whenever I add a native module to the codebase, for example, I recently changed the production release channel from 4 to 5. When I put out this new build on the iOS app store, new users who downloaded the app were on the latest production release channel (5), so I could OTA new changes to this new release channel.

How do I get users with builds attached to older production release channels to get the latest changes I want? For example, I want to get users on release channels 1 - 4 to get the same changes as those on release channel 5. I can't OTA to those older channels since my current codebase has new native code changes that will break those older builds.

Is prompting them to manually download the latest version from the app store the only way? Is there a more effective strategy to use release channels / OTA updates so all users can be on the same version?

Attached below is my eas.json

```<code>{
  "build": {
    "production": {
      "releaseChannel": "5",
      "env": {
        "ENV": "PROD"
      },
      "cache": {
        "key": "newkey"
      }
    },
    "testflight": {
      "releaseChannel": "1",
      "env": {
        "ENV": "PROD"
      },
      "cache": {
        "key": "anything"
      }
    },
    "staging": {
      "releaseChannel": "staging",
      "ios": {
        "distribution": "internal"
      },
      "android": {
        "distribution": "internal"
      },
      "env": {
        "ENV": "STAGING"
      }
    },
    "development": {
      "ios": {
        "cache": {
          "key": "anything"
        },
        "developmentClient": true,
        "distribution": "internal"
      },
      "android": {
        "developmentClient": true,
        "distribution": "internal"
      }
    },
    "developmentiOSSimulator": {
      "ios": {
        "developmentClient": true,
        "simulator": true,
        "cache": {
          "key": "anything"
        }
      }
    }
  },
  "cli": {
    "version": ">= 0.34.1",
    "requireCommit": true
  }
}

</code>```

Specs:

Managed Build

Expo SDK: 44

expo-cli: 5.3.0

eas-cli: eas-cli/2.1.0 darwin-arm64 node-v16.14.0

Any help would be greatly appreciated!

Body:
I have an Expo app and use EAS updates to send over-the-air (OTA) updates to users.
As per the docs, I change the production release channel whenever I add a native module to the codebase, for example, I recently changed the production release channel from 4 to 5. When I put out this new build on the iOS app store, new users who downloaded the app were on the latest production release channel (5), so I could OTA new changes to this new release channel.

How do I get users with builds attached to older production release channels to get the latest changes I want? For example, I want to get users on release channels 1 - 4 to get the same changes as those on release channel 5. I can't OTA to those older channels since my current codebase has new native code changes that will break those older builds.

Is prompting them to manually download the latest version from the app store the only way? Is there a more effective strategy to use release channels / OTA updates so all users can be on the same version?

Attached below is my eas.json

{
  "build": {
    "production": {
      "releaseChannel": "5",
      "env": {
        "ENV": "PROD"
      },
      "cache": {
        "key": "newkey"
      }
    },
    "testflight": {
      "releaseChannel": "1",
      "env": {
        "ENV": "PROD"
      },
      "cache": {
        "key": "anything"
      }
    },
    "staging": {
      "releaseChannel": "staging",
      "ios": {
        "distribution": "internal"
      },
      "android": {
        "distribution": "internal"
      },
      "env": {
        "ENV": "STAGING"
      }
    },
    "development": {
      "ios": {
        "cache": {
          "key": "anything"
        },
        "developmentClient": true,
        "distribution": "internal"
      },
      "android": {
        "developmentClient": true,
        "distribution": "internal"
      }
    },
    "developmentiOSSimulator": {
      "ios": {
        "developmentClient": true,
        "simulator": true,
        "cache": {
          "key": "anything"
        }
      }
    }
  },
  "cli": {
    "version": ">= 0.34.1",
    "requireCommit": true
  }
}

Specs:

Managed Build

Expo SDK: 44

expo-cli: 5.3.0

eas-cli: eas-cli/2.1.0 darwin-arm64 node-v16.14.0

Any help would be greatly appreciated!


问:
Specify coloring & grouping variable (habillage) within factoextra::fviz_pca custom function

Question

I am creating a custom function that takes a dataframe, wrangles it to a PCA, and then plots a PCA using factoextra::fviz_pca but I am having trouble coloring the groups of the PCA using the habillage arguement. Or, what is the unknown object class of character that is the current bottleneck?

Data

```<code>library(tidyverse, stats, factoextra, FactoMineR)
test <- structure(list(sample = c("2-3", "4-2", "1-3", "4-3", "3-1",
"1-2", "1-2", "4-3", "1-1", "4-2", "2-2", "1-2", "2-1", "1-3",
"3-2", "1-2", "2-2", "2-2", "3-3", "1-1"), compound = c("2-Ethyl-5-methylpyrazine",
"Benzaldehyde", "Acetic Acid", "Acetic Acid", "2-Pentylfuran",
"Nonanoic acid", "alpha-Pinene", "Benzaldehyde", "2-Pentylfuran",
"alpha-Pinene", "Linalool", "2-Pentylfuran", "2-Pentylfuran",
"D-Limonene", "Hexanoic acid", "Benzaldehyde", "Acetic Acid",
"2-Pentylfuran", "Linalool", "Methoxyacetone"), conc = c(38761,
60293, 79800, 221687, 50454, 23236, 41678, 106749, 52317, 88502,
118724, 34832, 62559, 1380089, 29133, 61118, 666771, 55145, 67546,
37265), code = c("2", "4", "1", "4", "3", "1", "1", "4", "1",
"4", "2", "1", "2", "1", "3", "1", "2", "2", "3", "1")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -20L))
> test <- df4 %>% ungroup %>% slice_sample(n=20) %>% dput
structure(list(sample = c("4-1", "4-1", "1-3", "1-3", "2-2",
"1-1", "3-3", "3-2", "2-1", "3-3", "4-2", "2-2", "3-2", "4-3",
"2-2", "3-3", "4-3", "1-2", "2-1", "1-3"), compound = c("D-Limonene",
"Nonanal", "D-Limonene", "Nonanal", "alpha-Pinene", "2-Ethyl-5-methylpyrazine",
"Nonanal", "Hexanoic acid", "Nonanoic acid", "D-Limonene", "Benzaldehyde",
"Methoxyacetone", "Acetic Acid", "2-Pentylfuran", "Nonanoic acid",
"Methoxyacetone", "Benzaldehyde", "Acetic Acid", "D-Limonene",
"alpha-Pinene"), conc = c(857431, 26448, 1380089, 28883, 63246,
28726, 19727, 29133, 48460, 802456, 60293, 38083, 117253, 74652,
36791, 53665, 106749, 99287, 1019527, 123793), code = c("4",
"4", "1", "1", "2", "1", "3", "3", "2", "3", "4", "2", "3", "4",
"2", "3", "4", "1", "2", "1")), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -20L))
</code>```

Code

```<code>my_fviz <- function(df, plot_version, codes_to_plot_v) {
  df %>%
    filter(code %in% codes_to_plot_v) %>% ## I choose what codes I want to plot
    arrange(code) %>%
    group_by(sample, compound) %>%
    pivot_wider(
      names_from = compound,
      values_from = conc,
      values_fill = 0
    ) %>%
    # mutate(across(sample:code, ~as.factor(.))) %>%
    ungroup() %>%
    column_to_rownames(var = "sample") %>%
    #Recode codes to keys for viz labels, and consistent colors for each code
    mutate(code = as.factor(
      recode(
        code,
        `1` = "Key 1 ",
        #1B9E77
        `2` = "Key 2",
        #D95F02
        `3` = "Key 3",
        #7570B3
        `4` = "Key 4",
      )
    )) %>%   #E7298A
    select_if(~ is.numeric(.)) %>%
    prcomp(center = T, scale = T) %>%
    assign(paste0("a", plot_version, "_pca"), ., envir = .GlobalEnv)

fviz_pca(
      paste0("a", plot_version, "_pca"),
      # ind.sup = df$code,
      addEllipses = T,
      ellipse.level = 0.95,
      ellipse.type = "confidence",
      habillage = df$code,
      invisible = c("var"),
      label = "",
      repel = T,
      title = "",
      palette = Accent,
      legend.title = ""
    ) + theme(legend.text = element_text(size = 12))
}
</code>```

I continue getting the error which I can not interpret, because the dataframe has a class prcomp, so I suspect it is from my habillage pointing.

```<code>Error in .get_facto_class(X) :
An object of class : character can't be handled by factoextra
6.
stop("An object of class : ", class(X), " can't be handled by factoextra")
5.
.get_facto_class(X)
4.
facto_summarize(X, element = "var", result = c("coord", "contrib",
"cos2"), axes = axes)
3.
fviz_pca_biplot(X, ...)
2.
fviz_pca(paste0("a", plot_version, "_pca"), ind.sup = df$code,
addEllipses = T, ellipse.level = 0.95, ellipse.type = "confidence",
habillage = df$code, invisible = c("var"), label = "", repel = T,
title = "", palette = Accent, legend.title = "")
1.
naepca_fviz(test, 25, c(1, 2))
</code>```

Question

How can I get the function to output a PCA grouped and colored by the original code column?

Desired Output

```<code>> my_fviz(test, 2.1, c(1,2))
``` plots a grouped an colored PCA
```

Body:
Question

I am creating a custom function that takes a dataframe, wrangles it to a PCA, and then plots a PCA using factoextra::fviz_pca but I am having trouble coloring the groups of the PCA using the habillage arguement. Or, what is the unknown object class of character that is the current bottleneck?

Data

library(tidyverse, stats, factoextra, FactoMineR)
test <- structure(list(sample = c("2-3", "4-2", "1-3", "4-3", "3-1",
"1-2", "1-2", "4-3", "1-1", "4-2", "2-2", "1-2", "2-1", "1-3",
"3-2", "1-2", "2-2", "2-2", "3-3", "1-1"), compound = c("2-Ethyl-5-methylpyrazine",
"Benzaldehyde", "Acetic Acid", "Acetic Acid", "2-Pentylfuran",
"Nonanoic acid", "alpha-Pinene", "Benzaldehyde", "2-Pentylfuran",
"alpha-Pinene", "Linalool", "2-Pentylfuran", "2-Pentylfuran",
"D-Limonene", "Hexanoic acid", "Benzaldehyde", "Acetic Acid",
"2-Pentylfuran", "Linalool", "Methoxyacetone"), conc = c(38761,
60293, 79800, 221687, 50454, 23236, 41678, 106749, 52317, 88502,
118724, 34832, 62559, 1380089, 29133, 61118, 666771, 55145, 67546,
37265), code = c("2", "4", "1", "4", "3", "1", "1", "4", "1",
"4", "2", "1", "2", "1", "3", "1", "2", "2", "3", "1")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -20L))
> test <- df4 %>% ungroup %>% slice_sample(n=20) %>% dput
structure(list(sample = c("4-1", "4-1", "1-3", "1-3", "2-2",
"1-1", "3-3", "3-2", "2-1", "3-3", "4-2", "2-2", "3-2", "4-3",
"2-2", "3-3", "4-3", "1-2", "2-1", "1-3"), compound = c("D-Limonene",
"Nonanal", "D-Limonene", "Nonanal", "alpha-Pinene", "2-Ethyl-5-methylpyrazine",
"Nonanal", "Hexanoic acid", "Nonanoic acid", "D-Limonene", "Benzaldehyde",
"Methoxyacetone", "Acetic Acid", "2-Pentylfuran", "Nonanoic acid",
"Methoxyacetone", "Benzaldehyde", "Acetic Acid", "D-Limonene",
"alpha-Pinene"), conc = c(857431, 26448, 1380089, 28883, 63246,
28726, 19727, 29133, 48460, 802456, 60293, 38083, 117253, 74652,
36791, 53665, 106749, 99287, 1019527, 123793), code = c("4",
"4", "1", "1", "2", "1", "3", "3", "2", "3", "4", "2", "3", "4",
"2", "3", "4", "1", "2", "1")), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -20L))

Code

my_fviz <- function(df, plot_version, codes_to_plot_v) {
  df %>%
    filter(code %in% codes_to_plot_v) %>% ## I choose what codes I want to plot
    arrange(code) %>%
    group_by(sample, compound) %>%
    pivot_wider(
      names_from = compound,
      values_from = conc,
      values_fill = 0
    ) %>%
    # mutate(across(sample:code, ~as.factor(.))) %>%
    ungroup() %>%
    column_to_rownames(var = "sample") %>%
    #Recode codes to keys for viz labels, and consistent colors for each code
    mutate(code = as.factor(
      recode(
        code,
        `1` = "Key 1 ",
        #1B9E77
        `2` = "Key 2",
        #D95F02
        `3` = "Key 3",
        #7570B3
        `4` = "Key 4",
      )
    )) %>%   #E7298A
    select_if(~ is.numeric(.)) %>%
    prcomp(center = T, scale = T) %>%
    assign(paste0("a", plot_version, "_pca"), ., envir = .GlobalEnv)

fviz_pca(
      paste0("a", plot_version, "_pca"),
      # ind.sup = df$code,
      addEllipses = T,
      ellipse.level = 0.95,
      ellipse.type = "confidence",
      habillage = df$code,
      invisible = c("var"),
      label = "",
      repel = T,
      title = "",
      palette = Accent,
      legend.title = ""
    ) + theme(legend.text = element_text(size = 12))
}

I continue getting the error which I can not interpret, because the dataframe has a class prcomp, so I suspect it is from my habillage pointing.

Error in .get_facto_class(X) :
An object of class : character can't be handled by factoextra
6.
stop("An object of class : ", class(X), " can't be handled by factoextra")
5.
.get_facto_class(X)
4.
facto_summarize(X, element = "var", result = c("coord", "contrib",
"cos2"), axes = axes)
3.
fviz_pca_biplot(X, ...)
2.
fviz_pca(paste0("a", plot_version, "_pca"), ind.sup = df$code,
addEllipses = T, ellipse.level = 0.95, ellipse.type = "confidence",
habillage = df$code, invisible = c("var"), label = "", repel = T,
title = "", palette = Accent, legend.title = "")
1.
naepca_fviz(test, 25, c(1, 2))

Question

How can I get the function to output a PCA grouped and colored by the original code column?

Desired Output

> my_fviz(test, 2.1, c(1,2))
``` plots a grouped an colored PCA


问:
Refreshing the offline page
I have this problem for a long time and I can't figure it out by my own.

I have a project that is coded in Django. The project has some data in the SQL tables and there are some tables which are empty yet and the empty tables will be filled by the real date and time matches with the date and time which comes from SQL table.

Some how i manage this if my site is open. in the code i have a little refresher function like this;

```<code>// The refresher function;
function myFunction() {
    var x = document.getElementById("myDIV");
    if (x.style.display === "none") {
      x.style.display = "block";
    } else {
      x.style.display = "none";
    }
  }
  window.setTimeout( function() {
  window.location.reload();
}, 60000);
</code>```

It works fantastic if the site is open in the browser but I need it to work fine again if the website is not open in the browser.

Is there any way to manage that?

Title: Refreshing the offline page

Body:
I have this problem for a long time and I can't figure it out by my own.

I have a project that is coded in Django. The project has some data in the SQL tables and there are some tables which are empty yet and the empty tables will be filled by the real date and time matches with the date and time which comes from SQL table.

Some how i manage this if my site is open. in the code i have a little refresher function like this;

// The refresher function;
function myFunction() {
    var x = document.getElementById("myDIV");
    if (x.style.display === "none") {
      x.style.display = "block";
    } else {
      x.style.display = "none";
    }
  }
  window.setTimeout( function() {
  window.location.reload();
}, 60000);

It works fantastic if the site is open in the browser but I need it to work fine again if the website is not open in the browser.

Is there any way to manage that?


问:
How to set integer values in y-axis in R
I'm new to R programming can someone help with fix this problem,

for both scatterplot and histogram my class column has only 1,0 values but get output on my plot as 0.1,0.2...1.0

```<code>options(scipen = 999)

pdf("visualization.pdf")
# install.packages("scales")
# Scatter plot

library(tidyverse)
dataset <- read.csv("creditcard.csv")
amount <- dataset$Amount
class <- dataset$Class
plot(amount, class,
     main = "correlation between the amount of transaction and\n
     the occurrence of credit card fraud",
     xlab = "Amount", ylab = "Class",
     ylim = c(0, 3),
     pch = 19, frame = T
)
m <- lm(class ~ amount, data = dataset)
abline(m, col = "green")

# histogram

h <- hist(class,
     6,
     main = "",
     xlim = c(0, 3),
     ylab = "Amount",
     xlab = "Class",
     col = "red"
)
amount <- seq(min(class), max(class), 1)
Mn <- mean(class)
StdD <- sd(class)
y1 <- dnorm(amount, mean = Mn, sd = StdD)
y1 <- y1 * diff(h$mid[1:2] * length(class))
lines(amount, y1, col = "blue")

dev.off()
</code>```

On my y-axis I only need to show 0 and 1, I tried using

```<code>scale_y_continuous(breaks= pretty_breaks())
</code>```

but haven't solved my problem as it was giving errors

Body:
I'm new to R programming can someone help with fix this problem,

for both scatterplot and histogram my class column has only 1,0 values but get output on my plot as 0.1,0.2...1.0

options(scipen = 999)

pdf("visualization.pdf")
# install.packages("scales")
# Scatter plot

library(tidyverse)
dataset <- read.csv("creditcard.csv")
amount <- dataset$Amount
class <- dataset$Class
plot(amount, class,
     main = "correlation between the amount of transaction and\n
     the occurrence of credit card fraud",
     xlab = "Amount", ylab = "Class",
     ylim = c(0, 3),
     pch = 19, frame = T
)
m <- lm(class ~ amount, data = dataset)
abline(m, col = "green")

# histogram

h <- hist(class,
     6,
     main = "",
     xlim = c(0, 3),
     ylab = "Amount",
     xlab = "Class",
     col = "red"
)
amount <- seq(min(class), max(class), 1)
Mn <- mean(class)
StdD <- sd(class)
y1 <- dnorm(amount, mean = Mn, sd = StdD)
y1 <- y1 * diff(h$mid[1:2] * length(class))
lines(amount, y1, col = "blue")

dev.off()

On my y-axis I only need to show 0 and 1, I tried using

scale_y_continuous(breaks= pretty_breaks())

but haven't solved my problem as it was giving errors


问:
Autosuggestion is not enable on webview using websetting
I have found it impossible to correctly set the autocompletion of fields in html forms in an android studio webview:

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <RelativeLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ProgressBar
            android:id="@+id/progressbar_id"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#FFFFFF" />

        <WebView
            android:id="@+id/webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:usesCleartextTraffic="true" />
    </RelativeLayout>
</android.support.constraint.ConstraintLayout>
```
<p><strong>MainActivity.java:</strong></p>
<pre class="lang-java prettyprint-override"><code>package com.example.webview;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;

public class MainActivity extends AppCompatActivity {

    private WebView myWebView;
    private ProgressBar progressBar;

    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myWebView = findViewById(R.id.webview);
        progressBar = findViewById(R.id.progressbar_id);

        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        webSettings.setGeolocationEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setSaveFormData(true);
        WebViewClient webViewClient = new WebViewClient(){
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                progressBar.setVisibility(View.VISIBLE);
                myWebView.setVisibility(View.GONE);
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                progressBar.setVisibility(View.GONE);
                myWebView.setVisibility(View.VISIBLE);
            }
        };

        myWebView.setWebViewClient(webViewClient);
        myWebView.setSoundEffectsEnabled(true);

        myWebView.loadUrl("https://tcg-wallet.ga/home");
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Check if the key event was the Back button and if there's history
        if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
            myWebView.goBack();
            return true;
        }
        // If it wasn't the Back key or there's no web page history, bubble up to the default
        // system behavior (probably exit the activity)
        return super.onKeyDown(keyCode, event);
    }
}
</code>```

i have try using:

webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
```

but nothing happens there are no suggestions, I expected something like:

I don't know what I need to add to enable those suggestions!

Body:
I have found it impossible to correctly set the autocompletion of fields in html forms in an android studio webview:

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <RelativeLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ProgressBar
            android:id="@+id/progressbar_id"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#FFFFFF" />

        <WebView
            android:id="@+id/webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:usesCleartextTraffic="true" />
    </RelativeLayout>
</android.support.constraint.ConstraintLayout>

MainActivity.java:

package com.example.webview;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;

public class MainActivity extends AppCompatActivity {

    private WebView myWebView;
    private ProgressBar progressBar;

    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myWebView = findViewById(R.id.webview);
        progressBar = findViewById(R.id.progressbar_id);

        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        webSettings.setGeolocationEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setSaveFormData(true);
        WebViewClient webViewClient = new WebViewClient(){
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                progressBar.setVisibility(View.VISIBLE);
                myWebView.setVisibility(View.GONE);
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                progressBar.setVisibility(View.GONE);
                myWebView.setVisibility(View.VISIBLE);
            }
        };

        myWebView.setWebViewClient(webViewClient);
        myWebView.setSoundEffectsEnabled(true);

        myWebView.loadUrl("https://tcg-wallet.ga/home");
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Check if the key event was the Back button and if there's history
        if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
            myWebView.goBack();
            return true;
        }
        // If it wasn't the Back key or there's no web page history, bubble up to the default
        // system behavior (probably exit the activity)
        return super.onKeyDown(keyCode, event);
    }
}

i have try using:

webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

but nothing happens there are no suggestions, I expected something like:

I don't know what I need to add to enable those suggestions!


问:
Decorator to clear thread context for Spring @Scheduled annotation
Want to clear the thread contex post execution of the functions annotated with @Scheduled in spring boot

Usage

@Scheduled(fixedDelayString = "10000")
    publi void doSomething() {
}
```
<p>Config for scheduled thread pool</p>
<pre class="lang-java prettyprint-override"><code>@Bean(destroyMethod = "shutdownNow")
        public ScheduledExecutorService scheduledExecutorService() {
            return Executors.newScheduledThreadPool(5);
 }
</code>```

Have created a simple decorator to solve the same

package com.demo.decorator;

import com.demo.utils.GeneralUtils;
import org.springframework.core.task.TaskDecorator;

public class ThreadContextDecorator implements TaskDecorator {

    @Override
    public Runnable decorate(Runnable runnable) {
        return () -> {
            try {
                runnable.run();
            } finally {
                GeneralUtils.clearContext();
            }
        };
    }
}

```

Not sure how to add it in bean of ScheduledExecutorService

Body:
Want to clear the thread contex post execution of the functions annotated with @Scheduled in spring boot

Usage

@Scheduled(fixedDelayString = "10000")
    publi void doSomething() {
}

Config for scheduled thread pool

@Bean(destroyMethod = "shutdownNow")
        public ScheduledExecutorService scheduledExecutorService() {
            return Executors.newScheduledThreadPool(5);
 }

Have created a simple decorator to solve the same

package com.demo.decorator;

import com.demo.utils.GeneralUtils;
import org.springframework.core.task.TaskDecorator;

public class ThreadContextDecorator implements TaskDecorator {

    @Override
    public Runnable decorate(Runnable runnable) {
        return () -> {
            try {
                runnable.run();
            } finally {
                GeneralUtils.clearContext();
            }
        };
    }
}

Not sure how to add it in bean of ScheduledExecutorService


问:
Docker Volume Data Replication Sync or Async
To persist data of a docker container, volume is the solution.

But I wonder what the mechanism of this implementation is.

Does docker help us to replicate container files to the host? If so, is it synchronous or asynchronous?


问:
how do we specify base os version in ova live build
Everyone
I am learning how to live-build ova and want to know where do we specify base os version, like ubuntu 16.04. I tried grep build don't find version...
I have below code repo. Does anyone know some good tutorial for my case. Thanks.
If someone knows the answer for speciyfing os verion. That's event better.</p>
```<code>xxx live-build-aaa % ls
auto    config
xxx live-build-aaa % cd config
xxx config % ls
binary          chroot          functions       includes.chroot     package-lists
bootstrap       common          hooks           oem-config-preinstalled source
xxx config % cd hooks
xxx hooks % ls
001-divert-sync.chroot_early        032-disk-image.binary           051-hwclock.chroot          999-extras.binary
010-write-etc-ec2-version.chroot    033-disk-image-uefi.binary      060-ipv6.chroot             999-undivert-sync.chroot
020-pkg-configure.chroot        040-qcow2-image.binary          061-open-iscsi.chroot           ovf
025-create-groups.chroot        040-vmdk-image.binary           099-cleanup.chroot
030-root-tarball.binary         041-vmdk-ova-image.binary       099-oem-provision.chroot
031-root-xz.binary          042-vagrant.binary          999-cpc-fixes.chroot

</code>```

Body:
Everyone
I am learning how to live-build ova and want to know where do we specify base os version, like ubuntu 16.04. I tried grep build don't find version...
I have below code repo. Does anyone know some good tutorial for my case. Thanks.
If someone knows the answer for speciyfing os verion. That's event better.

xxx live-build-aaa % ls
auto    config
xxx live-build-aaa % cd config
xxx config % ls
binary          chroot          functions       includes.chroot     package-lists
bootstrap       common          hooks           oem-config-preinstalled source
xxx config % cd hooks
xxx hooks % ls
001-divert-sync.chroot_early        032-disk-image.binary           051-hwclock.chroot          999-extras.binary
010-write-etc-ec2-version.chroot    033-disk-image-uefi.binary      060-ipv6.chroot             999-undivert-sync.chroot
020-pkg-configure.chroot        040-qcow2-image.binary          061-open-iscsi.chroot           ovf
025-create-groups.chroot        040-vmdk-image.binary           099-cleanup.chroot
030-root-tarball.binary         041-vmdk-ova-image.binary       099-oem-provision.chroot
031-root-xz.binary          042-vagrant.binary          999-cpc-fixes.chroot


问:
Doubles Round Robin Sorting Algorithm
Background:  I have a group of 6 guys that get together and play pickleball every week.  We play 2v2 and 2 players sit each game.  We play 2 sets of 6 games each week (12 total games) - in each set, each player plays 4 games, and sits for 2 games.  At the end of each set, each player totals up the amount of points he scores, and we have a winner.

Anyway, I worked out all the combinations of games for 6 people for playing doubles.  There are a total of 45 unique games that could be played, where every combination of partners would play every other combination of partners.  I would like to come up with a schedule to play all 45 of these games across 4 sessions of 2 sets each for a total of 8 sets (the final 3 games in the last set can be arbitrary since 6x8=48, and there are only 45 unique games).

The problem comes in with determining the order of the games, such that following criteria is met, for each of the sets of 6 games:

Each player plays 4 games, and sits for 2 games.

No player sits for 2 consecutive games.

Each player partners with a different partner every game.  (i.e. no 2 players partner more than once per set).

Where I could use help is figuring out the algorithm to come up with the optimal order of games.  With 45 factorial possible orders ~1e56...it's too many to brute force.  Any advice would be appreciated.

```<code>All the combinations for players A, B, C, D, E, and F:
T1  T2  Bye
AB  CD  EF
AB  CE  DF
AB  CF  DE
AB  DE  CF
AB  DF  CE
AB  EF  CD
AC  BD  EF
AC  BE  DF
AC  BF  DE
AC  DE  BF
AC  DF  BE
AC  EF  BD
AD  BC  EF
AD  BE  CF
AD  BF  CE
AD  CE  BF
AD  CF  BE
AD  EF  BC
AE  BC  DF
AE  BD  CF
AE  BF  CD
AE  CD  BF
AE  CF  BD
AE  DF  BC
AF  BC  DE
AF  BD  CE
AF  BE  CD
AF  CD  BE
AF  CE  BD
AF  DE  BC
BC  DE  AF
BC  DF  AE
BC  EF  AD
BD  CE  AF
BD  CF  AE
BD  EF  AC
BE  CD  AF
BE  CF  AD
BE  DF  AC
BF  CD  AE
BF  CE  AD
BF  DE  AC
CD  EF  AB
CE  DF  AB
CF  DE  AB
</code>```

Tried writing a brute force algorithm in Excel VBA...seems like it was going to take forever to run.

Title: Doubles Round Robin Sorting Algorithm

Body:
Background:  I have a group of 6 guys that get together and play pickleball every week.  We play 2v2 and 2 players sit each game.  We play 2 sets of 6 games each week (12 total games) - in each set, each player plays 4 games, and sits for 2 games.  At the end of each set, each player totals up the amount of points he scores, and we have a winner.

Anyway, I worked out all the combinations of games for 6 people for playing doubles.  There are a total of 45 unique games that could be played, where every combination of partners would play every other combination of partners.  I would like to come up with a schedule to play all 45 of these games across 4 sessions of 2 sets each for a total of 8 sets (the final 3 games in the last set can be arbitrary since 6x8=48, and there are only 45 unique games).

The problem comes in with determining the order of the games, such that following criteria is met, for each of the sets of 6 games:

Each player plays 4 games, and sits for 2 games.

No player sits for 2 consecutive games.

Each player partners with a different partner every game.  (i.e. no 2 players partner more than once per set).

Where I could use help is figuring out the algorithm to come up with the optimal order of games.  With 45 factorial possible orders ~1e56...it's too many to brute force.  Any advice would be appreciated.

All the combinations for players A, B, C, D, E, and F:
T1  T2  Bye
AB  CD  EF
AB  CE  DF
AB  CF  DE
AB  DE  CF
AB  DF  CE
AB  EF  CD
AC  BD  EF
AC  BE  DF
AC  BF  DE
AC  DE  BF
AC  DF  BE
AC  EF  BD
AD  BC  EF
AD  BE  CF
AD  BF  CE
AD  CE  BF
AD  CF  BE
AD  EF  BC
AE  BC  DF
AE  BD  CF
AE  BF  CD
AE  CD  BF
AE  CF  BD
AE  DF  BC
AF  BC  DE
AF  BD  CE
AF  BE  CD
AF  CD  BE
AF  CE  BD
AF  DE  BC
BC  DE  AF
BC  DF  AE
BC  EF  AD
BD  CE  AF
BD  CF  AE
BD  EF  AC
BE  CD  AF
BE  CF  AD
BE  DF  AC
BF  CD  AE
BF  CE  AD
BF  DE  AC
CD  EF  AB
CE  DF  AB
CF  DE  AB

Tried writing a brute force algorithm in Excel VBA...seems like it was going to take forever to run.


问:
How to center align the text of an ipywidgets.Text widget
Consider 3 different ways to display text input using jupyter ipywidgets:

```<code>from ipywidgets import Text,HTML,Layout
from IPython.display import display

# Using the HTML widget
input_html = """
<html>
<head>
<body>
<input size=20 type="text" style="text-align:center" value="HTML">
</body>
</html>
"""
my_widget = HTML(value=input_html,layout=Layout(width='50%'))
display(my_widget)

# Using the Text widget, without specifying a layout
display(Text(value = "Text"))

# Using the Text widget, specifying a layout
mylayout = layout=Layout(
    justify_content="center",
    width="50%",
    border="solid"
)
display(Text(value="Text/Layout ",layout=mylayout))
</code>```

The ipywidgets.HTML widget displays the input control with the text centered properly.  I have not been able to find any combination of ipywidgets.Layout or ipywidgets.Style attributes that properly center text using the Text widget (or Textarea).

I have searched quite a bit for the answer, and have not had any luck.  Text centering works well with other widgets like ipywidgets.Label and ipywidgets.Button.  However, the Text widget does not appear to allow for text centering.

I have read through the documentation pages below, that treat Styling and Layouts:

https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Styling.html
https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Layout.html

Finally, I have searched on google and Stackoverflow (directly) using search strings like:
ipywidgets Text center
ipywidgets Text text-align
jupyter widgets center the text in a Text widget

I have not yet found an answer.

Thanks much for any help

Body:
Consider 3 different ways to display text input using jupyter ipywidgets:

from ipywidgets import Text,HTML,Layout
from IPython.display import display

# Using the HTML widget
input_html = """

<input size=20 type="text" style="text-align:center" value="HTML">

"""
my_widget = HTML(value=input_html,layout=Layout(width='50%'))
display(my_widget)

# Using the Text widget, without specifying a layout
display(Text(value = "Text"))

# Using the Text widget, specifying a layout
mylayout = layout=Layout(
    justify_content="center",
    width="50%",
    border="solid"
)
display(Text(value="Text/Layout ",layout=mylayout))

The ipywidgets.HTML widget displays the input control with the text centered properly.  I have not been able to find any combination of ipywidgets.Layout or ipywidgets.Style attributes that properly center text using the Text widget (or Textarea).

I have searched quite a bit for the answer, and have not had any luck.  Text centering works well with other widgets like ipywidgets.Label and ipywidgets.Button.  However, the Text widget does not appear to allow for text centering.

I have read through the documentation pages below, that treat Styling and Layouts:

https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Styling.html
https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Layout.html

Finally, I have searched on google and Stackoverflow (directly) using search strings like:
ipywidgets Text center
ipywidgets Text text-align
jupyter widgets center the text in a Text widget

I have not yet found an answer.

Thanks much for any help