问:
Synchronize parent and forked process using POSIX named semaphores to print in text file
I want to print numbers from 1 to 99 in a text file where:

parent process prints odd numbers.

child process prints even numbers.
Here is what I've tried:

```<code>#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>
#include<semaphore.h>
#include<sys/types.h>
#include<fcntl.h>
FILE * ptr;     //file pointer

sem_t *sem_even,*sem_odd; //semaphores

void fileWR();

int main(void){

sem_even=sem_open("/S_even",O_CREAT,0644,0); //initiliaze sem _even to 0
sem_odd=sem_open("/S_odd",O_CREAT,0644,1); //initialize se_odd to 1

fileWR();
return 0;
        }

</code>```

fileWR function:

```<code>

void fileWR(){

    ptr=fopen("./TpSemaphore.txt","w+"); //open file in read write mode

    if(ptr==NULL){
        fprintf(stderr,"ERROR!");
        exit(-1);
            }
    if(fork()!=0){
        //Parent processs
        puts("#### Parent #################");
        int i=1;

        while(i<100){

        if(i%2==0) {  //Critical section

            sem_wait(sem_odd);
            //print in file
            fprintf(ptr,"%d ",i);
            //visualize which value is being printed
            printf("%d ",i);

            sem_post(sem_even);
                    }
            i++;

        }
        sem_unlink("S_odd"); //unlink semphore
        sem_close(sem_odd); //close semaphore
        fclose(ptr);    //close file
        exit(0);
    }
    else{
        //Child process

        puts("#### Child #################");
        int j=1;
        while(j<100){

        if(j%2!=0) {
            sem_wait(sem_even);
            //print in file
            fprintf(ptr,"%d ",j);

            printf("%d ",j);

            sem_post(sem_odd);
                        }
            j++;
        }

        sem_unlink("S_even");
        sem_close(sem_even);
        fclose(ptr);
        exit(0);
    }

}
</code>```

Output expected
1 2 3 4 5 6 7 8 9 10 .... etc

But all what i get is undefined behavior

What i'm missing ?
do i need to use shared memory ? Please, what's the right way to implement posix semaphores in IPC.

Body:
I want to print numbers from 1 to 99 in a text file where:

parent process prints odd numbers.

child process prints even numbers.
Here is what I've tried:

#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>
#include<semaphore.h>
#include<sys/types.h>
#include<fcntl.h>
FILE * ptr;     //file pointer

sem_t *sem_even,*sem_odd; //semaphores

void fileWR();

int main(void){

sem_even=sem_open("/S_even",O_CREAT,0644,0); //initiliaze sem _even to 0
sem_odd=sem_open("/S_odd",O_CREAT,0644,1); //initialize se_odd to 1

fileWR();
return 0;
        }

fileWR function:

void fileWR(){

    ptr=fopen("./TpSemaphore.txt","w+"); //open file in read write mode

    if(ptr==NULL){
        fprintf(stderr,"ERROR!");
        exit(-1);
            }
    if(fork()!=0){
        //Parent processs
        puts("#### Parent #################");
        int i=1;

        while(i<100){

        if(i%2==0) {  //Critical section

            sem_wait(sem_odd);
            //print in file
            fprintf(ptr,"%d ",i);
            //visualize which value is being printed
            printf("%d ",i);

            sem_post(sem_even);
                    }
            i++;

        }
        sem_unlink("S_odd"); //unlink semphore
        sem_close(sem_odd); //close semaphore
        fclose(ptr);    //close file
        exit(0);
    }
    else{
        //Child process

        puts("#### Child #################");
        int j=1;
        while(j<100){

        if(j%2!=0) {
            sem_wait(sem_even);
            //print in file
            fprintf(ptr,"%d ",j);

            printf("%d ",j);

            sem_post(sem_odd);
                        }
            j++;
        }

        sem_unlink("S_even");
        sem_close(sem_even);
        fclose(ptr);
        exit(0);
    }

}

Output expected
1 2 3 4 5 6 7 8 9 10 .... etc

But all what i get is undefined behavior

What i'm missing ?
do i need to use shared memory ? Please, what's the right way to implement posix semaphores in IPC.


来源: stackexchange

问:
inline definition/declaration in C
The C Standard has an example from 6.7.4 section:

inline double fahr(double t)
{
    return (9.0 * t) / 5.0 + 32.0;
}
inline double cels(double t)
{
    return (5.0 * (t - 32.0)) / 9.0;
}
extern double fahr(double); // creates an external definition
double convert(int is_fahr, double temp)
{
    /* A translator may perform inline substitution */
    return is_fahr ? cels(temp) : fahr(temp);
}
```
<p>And next it says:</p>
<blockquote>
<p>Because cels has external linkage and is referenced, an external definition has to appear in another translation unit.</p>
</blockquote>
<p>What does exactly mean <em>in another translation unit</em>?</p>
<p>I tried such an example:</p>
<pre class="lang-c prettyprint-override"><code>inline int foo() {
  return 0;
}

int main(void) {
  return foo();
}

</code>```

As the Standard says foo should have external definition in another TU, but what does this mean? Why I'm getting the following error:

```<code>$ gcc main.c
/usr/bin/ld: /tmp/ccsaje5J.o: in function `main':
main.c:(.text+0xa): undefined reference to `foo'
collect2: error: ld returned 1 exit status
</code>```

When I add the external definition at the top of the source file (but this is the same TU):

int foo();

inline int foo() {
  return 0;
}

int main(void) {
  return foo();
}
```

The error goes away. Why is it so, and is it necessary to have an external declaration in the same file?

ContentLicense: CC BY-SA 4.0

Title: inline definition/declaration in C

Body:
The C Standard has an example from 6.7.4 section:

inline double fahr(double t)
{
    return (9.0 * t) / 5.0 + 32.0;
}
inline double cels(double t)
{
    return (5.0 * (t - 32.0)) / 9.0;
}
extern double fahr(double); // creates an external definition
double convert(int is_fahr, double temp)
{
    /* A translator may perform inline substitution */
    return is_fahr ? cels(temp) : fahr(temp);
}

And next it says:

Because cels has external linkage and is referenced, an external definition has to appear in another translation unit.

What does exactly mean in another translation unit?

I tried such an example:

inline int foo() {
  return 0;
}

int main(void) {
  return foo();
}

As the Standard says foo should have external definition in another TU, but what does this mean? Why I'm getting the following error:

$ gcc main.c
/usr/bin/ld: /tmp/ccsaje5J.o: in function `main':
main.c:(.text+0xa): undefined reference to `foo'
collect2: error: ld returned 1 exit status

When I add the external definition at the top of the source file (but this is the same TU):

int foo();

inline int foo() {
  return 0;
}

int main(void) {
  return foo();
}

The error goes away. Why is it so, and is it necessary to have an external declaration in the same file?


问:
Why I'm getting a proxy error when running npm install?
I created a npm project on my work machine. This machine has NPM configured with a custom proxy and register.

I cloned this project on a different machine, and when I ran npm i, I got the following error:

```<code>npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to <<registry-name>> failed, reason: getaddrinfo ENOTFOUND <<registry-name>>
</code>```

Which is weird, I wouldn't think that my NPM configurations would be tied to the project itself.

Anyhow, I tried removing any proxy/registry related configurations from the second machine:

```<code>> npm config delete registry
> npm config delete proxy
> npm config delete https-proxy
</code>```

Now they are set back to their default values. However, I'm still getting the very same error. How can I fix this?

Body:
I created a npm project on my work machine. This machine has NPM configured with a custom proxy and register.

I cloned this project on a different machine, and when I ran npm i, I got the following error:

npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to <<registry-name>> failed, reason: getaddrinfo ENOTFOUND <<registry-name>>

Which is weird, I wouldn't think that my NPM configurations would be tied to the project itself.

Anyhow, I tried removing any proxy/registry related configurations from the second machine:

> npm config delete registry
> npm config delete proxy
> npm config delete https-proxy

Now they are set back to their default values. However, I'm still getting the very same error. How can I fix this?


问:
Mftraining Warning: no protos/configs for <n> in CreateIntTemplates() in intproto.cpp file
Yo guys, i've a problem when i wanna train my .tr file when im running the mftraninig command. Recently i saw a similar error than mine when i want to train my .tr file, link in mftraining gives Warning: no protos/configs for F in CreateIntTemplates().

I tried changing the font_properties usual error and the wrong training name but neither of both solutions solved it.

The difference between the similar error than mine is that my problem launch an error in intproto.cpp and in the other forum it points to the trainingsampleset.cpp file

I followed all the steps of this video: https://www.youtube.com/watch?v=1v8BPw0Dn0I&t=15s and also added the eng.traineddata file that is neccesary to train data in eng just such as i named on my files:

Anybody knows how can i solve this? Thanks in advance.

Added eng.traineddata from https://github.com/tesseract-ocr/tessdata_best/blob/main/eng.traineddata in /usr/local/share/tessdata.


问:
How to reproject a list of shapefiles (SpatialLinesDataFrame) in R
I read a list of shapefiles (SpatialLinesDataFrame) onto R. Now I am trying to reproject this list to a ndifferent EPSG but I just can't seem to have it work. I have tried with lapply and looping through the list but none seem to work, which keep giving the errors I show below.

I know my example is not reproducible, but I might just be missing something very obvious because I could not find a straight forward answer to this.

```<code>EPSG_102033 <- "+proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs" # CRS EPSG:102033 string

files <- list.files(files_path, pattern = ".shp$", full.names = TRUE)

roads <- setNames(lapply(files, shapefile), tools::file_path_sans_ext(basename(files))) # this gives a list of three SpatialLinesDataFrame S4 objects

### I have tried:

roads <- lapply(files, function(x) {x <- spTransform(x, CRSobj = EPSG_102033);x})

# which gives: Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘spTransform’ for signature ‘"character", "character"’

### Also tried:

for (i in length(roads)){
  roads[[i]] <- spTransform(roads[i],  CRSobj = EPSG_102033)
}

