问:
Netlify Typescript express lambda
I'm creating an typescript express api and I want to export it

What's the es6 equivalent for

```<code>app.use(bodyParser);
app.post('/updatestate', (req, res) => {
const newValue = updateDatabase(res.body);
  res.json(newValue);
});
module.exports.handler = serverless(app);

</code>```

in the .ts lambda file?

And if the function is deployed in http://localhost:9999/.netlify/functions/abc,
the request should me made in http://localhost:9999/.netlify/functions/abc/updatestate
to update the database?

I want to use this express app to be called in a shopify webhook

Title: Netlify Typescript express lambda

Body:
I'm creating an typescript express api and I want to export it

What's the es6 equivalent for

app.use(bodyParser);
app.post('/updatestate', (req, res) => {
const newValue = updateDatabase(res.body);
  res.json(newValue);
});
module.exports.handler = serverless(app);

in the .ts lambda file?

And if the function is deployed in http://localhost:9999/.netlify/functions/abc,
the request should me made in http://localhost:9999/.netlify/functions/abc/updatestate
to update the database?

I want to use this express app to be called in a shopify webhook


来源: stackexchange

问:
Function with cycle print 2 times before the first plot
My function prints 2 times before the first plot and this leads to misalignment between what is written and the graphs.

My function:

```<code>descriptive <- function(df1, df2){
        column_names <- colnames(df1)

        for (column in column_names) {

            par(mfrow=c(1,2))

            print("<= 8")
            print(summary(df1[[column]]))
            hist(df1[[column]], main="<= 8", col="blue",ylim= c(0,500))

            print("<= 18")
            print(summary(df2[[column]]))
            hist(df2[[column]], main="<= 18", col="blue", ylim = c(0, 500))

            mtext(column, side = 3, line = - 2, outer = TRUE)
        }
}
</code>```

The result of first cycle (first variable) is:

The second one (second variable) is:

But since in the first cycle it prints two times the info before the plot everything is misaligned by one step. How can I avoid this behavior by the function? I'd like to have since the beginning the behavior you can see in the second cycle.

ContentLicense: CC BY-SA 4.0

Body:
My function prints 2 times before the first plot and this leads to misalignment between what is written and the graphs.

My function:

descriptive <- function(df1, df2){
        column_names <- colnames(df1)

        for (column in column_names) {

            par(mfrow=c(1,2))

            print("<= 8")
            print(summary(df1[[column]]))
            hist(df1[[column]], main="<= 8", col="blue",ylim= c(0,500))

            print("<= 18")
            print(summary(df2[[column]]))
            hist(df2[[column]], main="<= 18", col="blue", ylim = c(0, 500))

            mtext(column, side = 3, line = - 2, outer = TRUE)
        }
}

The result of first cycle (first variable) is:

The second one (second variable) is:

But since in the first cycle it prints two times the info before the plot everything is misaligned by one step. How can I avoid this behavior by the function? I'd like to have since the beginning the behavior you can see in the second cycle.


问:
Java REST Web Services in NetBeans 14 not creating WADL file
I am trying to learn REST web services using Java. I am using NetBeans 14 and just trying to do a basic restful web service. The issue I keep getting is it pops up with the error Cannot Access WADL file. It's not being generated by the IDE. I have looked for it. I've tried everything, but have been unable to get it to generate. I am using GlassFish server.

Has anyone had any problems similar to this one? I could really use some help or point me in the right direction. I've been working on this for a few days with no luck.

I have tried reading through the libraries to see if I missed one I should have loaded. I have tried rebuilding the restful web services.


问:
How to find a list of excel sheets which contain references to one specific excel sheet?
I have an excel sheet I would like to move to a new folder directory, but its an old historical file with probably 20+ different excel sheets being linked to it. I would like to generate a list of all files which contain references to this file. Is there a way to accomplish this?</p>


问:
Why am I getting an error when creating a docx file on weblogic server 12 with apache poi?
Español: Estoy realizando un servicio REST para crear un documento de word con extension docx, utilizo Weblogic Server 12.2.1.4.0, JDK 1.8.0_341, Maven 3.6.3. Cada vez que genero el documento, arroja ese error

Ingles: I have a REST service to create a word document with a docx extension, I use Weblogic Server 12.2.1.4.0, JDK 1.8.0_341, Maven 3.6.3. everytime i generate the document it throws that error

```<code>####<9/12/2022 10:55:44,899 AM COT> <Error> <HTTP> <ATH27251> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <4780be29-6100-4494-97db-686dd3263a64-0000019d> <1670601344899> <[severity-value: 8] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-101017> <[ServletContext@1449791551[ spec-version:3.1], request: weblogic.servlet.internal.ServletRequestImpl@6573c664[
POST]] Root cause of ServletException.
org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B
    at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
    at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
    at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
Caused By: java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B
    at org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104)
    at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:51)
    at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:38)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.newPackage(XWPFDocument.java:174)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:164)
    at co.com.ath.dev.controller.DocumentCtrl.generate(DocumentCtrl.java:64)
    at co.com.ath.dev.app.DocumentApp.generate(DocumentApp.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:250)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3793)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1720)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1680)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)
</code>```

POM.XML

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>co.com.developer.dev</groupId>
    <artifactId>dev-version-rest</artifactId>
    <version>22.11.1</version>
    <packaging>war</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <build>
        <sourceDirectory>src/main/java/</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
            <version>3.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-bundle</artifactId>
            <version>1.19</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20140107</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.17.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpg-jdk15on</artifactId>
            <version>1.47</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.oracle.ojdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>19.3.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.6.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.6.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
        </dependency>
        <!--Create Document Word-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>5.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-scratchpad</artifactId>
            <version>5.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-full</artifactId>
            <version>5.2.3</version>
        </dependency>
    </dependencies>
