问:
Handle Date data type with spring data ldap
I am using spring-data-ldap to find all the users who are created or modified in a certain date range. My UserRepository

```<code>package com.test.service.ldap.com;

import org.springframework.data.ldap.repository.LdapRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRepository extends LdapRepository<User> {}
</code>```

My User class

```<code>package com.test.service.ldap.com;

import lombok.Data;
import lombok.ToString;
import org.springframework.data.domain.Persistable;
import org.springframework.ldap.odm.annotations.Attribute;
import org.springframework.ldap.odm.annotations.Entry;
import org.springframework.ldap.odm.annotations.Id;
import org.springframework.ldap.odm.annotations.Transient;

import javax.naming.Name;
import java.util.Date;

    @Entry(base = "ou=people,dc=example,dc=com",objectClasses = { "top","person","organizationalPerson","inetOrgPerson" })
    @Data
    @ToString
    public final class User implements Persistable<Name> {

        private @Id Name id;
        private @Attribute(name = "cn") String firstname;
        private @Attribute(name = "sn") String lastname;
        private @Attribute(name = "mobile") String mobile;
        private @Attribute(name = "createTimestamp") Date createdtime;
        private @Attribute(name = "modifyTimestamp") Date modifiedtime;

        @Transient
        private Boolean isNew = false;

        @Override
        public boolean isNew() {
            return isNew;
        }
    }
</code>```

I get the below exception when I try to findAll()

```<code>org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.util.Date] for value '20221229074251.850Z'
    at org.springframework.core.convert.support.ObjectToObjectConverter.convert(ObjectToObjectConverter.java:117)
    at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:175)
    at org.springframework.ldap.odm.typeconversion.impl.ConversionServiceConverterManager.convert(ConversionServiceConverterManager.java:67)
...
...
</code>```

I want to know

How to handle Date data type in spring-data-ldap

Can I use something like findAllOrderByModifiedTimeDesc or use Between two dates

Body:
I am using spring-data-ldap to find all the users who are created or modified in a certain date range. My UserRepository

package com.test.service.ldap.com;

import org.springframework.data.ldap.repository.LdapRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRepository extends LdapRepository<User> {}

My User class

package com.test.service.ldap.com;

import lombok.Data;
import lombok.ToString;
import org.springframework.data.domain.Persistable;
import org.springframework.ldap.odm.annotations.Attribute;
import org.springframework.ldap.odm.annotations.Entry;
import org.springframework.ldap.odm.annotations.Id;
import org.springframework.ldap.odm.annotations.Transient;

import javax.naming.Name;
import java.util.Date;

    @Entry(base = "ou=people,dc=example,dc=com",objectClasses = { "top","person","organizationalPerson","inetOrgPerson" })
    @Data
    @ToString
    public final class User implements Persistable<Name> {

        private @Id Name id;
        private @Attribute(name = "cn") String firstname;
        private @Attribute(name = "sn") String lastname;
        private @Attribute(name = "mobile") String mobile;
        private @Attribute(name = "createTimestamp") Date createdtime;
        private @Attribute(name = "modifyTimestamp") Date modifiedtime;

        @Transient
        private Boolean isNew = false;

        @Override
        public boolean isNew() {
            return isNew;
        }
    }

I get the below exception when I try to findAll()

org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.util.Date] for value '20221229074251.850Z'
    at org.springframework.core.convert.support.ObjectToObjectConverter.convert(ObjectToObjectConverter.java:117)
    at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:175)
    at org.springframework.ldap.odm.typeconversion.impl.ConversionServiceConverterManager.convert(ConversionServiceConverterManager.java:67)
...
...

I want to know

How to handle Date data type in spring-data-ldap

Can I use something like findAllOrderByModifiedTimeDesc or use Between two dates


来源: stackexchange

问:
Stacktraces with sourcemaps in warnings from react?
I have sourcemaps working when error are thrown but React has some special warnings that create stacktraces of its own in reactdom (when development mode). Is it possible to have sourcemaps loaded in these stacktraces?

We are building using webpack and I have tried almost all config setups :) Not sure if its actually possible to get sourcemaps loaded when stacktraces are logged like this?

The output comes from the following code in react-dom.development.js:

```<code>function printWarning(level, format, args) {
  // When changing this logic, you might want to also
  // update consoleWithStackDev.www.js as well.
  {
    var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
    var stack = ReactDebugCurrentFrame.getStackAddendum();

    if (stack !== '') {
      format += '%s';
      args = args.concat([stack]);
    } // eslint-disable-next-line react-internal/safe-string-coercion

    var argsWithFormat = args.map(function (item) {
      return String(item);
    }); // Careful: RN currently depends on this prefix

    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
    // breaks IE9: https://github.com/facebook/react/issues/13610
    // eslint-disable-next-line react-internal/no-production-logging

    Function.prototype.apply.call(console[level], console, argsWithFormat);
  }
}
</code>```

The stacktraces is fetched using this:

```<code>if (prefix === undefined) {
      // Extract the VM specific prefix used by each line.
      try {
        throw Error();
      } catch (x) {
        var match = x.stack.trim().match(/\n( *(at )?)/);
        prefix = match && match[1] || '';
      }
    } // We use the prefix to ensure our stacks line up with native stack frames.

    return '\n' + prefix + name;
</code>```
```<code>react-dom.development.js:86 Warning: Prop `sizes` did not match. Server: "246px" Client: ""
    at source
    at Source (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:9062:5)
    at picture
    at Picture (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:8942:5)
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardMedia (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:4476:5)
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardContent (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:4359:5)
    at a
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:10323:5
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardFrame (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:4403:5)
    at CategoryCard (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:3213:5)
    at CardRenderer (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:3077:5)
    at li
    at ScrollerItem (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:11893:5)
    at ol
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:11453:5
    at div
    at Scroller (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:11771:5)
    at div
    at div
    at Container (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:5586:5)
    at ConditonalWrapper (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:14324:5)
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardList (https://sitecore.nw.local/static/hbd/hbd.86c176f3.js:1248:5)
    at ConnectFunction (https://sitecore.nw.local/static/hbd/vendors.c78f2057.js:45074:68)
    at IntlProvider (https://sitecore.nw.local/static/hbd/vendors.c78f2057.js:44228:43)
    at Provider (https://sitecore.nw.local/static/hbd/vendors.c78f2057.js:44815:20)
    at StoreProvider (https://sitecore.nw.local/static/hbd/hbd.86c176f3.js:34359:5)
    at HydratingCardList (https://sitecore.nw.local/static/hbd/hbd.86c176f3.js:1168:5)
</code>```

Is is possible to map this through my sourcemaps in some way? Or am I chasing something impossible? :)

ContentLicense: CC BY-SA 4.0

Body:
I have sourcemaps working when error are thrown but React has some special warnings that create stacktraces of its own in reactdom (when development mode). Is it possible to have sourcemaps loaded in these stacktraces?

We are building using webpack and I have tried almost all config setups :) Not sure if its actually possible to get sourcemaps loaded when stacktraces are logged like this?

The output comes from the following code in react-dom.development.js:

function printWarning(level, format, args) {
  // When changing this logic, you might want to also
  // update consoleWithStackDev.www.js as well.
  {
    var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
    var stack = ReactDebugCurrentFrame.getStackAddendum();

    if (stack !== '') {
      format += '%s';
      args = args.concat([stack]);
    } // eslint-disable-next-line react-internal/safe-string-coercion

    var argsWithFormat = args.map(function (item) {
      return String(item);
    }); // Careful: RN currently depends on this prefix

    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
    // breaks IE9: https://github.com/facebook/react/issues/13610
    // eslint-disable-next-line react-internal/no-production-logging

    Function.prototype.apply.call(console[level], console, argsWithFormat);
  }
}

The stacktraces is fetched using this:

if (prefix === undefined) {
      // Extract the VM specific prefix used by each line.
      try {
        throw Error();
      } catch (x) {
        var match = x.stack.trim().match(/\n( *(at )?)/);
        prefix = match && match[1] || '';
      }
    } // We use the prefix to ensure our stacks line up with native stack frames.

    return '\n' + prefix + name;