# which gives: Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘spTransform’ for signature ‘"list", "character"’

</code>```

What am I missing?

Thanks!

Body:
I read a list of shapefiles (SpatialLinesDataFrame) onto R. Now I am trying to reproject this list to a ndifferent EPSG but I just can't seem to have it work. I have tried with lapply and looping through the list but none seem to work, which keep giving the errors I show below.

I know my example is not reproducible, but I might just be missing something very obvious because I could not find a straight forward answer to this.

EPSG_102033 <- "+proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs" # CRS EPSG:102033 string

files <- list.files(files_path, pattern = ".shp$", full.names = TRUE)

roads <- setNames(lapply(files, shapefile), tools::file_path_sans_ext(basename(files))) # this gives a list of three SpatialLinesDataFrame S4 objects

### I have tried:

roads <- lapply(files, function(x) {x <- spTransform(x, CRSobj = EPSG_102033);x})

# which gives: Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘spTransform’ for signature ‘"character", "character"’

### Also tried:

for (i in length(roads)){
  roads[[i]] <- spTransform(roads[i],  CRSobj = EPSG_102033)
}

# which gives: Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘spTransform’ for signature ‘"list", "character"’

What am I missing?

Thanks!


问:
Spring does not run job from another module
I have a scheduling module in my spring boot project, in that project there is a job that runs normally when I test the scheduling module.

I need to use this module inside another one, so I imported it in the target module's build.gradle file:

```<code>dependencies {
    implementation project(':scheduling')
</code>```

I also added in the target module the job execution settings in the bootstrap.yml file

```<code>schedule:
  account:
    unblock:
      process-time: "0 0/1 * * * ?"
      thread-pool:
        name-prefix: schedule-job-executor
        core-pool-size: 1
        max-pool-size: 2
        queue-capacity: 1
        use-max-available-processors: false
      query:
        limit-size: 100
        execution-count: 3
        execute-until-end: true
</code>```

This is the main class of the target module, I added the annotations for running and configuring the job.

```<code>@SpringBootApplication
@Import({EventsConfig.class, SchedulingConfig.class})
@EnableScheduling
@EnableConfigurationProperties({ScheduleQueryProperties.class, ScheduleThreadPoolProperties.class,
        ScheduleUnblockMaintenceLimitQueryProperties.class, ScheduleUnblockMaintenceLimitThreadPool.class})
public class EventsStarter {

    private static final Logger LOGGER = LoggerFactory.getLogger(EventsStarter.class);

    public static void main(String[] args) {
         Security.addProvider(new BouncyCastleProvider());
        try {
            SSLUtil.turnOffSslChecking();
        } catch (NoSuchAlgorithmException | KeyManagementException e) {
            LOGGER.error(e.getMessage(), e);
        }
        SpringApplication.run(EventsStarter.class, args);
    }
}
</code>```

This is the main class of the source module

```<code>@SpringBootApplication
@EnableScheduling
@Import({SchedulingConfig.class})
@EnableConfigurationProperties({ScheduleQueryProperties.class, ScheduleThreadPoolProperties.class,
        ScheduleUnblockMaintenceLimitQueryProperties.class, ScheduleUnblockMaintenceLimitThreadPool.class})
public class SchedulingStarter {

    private static final Logger LOGGER = LoggerFactory.getLogger(SchedulingStarter.class);

    public static void main(String[] args) {
        Security.addProvider(new BouncyCastleProvider());
        try {
            SSLUtil.turnOffSslChecking();
        } catch (NoSuchAlgorithmException | KeyManagementException e) {
            LOGGER.error(e.getMessage(), e);
        }
        SpringApplication.run(SchedulingStarter.class, args);
    }
}
</code>```

Debugging the target application, the application runs without errors but the job does not run

Body:
I have a scheduling module in my spring boot project, in that project there is a job that runs normally when I test the scheduling module.

I need to use this module inside another one, so I imported it in the target module's build.gradle file:

dependencies {
    implementation project(':scheduling')

I also added in the target module the job execution settings in the bootstrap.yml file

schedule:
  account:
    unblock:
      process-time: "0 0/1 * * * ?"
      thread-pool:
        name-prefix: schedule-job-executor
        core-pool-size: 1
        max-pool-size: 2
        queue-capacity: 1
        use-max-available-processors: false
      query:
        limit-size: 100
        execution-count: 3
        execute-until-end: true

This is the main class of the target module, I added the annotations for running and configuring the job.

@SpringBootApplication
@Import({EventsConfig.class, SchedulingConfig.class})
@EnableScheduling
@EnableConfigurationProperties({ScheduleQueryProperties.class, ScheduleThreadPoolProperties.class,
        ScheduleUnblockMaintenceLimitQueryProperties.class, ScheduleUnblockMaintenceLimitThreadPool.class})
public class EventsStarter {

    private static final Logger LOGGER = LoggerFactory.getLogger(EventsStarter.class);

    public static void main(String[] args) {
         Security.addProvider(new BouncyCastleProvider());
        try {
            SSLUtil.turnOffSslChecking();
        } catch (NoSuchAlgorithmException | KeyManagementException e) {
            LOGGER.error(e.getMessage(), e);
        }
        SpringApplication.run(EventsStarter.class, args);
    }
}

This is the main class of the source module

@SpringBootApplication
@EnableScheduling
@Import({SchedulingConfig.class})
@EnableConfigurationProperties({ScheduleQueryProperties.class, ScheduleThreadPoolProperties.class,
        ScheduleUnblockMaintenceLimitQueryProperties.class, ScheduleUnblockMaintenceLimitThreadPool.class})
public class SchedulingStarter {

    private static final Logger LOGGER = LoggerFactory.getLogger(SchedulingStarter.class);

    public static void main(String[] args) {
        Security.addProvider(new BouncyCastleProvider());
        try {
            SSLUtil.turnOffSslChecking();
        } catch (NoSuchAlgorithmException | KeyManagementException e) {
            LOGGER.error(e.getMessage(), e);
        }
        SpringApplication.run(SchedulingStarter.class, args);
    }
}

Debugging the target application, the application runs without errors but the job does not run


问:
PathML for image processing in Python, Jupyter Lab
I am reaching out regarding the installation of Pathml on both my Mac and windows, I followed these instructions (https://openbase.com/python/pathml/documentation) exactly but whenever I try to import ‘Pathml’ into my Jupyter Lab cell, it give me the following error:

ModuleNotFoundError: No module named ‘pathml'

I would appreciate any sort of help

Tried installing more Java stuff but no way


问:
Downgrade dependency version in gradle
I have excluded snakeyaml from all my dependencies, as i was unable to pin down which dependency has snakeyaml 1.33 in it's dependency tree.

However, the build is still failing, asking for a version of yaml that has been blocked by my org security policy.

I want to downgrade it to 1.29 version.

However, build fails searching for 1.33 even after using strict implementation like this:

```<code>implementation( group: 'org.yaml', name: 'snakeyaml'){
        version{
            strictly '1.29'
        }
    }
</code>```

What am i missing ?

Do i need to check dependency tree of plugins as well ? If yes, how can i do that? I used http://101coder.com/genTreeUI

Title: Downgrade dependency version in gradle

Body:
I have excluded snakeyaml from all my dependencies, as i was unable to pin down which dependency has snakeyaml 1.33 in it's dependency tree.

However, the build is still failing, asking for a version of yaml that has been blocked by my org security policy.

I want to downgrade it to 1.29 version.

However, build fails searching for 1.33 even after using strict implementation like this:

implementation( group: 'org.yaml', name: 'snakeyaml'){
        version{
            strictly '1.29'
        }
    }

What am i missing ?

Do i need to check dependency tree of plugins as well ? If yes, how can i do that? I used http://101coder.com/genTreeUI


问:
CMAKE: How to get multiple files generated by a add_custom_command
using CMake add_custom_command,  we cannot automatically find the output files.
the script generate many cpp/h files but it is base on some templates. Of course the template change from time to time.

so we have:

```<code>set(THE_SCRIPT "/x/y/z/theScript")
set(GENERATED_FILES "file1.cpp" "file1.h" "file2.cpp" "file2.hpp" ...)
set (TPL_FILE "Template.ert")

add_custom_command(
   OUTPUT   ${GENERATED_FILES}
   COMMAND  ${THE_SCRIPT} -t ${TPL_FILE} -D ${CMAKE_CURRENT_BINARY_DIR}
   MAIN_DEPENDENCY ${TPL_FILE}
   DEPENDS  ${GENERATED_FILES}
)
target_sources(myTarget PRIVATE ${GENERATED_FILES})
</code>```

The GENERATED_FILES variable is made by the developer each time he/she changes the template file.
the dev runs the command, grab all the files created and update the variable.

I was trying to think of a way to use file(GLOB GENERATED_FILES ...)

to get the list of files. But I am not sure how to go about it!

Body:
using CMake add_custom_command,  we cannot automatically find the output files.
the script generate many cpp/h files but it is base on some templates. Of course the template change from time to time.

so we have:

set(THE_SCRIPT "/x/y/z/theScript")
set(GENERATED_FILES "file1.cpp" "file1.h" "file2.cpp" "file2.hpp" ...)
set (TPL_FILE "Template.ert")

add_custom_command(
   OUTPUT   ${GENERATED_FILES}
   COMMAND  ${THE_SCRIPT} -t ${TPL_FILE} -D ${CMAKE_CURRENT_BINARY_DIR}
   MAIN_DEPENDENCY ${TPL_FILE}
   DEPENDS  ${GENERATED_FILES}
)
target_sources(myTarget PRIVATE ${GENERATED_FILES})

The GENERATED_FILES variable is made by the developer each time he/she changes the template file.
the dev runs the command, grab all the files created and update the variable.

I was trying to think of a way to use file(GLOB GENERATED_FILES ...)

to get the list of files. But I am not sure how to go about it!


问:
Why does Quarkus throw a java.util.ServiceConfigurationError after a period of time?
We have a Quarkus application using RestEasy Reactive, Hibernate Reactive (w/ panache), and Hazelcast for caching. When the application starts up, the endpoints return a response without any exceptions being thrown. However, after around 10 minutes or so, an exception is thrown that we're having a hard time making sense of. The exception is below. The only clues found for when this exception is thrown is the amount of time elapsed (10 mins), and endpoints which make use of the Hazelcast cache.

Resource Method

```<code>@GET
@APIResponse(
    responseCode = StatusCode.OK,
    description = "Get All Loans",
    content =
        @Content(
            mediaType = MediaType.APPLICATION_JSON,
            schema = @Schema(type = SchemaType.ARRAY, implementation = Loan.class)))
public Uni<List<Loan>> getLoans(final SearchParameters parameters) {
  return getDomainContextAndThen(
      domainContext -> {
        final LoanSearch search =
            LoanSearch.builder()
                .user(domainContext.getAuthenticatedUser())
                .team(domainContext.getTeam())
                .page(parameters.getPage())
                .perPage(parameters.getPerPage())
                .build();

        return loanService.find(search);
      });
}
</code>```

Utility Method

```<code>protected <T> Uni<T> getDomainContextAndThen(final Function<DomainContext, Uni<T>> callback) {
  // spotless:off
  return Uni.combine()
      .all().unis(getContextTeam(), getAuthenticatedUser()).asTuple()
      .onItem().transformToUni(
          tuple -> callback.apply(new DomainContext(tuple.getItem1(), tuple.getItem2())));
  // spotless:on
}
</code>```

Service Method

```<code>public Uni<List<Loan>> find(final LoanSearch search) {
  if (search.getUser() != null && search.getUser().isBorrower()) {
    return findLoansForBorrower(search);
  }

  return Uni.createFrom().item(new ArrayList<>());
}

private Uni<List<Loan>> findLoansForBorrower(final LoanSearch search) {
  final HQL hql =
      HQL.select()
          .from(LoanEntity.class)
          .join("le.borrowers", "lb")
          .join("lb.borrowerUser", "lbu")
          .joinFetch("le.loTeam", "lt")
          .leftJoinFetch("le.lender", "ll");
  final Condition where = Condition.eq("lbu.email", search.getUser().getEmail());

  if (search.getTeam() != null) {
    where.and(Condition.eq("le.loTeam.id", search.getTeam().getId()));
  }

  hql.where(where);

  return loanRepository
      .find(hql.getQuery(), hql.getParameters())
      .page(search.getPageZeroIndexed(), search.getPerPage())
      .stream()
      .map(loanMapper::toDomain)
      .collect()
      .asList();
}
</code>```

Exception:

```<code>java.util.ServiceConfigurationError: io.smallrye.config.SmallRyeConfigFactory: io.quarkus.runtime.configuration.QuarkusConfigFactory not a subtype
    at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
    at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
    at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getFactoryFor(SmallRyeConfigProviderResolver.java:100)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:76)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:64)
    at org.eclipse.microprofile.config.ConfigProvider.getConfig(ConfigProvider.java:85)
    at io.smallrye.context.impl.DefaultValues.<init>(DefaultValues.java:41)
    at io.smallrye.context.SmallRyeContextManager.<init>(SmallRyeContextManager.java:63)
    at io.smallrye.context.SmallRyeContextManager$Builder.build(SmallRyeContextManager.java:337)
    at io.smallrye.context.SmallRyeContextManagerProvider.getContextManager(SmallRyeContextManagerProvider.java:48)
    at io.smallrye.context.SmallRyeContextManagerProvider.getContextManager(SmallRyeContextManagerProvider.java:37)
    at io.smallrye.context.SmallRyeContextManagerProvider.getManager(SmallRyeContextManagerProvider.java:97)
    at io.smallrye.context.SmallRyeThreadContext.getCurrentThreadContextOrDefaultContexts(SmallRyeThreadContext.java:160)
    at io.smallrye.mutiny.context.DefaultContextPropagationInterceptor.getThreadContext(DefaultContextPropagationInterceptor.java:12)
    at io.smallrye.mutiny.context.BaseContextPropagationInterceptor.decorate(BaseContextPropagationInterceptor.java:24)
    at io.smallrye.mutiny.infrastructure.Infrastructure.decorate(Infrastructure.java:145)
    at io.smallrye.mutiny.groups.UniCreate.item(UniCreate.java:304)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.getSession(AbstractJpaOperations.java:138)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.find(AbstractJpaOperations.java:214)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.find(AbstractJpaOperations.java:209)
    at company.domain.loan.LoanRepository.find(LoanRepository.java)
    at company.domain.loan.LoanRepository_ClientProxy.find(Unknown Source)
    at company.domain.loan.LoanService.findLoansForBorrower(LoanService.java:61)
    at company.domain.loan.LoanService.find(LoanService.java:37)
    at company.domain.loan.LoanService_ClientProxy.find(Unknown Source)
    at company.domain.loan.LoanResource.lambda$getLoans$0(LoanResource.java:76)
    at company.domain.common.resource.SecuredResource.lambda$getDomainContextAndThen$1(SecuredResource.java:41)
    at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:68)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$AndSupervisor.computeAndFireTheOutcome(UniAndCombination.java:152)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$AndSupervisor.check(UniAndCombination.java:131)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$UniHandler.onItem(UniAndCombination.java:221)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23)
    at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
    at com.hazelcast.client.impl.ClientDelegatingFuture$WhenCompleteAdapter.apply(ClientDelegatingFuture.java:525)
    at com.hazelcast.client.impl.ClientDelegatingFuture$WhenCompleteAdapter.apply(ClientDelegatingFuture.java:507)
    at com.hazelcast.client.impl.spi.impl.ClientInvocationFuture$CallIdTrackingBiFunction.apply(ClientInvocationFuture.java:250)
    at com.hazelcast.spi.impl.AbstractInvocationFuture$HandleNode.lambda$execute$0(AbstractInvocationFuture.java:1536)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