</project>
</code>```

Code Java

```<code>public class DocumentCtrl {

    private static final Logger LOG = LogManager.getLogger(DocumentCtrl.class);
    DocumentMdl mdl = new DocumentMdl();
    MsgRsEnt msgRsEnt = new MsgRsEnt();

    public DocumentCtrl() {
        LOG.info("Call Class DocumentCtrl");
    }

    public MsgRsEnt generate(LstBankEnt lstVersion) {
        LOG.info("[Begin " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        try {
//            createDOCX(DocumentNotes.NAME_FILE);
            XWPFDocument document = new XWPFDocument();
            FileOutputStream out = new FileOutputStream(new File("D:\\Dev\\GDS.FO.08.Entrega_de_Software-asdasd.docx"));
            document.write(out);
            out.close();
        } catch (IOException ex) {
//        } catch (IOException | XmlException ex) {
            LOG.error("[" + Thread.currentThread().getStackTrace()[1].getMethodName() + "] ", ex);
            msgRsEnt.setMsgRsHdr(Tools.setHeadersRsError(ex));
        } finally {
            LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        }
        return msgRsEnt;
    }

    public static void setOrientation(XWPFDocument word) {
        LOG.info("[Begin " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        CTBody body = word.getDocument().getBody();
        if (!body.isSetSectPr()) {
            body.addNewSectPr();
        }
        CTSectPr section = body.getSectPr();
        if (!section.isSetPgSz()) {
            section.addNewPgSz();
        }
        CTPageSz pageSize = section.getPgSz();
        pageSize.setW(BigInteger.valueOf(20160)); //15840
        pageSize.setH(BigInteger.valueOf(12240));//12240
        LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
    }

    public static void createDOCX(String pdevFile) {
        LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        try {
            XWPFDocument word = new XWPFDocument();
            setOrientation(word);
            addStyle(word);

            FileOutputStream out = new FileOutputStream(new File(pdevFile));
            word.write(out);
            out.close();
        } catch (IOException ex) {
            LOG.error("[" + Thread.currentThread().getStackTrace()[1].getMethodName() + "] ", ex);
        } finally {
            LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        }
    }

}

</code>```

Body:
Español: Estoy realizando un servicio REST para crear un documento de word con extension docx, utilizo Weblogic Server 12.2.1.4.0, JDK 1.8.0_341, Maven 3.6.3. Cada vez que genero el documento, arroja ese error

Ingles: I have a REST service to create a word document with a docx extension, I use Weblogic Server 12.2.1.4.0, JDK 1.8.0_341, Maven 3.6.3. everytime i generate the document it throws that error

####<9/12/2022 10:55:44,899 AM COT> <Error> <HTTP> <ATH27251> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <4780be29-6100-4494-97db-686dd3263a64-0000019d> <1670601344899> <[severity-value: 8] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-101017> <[ServletContext@1449791551[ spec-version:3.1], request: weblogic.servlet.internal.ServletRequestImpl@6573c664[
POST]] Root cause of ServletException.
org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B
    at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
    at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
    at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
Caused By: java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B
    at org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104)
    at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:51)
    at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:38)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.newPackage(XWPFDocument.java:174)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:164)
    at co.com.ath.dev.controller.DocumentCtrl.generate(DocumentCtrl.java:64)
    at co.com.ath.dev.app.DocumentApp.generate(DocumentApp.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:250)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3793)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1720)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1680)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)

POM.XML

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>co.com.developer.dev</groupId>
    <artifactId>dev-version-rest</artifactId>
    <version>22.11.1</version>
    <packaging>war</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <build>
        <sourceDirectory>src/main/java/</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
            <version>3.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-bundle</artifactId>
            <version>1.19</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20140107</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.17.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpg-jdk15on</artifactId>
            <version>1.47</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.oracle.ojdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>19.3.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.6.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.6.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>5.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-scratchpad</artifactId>
            <version>5.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-full</artifactId>
            <version>5.2.3</version>
        </dependency>
    </dependencies>
</project>

Code Java

public class DocumentCtrl {

    private static final Logger LOG = LogManager.getLogger(DocumentCtrl.class);
    DocumentMdl mdl = new DocumentMdl();
    MsgRsEnt msgRsEnt = new MsgRsEnt();

    public DocumentCtrl() {
        LOG.info("Call Class DocumentCtrl");
    }

    public MsgRsEnt generate(LstBankEnt lstVersion) {
        LOG.info("[Begin " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        try {
//            createDOCX(DocumentNotes.NAME_FILE);
            XWPFDocument document = new XWPFDocument();
            FileOutputStream out = new FileOutputStream(new File("D:\\Dev\\GDS.FO.08.Entrega_de_Software-asdasd.docx"));
            document.write(out);
            out.close();
        } catch (IOException ex) {
//        } catch (IOException | XmlException ex) {
            LOG.error("[" + Thread.currentThread().getStackTrace()[1].getMethodName() + "] ", ex);
            msgRsEnt.setMsgRsHdr(Tools.setHeadersRsError(ex));
        } finally {
            LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        }
        return msgRsEnt;
    }

    public static void setOrientation(XWPFDocument word) {
        LOG.info("[Begin " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        CTBody body = word.getDocument().getBody();
        if (!body.isSetSectPr()) {
            body.addNewSectPr();
        }
        CTSectPr section = body.getSectPr();
        if (!section.isSetPgSz()) {
            section.addNewPgSz();
        }
        CTPageSz pageSize = section.getPgSz();
        pageSize.setW(BigInteger.valueOf(20160)); //15840
        pageSize.setH(BigInteger.valueOf(12240));//12240
        LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
    }

    public static void createDOCX(String pdevFile) {
        LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        try {
            XWPFDocument word = new XWPFDocument();
            setOrientation(word);
            addStyle(word);

            FileOutputStream out = new FileOutputStream(new File(pdevFile));
            word.write(out);
            out.close();
        } catch (IOException ex) {
            LOG.error("[" + Thread.currentThread().getStackTrace()[1].getMethodName() + "] ", ex);
        } finally {
            LOG.info("[End " + Thread.currentThread().getStackTrace()[1].getMethodName() + "]");
        }
    }

}


问:
SwiftUI remove extraneous padding on borderless Menu in toolbar
In the following example, I'm trying to remove padding so that "A" looks like "C". I can't find any way to remove this padding for a Menu when inside a ToolbarItemGroup (tested in iOS 15 or iOS 16). There shouldn't be any space between the green and red borders in "A". This is clearly controlled by .buttonStyle(.borderless) for a Button, but the corresponding .menuStyle(.borderlessButton) does not work when in a toolbar (but does work when no in a toolbar). Any ideas?

```<code>@main
struct TestApp: App {
  var body: some Scene {
    WindowGroup {
      ContentView()
    }
  }
}

struct ContentView: View {
  var body: some View {
    NavigationView {
      ScrollView{}.toolbar {
        ToolbarItemGroup(placement: .navigationBarTrailing) {
          HStack {
            Button {

            } label: {
              Image(systemName: "square.and.arrow.up")
                .border(Color.red)
            }
            .buttonStyle(.borderless) // <--Removed in "B" below.
            .border(Color.green)
            Menu {
              EmptyView()
            } label: {
              Image(systemName: "square.and.arrow.up")
                .border(Color.red)
            }
            .menuStyle(.borderlessButton) // <--Removed in "B" below.
            .border(Color.green)
          }
        }
      }
    }
  }
}
</code>```

Body:
In the following example, I'm trying to remove padding so that "A" looks like "C". I can't find any way to remove this padding for a Menu when inside a ToolbarItemGroup (tested in iOS 15 or iOS 16). There shouldn't be any space between the green and red borders in "A". This is clearly controlled by .buttonStyle(.borderless) for a Button, but the corresponding .menuStyle(.borderlessButton) does not work when in a toolbar (but does work when no in a toolbar). Any ideas?

@main
struct TestApp: App {
  var body: some Scene {
    WindowGroup {
      ContentView()
    }
  }
}

struct ContentView: View {
  var body: some View {
    NavigationView {
      ScrollView{}.toolbar {
        ToolbarItemGroup(placement: .navigationBarTrailing) {
          HStack {
            Button {

            } label: {
              Image(systemName: "square.and.arrow.up")
                .border(Color.red)
            }
            .buttonStyle(.borderless) // <--Removed in "B" below.
            .border(Color.green)
            Menu {
              EmptyView()
            } label: {
              Image(systemName: "square.and.arrow.up")
                .border(Color.red)
            }
            .menuStyle(.borderlessButton) // <--Removed in "B" below.
            .border(Color.green)
          }
        }
      }
    }
  }
}


问:
Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found
I'm trying to do a simple connection and initial creation of tables, but it's giving an error.

CODE:

```<code>export default function useIndexedDB() {
    const DB_REQUEST = window.indexedDB.open('dAppDatabase', 1);

    const connect = () =>
        new Promise((resolve, reject) => {
            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);

            DB_REQUEST.onupgradeneeded = () => {
                DB_REQUEST.result
                    .createObjectStore('metamask', { keyPath: 'id', autoIncrement: true })
                    .createIndex('user', ['wallet'], { unique: false });
            };

            DB_REQUEST.onsuccess = () => {
                DB_REQUEST.result.transaction(['metamask']);
                resolve('Succ');
            };
        });

    return {
        connect,
    };
}
</code>```

Body:
I'm trying to do a simple connection and initial creation of tables, but it's giving an error.

CODE:

export default function useIndexedDB() {
    const DB_REQUEST = window.indexedDB.open('dAppDatabase', 1);

    const connect = () =>
        new Promise((resolve, reject) => {
            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);

            DB_REQUEST.onupgradeneeded = () => {
                DB_REQUEST.result
                    .createObjectStore('metamask', { keyPath: 'id', autoIncrement: true })
                    .createIndex('user', ['wallet'], { unique: false });
            };

            DB_REQUEST.onsuccess = () => {
                DB_REQUEST.result.transaction(['metamask']);
                resolve('Succ');
            };
        });

    return {
        connect,
    };
}


问:
How to use Javascript to force "div.classname" to full screen width?
I would like to use some basic Javascript to automatically set the width of a div element (class name = "tb-megamenu-submenu") to be the full width of the screen and centered. I would also like this calculation to run any time the screen is resized.

Normally I would just use CSS for this (width: 100vw), but the parent element is position:relative and the submenu is position:absolute, so any attempt to set the width fails because the submenu cannot be centered on the screen with CSS alone.

I'm using a Drupal Module called "The Better Mega Menu." There is a working example of a websites that does this exact thing that I want (https://www.hollyhunt.com/), but I can't seem to replicate their success. Here's the code they are using on their site:

```<code>  // Make submenu full browser width.
const submenuFullwidthCalc = function () {
// Get the Mega menu Level 1 sub menu.
$(".tb-megamenu-nav > .level-1 > .tb-megamenu-submenu").each(function () {
// reset to zero so it can be calculated again and again
$(this).css("left", 0);
const offsettarget = $("body").offset();
// The offset of this submenu.
const offsetthis = $(this)
.parent()
.offset();
// Calculate the offset.
$(this).css("left", offsettarget.left - offsetthis.left);
// Set the submenu full width.
$(this).css("width", $("body").width());
});
};
</code>```

How can I get this kind of functionality working on my site? Oh, and I'm stuck using the old BootStrap 3 Theme, so any solutions may have to be compatible with older code standards. Thanks for any help you can give!!!

Body:
I would like to use some basic Javascript to automatically set the width of a div element (class name = "tb-megamenu-submenu") to be the full width of the screen and centered. I would also like this calculation to run any time the screen is resized.

Normally I would just use CSS for this (width: 100vw), but the parent element is position:relative and the submenu is position:absolute, so any attempt to set the width fails because the submenu cannot be centered on the screen with CSS alone.

I'm using a Drupal Module called "The Better Mega Menu." There is a working example of a websites that does this exact thing that I want (https://www.hollyhunt.com/), but I can't seem to replicate their success. Here's the code they are using on their site:

  // Make submenu full browser width.
const submenuFullwidthCalc = function () {
// Get the Mega menu Level 1 sub menu.
$(".tb-megamenu-nav > .level-1 > .tb-megamenu-submenu").each(function () {
// reset to zero so it can be calculated again and again
$(this).css("left", 0);
const offsettarget = $("body").offset();
// The offset of this submenu.
const offsetthis = $(this)
.parent()
.offset();
// Calculate the offset.
$(this).css("left", offsettarget.left - offsetthis.left);
// Set the submenu full width.
$(this).css("width", $("body").width());
});
};

How can I get this kind of functionality working on my site? Oh, and I'm stuck using the old BootStrap 3 Theme, so any solutions may have to be compatible with older code standards. Thanks for any help you can give!!!


问:
How can I use an outside variable inside a filter closure
I'm trying to create an iterator of video frames from a packetiter. I need to filter out packets that are not from the video stream as in a video file there are multiple streams, audio, video etc

Let's say I have variable index which is the index of the stream i want to decode and I want to only decode packets from that stream

This gives me the following iterator everything past the filter iterator has been elided

let index = self.video_index; // unused variable Index
        self.input
            .packets()
            .filter(|(stream, _packet)| match stream.index() {
                index => true, //unused variable index
                _ => false,
            })
```

Now the predicate function for .filter can't access the outer scope. I don't know what index will be beforehand. How can I get the predicate function to match on stream.index() when index does not exist in the predicate's scope?

Body:
I'm trying to create an iterator of video frames from a packetiter. I need to filter out packets that are not from the video stream as in a video file there are multiple streams, audio, video etc

Let's say I have variable index which is the index of the stream i want to decode and I want to only decode packets from that stream

This gives me the following iterator everything past the filter iterator has been elided

let index = self.video_index; // unused variable Index
        self.input
            .packets()
            .filter(|(stream, _packet)| match stream.index() {
                index => true, //unused variable index
                _ => false,
            })

Now the predicate function for .filter can't access the outer scope. I don't know what index will be beforehand. How can I get the predicate function to match on stream.index() when index does not exist in the predicate's scope?


问:
How to ensure tasks in one celery queue get executed in order
I am working on set up some celery queues for process some tasks. Each task hashes a value and send this task to a delicate queue based on hashed value. What I want to achieve is, to make sure messages in one celery queue can be executed sequentially.

Task looks like this

```<code>@app.task(
    acks_late=True,
    autoretry_for=(OperationalError,),
    max_retries=5,
    retry_backoff=True,
    retry_backoff_max=1,
)
def handle_a_task(task):
    # do something
</code>```

Get a dedicated celery queue

```<code>def get_queue(task_value):
    return md5(task_value)
</code>```

Send task to the queue

```<code>queue = get_queue()
handle_a_task.apply_async(
    kwargs={
        "task": {"id": 123},
    },
    queue=queue,
)
</code>```

In production, there are multiple celery workers. I've seen these workers would take messages from the same queue and process at the same time. What can I do to make messages in one celery queue get processed in order?

I've tried to do celery worker --prefetch-multiplier=1, but it doesn't work.

Body:
I am working on set up some celery queues for process some tasks. Each task hashes a value and send this task to a delicate queue based on hashed value. What I want to achieve is, to make sure messages in one celery queue can be executed sequentially.

Task looks like this

@app.task(
    acks_late=True,
    autoretry_for=(OperationalError,),
    max_retries=5,
    retry_backoff=True,
    retry_backoff_max=1,
)
def handle_a_task(task):
    # do something

Get a dedicated celery queue

def get_queue(task_value):
    return md5(task_value)

Send task to the queue

queue = get_queue()
handle_a_task.apply_async(
    kwargs={
        "task": {"id": 123},
    },
    queue=queue,
)

In production, there are multiple celery workers. I've seen these workers would take messages from the same queue and process at the same time. What can I do to make messages in one celery queue get processed in order?

I've tried to do celery worker --prefetch-multiplier=1, but it doesn't work.


问:
Is there really no easy way to change the width of a gif in R Markdown?
I'm trying to many difficult solutions found all over the internet to fix a really easy problem, making my gif (an animated plot) wider in R Markdown, but there doesn't seem to be a way to do it that doesn't screw something up.

I have a gif of an animated plot that I made in R studio. Trying to change the width in R studio is a nightmare, if the aspect ratio is ever changed, then the white filler spaces become part of the plot, which is driving me crazy.

I am also unable to simply change the width within R Markdown, out.width changes both dimensions (makes it either tiny or huge without changing the actual ratio) and fig.width doesn't change anything.

Here is the simple code for including the gif in R Markdown

```<code>knitr::include_graphics("100m_animation.gif")
</code>```

If anyone knows any way to simply change the width (make it longer), please let me know.

Body:
I'm trying to many difficult solutions found all over the internet to fix a really easy problem, making my gif (an animated plot) wider in R Markdown, but there doesn't seem to be a way to do it that doesn't screw something up.

I have a gif of an animated plot that I made in R studio. Trying to change the width in R studio is a nightmare, if the aspect ratio is ever changed, then the white filler spaces become part of the plot, which is driving me crazy.

I am also unable to simply change the width within R Markdown, out.width changes both dimensions (makes it either tiny or huge without changing the actual ratio) and fig.width doesn't change anything.

Here is the simple code for including the gif in R Markdown

knitr::include_graphics("100m_animation.gif")

If anyone knows any way to simply change the width (make it longer), please let me know.


问:
ANDI not recognizing ARIA role-based table rows
I'm working with a data table constructed from DIVs and styled as a CSS grid (not my idea! and I've been asked to leave it that way, so please just accept that as an immutable condition). My task is to make it accessible and, for now, I'm testing with ANDI in Chrome on Windows. It's an Angular application with Bootstrap, if that makes a difference.

