问:
Eigen matrices of boost rationals failing only in dimension 4
I'm trying to evaluate the determinants of certain small matrices exactly by using rational numbers with big integers for the numerator and denominator.
The boost multiprecision package provides a data type for this and Eigen will do linear algebra with custom scalar types.
Everything seems to work, except for 4D matrices!
Here's a minimal example:

#include <boost/multiprecision/cpp_int.hpp>
#include <Eigen/Dense>
#include <iostream>

using Rational = boost::multiprecision::cpp_rational;

template <size_t N>
Rational rational_test() {
    Eigen::Matrix<Rational, N, N> A;
    for (size_t i = 0; i < N; ++i)
        for (size_t j = 0; j < N; ++j)
            A(i, j) = Rational(1, 1 + i + j);
    return A.determinant();
}

int main() {
    std::cout << rational_test<2>() << "\n"
              << rational_test<3>() << "\n"
              // << rational_test<4>() << "\n"
              << rational_test<5>() << "\n";
    return 0;
}
```
<p>Un-commenting the line for the 4D test case triggers the compile error.
If I change it to instead do</p>
```    return A.partialPivLu().determinant();
```
<p>then the error goes away.
With some benchmarking in dimension 3, I get a performance hit of 4x, so while forcing it to use LU is an ok workaround for now, it's probably sacrificing performance.</p>
<p>I can copy the entire error message if need be but here's what I think is the operative part:</p>
```/usr/include/eigen3/Eigen/src/Core/GenericPacketMath.h:956:1: note:   template
argument deduction/substitution failed:
/usr/include/eigen3/Eigen/src/LU/Determinant.h:96:56: note:   deduced conflicti
ng types for parameter ‘const Packet’ (‘boost::multiprecision::detail::expressi
on<boost::multiprecision::detail::negate, boost::multiprecision::number<boost::
multiprecision::backends::rational_adaptor<boost::multiprecision::backends::cpp
_int_backend<> > >, void, void, void>’ and ‘Eigen::internal::determinant_impl<E
igen::Matrix<boost::multiprecision::number<boost::multiprecision::backends::rat
ional_adaptor<boost::multiprecision::backends::cpp_int_backend<> > >, 4, 4, 0,
4, 4>, 4>::Scalar’ {aka ‘boost::multiprecision::number<boost::multiprecision::b
ackends::rational_adaptor<boost::multiprecision::backends::cpp_int_backend<> >
>’})
   96 |     return internal::pmadd(m(i0,2), d0, internal::pmadd(-m(i1,2), d1, m
(i2,2)*d2));
      |                                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
~~~~~~~~~~
```

I'm wondering if there's some missing logic about how to static cast Rationals to other types, but I haven't got a clue what it needs to be.
The error doesn't go away when I add some shims recommended in the Eigen documentation for custom scalar types.
There's an example here of making Eigen work with Boost intervals that includes some template specializations of is_convertible that looks possibly relevant.

Body:
I'm trying to evaluate the determinants of certain small matrices exactly by using rational numbers with big integers for the numerator and denominator.
The boost multiprecision package provides a data type for this and Eigen will do linear algebra with custom scalar types.
Everything seems to work, except for 4D matrices!
Here's a minimal example:

#include <boost/multiprecision/cpp_int.hpp>
#include <Eigen/Dense>
#include <iostream>

using Rational = boost::multiprecision::cpp_rational;

template <size_t N>
Rational rational_test() {
    Eigen::Matrix<Rational, N, N> A;
    for (size_t i = 0; i < N; ++i)
        for (size_t j = 0; j < N; ++j)
            A(i, j) = Rational(1, 1 + i + j);
    return A.determinant();
}

int main() {
    std::cout << rational_test<2>() << "\n"
              << rational_test<3>() << "\n"
              // << rational_test<4>() << "\n"
              << rational_test<5>() << "\n";
    return 0;
}

Un-commenting the line for the 4D test case triggers the compile error.
If I change it to instead do

    return A.partialPivLu().determinant();

then the error goes away.
With some benchmarking in dimension 3, I get a performance hit of 4x, so while forcing it to use LU is an ok workaround for now, it's probably sacrificing performance.

I can copy the entire error message if need be but here's what I think is the operative part:

/usr/include/eigen3/Eigen/src/Core/GenericPacketMath.h:956:1: note:   template
argument deduction/substitution failed:
/usr/include/eigen3/Eigen/src/LU/Determinant.h:96:56: note:   deduced conflicti
ng types for parameter ‘const Packet’ (‘boost::multiprecision::detail::expressi
on<boost::multiprecision::detail::negate, boost::multiprecision::number<boost::
multiprecision::backends::rational_adaptor<boost::multiprecision::backends::cpp
_int_backend<> > >, void, void, void>’ and ‘Eigen::internal::determinant_impl<E
igen::Matrix<boost::multiprecision::number<boost::multiprecision::backends::rat
ional_adaptor<boost::multiprecision::backends::cpp_int_backend<> > >, 4, 4, 0,
4, 4>, 4>::Scalar’ {aka ‘boost::multiprecision::number<boost::multiprecision::b
ackends::rational_adaptor<boost::multiprecision::backends::cpp_int_backend<> >
>’})
   96 |     return internal::pmadd(m(i0,2), d0, internal::pmadd(-m(i1,2), d1, m
(i2,2)*d2));
      |                                         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
~~~~~~~~~~

I'm wondering if there's some missing logic about how to static cast Rationals to other types, but I haven't got a clue what it needs to be.
The error doesn't go away when I add some shims recommended in the Eigen documentation for custom scalar types.
There's an example here of making Eigen work with Boost intervals that includes some template specializations of is_convertible that looks possibly relevant.


来源: stackexchange

问:
Django Sub Filter Brings Same Datas with Main Filter
I am making very simple business directory. I wanna display a list of firms that belong to a particular city and district, and belong to a certain category. But district filter and city filter brings same datas. How can i fix this?
I filtered to district but again brings main city datas.
Where is my fault?

models.py

```<code>class City(models.Model):

        city = models.CharField(max_length=50)
        slug = models.SlugField()

        def __str__(self):
            return str(self.city)

class District(models.Model):

        district = models.CharField(max_length=50)
        slug = models.SlugField()
        city = models.ForeignKey(City, on_delete=models.CASCADE)

        def __str__(self):
            return str(self.district)

class FirmaCategory(models.Model):
    title = models.CharField(max_length=255)
    slug = models.SlugField()

    class Meta:
        verbose_name_plural = 'Firma Kategorileri'

    def __str__(self):
        return str(self.title)

class Firma(models.Model):
    category = models.ForeignKey(FirmaCategory, related_name="Firma", on_delete=models.CASCADE)
    title = models.CharField(max_length=255)
    slug = models.SlugField()
    adres = tinymce_models.HTMLField()
    tel = tinymce_models.HTMLField()
    website = tinymce_models.HTMLField()
    email = tinymce_models.HTMLField()
    intro = tinymce_models.HTMLField()
    body = tinymce_models.HTMLField()
    city = models.ForeignKey(City,related_name="FirmaCategory" ,on_delete=models.CASCADE)
    district = models.ForeignKey(District,related_name="FirmaCategory", on_delete=models.CASCADE)
    #url = models.CharField(max_length=255)

    date_added = models.DateTimeField(auto_now_add=True)

    class Meta:
        verbose_name_plural = 'Firmalar'

    def __str__(self):
        return str(self.title)

    def get_absolute_url(self):
        return reverse('firma-frontpage')
</code>```

views.py

```<code>def firmaana(request):
    firmalar = Firma.objects.all()
    context = {
        'firmalar': firmalar
    }
    return render(request, 'firma/firma-frontpage.html', context)

def firmadetail(request, slug):
    firmax = Firma.objects.get(slug=slug)
    context = {
        'firmax': firmax,
    }
    return render(request, 'firma/firma-detail.html', context)

def firmacategory(request, slug):
    firmacategory = FirmaCategory.objects.get(slug=slug)
    context = {
        'firmacategory': firmacategory
    }
    return render(request, 'firma/firma-category.html', context)

class FirmaEkle(CreateView):
    model = Firma
    form_class = FirmaForm
    template_name = 'firma/add_firma.html'

def firmacity(request, city_slug, category_slug):
    category = FirmaCategory.objects.get(slug=category_slug)
    try:
        city = City.objects.get(slug=city_slug)
        context = {
        "firma" : Firma.objects.filter(city=city)
        }
        return render(request, 'firma/city.html', context)
    except City.DoesNotExist:
         context = {
             "error" : "City does not exist"
         }
         return render(request, 'firma/city.html', context)

def firmadistrict(request, city_slug, dist_slug, category_slug):
    category = FirmaCategory.objects.get(slug=category_slug)
    city = City.objects.get(slug=city_slug)
    if city is not None:
        district = District.objects.filter(city=city)
        if district is not None:
            firms = Firma.objects.filter(district__in=district)
            context = {
                "firms" :firms
            }
            return render(request, 'firma/district.html', context)

    context = {
        "error" : "Error in city/district"
    }
    return render(request, 'firma/district.html', context)

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am making very simple business directory. I wanna display a list of firms that belong to a particular city and district, and belong to a certain category. But district filter and city filter brings same datas. How can i fix this?
I filtered to district but again brings main city datas.
Where is my fault?

models.py

class City(models.Model):

        city = models.CharField(max_length=50)
        slug = models.SlugField()

        def __str__(self):
            return str(self.city)

class District(models.Model):

        district = models.CharField(max_length=50)
        slug = models.SlugField()
        city = models.ForeignKey(City, on_delete=models.CASCADE)

        def __str__(self):
            return str(self.district)

class FirmaCategory(models.Model):
    title = models.CharField(max_length=255)
    slug = models.SlugField()

    class Meta:
        verbose_name_plural = 'Firma Kategorileri'

    def __str__(self):
        return str(self.title)

class Firma(models.Model):
    category = models.ForeignKey(FirmaCategory, related_name="Firma", on_delete=models.CASCADE)
    title = models.CharField(max_length=255)
    slug = models.SlugField()
    adres = tinymce_models.HTMLField()
    tel = tinymce_models.HTMLField()
    website = tinymce_models.HTMLField()
    email = tinymce_models.HTMLField()
    intro = tinymce_models.HTMLField()
    body = tinymce_models.HTMLField()
    city = models.ForeignKey(City,related_name="FirmaCategory" ,on_delete=models.CASCADE)
    district = models.ForeignKey(District,related_name="FirmaCategory", on_delete=models.CASCADE)
    #url = models.CharField(max_length=255)

    date_added = models.DateTimeField(auto_now_add=True)

    class Meta:
        verbose_name_plural = 'Firmalar'

    def __str__(self):
        return str(self.title)

    def get_absolute_url(self):
        return reverse('firma-frontpage')

views.py

def firmaana(request):
    firmalar = Firma.objects.all()
    context = {
        'firmalar': firmalar
    }
    return render(request, 'firma/firma-frontpage.html', context)