</code>```

Given that QuarkusConfigFactory is a subclass of SmallRyeConfigFactory I was expecting that it wouldn't throw an exception claiming that it is 'not a subtype'. Step debugging through the source code did not reveal anything.

Body:
We have a Quarkus application using RestEasy Reactive, Hibernate Reactive (w/ panache), and Hazelcast for caching. When the application starts up, the endpoints return a response without any exceptions being thrown. However, after around 10 minutes or so, an exception is thrown that we're having a hard time making sense of. The exception is below. The only clues found for when this exception is thrown is the amount of time elapsed (10 mins), and endpoints which make use of the Hazelcast cache.

Resource Method

@GET
@APIResponse(
    responseCode = StatusCode.OK,
    description = "Get All Loans",
    content =
        @Content(
            mediaType = MediaType.APPLICATION_JSON,
            schema = @Schema(type = SchemaType.ARRAY, implementation = Loan.class)))
public Uni<List<Loan>> getLoans(final SearchParameters parameters) {
  return getDomainContextAndThen(
      domainContext -> {
        final LoanSearch search =
            LoanSearch.builder()
                .user(domainContext.getAuthenticatedUser())
                .team(domainContext.getTeam())
                .page(parameters.getPage())
                .perPage(parameters.getPerPage())
                .build();

        return loanService.find(search);
      });
}

Utility Method

protected <T> Uni<T> getDomainContextAndThen(final Function<DomainContext, Uni<T>> callback) {
  // spotless:off
  return Uni.combine()
      .all().unis(getContextTeam(), getAuthenticatedUser()).asTuple()
      .onItem().transformToUni(
          tuple -> callback.apply(new DomainContext(tuple.getItem1(), tuple.getItem2())));
  // spotless:on
}

Service Method

public Uni<List<Loan>> find(final LoanSearch search) {
  if (search.getUser() != null && search.getUser().isBorrower()) {
    return findLoansForBorrower(search);
  }

  return Uni.createFrom().item(new ArrayList<>());
}

private Uni<List<Loan>> findLoansForBorrower(final LoanSearch search) {
  final HQL hql =
      HQL.select()
          .from(LoanEntity.class)
          .join("le.borrowers", "lb")
          .join("lb.borrowerUser", "lbu")
          .joinFetch("le.loTeam", "lt")
          .leftJoinFetch("le.lender", "ll");
  final Condition where = Condition.eq("lbu.email", search.getUser().getEmail());

  if (search.getTeam() != null) {
    where.and(Condition.eq("le.loTeam.id", search.getTeam().getId()));
  }

  hql.where(where);

  return loanRepository
      .find(hql.getQuery(), hql.getParameters())
      .page(search.getPageZeroIndexed(), search.getPerPage())
      .stream()
      .map(loanMapper::toDomain)
      .collect()
      .asList();
}

Exception:

java.util.ServiceConfigurationError: io.smallrye.config.SmallRyeConfigFactory: io.quarkus.runtime.configuration.QuarkusConfigFactory not a subtype
    at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
    at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
    at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getFactoryFor(SmallRyeConfigProviderResolver.java:100)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:76)
    at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:64)
    at org.eclipse.microprofile.config.ConfigProvider.getConfig(ConfigProvider.java:85)
    at io.smallrye.context.impl.DefaultValues.<init>(DefaultValues.java:41)
    at io.smallrye.context.SmallRyeContextManager.<init>(SmallRyeContextManager.java:63)
    at io.smallrye.context.SmallRyeContextManager$Builder.build(SmallRyeContextManager.java:337)
    at io.smallrye.context.SmallRyeContextManagerProvider.getContextManager(SmallRyeContextManagerProvider.java:48)
    at io.smallrye.context.SmallRyeContextManagerProvider.getContextManager(SmallRyeContextManagerProvider.java:37)
    at io.smallrye.context.SmallRyeContextManagerProvider.getManager(SmallRyeContextManagerProvider.java:97)
    at io.smallrye.context.SmallRyeThreadContext.getCurrentThreadContextOrDefaultContexts(SmallRyeThreadContext.java:160)
    at io.smallrye.mutiny.context.DefaultContextPropagationInterceptor.getThreadContext(DefaultContextPropagationInterceptor.java:12)
    at io.smallrye.mutiny.context.BaseContextPropagationInterceptor.decorate(BaseContextPropagationInterceptor.java:24)
    at io.smallrye.mutiny.infrastructure.Infrastructure.decorate(Infrastructure.java:145)
    at io.smallrye.mutiny.groups.UniCreate.item(UniCreate.java:304)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.getSession(AbstractJpaOperations.java:138)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.find(AbstractJpaOperations.java:214)
    at io.quarkus.hibernate.reactive.panache.common.runtime.AbstractJpaOperations.find(AbstractJpaOperations.java:209)
    at company.domain.loan.LoanRepository.find(LoanRepository.java)
    at company.domain.loan.LoanRepository_ClientProxy.find(Unknown Source)
    at company.domain.loan.LoanService.findLoansForBorrower(LoanService.java:61)
    at company.domain.loan.LoanService.find(LoanService.java:37)
    at company.domain.loan.LoanService_ClientProxy.find(Unknown Source)
    at company.domain.loan.LoanResource.lambda$getLoans$0(LoanResource.java:76)
    at company.domain.common.resource.SecuredResource.lambda$getDomainContextAndThen$1(SecuredResource.java:41)
    at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:68)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$AndSupervisor.computeAndFireTheOutcome(UniAndCombination.java:152)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$AndSupervisor.check(UniAndCombination.java:131)
    at io.smallrye.mutiny.operators.uni.UniAndCombination$UniHandler.onItem(UniAndCombination.java:221)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23)
    at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
    at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43)
    at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
    at com.hazelcast.client.impl.ClientDelegatingFuture$WhenCompleteAdapter.apply(ClientDelegatingFuture.java:525)
    at com.hazelcast.client.impl.ClientDelegatingFuture$WhenCompleteAdapter.apply(ClientDelegatingFuture.java:507)
    at com.hazelcast.client.impl.spi.impl.ClientInvocationFuture$CallIdTrackingBiFunction.apply(ClientInvocationFuture.java:250)
    at com.hazelcast.spi.impl.AbstractInvocationFuture$HandleNode.lambda$execute$0(AbstractInvocationFuture.java:1536)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Given that QuarkusConfigFactory is a subclass of SmallRyeConfigFactory I was expecting that it wouldn't throw an exception claiming that it is 'not a subtype'. Step debugging through the source code did not reveal anything.


问:
Display Dictionary in List
using SwiftUI, I am making a request to a server to get data. My call to the server is good. However, the app is not displaying the data in the View.

I am attempting to display value(s) from the dictionary COURSE, which is part of the struct RESULT, in the list. What is wrong with my code?

the code:

```<code>// an array of what comes back from the server
struct Response: Codable {
    var results: [Result]
}