(UPDATE at another's request: ANDI is a detailed web accessibility analytical tool published by the US Social Security Administration at https://www.ssa.gov/accessibility/andi/help/install.html. It's a favelet, you just save a bookmark to it and then click the bookmark when you have a page up in your browser.)

When I open the page in the browser and turn on ANDI, it finds the table, with its 13 columns and 100 data rows in addition to the header row, but it flags two errors:

"ARIA table has no [role=row] rows."

"
 has 1313 cells not contained by [role=row]."

And, indeed, while ANDI marks the table with a dashed border, it doesn't mark the cells, nor does it respond to my hovering the cursor over them.

There's an Angular component element, the data row component, <app-content-row>, in the middle of this. I wondered whether that could be source of the problem, but I tried removing it, leaving only the row with the column headers, and ANDI gave me the same report.

I can't provide the full code for proprietary reasons, and for clarity I'm going to leave out the directive (_ngcontent-wjw-c154, in this instance) that Angular inserts into every element, but looking at it in the Chrome inspector window, it starts, basically, with:

```<code><div role="table" class="..." ...>
  <div role="rowgroup" style="display: contents;">
    <div role="row" ...>
      <div role="columnheader" ...>ID</div>
      <div role="columnheader" ...>Name</div>
      <div role="columnheader" ...>Start Date</div>
      <!-- More columnheaders -->
    </div>
  </div>
  <div role="rowgroup style="display:contents;">
    <app-content-row ...>
      <div role="row" ...>
        <div role="rowheader" ...>137</div>
        <div role="rowheader" ...>Frapjab Industries</div>
        <div role="cell" ...>04/15/2008</div>
        <!-- More cells -->
      </div>
      <!-- More rows -->
    </app-content-row>
  </div>
</div>
</code>```