react-dom.development.js:86 Warning: Prop `sizes` did not match. Server: "246px" Client: ""
    at source
    at Source (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:9062:5)
    at picture
    at Picture (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:8942:5)
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardMedia (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:4476:5)
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardContent (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:4359:5)
    at a
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:10323:5
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardFrame (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:4403:5)
    at CategoryCard (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:3213:5)
    at CardRenderer (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:3077:5)
    at li
    at ScrollerItem (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:11893:5)
    at ol
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:11453:5
    at div
    at Scroller (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:11771:5)
    at div
    at div
    at Container (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:5586:5)
    at ConditonalWrapper (https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:14324:5)
    at div
    at https://sitecore.nw.local/static/hbd/hbd-core.7ba76711.js:1952:5
    at CardList (https://sitecore.nw.local/static/hbd/hbd.86c176f3.js:1248:5)
    at ConnectFunction (https://sitecore.nw.local/static/hbd/vendors.c78f2057.js:45074:68)
    at IntlProvider (https://sitecore.nw.local/static/hbd/vendors.c78f2057.js:44228:43)
    at Provider (https://sitecore.nw.local/static/hbd/vendors.c78f2057.js:44815:20)
    at StoreProvider (https://sitecore.nw.local/static/hbd/hbd.86c176f3.js:34359:5)
    at HydratingCardList (https://sitecore.nw.local/static/hbd/hbd.86c176f3.js:1168:5)

Is is possible to map this through my sourcemaps in some way? Or am I chasing something impossible? :)


问:
add sound to a specific frame of a video in python
I have a video of a bouncing ball and know exactly in which frames the ball hits the ground. I want now to add a sound (i.e. a piano note) added to the video every time the ball is hitting the ground. What is the best way/module to do this in Python?</p>


问:
Duplicate a liberty server, application won't start
I have installed on my laptop a Liberty server, just unzipped, launched server create <name> and copied some files from the remote server test environment and put a .war with a local configuration.
Run the server through command line and the application is working.

Now I tried to do the same on a colleague laptop, but the application seems that is started, but when I call a rest endpoint I have no response, just an ERR_CONNECTION_REFUSED from browser.
I tried to copy my exact folder on his laptop, same problem. I tried to copy my server folder on another folder in my laptop, same problem. I tried with different version of the server, but nothing change. I tried to copy the server from test environment on my laptop and using my .war, no way. The .war is always the same, the one that's working on my first attempt, I checked to not have hard-coded path.

The log:

```<code>...

com.ibm.ws.http.internal.VirtualHostImpl                     A CWWKT0016I: Web application available (default_host): http://localhost:9080/idsWS/
com.ibm.ws.session.WASSessionCore                            I SESN0176I: A new session context will be created for application key default_host/idsWS
com.ibm.ws.util                                              I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
io.jaegertracing.Configuration                               I Initialized tracer=JaegerTracer(version=Java-0.34.0, serviceName=ws-ids, reporter=RemoteReporter(sender=UdpSender(), closeEnqueueTimeout=1000), sampler=RemoteControlledSampler(maxOperations=2000, manager=HttpSamplingManager(hostPort=localhost:5778), sampler=ProbabilisticSampler(tags={sampler.type=probabilistic, sampler.param=0.001})), tags={hostname=CTXW10VDDN-006, jaeger.version=Java-0.34.0, ip=26.0.226.195}, zipkinSharedRpcSpan=false, expandExceptionLogs=false, useTraceId128Bit=false)
m.ibm.ws.microprofile.opentracing.jaeger.JaegerTracerFactory I CWMOT1001I: A JaegerTracer instance was created for the ws-ids application.  Tracing information is sent to localhost:6831.
com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0001I: Application ws-ids started in 39.529 seconds.

<-------------------------------------------->

com.ibm.ws.webcontainer.extension                            W SRVE0190E: File not found: /openapi/ui/
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider FakeRestFilter is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider PortaleCookieFilterRest is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider BusinessExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider GenericExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider UnknownUrlExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider ValidationExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.apache.cxf.cxf.core.3.2:1.0.71.cl221220221107-1900(id=116)] I Setting the server's publish address to be /api/
com.ibm.ws.webcontainer.servlet                              I SRVE0242I: [ws-ids] [/idsWS] [it.sogei.dichiarazioneids.ws.server.JAXRSActivator]: Initialization successful.
eclipselink                                                  I CWWJP9990I: [eclipselink] EclipseLink, version: Eclipse Persistence Services - 2.7.11.v20220804-52dea2a3c0
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8203I: Database product name : Oracle
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8204I: Database product version : Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8205I: JDBC driver name  : Oracle JDBC driver
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8206I: JDBC driver version  : 12.2.0.1.0
</code>```

Before the line the logs are the same, below the line only the working application write the logs after that an endpoint is called. If I call the same api url on my colleague laptop, too if as written in the logs above the application ws-ids seems started, no others logs are written.

I understand that I'm not giving much information, but the server.xml, server.env and the .war and all the other configuration file are really the same.
It seems like the server is starting my application, without loading it to the server. Any idea? Which information could I add?

Body:
I have installed on my laptop a Liberty server, just unzipped, launched server create <name> and copied some files from the remote server test environment and put a .war with a local configuration.
Run the server through command line and the application is working.

Now I tried to do the same on a colleague laptop, but the application seems that is started, but when I call a rest endpoint I have no response, just an ERR_CONNECTION_REFUSED from browser.
I tried to copy my exact folder on his laptop, same problem. I tried to copy my server folder on another folder in my laptop, same problem. I tried with different version of the server, but nothing change. I tried to copy the server from test environment on my laptop and using my .war, no way. The .war is always the same, the one that's working on my first attempt, I checked to not have hard-coded path.

The log:

...

com.ibm.ws.http.internal.VirtualHostImpl                     A CWWKT0016I: Web application available (default_host): http://localhost:9080/idsWS/
com.ibm.ws.session.WASSessionCore                            I SESN0176I: A new session context will be created for application key default_host/idsWS
com.ibm.ws.util                                              I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
io.jaegertracing.Configuration                               I Initialized tracer=JaegerTracer(version=Java-0.34.0, serviceName=ws-ids, reporter=RemoteReporter(sender=UdpSender(), closeEnqueueTimeout=1000), sampler=RemoteControlledSampler(maxOperations=2000, manager=HttpSamplingManager(hostPort=localhost:5778), sampler=ProbabilisticSampler(tags={sampler.type=probabilistic, sampler.param=0.001})), tags={hostname=CTXW10VDDN-006, jaeger.version=Java-0.34.0, ip=26.0.226.195}, zipkinSharedRpcSpan=false, expandExceptionLogs=false, useTraceId128Bit=false)
m.ibm.ws.microprofile.opentracing.jaeger.JaegerTracerFactory I CWMOT1001I: A JaegerTracer instance was created for the ws-ids application.  Tracing information is sent to localhost:6831.
com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0001I: Application ws-ids started in 39.529 seconds.

<-------------------------------------------->

com.ibm.ws.webcontainer.extension                            W SRVE0190E: File not found: /openapi/ui/
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider FakeRestFilter is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider PortaleCookieFilterRest is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider BusinessExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider GenericExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider UnknownUrlExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer W CWWKW1002W: The CDI scope of JAXRS Provider ValidationExceptionMapper is javax.enterprise.context.Dependent. Liberty gets the provider instance from CDI.
.apache.cxf.cxf.core.3.2:1.0.71.cl221220221107-1900(id=116)] I Setting the server's publish address to be /api/
com.ibm.ws.webcontainer.servlet                              I SRVE0242I: [ws-ids] [/idsWS] [it.sogei.dichiarazioneids.ws.server.JAXRSActivator]: Initialization successful.
eclipselink                                                  I CWWJP9990I: [eclipselink] EclipseLink, version: Eclipse Persistence Services - 2.7.11.v20220804-52dea2a3c0
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8203I: Database product name : Oracle
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8204I: Database product version : Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8205I: JDBC driver name  : Oracle JDBC driver
com.ibm.ws.rsadapter.impl.DatabaseHelper                     I DSRA8206I: JDBC driver version  : 12.2.0.1.0

Before the line the logs are the same, below the line only the working application write the logs after that an endpoint is called. If I call the same api url on my colleague laptop, too if as written in the logs above the application ws-ids seems started, no others logs are written.

I understand that I'm not giving much information, but the server.xml, server.env and the .war and all the other configuration file are really the same.
It seems like the server is starting my application, without loading it to the server. Any idea? Which information could I add?


问:
Two output files share the same path but have different contents: node_modules\.vite\deps_temp\React.js
```<code>X [ERROR] Two output files share the same path but have different contents: node_modules\.vite\deps_temp\React.js

E:\DGSfrontend\node_modules\esbuild\lib\main.js:1596
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 1 error:
error: Two output files share the same path but have different contents: node_modules\.vite\deps_temp\React.js
    at failureErrorWithLog (E:\DGSfrontend\node_modules\esbuild\lib\main.js:1596:15)
    at E:\DGSfrontend\node_modules\esbuild\lib\main.js:1052:28
    at runOnEndCallbacks (E:\DGSfrontend\node_modules\esbuild\lib\main.js:1468:61)
    at buildResponseToResult (E:\DGSfrontend\node_modules\esbuild\lib\main.js:1050:7)
    at E:\DGSfrontend\node_modules\esbuild\lib\main.js:1162:14
    at responseCallbacks.<computed> (E:\DGSfrontend\node_modules\esbuild\lib\main.js:697:9)
    at handleIncomingPacket (E:\DGSfrontend\node_modules\esbuild\lib\main.js:752:9)
    at Socket.readFromStdout (E:\DGSfrontend\node_modules\esbuild\lib\main.js:673:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: null,
      notes: [],
      pluginName: '',
      text: 'Two output files share the same path but have different contents: node_modules\\.vite\\deps_temp\\React.js'
    }
  ],
  warnings: []
}

Node.js v18.12.1
</code>```

tried checking and rechecking the file name and package names but didn't work.it occured after I started routing with react-router-dom. It worked before but after some time the error stopped the build and stopped the site

Body:
X [ERROR] Two output files share the same path but have different contents: node_modules\.vite\deps_temp\React.js

E:\DGSfrontend\node_modules\esbuild\lib\main.js:1596
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 1 error:
error: Two output files share the same path but have different contents: node_modules\.vite\deps_temp\React.js
    at failureErrorWithLog (E:\DGSfrontend\node_modules\esbuild\lib\main.js:1596:15)
    at E:\DGSfrontend\node_modules\esbuild\lib\main.js:1052:28
    at runOnEndCallbacks (E:\DGSfrontend\node_modules\esbuild\lib\main.js:1468:61)
    at buildResponseToResult (E:\DGSfrontend\node_modules\esbuild\lib\main.js:1050:7)
    at E:\DGSfrontend\node_modules\esbuild\lib\main.js:1162:14
    at responseCallbacks.<computed> (E:\DGSfrontend\node_modules\esbuild\lib\main.js:697:9)
    at handleIncomingPacket (E:\DGSfrontend\node_modules\esbuild\lib\main.js:752:9)
    at Socket.readFromStdout (E:\DGSfrontend\node_modules\esbuild\lib\main.js:673:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: null,
      notes: [],
      pluginName: '',
      text: 'Two output files share the same path but have different contents: node_modules\\.vite\\deps_temp\\React.js'
    }
  ],
  warnings: []
}

Node.js v18.12.1

tried checking and rechecking the file name and package names but didn't work.it occured after I started routing with react-router-dom. It worked before but after some time the error stopped the build and stopped the site


问:
Font-face imported font not loading on webpage (django)
I've got a django web app running and am trying to upload a custom font. I'm using @font-face in the style sheet to grab the font files and then am using inline styling in the html template to apply the font (for some reason using body{} in the style sheet doesn't apply styles to the entire page).

@font-face code in style sheet:

```<code>@font-face {
    font-family: 'D3 Digitalism';
    src: local('D3 Digitalism') url('static/chatswap/font/d3-digitalism-font/D3Digitalism.woff2') format('woff2'),
    local('D3 Digitalism'), url('static/chatswap/font/d3-digitalism-font/D3Digitalism.woff') format('woff'),
    local('D3 Digitalism'), url('static/chatswap/font/d3-digitalism-font/D3Digitalism.eot'),
    local('D3 Digitalism'), url('static/chatswap/font/d3-digitalism-font/D3Digitalism.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
</code>```

index.html template:

```<code><body style="background-color: rgb(20,20,20); font-family: D3 Digitalism">
</code>```

I've tried changing the name of the font in the CSS file to something without a number or space character in the name, did not help.

Body:
I've got a django web app running and am trying to upload a custom font. I'm using @font-face in the style sheet to grab the font files and then am using inline styling in the html template to apply the font (for some reason using body{} in the style sheet doesn't apply styles to the entire page).

@font-face code in style sheet:

@font-face {
    font-family: 'D3 Digitalism';
    src: local('D3 Digitalism') url('static/chatswap/font/d3-digitalism-font/D3Digitalism.woff2') format('woff2'),
    local('D3 Digitalism'), url('static/chatswap/font/d3-digitalism-font/D3Digitalism.woff') format('woff'),
    local('D3 Digitalism'), url('static/chatswap/font/d3-digitalism-font/D3Digitalism.eot'),
    local('D3 Digitalism'), url('static/chatswap/font/d3-digitalism-font/D3Digitalism.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

index.html template:

I've tried changing the name of the font in the CSS file to something without a number or space character in the name, did not help.


问:
How to hide UITableViewCell _UIFloatingContentView TVOS swift
i want to hide _UIFloatingContentView in UITableViewCell tvOs swift

how to hide _UIFloatingContentView


问:
How to use dependency_proxy with Gitlab AutoDevops?
When using Gitlab AutoDevops we can include their templates.

https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml#L168

The imported ci templates is owned by gitlab in our gitlab-ci.yml file. We can't alter their templates with the necessary variable CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX or other changes that is required for dependency proxy to work.

We intend to use "dependency_proxy" to avoid dockerhub pull rate limitation.

How do we take advantage of dependency_proxy without having to re-write/override their templates?


问:
Django View Test With PUT Method
I am testing my Django App and I have used APIView to have all HTTP requests go to one endpoint. I have managed to test the GET and POST but testing the PUT I am getting {"detail":"Unsupported media type \\"application/octet-stream\\" in request."} when I print response.content with AssertionError: 415!=200. Below is my code;

```<code>def test_view_province_exists(self):
    user = User.objects.create_superuser(firstname='John', lastname='Doez', email='johndoez@mail.com',
                            role='System Admin', access_url='chikoloadmin.kodkon.com',
                            password='Passwordz123')
    self.client.login(email='johndoez@mail.com', password='Passwordz123')
    prov = Province.objects.create(province='Southern', created_by=user)
    response = self.client.put(self.province_url, data={'province': 'Southern Province',
                            'public_key': prov.public_key})
    print(response.content)
    self.assertEqual(response.status_code, 200)
    self.assertContains(response, 'Province Updated.')
</code>```

Title: Django View Test With PUT Method

Body:
I am testing my Django App and I have used APIView to have all HTTP requests go to one endpoint. I have managed to test the GET and POST but testing the PUT I am getting {"detail":"Unsupported media type \\"application/octet-stream\\" in request."} when I print response.content with AssertionError: 415!=200. Below is my code;

def test_view_province_exists(self):
    user = User.objects.create_superuser(firstname='John', lastname='Doez', email='johndoez@mail.com',
                            role='System Admin', access_url='chikoloadmin.kodkon.com',
                            password='Passwordz123')
    self.client.login(email='johndoez@mail.com', password='Passwordz123')
    prov = Province.objects.create(province='Southern', created_by=user)
    response = self.client.put(self.province_url, data={'province': 'Southern Province',
                            'public_key': prov.public_key})
    print(response.content)
    self.assertEqual(response.status_code, 200)
    self.assertContains(response, 'Province Updated.')


问:
"Login with" experience when only service account can be used?
We're building a web app where a user is able to work with their BigQuery data.
We'd like to offer users an easy and quick experience when making the connection (i.e "login with google"), so using the web app OAUTH flow seems like the way to go.

However, it seems like our app only knows how to handle service account credentials.
The app is based (server side) on Databricks, which means Spark will be used to make the connection. As far as we could find - Spark only accepts service accounts.

Has anyone had similar challenge and can share their experience?

We have an idea to use the access token from the web app flow to create a service account programmatically but it sounds a bit hackie.

Searching SO I found this old post:
oauth2 for service account

The idea is similar but I'm sure people gathered more experience with this.


问:
avx512 programming - what is the prefered way to organize load (e.g. vmovups) and compute (e.g. vaddps) instructions
I'm using the Xbyak library. I use avx512 instruction to calculate dot product of two vectors.

the first unrolling strategy: load 16*4 float32 from each vector, and do the fmadd operation.

// variable A and B are the registers store base address of vector A and B
// zmm0,1,2,3 load 16*4 float32 from A
// zmm4,5,6,7 load 16*4 float32 from B
// zmm8 stores the temp accumulation
vmovups(zmm0, ptr[A]);
vmovups(zmm1, ptr[A+64]);
vmovups(zmm2, ptr[A+64*2]);
vmovups(zmm3, ptr[A+64*3]);

vmovups(zmm4, ptr[B]);
vmovups(zmm5, ptr[B+64]);
vmovups(zmm6, ptr[B+64*2]);
vmovups(zmm7, ptr[B+64*3]);

vfmadd231ps(zmm8, zmm0, zmm4);
vfmadd231ps(zmm8, zmm1, zmm5);
vfmadd231ps(zmm8, zmm2, zmm6);
vfmadd231ps(zmm8, zmm3, zmm7);
```
<p>the second unrolling strategy: load 16 float32 from each vector, and do the fmadd operation</p>
<pre class="lang-cpp prettyprint-override"><code>vmovups(zmm0, ptr[A]);
vmovups(zmm4, ptr[B]);
vfmadd231ps(zmm8, zmm0, zmm4);

vmovups(zmm1, ptr[A+64]);
vmovups(zmm5, ptr[B+64]);
vfmadd231ps(zmm8, zmm1, zmm5);

vmovups(zmm2, ptr[A+64*2]);
vmovups(zmm6, ptr[B+64*2]);
vfmadd231ps(zmm8, zmm2, zmm6);

vmovups(zmm3, ptr[A+64*3]);
vmovups(zmm7, ptr[B+64*3]);
vfmadd231ps(zmm8, zmm3, zmm7);
</code>```

does the two unrolling strategies make difference(, does the out-of-order execution unit makes the two code have no difference)? which is prefered? or if the two strategies are not optimized, what is the optimized way to do this?

I also tried to use zmm8,9,10,11 to store the temp accumulations, and at the end of loop, use vaddps to   add the 4 registers. Can it make the code run faster?

I'm going to write some benchmarks to see how the two piece of code performce in the real world. But I think there must be some prefered way to write such code. I do have some google searching, but not get much information about the question.

Body:
I'm using the Xbyak library. I use avx512 instruction to calculate dot product of two vectors.

the first unrolling strategy: load 16*4 float32 from each vector, and do the fmadd operation.

// variable A and B are the registers store base address of vector A and B
// zmm0,1,2,3 load 16*4 float32 from A
// zmm4,5,6,7 load 16*4 float32 from B
// zmm8 stores the temp accumulation
vmovups(zmm0, ptr[A]);
vmovups(zmm1, ptr[A+64]);
vmovups(zmm2, ptr[A+64*2]);
vmovups(zmm3, ptr[A+64*3]);

vmovups(zmm4, ptr[B]);
vmovups(zmm5, ptr[B+64]);
vmovups(zmm6, ptr[B+64*2]);
vmovups(zmm7, ptr[B+64*3]);

vfmadd231ps(zmm8, zmm0, zmm4);
vfmadd231ps(zmm8, zmm1, zmm5);
vfmadd231ps(zmm8, zmm2, zmm6);
vfmadd231ps(zmm8, zmm3, zmm7);

the second unrolling strategy: load 16 float32 from each vector, and do the fmadd operation

vmovups(zmm0, ptr[A]);
vmovups(zmm4, ptr[B]);
vfmadd231ps(zmm8, zmm0, zmm4);

vmovups(zmm1, ptr[A+64]);
vmovups(zmm5, ptr[B+64]);
vfmadd231ps(zmm8, zmm1, zmm5);

vmovups(zmm2, ptr[A+64*2]);
vmovups(zmm6, ptr[B+64*2]);
vfmadd231ps(zmm8, zmm2, zmm6);

vmovups(zmm3, ptr[A+64*3]);
vmovups(zmm7, ptr[B+64*3]);
vfmadd231ps(zmm8, zmm3, zmm7);

does the two unrolling strategies make difference(, does the out-of-order execution unit makes the two code have no difference)? which is prefered? or if the two strategies are not optimized, what is the optimized way to do this?

I also tried to use zmm8,9,10,11 to store the temp accumulations, and at the end of loop, use vaddps to   add the 4 registers. Can it make the code run faster?

I'm going to write some benchmarks to see how the two piece of code performce in the real world. But I think there must be some prefered way to write such code. I do have some google searching, but not get much information about the question.


问:
What does trusted: false mean in Jupyter notebook Cells metadata
When I activate the cell metadata via View | Cell Toolbar | Edit Metadata and then click on the button 'Edit Metadata' in the cell, there is the following JSON code by default:

{
  "trusted": false
}
```

What does it mean? I can't find documentation about that. Setting trusted to true doesn't change anything, it seems.

Body:
When I activate the cell metadata via View | Cell Toolbar | Edit Metadata and then click on the button 'Edit Metadata' in the cell, there is the following JSON code by default:

{
  "trusted": false
}

What does it mean? I can't find documentation about that. Setting trusted to true doesn't change anything, it seems.


问:
How to name class parameter in Vite JSX components?
In Vite, className is deprecated and we are encouraged to use class.

This is great news.

But when we want to create a component:

```<code>const Card = ({ class }) => {
   return <div class={class}>I am a card</div>
}
</code>```

Then the code does not compile.

We can easily change the name to style:

```<code>const Card = ({ style }) => {
</code>```

But this means that our code is not consistent anymore. In some places we apply styles using class and in some places we apply styles using any other name that we have given to our parameters.

What is the solution here? How can we be consistent across a Vite JSX project to apply styles?

Body:
In Vite, className is deprecated and we are encouraged to use class.

This is great news.

But when we want to create a component:

const Card = ({ class }) => {
   return
I am a card

}

Then the code does not compile.

We can easily change the name to style:

const Card = ({ style }) => {

But this means that our code is not consistent anymore. In some places we apply styles using class and in some places we apply styles using any other name that we have given to our parameters.

What is the solution here? How can we be consistent across a Vite JSX project to apply styles?


问:
Is my assumption about Time and Space Complexity of subsum algorithm correct?
Is the space complexity of this algorithm is O(n^3) cubic space complexity ?
As: list is an array, subs is an array + one array created with map.

Is the time complexity is O(n^4) biquadratic?
As: two times loop on list + one time map  + one time sum

```<code>def largest_contiguous_subsum(list)
  subs = []

  list.each_index do |idx1|
    (idx1..list.length - 1).each do |idx2|
      subs << list[idx1..idx2]
    end
  end

  subs.map(&:sum).max
end
</code>```

I am currently trying to understand Big O concept

Body:
Is the space complexity of this algorithm is O(n^3) cubic space complexity ?
As: list is an array, subs is an array + one array created with map.

Is the time complexity is O(n^4) biquadratic?
As: two times loop on list + one time map  + one time sum

def largest_contiguous_subsum(list)
  subs = []

  list.each_index do |idx1|
    (idx1..list.length - 1).each do |idx2|
      subs << list[idx1..idx2]
    end
  end

  subs.map(&:sum).max
end

I am currently trying to understand Big O concept


问:
Should I use question mark when styling GSS code in Memgraph Lab?
I'm going through GSS tutorial and I can see that sometimes there is question mark when styling GSS code, and other time there isn't one. For example:

```<code>@NodeStyle HasLabel?(node, "Country") {
  color: #dd2222
  color-hover: Darker(#dd2222)
  color-selected: #dd2222
}
</code>```

and

```<code>@NodeStyle HasLabel(node, "Country") {
  color: #ffd700
  color-hover: #ffa500
  color-selected: #dd2222
}
</code>```

Both codes work for me. So I wonder, should I use HasLabel? or HasLabel?

Body:
I'm going through GSS tutorial and I can see that sometimes there is question mark when styling GSS code, and other time there isn't one. For example:

@NodeStyle HasLabel?(node, "Country") {
  color: #dd2222
  color-hover: Darker(#dd2222)
  color-selected: #dd2222
}

and

@NodeStyle HasLabel(node, "Country") {
  color: #ffd700
  color-hover: #ffa500
  color-selected: #dd2222
}

Both codes work for me. So I wonder, should I use HasLabel? or HasLabel?


问:
Lattice option not working for column header in tabula-py
I am using tabula-py for extracting table from pdf. Where I am using lattice for parsing the file. It is doing good for all rows except the first one.

code:

```<code>df = read_pdf("filename.pdf", pages=21, multiple_tables=True, lattice=True)
</code>```

Table in pdf:
enter image description here

Output from Tabula:
enter image description here

There are multiple table tables with varying area and number of columns in the pdf. As you can see in image lattice is working good for 2 and 3rd rows and for 1st row it is not working good.

I tried camelot library but it is giving deprecation error of pypdf2.

Body:
I am using tabula-py for extracting table from pdf. Where I am using lattice for parsing the file. It is doing good for all rows except the first one.

code:

df = read_pdf("filename.pdf", pages=21, multiple_tables=True, lattice=True)

Table in pdf:
enter image description here

Output from Tabula:
enter image description here

There are multiple table tables with varying area and number of columns in the pdf. As you can see in image lattice is working good for 2 and 3rd rows and for 1st row it is not working good.

I tried camelot library but it is giving deprecation error of pypdf2.


问:
WebIDL object class strings
In https://webidl.spec.whatwg.org/ , while I see reference to specific prescribed class strings on interface prototypes, I don't see any prescribed behavior for class strings on objects which implement an interface.

Is that up to the spec to specify in some manner?  I'm specifically wondering whether CryptoKey objects, by their WebIDL implies a specific class string (presumably "CryptoKey", if so).

If this is not implied in WebIDL, why is it not (as it should be useful to have such a consistent means available for detection in userland)? Should it not at least be encouraged somewhere for objects implementing an interface to define them?

Title: WebIDL object class strings


问:
Fail to send MMS w/ cause Permission Denial: opening provider com.android.providers.mms.MmsFileProvider from ProcessRecord
I failed to send MMS via the SmsManager method sendMultimediaMessage() and got the permission denial failure below.

Can anyone help to check it and guide me the reason? Thank you so much!

```<code>12-23 00:01:25.806  2020  7842 E MmsService: Exception during PDU read
12-23 00:01:25.806  2020  7842 E MmsService: java.util.concurrent.ExecutionException: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.mms.MmsFileProvider from ProcessRecord{f91aec3 2020:com.android.phone/1001} (pid=2020, uid=1001) that is not exported from UID 1000
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.FutureTask.get(FutureTask.java:205)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsService.readPduBytesFromContentUri(MmsService.java:1084)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsService.readPduFromContentUri(MmsService.java:1033)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.SendRequest.readPduFromContentUri(SendRequest.java:352)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.SendRequest.prepareForHttpRequest(SendRequest.java:378)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsRequest.execute(MmsRequest.java:151)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsService$2.run(MmsService.java:644)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.lang.Thread.run(Thread.java:1012)
</code>```

Below is the key part of my java code and manifest.

Java code

```<code>smsManager.sendMultimediaMessage(
        /* context= */ context,
        /* contentUri= */ new Uri.Builder()
            .authority(MmsFileProvider.class.getName())
            .path(fileName)
            .scheme(ContentResolver.SCHEME_CONTENT)
            .build(),
        /* locationUrl= */ null,
        /* configOverrides= */ null,
        /* sentIntent= */ PendingIntent.getBroadcast(
            /* context= */ context,
            /* requestCode= */ 0,
            /* intent= */ new Intent(OutgoingMMSReceiver.ACTION),
            /* flags= */ 0));
</code>```

AndroidManifest.xml

```<code><provider
        android:name="com.android.providers.mms.MmsFileProvider"
        android:authorities="com.android.providers.mms.MmsFileProvider"
        android:enabled="true"
        android:grantUriPermissions="true"
        android:exported="false" />
</code>```

It seems like the provider 'com.android.providers.mms.MmsFileProvider' doesn't have the permission.
Actually I can succeed to send the MMS few months ago with the same method but for unknow reason it doesn't work anymore right now.

Body:
I failed to send MMS via the SmsManager method sendMultimediaMessage() and got the permission denial failure below.

Can anyone help to check it and guide me the reason? Thank you so much!

12-23 00:01:25.806  2020  7842 E MmsService: Exception during PDU read
12-23 00:01:25.806  2020  7842 E MmsService: java.util.concurrent.ExecutionException: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.mms.MmsFileProvider from ProcessRecord{f91aec3 2020:com.android.phone/1001} (pid=2020, uid=1001) that is not exported from UID 1000
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.FutureTask.get(FutureTask.java:205)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsService.readPduBytesFromContentUri(MmsService.java:1084)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsService.readPduFromContentUri(MmsService.java:1033)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.SendRequest.readPduFromContentUri(SendRequest.java:352)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.SendRequest.prepareForHttpRequest(SendRequest.java:378)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsRequest.execute(MmsRequest.java:151)
12-23 00:01:25.806  2020  7842 E MmsService:    at com.android.mms.service.MmsService$2.run(MmsService.java:644)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
12-23 00:01:25.806  2020  7842 E MmsService:    at java.lang.Thread.run(Thread.java:1012)

Below is the key part of my java code and manifest.

Java code

smsManager.sendMultimediaMessage(
        /* context= */ context,
        /* contentUri= */ new Uri.Builder()
            .authority(MmsFileProvider.class.getName())
            .path(fileName)
            .scheme(ContentResolver.SCHEME_CONTENT)
            .build(),
        /* locationUrl= */ null,
        /* configOverrides= */ null,
        /* sentIntent= */ PendingIntent.getBroadcast(
            /* context= */ context,
            /* requestCode= */ 0,
            /* intent= */ new Intent(OutgoingMMSReceiver.ACTION),
            /* flags= */ 0));

AndroidManifest.xml

<provider
        android:name="com.android.providers.mms.MmsFileProvider"
        android:authorities="com.android.providers.mms.MmsFileProvider"
        android:enabled="true"
        android:grantUriPermissions="true"
        android:exported="false" />

It seems like the provider 'com.android.providers.mms.MmsFileProvider' doesn't have the permission.
Actually I can succeed to send the MMS few months ago with the same method but for unknow reason it doesn't work anymore right now.


问:
I have installed sass correctly in my react project but still I am getting module error -> cannot find module 'sass' & shows module build failed
Cannot find module 'sass' and Module build failed error

I tried npm rebuild node-sass, reinstalling webpack, what should I do now?


问:
React download pdf and view
How to view pdf downloaded? There is no problem on downloading pdf, the problem is the viewing, cant view the downloaded pdf, why is that?

I have this code

```<code>  static getAttachement(item) {
    return axios.get(this.contextUrl + '/test', {responseType: 'blob'})
      .then(response => {
        return response.data;
      })
      .catch(error => {
        throw error;
      });
  }
</code>```

and this

```<code>  const handlePrint = async () => {
    await UserApi.getAttachement().then((res)=>{
      console.log(res.data)
      const url = window.URL.createObjectURL(new Blob([new Uint8Array(res.data)]));
      const link = document.createElement('a');
      link.href = url;
      link.setAttribute('download', 'pdf1.pdf');
      document.body.appendChild(link);
      link.click();
    })
  }
</code>```

here are the result of console.log(res.data)

cant view the downloaded pdf

this is how i generate the pdf on nodejs, I use pdf-lib for modifying the pdf and it works succesfully, the only problem is on downloading,

```<code>const PdfGeneration = async data => {
  const pdfLocation =
    'UserAccount.pdf';
  const pdfDoc = await PDFDocument.load(
    readFileSync(
      './UserAccount.pdf',
    ),
  );
  const form = pdfDoc.getForm();
  const applicationFor = form
    .getTextField('username')
    .setText('Mario');
  const pdfBytes = await pdfDoc.save();
  fs.writeFileSync(pdfLocation, Buffer.from(pdfBytes));
  return pdfBytes;
};
</code>```

//

```<code>  generateUser: async (req, res) => {
    try {
      const result = await PdfGeneration();
      const data = {
        msg: 'successful',
        code: 1,
        data: result,
      };
      res.json(data.data);
    } catch (err) {
      console.log(err);
      const safeErr = ErrorManager.getSafeError(err);
      const data = {
        msg: 'unsuccessful',
        code: 1,
        data: safeErr,
      };
      res.status(400).json(data);
    }
  },
</code>```

Title: React download pdf and view

Body:
How to view pdf downloaded? There is no problem on downloading pdf, the problem is the viewing, cant view the downloaded pdf, why is that?

I have this code

  static getAttachement(item) {
    return axios.get(this.contextUrl + '/test', {responseType: 'blob'})
      .then(response => {
        return response.data;
      })
      .catch(error => {
        throw error;
      });
  }

and this

  const handlePrint = async () => {
    await UserApi.getAttachement().then((res)=>{
      console.log(res.data)
      const url = window.URL.createObjectURL(new Blob([new Uint8Array(res.data)]));
      const link = document.createElement('a');
      link.href = url;
      link.setAttribute('download', 'pdf1.pdf');
      document.body.appendChild(link);
      link.click();
    })
  }

here are the result of console.log(res.data)

cant view the downloaded pdf

this is how i generate the pdf on nodejs, I use pdf-lib for modifying the pdf and it works succesfully, the only problem is on downloading,

const PdfGeneration = async data => {
  const pdfLocation =
    'UserAccount.pdf';
  const pdfDoc = await PDFDocument.load(
    readFileSync(
      './UserAccount.pdf',
    ),
  );
  const form = pdfDoc.getForm();
  const applicationFor = form
    .getTextField('username')
    .setText('Mario');
  const pdfBytes = await pdfDoc.save();
  fs.writeFileSync(pdfLocation, Buffer.from(pdfBytes));
  return pdfBytes;
};

//

  generateUser: async (req, res) => {
    try {
      const result = await PdfGeneration();
      const data = {
        msg: 'successful',
        code: 1,
        data: result,
      };
      res.json(data.data);
    } catch (err) {
      console.log(err);
      const safeErr = ErrorManager.getSafeError(err);
      const data = {
        msg: 'unsuccessful',
        code: 1,
        data: safeErr,
      };
      res.status(400).json(data);
    }
  },


问:
How to render class selector stored as a string in Angular?
Component.ts file with selector stored as a string in testWidget variable

```<code>   import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: ['./dashboard.component.scss'],
})
export class DashboardComponent implements OnInit {

    constructor() { }
    dashboard: any;
    ngOnInit(): void {}

    // variable with a child component selector stored as a string
    testWidget = `<app-dashboard></app-dashboard>`;
}

</code>```

In html file this should render the component.

```<code>  <testWidget></testWidget>

</code>```

Any other approach that dynamically renders the component will also work as selector names will come from the database

Body:
Component.ts file with selector stored as a string in testWidget variable

   import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: ['./dashboard.component.scss'],
})
export class DashboardComponent implements OnInit {

    constructor() { }
    dashboard: any;
    ngOnInit(): void {}

    // variable with a child component selector stored as a string
    testWidget = `<app-dashboard></app-dashboard>`;
}

In html file this should render the component.

  <testWidget></testWidget>

Any other approach that dynamically renders the component will also work as selector names will come from the database


问:
PyInstaller --onefile not including secondary file
I have two python files and a favicon.ico file all within the same directory.

The second python file only has a single import (from tkinter import *) and a bunch of helper methods. This file is called tk.py.

From my main python file, I import that second file (from tk import create_window, create_xxxx, and_so_on) as well as a bunch of other libraries I need (cv2, pystray, apscheduler, etc.)

I have confirmed that all of this works when I run python mainfile.py however pyinstaller doesn't want to work. I've read a lot of different posts of people having the same/similar issues with answers that basically say to use --onefile but that doesn't work for me for whatever reason.

The command I'm running is:

```<code>pyinstaller.exe --onefile --icon=favicon.ico mainfile.py
</code>```

I'd normally have -w as well but I've excluded it so I can see the error in console.

Anyhow, when running that executable (in console as normally the console window would immediately close), I get the following error:

```<code>$ ./mainfile.exe
[28968] Failed to execute script mainfile
Traceback (most recent call last):
  File "mainfile.py", line 3, in <module>
ImportError: cannot import name 'create_window' from 'tk' (unknown location)
</code>```

I am using Python 3.10.1 and PyInstaller 3.5. I'd appreciate any help here.

Body:
I have two python files and a favicon.ico file all within the same directory.

The second python file only has a single import (from tkinter import *) and a bunch of helper methods. This file is called tk.py.

From my main python file, I import that second file (from tk import create_window, create_xxxx, and_so_on) as well as a bunch of other libraries I need (cv2, pystray, apscheduler, etc.)

I have confirmed that all of this works when I run python mainfile.py however pyinstaller doesn't want to work. I've read a lot of different posts of people having the same/similar issues with answers that basically say to use --onefile but that doesn't work for me for whatever reason.

The command I'm running is:

pyinstaller.exe --onefile --icon=favicon.ico mainfile.py

I'd normally have -w as well but I've excluded it so I can see the error in console.

Anyhow, when running that executable (in console as normally the console window would immediately close), I get the following error:

$ ./mainfile.exe
[28968] Failed to execute script mainfile
Traceback (most recent call last):
  File "mainfile.py", line 3, in <module>
ImportError: cannot import name 'create_window' from 'tk' (unknown location)

I am using Python 3.10.1 and PyInstaller 3.5. I'd appreciate any help here.


问:
How to Self Reference in laravel 9 - eloquent
I want to configure the migration to self referencing in laravel 9.

```<code>Schema::create('shop_categories', function (Blueprint $table) {
    $table->id();
    $table->foreign('parent_id')->references('id')->on('shop_categories')->onDelete('cascade');
    $table->string('name');
    $table->string('slug')->unique();
    $table->longText('description')->nullable();
    $table->unsignedSmallInteger('position')->default(0);
    $table->boolean('is_visible')->default(false);
    $table->string('seo_title', 60)->nullable();
    $table->string('seo_description', 160)->nullable();
    $table->timestamps();
});
</code>```

Error :

```<code>  SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Foreign key 'shop_categories_parent_id_foreign' references invalid column 'parent_id' in referencing table 'shop_categories'. (SQL: alter table "shop_categories" add constraint "shop_categories_parent_id_foreign" foreign key ("parent_id") references "shop_categories" ("id") on delete cascade)
</code>```

How to fix this ??
Thank you.

Body:
I want to configure the migration to self referencing in laravel 9.

Schema::create('shop_categories', function (Blueprint $table) {
    $table->id();
    $table->foreign('parent_id')->references('id')->on('shop_categories')->onDelete('cascade');
    $table->string('name');
    $table->string('slug')->unique();
    $table->longText('description')->nullable();
    $table->unsignedSmallInteger('position')->default(0);
    $table->boolean('is_visible')->default(false);
    $table->string('seo_title', 60)->nullable();
    $table->string('seo_description', 160)->nullable();
    $table->timestamps();
});

Error :

  SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Foreign key 'shop_categories_parent_id_foreign' references invalid column 'parent_id' in referencing table 'shop_categories'. (SQL: alter table "shop_categories" add constraint "shop_categories_parent_id_foreign" foreign key ("parent_id") references "shop_categories" ("id") on delete cascade)

How to fix this ??
Thank you.


问:
How can I insert data to the database?
I want to insert data from website but my website still can't insert to database mysql. whats wrong with my php code?

this is the html file

```<code><form class="sign-in-up-form" action="book.inc.php" method="POST">
                    <p class="section-title">Booking Form</p>
                    <input class="input-field" type="text" id="name" name="UserName" placeholder="Full name" required>

                    <input class="input-field" type="tel" id="contact" name="UserContact" placeholder="Contact Number" required>

                    <input class="input-field" type="email" id="email" name="UserEmail" placeholder="Email" required>

                    <input id="datetime-book" class="input-field book-field" type="datetime-local" id="date" name="aptDateTime" required>

                    <select class="input-field book-field" name="artistName" id="selArtist" required>
                        <option id="select-placeholder" value="">Please choose an artist</option>
                        <option value="Aurelius">Aurelius</option>
                        <option value="Crocks">Crocks</option>
                    </select>

                    <textarea id="textarea-tattoo-idea" name="aptComment" class="input-field" placeholder="Describe your tattoo idea here..."></textarea>

                    <input class="submit-btn" type="submit" name="submit" value="book">
                </form>
</code>```

this is the php file

```<code><?php
session_start();
// connect to database
$con = mysqli_connect("localhost","root","","yellowstudios");

// to collect data
if(isset($_POST['submit'])) {

    $name = $_POST['UserName'];
    $contact = $_POST['UserContact'];
    $email = $_POST['UserEmail'];
    $date = $_POST['aptDateTime'];
    $artist = $_POST['artistName'];
    $text = $_POST['aptText'];
    $stat = $_POST['aptStat'];

    // will insert to DB
    $query = "INSERT INTO UserRecord (UserName, UserContact, UserEmail, aptDateTime, artistName, aptText, aptStat) VALUES ($name, $contact, $email, $date, $artist, $text, $stat)";
    $query_run = mysqli_query($con, $query);

    if($query_run)
    {
        // will execute if booking is successful, and will go to next page
        $_SESSION['status'] = "Appointment inserted successfully!";
        header("Location: book.output.php");
    }
    else
    {
        // will execute if booking is not successful, and will go to next page
        $_SESSION['status'] = "Appointment not inserted!";
        header("Location: book.output.php");
    }
}

</code>```

I looked for typos and everything, but it won't insert data to database. I also double checked everything.

Title: How can I insert data to the database?

Body:
I want to insert data from website but my website still can't insert to database mysql. whats wrong with my php code?

this is the html file

<form class="sign-in-up-form" action="book.inc.php" method="POST">

Booking Form

                    <input class="input-field" type="text" id="name" name="UserName" placeholder="Full name" required>

                    <input class="input-field" type="tel" id="contact" name="UserContact" placeholder="Contact Number" required>

                    <input class="input-field" type="email" id="email" name="UserEmail" placeholder="Email" required>

                    <input id="datetime-book" class="input-field book-field" type="datetime-local" id="date" name="aptDateTime" required>

                    <select class="input-field book-field" name="artistName" id="selArtist" required>
                        <option id="select-placeholder" value="">Please choose an artist</option>
                        <option value="Aurelius">Aurelius</option>
                        <option value="Crocks">Crocks</option>
                    </select>

                    <textarea id="textarea-tattoo-idea" name="aptComment" class="input-field" placeholder="Describe your tattoo idea here..."></textarea>

                    <input class="submit-btn" type="submit" name="submit" value="book">
                </form>

this is the php file

<?php
session_start();
// connect to database
$con = mysqli_connect("localhost","root","","yellowstudios");

// to collect data
if(isset($_POST['submit'])) {

    $name = $_POST['UserName'];
    $contact = $_POST['UserContact'];
    $email = $_POST['UserEmail'];
    $date = $_POST['aptDateTime'];
    $artist = $_POST['artistName'];
    $text = $_POST['aptText'];
    $stat = $_POST['aptStat'];

    // will insert to DB
    $query = "INSERT INTO UserRecord (UserName, UserContact, UserEmail, aptDateTime, artistName, aptText, aptStat) VALUES ($name, $contact, $email, $date, $artist, $text, $stat)";
    $query_run = mysqli_query($con, $query);

    if($query_run)
    {
        // will execute if booking is successful, and will go to next page
        $_SESSION['status'] = "Appointment inserted successfully!";
        header("Location: book.output.php");
    }
    else
    {
        // will execute if booking is not successful, and will go to next page
        $_SESSION['status'] = "Appointment not inserted!";
        header("Location: book.output.php");
    }
}

I looked for typos and everything, but it won't insert data to database. I also double checked everything.


问:
Visual Studio 2022 shows error but compiles successfully
I have the following code.

#include <iostream>
#include <unordered_map>

struct Object {
    ~Object() noexcept = default;
    Object() noexcept = default;
    Object(const Object&) = delete;
    Object(Object&&) noexcept = default;
    Object& operator=(const Object&) = delete;
    Object& operator=(Object&&) noexcept = default;

    std::unordered_map<int, int> map{};
};

Object get_object() {
    Object o{};
    o.map[0] = 1;
    return o; // error
}

int main() {
    Object o = get_object();
    std::cout << o.map[0] << '\n';
    return 0;
}
```
<p>The static analysis in Visual Studio 2022 shows the following error.</p>
<pre class="lang-none prettyprint-override"><code>Line 18: function "Object::Object(const Object &)" (declared at line 7) cannot be referenced -- it is a deleted function
</code>```

However, the code compiles just fine and the result is 1 as expected.

What actually happens? Can std::unordered_map be really moved? If this isn't a problem, how can I tell the static analysis that this is a false positive?

Body:
I have the following code.

#include <iostream>
#include <unordered_map>

struct Object {
    ~Object() noexcept = default;
    Object() noexcept = default;
    Object(const Object&) = delete;
    Object(Object&&) noexcept = default;
    Object& operator=(const Object&) = delete;
    Object& operator=(Object&&) noexcept = default;

    std::unordered_map<int, int> map{};
};

Object get_object() {
    Object o{};
    o.map[0] = 1;
    return o; // error
}

int main() {
    Object o = get_object();
    std::cout << o.map[0] << '\n';
    return 0;
}

The static analysis in Visual Studio 2022 shows the following error.

Line 18: function "Object::Object(const Object &)" (declared at line 7) cannot be referenced -- it is a deleted function

However, the code compiles just fine and the result is 1 as expected.

What actually happens? Can std::unordered_map be really moved? If this isn't a problem, how can I tell the static analysis that this is a false positive?


问:
invalid conversion from ‘mpfr_srcptr’ error compiling CGAL program in Debian
I'm trying to compile this CGAL program:

```<code>#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;

typedef K::Point_2 Point_2;
typedef std::vector<Point_2> Points;

int main()
{
    Points points;
    points.push_back(Point_2(0,0));
    points.push_back(Point_2(0,7));
    points.push_back(Point_2(7,0));
    points.push_back(Point_2(7,7));

    Delaunay dt(points.begin(), points.end());

    // Print Cartesian coordinates of vertices of triangles in 2D Delaunay triangulation
    for (Delaunay::Finite_faces_iterator it = dt.finite_faces_begin(); it != dt.finite_faces_end(); it++)
    {
        std::cout << " " << dt.triangle(it)[0].x() << " " << dt.triangle(it)[0].y() << " ";
        std::cout << " " << dt.triangle(it)[1].x() << " " << dt.triangle(it)[1].y() << " ";
        std::cout << " " << dt.triangle(it)[2].x() << " " << dt.triangle(it)[2].y() << " ";
        std::cout << std::endl << "-------------------" << std::endl;
    }
    return 0;
}
</code>```

I'm running Debian Sid and I have installed from the official repositories the packages libcgal-dev 5.5.1-2 and libmpfr-dev 4.1.1-1 plus their dependencies. But I obtain this error at compiling time:

```<code>$ g++ -Wall test_cgal.cc -o test_cgal -lcgal
In file included from /usr/include/CGAL/boost_mp.h:54,
                 from /usr/include/CGAL/Number_types/internal/Exact_type_selector.h:27,
                 from /usr/include/CGAL/Exact_kernel_selector.h:26,
                 from /usr/include/CGAL/Filtered_kernel.h:22,
                 from /usr/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:21,
                 from hola.cc:1:
/usr/include/CGAL/GMP/Gmpfr_type.h: In constructor ‘CGAL::Gmpfr::Gmpfr(mpfr_srcptr)’:
/usr/include/CGAL/GMP/Gmpfr_type.h:199:25: error: invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’} [-fpermissive]
  199 |                         mpfr_custom_get_kind(f),
      |                         ^
      |                         |
      |                         mpfr_srcptr {aka const __mpfr_struct*}
/usr/include/CGAL/GMP/Gmpfr_type.h: In constructor ‘CGAL::Gmpfr::Gmpfr(mpfr_srcptr, std::float_round_style, Precision_type)’:
/usr/include/CGAL/GMP/Gmpfr_type.h:216:33: error: invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’} [-fpermissive]
  216 |                                 mpfr_custom_get_kind(f),
      |                                 ^
      |                                 |
      |                                 mpfr_srcptr {aka const __mpfr_struct*}
/usr/include/CGAL/GMP/Gmpfr_type.h: In constructor ‘CGAL::Gmpfr::Gmpfr(mpfr_srcptr, Precision_type)’:
/usr/include/CGAL/GMP/Gmpfr_type.h:237:33: error: invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’} [-fpermissive]
  237 |                                 mpfr_custom_get_kind(f),
      |                                 ^
      |                                 |
      |                                 mpfr_srcptr {aka const __mpfr_struct*}
</code>```

Why the error invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’}? The MPFR version is the same from Debian stable to Debian Sid

Body:
I'm trying to compile this CGAL program:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;

typedef K::Point_2 Point_2;
typedef std::vector<Point_2> Points;

int main()
{
    Points points;
    points.push_back(Point_2(0,0));
    points.push_back(Point_2(0,7));
    points.push_back(Point_2(7,0));
    points.push_back(Point_2(7,7));

    Delaunay dt(points.begin(), points.end());

    // Print Cartesian coordinates of vertices of triangles in 2D Delaunay triangulation
    for (Delaunay::Finite_faces_iterator it = dt.finite_faces_begin(); it != dt.finite_faces_end(); it++)
    {
        std::cout << " " << dt.triangle(it)[0].x() << " " << dt.triangle(it)[0].y() << " ";
        std::cout << " " << dt.triangle(it)[1].x() << " " << dt.triangle(it)[1].y() << " ";
        std::cout << " " << dt.triangle(it)[2].x() << " " << dt.triangle(it)[2].y() << " ";
        std::cout << std::endl << "-------------------" << std::endl;
    }
    return 0;
}

I'm running Debian Sid and I have installed from the official repositories the packages libcgal-dev 5.5.1-2 and libmpfr-dev 4.1.1-1 plus their dependencies. But I obtain this error at compiling time:

$ g++ -Wall test_cgal.cc -o test_cgal -lcgal
In file included from /usr/include/CGAL/boost_mp.h:54,
                 from /usr/include/CGAL/Number_types/internal/Exact_type_selector.h:27,
                 from /usr/include/CGAL/Exact_kernel_selector.h:26,
                 from /usr/include/CGAL/Filtered_kernel.h:22,
                 from /usr/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:21,
                 from hola.cc:1:
/usr/include/CGAL/GMP/Gmpfr_type.h: In constructor ‘CGAL::Gmpfr::Gmpfr(mpfr_srcptr)’:
/usr/include/CGAL/GMP/Gmpfr_type.h:199:25: error: invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’} [-fpermissive]
  199 |                         mpfr_custom_get_kind(f),
      |                         ^
      |                         |
      |                         mpfr_srcptr {aka const __mpfr_struct*}
/usr/include/CGAL/GMP/Gmpfr_type.h: In constructor ‘CGAL::Gmpfr::Gmpfr(mpfr_srcptr, std::float_round_style, Precision_type)’:
/usr/include/CGAL/GMP/Gmpfr_type.h:216:33: error: invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’} [-fpermissive]
  216 |                                 mpfr_custom_get_kind(f),
      |                                 ^
      |                                 |
      |                                 mpfr_srcptr {aka const __mpfr_struct*}
/usr/include/CGAL/GMP/Gmpfr_type.h: In constructor ‘CGAL::Gmpfr::Gmpfr(mpfr_srcptr, Precision_type)’:
/usr/include/CGAL/GMP/Gmpfr_type.h:237:33: error: invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’} [-fpermissive]
  237 |                                 mpfr_custom_get_kind(f),
      |                                 ^
      |                                 |
      |                                 mpfr_srcptr {aka const __mpfr_struct*}

Why the error invalid conversion from ‘mpfr_srcptr’ {aka ‘const __mpfr_struct*’} to ‘mpfr_ptr’ {aka ‘__mpfr_struct*’}? The MPFR version is the same from Debian stable to Debian Sid


问:
Javascript document.querySelectorAll get tags with specific class but without a specific attribute
How can have a list of tags with a specific class but without a specific attribute?

var sentenceTrans = document.querySelectorAll('.trans-lang:not[data-translation="translated"]');
// but this doesn't work
```


问:
Fullpage horizontal AND vertical scroller
I am looking for some Javascript/jQuery/WordPress plugin with which to create a full screen bidirectional slideshow (fullscreen scroll slider).

Similar to fullpage.js but the main slider is horizontal and some slides contain vertical sliders.

There needs to be an up/down/right/left controller to be able to move to a next or previous slide both vertically and horizontally at any time using these controls or the keyboard.

Any ideas?

Thanks.

I have searched and tried different solutions (fullpage.js, Swiper slider, Slick slider) without success.


问:
Show a shipping method only for a specific category and hide with mixed category in WooCommerce
I am trying to show a shipping method only for the specific product category. I want it should be hidden for the mixed category or not found on the cart items/ package.

So I try the bellow code but it only work for found or not found / not work for the mixed categories.

```<code>add_filter( 'woocommerce_package_rates', 'vpm_specific_products_shipping_methods', 10, 2 );
function vpm_specific_products_shipping_methods( $rates, $package ) {
    // HERE set the product category in the array (ID, slug, or name)
    $terms = array( 'express-shipping' ); //4918
    $taxonomy = 'product_cat';

    // HERE set the shipping methods to be removed (like "fat_rate:5")
    $method_instances_ids = array('flat_rate:20');

    $found = false;

    // Loop through cart items checking for defined product IDs
    foreach( $package['contents'] as $cart_item ) {
        if ( has_term( $terms, $taxonomy, $cart_item['product_id'] ) ){
            $found = true;
           // break;
        }else{
            $found = false;
        }
    }

    if (  $found ) {
        return $rates;
    }else{// If not found we remove and exit exit
        unset( $rates['flat_rate:20'] );
        return $rates;
    }

}
</code>```

Body:
I am trying to show a shipping method only for the specific product category. I want it should be hidden for the mixed category or not found on the cart items/ package.

So I try the bellow code but it only work for found or not found / not work for the mixed categories.

add_filter( 'woocommerce_package_rates', 'vpm_specific_products_shipping_methods', 10, 2 );
function vpm_specific_products_shipping_methods( $rates, $package ) {
    // HERE set the product category in the array (ID, slug, or name)
    $terms = array( 'express-shipping' ); //4918
    $taxonomy = 'product_cat';

    // HERE set the shipping methods to be removed (like "fat_rate:5")
    $method_instances_ids = array('flat_rate:20');

    $found = false;

    // Loop through cart items checking for defined product IDs
    foreach( $package['contents'] as $cart_item ) {
        if ( has_term( $terms, $taxonomy, $cart_item['product_id'] ) ){
            $found = true;
           // break;
        }else{
            $found = false;
        }
    }

    if (  $found ) {
        return $rates;
    }else{// If not found we remove and exit exit
        unset( $rates['flat_rate:20'] );
        return $rates;
    }

}


问:
Python Kafka Consumer in docker container localhost
I try to consume some messages created with a spring-boot kafka producer on localhost.

For the consumer I have the following python code (consumer.py):

```<code>from kafka import KafkaConsumer

# To consume latest messages and auto-commit offsets
print("consume...")
consumer = KafkaConsumer('upload_media',
                         group_id='groupId',
                         bootstrap_servers=['host.docker.internal:9092'])
for message in consumer:
    # message value and key are raw bytes -- decode if necessary!
    # e.g., for unicode: `message.value.decode('utf-8')`
    print("message")
    print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition,
                                          message.offset, message.key,
                                          message.value))
</code>```

And I have the dockerfile:

```<code># Set python version
FROM python:3.6-stretch

# Make a directory for app
WORKDIR /consumer

# Install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
# RUN pip install --no-cache-dir --user -r /req.txt

# Copy source code
COPY ./app/consumer.py .

# Run the application
#CMD ["python", "-m", "app"]
ENTRYPOINT [ "python3", "-u", "consumer.py" ]
CMD [ "" ]
</code>```

When I build and run it, i get:

```<code>$ docker run --expose=9092 consumer
consume...
</code>```

But it never gets some messages.
When I start the script just with python consumer.py it works fine.
So something seems to be wrong with the docker image?

Edit:
I started the ZooKeeper and a broker locally as it is described here:
https://kafka.apache.org/quickstart

Edit 2:
I don't know why the question is a duplicate. I don't use ksqlDB, don't use docker compose. I am not on a VM and I do not get any error.

Body:
I try to consume some messages created with a spring-boot kafka producer on localhost.

For the consumer I have the following python code (consumer.py):

from kafka import KafkaConsumer

# To consume latest messages and auto-commit offsets
print("consume...")
consumer = KafkaConsumer('upload_media',
                         group_id='groupId',
                         bootstrap_servers=['host.docker.internal:9092'])
for message in consumer:
    # message value and key are raw bytes -- decode if necessary!
    # e.g., for unicode: `message.value.decode('utf-8')`
    print("message")
    print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition,
                                          message.offset, message.key,
                                          message.value))

And I have the dockerfile:

# Set python version
FROM python:3.6-stretch

# Make a directory for app
WORKDIR /consumer

# Install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
# RUN pip install --no-cache-dir --user -r /req.txt

# Copy source code
COPY ./app/consumer.py .

# Run the application
#CMD ["python", "-m", "app"]
ENTRYPOINT [ "python3", "-u", "consumer.py" ]
CMD [ "" ]

When I build and run it, i get:

$ docker run --expose=9092 consumer
consume...

But it never gets some messages.
When I start the script just with python consumer.py it works fine.
So something seems to be wrong with the docker image?

Edit:
I started the ZooKeeper and a broker locally as it is described here:
https://kafka.apache.org/quickstart

Edit 2:
I don't know why the question is a duplicate. I don't use ksqlDB, don't use docker compose. I am not on a VM and I do not get any error.


问:
Rendering PlantUML from Azure DevOps Repo in Confluence
For a project I'm working on I'd like to adopt the C4 diagramming language to illustrate technical designs. In order to manage changes to the designs I'd like to use PlantUML so that I can express the diagrams as text which can be tracked in a Git repo (Azure DevOps).

The diagrams will appear in a Confluence wiki, but I don't want to manually render and upload the diagrams to Confluence because they will quickly become out of date. My research suggests that the best way around this is to use a PlantUML proxy server which you make a call to, providing the link to the PlantUML (.puml) file in Git as a parameter.

It's easy enough to spin up the PlantUML server in Azure as a docker container, but it seems pretty complicated to manage the authentication between it, Confluence, and the git repo. I've seen that there is also a Confluence plugin available but I wanted to check with the community whether this is the easiest solution or whether there's anything else that I haven't considered?


Title: how to extract a date from text abstracted of a web page using Microsoft power automate?

Body:
I have this data extracted from a particular web page

Document Name
*Created Date/Uploaded Date
201647034526-RELEVANT DOCUMENTS [27-09-2022(online)].pdf
27/09/2022
201647034526-US(14)-HearingNotice-(HearingDate-14-12-2020).pdf
17/10/2021
201647034526-IntimationOfGrant31-12-2020.pdf
31/12/2020
201647034526-PatentCertificate31-12-2020.pdf
31/12/2020
201647034526-Written submissions and relevant documents [29-12-2020(online)].pdf
29/12/2020
201647034526-Correspondence to notify the Controller [11-12-2020(online)].pdf
11/12/2020
201647034526-FORM-26 [11-12-2020(online)].pdf
11/12/2020
201647034526-FORM 3 [05-12-2020(online)].pdf
05/12/2020
201647034526-Annexure [09-09-2019(online)].pdf
09/09/2019
201647034526-CLAIMS [09-09-2019(online)].pdf
09/09/2019
201647034526-COMPLETE SPECIFICATION [09-09-2019(online)].pdf
09/09/2019
201647034526-FER_SER_REPLY [09-09-2019(online)].pdf
09/09/2019
201647034526-OTHERS [09-09-2019(online)].pdf
09/09/2019
201647034526-FORM 3 [11-06-2019(online)].pdf
11/06/2019
201647034526-FER.pdf
23/05/2019
201647034526-AMENDED DOCUMENTS [04-01-2019(online)].pdf
04/01/2019
201647034526-FORM 13 [04-01-2019(online)].pdf
04/01/2019
201647034526-RELEVANT DOCUMENTS [04-01-2019(online)].pdf
04/01/2019
201647034526-FORM 18 [27-03-2018(online)].pdf
27/03/2018
Form 3 [03-03-2017(online)].pdf
03/03/2017
Correspondence by Agent_Form30_04-01-2017.pdf
04/01/2017
Other Patent Document [29-12-2016(online)].pdf
29/12/2016
201647034526.pdf
14/10/2016
Description(Complete) [12-10-2016(online)].pdf
12/10/2016
Form 13 [12-10-2016(online)].pdf
12/10/2016
Marked Copy [12-10-2016(online)].pdf
12/10/2016
201647034526 Abstract 07-10-2016.pdf
07/10/2016
201647034526 Claims 07-10-2016.pdf
07/10/2016
201647034526 Description Complete 07-10-2016.pdf
07/10/2016
- **201647034526 Form-13 07-10-2016.pdf**
07/10/2016
201647034526 Form-2 07-10-2016.pdf
07/10/2016
Description(Complete) [07-10-2016(online)].pdf
07/10/2016
Form 3 [07-10-2016(online)].pdf
07/10/2016
Form 5 [07-10-2016(online)].pdf
07/10/2016
Power of Attorney [07-10-2016(online)].pdf
07/10/2016
Note: The displayed "Created Date/Uploaded Date" is dynamic in nature and depends upon the operating system environment of storage. For more information, please contact the Patent office of the respective jurisdiction

I want the above highlighted text as the output.

How do I do this in power automate?

Can someone help me how to deal with this?

I explored split() method in power automate and it wasn't working.
Even tried to paste it in an excel column and still wasn't working.

I'm referring to power automate desktop.


问:
Can I return 402 in my GitHub App as response to an unhandled event?
Can I return 402 (No-Content) in my GitHub App as response to an unhandled event?

If not, and I get an event I intentionally don't handle, what response code should I return?


问:
how to post a file in goggle drive using groovy script in SAP CPI
Show how to post file in goggle drive using groovy script in SAP CPI

i have being trying with  code but its not working , can you suggest any code


问:
Custom hook throw error from external package in React
I have a custom hook:

```<code>const useMyHook = () => {
  const [state, setState] = useState();
  ...
  return state;
};
</code>```

When I use this hook within the same project it's working fine:

```<code>const MyComp = () => {
  const state = useMyHook();
  ...
  return <ChildComp {...state} />
}
</code>```

But when I export this hook from an external package (that I created):

```<code>import {useMyHook} from 'my-package';

const MyComp = () => {
  const state = useMyHook();
  ...
  return <ChildComp {...state} />
}
</code>```

I get TypeError: null is not an object (evaluating 'dispatcher.useState') with the following general error:

```<code>Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
</code>```

I want to assume that the problem is not the custom hook since it's working initially. I tought maybe it has to do something with versioning so in the external package I define the package.json with:

```<code>"peerDependencies": {
  "react": "18.1.0"
},
</code>```

Same version as the react dependency in my original project in order to resolve react duplication as the error says.

Nothing of the solutions in the web works for me. Any idea what can cause this behavior?

FYI: I'm using react-native (with Expo).

Body:
I have a custom hook:

const useMyHook = () => {
  const [state, setState] = useState();
  ...
  return state;
};

When I use this hook within the same project it's working fine:

const MyComp = () => {
  const state = useMyHook();
  ...
  return <ChildComp {...state} />
}

But when I export this hook from an external package (that I created):

import {useMyHook} from 'my-package';

const MyComp = () => {
  const state = useMyHook();
  ...
  return <ChildComp {...state} />
}

I get TypeError: null is not an object (evaluating 'dispatcher.useState') with the following general error:

Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app

I want to assume that the problem is not the custom hook since it's working initially. I tought maybe it has to do something with versioning so in the external package I define the package.json with:

"peerDependencies": {
  "react": "18.1.0"
},

Same version as the react dependency in my original project in order to resolve react duplication as the error says.

Nothing of the solutions in the web works for me. Any idea what can cause this behavior?

FYI: I'm using react-native (with Expo).


问:
How to solve the issue of foliages being crazy in unreal engine after migrating the 5.0 project to 5.1 and enabled Nanite
How to solve the issue of foliages being crazy after migrating the 5.0 project to 5.1 and enabling Nanite.

Here’s a video: https://drive.google.com/file/d/1mDy9Yk4W5vJEF3JuIwNYkw0zuhK3GpXi/view?usp=sharing


问:
Use a variable name as part of another variable name
I tray to print all student names from a class with a loop and use the incremental (i) as part of the name.

I have a class with students and want to print the contents of all via a loop.
Individual printing works.
Another way of posing the question is how to convert a string into a variable name.

Here is an example:

```<code>class Student:
    pass

std1 = Student()
std2 = Student()
std3 = Student()

# student information
std1.voorn = "Boris"
std2.voorn = "Joris"
std3.voorn = "Sophie"

# printing one by one is ok for a limited number but not for large number of students
print(f"{std1.voorn}")
print(f"{std2.voorn}")
print(f"{std3.voorn}")

# I try to inject the i into the name, of course this doesn't work.
# But how to convert this to the variable naam?
for i in range(1,4):
    print(f"std{i}voorn")
</code>```

Body:
I tray to print all student names from a class with a loop and use the incremental (i) as part of the name.

I have a class with students and want to print the contents of all via a loop.
Individual printing works.
Another way of posing the question is how to convert a string into a variable name.

Here is an example:

class Student:
    pass

std1 = Student()
std2 = Student()
std3 = Student()

# student information
std1.voorn = "Boris"
std2.voorn = "Joris"
std3.voorn = "Sophie"

# printing one by one is ok for a limited number but not for large number of students
print(f"{std1.voorn}")
print(f"{std2.voorn}")
print(f"{std3.voorn}")

# I try to inject the i into the name, of course this doesn't work.
# But how to convert this to the variable naam?
for i in range(1,4):
    print(f"std{i}voorn")


问:
Amazon SQS sendMessageBatch() response and retries
I wanted to clear something up. So this function returns a response for successful and failed batch entries. For failed batch entries if I set the maximum recieves for a message attribute for the dead letter queue to 3 found here Amazon SQS how to control the number of retries are the batches retried immediately before the response or are they retried asynchronously.

```<code>public SendMessageBatchResponse sendBatch(List<SendMessageBatchRequestEntry> entryList){
       return this.sqsClient.sendMessageBatch(SendMessageBatchRequest.builder().queueUrl(this.queueUrl).entries(entryList).build());}
</code>```

It's not clear from the aws docs what is the case.

Body:
I wanted to clear something up. So this function returns a response for successful and failed batch entries. For failed batch entries if I set the maximum recieves for a message attribute for the dead letter queue to 3 found here Amazon SQS how to control the number of retries are the batches retried immediately before the response or are they retried asynchronously.

public SendMessageBatchResponse sendBatch(List<SendMessageBatchRequestEntry> entryList){
       return this.sqsClient.sendMessageBatch(SendMessageBatchRequest.builder().queueUrl(this.queueUrl).entries(entryList).build());}

It's not clear from the aws docs what is the case.


问:
Forcing Gitlab CI pipeline status
I have the following Gitlab CI pipeline :
--- job 1 ---- job 2 ---- job 3

I implemented a workflow where even if job 1 fails, job 2 runs and if it succeeds job 3 also runs.
Problem is, the pipeline shows up as failed because job 1 failed ( even though job 2 and 3 succeeded ). I can't allow the failure of job 1.

Is there anyway I can instruct the pipeline to have the same status as a specific job or force its success even though only one job failed ?

Title: Forcing Gitlab CI pipeline status


问:
I want to change jquery-ui sortable code into sortableJS with stimulus how can I do it
all_request.js.erb

$(function () {
  $( ".kanban-card, .sub-card, .kanban-card .sub-tickets" ).sortable({
    connectWith: ".kanban-card",
    cancel: ".main_ticket",

    start: function (event, ui) {

    },

    change: function (event, ui) {

    },

    out: function (event, ui) {

    },

    over: function (event, ui) {

    },

    receive: function (event, ui) {
     }
    });
});
```
<p><strong>all_request.html.erb</strong></p>
<pre class="lang-rb prettyprint-override"><code><div class="d-flex justify-content-around">
    <% @kanban_columns.each do |col| %>
      <div class="box border" data-item="<%=col.id %>">
        <h3 class="text-center"><%=col.name.humanize%></h3>
        <hr>
        <div class="kanban-card" style="height: 770px; overflow: auto;">
          <% col.client_requests.each do |interview| %>
            <div class="border bg-warning bg-opacity-50 m-2">
              <div class="main_ticket card m-2 border border-danger" >
                <div class="card-body">
                  <p class="card-text mb-0">#<%= interview.id %></p>
                  <h5 class="card-title"><%= interview.customer_name %></h5>
                </div>
              </div>
              <div class="sub-tickets collapse" id="Req<%= interview.id %>">
                <% interview.departments.each do |dept| %>
                  <% if interview.kanban_column.name == 'new_request' %>
                    <div class="card m-2  border border-dark" >
                      <div class="card-body">
                        <p class="mb-0">dept. <%=dept.name%></p>
                        <p class="mb-0">no of resources: <%=dept.no_of_resources%></p>
                      </div>
                    </div>
                  <% end %>
                  <% dept.developers.each do |dev| %>
                    <% if col.name == dev.developer_status %>
                      <div class="sub-card">
                        <div class="card m-2  border border-dark"  data-item="<%=dev.id %>">
                          <p class="mb-0">dept. <%=dept.name%></p>
                          <p class="mb-0">developer. <%=dev.name%></p>
                        </div>
                      </div>
                    <% end %>
                  <% end %>
                <%end%>
              </div>
            </div>
          <%end%>
          <!--if developers exist and main ticket is in new request-->
          <% @client_requests.each do |interview| %>
            <% @card_id = interview.customer_name+"_#{interview.id}"+"_#{col.id}" %>
            <% @card_class = interview.customer_name+"_#{interview.id}" %>
            <div class="border bg-warning bg-opacity-50 m-2 card-header main-card-div" >
              #id : <%=interview.id%>
              <%=interview.customer_name%>
              <% interview.departments.each do |dept| %>
                <% dept.developers.each do |dev| %>
                  <% if col.name == dev.developer_status %>
                    <div class="m-2 sub-card" id="<%= @card_id %>">
                      <div class="card m-2" data-item="<%= dev.id %>">
                        <div class="card-body">
                          #id : <%=dev.id%>
                          <p class="mb-0">dept. <%=dept.name%></p>
                          <p class="mb-0">developer. <%=dev.name%></p>
                        </div>
                      </div>
                    </div>
                  <% end %>
                <%end%>
              <%end %>
            </div>
          <%end%>
          <!-- -->
        </div>
      </div>
    <% end %>
  </div>
</code>```

In above code div with class-name kanban-card, sub-tickets, .sub-cards are sortable so I just want same class will be sortable using sortableJs.

You can see the demo here: https://drive.google.com/file/d/15E9gT0F91mUES8gfLm1tYxUqvDGrUAjM/view?usp=sharing

resources:

sortableJs: https://github.com/SortableJS/Sortable

Body:
all_request.js.erb

$(function () {
  $( ".kanban-card, .sub-card, .kanban-card .sub-tickets" ).sortable({
    connectWith: ".kanban-card",
    cancel: ".main_ticket",

    start: function (event, ui) {

    },

    change: function (event, ui) {

    },

    out: function (event, ui) {

    },

    over: function (event, ui) {

    },

    receive: function (event, ui) {
     }
    });
});

all_request.html.erb

    <% @kanban_columns.each do |col| %>
      <div class="box border" data-item="<%=col.id %>">

<%=col.name.humanize%>

          <% col.client_requests.each do |interview| %>

#<%= interview.id %>

<%= interview.customer_name %>

              <div class="sub-tickets collapse" id="Req<%= interview.id %>">
                <% interview.departments.each do |dept| %>
                  <% if interview.kanban_column.name == 'new_request' %>

dept. <%=dept.name%>

no of resources: <%=dept.no_of_resources%>

                  <% end %>
                  <% dept.developers.each do |dev| %>
                    <% if col.name == dev.developer_status %>

                        <div class="card m-2  border border-dark"  data-item="<%=dev.id %>">

dept. <%=dept.name%>

developer. <%=dev.name%>

                    <% end %>
                  <% end %>
                <%end%>

          <%end%>

          <% @client_requests.each do |interview| %>
            <% @card_id = interview.customer_name+"_#{interview.id}"+"_#{col.id}" %>
            <% @card_class = interview.customer_name+"_#{interview.id}" %>

              #id : <%=interview.id%>
              <%=interview.customer_name%>
              <% interview.departments.each do |dept| %>
                <% dept.developers.each do |dev| %>
                  <% if col.name == dev.developer_status %>
                    <div class="m-2 sub-card" id="<%= @card_id %>">
                      <div class="card m-2" data-item="<%= dev.id %>">

                          #id : <%=dev.id%>

dept. <%=dept.name%>

developer. <%=dev.name%>

                  <% end %>
                <%end%>
              <%end %>

          <%end%>

    <% end %>

In above code div with class-name kanban-card, sub-tickets, .sub-cards are sortable so I just want same class will be sortable using sortableJs.

You can see the demo here: https://drive.google.com/file/d/15E9gT0F91mUES8gfLm1tYxUqvDGrUAjM/view?usp=sharing

resources:

sortableJs: https://github.com/SortableJS/Sortable