// this is what comes back from the server
struct Result: Codable, Hashable {
    var STATUS_CODE : String
    var STATUS_MESSAGE : String
    var COURSE: [String : String] = ["ID" : "", "TITLE" : "", "DATE" : "", "DEPT" : "", "CATEGORY" : "", "COURSE_URL" : "", "COURSE_ID" : ""]

}

struct ContentView: View {
    @State private var results = [Result]()

    var body: some View {
        List(results, id: \.self) { item in
            VStack() {
                Text(item.COURSE["TITLE"] ?? "n/a")

            }// end VStack
        }// end List
        .task {
            await loadData()
        }// end task
    }// end some View

func loadData() async {
        // set url
        guard let url = URL(string:
                                "theurl.com")
        else {
            print("Invalid url")

        return
        }

        let json: [String: String] = ["ACTION" : "GET_COURSES"]
        let jsonData = try? JSONSerialization.data(withJSONObject: json)

        var request = URLRequest(url: url)
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.httpMethod = "POST"
        request.httpBody = jsonData

        // this is what does the call
        do {

            let (data, _) = try await URLSession.shared.data(for: request)

            if let decodedResponse = try? JSONDecoder().decode(Response.self, from:
                                                                data) {
                results = decodedResponse.results
            }
        } catch {
            print("invalid data")
        }
    }
}// end ContentView
</code>```

This question is different than the recommended post because this question asks about looping through multiple dictionaries as opposed to just one dictionary.

Title: Display Dictionary in List

Body:
using SwiftUI, I am making a request to a server to get data. My call to the server is good. However, the app is not displaying the data in the View.

I am attempting to display value(s) from the dictionary COURSE, which is part of the struct RESULT, in the list. What is wrong with my code?

the code:

// an array of what comes back from the server
struct Response: Codable {
    var results: [Result]
}

// this is what comes back from the server
struct Result: Codable, Hashable {
    var STATUS_CODE : String
    var STATUS_MESSAGE : String
    var COURSE: [String : String] = ["ID" : "", "TITLE" : "", "DATE" : "", "DEPT" : "", "CATEGORY" : "", "COURSE_URL" : "", "COURSE_ID" : ""]

}

struct ContentView: View {
    @State private var results = [Result]()

    var body: some View {
        List(results, id: \.self) { item in
            VStack() {
                Text(item.COURSE["TITLE"] ?? "n/a")

            }// end VStack
        }// end List
        .task {
            await loadData()
        }// end task
    }// end some View

func loadData() async {
        // set url
        guard let url = URL(string:
                                "theurl.com")
        else {
            print("Invalid url")

        return
        }

        let json: [String: String] = ["ACTION" : "GET_COURSES"]
        let jsonData = try? JSONSerialization.data(withJSONObject: json)

        var request = URLRequest(url: url)
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.httpMethod = "POST"
        request.httpBody = jsonData

        // this is what does the call
        do {

            let (data, _) = try await URLSession.shared.data(for: request)

            if let decodedResponse = try? JSONDecoder().decode(Response.self, from:
                                                                data) {
                results = decodedResponse.results
            }
        } catch {
            print("invalid data")
        }
    }
}// end ContentView

This question is different than the recommended post because this question asks about looping through multiple dictionaries as opposed to just one dictionary.


问:
How to use asyncio.gather with dynamically generated tasks?
I have an async method called send_notifications_async(token). This method users a library to sent apple push notifications asynchronously. Given a list of tokens how can I dynamically create a iterable set of tasks to run asynchronously with asyncio.gather?

```<code>async def gather_notification_responses(tokens):
    return await asyncio.gather(*[send_notification_async(token.token) async for token in tokens])
</code>```

I'm running the code with this synchronous method:

```<code>def send_notifications(tokens):
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    results = loop.run_until_complete(gather_notification_responses(tokens))
    loop.close()
    return results
</code>```

I keep facing the same 2 runtime errors:

```<code>OSError: [Errno 9] Bad file descriptor
</code>```

and

```<code>RuntimeError: Event loop is closed
</code>```

Body:
I have an async method called send_notifications_async(token). This method users a library to sent apple push notifications asynchronously. Given a list of tokens how can I dynamically create a iterable set of tasks to run asynchronously with asyncio.gather?

async def gather_notification_responses(tokens):
    return await asyncio.gather(*[send_notification_async(token.token) async for token in tokens])

I'm running the code with this synchronous method:

def send_notifications(tokens):
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    results = loop.run_until_complete(gather_notification_responses(tokens))
    loop.close()
    return results

I keep facing the same 2 runtime errors:

OSError: [Errno 9] Bad file descriptor

and

RuntimeError: Event loop is closed


问:
Laravel relational model group by
My two data tables for vehicles and fuels have a one to many relationship. Two columns in the fuels datatable are named cost and date. I need to retrieve the vehicle models along with the monthly fuel costs, which entails grouping the fuel entries by month and year.

Here what I have tried

```<code>$vehicles = Vehicle::withSum('fuels', 'quantity')
            ->with('fuels')
            ->withSum('fuels', 'cost')
            ->withMax('meterEntries', 'meter_entry')
            ->withMin('meterEntries', 'meter_entry')
            ->get();
</code>```

Output similar to that

```<code>Illuminate\Database\Eloquent\Collection {#1503 ▼ // app\Http\Controllers\GeneralController.php:46
  #items: array:20 [▼
    0 => App\Models\Vehicle {#1498 ▼
      #relations: array:1 [▼
        "fuels" => Illuminate\Database\Eloquent\Collection {#1487 ▼
          #items: array:1 [▼
            0 => App\Models\Fuel {#1486 ▶}
          ]
          #escapeWhenCastingToString: false
        }
      ]
    }
    .
    .
    .
    .
}
</code>```

I have fuel entries with car vehicle model, but I want to group them by months and years. Additionally, rather than receiving all fuel entries, I need the monthly cost total.

Title: Laravel relational model group by

Body:
My two data tables for vehicles and fuels have a one to many relationship. Two columns in the fuels datatable are named cost and date. I need to retrieve the vehicle models along with the monthly fuel costs, which entails grouping the fuel entries by month and year.

Here what I have tried

$vehicles = Vehicle::withSum('fuels', 'quantity')
            ->with('fuels')
            ->withSum('fuels', 'cost')
            ->withMax('meterEntries', 'meter_entry')
            ->withMin('meterEntries', 'meter_entry')
            ->get();

Output similar to that

Illuminate\Database\Eloquent\Collection {#1503 ▼ // app\Http\Controllers\GeneralController.php:46
  #items: array:20 [▼
    0 => App\Models\Vehicle {#1498 ▼
      #relations: array:1 [▼
        "fuels" => Illuminate\Database\Eloquent\Collection {#1487 ▼
          #items: array:1 [▼
            0 => App\Models\Fuel {#1486 ▶}
          ]
          #escapeWhenCastingToString: false
        }
      ]
    }
    .
    .
    .
    .
}

I have fuel entries with car vehicle model, but I want to group them by months and years. Additionally, rather than receiving all fuel entries, I need the monthly cost total.


问:
Pyspark sql ANSI SQL
I'm working with pyspark sql. i need to write and check the sql quer standards with ANSI how to get it done with pyspark. I have tried adding "spark.sql.ansi.enabled" to True in option while reading data from database.

I need to add ANSI SQL standards in my pyspark sql queries

Title: Pyspark sql ANSI SQL


问:
workflow_run in PR
I have some CI in my repo which has two separate workflows. Workflow B needs to run after workflow A completes. When I call workflow B from A:

```<code>name: HelmLint
on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