Above is my second attempt. In my first attempt, I didn't even have the role="rowgroup" divs wrapped around the header row and around the data rows, and I guessed that maybe they, unlike thead and tbody in an HTML table, were required. In my third attempt, guessing that maybe the role="row" divs had to be directly inside the role="rowgroup" element, I removed the second "rowgroup" div and instead stuck role="rowgroup" into the <app-content-row> tag. That role did carry through to the code displayed in the Chrome inspector. But it made no difference in the ANDI outcome.

My fourth attempt, removing the data rows (including the Angular component tags they're wrapped in, leaving only the column header row:

```<code><div role="table" class="..." ...>
  <div role="rowgroup" style="display: contents;">
    <div role="row" ...>
      <div role="columnheader" ...>ID</div>
      <div role="columnheader" ...>Name</div>
      <div role="columnheader" ...>Start Date</div>
      <!-- More columnheaders -->
    </div>
  </div>
</div>
</code>```

Still no good. So the Angular component tags had nothing to do with it.

Are there any common causes of ANDI failing to find the table structure defined by the roles, or unable to see the defined roles? Is there anything it seems I've missed?

Body:
I'm working with a data table constructed from DIVs and styled as a CSS grid (not my idea! and I've been asked to leave it that way, so please just accept that as an immutable condition). My task is to make it accessible and, for now, I'm testing with ANDI in Chrome on Windows. It's an Angular application with Bootstrap, if that makes a difference.

(UPDATE at another's request: ANDI is a detailed web accessibility analytical tool published by the US Social Security Administration at https://www.ssa.gov/accessibility/andi/help/install.html. It's a favelet, you just save a bookmark to it and then click the bookmark when you have a page up in your browser.)

When I open the page in the browser and turn on ANDI, it finds the table, with its 13 columns and 100 data rows in addition to the header row, but it flags two errors:

"ARIA table has no [role=row] rows."

"
 has 1313 cells not contained by [role=row]."

And, indeed, while ANDI marks the table with a dashed border, it doesn't mark the cells, nor does it respond to my hovering the cursor over them.

There's an Angular component element, the data row component, <app-content-row>, in the middle of this. I wondered whether that could be source of the problem, but I tried removing it, leaving only the row with the column headers, and ANDI gave me the same report.

I can't provide the full code for proprietary reasons, and for clarity I'm going to leave out the directive (_ngcontent-wjw-c154, in this instance) that Angular inserts into every element, but looking at it in the Chrome inspector window, it starts, basically, with:

ID

Name

Start Date

    <app-content-row ...>

137

Frapjab Industries

04/15/2008

    </app-content-row>

Above is my second attempt. In my first attempt, I didn't even have the role="rowgroup" divs wrapped around the header row and around the data rows, and I guessed that maybe they, unlike thead and tbody in an HTML table, were required. In my third attempt, guessing that maybe the role="row" divs had to be directly inside the role="rowgroup" element, I removed the second "rowgroup" div and instead stuck role="rowgroup" into the <app-content-row> tag. That role did carry through to the code displayed in the Chrome inspector. But it made no difference in the ANDI outcome.