def firmadetail(request, slug):
    firmax = Firma.objects.get(slug=slug)
    context = {
        'firmax': firmax,
    }
    return render(request, 'firma/firma-detail.html', context)

def firmacategory(request, slug):
    firmacategory = FirmaCategory.objects.get(slug=slug)
    context = {
        'firmacategory': firmacategory
    }
    return render(request, 'firma/firma-category.html', context)

class FirmaEkle(CreateView):
    model = Firma
    form_class = FirmaForm
    template_name = 'firma/add_firma.html'

def firmacity(request, city_slug, category_slug):
    category = FirmaCategory.objects.get(slug=category_slug)
    try:
        city = City.objects.get(slug=city_slug)
        context = {
        "firma" : Firma.objects.filter(city=city)
        }
        return render(request, 'firma/city.html', context)
    except City.DoesNotExist:
         context = {
             "error" : "City does not exist"
         }
         return render(request, 'firma/city.html', context)

def firmadistrict(request, city_slug, dist_slug, category_slug):
    category = FirmaCategory.objects.get(slug=category_slug)
    city = City.objects.get(slug=city_slug)
    if city is not None:
        district = District.objects.filter(city=city)
        if district is not None:
            firms = Firma.objects.filter(district__in=district)
            context = {
                "firms" :firms
            }
            return render(request, 'firma/district.html', context)

    context = {
        "error" : "Error in city/district"
    }
    return render(request, 'firma/district.html', context)


问:
Angular Js version 1.4 - While running a build with gulp command to deploy receiving error Cannot read property '0' of null in commit.js file
I am new to angular js. My project is using Angular js version 1.4 and to deploy the build we are using gulp. While gulp deploy production in my local machine I am receiving the error as follows :

```<code>/home/sites/Project_Name/node_modules/gift/lib/commit.js:145
  ref1 = /^.+? (.*) (\d+) .*$/.exec(line), m = ref1[0], actor = ref1[1], epoch = ref1[2];
                                                   ^

TypeError: Cannot read property '0' of null
    at Function.module.exports.Commit.actor (/home/sites/Project_Name/node_modules/gift/lib/commit.js:145:56)
    at Function.module.exports.Commit.parse_commits (/home/sites/Project_Name/node_modules/gift/lib/commit.js:111:21)
    at /home/sites/Project_Name/node_modules/gift/lib/commit.js:71:39
    at ChildProcess.exithandler (child_process.js:285:7)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:198:13)
    at Pipe._handle.close (net.js:607:12)
</code>```

I am not sure whats the issue is because I don't see any kind of specific structure followed for commit messages already been there on the repository for a very long.

Body:
I am new to angular js. My project is using Angular js version 1.4 and to deploy the build we are using gulp. While gulp deploy production in my local machine I am receiving the error as follows :

/home/sites/Project_Name/node_modules/gift/lib/commit.js:145
  ref1 = /^.+? (.*) (\d+) .*$/.exec(line), m = ref1[0], actor = ref1[1], epoch = ref1[2];
                                                   ^

TypeError: Cannot read property '0' of null
    at Function.module.exports.Commit.actor (/home/sites/Project_Name/node_modules/gift/lib/commit.js:145:56)
    at Function.module.exports.Commit.parse_commits (/home/sites/Project_Name/node_modules/gift/lib/commit.js:111:21)
    at /home/sites/Project_Name/node_modules/gift/lib/commit.js:71:39
    at ChildProcess.exithandler (child_process.js:285:7)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:198:13)
    at Pipe._handle.close (net.js:607:12)

I am not sure whats the issue is because I don't see any kind of specific structure followed for commit messages already been there on the repository for a very long.


问:
How in CMake add aditional folders for headers to source code include path
Im have INTERFACE library libA, what include some headers, used by main project.

```<code>/-
/ --- LibA
/ --- --- CMakeLists.txt
/ --- --- include/
/ --- --- --- my_lib_header.h
/ --- Project
/ --- --- CMakeLists.txt
/ --- --- main.c
</code>```
```<code>LibA CMakeLists.txt

add_library(my_lib INTERFACE)
target_include_directories(my_lib INTERFACE ./include)
</code>```
```<code>Project CMakeLists.txt

add_executable(project main.c)
target_link_libraries(project INTERFACE my_lib)
</code>```

I want to my_lib header files have additional directory in include path.

```<code>main.c

#include "myLib/my_lib_header.h"

int main()
{

}
</code>```

The root of problem - im linked external library to my project. This library in most use cases have his own folder with inludes #include <lib/lib_header.h>. But in my case i have all headers in global scope #include <lib_header.h> and cant understand how it depends on CMake code.

Body:
Im have INTERFACE library libA, what include some headers, used by main project.

/-
/ --- LibA
/ --- --- CMakeLists.txt
/ --- --- include/
/ --- --- --- my_lib_header.h
/ --- Project
/ --- --- CMakeLists.txt
/ --- --- main.c

LibA CMakeLists.txt

add_library(my_lib INTERFACE)
target_include_directories(my_lib INTERFACE ./include)

Project CMakeLists.txt

add_executable(project main.c)
target_link_libraries(project INTERFACE my_lib)

I want to my_lib header files have additional directory in include path.

main.c

#include "myLib/my_lib_header.h"

int main()
{

}

The root of problem - im linked external library to my project. This library in most use cases have his own folder with inludes #include <lib/lib_header.h>. But in my case i have all headers in global scope #include <lib_header.h> and cant understand how it depends on CMake code.


问:
Exclude jar from tomcat/lib folder
I have a tomcat server with 10 apps.

Yesterday we did an update of our jdbc driver into tomcat/lib folder.

The new version works fine for 9 apps but not the 10th because the code is too outdated

Until we evolve the code too , i want for a specific app to exclude the jdbc driver loaded during runtime from tomcat/lib folder but instead pick the old one compatible in WEB-INF/lib folder.

I tired many things but it seems that the lib into tomcat folder has always the highest priority so the old driver in WEB-INF/lib is ignored

In context.xml i tried postResources and preResources in order to alter classpath during app runtime but it's not working :/

Any advices ? Thank you very much

```<code><Context reloadable="true">
<Resources>
  <PreResources base="/usr/local/myapp-web/WEB-INF/lib/ojdbc6-11.2.0.2.0.jar"
                 className="org.apache.catalina.webresources.FileResourceSet"
                 webAppMount="/WEB-INF/lib/ojdbc6-11.2.0.2.0.jar"/>
</Resources>
</Context>
</code>```

Title: Exclude jar from tomcat/lib folder

Body:
I have a tomcat server with 10 apps.

Yesterday we did an update of our jdbc driver into tomcat/lib folder.

The new version works fine for 9 apps but not the 10th because the code is too outdated

Until we evolve the code too , i want for a specific app to exclude the jdbc driver loaded during runtime from tomcat/lib folder but instead pick the old one compatible in WEB-INF/lib folder.

I tired many things but it seems that the lib into tomcat folder has always the highest priority so the old driver in WEB-INF/lib is ignored

In context.xml i tried postResources and preResources in order to alter classpath during app runtime but it's not working :/

Any advices ? Thank you very much

<Context reloadable="true">
<Resources>
  <PreResources base="/usr/local/myapp-web/WEB-INF/lib/ojdbc6-11.2.0.2.0.jar"
                 className="org.apache.catalina.webresources.FileResourceSet"
                 webAppMount="/WEB-INF/lib/ojdbc6-11.2.0.2.0.jar"/>
</Resources>
</Context>


问:
How do I count number of unique log messages in DataDog
I'm trying to make a dashboard in DataDog to count the number of certain log messages we get. I want to filter out duplicates though. My log messages look something along the lines of:

Something specific happened for user with email example@email.com

We often get multiple of these same messages for the same user but I only want a count for unique messages.

I've found that I can almost get what I want using the Pattern Inspector which gives me a list of unique emails and the counts for each email but it doesn't let me export that data to a dashboard. It also won't give me the count of the unique logs.

The one other similar question I found on SO was dependent on the values being in a facet rather than the actual log message so it wasn't useful unfortunately.


问:
Flappy Bird (NEAT) AI outputs Going in the wrong direction
I made flappy using the NEAT AI and the I finally got the game to run with NEAT. The problem is that with the 100 birds I made their either going diagonally up or down and not going through the pipes at all. in the part of my code where I define the outputs, I have the bird distance from the top, bottom, and middle of the pipe its closest to and currently looking at it I dont see what the problem is:

```<code># FINDING THE INDEX OF THE PIPE THATS IN FRONT OF THE BIRD
        pipe_ind = 0
        if len(birds) > 0:
            if len(pipes) > 1 and birds[0].x > pipes[0].pipe_bottom_rect.centerx + pipes[0].pipe_top.get_width():
                pipe_ind = 1
        else:
            run == False
            break

        # GIVING THE NETWORK DISTANCE OF THE BIRD TO THE TOP BOTTOM AND MIDDLE OF THE PIPE
        for x, bird in enumerate(birds):
            bird.move()
            ge[x].fitness += 0.1

            output = nets[x].activate((bird.y, abs(bird.y - pipes[pipe_ind].height - 200), abs(bird.y - pipes[pipe_ind].height)))

            if output[0] > 0.5:
                bird.jump()
</code>```

With 3 distances it should give the bird proper guidance to go through the pipes but it makes all my birds end up going in one of two directions. Is it because I'm using absolute values? I'm new to using neat so i'm still learning as I go along.

Full GitHub Repo:
https://github.com/sharktankful/Flappy_Bird_AI

Body:
I made flappy using the NEAT AI and the I finally got the game to run with NEAT. The problem is that with the 100 birds I made their either going diagonally up or down and not going through the pipes at all. in the part of my code where I define the outputs, I have the bird distance from the top, bottom, and middle of the pipe its closest to and currently looking at it I dont see what the problem is:

# FINDING THE INDEX OF THE PIPE THATS IN FRONT OF THE BIRD
        pipe_ind = 0
        if len(birds) > 0:
            if len(pipes) > 1 and birds[0].x > pipes[0].pipe_bottom_rect.centerx + pipes[0].pipe_top.get_width():
                pipe_ind = 1
        else:
            run == False
            break

        # GIVING THE NETWORK DISTANCE OF THE BIRD TO THE TOP BOTTOM AND MIDDLE OF THE PIPE
        for x, bird in enumerate(birds):
            bird.move()
            ge[x].fitness += 0.1

            output = nets[x].activate((bird.y, abs(bird.y - pipes[pipe_ind].height - 200), abs(bird.y - pipes[pipe_ind].height)))

            if output[0] > 0.5:
                bird.jump()

With 3 distances it should give the bird proper guidance to go through the pipes but it makes all my birds end up going in one of two directions. Is it because I'm using absolute values? I'm new to using neat so i'm still learning as I go along.

Full GitHub Repo:
https://github.com/sharktankful/Flappy_Bird_AI


问:
Databricks cluster Java libraries getting uninstalled on Terraform runs with unrelated changes
I'm using Databricks provider 1.6.5 for Terraform to deploy clusters like this:

resource "databricks_cluster" "super" {
  for_each                  = toset([ "dev", "prod" ])
  cluster_name              = "${each.key}-Cluster"
  spark_version             = data.databricks_spark_version.latest_lts.id
  autotermination_minutes   = 20
  driver_node_type_id       = "r5.2xlarge"
  node_type_id              = "i3.2xlarge"
  enable_elastic_disk       = true

  autoscale {
    min_workers = 1
    max_workers = 8
  }

  spark_conf = {
    "spark.databricks.io.cache.enabled" : true,
    "spark.driver.memory": "45G"
    "spark.sql.autoBroadcastJoinThreshold": -1
  }

  spark_env_vars = each.key == "dev" ? {} : {
    DD_API_KEY = "{{secrets/datadog/datadog_API_key}}"
    DD_ENV = "Databricks-Prod"
    DD_SITE = "https://app.datadoghq.com"
  }

  aws_attributes {
    first_on_demand         = 8
    availability            = "SPOT_WITH_FALLBACK"
    zone_id                 = data.aws_availability_zones.available.names[0]
    spot_bid_price_percent  = 100
    ebs_volume_type         = "GENERAL_PURPOSE_SSD"
    ebs_volume_count        = 1
    ebs_volume_size         = 100
  }

  custom_tags = var.tags

  dynamic "library" {
    for_each = var.databricks_pypi_libraries
    content {
        pypi {
          package = library.value
        }
      }
  }

  init_scripts {
    dbfs {
      destination = "dbfs:/init-scripts/datadog-install-driver-only-v2.sh"
    }
  }

  cluster_log_conf {
    dbfs {
      destination = "dbfs:/cluster-logs"
    }
  }
}

resource "databricks_dbfs_file" "iceberg" {
  source = "${path.module}/jars/iceberg-spark-runtime-3.3_2.12-1.0.0.jar"
  path   = "/FileStore/jars/iceberg_spark_runtime_3.3_2.12_1.0.0.jar"
}

resource "databricks_library" "iceberg" {
  for_each    = toset([ "dev", "prod" ])
  cluster_id  = databricks_cluster.super[each.key].id
  jar         = databricks_dbfs_file.iceberg.dbfs_path
}

resource "databricks_dbfs_file" "hadoop-aws" {
  source = "${path.module}/jars/hadoop-aws-3.3.4.jar"
  path   = "/FileStore/jars/hadoop_aws_3.3.4.jar"
}

resource "databricks_library" "hadoop-aws" {
  for_each    = toset([ "dev", "prod" ])
  cluster_id  = databricks_cluster.super[each.key].id
  jar         = databricks_dbfs_file.hadoop-aws.dbfs_path
}

```
<p>Sometimes, I make a small change in this resource, say, changing a spark env var from plain-text to a Databricks secret and I try to re-run terraform but it seems to want to reinstall all the libraries:</p>
<pre class="lang-hcl prettyprint-override"><code># module.super-clusters.databricks_cluster.super["prod"] will be updated in-place
  ~ resource "databricks_cluster" "super" {
        id                           = "1122-180908-gh1ahrr7"
      ~ spark_env_vars               = {
          # Warning: this attribute value will no longer be marked as sensitive
          # after applying this change. The value is unchanged.
          ~ "DD_API_KEY" = (sensitive)
            # (2 unchanged elements hidden)
        }
        # (15 unchanged attributes hidden)

      - library {

          - pypi {
              - package = "SentencePiece" -> null
            }
        }
      - library {

          - pypi {
              - package = "boto3" -> null
            }
        }

...
      - library {
          - jar = "dbfs:/FileStore/jars/hadoop_aws_3.3.4.jar" -> null
        }
      - library {
          - jar = "dbfs:/FileStore/jars/iceberg_spark_runtime_3.3_2.12_1.0.0.jar" -> null
        }
      + library {

          + pypi {
              + package = "SentencePiece"
            }
        }
      + library {

          + pypi {
              + package = "boto3"
            }
        }
...
        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.
</code>```