...
...

  install:
    needs:
      - lint
    uses: ./.github/workflows/install.yaml
    secrets: inherit
</code>```

Workflow B runs on the PR. Because it uses a matrix, I see this on the status checks:

However, these do not show up in the runs for this workflow under the actions tab:
Which I need to have my CI badge in the readme in a 'passing' state.

If I instead do this for workflow B:

```<code>name: Install Helm Charts
on:
  workflow_run:
    workflows: [HelmLint]
    types:
      - completed
</code>```

Where 'HelmLint' is Workflow A, then this workflow B does not run on PR after workflow A. What do I need so that I can get my status badge in a passing state and the workflow running on PR?

Title: workflow_run in PR

Body:
I have some CI in my repo which has two separate workflows. Workflow B needs to run after workflow A completes. When I call workflow B from A:

name: HelmLint
on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

...
...

  install:
    needs:
      - lint
    uses: ./.github/workflows/install.yaml
    secrets: inherit

Workflow B runs on the PR. Because it uses a matrix, I see this on the status checks:

However, these do not show up in the runs for this workflow under the actions tab:
Which I need to have my CI badge in the readme in a 'passing' state.

If I instead do this for workflow B:

name: Install Helm Charts
on:
  workflow_run:
    workflows: [HelmLint]
    types:
      - completed

Where 'HelmLint' is Workflow A, then this workflow B does not run on PR after workflow A. What do I need so that I can get my status badge in a passing state and the workflow running on PR?


问:
I am Getting An ERROR when I Unequipe an I item
I am Getting An ERROR when I Unequipe an I item message me at discord acceleratedrip#4080
And i can send you my script at my discord</p>


问:
how can i create pytorch or tensor flow model that takes 2 images as input for classification
I'm new to deep learning and its frameworks(pytorch or tensorflow). I want to create a multi label classification model that takes 2 images as an input and classify them based on the relation between in predefined category or dataset(csv file). how can I achieve that

I didn't try anything yet because I didn't understand how to start


问:
How do you read the ANTS Graph in order to free up memory?
I have this project that is using up too much memory, and I suspect that I have found the culprits:

These boys are the ones hogging up all the memory. Looking through, I then guess that the one's labeled as "no" are ones that I should try to remove/mitigate. They look like this:

So, my main question is what should I be looking at? I am just really unfamiliar with the process of using this information to start commenting out what's causing us to use so much memory

So far, I have tried commenting out everything that uses aboutdialog and progress form, but I have not seen a shrink in memory.


问:
How to create Tensorflow dataset batches for variable shape inputs?
I have dataset for image captioning. Each image has different number of captions (or sentences), let say some images have seven captions and other may have ten or more. I used the following code for dataset creation:

```<code>def make_dataset(videos, captions):
    dataset = tf.data.Dataset.from_tensor_slices((videos, tf.ragged.constant(captions)))
    dataset = dataset.shuffle(BATCH_SIZE * 8)
    dataset = dataset.map(process_input, num_parallel_calls=AUTOTUNE)
    dataset = dataset.batch(BATCH_SIZE).prefetch(AUTOTUNE)

    return dataset
</code>```

this code is worked fine only when the BATCH_SIZE = 1 .
when I try to use BATCH_SIZE = 2 or more I get the following error:

```<code>InvalidArgumentError: Cannot add tensor to the batch: number of elements does not match. Shapes are: [tensor]: [7,20], [batch]: [10,20] [Op:IteratorGetNext]
</code>```

Is there a way to merge these data in batches without using padding?

Body:
I have dataset for image captioning. Each image has different number of captions (or sentences), let say some images have seven captions and other may have ten or more. I used the following code for dataset creation:

def make_dataset(videos, captions):
    dataset = tf.data.Dataset.from_tensor_slices((videos, tf.ragged.constant(captions)))
    dataset = dataset.shuffle(BATCH_SIZE * 8)
    dataset = dataset.map(process_input, num_parallel_calls=AUTOTUNE)
    dataset = dataset.batch(BATCH_SIZE).prefetch(AUTOTUNE)

    return dataset

this code is worked fine only when the BATCH_SIZE = 1 .
when I try to use BATCH_SIZE = 2 or more I get the following error:

InvalidArgumentError: Cannot add tensor to the batch: number of elements does not match. Shapes are: [tensor]: [7,20], [batch]: [10,20] [Op:IteratorGetNext]

Is there a way to merge these data in batches without using padding?


问:
Recompiling ROS with specified libboost version
I currently have ROS noetic, I'd like to recompile noetic from source. I also want to make sure I'm compiling ROS with boost 1.69. I've been following the instructions here for compiling ROS from source: http://wiki.ros.org/noetic/Installation/Source#Installing_from_source

I'm not sure what the steps are and when I need to do the steps to get boost 1.69 and have it used in the ROS compilation. I currently have boost 1.71 on my system.

I'm on Ubuntu 20.04.4

Here's what I've tried and found so far:

I've cleaned up the 1.71 version of boost using apt purge -y libboost* and
installed boost 1.69 using steps here: How to install Boost on Ubuntu

This installed 1.69 in /usr/local/include so I moved 1.71  boost to /usr/include/boost_old and 1.69 to /usr/include/boost.

Now when I type: aptitude search boost I only get results for 1.71 and 1.67.

When I try to install with: sudo apt-get install libboost1.69-dev-all I get the output:

```<code>Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libboost1.69-dev-all
E: Couldn't find any package by glob 'libboost1.69-dev-all'
E: Couldn't find any package by regex 'libboost1.69-dev-all'
`
</code>```

The only options I have for installation are:

```<code>libboost1.67-all-dev    libboost1.67-doc        libboost1.71-all-dev    libboost1.71-doc
</code>```

libboost1.67-dev        libboost1.67-tools-dev  libboost1.71-dev        libboost1.71-tools-dev

This doesn't include 1.69. I tried looking and seeing if there was an ubuntu provided package for 1.69 but I couldn't find one.

Output of whereis boost is:

```<code>boost: /usr/include/boost
</code>```

This matches the location where I moved 1.69.

I'm trying to compile ROS with libboost1.69 rather than the default 1.71. However, rosdep install --from-paths src --ignore-src -r -y will just install 1.71, I believe I'll need to use apt-get to install 1.69 and skip over the boost installation.

Any insights on how to accomplish this?

Body:
I currently have ROS noetic, I'd like to recompile noetic from source. I also want to make sure I'm compiling ROS with boost 1.69. I've been following the instructions here for compiling ROS from source: http://wiki.ros.org/noetic/Installation/Source#Installing_from_source

I'm not sure what the steps are and when I need to do the steps to get boost 1.69 and have it used in the ROS compilation. I currently have boost 1.71 on my system.

I'm on Ubuntu 20.04.4

Here's what I've tried and found so far:

I've cleaned up the 1.71 version of boost using apt purge -y libboost* and
installed boost 1.69 using steps here: How to install Boost on Ubuntu

This installed 1.69 in /usr/local/include so I moved 1.71  boost to /usr/include/boost_old and 1.69 to /usr/include/boost.

Now when I type: aptitude search boost I only get results for 1.71 and 1.67.

When I try to install with: sudo apt-get install libboost1.69-dev-all I get the output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libboost1.69-dev-all
E: Couldn't find any package by glob 'libboost1.69-dev-all'
E: Couldn't find any package by regex 'libboost1.69-dev-all'
`

The only options I have for installation are:

libboost1.67-all-dev    libboost1.67-doc        libboost1.71-all-dev    libboost1.71-doc

libboost1.67-dev        libboost1.67-tools-dev  libboost1.71-dev        libboost1.71-tools-dev

This doesn't include 1.69. I tried looking and seeing if there was an ubuntu provided package for 1.69 but I couldn't find one.

Output of whereis boost is:

boost: /usr/include/boost

This matches the location where I moved 1.69.

I'm trying to compile ROS with libboost1.69 rather than the default 1.71. However, rosdep install --from-paths src --ignore-src -r -y will just install 1.71, I believe I'll need to use apt-get to install 1.69 and skip over the boost installation.

Any insights on how to accomplish this?


问:
Why is message double sending to the other user in my react app?
I'm building a react app with socket-io and I'm currently experiencing a problem where when there is two users in the same room, the message from the sender will double send to the receiver. I've parsed through the code for a bit and can't figure out what is causing it. Here is the code.

Chat.js

```<code>import React, { useEffect, useState } from 'react'

function Chat({socket, username, room}) {
    const [currentMessage, setCurrentMessage] = useState("");
    const [messageList, setMessageList] = useState([]);

    const sendMessage = async () => {
        if (currentMessage != ""){
            const messageData = {
                room: room,
                author: username,
                message: currentMessage,
                time: new Date(Date.now()).getHours() +
                ":" + new Date(Date.now()).getMinutes(),

            };
            await socket.emit("send_message", messageData);
            setMessageList((list) => [...list, messageData]);
        }
    };

    useEffect(() => {
        socket.on("recieve_message", (data) => {
            setMessageList((list) => [...list, data]);

        })
    },[socket]);

    return (
        <div className='chat-window'>
            <div className='chat-header'>
                <p>Live Chat</p>
            </div>
            <div className='chat-body'>
                {messageList.map((messageContent) => {
                    return <h1>{messageContent.message}</h1>;
                })}
            </div>
            <div className='chat-footer'>
                <input
                type="text"
                placeholder="Hey..."
                onChange={(event) => {
                    setCurrentMessage(event.target.value);
                }}
                />
                <button onClick={sendMessage}>►</button>
            </div>

        </div>
    )
}

export default Chat
</code>```

App.js

```<code>import './App.css';
import io from 'socket.io-client'
import {useState} from "react";
import Chat from './Chat'