My fourth attempt, removing the data rows (including the Angular component tags they're wrapped in, leaving only the column header row:

ID

Name

Start Date

Still no good. So the Angular component tags had nothing to do with it.

Are there any common causes of ANDI failing to find the table structure defined by the roles, or unable to see the defined roles? Is there anything it seems I've missed?


问:
onclick event handler of a child button node is also triggered on the parent button node
I have a button that generates a new form template with its own input and button nodes. The newly generated button element has its own onclick event handler, but when I click the first button that is supposed to generate the new form template, the onclick secondary button handler is triggered.

1- Why does the child button handler trigger when I click the parent button?

2- How would you create and manage the onclick event handler for the generated template button?

Thanks in advance!

const addButton = document.querySelector("#add-button")

addButton.onclick = () =>{
    const newForm = document.createElement("div")
    newForm.innerHTML = `\
    <form>
        <input type="text" name="name" placeholder=" name" required>
        <button type="submit" id="new-add-button" oninput="${inputHandler()}">submit</button>
    </form>
    `
    document.body.appendChild(newForm)
}

function inputHandler(){
    alert("hello")
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body style="background-color: #333;">
    <button type="button" id="add-button">Add</button>

    <script src="./main.js"></script>
</body>
</html></code>```

Body:
I have a button that generates a new form template with its own input and button nodes. The newly generated button element has its own onclick event handler, but when I click the first button that is supposed to generate the new form template, the onclick secondary button handler is triggered.

1- Why does the child button handler trigger when I click the parent button?

2- How would you create and manage the onclick event handler for the generated template button?

Thanks in advance!

const addButton = document.querySelector("#add-button")

addButton.onclick = () =>{
    const newForm = document.createElement("div")
    newForm.innerHTML = `\
    <form>
        <input type="text" name="name" placeholder=" name" required>
        <button type="submit" id="new-add-button" oninput="${inputHandler()}">submit</button>
    </form>
    `
    document.body.appendChild(newForm)
}

function inputHandler(){
    alert("hello")
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <button type="button" id="add-button">Add</button>


问:
How to allow Sagemaker studio to access data stored in MongoDB?
I'm trying to read data that is stored in MongoDB in Sagemaker studio, and both the MongoDB instance and Sagemaker studio domain is under the same VPC and security group, but I keep getting connection timeout error when I try to do it. Any help is appreciated.

I tried searching online and see if other people have ran into this problem as well but I haven't found any.


问:
Set Mavsys Configuration in Roslaunch File
How do you set mavsys in the ros launch file? I want to update the mavros data rate on start up.

Normally l use this terminal command: rosrun mavros mavsys rate --all 10.

My launch file:

```<code><launch>

<include file="$(find mavros)/launch/apm.launch" />

</launch>
</code>```

Thank you for the help.

Body:
How do you set mavsys in the ros launch file? I want to update the mavros data rate on start up.

Normally l use this terminal command: rosrun mavros mavsys rate --all 10.

My launch file:

<launch>

<include file="$(find mavros)/launch/apm.launch" />

</launch>

Thank you for the help.


问:
pytest+celery: Test hangs
I have a super simple celery task. During development, my broker for celery and pytest is sharing the same AWS SQS, and DynamoDB for results. My task was successful via CLI.

However, when running within pytest, my test would hang forever. When I force stop the test, it tells me it was stuck on the 'wait_for' function of celery/backends/base.py:756:

```<code>self = <celery.backends.dynamodb.DynamoDBBackend object at 0x1075354d0>, task_id = 'ac20975a-76db-495b-895f-f7905f2f6b81', timeout = None, interval = 0.5
no_ack = True, on_interval = <promise@0x10749af80>
</code>```

Note: code is simplified for stackoverflow.

my env is apple m1pro macOS 13.0.1

python: python 3.11.0 (homebrew)

celery: 5.2.7

# proj/tasks.py
from celery import Celery
from celery.utils.log import get_task_logger

logger = get_task_logger(__name__)

broker_transport_options = {
    'region': 'us-east-2',
    'predefined_queues': {
        'celery': {
            'url': 'https://sqs.us-east-2.amazonaws.com/../awesome_queue',
        }
    }
}

app = Celery(
    "awesome_queue",
    broker="sqs://",
    broker_transport_options=broker_transport_options,
    backend="dynamodb://@us-east-2/awesome_queue"
)

@app.task
def read_dynamodb( region: str, tablename: str) -> list:
    # Read from DynamoDB
    logger.info(f"Reading {region}/{tablename}")
    dynamodb_list = ["greetings"]
    logger.info(dynamodb_list)
    return region+tablename

```
<p>My PyTest:</p>
<pre class="lang-py prettyprint-override"><code># tests/conftest.py
from proj.tasks import broker_transport_options

@pytest.fixture(scope="session")
def celery_config():
    return {
        "broker": "sqs://",
        "broker_transport_options": broker_transport_options,
        "backend": "dynamodb://@us-east-2/awesome_queue",
    }

</code>```

# tests/test_tasks.py
import pytest
from customer_shard_restore.tasks import app, read_dynamodb
from unittest.mock import patch

@pytest.mark.usefixtures("celery_session_app")
@pytest.mark.usefixtures("celery_session_worker")
class TestRestore:

    def test_read_dynamodb(self):
        result = read_dynamodb.apply_async("us-west-2", "blank")
        print(result.get())

```
<p>Running CLI, I get the correct output:</p>
<pre class="lang-bash prettyprint-override"><code># session 1
celery -A proj.tasks worker --loglevel=INFO
...
[2022-12-12 17:57:18,074: INFO/ForkPoolWorker-8] Task proj.tasks.read_dynamodb[829f0f0f-d177-4a4f-a045-7660f3b45ab6] succeeded in 0.9378940409806091s: 'somethingsomethingelse'
</code>```

# session 2
Python 3.11.0 (main, Oct 26 2022, 19:06:18) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from proj.tasks import read_dynamodb
>>> result = read_dynamodb.apply_async(("something", "somethingelse"))
>>> result.get()
'somethingsomethingelse'
>>> exit()
```

Title: pytest+celery: Test hangs

Body:
I have a super simple celery task. During development, my broker for celery and pytest is sharing the same AWS SQS, and DynamoDB for results. My task was successful via CLI.

However, when running within pytest, my test would hang forever. When I force stop the test, it tells me it was stuck on the 'wait_for' function of celery/backends/base.py:756:

self = <celery.backends.dynamodb.DynamoDBBackend object at 0x1075354d0>, task_id = 'ac20975a-76db-495b-895f-f7905f2f6b81', timeout = None, interval = 0.5
no_ack = True, on_interval = <promise@0x10749af80>

Note: code is simplified for stackoverflow.

my env is apple m1pro macOS 13.0.1

python: python 3.11.0 (homebrew)

celery: 5.2.7

# proj/tasks.py
from celery import Celery
from celery.utils.log import get_task_logger

logger = get_task_logger(__name__)

broker_transport_options = {
    'region': 'us-east-2',
    'predefined_queues': {
        'celery': {
            'url': 'https://sqs.us-east-2.amazonaws.com/../awesome_queue',
        }
    }
}

app = Celery(
    "awesome_queue",
    broker="sqs://",
    broker_transport_options=broker_transport_options,
    backend="dynamodb://@us-east-2/awesome_queue"
)

@app.task
def read_dynamodb( region: str, tablename: str) -> list:
    # Read from DynamoDB
    logger.info(f"Reading {region}/{tablename}")
    dynamodb_list = ["greetings"]
    logger.info(dynamodb_list)
    return region+tablename

My PyTest:

# tests/conftest.py
from proj.tasks import broker_transport_options

@pytest.fixture(scope="session")
def celery_config():
    return {
        "broker": "sqs://",
        "broker_transport_options": broker_transport_options,
        "backend": "dynamodb://@us-east-2/awesome_queue",
    }

# tests/test_tasks.py
import pytest
from customer_shard_restore.tasks import app, read_dynamodb
from unittest.mock import patch

@pytest.mark.usefixtures("celery_session_app")
@pytest.mark.usefixtures("celery_session_worker")
class TestRestore:

    def test_read_dynamodb(self):
        result = read_dynamodb.apply_async("us-west-2", "blank")
        print(result.get())

Running CLI, I get the correct output:

# session 1
celery -A proj.tasks worker --loglevel=INFO
...
[2022-12-12 17:57:18,074: INFO/ForkPoolWorker-8] Task proj.tasks.read_dynamodb[829f0f0f-d177-4a4f-a045-7660f3b45ab6] succeeded in 0.9378940409806091s: 'somethingsomethingelse'

# session 2
Python 3.11.0 (main, Oct 26 2022, 19:06:18) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from proj.tasks import read_dynamodb
>>> result = read_dynamodb.apply_async(("something", "somethingelse"))
>>> result.get()
'somethingsomethingelse'
>>> exit()


问:
replace all the elements in an array with a new value
I have two arrays of the same size, A and B.
What would be the fastest way to replace all elements in A that have value equal to y to change and be become equal to z?

The arrays are not small in terms of size.

I can think of a simple for loop along with using array.get and then array.set, but this is not very efficient and is slow, so I was wondering if there is a way without using a loop.

If this is too easy, then would it be possible to also do the same thing for the case that elements in the array are less than equal to y (instead of only being equal)?


问:
Page loader while retrieving data from a PostgreSQL database in Django
I'm using Django with a PostgreSQL database to create a website for entering and viewing data. On the data viewing page there are several tables that are populated with data from the database. I'm trying to implement a page loader that will display until the data has been retrieved from the database and the webpage is fully loaded. At the moment, the page loader does not appear until after the data is retrieved and then only flashes briefly while the page fully loads. How can I make it appear from when I first click on the link to go to the page?

Here is my html:

```<code><div id="page-loader">
    <div class="loader-spinner"></div>
    <p class="loader-message">Loading...</p>
</div>
</code>```

My CSS:

```<code>#page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 300px;
    z-index: 999999;
    background-color: rgba(75, 75, 75, 0.75);
    border-radius: 10px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 2px solid #FC6620;
    border-radius: 50%;
    border-top: 2px solid #fff;
    animation: spin 1s linear infinite;
    margin: 0;
    z-index: 999999;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loader-message {
    margin-left: 10px;
    font-size: 24px;
    color: #FC6620;
    z-index: 999999;
}
</code>```

and my Javascript:

```<code>document.addEventListener('readystatechange', () => {
    document.getElementById("page-loader").style.display = "visible";
})

window.onload = function() {
    document.getElementById("page-loader").style.display = "none";
}
</code>```

Everything is working fine accept for my javascript code. I've tried different even listeners such as load and DOMContentLoaded. Nothing has worked for me. Any help would be much appreciated!

Body:
I'm using Django with a PostgreSQL database to create a website for entering and viewing data. On the data viewing page there are several tables that are populated with data from the database. I'm trying to implement a page loader that will display until the data has been retrieved from the database and the webpage is fully loaded. At the moment, the page loader does not appear until after the data is retrieved and then only flashes briefly while the page fully loads. How can I make it appear from when I first click on the link to go to the page?

Here is my html:

Loading...

My CSS:

#page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 300px;
    z-index: 999999;
    background-color: rgba(75, 75, 75, 0.75);
    border-radius: 10px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 2px solid #FC6620;
    border-radius: 50%;
    border-top: 2px solid #fff;
    animation: spin 1s linear infinite;
    margin: 0;
    z-index: 999999;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loader-message {
    margin-left: 10px;
    font-size: 24px;
    color: #FC6620;
    z-index: 999999;
}

and my Javascript:

document.addEventListener('readystatechange', () => {
    document.getElementById("page-loader").style.display = "visible";
})

window.onload = function() {
    document.getElementById("page-loader").style.display = "none";
}

Everything is working fine accept for my javascript code. I've tried different even listeners such as load and DOMContentLoaded. Nothing has worked for me. Any help would be much appreciated!


问:
Why is my controller test not working even though it mimics a working example from javadevjournal?
I am following the below article to test my contoller on its own without having to start a spring application completely. Please can you let me know where I am going wrong, is the article wrong?

https://www.javadevjournal.com/spring-boot/testing-in-spring-boot/

The error I get is as below

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

SearchController.java

```<code>@RestController
@RequestMapping(value = "/top5")
public class SearchController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/{user}", method = RequestMethod.GET)
    public List<Repo> getInfo(@PathVariable(name = "user") String user) {
        System.out.println("Querying for [" + user + "]");
        return userService.getResults(user);
    }
}
</code>```

UserService.java

```<code>@Service
public class UserService {
    private static final String search_url = "https://api.github.com/users/%s/repos?page=1&per_page=5";

    @Autowired
    RestTemplate rt;

    public List<Repo> getResults(String user) {
        System.out.println("Invoking: " + String.format(search_url, user));
        Repo[] a = rt.getForEntity(String.format(search_url, user), Repo[].class).getBody();
        return Arrays.asList(a);
    }
}
</code>```

SearchControllerTest.java

```<code>@RunWith(SpringRunner.class)
@WebMvcTest(value = SearchController.class)
public class SearchControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private UserService userService;

    private static List<Repo> repoList;

    @BeforeClass
    public static void setupTestData() {
        repoList = new ArrayList<Repo>();
        // Populate with test data
        repoList.add(new Repo("1", "Repo1", "Repository 1", "http://myurl.com/1", "Description 1"));
        repoList.add(new Repo("2", "Repo2", "Repository 2", "http://myurl.com/2", "Description 2"));
        repoList.add(new Repo("3", "Repo3", "Repository 3", "http://myurl.com/3", "Description 3"));
        repoList.add(new Repo("4", "Repo4", "Repository 4", "http://myurl.com/4", "Description 4"));
        repoList.add(new Repo("5", "Repo5", "Repository 5", "http://myurl.com/5", "Description 5"));
    }

    @Test
    public void testGetInfo() throws Exception {
        String apiUrl = "/top5/tester";
        // Setup "Mockito" to mock userService call
        Mockito.when(userService.getResults(Mockito.anyString())).thenReturn(repoList);

        // Build a GET Request and send it to the test server
        RequestBuilder rb = MockMvcRequestBuilders.get(apiUrl).accept(MediaType.APPLICATION_JSON);
        MvcResult r = mockMvc.perform(rb).andReturn(); // throws Exception

        // Validate response
        String tr = r.getResponse().getContentAsString();
        // System.out.println(tr);

        String er = "[{\"id\":\"1\",\"name\":\"Repo1\",\"full_name\":\"Repository 1\",\"html_url\":\"http://myurl.com/1\",\"description\":\"Description 1\"},{\"id\":\"2\",\"name\":\"Repo2\",\"full_name\":\"Repository 2\",\"html_url\":\"http://myurl.com/2\",\"description\":\"Description 2\"},{\"id\":\"3\",\"name\":\"Repo3\",\"full_name\":\"Repository 3\",\"html_url\":\"http://myurl.com/3\",\"description\":\"Description 3\"},{\"id\":\"4\",\"name\":\"Repo4\",\"full_name\":\"Repository 4\",\"html_url\":\"http://myurl.com/4\",\"description\":\"Description 4\"},{\"id\":\"5\",\"name\":\"Repo5\",\"full_name\":\"Repository 5\",\"html_url\":\"http://myurl.com/5\",\"description\":\"Description 5\"}]";
        JSONAssert.assertEquals(er, tr, true);

        // Or we can use JUnit's assertEquals() method
        // assertEquals("REST API Returned incorrect response.", er, tr);
    }
}
</code>```

Repo.class

```<code>public class Repo {

    private String id;
    private String name;
    private String description;

    private String fullName;

    private String htmlUrl;

    public Repo(String id, String name, String description, String fullName, String htmlUrl) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.fullName = fullName;
        this.htmlUrl = htmlUrl;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public String getFullName() {
        return fullName;
    }

    public String getHtmlUrl() {
        return htmlUrl;
    }
}
</code>```

Body:
I am following the below article to test my contoller on its own without having to start a spring application completely. Please can you let me know where I am going wrong, is the article wrong?

https://www.javadevjournal.com/spring-boot/testing-in-spring-boot/

The error I get is as below

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

SearchController.java

@RestController
@RequestMapping(value = "/top5")
public class SearchController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/{user}", method = RequestMethod.GET)
    public List<Repo> getInfo(@PathVariable(name = "user") String user) {
        System.out.println("Querying for [" + user + "]");
        return userService.getResults(user);
    }
}

UserService.java

@Service
public class UserService {
    private static final String search_url = "https://api.github.com/users/%s/repos?page=1&per_page=5";

    @Autowired
    RestTemplate rt;

    public List<Repo> getResults(String user) {
        System.out.println("Invoking: " + String.format(search_url, user));
        Repo[] a = rt.getForEntity(String.format(search_url, user), Repo[].class).getBody();
        return Arrays.asList(a);
    }
}

SearchControllerTest.java

@RunWith(SpringRunner.class)
@WebMvcTest(value = SearchController.class)
public class SearchControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private UserService userService;

    private static List<Repo> repoList;

    @BeforeClass
    public static void setupTestData() {
        repoList = new ArrayList<Repo>();
        // Populate with test data
        repoList.add(new Repo("1", "Repo1", "Repository 1", "http://myurl.com/1", "Description 1"));
        repoList.add(new Repo("2", "Repo2", "Repository 2", "http://myurl.com/2", "Description 2"));
        repoList.add(new Repo("3", "Repo3", "Repository 3", "http://myurl.com/3", "Description 3"));
        repoList.add(new Repo("4", "Repo4", "Repository 4", "http://myurl.com/4", "Description 4"));
        repoList.add(new Repo("5", "Repo5", "Repository 5", "http://myurl.com/5", "Description 5"));
    }

    @Test
    public void testGetInfo() throws Exception {
        String apiUrl = "/top5/tester";
        // Setup "Mockito" to mock userService call
        Mockito.when(userService.getResults(Mockito.anyString())).thenReturn(repoList);

        // Build a GET Request and send it to the test server
        RequestBuilder rb = MockMvcRequestBuilders.get(apiUrl).accept(MediaType.APPLICATION_JSON);
        MvcResult r = mockMvc.perform(rb).andReturn(); // throws Exception

        // Validate response
        String tr = r.getResponse().getContentAsString();
        // System.out.println(tr);

        String er = "[{\"id\":\"1\",\"name\":\"Repo1\",\"full_name\":\"Repository 1\",\"html_url\":\"http://myurl.com/1\",\"description\":\"Description 1\"},{\"id\":\"2\",\"name\":\"Repo2\",\"full_name\":\"Repository 2\",\"html_url\":\"http://myurl.com/2\",\"description\":\"Description 2\"},{\"id\":\"3\",\"name\":\"Repo3\",\"full_name\":\"Repository 3\",\"html_url\":\"http://myurl.com/3\",\"description\":\"Description 3\"},{\"id\":\"4\",\"name\":\"Repo4\",\"full_name\":\"Repository 4\",\"html_url\":\"http://myurl.com/4\",\"description\":\"Description 4\"},{\"id\":\"5\",\"name\":\"Repo5\",\"full_name\":\"Repository 5\",\"html_url\":\"http://myurl.com/5\",\"description\":\"Description 5\"}]";
        JSONAssert.assertEquals(er, tr, true);

        // Or we can use JUnit's assertEquals() method
        // assertEquals("REST API Returned incorrect response.", er, tr);
    }
}