(The 2 to change here refers to 2 clusters, I've only shown one above for brevity).

As you can see, it's uninstalling and reinstalling all the python libraries, but it is only uninstalling the Java libraries and not even reinstalling them. Any clue as to why Terraform should even be touching the libraries when the change I've made is in a completely unrelated part of the terraform code? Is this a bug in the provider?

Body:
I'm using Databricks provider 1.6.5 for Terraform to deploy clusters like this:

resource "databricks_cluster" "super" {
  for_each                  = toset([ "dev", "prod" ])
  cluster_name              = "${each.key}-Cluster"
  spark_version             = data.databricks_spark_version.latest_lts.id
  autotermination_minutes   = 20
  driver_node_type_id       = "r5.2xlarge"
  node_type_id              = "i3.2xlarge"
  enable_elastic_disk       = true

  autoscale {
    min_workers = 1
    max_workers = 8
  }

  spark_conf = {
    "spark.databricks.io.cache.enabled" : true,
    "spark.driver.memory": "45G"
    "spark.sql.autoBroadcastJoinThreshold": -1
  }

  spark_env_vars = each.key == "dev" ? {} : {
    DD_API_KEY = "{{secrets/datadog/datadog_API_key}}"
    DD_ENV = "Databricks-Prod"
    DD_SITE = "https://app.datadoghq.com"
  }

  aws_attributes {
    first_on_demand         = 8
    availability            = "SPOT_WITH_FALLBACK"
    zone_id                 = data.aws_availability_zones.available.names[0]
    spot_bid_price_percent  = 100
    ebs_volume_type         = "GENERAL_PURPOSE_SSD"
    ebs_volume_count        = 1
    ebs_volume_size         = 100
  }

  custom_tags = var.tags

  dynamic "library" {
    for_each = var.databricks_pypi_libraries
    content {
        pypi {
          package = library.value
        }
      }
  }

  init_scripts {
    dbfs {
      destination = "dbfs:/init-scripts/datadog-install-driver-only-v2.sh"
    }
  }

  cluster_log_conf {
    dbfs {
      destination = "dbfs:/cluster-logs"
    }
  }
}

resource "databricks_dbfs_file" "iceberg" {
  source = "${path.module}/jars/iceberg-spark-runtime-3.3_2.12-1.0.0.jar"
  path   = "/FileStore/jars/iceberg_spark_runtime_3.3_2.12_1.0.0.jar"
}

resource "databricks_library" "iceberg" {
  for_each    = toset([ "dev", "prod" ])
  cluster_id  = databricks_cluster.super[each.key].id
  jar         = databricks_dbfs_file.iceberg.dbfs_path
}

resource "databricks_dbfs_file" "hadoop-aws" {
  source = "${path.module}/jars/hadoop-aws-3.3.4.jar"
  path   = "/FileStore/jars/hadoop_aws_3.3.4.jar"
}

resource "databricks_library" "hadoop-aws" {
  for_each    = toset([ "dev", "prod" ])
  cluster_id  = databricks_cluster.super[each.key].id
  jar         = databricks_dbfs_file.hadoop-aws.dbfs_path
}

Sometimes, I make a small change in this resource, say, changing a spark env var from plain-text to a Databricks secret and I try to re-run terraform but it seems to want to reinstall all the libraries:

# module.super-clusters.databricks_cluster.super["prod"] will be updated in-place
  ~ resource "databricks_cluster" "super" {
        id                           = "1122-180908-gh1ahrr7"
      ~ spark_env_vars               = {
          # Warning: this attribute value will no longer be marked as sensitive
          # after applying this change. The value is unchanged.
          ~ "DD_API_KEY" = (sensitive)
            # (2 unchanged elements hidden)
        }
        # (15 unchanged attributes hidden)

      - library {

          - pypi {
              - package = "SentencePiece" -> null
            }
        }
      - library {

          - pypi {
              - package = "boto3" -> null
            }
        }

...
      - library {
          - jar = "dbfs:/FileStore/jars/hadoop_aws_3.3.4.jar" -> null
        }
      - library {
          - jar = "dbfs:/FileStore/jars/iceberg_spark_runtime_3.3_2.12_1.0.0.jar" -> null
        }
      + library {

          + pypi {
              + package = "SentencePiece"
            }
        }
      + library {

          + pypi {
              + package = "boto3"
            }
        }
...
        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

(The 2 to change here refers to 2 clusters, I've only shown one above for brevity).

As you can see, it's uninstalling and reinstalling all the python libraries, but it is only uninstalling the Java libraries and not even reinstalling them. Any clue as to why Terraform should even be touching the libraries when the change I've made is in a completely unrelated part of the terraform code? Is this a bug in the provider?


问:
Fatal error: Uncaught TypeError: xml_parse(): Argument #1 ($parser) must be of type XMLParser, null given
The following warning has been triggered after upgrading to PHP 8:

Fatal error: Uncaught TypeError: xml_parse(): Argument #1 ($parser) must be of type XMLParser, null given

This relates to the following line of code:

return xml_parse($this->parser, $data, true) ? $this->document : NULL;

The whole function code is:

class WGGXML{
var $parser;   #a reference to the XML parser
var $document; #the entire XML structure built up so far
var $parent;   #a pointer to the current parent - the parent will be an array
var $stack;    #a stack of the most recent parent at each nesting level
var $last_opened_tag; #keeps track of the last tag opened.
function WGGXML(){
$this->parser = &xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'open','close');
xml_set_character_data_handler($this->parser, 'data');
}
function destruct(){ xml_parser_free($this->parser); }
function parse(&$data){
$this->document = array();
$this->stack    = array();
$this->parent   = &$this->document;
return xml_parse($this->parser, $data, true) ? $this->document : NULL;
}

Struggling to work out how to make the above PHP 8 compatible.

Rolled back to PHP 7.4 and all worked fine.

Any ideas on how to modify the above code to make it PHP 8.0 compatible?


问:
Customize search filter .NET Core 6
I am creating a project in .NET 6 with Entity Framework. The idea is to create a search engine that filters by expiration date, for that I had thought that if the expiration date is less than today it should return an expired certificate, otherwise, it should filter the records it finds

For that I made a function in the controller, which I tested manually assigning dates and everything seems to be fine. My problem is that I don't know how to save the date into a variable to be able to use it in the if condition, I feel a little confused and my question is, am I doing it right? Should I try another way? Or if it's ok, how can I get the date to assign to a variable?

Controller

```<code>public async Task<IActionResult> Index(string searchString)
{
    DateTime today = DateTime.Now;

    IQueryable<Personal> personal = _db.Personal;

    DateTime date1 = new DateTime(2009, 8, 1, 0, 0, 0);
    DateTime date2 = new DateTime(2023, 8, 1, 0, 0, 0);

    if (searchString != null)
    {
        if (date1 < today)
        {
            return View("Views/Home/Index.cshtml");
        }
        else
        {
            personal = personal.Where(s => s.Rut!.Contains(searchString));
        }
    }

    return View(await personal.ToListAsync());
}
</code>```

I also tried creating these variables to be able to assign the date in the if, but when debugging the date it does not take the value and leaves it by default (01/01/0001 0:00:00).

I would really appreciate your help, thanks

```<code>Personal p = new Personal();
var fecha = p.FechaCertificado;
</code>```

Title: Customize search filter .NET Core 6

Body:
I am creating a project in .NET 6 with Entity Framework. The idea is to create a search engine that filters by expiration date, for that I had thought that if the expiration date is less than today it should return an expired certificate, otherwise, it should filter the records it finds

For that I made a function in the controller, which I tested manually assigning dates and everything seems to be fine. My problem is that I don't know how to save the date into a variable to be able to use it in the if condition, I feel a little confused and my question is, am I doing it right? Should I try another way? Or if it's ok, how can I get the date to assign to a variable?

Controller

public async Task<IActionResult> Index(string searchString)
{
    DateTime today = DateTime.Now;

    IQueryable<Personal> personal = _db.Personal;

    DateTime date1 = new DateTime(2009, 8, 1, 0, 0, 0);
    DateTime date2 = new DateTime(2023, 8, 1, 0, 0, 0);

    if (searchString != null)
    {
        if (date1 < today)
        {
            return View("Views/Home/Index.cshtml");
        }
        else
        {
            personal = personal.Where(s => s.Rut!.Contains(searchString));
        }
    }

    return View(await personal.ToListAsync());
}

I also tried creating these variables to be able to assign the date in the if, but when debugging the date it does not take the value and leaves it by default (01/01/0001 0:00:00).

I would really appreciate your help, thanks

Personal p = new Personal();
var fecha = p.FechaCertificado;


问:
xpath for this element

<input aria-expanded="false" aria-owns="IA_REF_SRC_MAIN_id__listbox" aria-autocomplete="list" aria-describedby="IA_REF_SRC_MAIN_id__assistiveHint" autocomplete="off" class="autocomplete__input autocomplete__input--show-all-values" id="IA_REF_SRC_MAIN_id" name="input-autocomplete" placeholder="" type="text" role="combobox"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" class="autocomplete__dropdown-arrow-down" focusable="false"><g stroke="none" fill="none" fill-rule="evenodd"><polygon fill="#000000" points="0 0 22 0 11 17"></polygon></g></svg>

AIU (appointment)

AIU (walk-in)

Enforcement (lorry drop)

Enforcement (other)

IA Request (Migrant help)

IA Request (other)

Kent intake unit

Midlands intake unit

Migrant Refusal Pool

Other Government Department

Other referral source

Police

Port (documented)

Port (undocumented)

Prison Service

ROM

Self Referral

Third Country Unit (TCU)

UKVI (FHU)

UKVI (Other)

UKVI (Special Project)

When autocomplete results are available use up and down arrows to review and enter to select.  Touch device users, explore by touch or with swipe gestures.

```
```@FindBy(id = "IA_REF_SRC_MAIN_id")
```
<p>and error</p>
```org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"
```

Title: xpath for this element

Body:
<input aria-expanded="false" aria-owns="IA_REF_SRC_MAIN_id__listbox" aria-autocomplete="list" aria-describedby="IA_REF_SRC_MAIN_id__assistiveHint" autocomplete="off" class="autocomplete__input autocomplete__input--show-all-values" id="IA_REF_SRC_MAIN_id" name="input-autocomplete" placeholder="" type="text" role="combobox"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" class="autocomplete__dropdown-arrow-down" focusable="false"><g stroke="none" fill="none" fill-rule="evenodd"><polygon fill="#000000" points="0 0 22 0 11 17"></polygon></g></svg>

AIU (appointment)

AIU (walk-in)

Enforcement (lorry drop)

Enforcement (other)

IA Request (Migrant help)

IA Request (other)

Kent intake unit

Midlands intake unit

Migrant Refusal Pool

Other Government Department

Other referral source

Police

Port (documented)

Port (undocumented)

Prison Service

ROM

Self Referral

Third Country Unit (TCU)

UKVI (FHU)

UKVI (Other)

UKVI (Special Project)

When autocomplete results are available use up and down arrows to review and enter to select.  Touch device users, explore by touch or with swipe gestures.

@FindBy(id = "IA_REF_SRC_MAIN_id")

and error

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"


问:
When specifying a second Y axis in ggplot2 using sec.axis(), can I write only custom ticks?
I'm plotting a line graph and scatter graph simultaneously using ggplot, specifying the second axis with sec.axis() and the transformation parameter.  The second axis is scaled to show -10 to 10.  Instead of -10,-5,0,5,10, I would like only 2,6 and 10 to be plotted.  But I have no idea how to do this just for the second axis.  This is my code.</p>
```<code>a = ggplot(df1)+
  geom_line(aes(x = Time, y = Rate))+
  geom_polygon(data = df2, mapping = aes(x = rev(x), y = y, alpha = 0.5))+
  coord_cartesian(ylim = c(0,3))+
  geom_vline(xintercept=66, linetype="dashed", color = "red")+
  geom_point(data = df3,mapping = aes(x = rev(x), y = y))+
  scale_y_continuous(

    # Features of the first axis
    name = "Rate",

    # Add a second axis and specify its features
    sec.axis = sec_axis( trans=~.*(20/3)-10, name="Bayes factor support")
  ) +

  scale_x_reverse()
a
</code>```

Body:
I'm plotting a line graph and scatter graph simultaneously using ggplot, specifying the second axis with sec.axis() and the transformation parameter.  The second axis is scaled to show -10 to 10.  Instead of -10,-5,0,5,10, I would like only 2,6 and 10 to be plotted.  But I have no idea how to do this just for the second axis.  This is my code.

a = ggplot(df1)+
  geom_line(aes(x = Time, y = Rate))+
  geom_polygon(data = df2, mapping = aes(x = rev(x), y = y, alpha = 0.5))+
  coord_cartesian(ylim = c(0,3))+
  geom_vline(xintercept=66, linetype="dashed", color = "red")+
  geom_point(data = df3,mapping = aes(x = rev(x), y = y))+
  scale_y_continuous(

    # Features of the first axis
    name = "Rate",

    # Add a second axis and specify its features
    sec.axis = sec_axis( trans=~.*(20/3)-10, name="Bayes factor support")
  ) +

  scale_x_reverse()
a


问:
Package structure for functions with multiple possible outcomes
I am maintaining and upgrading a not so small internal package in R and would appreciate some tips and opinions on best practices to maintain functions with many possible scenarios.

An example:

Suppose I have a function that does some computations on an object, but these computations can be done using several techniques, which I'll call "type" for simplicity, with each technique having multiple settings parameters to it. (They each have default values, I jsut used some numbers for simplification.)

For instance:

```<code>foo <- function(x, type = c("a", "b", "c"),
                param1_a = 1, param2_a = 2, param1_b = 3, param1_c = 4, param2_c = 5){
   type <- match.arg(type)
   ### some common computations here

   if(type == "a"){
      ### computations using type "a"
   }
   else if(type == "b"){
      ### computations using type "b"
   }
   else if(type == "c"){
      ### computations using type "c"
   }
}
</code>```

Now this seems not good, so what I did was to change some things, such as creating individual functions for each type and setting the parameters in each function definition, instead of on the main function:

```<code>foo <- function(x, type = c("a", "b", "c"), ...){
   type <- match.arg(type)
   ### some common computations here

   if(type == "a"){
      foo_a(x, ...)
   }
   else if(type == "b"){
      foo_b(x, ...)
   }
   else if(type == "c"){
      foo_c(x, ...)
   }
}

foo_a <- function(x, param1_a = 1, param2_a = 2){
   ### computations using type "a"
}

foo_a <- function(x, param1_b = 3){
   ### computations using type "b"
}

foo_c <- function(x, param1_c = 4, param2_c = 5){
   ### computations using type "c"
}
</code>```

What I am interested in learning is:
Is this usually considered best practices in maintaining these type of functions in a package?
If not, then I'd gladly take any tips, suggestions or reading material on the best (or better) ways to oganize it.

Body:
I am maintaining and upgrading a not so small internal package in R and would appreciate some tips and opinions on best practices to maintain functions with many possible scenarios.

An example:

Suppose I have a function that does some computations on an object, but these computations can be done using several techniques, which I'll call "type" for simplicity, with each technique having multiple settings parameters to it. (They each have default values, I jsut used some numbers for simplification.)

For instance:

foo <- function(x, type = c("a", "b", "c"),
                param1_a = 1, param2_a = 2, param1_b = 3, param1_c = 4, param2_c = 5){
   type <- match.arg(type)
   ### some common computations here

   if(type == "a"){
      ### computations using type "a"
   }
   else if(type == "b"){
      ### computations using type "b"
   }
   else if(type == "c"){
      ### computations using type "c"
   }
}

Now this seems not good, so what I did was to change some things, such as creating individual functions for each type and setting the parameters in each function definition, instead of on the main function:

foo <- function(x, type = c("a", "b", "c"), ...){
   type <- match.arg(type)
   ### some common computations here

   if(type == "a"){
      foo_a(x, ...)
   }
   else if(type == "b"){
      foo_b(x, ...)
   }
   else if(type == "c"){
      foo_c(x, ...)
   }
}

foo_a <- function(x, param1_a = 1, param2_a = 2){
   ### computations using type "a"
}

foo_a <- function(x, param1_b = 3){
   ### computations using type "b"
}

foo_c <- function(x, param1_c = 4, param2_c = 5){
   ### computations using type "c"
}

What I am interested in learning is:
Is this usually considered best practices in maintaining these type of functions in a package?
If not, then I'd gladly take any tips, suggestions or reading material on the best (or better) ways to oganize it.


问:
Facing error when formatting hdfs namenode
I have already added the required java home in hadoop-env.sh.

```<code>adminn@hadoop-master:~$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/jre
adminn@hadoop-master:~$
</code>```

Body:
I have already added the required java home in hadoop-env.sh.

adminn@hadoop-master:~$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/jre
adminn@hadoop-master:~$


问:
R AOV giving different p-values compared to graphpad prism?
I'm running an ANOVA in R using aov, so I can analyze a lot of data at once. I've picked out a few samples to ensure accuracy, and my prism p-values are different than the ones I'm getting in R. My ANOVA in prism is not repeated measures.

I saw this question:

Multitest p-values are different compared to graphpad prism?

But I'm not using statsmodel/python.

In R in doing:

```<code>analy$genotype <- as.character(for.analy$genotype)
analy$diet <- as.character(for.analy$diet)
analy$gene <- as.numeric(for.analy$gene)

interaction <- aov(gene ~ diet*genotype, data = analy)
summary(interaction)
</code>```

This gives me:

```<code>              Df    Sum Sq  Mean Sq F value Pr(>F)
diet           1     34164    34164   0.012 0.9121
genotype       1       261      261   0.000 0.9923
diet:genotype  1  12808573 12808573   4.611 0.0361 *
Residuals     56 155556948  2777803
</code>```

While in graphpad prism I get:

```<code>ANOVA table SS (Type III)   DF  MS      F (DFn, DFd)        P value
    Interaction 2852813     1   2852813 F (1, 56) = 1.043   P=0.3115
    Diet        12752869    1   12752869F (1, 56) = 4.663   P=0.0351
    Genotype    60058       1   60058   F (1, 56) = 0.02196 P=0.8827
    Residual    153146125   56  2734752
</code>```

Thanks!

Body:
I'm running an ANOVA in R using aov, so I can analyze a lot of data at once. I've picked out a few samples to ensure accuracy, and my prism p-values are different than the ones I'm getting in R. My ANOVA in prism is not repeated measures.

I saw this question:

Multitest p-values are different compared to graphpad prism?

But I'm not using statsmodel/python.

In R in doing:

analy$genotype <- as.character(for.analy$genotype)
analy$diet <- as.character(for.analy$diet)
analy$gene <- as.numeric(for.analy$gene)

interaction <- aov(gene ~ diet*genotype, data = analy)
summary(interaction)

This gives me:

              Df    Sum Sq  Mean Sq F value Pr(>F)
diet           1     34164    34164   0.012 0.9121
genotype       1       261      261   0.000 0.9923
diet:genotype  1  12808573 12808573   4.611 0.0361 *
Residuals     56 155556948  2777803

While in graphpad prism I get:

ANOVA table SS (Type III)   DF  MS      F (DFn, DFd)        P value
    Interaction 2852813     1   2852813 F (1, 56) = 1.043   P=0.3115
    Diet        12752869    1   12752869F (1, 56) = 4.663   P=0.0351
    Genotype    60058       1   60058   F (1, 56) = 0.02196 P=0.8827
    Residual    153146125   56  2734752

Thanks!


问:
Payflow Pro Legacy NVP API Sandbox issue
Good day,

We recently started experiencing an error accross certain customers in their Sandbox environments.

The error we are receiving is returning a result code = 0 with an RESPMSG = Approved: 10747 - The IP Address provided is invalid. It appears to only be affecting accounts who's payment processor is setup to use PayPal Internet Merchant Account.

Wondering why we are receiving this error and what is the cause?

Hoping that if a change was made on Paypal's end that we get to the bottom of this before they push the change that caused this issue to production.

We utilize paypals transparent redirect functionality which falls under the hosted checkout service to 'tokenize' customer credit cards via a securetoken/securetokenid combination. We then use the resulting PNREF to perform referenced transactions via the Payflow Pro NVP legacy API from our backend server. We perform authorizations then delay capture them at time of invoicing. The issue above that we are seeing is occuring when we attempt to 'tokenize' the credit card. What is odd is that we are receiving a result code = 0 which implies paypal payment gateway thinks things are fine but in the respmsg field (which based on past experience is often used to pass additional messages from the payment processor to the end user) contains conflicting verbiage. It starts with "Approved:" which is what we are used to seeing and implying that everything is fine, followed by an error code from one of your newer APIs (10747 - The IP Address provided is invalid) which implies that there is an issue/error that occured.

Anyone else experiencing the same or have any ideas? Greatly appreciated!


问:
Hamiltonian Cycle using iterative approach (DFS?)
I am trying to implement backtracking algorithm of finding a Hamiltonian Cycle - using stack instead of recursion, like in DFS. However, I can't figure out how to implement backtracking properly. The problem with my code is that at some point when there is no vertex to go to, instead of deleting the whole false path it keeps poping vertexes from the stack, and builds path incorrectly, ignoring, like, "levels" - number of available adjacent vertices, it goes for the previous level with previous set of vertices.
There's another StackOverflow question with similar problem ("https://stackoverflow.com/questions/72594661/find-all-hamiltonian-cycles-using-bfs") - however there's no solution here.
I've tried to implement the level approach - when if current level is invalid we step back - but failed. Any ideas? Help!
Here is code, pseudo.</p>
```<code> bool HamiltonianCycle_It(vector<vector<int>>& G, vector<int> &path) {
        vector<bool> used(G.size(), false);
        stack<int> s;
        vector<int> level (G.size(), 0);
        int levelI = 0;
        s.push(0);
        while (!s.empty()) {
            int cr= s.top();
            s.pop();
            path.push_back(cr);

            if (path.size() == G.size()) {
                if (G[path[0]][ path[path.size() - 1]] == 1) {
                        path.push_back((path[0]));
                        return true;
                }
                path.pop_back();
                used[cr] = false;
                continue;
            }

            used[curr_vertex] = true;
            for (int i = 0; i < G.size(); i++) {
                if (G[cr][i] == 1 && used[i] == false) {
                    s.push(i);
                    level[levelI]++;

                }
            }
           if(level[levelI] == 0){
           level[levelI-1] --;
           levelI--;
           path.pop_back();
           used[cr] = false
              }
           else levelI++;

        }

        return false;
    }
};
</code>```

Body:
I am trying to implement backtracking algorithm of finding a Hamiltonian Cycle - using stack instead of recursion, like in DFS. However, I can't figure out how to implement backtracking properly. The problem with my code is that at some point when there is no vertex to go to, instead of deleting the whole false path it keeps poping vertexes from the stack, and builds path incorrectly, ignoring, like, "levels" - number of available adjacent vertices, it goes for the previous level with previous set of vertices.
There's another StackOverflow question with similar problem ("https://stackoverflow.com/questions/72594661/find-all-hamiltonian-cycles-using-bfs") - however there's no solution here.
I've tried to implement the level approach - when if current level is invalid we step back - but failed. Any ideas? Help!
Here is code, pseudo.

 bool HamiltonianCycle_It(vector<vector<int>>& G, vector<int> &path) {
        vector<bool> used(G.size(), false);
        stack<int> s;
        vector<int> level (G.size(), 0);
        int levelI = 0;
        s.push(0);
        while (!s.empty()) {
            int cr= s.top();
            s.pop();
            path.push_back(cr);

            if (path.size() == G.size()) {
                if (G[path[0]][ path[path.size() - 1]] == 1) {
                        path.push_back((path[0]));
                        return true;
                }
                path.pop_back();
                used[cr] = false;
                continue;
            }

            used[curr_vertex] = true;
            for (int i = 0; i < G.size(); i++) {
                if (G[cr][i] == 1 && used[i] == false) {
                    s.push(i);
                    level[levelI]++;

                }
            }
           if(level[levelI] == 0){
           level[levelI-1] --;
           levelI--;
           path.pop_back();
           used[cr] = false
              }
           else levelI++;

        }

        return false;
    }
};


问:
Unable to load Teams on Windows 10

I see the following error when Teams starts up:

When we start Docker Application

Something went wrongCreating "rootNode" subnodes: constructing "BackendServices" in "rootNode": doing migrations: reading actual settings: invalid character '\x00' looking for beginning of value

I have tried uninstalling/re-installing, restarting my computer, etc.

Title: Unable to load Teams on Windows 10


问:
bad argument #1 to 'pairs' (table expected, got nil)
so, I'm trying to fix this bug, but I'm completely stuck, so if anyone has any ideas, please share your option with me. Mistake: gamemodes/starwarsrp/gamemode/modules/chars/sv_player.lua:4: bad argument #1 to 'pairs' (table expected, got nil)</p>
```<code>function pMeta:CharacterByID(character_id)
    for i, char in pairs(self.Characters) do
        if char.character_id == character_id then
            return char
        end
    end

    return false
end
</code>```

Body:
so, I'm trying to fix this bug, but I'm completely stuck, so if anyone has any ideas, please share your option with me. Mistake: gamemodes/starwarsrp/gamemode/modules/chars/sv_player.lua:4: bad argument #1 to 'pairs' (table expected, got nil)

function pMeta:CharacterByID(character_id)
    for i, char in pairs(self.Characters) do
        if char.character_id == character_id then
            return char
        end
    end

    return false
end


问:
Apache serve service from local host on subdomain
I am trying to use Apache to serve multiple sites at the same time, the structure I want to obtain is composed by a main site at example.com and use the subdomains radarr.example.com and sonarr.example.com to access my Radarr and Sonarr servers.

The main site is hosted on machine1, I set up a virtual host using apache and certbot:

```<code><IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerName example.com

  WSGIDaemonProcess sflasksite user=www-data group=www-data threads=5
  WSGIScriptAlias / /var/www/webapp/app.wsgi

  <Directory /var/www/webapp>
    WSGIProcessGroup sflasksite
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Require all granted
  </Directory>

  Alias /static /var/www/webapp/static

  <Directory /var/www/webapp/static/>
    Order deny,allow
    Require all granted
  </Directory>

  ErrorLog /var/www/webapp/logs/error.log
  CustomLog /var/www/webapp/logs/access.log combined

SSLCertificateFile /etc/letsencrypt/live/example.com-0002/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com-0002/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
</code>```

The two servers I want to serve are on machine2, on the same network as machine1, how can I obtain the two services respectively on radarr.example.com and sonarr.example.com?

After some reading, I tried to use a Reverse Proxy, configuring a virtual host for each service as follows:

```<code><VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off

  ServerAlias radarr.example.com

  ProxyPass / http://192.168.1.20:7878/
  ProxyPassReverse / http://192.168.1.20:7878/

  ErrorLog /var/www/radarr/logs/error.log
  CustomLog /var/www/radarr/logs/access.log combined
</VirtualHost>
</code>```

and alike for Sonarr.

However, when I navigate to radarr.example.com, I do not get the expected service but the main site.

How can I get the reverse proxy to work? Or should I switch to another strategy altogether?

Body:
I am trying to use Apache to serve multiple sites at the same time, the structure I want to obtain is composed by a main site at example.com and use the subdomains radarr.example.com and sonarr.example.com to access my Radarr and Sonarr servers.

The main site is hosted on machine1, I set up a virtual host using apache and certbot:

<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerName example.com

  WSGIDaemonProcess sflasksite user=www-data group=www-data threads=5
  WSGIScriptAlias / /var/www/webapp/app.wsgi

  <Directory /var/www/webapp>
    WSGIProcessGroup sflasksite
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Require all granted
  </Directory>

  Alias /static /var/www/webapp/static

  <Directory /var/www/webapp/static/>
    Order deny,allow
    Require all granted
  </Directory>

  ErrorLog /var/www/webapp/logs/error.log
  CustomLog /var/www/webapp/logs/access.log combined

SSLCertificateFile /etc/letsencrypt/live/example.com-0002/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com-0002/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

The two servers I want to serve are on machine2, on the same network as machine1, how can I obtain the two services respectively on radarr.example.com and sonarr.example.com?

After some reading, I tried to use a Reverse Proxy, configuring a virtual host for each service as follows:

<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off

  ServerAlias radarr.example.com

  ProxyPass / http://192.168.1.20:7878/
  ProxyPassReverse / http://192.168.1.20:7878/

  ErrorLog /var/www/radarr/logs/error.log
  CustomLog /var/www/radarr/logs/access.log combined
</VirtualHost>

and alike for Sonarr.

However, when I navigate to radarr.example.com, I do not get the expected service but the main site.

How can I get the reverse proxy to work? Or should I switch to another strategy altogether?


问:
Background printing on Android MAUI app without showing the UI for printer selection
All, I am working on a mobile app POC using .Net Maui where we have a requirement to print a page in background. I am able to write the platform specific code to print on Android, however whenever the print job is fired, the screen to select the printer pops up. I want to pass the default printer when printing the page and do not want the user to select the printer everytime, as there will be lot of printing involved in the process. We want the printing to be a background process without any user intervention.
I would like to know how to achieve this on .Net Maui Android mobile app using .Net Maui or otherwise.

I tried looking if there is way to pass the default printer when calling the print job on Android, but could not find any option.

Below is what I did so far

Created a partial class to print

In platform specific folder for Android, I added below code for printing

```<code>     Context context = Platform.CurrentActivity;

     Android.Webkit.WebView  webView = new Android.Webkit.WebView(context);

     PrintManager printManager = context.GetSystemService(MainActivity.PrintService).JavaCast<PrintManager>();

     string htmlData = "test";
     webView.LoadData(htmlData, null, null);

     string jobName = "test";
     PrintAttributes printAttribute = new PrintAttributes.Builder()
                                         .SetMediaSize(PrintAttributes.MediaSize.NaLetter)
                                         .Build();

     printManager.Print(jobName, webView.CreatePrintDocumentAdapter("test"), printAttribute);
</code>```

Body:
All, I am working on a mobile app POC using .Net Maui where we have a requirement to print a page in background. I am able to write the platform specific code to print on Android, however whenever the print job is fired, the screen to select the printer pops up. I want to pass the default printer when printing the page and do not want the user to select the printer everytime, as there will be lot of printing involved in the process. We want the printing to be a background process without any user intervention.
I would like to know how to achieve this on .Net Maui Android mobile app using .Net Maui or otherwise.

I tried looking if there is way to pass the default printer when calling the print job on Android, but could not find any option.

Below is what I did so far

Created a partial class to print

In platform specific folder for Android, I added below code for printing

     Context context = Platform.CurrentActivity;

     Android.Webkit.WebView  webView = new Android.Webkit.WebView(context);

     PrintManager printManager = context.GetSystemService(MainActivity.PrintService).JavaCast<PrintManager>();

     string htmlData = "test";
     webView.LoadData(htmlData, null, null);

     string jobName = "test";
     PrintAttributes printAttribute = new PrintAttributes.Builder()
                                         .SetMediaSize(PrintAttributes.MediaSize.NaLetter)
                                         .Build();

     printManager.Print(jobName, webView.CreatePrintDocumentAdapter("test"), printAttribute);


问:
Create folder wise structure in Delta Format on HDFS
I am consuming kafka data having "eventtime" (datetime) field in the packet. I want to create hdfs directories in "year/month/day" structure in streaming based on the date part of the eventtime field .

I am using delta-core_2.11:0.6.1, Spark : 2.4 versions

Example :

```<code>    /temp/deltalake/data/project_1/2022/12/1
    /temp/deltalake/data/project_1/2022/12/2
    .
    .
    and so on.
</code>```

The thing I found nearest to my requirement was : partitionBy(Keys) in delta lake documentation.

That will create the data in this format : /temp/deltalake/data/project_1/year=2022/month=12/day=1

```<code>data.show() :
+----+-------+-----+-------+---+-------------------+----------+
|S_No|section| Name|   City|Age|          eventtime|      date|
+----+-------+-----+-------+---+-------------------+----------+
|   1|      a|Name1| Indore| 25|2022-02-10 23:30:14|2022-02-10|
|   2|      b|Name2|  Delhi| 25|2021-08-12 10:50:10|2021-08-12|
|   3|      c|Name3| Ranchi| 30|2022-12-10 15:00:00|2022-12-10|
|   4|      d|Name4|Kolkata| 30|2022-05-10 00:30:00|2022-05-10|
|   5|      e|Name5| Mumbai| 30|2022-07-01 10:32:12|2022-07-01|
+----+-------+-----+-------+---+-------------------+----------+

data
  .write
  .format("delta")
  .mode("overwrite")
  .option("mergeSchema", "true")
  .partitionBy(Keys)
  .save("/temp/deltalake/data/project_1/")
</code>```

But this too didn't work. I referred to this below medium article:
https://medium.com/@aravinthR/partitioned-delta-lake-part-3-5cc52b64ebda

Would be great if anyone can help me out in figuring out a possible solution.

Body:
I am consuming kafka data having "eventtime" (datetime) field in the packet. I want to create hdfs directories in "year/month/day" structure in streaming based on the date part of the eventtime field .

I am using delta-core_2.11:0.6.1, Spark : 2.4 versions

Example :

    /temp/deltalake/data/project_1/2022/12/1
    /temp/deltalake/data/project_1/2022/12/2
    .
    .
    and so on.

The thing I found nearest to my requirement was : partitionBy(Keys) in delta lake documentation.

That will create the data in this format : /temp/deltalake/data/project_1/year=2022/month=12/day=1

data.show() :
+----+-------+-----+-------+---+-------------------+----------+
|S_No|section| Name|   City|Age|          eventtime|      date|
+----+-------+-----+-------+---+-------------------+----------+
|   1|      a|Name1| Indore| 25|2022-02-10 23:30:14|2022-02-10|
|   2|      b|Name2|  Delhi| 25|2021-08-12 10:50:10|2021-08-12|
|   3|      c|Name3| Ranchi| 30|2022-12-10 15:00:00|2022-12-10|
|   4|      d|Name4|Kolkata| 30|2022-05-10 00:30:00|2022-05-10|
|   5|      e|Name5| Mumbai| 30|2022-07-01 10:32:12|2022-07-01|
+----+-------+-----+-------+---+-------------------+----------+

data
  .write
  .format("delta")
  .mode("overwrite")
  .option("mergeSchema", "true")
  .partitionBy(Keys)
  .save("/temp/deltalake/data/project_1/")

But this too didn't work. I referred to this below medium article:
https://medium.com/@aravinthR/partitioned-delta-lake-part-3-5cc52b64ebda

Would be great if anyone can help me out in figuring out a possible solution.


问:
How can I toggle the button in real time when liking and disliking?
It seemed like something that'd be straightforward to accomplish, but I'm kind of struggling with this. The current behavior with the code below correctly increments likes/dislikes on each photo upon clicking any specific photo, but not the like/dislike state upon clicking which's what needs to be done to toggle between the Like and Dislike buttons.

Just like the functionality as Instagram - How can I make it so that the green like button (success) is displayed when the respective photo isn't liked.

And similarly, display the red dislike button (danger) when the respective photo is liked?

Below I tried to only use the setUserClickedLike() hook in both handleLike() and handleDislike() but it doesn't work.

const Grid = () => {
  let authToken = localStorage.getItem("token");

  const [gridData, setGridData] = useState([]);

  // User clicks likes
  const [userLikedPhotos, setUserLikedPhotos] = useState({});

  const [userClickedLike, setUserClickedLike] = useState(false);
  const [userClickedDislike, setUserClickedDisliked] = useState(false);

  useEffect(() => {
    const headers = {
      Accept: "application/json",
      Authorization: `Bearer ${authToken}`,
    };

    axios
      .get("http://127.0.0.1:8000/api/get-user-uploads-data", { headers })
      .then((resp) => {
        console.log(resp.data);
        setGridData(resp.data);
      })
      .catch((err) => {
        console.log(err);
      });
  }, []);

  const handleLike = (likedPhotoUserId, userName, likedPhotoId) => {
    const url = "http://127.0.0.1:8000/api/like";

    const headers = {
      Accept: "application/json",
      Authorization: `Bearer ${authToken}`,
    };

    let data = {
      UserID: likedPhotoUserId,
      userName: userName,
      likedPhotoId: likedPhotoId,
    };

    userLikedPhotos[likedPhotoUserId] = true;

    gridData.find(function (photo) {
      setUserClickedLike(photo.UserID === likedPhotoUserId);
      return photo.UserID === likedPhotoUserId;
    }).likes++;

    axios
      .post(url, data, { headers })
      .then((resp) => {
        setDataFromUserLikesTable(resp.data);
      })
      .catch((err) => {
        console.log(err);
      });

    setUserLikedPhotos({ ...userLikedPhotos });
  };

  const handleDislike = (likedPhotoUserId, userName, likedPhotoId) => {
    const url = "http://127.0.0.1:8000/api/dislike";

    const headers = {
      Accept: "application/json",
      Authorization: `Bearer ${authToken}`,
    };

    let data = {
      UserID: likedPhotoUserId,
      userName: userName,
      dislikedPhotoId: likedPhotoId,
    };

    // dislike
    delete userLikedPhotos[likedPhotoUserId];
    gridData.find(function (photo) {
      setUserClickedLike(photo.UserID === likedPhotoUserId);
      return photo.UserID === likedPhotoUserId;
    }).likes--;

    axios
      .post(url, data, { headers })
      .then((resp) => {
        console.log(resp.data);
      })
      .catch((err) => {
        console.log(err);
      });

    setUserLikedPhotos({ ...userLikedPhotos });
  };

  return (
    <>

          {gridData.map((photos, index) => {
            return (
              <>

                  ❤ {photos.likes}

                  {!photos.is_liked && !userClickedLike ? (
                    <Button
                      variant="success"
                      onClick={() =>
                        handleLike(
                          photos.UserID,
                          photos.name,
                          photos.photo_id,
                          photos.is_liked
                        )
                      }
                    >
                      Like
                    </Button>
                  ) : (
                    <Button
                      variant="danger"
                      onClick={() =>
                        handleDislike(
                          photos.UserID,
                          photos.name,
                          photos.photo_id,
                          photos.is_liked
                        )
                      }
                    >
                      Dislike
                    </Button>
                  )}

              </>
            );
          })}

    </>
  );
};

export default Grid;
```


问:
Bootstrap nav get push off screen when i click a leaflet.js easy button
I have the following HTML:

```<code><nav class="navbar navbar-expand-lg navbar-dark bg-dark py-4 px-4">
    <div class="container-fluid">
      <a class="navbar-brand" href="#">
        Gazetteer App
      </a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDarkDropdown" aria-controls="navbarNavDarkDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarNavDarkDropdown">
        <ul class="navbar-nav">
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle fs-4" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
              Countries
            </a>
            <ul class="dropdown-menu dropdown-menu-dark " id="menu">
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
              <li><a class="dropdown-item" href="#"Test</a></li>
              <li><a class="dropdown-item" href="#">Test</a></li>
            </ul>
          </li>
        </ul>
      </div>
    </div>
  </nav>

    <main>
      <div id="map"></div>

      <!--Modal 1-->
      <div class="modal fade modal-1" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
          <div class="modal-content">
            <div class="modal-header">
              <h1 class="modal-title fs-5" id="staticBackdropLabel">About: Country Name</h1>
              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
              <ul>
                <li id="capital">Capital:</li>
                <li id="population">Population:</li>
                <li id="iso2">ISO 2:</li>
                <li id="iso3">ISO 3:</li>
              </ul>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
            </div>
          </div>
        </div>
      </div>
    </main>
</code>```

And the following CSS:

```<code>*,*::before,*::after{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body{
    overflow: hidden;
}

.navbar-brand{
    letter-spacing: 2.5px;
    color: lightgreen;
}

li{
    list-style: none;
}

#map{
    height: 800px;
}

#weather-icon{
    background-color: lightslategray;
    border-radius: 50%;
}
</code>```

My problem is when i increase the size of the map so that the whole screen consists of the nav and the top and the map covering the remaining whitespace whenever i click the leaflet.js easy button to display a bootstrap modal the map moves up and covers the navbar.

enter image description here

enter image description here

I tried setting very precise height values for the #map so that the modal is displayed and the navbar isn't pushed off.

I don't know if theirs something simple I'm missing or if i need to do some hacky to achieve the outcome I'm looking for.

Any help would be great, thanks.

Body:
I have the following HTML:

        Gazetteer App

      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDarkDropdown" aria-controls="navbarNavDarkDropdown" aria-expanded="false" aria-label="Toggle navigation">

      </button>

              Countries

Test

Test

Test

Test

Test

Test

Test

<a class="dropdown-item" href="#"Test

Test

About: Country Name

              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>

Capital:

Population:

ISO 2:

ISO 3:

              <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>

And the following CSS:

*,*::before,*::after{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body{
    overflow: hidden;
}

.navbar-brand{
    letter-spacing: 2.5px;
    color: lightgreen;
}

li{
    list-style: none;
}

#map{
    height: 800px;
}

#weather-icon{
    background-color: lightslategray;
    border-radius: 50%;
}

My problem is when i increase the size of the map so that the whole screen consists of the nav and the top and the map covering the remaining whitespace whenever i click the leaflet.js easy button to display a bootstrap modal the map moves up and covers the navbar.

enter image description here

enter image description here

I tried setting very precise height values for the #map so that the modal is displayed and the navbar isn't pushed off.

I don't know if theirs something simple I'm missing or if i need to do some hacky to achieve the outcome I'm looking for.

Any help would be great, thanks.


问:
HTTP communication error between ReactJS frontend and Grails and SpringBoot backend
I don't know what exactly is happening but, suddenly my React front end web application started receving this error while trying to coneect to my spring security protected endpoints.

```<code>Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
Failed to load resource: net::ERR_CONNECTION_CLOSED
</code>```

In my backend, when I try to access via Insomnia Rest Client, I do receive the message.

```<code>Error: Stream error in the HTTP/2 framing layer
</code>```

I did not modified the application, neither backend nor frontend.

And it is interesting to say that it only happens while accessing endpoint which neeed authentication. In the public endpoint it does not happen.

It seems to be some update concerning the version of HTTP protocol, and I don't know how to fix it.

I have micro services in the backend in Grails 4.0.3 and SpringBoot.

Any suggestions? Could anyone help me.

Thanks.

Alfredo

Body:
I don't know what exactly is happening but, suddenly my React front end web application started receving this error while trying to coneect to my spring security protected endpoints.

Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
Failed to load resource: net::ERR_CONNECTION_CLOSED

In my backend, when I try to access via Insomnia Rest Client, I do receive the message.

Error: Stream error in the HTTP/2 framing layer

I did not modified the application, neither backend nor frontend.

And it is interesting to say that it only happens while accessing endpoint which neeed authentication. In the public endpoint it does not happen.

It seems to be some update concerning the version of HTTP protocol, and I don't know how to fix it.

I have micro services in the backend in Grails 4.0.3 and SpringBoot.

Any suggestions? Could anyone help me.

Thanks.

Alfredo


问:
Pupeteer generate non tagged SVG path elements in PDF
I generate a PDF from HTML page sent to pupeteer in small nodeJs app. The generation is ok.

My goal is to make that PDF pass the WCAG2 "PAC 2021" testing tool (https://pdfua.foundation/en/pdf-accessibility-checker-pac).

So I had tagged every elements of my html page from WCAG2 specifications.
But it seems that the <path> tag of each SVG raise an error as "non tagged item". As pupeteer generate SVG for many elements (like borders) and also as I want to print highcharts graph, it is a real problem that makes crash the validation of the tool.

So I tried to tag every path object in my HTML page and I also tagged the parent SVG like this :

```<code><svg focusable="false" role="img" aria-describedby="desc_svg" aria-labelledby="title_svg" width="335" height="335" viewBox="0 0 335 335" fill="none" xmlns="http://www.w3.org/2000/svg">
    <title id="title_svg">The title of the SVG</title>
    <desc id="desc_svg">The description of the SVG</desc>
    <path aria-hidden="true" role="presentation" fill-rule="evenodd" clip-rule="evenodd" d="M131" fill="#2E404F"/>
</svg>
</code>```

I tried to make the SVG compliant by folowing these guidelines :

https://css-tricks.com/accessible-svgs/#aa-2-inline-svg

https://a11y-guidelines.orange.com/en/articles/accessible-svg/

https://www.smashingmagazine.com/2021/05/accessible-svg-patterns-comparison/

Nothing seems to work, accessibility error is still poping on these tagged items.

Is anybody faced the same problem ?

Body:
I generate a PDF from HTML page sent to pupeteer in small nodeJs app. The generation is ok.

My goal is to make that PDF pass the WCAG2 "PAC 2021" testing tool (https://pdfua.foundation/en/pdf-accessibility-checker-pac).

So I had tagged every elements of my html page from WCAG2 specifications.
But it seems that the <path> tag of each SVG raise an error as "non tagged item". As pupeteer generate SVG for many elements (like borders) and also as I want to print highcharts graph, it is a real problem that makes crash the validation of the tool.

So I tried to tag every path object in my HTML page and I also tagged the parent SVG like this :

<svg focusable="false" role="img" aria-describedby="desc_svg" aria-labelledby="title_svg" width="335" height="335" viewBox="0 0 335 335" fill="none" xmlns="http://www.w3.org/2000/svg">
    <title id="title_svg">The title of the SVG</title>
    <desc id="desc_svg">The description of the SVG</desc>
    <path aria-hidden="true" role="presentation" fill-rule="evenodd" clip-rule="evenodd" d="M131" fill="#2E404F"/>
</svg>

I tried to make the SVG compliant by folowing these guidelines :

https://css-tricks.com/accessible-svgs/#aa-2-inline-svg

https://a11y-guidelines.orange.com/en/articles/accessible-svg/

https://www.smashingmagazine.com/2021/05/accessible-svg-patterns-comparison/

Nothing seems to work, accessibility error is still poping on these tagged items.

Is anybody faced the same problem ?


问:
Loader video stopped working after several successful plays
I am trying to have a video play before the site loads. After a few successful reloads, the video stopped playing and I cannot get it to work again. I am not sure why this is happening as it did work a couple times initially! I followed the instructions in this video but am not getting the same results (yes, my loader content is different than theirs). Please help! Thanks!

HTML:

```<code><html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>My Website</title>
    <link rel="stylesheet" href="style.css">
    <link rel="icon" href="./favicon.ico" type="image/x-icon">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

  </head>
  <body>

      <div class="loaderWrap">
        <span class="loader">
          <span class="loader-inner">
            <div class="content">
              <video autoplay>
                <source src="video_source.mp4" type="video/mp4">
                Your browser does not support the video tag.
              </video>
            </div>
          </span>
        </span>
      </div>

      <h1>HELLO WORLD</h1>

    <script>
    window.addEventListener("load",function () {
    const loader = document.querySelector(".loader");
    loader.loaderWrap += " hidden"; // class hidden loader
    });
  </script>

  </body>
</html>
</code>```

CSS:

```<code>h1 {
    color: black;
    font-family: sans-serif;
}

body {
    background-color: black;
}

.content{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.loaderWrap {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader{
    display: inline-block;
    width: 100%;
    height: 100%;
    position: relative;
    background-color: black;
    animation: loader-inner 2s infinite ease-in;
}

.loader-inner{
    vertical-align: top;
    display: inline-block;
    width: 100%;
    background-color: black;
    animation: loader-inner 2s infinite ease-in;
}
</code>```

Body:
I am trying to have a video play before the site loads. After a few successful reloads, the video stopped playing and I cannot get it to work again. I am not sure why this is happening as it did work a couple times initially! I followed the instructions in this video but am not getting the same results (yes, my loader content is different than theirs). Please help! Thanks!

HTML:

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>My Website</title>
    <link rel="stylesheet" href="style.css">
    <link rel="icon" href="./favicon.ico" type="image/x-icon">

              <video autoplay>
                <source src="video_source.mp4" type="video/mp4">
                Your browser does not support the video tag.
              </video>

HELLO WORLD

CSS:

h1 {
    color: black;
    font-family: sans-serif;
}

body {
    background-color: black;
}

.content{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.loaderWrap {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader{
    display: inline-block;
    width: 100%;
    height: 100%;
    position: relative;
    background-color: black;
    animation: loader-inner 2s infinite ease-in;
}

.loader-inner{
    vertical-align: top;
    display: inline-block;
    width: 100%;
    background-color: black;
    animation: loader-inner 2s infinite ease-in;
}


问:
YITH Membership / Subscription - How to check if user has any active subscriptions / memberships?
I have YITH Membership + Subscription plugins together, and shop has virtual downloadable products. When Membership / Subscription is active and user has access to a single product, then on a single product page is widget with available downloads – for free or for credits.

How to check if user has access to a single product? It doesn’t matter if can download or not, just if subscription / membership for a product is active. I couldn’t find any solution. I found only this function bellow, but even if I passed proper user ID and product ID to it, this “subscriptions” array is empty, so it says “no active subscriptions” and it’s not truth. I use this code in functions.php

Subscription or membership can be checked, as they both together can be active or not.

https://erlycoder.com/how-to-check-active-subscription-using-yith-woocommerce-subscription/

I added function „CheckStatus” to functions.php and checked if product_id and user_id have values, but subscriptions array is still empty.


问:
How to mock firebase/auth method createUserWithEmailAndPassword and firebase/firestore method addDoc in Redux Toolkit async thunk?
I'm trying to test redux async thunk using Jest. In this thunk I call two firebase methods, so I want to mock them in my test. But mocked methods return undefined instead of objects specified in the mocked implementation. So mocks are being applied in the process of test execution, but values they should return are somehow ignored. What am I doing wrong?

userSlice.test.js

```<code>import {registerUser} from '../slices/userSlice';

const mockedСreateUserWithEmailAndPassword = jest.fn();
mockedСreateUserWithEmailAndPassword.mockImplementationOnce(() => Promise.resolve({ user: { refreshToken: '123', uid: '321' } }));

const mockedAddDoc = jest.fn();
mockedAddDoc.mockImplementation(() => Promise.resolve({ doc: {id: '333'} }));

jest.mock('firebase/firestore', () => ({
  ...jest.requireActual('firebase/firestore'),
  addDoc: () => mockedAddDoc,
}));

jest.mock('firebase/auth', () => ({
  ...jest.requireActual('firebase/auth'),
  createUserWithEmailAndPassword: () => mockedСreateUserWithEmailAndPassword,
}));

describe('registerUser thunk', () => {
  it('should register user with resolved response', async () => {

    const dispatch = jest.fn();
    const thunk = registerUser({
    name: 'TestName',
    surname: 'TestSurname',
    email: 'test@test.com',
    password: 'testPassword'
  },
)

await thunk (dispatch, () => {}, () => {});
const [start, end] = dispatch.mock.calls;
expect(start[1].type).toBe('user/registerUser/fulfilled');

  })
})

</code>```

userSlice.js

```<code>import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import { createUserWithEmailAndPassword, getAuth } from "firebase/auth";
import db, { firebaseApp } from './../../firebase';
import { collection,  addDoc} from "firebase/firestore";

firebaseApp;
const authdata = getAuth();

const initialState = {
  email: null,
  token: null,
  id: null,
  name: null,
  surname: null,
  userDocID: null,
  favorites: [],
  status: null,
  error: null,
};

export const registerUser = createAsyncThunk(
  'user/registerUser',

  async function (data) {
    const { user } = await createUserWithEmailAndPassword(authdata, data.email, data.password)

    const { name, surname, email } = data;
    const { refreshToken, uid } = user;

    const userRec = {
      name,
      surname,
      email,
      token: refreshToken,
      id: uid,
      favorites: [],
    };

    const doc = await addDoc(collection(db, "users"), userRec);
    return {
      ...userRec,
      userDocID: doc.id
    }
  }
)

const userSlice = createSlice({
  name: 'user',
  initialState,

  extraReducers:
    builder => {
      builder
        .addCase(registerUser.fulfilled, (state, action) => {
          const {
            name,
            surname,
            email,
            token,
            id,
            favorites,
            userDocID,
          } = action.payload;

          state.status = 'resolved';
          state.name = name;
          state.surname = surname;
          state.email = email;
          state.token = token;
          state.id = id;
          state.favorites = favorites;
          state.userDocID = userDocID;
        })
    },

  reducers: {},
});

export default userSlice.reducer;
</code>```

Body:
I'm trying to test redux async thunk using Jest. In this thunk I call two firebase methods, so I want to mock them in my test. But mocked methods return undefined instead of objects specified in the mocked implementation. So mocks are being applied in the process of test execution, but values they should return are somehow ignored. What am I doing wrong?

userSlice.test.js

import {registerUser} from '../slices/userSlice';

const mockedСreateUserWithEmailAndPassword = jest.fn();
mockedСreateUserWithEmailAndPassword.mockImplementationOnce(() => Promise.resolve({ user: { refreshToken: '123', uid: '321' } }));

const mockedAddDoc = jest.fn();
mockedAddDoc.mockImplementation(() => Promise.resolve({ doc: {id: '333'} }));

jest.mock('firebase/firestore', () => ({
  ...jest.requireActual('firebase/firestore'),
  addDoc: () => mockedAddDoc,
}));

jest.mock('firebase/auth', () => ({
  ...jest.requireActual('firebase/auth'),
  createUserWithEmailAndPassword: () => mockedСreateUserWithEmailAndPassword,
}));

describe('registerUser thunk', () => {
  it('should register user with resolved response', async () => {

    const dispatch = jest.fn();
    const thunk = registerUser({
    name: 'TestName',
    surname: 'TestSurname',
    email: 'test@test.com',
    password: 'testPassword'
  },
)

await thunk (dispatch, () => {}, () => {});
const [start, end] = dispatch.mock.calls;
expect(start[1].type).toBe('user/registerUser/fulfilled');

  })
})

userSlice.js

import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import { createUserWithEmailAndPassword, getAuth } from "firebase/auth";
import db, { firebaseApp } from './../../firebase';
import { collection,  addDoc} from "firebase/firestore";

firebaseApp;
const authdata = getAuth();

const initialState = {
  email: null,
  token: null,
  id: null,
  name: null,
  surname: null,
  userDocID: null,
  favorites: [],
  status: null,
  error: null,
};

export const registerUser = createAsyncThunk(
  'user/registerUser',

  async function (data) {
    const { user } = await createUserWithEmailAndPassword(authdata, data.email, data.password)

    const { name, surname, email } = data;
    const { refreshToken, uid } = user;

    const userRec = {
      name,
      surname,
      email,
      token: refreshToken,
      id: uid,
      favorites: [],
    };

    const doc = await addDoc(collection(db, "users"), userRec);
    return {
      ...userRec,
      userDocID: doc.id
    }
  }
)

const userSlice = createSlice({
  name: 'user',
  initialState,

  extraReducers:
    builder => {
      builder
        .addCase(registerUser.fulfilled, (state, action) => {
          const {
            name,
            surname,
            email,
            token,
            id,
            favorites,
            userDocID,
          } = action.payload;

          state.status = 'resolved';
          state.name = name;
          state.surname = surname;
          state.email = email;
          state.token = token;
          state.id = id;
          state.favorites = favorites;
          state.userDocID = userDocID;
        })
    },

  reducers: {},
});

export default userSlice.reducer;


问:
Multiple NavigationPages Outside of MainPage
We are mostly a WPF shop currently and are exploring MAUI development for future projects. We have a need to track three separate layers of content (in addition to any necessary modal content), which each navigate and may all be visible on the screen at once.

I am attempting to work through various use-cases in a test app, and am separating cases in a TabBar. I had thought to use three NavigationPages in the VM of one tab and navigate each independently, but I am stumbling over getting even one to work, let alone three.

I have tried several different approaches, including ContentPresenter and ContentView, but here is the core of my most recent approach:

```<code>public NavTestVM()
{
    NavPage = new NavigationPage(new NavRoot());
}

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MauiAndUnitTest.Views.NavTest"
         x:DataType="viewModels:NavTestVM">
    <TemplatedPage ControlTemplate="{Binding NavPage.CurrentPage}" HeightRequest="400" WidthRequest="600"/>
</ContentPage>

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MauiAndUnitTest.Views.NavTestViews.NavRoot"
         BackgroundColor="Coral">
</ContentPage>
</code>```

The NavRoot page (the root page in NavPage) does not appear in the tab. If, in App.xaml.cs, I replace

```<code>MainPage = new AppShell();
</code>```

with

```<code>MainPage = new NavigationPage(new NavRoot());
</code>```

I get a page full of Coral-y goodness on startup. What am I missing to get current NavigationPage content to display, outside of App.xaml.cs.MainPage?

Assuming I can get this working, I would then expect I can just repeat the approach twice more for the other layers and call it good.

Body:
We are mostly a WPF shop currently and are exploring MAUI development for future projects. We have a need to track three separate layers of content (in addition to any necessary modal content), which each navigate and may all be visible on the screen at once.

I am attempting to work through various use-cases in a test app, and am separating cases in a TabBar. I had thought to use three NavigationPages in the VM of one tab and navigate each independently, but I am stumbling over getting even one to work, let alone three.

I have tried several different approaches, including ContentPresenter and ContentView, but here is the core of my most recent approach:

public NavTestVM()
{
    NavPage = new NavigationPage(new NavRoot());
}

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MauiAndUnitTest.Views.NavTest"
         x:DataType="viewModels:NavTestVM">
    <TemplatedPage ControlTemplate="{Binding NavPage.CurrentPage}" HeightRequest="400" WidthRequest="600"/>
</ContentPage>

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MauiAndUnitTest.Views.NavTestViews.NavRoot"
         BackgroundColor="Coral">
</ContentPage>

The NavRoot page (the root page in NavPage) does not appear in the tab. If, in App.xaml.cs, I replace

MainPage = new AppShell();

with

MainPage = new NavigationPage(new NavRoot());

I get a page full of Coral-y goodness on startup. What am I missing to get current NavigationPage content to display, outside of App.xaml.cs.MainPage?

Assuming I can get this working, I would then expect I can just repeat the approach twice more for the other layers and call it good.


问:
Concat videos and add text to them with ffmpeg
I have a txt file which contains links to mp4 videos. This videos are concated with ffmpeg.
Is it possible to write some text to each video while concating them?
Could I write the text command in the txt file maybe?

Concating already works, but I can not add text


问:
Overwrite Complex Object fields that have been edited by the user
I have a complex object (seen below) that is stored on a server. A client (browser) will pull this object down and present it flattened on a webpage. The user can then edit any field data and send the field as updated text to the server. The object will updated according to only the fields that have been changed. What is the best way to do this in C#? Since the "mobile" field is nested, how would a create a mapping?

Request with changed fields (example):

```<code>{ "mobile": "999-999-9999" }
</code>```

Complex Object on Server (to be updated):

```<code>{
  "product": "Live JSON generator",
  "version": 3.1,
  "releaseDate": "2014-06-25T00:00:00.000Z",
  "demo": true,
  "person": {
    "id": 12345,
    "name": "John Doe",
    "phones": {
      "home": "800-123-4567",
      "mobile": "877-123-1234"
    },
    "email": [
      "jd@example.com",
      "jd@example.org"
    ],
    "dateOfBirth": "1980-01-02T00:00:00.000Z",
    "registered": true,
    "emergencyContacts": [
      {
        "name": "Jane Doe",
        "phone": "888-555-1212",
        "relationship": "spouse"
      },
      {
        "name": "Justin Doe",
        "phone": "877-123-1212",
        "relationship": "parent"
      }
    ]
  }
}
</code>```

I looked at Automapper. The issue I see with it is that I have not seen an example where an Update is done, only new creation of an object.

Body:
I have a complex object (seen below) that is stored on a server. A client (browser) will pull this object down and present it flattened on a webpage. The user can then edit any field data and send the field as updated text to the server. The object will updated according to only the fields that have been changed. What is the best way to do this in C#? Since the "mobile" field is nested, how would a create a mapping?

Request with changed fields (example):

{ "mobile": "999-999-9999" }

Complex Object on Server (to be updated):

{
  "product": "Live JSON generator",
  "version": 3.1,
  "releaseDate": "2014-06-25T00:00:00.000Z",
  "demo": true,
  "person": {
    "id": 12345,
    "name": "John Doe",
    "phones": {
      "home": "800-123-4567",
      "mobile": "877-123-1234"
    },
    "email": [
      "jd@example.com",
      "jd@example.org"
    ],
    "dateOfBirth": "1980-01-02T00:00:00.000Z",
    "registered": true,
    "emergencyContacts": [
      {
        "name": "Jane Doe",
        "phone": "888-555-1212",
        "relationship": "spouse"
      },
      {
        "name": "Justin Doe",
        "phone": "877-123-1212",
        "relationship": "parent"
      }
    ]
  }
}

I looked at Automapper. The issue I see with it is that I have not seen an example where an Update is done, only new creation of an object.