const socket = io.connect("http://localhost:3001");

function App() {
  const [username, setUsername] = useState("");
  const [room, setRoom] = useState("");
  const [showChat, setShowChat] = useState(false);

  const joinRoom = () => {
    if (username != "" && room != ""){
      socket.emit("join_room", room)
      setShowChat(true);

    }

  };
  return (
    <div className="App">
      {!showChat ? (
      <div className='joinChatContainer'>
        <h3>Join a chat</h3>
        <input type='text'
        placeholder='Name?'
        onChange={(event) => {setUsername(event.target.value);
        }}/>

        <input type='text'
        placeholder='Room ID'
        onChange={(event) => {setRoom(event.target.value);
        }}/>

        <button onClick={joinRoom}>Join A Room</button>
      </div>
      )
      : (
      <Chat socket={socket} username={username} room={room}/>
      )}
    </div>
  );
}

export default App;
</code>```

index.js

```<code>const express = require('express');
const app = express();
const http = require("http");
const cors = require("cors");
const { Server } = require("socket.io")

app.use(cors());
const server = http.createServer(app);

const io = new Server(server, {
    cors:{
        origin: "http://localhost:3000",
        methods: ["GET", "POST"]
    }
});

io.on("connection", (socket) => {
    console.log('User Connected: ' + socket.id);

    socket.on("join_room", (data) => {
        socket.join(data);
        console.log("User with ID: " + socket.id + " joined room " + data)
    })

    socket.on("send_message", (data) => {
        console.log(data);
        socket.to(data.room).emit("recieve_message", data);

    });
    socket.on("disconnect", () => {
        console.log("User Disconnected", socket.id);
    })

})

server.listen(3001, () => {
    console.log("SERVER RUNNING");
});
</code>```

I'm assuming there is something that calls twice when the receiver gets the message but I can't seem to find it

Body:
I'm building a react app with socket-io and I'm currently experiencing a problem where when there is two users in the same room, the message from the sender will double send to the receiver. I've parsed through the code for a bit and can't figure out what is causing it. Here is the code.

Chat.js

import React, { useEffect, useState } from 'react'

function Chat({socket, username, room}) {
    const [currentMessage, setCurrentMessage] = useState("");
    const [messageList, setMessageList] = useState([]);

    const sendMessage = async () => {
        if (currentMessage != ""){
            const messageData = {
                room: room,
                author: username,
                message: currentMessage,
                time: new Date(Date.now()).getHours() +
                ":" + new Date(Date.now()).getMinutes(),

            };
            await socket.emit("send_message", messageData);
            setMessageList((list) => [...list, messageData]);
        }
    };

    useEffect(() => {
        socket.on("recieve_message", (data) => {
            setMessageList((list) => [...list, data]);

        })
    },[socket]);

    return (

Live Chat

                {messageList.map((messageContent) => {
                    return
{messageContent.message}
;
                })}

                <input
                type="text"
                placeholder="Hey..."
                onChange={(event) => {
                    setCurrentMessage(event.target.value);
                }}
                />
                <button onClick={sendMessage}>►</button>

    )
}

export default Chat

App.js

import './App.css';
import io from 'socket.io-client'
import {useState} from "react";
import Chat from './Chat'

const socket = io.connect("http://localhost:3001");

function App() {
  const [username, setUsername] = useState("");
  const [room, setRoom] = useState("");
  const [showChat, setShowChat] = useState(false);

  const joinRoom = () => {
    if (username != "" && room != ""){
      socket.emit("join_room", room)
      setShowChat(true);

    }

  };
  return (

      {!showChat ? (

Join a chat

        <input type='text'
        placeholder='Name?'
        onChange={(event) => {setUsername(event.target.value);
        }}/>

        <input type='text'
        placeholder='Room ID'
        onChange={(event) => {setRoom(event.target.value);
        }}/>

        <button onClick={joinRoom}>Join A Room</button>

      )
      : (
      <Chat socket={socket} username={username} room={room}/>
      )}

  );
}

export default App;

index.js

const express = require('express');
const app = express();
const http = require("http");
const cors = require("cors");
const { Server } = require("socket.io")

app.use(cors());
const server = http.createServer(app);

const io = new Server(server, {
    cors:{
        origin: "http://localhost:3000",
        methods: ["GET", "POST"]
    }
});

io.on("connection", (socket) => {
    console.log('User Connected: ' + socket.id);

    socket.on("join_room", (data) => {
        socket.join(data);
        console.log("User with ID: " + socket.id + " joined room " + data)
    })

    socket.on("send_message", (data) => {
        console.log(data);
        socket.to(data.room).emit("recieve_message", data);

    });
    socket.on("disconnect", () => {
        console.log("User Disconnected", socket.id);
    })

})

server.listen(3001, () => {
    console.log("SERVER RUNNING");
});

I'm assuming there is something that calls twice when the receiver gets the message but I can't seem to find it


问:
How to change key type from text to file like in Postman but in Insomia?
Aloha,

Question: How to change the key type from text to file like in Postman but in Insomnia?

Reference From Postman

Problem: Cannot test POST on localhost:8080/predict/upload.

Reason: Testing back-end to see if file type is jpeg.

Expectation: Insomnia to produce same results from Postman.

Tried: Used Form urlEncoded and Binary File to POST http://localhost:8080/predict/upload but received 400 bad request.

Reference From Insomnia

Thank you!


问:
SAS Proc Mixed Random VS Repeated (Or both)?
I have data from a study for a "device". Subjects receive an implant and are followed for 5 years, with a checkup every year. A "disability score" is calculated from a survey every visit. The implant comes in different "sizes". Also, every year the "device condition" is evaluated. What I'm trying to do is see if "device condition" is associated with "disability score" while controlling for implant size/time/subject.

The Data:

I have the subject id, implant (A and B for sizes and is a static/baseline variable), the timepoint (12, 24, 36, 48, 60 months), implant condition (ordinal scale where 0 is best condition and can change timepoint to timepoint within each subject) and the disability score (dependent quantitative variable).

Example shown below

```<code>data modelling;
    input sid $ implant $ timepoint condition disability_score;
    cards;
    1 A 12 0 8
    1 A 24 0 9
    1 A 36 1 9.5
    1 A 48 1 8
    1 A 60 2 9
    2 B 12 1 7
    2 B 24 2 6
    2 B 36 2 7
    2 B 48 3 8
    2 B 60 4 9
    .....
    15 A 12 0 8
    15 A 24 0 9
    15 A 36 1 9.5
    15 A 48 1 8
    15 A 60 2 9
    ;
run;
</code>```

I'm using proc mixed, but I'm not sure which syntax would be most appropriate for this question. My initial inkling is this is a repeated measures situation and used this:

```<code>proc mixed data=modelling plots=none;
    class sid implant timepoint condition;
    model disability_score = implant condition timepoint condition*timepoint;
    repeated timepoint / subject=sid;
run;
</code>```

However, one thing I'm concerned with is if timepoint needs/should be a quantitative value, and if this is truly a repeated measures situation. When I run this, the condition and implant seem to be significant, and timepoint is not.

I also tried using the random statement with the subject id instead and using timepoint as quantitative

```<code>proc mixed data=modelling plots=none;
    class sid implant condition;
    model disability_score = implant condition timepoint condition*timepoint;
    random sid;
run;
</code>```

When I do this, I get vastly different results, with timepoint being significant and both implant and condition no longer significant.

Really, I'm not 100% sure which is the correctly specified model, and am looking for some validation and/or guidance to the correctly specified model for this question.

Body:
I have data from a study for a "device". Subjects receive an implant and are followed for 5 years, with a checkup every year. A "disability score" is calculated from a survey every visit. The implant comes in different "sizes". Also, every year the "device condition" is evaluated. What I'm trying to do is see if "device condition" is associated with "disability score" while controlling for implant size/time/subject.

The Data:

I have the subject id, implant (A and B for sizes and is a static/baseline variable), the timepoint (12, 24, 36, 48, 60 months), implant condition (ordinal scale where 0 is best condition and can change timepoint to timepoint within each subject) and the disability score (dependent quantitative variable).

Example shown below

data modelling;
    input sid $ implant $ timepoint condition disability_score;
    cards;
    1 A 12 0 8
    1 A 24 0 9
    1 A 36 1 9.5
    1 A 48 1 8
    1 A 60 2 9
    2 B 12 1 7
    2 B 24 2 6
    2 B 36 2 7
    2 B 48 3 8
    2 B 60 4 9
    .....
    15 A 12 0 8
    15 A 24 0 9
    15 A 36 1 9.5
    15 A 48 1 8
    15 A 60 2 9
    ;
run;

I'm using proc mixed, but I'm not sure which syntax would be most appropriate for this question. My initial inkling is this is a repeated measures situation and used this:

proc mixed data=modelling plots=none;
    class sid implant timepoint condition;
    model disability_score = implant condition timepoint condition*timepoint;
    repeated timepoint / subject=sid;
run;

However, one thing I'm concerned with is if timepoint needs/should be a quantitative value, and if this is truly a repeated measures situation. When I run this, the condition and implant seem to be significant, and timepoint is not.

I also tried using the random statement with the subject id instead and using timepoint as quantitative

proc mixed data=modelling plots=none;
    class sid implant condition;
    model disability_score = implant condition timepoint condition*timepoint;
    random sid;
run;

When I do this, I get vastly different results, with timepoint being significant and both implant and condition no longer significant.

Really, I'm not 100% sure which is the correctly specified model, and am looking for some validation and/or guidance to the correctly specified model for this question.


问:
Elementor Pro E_ERROR
newbe here and with worldpress.

I am getting this error with Elementor Pro Version 3.3.6

This plugin failed to load properly and is paused during recovery mode.

An error of type E_ERROR was caused in line 48 of the file

/data/user2/2021/182/33432/wordpress/.7898f453bbbcc2c64665ea922552af2a/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php. Error message: Uncaught ReflectionException: Method get_site_editor_type does not exist in /data/user2/2021/182/33432/wordpress/.7898f453bbbcc2c64665ea922552af2a/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php:48 Stack trace: #0 /data/user2/2021/182/33432/wordpress/.7898f453bbbcc2c64665ea922552af2a/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(48): ReflectionClass->getMethod() #1 /data/user2/2021/182/33432/wordpress/.7898f453bbbcc2c64665ea922552af2a/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(129): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document::get_site_editor_type_bc() #2 /data/user2/2021/182/33432/wordpress/.7898f453bbbcc2c64665ea922552af2a/wp-content/plugins/elementor/core/common/modules/finder/categories/create.php(94): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document::get_create_url() #3 /data/user2/2021/182/33432/wordpress/.7898f453bbbcc2c64665ea922552af2a/wp-content/plugins/elemento

I am expecting the plugin to load correctly, I've already restared the plugin still not working.

Title: Elementor Pro E_ERROR


问:
Cannot read properties of null (reading 'appendChild')
```<code>function cargar_tapete_inicial(mazo) {

        for (let i = 0; i < mazo.length; i++) {
            mazo[i].style.width = "50px";
            mazo[i].style.position = "absolute";
            mazo[i].style.top = paso+'px';
            mazo[i].style.left = paso+'px';
            paso = paso + 3;

            tapete_inicial.appendChild(mazo[i]);
        }

        paso = 3;
    }