Repo.class

public class Repo {

    private String id;
    private String name;
    private String description;

    private String fullName;

    private String htmlUrl;

    public Repo(String id, String name, String description, String fullName, String htmlUrl) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.fullName = fullName;
        this.htmlUrl = htmlUrl;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public String getFullName() {
        return fullName;
    }

    public String getHtmlUrl() {
        return htmlUrl;
    }
}


问:
Resize form, subform, content and controls in MS Access
I have followed the suggested code to resize a form Access 2010 VBA Forms - Automatic Form Resize.

I have a few issues with this code:

When Access opens, the form is automatically opened but it is not recognizing this code. If I open the form in Designer and then go back to the form, it has the code applied. What step would the EventProcedure need to be applied to? Form_Open?

The subform is not resizing - there is a subform within the original form. I have added the code to the primary form and the subform is not affected. If I add the code to the subform, also, then the font on the subform is HUGE. Could it be using the acHeader and acFooter from the main form? And is there anything that I should be considering for the subform so that it recognizes its own window size?

When the form initially opens without the code activated, the subform is overlapping the tabs of the main form. The subform is the content that is supposed to display on the tabs, so I do not understand why it would overlap the tab.

Since I am very new to working in VBA, any assistance is greatly appreciated. We have multiple forms and subforms within an existing application and I am tasked with either resizing everything manually to larger font, or finding a solution that will allow the user to resize the page/font themselves - which is the reference I have above. (questions/13337942)