</code>```

mazo_inicial it starts empty but is filled with the use of some methods

```<code>/***** INICIO DECLARACIÓN DE VARIABLES GLOBALES *****/

    // Array de palos y números
    let palos = ["corazones", "picas", "rombos", "treboles"];
    let numeros = ["as", 2, 3, 4, 5, 6, 7, 8, 9, 10, "jota", "reina", "rey"];

    let paso = 3;

    // Tapetes
    let tapete_inicial   = document.getElementById("inicial");

    // Mazos
    let mazo_inicial   = [];

    comenzar_juego();
    document.getElementById("reset").onclick = comenzar_juego;

    // Desarrollo del comienzo de juego
    function comenzar_juego() {

        mazo_inicial = [];

        for (let i = 0; i < numeros.length; i++) {
            for (let j = 0; j < palos.length; j++) {

                let carta  = document.createElement("img");
                carta.setAttribute("data-nombre", numeros[i]);
                carta.setAttribute("data-palo", palos[j]);
                carta.setAttribute("id", numeros[i] + '-' + palos[j]);
                carta.setAttribute("src", 'img/baraja/' + numeros[i] + '-' + palos[j] + '.png');

                if(palos[j] == "corazones" || palos[j] == "rombos") {
                    carta.setAttribute("data-color", "rojo");
                } else {
                    carta.setAttribute("data-color", "negro");
                }

                mazo_inicial.push(carta);

            }
        }

        // Barajar
        barajar(mazo_inicial);

        // Dejar mazo_inicial en tapete inicial
        cargar_tapete_inicial(mazo_inicial);

        // Arrancar el conteo de tiempo
        arrancar_tiempo();

    }
</code>```

```<code><html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Solitario</title>
</head>
<body>

    <!-- Título principal -->
    <h1 id="titulo">Juego del solitario</h1>

    <h2 id="marcadores">
        <span>Tiempo: <span id="cont_tiempo"></span></span>
        <span style="display:inline-block; width:200px"></span>
        <span>Movimientos: <span id="cont_movimientos" class=""></span></span>
    </h2>

    <div id="mesa">
        <div class="tapetes_superiores">
            <div id="inicial"   class="tapete"><span id="cont_inicial"   class="contador"></span></div>
            <div id="sobrantes" class="tapete"><span id="cont_sobrantes" class="contador"></span></div>
        </div>
        <div id="receptor1" class="tapete receptor"><span id="cont_receptor1" class="contador"></span></div>
        <div id="receptor2" class="tapete receptor"><span id="cont_receptor2" class="contador"></span></div>
        <div id="receptor3" class="tapete receptor"><span id="cont_receptor3" class="contador"></span></div>
        <div id="receptor4" class="tapete receptor"><span id="cont_receptor4" class="contador"></span></div>
    </div>

    <button id="reset" class="btn btn-danger">Reiniciar</button>

    <!-- Cargar el script js/solitario.js -->
    <script src="js/solitario.js"></script>

</body>
</code>```

The div that has id=inicial exists before the js link.

All tapetes are declared at the beginning of the js as global variables.

Script link is added at the end of the body.

Nevertheless, the code works and put me the cards in the correct div, but it annoys me to watch that error.

Can somebody solve this error?

Body:
function cargar_tapete_inicial(mazo) {

        for (let i = 0; i < mazo.length; i++) {
            mazo[i].style.width = "50px";
            mazo[i].style.position = "absolute";
            mazo[i].style.top = paso+'px';
            mazo[i].style.left = paso+'px';
            paso = paso + 3;

            tapete_inicial.appendChild(mazo[i]);
        }

        paso = 3;
    }

mazo_inicial it starts empty but is filled with the use of some methods

/***** INICIO DECLARACIÓN DE VARIABLES GLOBALES *****/

    // Array de palos y números
    let palos = ["corazones", "picas", "rombos", "treboles"];
    let numeros = ["as", 2, 3, 4, 5, 6, 7, 8, 9, 10, "jota", "reina", "rey"];

    let paso = 3;

    // Tapetes
    let tapete_inicial   = document.getElementById("inicial");

    // Mazos
    let mazo_inicial   = [];

    comenzar_juego();
    document.getElementById("reset").onclick = comenzar_juego;

    // Desarrollo del comienzo de juego
    function comenzar_juego() {

        mazo_inicial = [];

        for (let i = 0; i < numeros.length; i++) {
            for (let j = 0; j < palos.length; j++) {

                let carta  = document.createElement("img");
                carta.setAttribute("data-nombre", numeros[i]);
                carta.setAttribute("data-palo", palos[j]);
                carta.setAttribute("id", numeros[i] + '-' + palos[j]);
                carta.setAttribute("src", 'img/baraja/' + numeros[i] + '-' + palos[j] + '.png');

                if(palos[j] == "corazones" || palos[j] == "rombos") {
                    carta.setAttribute("data-color", "rojo");
                } else {
                    carta.setAttribute("data-color", "negro");
                }

                mazo_inicial.push(carta);

            }
        }

        // Barajar
        barajar(mazo_inicial);

        // Dejar mazo_inicial en tapete inicial
        cargar_tapete_inicial(mazo_inicial);

        // Arrancar el conteo de tiempo
        arrancar_tiempo();

    }

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Solitario</title>

Juego del solitario

        Tiempo:

        Movimientos:

    <button id="reset" class="btn btn-danger">Reiniciar</button>

The div that has id=inicial exists before the js link.

All tapetes are declared at the beginning of the js as global variables.

Script link is added at the end of the body.

Nevertheless, the code works and put me the cards in the correct div, but it annoys me to watch that error.

Can somebody solve this error?


问:
Microsoft Teams Adaptive Card Multiple Updates
Has anyone had experience submitting an adaptive card after it has had an update action performed on it?

Steps:

Send adaptive card to end user using a Power Automate Flow

User responds with a due date

Separate PA flow triggered on when the response to this card is submitted.

Update action performed on card to update due date from step two above.

The end user then fills out several additional fields in the same card.

The issue is with step five, when I go to submit the card at this step I get the error: "Unable to reach app. Please try again."

Steps:

Send adaptive card to end user using a Power Automate Flow

User responds with a due date

Separate PA flow triggered on when the response to this card is submitted.

Update action performed on card to update due date from step two above.

The end user then fills out several additional fields in the same card

End user submits card and I'm able to extract this data with the PA flow.


问:
How to send real time notification with socket.io in express
I want to send a real-time notification to the owner of the post when the post is liked. But, I don't really have an idea how to implement it into my React app and make it work. My notification function on the server side looks like this;

```<code>const Notification = require("../models/NotificationModel.js");
const { Server } = require("socket.io");

const io = new Server({
  cors: "clientURL",
});

const sendNotification = async ({
  sender,
  receiver,
  message,
  project,
  comment,
  challenge,
}) => {

  io.on("connection", (socket) => {
    socket.on("sendNotification", ({sender, receiver, message}) => {
      io.to(receiver.socketId).emit("getNotification", {
        sender,
        message
      })
    });
  });

  await Notification.create({
    message,
    sender,
    receiver,
    project,
    comment,
    challenge,
  });
};

module.exports = sendNotification;
</code>```

According to the OpenGPT client-side should look like this;

```<code>import React, { useEffect } from 'react';
import io from 'socket.io-client';

const socket = io('serverURL');

const MyComponent = () => {
  useEffect(() => {
    socket.on("getNotification", (data) => {
      // Handle the notification with the data from the server
    });
  }, []);

  return (
    // Render your component
  );
};
</code>```

Could you please point out all the wrongs in this snippet and provide the correct way to make these actions in sequence;

user likes a post -> server sends a notification to the owner of the post

Body:
I want to send a real-time notification to the owner of the post when the post is liked. But, I don't really have an idea how to implement it into my React app and make it work. My notification function on the server side looks like this;

const Notification = require("../models/NotificationModel.js");
const { Server } = require("socket.io");

const io = new Server({
  cors: "clientURL",
});

const sendNotification = async ({
  sender,
  receiver,
  message,
  project,
  comment,
  challenge,
}) => {

  io.on("connection", (socket) => {
    socket.on("sendNotification", ({sender, receiver, message}) => {
      io.to(receiver.socketId).emit("getNotification", {
        sender,
        message
      })
    });
  });

  await Notification.create({
    message,
    sender,
    receiver,
    project,
    comment,
    challenge,
  });
};

module.exports = sendNotification;

According to the OpenGPT client-side should look like this;

import React, { useEffect } from 'react';
import io from 'socket.io-client';

const socket = io('serverURL');

const MyComponent = () => {
  useEffect(() => {
    socket.on("getNotification", (data) => {
      // Handle the notification with the data from the server
    });
  }, []);

  return (
    // Render your component
  );
};

Could you please point out all the wrongs in this snippet and provide the correct way to make these actions in sequence;

user likes a post -> server sends a notification to the owner of the post


问:
Mbtiles - display offline map in HTML
Probably, you can help me.
I need to display a map of the current location.
This has to be an offline map.
I found that I can get a map of a specific country and download it. I downloaded it.
The downloaded file has an extension .mbtiles
If there is a way to get this file and show it on html5 .
Thanks.</p>

Title: Mbtiles - display offline map in HTML


问:
How do i get the slug of a specific products custom attribute in Woocommerce?
I've been working on this PHP snippet for a while and I am trying to get the custom attribute slug printed in a HTML div to later select it through its slug name.

The PHP code I've got this far is this

```<code>global $product;
if ( ! $product->is_type( 'simple' ) ) return;
$product_attribute_taxonomies = array( 'pa_tillverkningsland' );
$attr_output = array();

foreach( $product_attribute_taxonomies as $taxonomy ){
    if( taxonomy_exists($taxonomy) ){
        $label_name = wc_attribute_label( $taxonomy, $product );

        $term_names = $product->get_attribute( $taxonomy );
        $term_slug = $product->get_attribute( $taxonomy )->slug;

        if( ! empty($term_names) ){
            $attr_output[] = '<span>Tillverkad i '.$term_names.'</span>';
        }
    }
}
echo '<div class="origin '.$term_slug.'">'.implode( '', $attr_output ).'</div>';
</code>```

I successfully get the attribute and term name and label, the slug however. Different story. At the moment I'm just getting nothing, the HTML printed looks like this:

```<code><div class="origin ">
    <span>Tillverkad i Danmark</span>
</div>
</code>```

The slug should populate right after origin in the div.

I've searched the better part of SO for an answer, it got me somewhat to where I am right now but I can't seem to get further. Any ideas?

Body:
I've been working on this PHP snippet for a while and I am trying to get the custom attribute slug printed in a HTML div to later select it through its slug name.

The PHP code I've got this far is this

global $product;
if ( ! $product->is_type( 'simple' ) ) return;
$product_attribute_taxonomies = array( 'pa_tillverkningsland' );
$attr_output = array();

foreach( $product_attribute_taxonomies as $taxonomy ){
    if( taxonomy_exists($taxonomy) ){
        $label_name = wc_attribute_label( $taxonomy, $product );

        $term_names = $product->get_attribute( $taxonomy );
        $term_slug = $product->get_attribute( $taxonomy )->slug;

        if( ! empty($term_names) ){
            $attr_output[] = 'Tillverkad i '.$term_names.'';
        }
    }
}
echo '
'.implode( '', $attr_output ).'
';

I successfully get the attribute and term name and label, the slug however. Different story. At the moment I'm just getting nothing, the HTML printed looks like this:

    Tillverkad i Danmark

The slug should populate right after origin in the div.

I've searched the better part of SO for an answer, it got me somewhat to where I am right now but I can't seem to get further. Any ideas?


问:
How to trigger and customize PickerView programmatically in Swift?
I need to selection of PickerView transparent in Swift and trigger the date selection programmatically.

I made a layout from labels where I will show date, and when I tap those labels I need to trigger PickerView.

I have custom layout so I'm trying to implement this way, instead of customizing PickerView.

I tried to trigger it programmatically but it's not working:

```<code>datePicker.becomeFirstResponder()
</code>```

Also, I tried to make the PickerView text clear color or alpha 0, but neither of ways worked.

How it's showing:

(I want to hide or make transparent the black color date)

How it should be:

Body:
I need to selection of PickerView transparent in Swift and trigger the date selection programmatically.

I made a layout from labels where I will show date, and when I tap those labels I need to trigger PickerView.

I have custom layout so I'm trying to implement this way, instead of customizing PickerView.

I tried to trigger it programmatically but it's not working:

datePicker.becomeFirstResponder()

Also, I tried to make the PickerView text clear color or alpha 0, but neither of ways worked.

How it's showing:

(I want to hide or make transparent the black color date)

How it should be:


问:
Script with src="..." doesn't receive data
I have a problem, I'm trying to use the Google Drive API, and this is the important part of my code:

```<code><script src="https://apis.google.com/js/api.js"></script>
<script src="https://apis.google.com/js/client.js?onload=init"></script>
<script>
  function init() {
    console.log("init");
    [...]
  }
</script>
</code>```

The problem is that I don't see the "init" in the console, so the init() function doesn't run, I've checked the Network tab (in the inspect menu) and sure enough, both domains transfer 0 bytes.

I tried running it from an actual webserver and my Python localhost too. And I also tried putting these between all the scripts and they all show up in the console:

```<code><script>console.log("runs!");</script>
</code>```

What could cause this issue?

Body:
I have a problem, I'm trying to use the Google Drive API, and this is the important part of my code:

The problem is that I don't see the "init" in the console, so the init() function doesn't run, I've checked the Network tab (in the inspect menu) and sure enough, both domains transfer 0 bytes.

I tried running it from an actual webserver and my Python localhost too. And I also tried putting these between all the scripts and they all show up in the console:

What could cause this issue?


问:
Can I create svg drawings with flutter_svg?
If I have an app that creates svg drawings, can it be done with flutter using flutter_svg.</p>


问:
Trying to webscrape using Puppeteer in NodeJS. I keep getting this error while scraping however. I copied the XPATH of the element exactly how it is
TimeoutError: Waiting for selector .//*[@id="main-content"]/section[1]/div/div/section[1]/div/div[2]/section/div/ul[2]/li[1] failed: Waiting failed: 30000ms exceeded

This is the error I keep getting. I am copying the XPATH exactly how it is. I am currently trying to scrape job postings for fun on linkedin and this is the "job requirements" section. I am only trying to get the first list item and it keeps saying theres an error

Here is my code:

```<code>const puppeteer = require('puppeteer');
const xlsx = require('xlsx');

async function webScraper(url) {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();

    const JobLink = url;
    await page.goto(url);

    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h1')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[3]/span')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[1]/a')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[4]/span')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[2]/span')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[2]')
    **await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/div[2]/section/div/ul[2]/li[1]')**

    const [posName] = await page.$x('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h1')
    const posSrc = await posName.getProperty('textContent')
    const positionName = await posSrc.jsonValue();

    const [type] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[3]/span')
    const typeSrc = await type.getProperty('textContent')
    const JobType = await typeSrc.jsonValue();

    const [company] = await page.$x('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[1]/a')
    const companySrc = await company.getProperty('textContent')
    const companyName = await companySrc.jsonValue();

    const [industry] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[4]/span')
    const industrySrc = await industry.getProperty('textContent')
    const industryType = await industrySrc.jsonValue();

    const [comit] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[2]/span')
    const comitSrc = await comit.getProperty('textContent')
    const committment = await comitSrc.jsonValue();

    const [location] = await page.$x('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[2]')
    const locationSrc = await location.getProperty('textContent')
    const joblocation = await locationSrc.jsonValue();

   ** const [requirement] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/div[2]/section/div/ul[2]/li[1]')
    const requireSrc = await requirement.getProperty('textContent')
    const jobRequirements = await requireSrc.jsonValue();**

    return {positionName, JobType, JobLink, companyName, industryType, committment, joblocation, jobRequirements}

}
</code>```

I tried going to another job posting, but the XPATH is the exact same. Also I was wondering if there was anyway to make it so that if the browser isnt able to wait for an XPATH, it will just skip over it and continue on to the next piece of data since I have to restart my script everytime something like this happens.

Body:
TimeoutError: Waiting for selector .//*[@id="main-content"]/section[1]/div/div/section[1]/div/div[2]/section/div/ul[2]/li[1] failed: Waiting failed: 30000ms exceeded

This is the error I keep getting. I am copying the XPATH exactly how it is. I am currently trying to scrape job postings for fun on linkedin and this is the "job requirements" section. I am only trying to get the first list item and it keeps saying theres an error

Here is my code:

const puppeteer = require('puppeteer');
const xlsx = require('xlsx');

async function webScraper(url) {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();

    const JobLink = url;
    await page.goto(url);

    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h1')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[3]/span')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[1]/a')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[4]/span')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[2]/span')
    await page.waitForXPath('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[2]')
    **await page.waitForXPath('//*[@id="main-content"]/section[1]/div/div/section[1]/div/div[2]/section/div/ul[2]/li[1]')**

    const [posName] = await page.$x('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h1')
    const posSrc = await posName.getProperty('textContent')
    const positionName = await posSrc.jsonValue();

    const [type] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[3]/span')
    const typeSrc = await type.getProperty('textContent')
    const JobType = await typeSrc.jsonValue();

    const [company] = await page.$x('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[1]/a')
    const companySrc = await company.getProperty('textContent')
    const companyName = await companySrc.jsonValue();

    const [industry] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[4]/span')
    const industrySrc = await industry.getProperty('textContent')
    const industryType = await industrySrc.jsonValue();

    const [comit] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/ul/li[2]/span')
    const comitSrc = await comit.getProperty('textContent')
    const committment = await comitSrc.jsonValue();

    const [location] = await page.$x('//*[@id="main-content"]/section[1]/div/section[2]/div/div[1]/div/h4/div[1]/span[2]')
    const locationSrc = await location.getProperty('textContent')
    const joblocation = await locationSrc.jsonValue();

   ** const [requirement] = await page.$x('//*[@id="main-content"]/section[1]/div/div/section[1]/div/div[2]/section/div/ul[2]/li[1]')
    const requireSrc = await requirement.getProperty('textContent')
    const jobRequirements = await requireSrc.jsonValue();**

    return {positionName, JobType, JobLink, companyName, industryType, committment, joblocation, jobRequirements}

}

I tried going to another job posting, but the XPATH is the exact same. Also I was wondering if there was anyway to make it so that if the browser isnt able to wait for an XPATH, it will just skip over it and continue on to the next piece of data since I have to restart my script everytime something like this happens.