Code was applied but is not executing when form opens with the main application - only after opening in Designer.

Subform is not being affected. When adding the same code to the subform, the font in the subform is a few times larger than the font in the main form.

When code is not activated (upon initial open with application), the subform is overlapping the tabs of the main form - and the subform resides within the tab.


问:
Format DatePicker to date format of user's country by passing in locale
I want to set the locale of every showDatePicker in the app, to the locale of the user's location, so that when they click the edit pencil in the DatePicker, they see the initial date in the format of their country.

I have found this to set the system locale:

```<code>Intl.systemLocale = await findSystemLocale();
</code>```

Then when I use showDatePicker I get that locale:

This does not format the date to the users country:

```<code>final systemLocale = Intl.systemLocale;
final splittedLocaleChars = systemLocale.split('_');
final locale = Locale(splittedLocaleChars[0], splittedLocaleChars[1]);
final selectedDate = await showDatePicker(
  locale: locale,
</code>```

And also this inside initState should work:

```<code>findSystemLocale().then((value) {
  Intl.systemLocale = value;
  initializeDateFormatting(value, null);
});
</code>```

But it gives the error:

"Unsupported operation: Cannot modify unmodifiable map"

What am I doing wrong?

Body:
I want to set the locale of every showDatePicker in the app, to the locale of the user's location, so that when they click the edit pencil in the DatePicker, they see the initial date in the format of their country.

I have found this to set the system locale:

Intl.systemLocale = await findSystemLocale();

Then when I use showDatePicker I get that locale:

This does not format the date to the users country:

final systemLocale = Intl.systemLocale;
final splittedLocaleChars = systemLocale.split('_');
final locale = Locale(splittedLocaleChars[0], splittedLocaleChars[1]);
final selectedDate = await showDatePicker(
  locale: locale,

And also this inside initState should work:

findSystemLocale().then((value) {
  Intl.systemLocale = value;
  initializeDateFormatting(value, null);
});

But it gives the error:

"Unsupported operation: Cannot modify unmodifiable map"

What am I doing wrong?


问:
Reload a const from external page ReactJS
I imported my menu to the another page:
import Sidebar from "../Sidebar.js";

However, I need to select a store on the main page, and currently I need to refresh the entire page for that store's options to appear in the menu. If I only updated the menu, there would be no need to update the entire page and the site would look more elegant!

In the const, I tried:

```<code>const shopSelect = async (e) => {
        e.preventDefault();
        try {
            await axios.post('http://localhost:5000/select', {
                sel: sel
            });
            Sidebar(); (Here before was a window.location.reload)
        } catch (error) {
            if (error.response) {
                console.log(error.response);
            }
        }
    }
</code>```

With this current code, the menu does not update! How can I update the menu without having to refresh the whole page? Thanks!

Body:
I imported my menu to the another page:
import Sidebar from "../Sidebar.js";

However, I need to select a store on the main page, and currently I need to refresh the entire page for that store's options to appear in the menu. If I only updated the menu, there would be no need to update the entire page and the site would look more elegant!

In the const, I tried:

const shopSelect = async (e) => {
        e.preventDefault();
        try {
            await axios.post('http://localhost:5000/select', {
                sel: sel
            });
            Sidebar(); (Here before was a window.location.reload)
        } catch (error) {
            if (error.response) {
                console.log(error.response);
            }
        }
    }

With this current code, the menu does not update! How can I update the menu without having to refresh the whole page? Thanks!


问:
Is it possible to `unset` a library target in cmake?
Please see the below minimal example,

CMakeLists.txt

```<code>set(MY_DIR "/path/one")
add_library(third-party-lib INTERFACE IMPORTED)
set_target_properties(third-party-lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                                 ${MY_DIR}/usr/local/include)
add_executable(foo main.cpp)
target_link_libraries(foo third-party-lib)

add_subdirectory(bar)
</code>```

bar/CMakeLists.txt

```<code>set(MY_DIR "/path/two")
add_library(third-party-lib INTERFACE IMPORTED)
set_target_properties(third-party-lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                                 ${MY_DIR}/usr/local/include)
add_executable(bar main.cpp)
target_link_libraries(bar third-party-lib)
</code>```

I have a third party imported library that have properties that depend on a certain variable, in the case of the minimal example it's MY_DIR, I want to set this variable differently for different targets. Is this possible to achieve by "unset"-ing the imported target?

The current minimal example results in add_library cannot create imported target "third-party-lib" because another target with the same name already exists. I tried something like adding unset(third-party-lib) on top of bar/CMakeLists.txt, and I still see the same error.

To provide more context for the real situation, the third party library I need to link to is called by find_package, there are various versions of this third party library that are compiled with different compilers, but only one single config.cmake file is provided, and the IMPORTED_LOCATION has a variable in it's path that determines which version of the third party library it points to. I want to be able to compile one of my target linking to this third party library that is compiled by compiler A, and compile another one of my target linking to this third party library that is compiled by compiler B.

Body:
Please see the below minimal example,

CMakeLists.txt

set(MY_DIR "/path/one")
add_library(third-party-lib INTERFACE IMPORTED)
set_target_properties(third-party-lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                                 ${MY_DIR}/usr/local/include)
add_executable(foo main.cpp)
target_link_libraries(foo third-party-lib)

add_subdirectory(bar)

bar/CMakeLists.txt

set(MY_DIR "/path/two")
add_library(third-party-lib INTERFACE IMPORTED)
set_target_properties(third-party-lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                                 ${MY_DIR}/usr/local/include)
add_executable(bar main.cpp)
target_link_libraries(bar third-party-lib)

I have a third party imported library that have properties that depend on a certain variable, in the case of the minimal example it's MY_DIR, I want to set this variable differently for different targets. Is this possible to achieve by "unset"-ing the imported target?

The current minimal example results in add_library cannot create imported target "third-party-lib" because another target with the same name already exists. I tried something like adding unset(third-party-lib) on top of bar/CMakeLists.txt, and I still see the same error.

To provide more context for the real situation, the third party library I need to link to is called by find_package, there are various versions of this third party library that are compiled with different compilers, but only one single config.cmake file is provided, and the IMPORTED_LOCATION has a variable in it's path that determines which version of the third party library it points to. I want to be able to compile one of my target linking to this third party library that is compiled by compiler A, and compile another one of my target linking to this third party library that is compiled by compiler B.


问:
Co Prime Monte Carlo Simulation
Im trying to create a program to get the probability that 2 numbers are Coprime.I think my algorithm is right but I'm getting runtime errors and I can't see why.

`

```<code>import java.util.*;
import java.util.Random;
public class coPrimeMonteCarlo
{
    public static void main(String[]args)
    {
        Scanner s1 = new Scanner(System.in);
        Random rand = new Random();
        double total = 0;
        double totalNum = 1000000;
        for(int i=0;i<totalNum;i++)
        {
            int a = rand.nextInt();
            int b = rand.nextInt();
            if(isCoPrime(a,b)==1)
            {
                total++;
            };
        }
        System.out.println(total/totalNum);

    }
    public static int isCoPrime(int a, int b)
    {
        if(a==b)
        {
            return a;
        }
        else if((a == 0 || b == 0))
        {
            return 0;
        }
        else if(a>b)
        {
            return isCoPrime(a-b,b);
        }

            return isCoPrime(a,b-a);

    }
}
</code>```

`
Output is

at coPrimeMonteCarlo.isCoPrime(coPrimeMonteCarlo.java:35)
at coPrimeMonteCarlo.isCoPrime(coPrimeMonteCarlo.java:35)

Tried Running but got that output.

Title: Co Prime Monte Carlo Simulation

Body:
Im trying to create a program to get the probability that 2 numbers are Coprime.I think my algorithm is right but I'm getting runtime errors and I can't see why.

`

import java.util.*;
import java.util.Random;
public class coPrimeMonteCarlo
{
    public static void main(String[]args)
    {
        Scanner s1 = new Scanner(System.in);
        Random rand = new Random();
        double total = 0;
        double totalNum = 1000000;
        for(int i=0;i<totalNum;i++)
        {
            int a = rand.nextInt();
            int b = rand.nextInt();
            if(isCoPrime(a,b)==1)
            {
                total++;
            };
        }
        System.out.println(total/totalNum);

    }
    public static int isCoPrime(int a, int b)
    {
        if(a==b)
        {
            return a;
        }
        else if((a == 0 || b == 0))
        {
            return 0;
        }
        else if(a>b)
        {
            return isCoPrime(a-b,b);
        }

            return isCoPrime(a,b-a);

    }
}

`
Output is

at coPrimeMonteCarlo.isCoPrime(coPrimeMonteCarlo.java:35)
at coPrimeMonteCarlo.isCoPrime(coPrimeMonteCarlo.java:35)

Tried Running but got that output.


问:
Generate n-digit prime numbers given their first m digits
Digressing a bit on the site I came across this question, It is clear to me that generating prime numbers is complicated and some of the solutions given in that question to make the problem easier are good and ingenious, It occurs to me that perhaps giving the program some leading digits for large primes will make the search easier, is this correct? For example, perhaps finding 10-digit primes starting with 111 is easier than generating all 10-digit primes (even the more leading digits provided this makes it less complex).

Searching on the net (I must clarify that I am not a mathematician and I am not a computer scientist) I found the following code to generate primes of n digits

```<code>#include <bits/stdc++.h>

using namespace std;
const int sz = 1e5;
bool isPrime[sz + 1];

// Function for Sieve of Eratosthenes

void sieve() {
    memset(isPrime, true, sizeof(isPrime));
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i * i <= sz; i++) {
        if (isPrime[i]) {
            for (int j = i * i; j < sz; j += i) {
                isPrime[j] = false;
            }
        }
    }
}

// Function to print all the prime

// numbers with d digits

void findPrimesD(int d) {
    // Range to check integers
    int left = pow(10, d - 1);
    int right = pow(10, d) - 1;
    // For every integer in the range
    for (int i = left; i <= right; i++) {
        // If the current integer is prime
        if (isPrime[i]) {
            cout << i << " ";
        }
    }
}

// Driver code

int main() {
    // Generate primes
    sieve();
    int d = 1;
    findPrimesD(d);
    return 0;
}
</code>```

My question is, how to take advantage of this code to give it the first m digits and thus make the search easier and smaller?

Body:
Digressing a bit on the site I came across this question, It is clear to me that generating prime numbers is complicated and some of the solutions given in that question to make the problem easier are good and ingenious, It occurs to me that perhaps giving the program some leading digits for large primes will make the search easier, is this correct? For example, perhaps finding 10-digit primes starting with 111 is easier than generating all 10-digit primes (even the more leading digits provided this makes it less complex).

Searching on the net (I must clarify that I am not a mathematician and I am not a computer scientist) I found the following code to generate primes of n digits

#include <bits/stdc++.h>

using namespace std;
const int sz = 1e5;
bool isPrime[sz + 1];

// Function for Sieve of Eratosthenes

void sieve() {
    memset(isPrime, true, sizeof(isPrime));
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i * i <= sz; i++) {
        if (isPrime[i]) {
            for (int j = i * i; j < sz; j += i) {
                isPrime[j] = false;
            }
        }
    }
}

// Function to print all the prime

// numbers with d digits

void findPrimesD(int d) {
    // Range to check integers
    int left = pow(10, d - 1);
    int right = pow(10, d) - 1;
    // For every integer in the range
    for (int i = left; i <= right; i++) {
        // If the current integer is prime
        if (isPrime[i]) {
            cout << i << " ";
        }
    }
}

// Driver code

int main() {
    // Generate primes
    sieve();
    int d = 1;
    findPrimesD(d);
    return 0;
}

My question is, how to take advantage of this code to give it the first m digits and thus make the search easier and smaller?


问:
How compiler is knowing about head in linkedlist
How here head is automatically got the address of the node when we did not pointed we just created a node with name head
`we are directly using the head as if head is not equal to null do this but how head is getting any value in it thats my question.</p>
```<code>public class Main {
    public int size ;
    Main(){
        this.size=0;
    }
    Node head;
    class Node{
        String data;
        Node next;
        Node(String data){
            this.data= data;
            this.next=null;
            size++;
        }
    }
    // add in first
    public void addFirst(String data){
        Node Newnode = new Node(data);
        if (head == null){
            head = Newnode;
            return;
        }
        Newnode.next=head;
        head=Newnode;
    }
}
</code>```

Body:
How here head is automatically got the address of the node when we did not pointed we just created a node with name head
`we are directly using the head as if head is not equal to null do this but how head is getting any value in it thats my question.

public class Main {
    public int size ;
    Main(){
        this.size=0;
    }
    Node head;
    class Node{
        String data;
        Node next;
        Node(String data){
            this.data= data;
            this.next=null;
            size++;
        }
    }
    // add in first
    public void addFirst(String data){
        Node Newnode = new Node(data);
        if (head == null){
            head = Newnode;
            return;
        }
        Newnode.next=head;
        head=Newnode;
    }
}


问:
How to sort Youtube API
I have created a function to pull youtube's video data and load it into a data frame. I need to reverse the order so that I can append new videos to the end of the EXCEL as I'm not aware of code to append lines by adding a new row to the top. My code:

```<code>def get_video_details(youtube, video_ids):
    all_data = []
    for i in range(0, len(video_ids), 50):
        request = youtube.videos().list(
            part = 'snippet, statistics' ,
            id = ','.join(video_ids[i: i + 50]) ,
            #order = 'date'
        )
        response = request.execute()

        for video in response['items']:
            video_stats = dict(
                result_video_name = video['snippet']['title']  ,
                result_video_id = video['id'] ,
                result_video_description = video['snippet']['description']  ,
                result_video_upload_time = video['snippet']['publishedAt']  ,
                result_video_views = video['statistics']['viewCount'] ,
                result_video_likes = video['statistics']['likeCount'] ,
                result_video_favorites = video['statistics']['favoriteCount'] ,
                result_video_comments = video['statistics']['commentCount']
                )
            all_data.append(video_stats)

    return all_data
</code>```

I tried the order = 'date' option per YouTube's recommendation, but it's giving me a type error:
TypeError: Got an unexpected keyword argument order

I followed a similar question (YouTube API: youtube.search().list won't order by date and Sorting Youtube API result from playlist) and it appears it's still not working or not really a feature. Is this still the case or has anyone found a work around?

If I put everything into a data frame, I get an output like this:

2921 - 2016-02-02T02:11:11Z

0    - 2022-12-12T21:10:11Z

I would like 0 to be the first video uploaded in 2016, and 2921 to the 0, uploaded today. I can use my data frame to flip them around, but the unique ID will not be changed.

Title: How to sort Youtube API

Body:
I have created a function to pull youtube's video data and load it into a data frame. I need to reverse the order so that I can append new videos to the end of the EXCEL as I'm not aware of code to append lines by adding a new row to the top. My code:

def get_video_details(youtube, video_ids):
    all_data = []
    for i in range(0, len(video_ids), 50):
        request = youtube.videos().list(
            part = 'snippet, statistics' ,
            id = ','.join(video_ids[i: i + 50]) ,
            #order = 'date'
        )
        response = request.execute()

        for video in response['items']:
            video_stats = dict(
                result_video_name = video['snippet']['title']  ,
                result_video_id = video['id'] ,
                result_video_description = video['snippet']['description']  ,
                result_video_upload_time = video['snippet']['publishedAt']  ,
                result_video_views = video['statistics']['viewCount'] ,
                result_video_likes = video['statistics']['likeCount'] ,
                result_video_favorites = video['statistics']['favoriteCount'] ,
                result_video_comments = video['statistics']['commentCount']
                )
            all_data.append(video_stats)

    return all_data

I tried the order = 'date' option per YouTube's recommendation, but it's giving me a type error:
TypeError: Got an unexpected keyword argument order

I followed a similar question (YouTube API: youtube.search().list won't order by date and Sorting Youtube API result from playlist) and it appears it's still not working or not really a feature. Is this still the case or has anyone found a work around?

If I put everything into a data frame, I get an output like this:

2921 - 2016-02-02T02:11:11Z

0    - 2022-12-12T21:10:11Z

I would like 0 to be the first video uploaded in 2016, and 2921 to the 0, uploaded today. I can use my data frame to flip them around, but the unique ID will not be changed.