问:
How write an own load balancer for an IIS hosted WCF REST application
I have a requirement for writing a loadbalancer application for existing WCF REST Services which are Hosted on IIS as a website. Hosted website has 3 services in it. Ex. Service1, Service2 and Service3. These 3 are present in App_Code directory. And endpoints are being activated through below lines once I host this on IIS.

```<code><serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/xyz/Sample1.svc" service="xyz.WCFService.Sample1.svc"/>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/xyz/Sample2.svc" service="xyz.WCFService.Sample2.svc"/>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/xyz/Sample3.svc" service="xyz.WCFService.Sample3.svc"/>
      </serviceActivations>
    </serviceHostingEnvironment>
</code>```

I am not sure for loadbalancing in this scenario, should I create a new instance of the Hosted IIS Application or I should follow another approach.

I tried following the samples for Load Balancing by understanding
https://www.codeproject.com/Articles/778575/WCF-Routing-Service-Part-III-Failover-Load-Balanci

but not able to figure out from where I can start working on it.

Body:
I have a requirement for writing a loadbalancer application for existing WCF REST Services which are Hosted on IIS as a website. Hosted website has 3 services in it. Ex. Service1, Service2 and Service3. These 3 are present in App_Code directory. And endpoints are being activated through below lines once I host this on IIS.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/xyz/Sample1.svc" service="xyz.WCFService.Sample1.svc"/>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/xyz/Sample2.svc" service="xyz.WCFService.Sample2.svc"/>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="~/xyz/Sample3.svc" service="xyz.WCFService.Sample3.svc"/>
      </serviceActivations>
    </serviceHostingEnvironment>

I am not sure for loadbalancing in this scenario, should I create a new instance of the Hosted IIS Application or I should follow another approach.

I tried following the samples for Load Balancing by understanding
https://www.codeproject.com/Articles/778575/WCF-Routing-Service-Part-III-Failover-Load-Balanci

but not able to figure out from where I can start working on it.


来源: stackexchange

问:
Accessing pages in a namespace
I'm using blueSpice to create a wiki, I want to assign pages to a specific namespace, I just created few custom groups and assigned some pages to those groups and then in the permission manager I gave some roles to a namespace that I created but the problem is that there is no pages assign to my custom namespace.

I really don't know how to fix my problem I hope that someone has the answer.

ContentLicense: CC BY-SA 4.0

Title: Accessing pages in a namespace


问:
Differences in Task.init behavior in Xcode13 and Xcode14
Task.init{} inherits the current actor context, and asynchronous processing passed to Task would be executed in an arbitrary thread.
I was curious about this because the behavior of processing using Task.init{} was different when the same code was executed in Xcode13.4.1 and Xcode14.2.

The following code is an example.

import SwiftUI

class Model: ObservableObject {
    @Published var results: [Int] = [0]
    func doWork() async {
        print(" start doWork :\(Thread.isMainThread)")
        var results: [Int] = []
        for i in 0 ..< 1_000_000 {
            results.append(i)
        }
        print(" before update :\(Thread.isMainThread)")
        self.results = results
    }

    func doWork2() async {
        print(" 2 start :\(Thread.isMainThread)")
        try! await Task.sleep(nanoseconds: 2_000_000_000)
        var results: [Int] = []
        for i in 0 ..< 1_000_000 {
            results.append(i)
        }
        print(" 2 before update :\(Thread.isMainThread)")
        self.results = results
    }
}

struct ContentView: View {
    @StateObject var model = Model()

    var body: some View {

        Button.init("\(model.results.count)") {
            Task {
                print(" before doWork :\(Thread.isMainThread)")
                await model.doWork()
                print(" after doWork :\(Thread.isMainThread)")
            }
        }
    }
}

```
<p>When the button is tapped, Task is created and processed.</p>
<p>[case1]<br />
Since <code>ContentView</code> is the MainActor, I expected that the Task would inherit it and the processing in the Task would be executed in the main thread.</p>
<p>Xcode13.4.1 log</p>
``` before doWork :true
 start doWork :true
 before update :true
 after doWork :true
```
<p>All are executed in the main thread.</p>
<p>Xcode14.2 log</p>
``` before doWork :true
 start doWork :false
 before update :false
2023-01-02 17:23:38.248216+0900 DemoSwiftConcurrencyTask[87042:10561056] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
 after doWork :true
```
<p>doWork{} seems to be running in a background thread.
I don't trust <code>Thread.isMainThread</code>, but it does warn that <code>Publishing changes from background threads is not allowed</code>, so it must be running in a background thread.</p>
<p>[case2]<br />
doWork() with <code>async</code> is a synchronous process. Try <code>doWork2()</code> with <code>sleep</code>. In this case, the log is as follows.</p>
<p>Xcode13.4.1 log</p>
``` before doWork :true
 2 start :true
 2 before update :false
2023-01-02 18:13:36.415885+0900 DemoSwiftConcurrencyTask[89588:10614813] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
 after doWork :true
```
<p>There is no guarantee which thread you will be in after <code>await Task.sleep</code>, so <code> 2 before update :false</code>.</p>
<p>Xcode14.2 log</p>
``` before doWork :true
 2 start :false
 2 before update :false
2023-01-02 18:15:45.114962+0900 DemoSwiftConcurrencyTask[89747:10618148] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
 after doWork :true
```

From the above, I had the following thoughts about asynchronous processing (doWork()) passed to Task.init{}.

Until Xcode13, it depends on the actor context of the calling point until it is suspended.

After Xcode14, it is executed in the background.

Is this correct?

I understand that in the doWork process, I can use Task.detached to prevent processing in the main thread, or I can set @MainActor to specify processing in the main thread.

Body:
Task.init{} inherits the current actor context, and asynchronous processing passed to Task would be executed in an arbitrary thread.
I was curious about this because the behavior of processing using Task.init{} was different when the same code was executed in Xcode13.4.1 and Xcode14.2.

The following code is an example.

import SwiftUI

class Model: ObservableObject {
    @Published var results: [Int] = [0]
    func doWork() async {
        print(" start doWork :\(Thread.isMainThread)")
        var results: [Int] = []
        for i in 0 ..< 1_000_000 {
            results.append(i)
        }
        print(" before update :\(Thread.isMainThread)")
        self.results = results
    }

    func doWork2() async {
        print(" 2 start :\(Thread.isMainThread)")
        try! await Task.sleep(nanoseconds: 2_000_000_000)
        var results: [Int] = []
        for i in 0 ..< 1_000_000 {
            results.append(i)
        }
        print(" 2 before update :\(Thread.isMainThread)")
        self.results = results
    }
}

struct ContentView: View {
    @StateObject var model = Model()

    var body: some View {

        Button.init("\(model.results.count)") {
            Task {
                print(" before doWork :\(Thread.isMainThread)")
                await model.doWork()
                print(" after doWork :\(Thread.isMainThread)")
            }
        }
    }
}

When the button is tapped, Task is created and processed.

[case1]

Since ContentView is the MainActor, I expected that the Task would inherit it and the processing in the Task would be executed in the main thread.

Xcode13.4.1 log

 before doWork :true
 start doWork :true
 before update :true
 after doWork :true

All are executed in the main thread.

Xcode14.2 log

 before doWork :true
 start doWork :false
 before update :false
2023-01-02 17:23:38.248216+0900 DemoSwiftConcurrencyTask[87042:10561056] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
 after doWork :true

doWork{} seems to be running in a background thread.
I don't trust Thread.isMainThread, but it does warn that Publishing changes from background threads is not allowed, so it must be running in a background thread.

[case2]

doWork() with async is a synchronous process. Try doWork2() with sleep. In this case, the log is as follows.

Xcode13.4.1 log

 before doWork :true
 2 start :true
 2 before update :false
2023-01-02 18:13:36.415885+0900 DemoSwiftConcurrencyTask[89588:10614813] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
 after doWork :true

There is no guarantee which thread you will be in after await Task.sleep, so  2 before update :false.

Xcode14.2 log

 before doWork :true
 2 start :false
 2 before update :false
2023-01-02 18:15:45.114962+0900 DemoSwiftConcurrencyTask[89747:10618148] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
 after doWork :true

From the above, I had the following thoughts about asynchronous processing (doWork()) passed to Task.init{}.

Until Xcode13, it depends on the actor context of the calling point until it is suspended.

After Xcode14, it is executed in the background.

Is this correct?

I understand that in the doWork process, I can use Task.detached to prevent processing in the main thread, or I can set @MainActor to specify processing in the main thread.


问:
How can I submit a form to a controller in an MVC framework using PHP from scratch?
I am building an MVC framework in PHP from scratch and I am having trouble with submitting a form to a controller. The form is located in the views folder files and I want to submit it to a controller for processing. However, I am not sure how to properly connect the form and the controller.

Here is some more context to my problem:

I have a form in the views folder files that looks like this:

```<code><form method="post" action="">
  <label for="name">Name:</label><br>
  <input type="text" id="name" name="name"><br>
  <label for="email">Email:</label><br>
  <input type="text" id="email" name="email"><br>
  <input type="submit" value="Submit">
</form>

</code>```

And I have a controller that looks like this:

```<code>class FormController {
  public function submit() {
    // code to process form submission goes here
  }
}

</code>```

Is it correct to use a switch statement with the $path variable to determine the appropriate controller to use in an MVC framework built in PHP from scratch?
This is on index.php routing URL.

```<code>switch ($path) {
    case '/FormController':
      // Check if the request method is POST
      if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        // Initialize the Controller
        $FormController = new FormController();
      }else{
require '/views/form.php';

}
      break;
  }
</code>```

I am using a switch statement with the $path variable to determine the appropriate controller to use.
However, I am not sure if this is the correct way to handle form submissions in an MVC framework. Can anyone provide guidance on how to properly submit a form to a controller in this context?
Thanks!

Body:
I am building an MVC framework in PHP from scratch and I am having trouble with submitting a form to a controller. The form is located in the views folder files and I want to submit it to a controller for processing. However, I am not sure how to properly connect the form and the controller.

Here is some more context to my problem:

I have a form in the views folder files that looks like this:

<form method="post" action="">
  Name:

  <input type="text" id="name" name="name">

  Email:

  <input type="text" id="email" name="email">

  <input type="submit" value="Submit">
</form>

And I have a controller that looks like this:

class FormController {
  public function submit() {
    // code to process form submission goes here
  }
}

Is it correct to use a switch statement with the $path variable to determine the appropriate controller to use in an MVC framework built in PHP from scratch?
This is on index.php routing URL.

switch ($path) {
    case '/FormController':
      // Check if the request method is POST
      if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        // Initialize the Controller
        $FormController = new FormController();
      }else{
require '/views/form.php';

}
      break;
  }

I am using a switch statement with the $path variable to determine the appropriate controller to use.
However, I am not sure if this is the correct way to handle form submissions in an MVC framework. Can anyone provide guidance on how to properly submit a form to a controller in this context?
Thanks!


问:
How to update Plotly Scatter3d graph in streamlit?
I am stuck off a point about updating plotly Scatter3d. I have a bunch of x, y, and z value of a dataframe. Firstly, User loads first dataframe file. Figure plots the first dataframe as you can see

Then, user loads second dataframe. However, there are two graphs. Second dataframe does not plotted on first graph. Its create second graph.

there are two graph same time.

How can update the graph using Figure 1?.


问:
convert ffmpeg command to node.js fluent-ffmpeg
I need some help converging ffmpeg to node.js fluent-ffmpeg. This is ffmpeg command

```<code>ffmpeg -i tears_of_steel_1080p.webm -vf scale=1280x720 -b:v 1024k \
 -minrate 512k -maxrate 1485k -tile-columns 2 -g 240 -threads 8 \
 -quality good -crf 32 -c:v libvpx-vp9 -c:a libopus \
 -pass 1 -speed 4 tos-1280x720-24-30fps.webm && \
ffmpeg -i tears_of_steel_1080p.webm -vf scale=1280x720 -b:v 1024k \
 -minrate 512k -maxrate 1485k -tile-columns 2 -g 240 -threads 8 \
 -quality good -crf 32 -c:v libvpx-vp9 -c:a libopus \
 -pass 2 -speed 4 -y tos-1280x720-24-30fps.webm
</code>```

As you can this command is from 2 passes. It should not generate log file and it would be very nice to use output and input as a node.js stream

Body:
I need some help converging ffmpeg to node.js fluent-ffmpeg. This is ffmpeg command

ffmpeg -i tears_of_steel_1080p.webm -vf scale=1280x720 -b:v 1024k \
 -minrate 512k -maxrate 1485k -tile-columns 2 -g 240 -threads 8 \
 -quality good -crf 32 -c:v libvpx-vp9 -c:a libopus \
 -pass 1 -speed 4 tos-1280x720-24-30fps.webm && \
ffmpeg -i tears_of_steel_1080p.webm -vf scale=1280x720 -b:v 1024k \
 -minrate 512k -maxrate 1485k -tile-columns 2 -g 240 -threads 8 \
 -quality good -crf 32 -c:v libvpx-vp9 -c:a libopus \
 -pass 2 -speed 4 -y tos-1280x720-24-30fps.webm

As you can this command is from 2 passes. It should not generate log file and it would be very nice to use output and input as a node.js stream


问:
TypeEvaluator implementation **endValue**
Hello I was exploring Property Animation from official documentation here : Property animation overview

There is a section talking about TypeEvaluator and how to make a customized implementation of it the example shows that you have to implement TypeEvaluator and then type the logic inside evaluate function of how to animate different types rather than int, float and colors my question is what is the end value means inside evaluate function params and is it states the value that the property is going to be after amount of time? here is example of Custom TypeEvaluator :

```<code>
private class FloatEvaluator : TypeEvaluator<Any> {

    override fun evaluate(fraction: Float, startValue: Any, endValue: Any): Any {
        return (startValue as Number).toFloat().let { startFloat ->
            startFloat + fraction * ((endValue as Number).toFloat() - startFloat)
        }
    }

}

</code>```

Body:
Hello I was exploring Property Animation from official documentation here : Property animation overview

There is a section talking about TypeEvaluator and how to make a customized implementation of it the example shows that you have to implement TypeEvaluator and then type the logic inside evaluate function of how to animate different types rather than int, float and colors my question is what is the end value means inside evaluate function params and is it states the value that the property is going to be after amount of time? here is example of Custom TypeEvaluator :

private class FloatEvaluator : TypeEvaluator<Any> {

    override fun evaluate(fraction: Float, startValue: Any, endValue: Any): Any {
        return (startValue as Number).toFloat().let { startFloat ->
            startFloat + fraction * ((endValue as Number).toFloat() - startFloat)
        }
    }

}


问:
How can I update data with the same ID in a single PUT method?
I have 3 tables on database

```<code>public class RawMaterial
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int RawId { get; set; }
    [StringLength(50)]
    public string RawName { get; set; }
    public int RawNumber { get; set; }

}
</code>```
```<code>public class Product
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int ProductId { get; set; }
    [StringLength(50)]
    public string ProductName { get; set; }
    public int ProductNumber { get; set; }
}
</code>```
```<code>public class Stock
{
    [Key]
    public int StockId { get; set; }
    [ForeignKey("Product")]
    public int ProdutctId { get; set; }
    public Produtct Produtct { get; set; }
    [ForeignKey("RawMaterial")]
    public int RawId { get; set; }
    public RawMaterial RawMaterial { get; set; }
    public int StockNumber { get; set; }
}
</code>```
```<code>public void CreateRawMaterial(int id)
{
    using (var projeDbContext = new ProjeDbContext())
    {
        var RawCreate = projeDbContext.Stock.Where(d => d.ProductId.Equals(id)).FirstOrDefault();
        if (RawCreate != null)
        {

        }
    }
}
</code>```

If the entered Id is equal to the ProductId, I want the raw materials with that ProductId to increase by 100. I wrote this far, but after that I got an error.

I have 3 tables, my stock table has 2 foreign keys, one is ProductID and the other is RawId, so I want the value of my materials whose Id and ProductId are equal to increase by 100. There are more than 1 material with the same ProductId.

Body:
I have 3 tables on database

public class RawMaterial
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int RawId { get; set; }
    [StringLength(50)]
    public string RawName { get; set; }
    public int RawNumber { get; set; }

}

public class Product
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int ProductId { get; set; }
    [StringLength(50)]
    public string ProductName { get; set; }
    public int ProductNumber { get; set; }
}

public class Stock
{
    [Key]
    public int StockId { get; set; }
    [ForeignKey("Product")]
    public int ProdutctId { get; set; }
    public Produtct Produtct { get; set; }
    [ForeignKey("RawMaterial")]
    public int RawId { get; set; }
    public RawMaterial RawMaterial { get; set; }
    public int StockNumber { get; set; }
}

public void CreateRawMaterial(int id)
{
    using (var projeDbContext = new ProjeDbContext())
    {
        var RawCreate = projeDbContext.Stock.Where(d => d.ProductId.Equals(id)).FirstOrDefault();
        if (RawCreate != null)
        {

        }
    }
}

If the entered Id is equal to the ProductId, I want the raw materials with that ProductId to increase by 100. I wrote this far, but after that I got an error.

I have 3 tables, my stock table has 2 foreign keys, one is ProductID and the other is RawId, so I want the value of my materials whose Id and ProductId are equal to increase by 100. There are more than 1 material with the same ProductId.


问:
How to find out if a line, defined by two points, intersects an axis-aligned cube?
I am looking for a way to check if a line defined by two points, A(x, y, z) and B(x, y, z) have an intersection with an axis-aligned cube with side length 1.
An intersection also includes if the line simply "touches" one of the sides of the cube.

Point A(x, y, z)

Point B(x, y, z)

Cube C(x, y, z)

C's bounding points would be:
(x, y, z), (x + 1, y + 1, z + 1)

I've tried the algorithm for finding if a point is on a line using this solution how-do-i-check-if-a-3d-point-is-between-2-other-3d-points and it works for a single point, however I am now looking for a way to check that it intersects a cube and can't figure out how to do it.


问:
RTree is not adding the geometric line in the entries
I am using davidmoten RTree to index the edges from the graph. however, rtree is not adding the edges in the entry.
RTreeIndexer.class</p>
```<code>public static RTree<Integer, Line> createRTree(CoreGraph graph) {
        RTree<Integer, Line> rtree = RTree.create();

        Map<Integer, Map<Integer, Double>> adjMap = graph.getAdjancencyMap();

        for (Entry<Integer, Map<Integer, Double>> entry : adjMap.entrySet()) {
            int startNodeId = entry.getKey();
            double startLong = graph.getNodeFromMap(startNodeId).getLongitude();
            double startLatit = graph.getNodeFromMap(startNodeId).getLatitude();
            Map<Integer, Double> adjList = entry.getValue();

            for (Entry<Integer, Double> adjacentNodes : adjList.entrySet()) {
                int endNodeId = adjacentNodes.getKey();
                double endLong = graph.getNodeFromMap(endNodeId).getLongitude();
                double endLatit = graph.getNodeFromMap(endNodeId).getLatitude();
                Line line = Geometries.line(startLong, startLatit, endLong, endLatit);
                int edgeId = graph.getEdgeId(startNodeId, endNodeId);
                if (rtree.isEmpty()) {
                    rtree.add(edgeId, line);
                }

            }
        }
        return rtree;

    }
</code>```

Body:
I am using davidmoten RTree to index the edges from the graph. however, rtree is not adding the edges in the entry.
RTreeIndexer.class

public static RTree<Integer, Line> createRTree(CoreGraph graph) {
        RTree<Integer, Line> rtree = RTree.create();

        Map<Integer, Map<Integer, Double>> adjMap = graph.getAdjancencyMap();

        for (Entry<Integer, Map<Integer, Double>> entry : adjMap.entrySet()) {
            int startNodeId = entry.getKey();
            double startLong = graph.getNodeFromMap(startNodeId).getLongitude();
            double startLatit = graph.getNodeFromMap(startNodeId).getLatitude();
            Map<Integer, Double> adjList = entry.getValue();

            for (Entry<Integer, Double> adjacentNodes : adjList.entrySet()) {
                int endNodeId = adjacentNodes.getKey();
                double endLong = graph.getNodeFromMap(endNodeId).getLongitude();
                double endLatit = graph.getNodeFromMap(endNodeId).getLatitude();
                Line line = Geometries.line(startLong, startLatit, endLong, endLatit);
                int edgeId = graph.getEdgeId(startNodeId, endNodeId);
                if (rtree.isEmpty()) {
                    rtree.add(edgeId, line);
                }

            }
        }
        return rtree;

    }


问:
Unable to use nvidia dali pipeline for inference, getting memory issue
I've a pretrained Keras model that I'm trying to use for inference purpose (Image classification). I've built a DALI pipeline to read jpeg 2000 images and passing it to create a dali dataset which I'm then using for inference purpose. Here's code

```<code>@pipeline_def
def j2k_decode_pipeline():
    jpegs, labels = fn.readers.file(files = j2kfiles)
    images = fn.experimental.decoders.image(jpegs, device='mixed', output_type=types.RGB, dtype=DALIDataType.UINT16)
    images = fn.resize(
        images,
        resize_x=160,
        resize_y=160,
        resize_z=3,
        interp_type=types.INTERP_LANCZOS3)
    return images, labels

max_batch_size = 32
pipe = j2k_decode_pipeline(batch_size=max_batch_size, num_threads=2, device_id=0, debug=True)

model = tf.keras.models.load_model('/kaggle/input/custom-model/modelv1_0.h5')
BATCH_SIZE = 32
shapes = (
    (32, 160, 160, 3),
    (BATCH_SIZE))
dtypes = (
    tf.float32,
    tf.int32)

with tf.device('/gpu:0'):
    ds = dali_tf.DALIDataset(
        pipeline=pipe,
        batch_size=BATCH_SIZE,
        output_shapes=shapes,
        output_dtypes=dtypes,
        fail_on_device_mismatch=False)
#         pipe_out = pipe.run()
#         temp = pipe_out[0].as_cpu().as_array()
#         ds = tf.convert_to_tensor(temp)
    #np_ds = ds.as_numpy_iterator()
    predictions_list = []
    for d, _ in ds:
        predictions.append(model.predict_on_batch(d).flatten())
</code>```

When I run model.predict_on_batch, I get:

```<code>InternalError: DALI daliShareOutput(&pipeline_handle_) failed: Critical error in pipeline:
Error when executing Mixed operator experimental__decoders__Image encountered:
Can't allocate 4068474880 bytes on device 0.
Current pipeline object is no longer valid. [Op:IteratorGetNext]
</code>```

Can someone help pinpoint what am I doing wrong?

Body:
I've a pretrained Keras model that I'm trying to use for inference purpose (Image classification). I've built a DALI pipeline to read jpeg 2000 images and passing it to create a dali dataset which I'm then using for inference purpose. Here's code

@pipeline_def
def j2k_decode_pipeline():
    jpegs, labels = fn.readers.file(files = j2kfiles)
    images = fn.experimental.decoders.image(jpegs, device='mixed', output_type=types.RGB, dtype=DALIDataType.UINT16)
    images = fn.resize(
        images,
        resize_x=160,
        resize_y=160,
        resize_z=3,
        interp_type=types.INTERP_LANCZOS3)
    return images, labels

max_batch_size = 32
pipe = j2k_decode_pipeline(batch_size=max_batch_size, num_threads=2, device_id=0, debug=True)

model = tf.keras.models.load_model('/kaggle/input/custom-model/modelv1_0.h5')
BATCH_SIZE = 32
shapes = (
    (32, 160, 160, 3),
    (BATCH_SIZE))
dtypes = (
    tf.float32,
    tf.int32)

with tf.device('/gpu:0'):
    ds = dali_tf.DALIDataset(
        pipeline=pipe,
        batch_size=BATCH_SIZE,
        output_shapes=shapes,
        output_dtypes=dtypes,
        fail_on_device_mismatch=False)
#         pipe_out = pipe.run()
#         temp = pipe_out[0].as_cpu().as_array()
#         ds = tf.convert_to_tensor(temp)
    #np_ds = ds.as_numpy_iterator()
    predictions_list = []
    for d, _ in ds:
        predictions.append(model.predict_on_batch(d).flatten())

When I run model.predict_on_batch, I get:

InternalError: DALI daliShareOutput(&pipeline_handle_) failed: Critical error in pipeline:
Error when executing Mixed operator experimental__decoders__Image encountered:
Can't allocate 4068474880 bytes on device 0.
Current pipeline object is no longer valid. [Op:IteratorGetNext]

Can someone help pinpoint what am I doing wrong?


问:
http user agent to avoid cookie warning (youtube)
I wrote my own RSS reader and it is not able to discover feeds on youtube. The reason is that youtube redirects to a separate page for their cookie warning, and the rss discovery url is not on that page. I tested it with curl and the redirect did not happen. I then changed the user agent in my application to be curl/7.8.6.0 and now my app can handle youtube discovery. So the problem is solved, but this feels like a bad workaround. Best practices for a user agent string is
appname/version framework/version (comment)
or something similar, which is what I was using before. Now I am forced to lie to every website I visit about what application I am using, just to make it work for one site. I could write a special bespoke discovery function just for youtube and change the url to youtube-nocookie or change the user agent just for that request, but that is extra work, and extra processing cycles on the user's machine for every discovery attempt.

Is there a standard way to inform a website that the request is coming from a piece of code and not a human? How do webcrawlers deal with this?

I am using Godot Mono as the framework for the application, you can find the full source here, this question relates to the GetHtml() function in the DiscoveryService which is a standard dotnet HttpClient call:

```<code>HttpResponseMessage response = await this.http.GetAsync(url);
if (!response.IsSuccessStatusCode) return null;
using HttpContent content = response.Content;
return await content.ReadAsStringAsync();
</code>```

The HttpClient is instantiated in the constructor and the User agent string is set there too.

If the user agent is set to anything other than curl/someversion youtube does not return the requested page and instead returns a page asking the user whether it is ok for them to save a bunch of cookies.

The issue can be reproduced easily enough with curl, just do

curl <some youtube channel url> | grep rss+xml

and

curl -A "porifera/1.0.0.0" <some youtube channel url> | grep rss+xml

porifera is the name of the application I am developing, you can write pretty much anything there it seems

Body:
I wrote my own RSS reader and it is not able to discover feeds on youtube. The reason is that youtube redirects to a separate page for their cookie warning, and the rss discovery url is not on that page. I tested it with curl and the redirect did not happen. I then changed the user agent in my application to be curl/7.8.6.0 and now my app can handle youtube discovery. So the problem is solved, but this feels like a bad workaround. Best practices for a user agent string is
appname/version framework/version (comment)
or something similar, which is what I was using before. Now I am forced to lie to every website I visit about what application I am using, just to make it work for one site. I could write a special bespoke discovery function just for youtube and change the url to youtube-nocookie or change the user agent just for that request, but that is extra work, and extra processing cycles on the user's machine for every discovery attempt.

Is there a standard way to inform a website that the request is coming from a piece of code and not a human? How do webcrawlers deal with this?

I am using Godot Mono as the framework for the application, you can find the full source here, this question relates to the GetHtml() function in the DiscoveryService which is a standard dotnet HttpClient call:

HttpResponseMessage response = await this.http.GetAsync(url);
if (!response.IsSuccessStatusCode) return null;
using HttpContent content = response.Content;
return await content.ReadAsStringAsync();

The HttpClient is instantiated in the constructor and the User agent string is set there too.

If the user agent is set to anything other than curl/someversion youtube does not return the requested page and instead returns a page asking the user whether it is ok for them to save a bunch of cookies.

The issue can be reproduced easily enough with curl, just do

curl <some youtube channel url> | grep rss+xml

and

curl -A "porifera/1.0.0.0" <some youtube channel url> | grep rss+xml

porifera is the name of the application I am developing, you can write pretty much anything there it seems


问:
Access advanced properties of network adapter in .NET
I need to get and set the "Jumbo Packet" size of a network adapter programmatically in .NET, without using PowerShell (in PowerShell this is easy by e.g. "Get-NetAdapterAdvancedProperty").

I tried using the .NET class "NetworkInterface", but it does not seem to provide access to the advanced properties of a network adapter.

Maybe the advanced properties are accessible by the Registry?

Any help is appreciated. Thanks in advance.


问:
YouTube: How to search for the channels with given exact channel name?
I want to search for the YouTube channels with the given channel name.

Exact match with double quotation doesn't satisfy my need.

For example, when the given channel name is "ABC", I only want to retrieve channels with the name "ABC", and I don't want to retrieve channels with names such as "ABCD" or "ABCReadyGo" or "HiABC" or etc.

How can I do it?

Thanks for your help!


问:
chef's Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '139' Error
So, when trying to enable ubuntu 22.04 on the chef client,
when running the command :

```<code>sudo chef-client --once -l info
</code>```

i get this error:

```<code> ERROR: Running exception handlers
 Running handlers complete
 ERROR: Exception handlers complete
 Chef Client failed. 60 resources updated in 39 seconds
 FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
 FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
 ERROR: bash[Install virtualenv] (<my_work_project_name>-python::python36 line 40) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '139'
</code>```

after passing on the python recipe we have, i tried looking for solutions elsewhere but couldn't find any, thank you

i tried traversing through the actual default.rb file regarding this recipe, didn't see anything that would cause this issue , apart from something which might be related which is the fact it downloads resources from artifactory server , and it had 404 error when fething a package ,
also i tried doing the pip install env command , worked in the terminal, might be failing in the recipe from some reason

Body:
So, when trying to enable ubuntu 22.04 on the chef client,
when running the command :

sudo chef-client --once -l info

i get this error:

 ERROR: Running exception handlers
 Running handlers complete
 ERROR: Exception handlers complete
 Chef Client failed. 60 resources updated in 39 seconds
 FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
 FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
 ERROR: bash[Install virtualenv] (<my_work_project_name>-python::python36 line 40) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '139'

after passing on the python recipe we have, i tried looking for solutions elsewhere but couldn't find any, thank you

i tried traversing through the actual default.rb file regarding this recipe, didn't see anything that would cause this issue , apart from something which might be related which is the fact it downloads resources from artifactory server , and it had 404 error when fething a package ,
also i tried doing the pip install env command , worked in the terminal, might be failing in the recipe from some reason


问:
How to use VsCode debug breakpoints for node.js project in docker
I have a node.js project that run in docker, how I can use breakpoints to debug the project?</p>


Title: scipy RBFInterpolator doesnt reproduce data points

Body:
I'm trying to perform a 3D interpolation using a cubic kernel with scipy's RBFInterpolator routine. I'm running into a problem where the interpolator wont reproduce the input data points, even with smoothing set to 0. I've tried other kernels, such as 'linear' and 'quintic' and varying the neighbors argument, but still the interpolator wont reproduce the input data.

My two questions are:
Why wont RBFInterpolator reproduce the input data?
Is there another python module that can perform 3d cubic spline interpolation?

Here's a minimal example:

import numpy as np
from numpy import array
import scipy.interpolate as spint
import matplotlib.pyplot as plt

TMPenden=array([[[0.00033903, 0.00034132, 0.00034312, 0.00034442, 0.0003452 ,
         0.00034547, 0.0003452 , 0.00034441, 0.00034311, 0.0003413 ],
        [0.00041104, 0.0004126 , 0.00041383, 0.00041471, 0.00041524,
         0.00041542, 0.00041524, 0.00041471, 0.00041382, 0.00041259],
        [0.00044731, 0.00044845, 0.00044934, 0.00044999, 0.00045037,
         0.0004505 , 0.00045037, 0.00044998, 0.00044934, 0.00044844],
        [0.00046978, 0.00047068, 0.00047138, 0.00047189, 0.00047219,
         0.00047229, 0.00047219, 0.00047188, 0.00047138, 0.00047067],
        [0.00048431, 0.00048505, 0.00048563, 0.00048604, 0.00048629,
         0.00048638, 0.00048629, 0.00048604, 0.00048563, 0.00048504],
        [0.00049386, 0.00049449, 0.00049499, 0.00049534, 0.00049555,
         0.00049562, 0.00049555, 0.00049534, 0.00049498, 0.00049449],
        [0.00050013, 0.00050068, 0.00050111, 0.00050142, 0.0005016 ,
         0.00050166, 0.0005016 , 0.00050142, 0.00050111, 0.00050068],
        [0.00050414, 0.00050462, 0.000505  , 0.00050527, 0.00050544,
         0.00050549, 0.00050544, 0.00050527, 0.000505  , 0.00050462],
        [0.00050653, 0.00050696, 0.0005073 , 0.00050754, 0.00050769,
         0.00050774, 0.00050769, 0.00050754, 0.0005073 , 0.00050696],
        [0.00050773, 0.00050812, 0.00050843, 0.00050865, 0.00050878,
         0.00050882, 0.00050878, 0.00050865, 0.00050843, 0.00050812]],

       [[0.00047842, 0.00048166, 0.00048422, 0.00048606, 0.00048717,
         0.00048755, 0.00048717, 0.00048605, 0.0004842 , 0.00048164],
        [0.00058177, 0.00058398, 0.00058571, 0.00058696, 0.00058771,
         0.00058796, 0.00058771, 0.00058695, 0.0005857 , 0.00058396],
        [0.00063274, 0.00063436, 0.00063562, 0.00063653, 0.00063708,
         0.00063726, 0.00063708, 0.00063653, 0.00063562, 0.00063435],
        [0.00066297, 0.00066424, 0.00066524, 0.00066595, 0.00066638,
         0.00066653, 0.00066638, 0.00066595, 0.00066523, 0.00066424],
        [0.00068146, 0.00068251, 0.00068333, 0.00068392, 0.00068427,
         0.00068439, 0.00068427, 0.00068392, 0.00068333, 0.00068251],
        [0.00069271, 0.00069361, 0.0006943 , 0.0006948 , 0.0006951 ,
         0.0006952 , 0.0006951 , 0.0006948 , 0.0006943 , 0.0006936 ],
        [0.00069925, 0.00070002, 0.00070062, 0.00070106, 0.00070132,
         0.00070141, 0.00070132, 0.00070106, 0.00070062, 0.00070001],
        [0.00070256, 0.00070325, 0.00070378, 0.00070416, 0.00070439,
         0.00070447, 0.00070439, 0.00070416, 0.00070378, 0.00070324],
        [0.00070361, 0.00070422, 0.0007047 , 0.00070505, 0.00070525,
         0.00070532, 0.00070525, 0.00070504, 0.0007047 , 0.00070422],
        [0.00070302, 0.00070358, 0.00070401, 0.00070432, 0.0007045 ,
         0.00070457, 0.0007045 , 0.00070432, 0.00070401, 0.00070357]],

       [[0.00064677, 0.00065116, 0.00065462, 0.00065712, 0.00065863,
         0.00065914, 0.00065863, 0.00065711, 0.00065461, 0.00065114],
        [0.00078754, 0.00079052, 0.00079286, 0.00079455, 0.00079556,
         0.0007959 , 0.00079556, 0.00079454, 0.00079285, 0.0007905 ],
        [0.00085515, 0.00085733, 0.00085904, 0.00086027, 0.00086101,
         0.00086126, 0.00086101, 0.00086026, 0.00085903, 0.00085732],
        [0.00089318, 0.0008949 , 0.00089624, 0.0008972 , 0.00089778,
         0.00089798, 0.00089778, 0.0008972 , 0.00089623, 0.00089489],
        [0.00091474, 0.00091616, 0.00091726, 0.00091805, 0.00091853,
         0.00091869, 0.00091853, 0.00091805, 0.00091726, 0.00091615],
        [0.00092632, 0.00092752, 0.00092845, 0.00092913, 0.00092953,
         0.00092967, 0.00092953, 0.00092912, 0.00092845, 0.00092751],
        [0.00093148, 0.00093252, 0.00093333, 0.00093391, 0.00093426,
         0.00093438, 0.00093426, 0.00093391, 0.00093332, 0.00093251],
        [0.00093233, 0.00093325, 0.00093396, 0.00093448, 0.00093479,
         0.00093489, 0.00093478, 0.00093447, 0.00093396, 0.00093324],
        [0.0009302 , 0.00093102, 0.00093166, 0.00093212, 0.00093239,
         0.00093248, 0.00093239, 0.00093211, 0.00093166, 0.00093102],
        [0.00092595, 0.00092669, 0.00092726, 0.00092768, 0.00092792,
         0.00092801, 0.00092792, 0.00092767, 0.00092726, 0.00092668]]])
TMPraddata=array([ 2.43597707,  3.43597707,  4.43597707,  5.43597707,  6.43597707,
        7.43597707,  8.43597707,  9.43597707, 10.43597707, 11.43597707])
TMPthetadata=array([1.41381669, 1.44523262, 1.47664855, 1.50806447, 1.5394804 ,
       1.57089633, 1.60231225, 1.63372818, 1.66514411, 1.69656003])
TMPalpha = np.array([0.06,0.07,0.08])

coords = np.asarray([[alpha,r,theta] for alpha in TMPalpha for r in TMPraddata for theta in TMPthetadata])
yvalues = np.ravel(TMPenden)
tmprbf = spint.RBFInterpolator(
    coords,
    yvalues,
    neighbors=1000,
    kernel='linear',
    smoothing=0,
    degree=2
)

tmpalpha = 0.6
pnts = [[tmpalpha,i,TMPthetadata[5]] for i in TMPraddata]
datpnts = tmprbf(pnts)
plt.scatter(TMPraddata, datpnts, label="Radial Basis Function",marker=".", linewidth=.5)
plt.plot(TMPraddata, TMPenden[0,:,5],label="Data")
plt.legend();


问:
'MediaPlayer Error Code 4003 extra 0' on Leanback Exoplayer Library
I'm using

```<code> implementation 'com.google.android.exoplayer:extension-leanback:2.18.2'
</code>```

for VOD playing in Android TV. But facing getting Media error code 4003 in some of device like MI-TV

**All device doesn't throw the exception . Checked Samsung TV and Emulator TV ,it's worked well but in some MI-BOX this exception is occurring **

How do i fix it?

Body:
I'm using

 implementation 'com.google.android.exoplayer:extension-leanback:2.18.2'

for VOD playing in Android TV. But facing getting Media error code 4003 in some of device like MI-TV

**All device doesn't throw the exception . Checked Samsung TV and Emulator TV ,it's worked well but in some MI-BOX this exception is occurring **

How do i fix it?


问:
How to get correct systemBars height using compose
I know this seems trivial but I've looked up every doc, maybe I'm missing something.
I am trying to get this

across different device screen size (focusing on compact types). I successfully got screen height using LocalConfiguration.current.screenHeightDp

Now I'm implementing edge-to-edge display.
I followed this doc, but i get this

looking at this there is a space between them (blue), because of the feature to draw behind systembars. then i tried to get the systemBars height(top & bottom) to add to the boxes resp to compensate for the extra space.
I used inset.getInsets(WindowInsetsCompat.Type.systemBars()) which returns the heights of the systembars but after that the boxes overlap(yellow)

I logged the values I'm getting from the insets, it was quite more than the values of LocalConfiguration.current.screenHeightDP

How do i compensate for the space or get the correct height for the systemBars?

Here is my code :

```<code>@Composable
fun MyBox() {

val view = LocalView.current
val inset = ViewCompat.getRootWindowInsets(view)!!

val insetSystemBar = inset.getInsets(WindowInsetsCompat.Type.systemBars()) //Insets{left=0, top=136, right=0, bottom=132}
val insetStatusBar = insetSystemBar.top // 136
val insetNavBar = insetSystemBar.bottom  // 132

val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp //This returns 753

val testHeightRatio = 0.5
val TopBoxHeight = (((screenHeight * testHeightRatio).roundToInt())).dp   // 377
val BottomBoxHeight = (((screenHeight * testHeightRatio).roundToInt())).dp   // 377

val TopBoxAndStatusBarHeight = TopBoxHeight + insetStatusBar.dp   // 513
val BottomBoxAndNavBar = BottomBoxHeight + insetNavBar.dp    // 509

MyBoxTheme {
    Surface(Modifier.fillMaxSize()) {
        Box(
            Modifier
                .fillMaxSize()
                .background(Color(0xFF00B8D4))
        ) {
            Box(
                modifier = Modifier
                    .height(BottomBoxAndNavBar)
                    .fillMaxWidth()
                    .align(Alignment.BottomCenter)
                    .background(Color(0x86FF0303)),
            )

            Box(
                modifier = Modifier
                    .height(TopBoxAndStatusBarHeight)
                    .fillMaxWidth()
                    .background(Color(0x8FFFDD03))
                    .align(Alignment.TopCenter)
            )
        }
    }
 }
}
</code>```

Body:
I know this seems trivial but I've looked up every doc, maybe I'm missing something.
I am trying to get this

across different device screen size (focusing on compact types). I successfully got screen height using LocalConfiguration.current.screenHeightDp

Now I'm implementing edge-to-edge display.
I followed this doc, but i get this

looking at this there is a space between them (blue), because of the feature to draw behind systembars. then i tried to get the systemBars height(top & bottom) to add to the boxes resp to compensate for the extra space.
I used inset.getInsets(WindowInsetsCompat.Type.systemBars()) which returns the heights of the systembars but after that the boxes overlap(yellow)

I logged the values I'm getting from the insets, it was quite more than the values of LocalConfiguration.current.screenHeightDP

How do i compensate for the space or get the correct height for the systemBars?

Here is my code :

@Composable
fun MyBox() {

val view = LocalView.current
val inset = ViewCompat.getRootWindowInsets(view)!!

val insetSystemBar = inset.getInsets(WindowInsetsCompat.Type.systemBars()) //Insets{left=0, top=136, right=0, bottom=132}
val insetStatusBar = insetSystemBar.top // 136
val insetNavBar = insetSystemBar.bottom  // 132

val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp //This returns 753

val testHeightRatio = 0.5
val TopBoxHeight = (((screenHeight * testHeightRatio).roundToInt())).dp   // 377
val BottomBoxHeight = (((screenHeight * testHeightRatio).roundToInt())).dp   // 377

val TopBoxAndStatusBarHeight = TopBoxHeight + insetStatusBar.dp   // 513
val BottomBoxAndNavBar = BottomBoxHeight + insetNavBar.dp    // 509

MyBoxTheme {
    Surface(Modifier.fillMaxSize()) {
        Box(
            Modifier
                .fillMaxSize()
                .background(Color(0xFF00B8D4))
        ) {
            Box(
                modifier = Modifier
                    .height(BottomBoxAndNavBar)
                    .fillMaxWidth()
                    .align(Alignment.BottomCenter)
                    .background(Color(0x86FF0303)),
            )

            Box(
                modifier = Modifier
                    .height(TopBoxAndStatusBarHeight)
                    .fillMaxWidth()
                    .background(Color(0x8FFFDD03))
                    .align(Alignment.TopCenter)
            )
        }
    }
 }
}


问:
Defining multiple self-relations on the same model with prisma
I could use some help with self relations.

So we basically have a microservice that handles callbacks/postbacks from other another company. A callback can either be completely new, with no relations, or it can be a callback that updates another previous callback, so it has a relation with that callback.

I won't got into too much details, but if it's a callback that is related to another callback, they provide the reference id of the other callback. And that's how we come up with the relation.

This worked perfect with the self relations that is detailed here:
https://www.prisma.io/docs/concepts/components/prisma-schema/relations/self-relations

```<code>referenceId String?   @unique

reference  Callback?  @relation("CallbackHistory", fields: [referenceId], references: [id])

referenceOf Callback? @relation("CallbackHistory")
</code>```

Now here's the problem we encountered - we'd like to have a way to know what the original callback is in this chain of callbacks.  Ideally, we'd like to pass along that relation to all the callbacks that related to eachother.  We realized self relations can only have two sides however - so we can't simply add a:

```<code>original Callback? @relation("CallbackHistory")
</code>```

And we're struggling coming up with another relation name if we'd define another self-relation, nevertheless what we would call the other side of this "original" relation.

Does anyone have here have any input on this? Would appreciate it a ton.

Thanks!

Body:
I could use some help with self relations.

So we basically have a microservice that handles callbacks/postbacks from other another company. A callback can either be completely new, with no relations, or it can be a callback that updates another previous callback, so it has a relation with that callback.

I won't got into too much details, but if it's a callback that is related to another callback, they provide the reference id of the other callback. And that's how we come up with the relation.

This worked perfect with the self relations that is detailed here:
https://www.prisma.io/docs/concepts/components/prisma-schema/relations/self-relations

referenceId String?   @unique

reference  Callback?  @relation("CallbackHistory", fields: [referenceId], references: [id])

referenceOf Callback? @relation("CallbackHistory")

Now here's the problem we encountered - we'd like to have a way to know what the original callback is in this chain of callbacks.  Ideally, we'd like to pass along that relation to all the callbacks that related to eachother.  We realized self relations can only have two sides however - so we can't simply add a:

original Callback? @relation("CallbackHistory")

And we're struggling coming up with another relation name if we'd define another self-relation, nevertheless what we would call the other side of this "original" relation.

Does anyone have here have any input on this? Would appreciate it a ton.

Thanks!


问:
How to add datepicker in antd filter options?
I have antd table in react in which there is one column which has dates, i want to filter the table rows using dates, so i want to use datepicker in antd filter options</p>


问:
Why does not liquibase-mongodb start due to StringUtil?
I'm trying to add liquibase-mongodb dependency to my spring-boot project

```<code>        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-jdbc</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-mongodb</artifactId>
            <version>4.18.0</version>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.8.1</version>
        </dependency>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                    <jvmArguments>-Dfile.encoding=UTF8</jvmArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>4.17.2</version>
                <configuration>
                    <outputDefaultSchema>true</outputDefaultSchema>
                </configuration>
            </plugin>
        </plugins>
    </build>
</code>```

I'm getting the error with the start of my app:

```<code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: liquibase.util.StringUtil
</code>```

I don't use the StringUtil in my project and I don't understand the reason. What must it be and how to solve it?

Body:
I'm trying to add liquibase-mongodb dependency to my spring-boot project

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-jdbc</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-mongodb</artifactId>
            <version>4.18.0</version>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.8.1</version>
        </dependency>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                    <jvmArguments>-Dfile.encoding=UTF8</jvmArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>4.17.2</version>
                <configuration>
                    <outputDefaultSchema>true</outputDefaultSchema>
                </configuration>
            </plugin>
        </plugins>
    </build>

I'm getting the error with the start of my app:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: liquibase.util.StringUtil

I don't use the StringUtil in my project and I don't understand the reason. What must it be and how to solve it?


问:
Compilation of Multifile C++ Code with Template Functions
Suppose, I'm writing a code that contains many template functions across many files. The code is supposed to be used with different datatypes. My first attempt was something like as follows (it's just an example, not my actual project):

main.cpp

```<code>#include <iostream>

#include "template.h"

int main() {
  using T = int;
  T val{ f<T>() };
  std::cout << val;
  return 0;
}
</code>```

template.h

```<code>#ifndef TEMPLATE_H
#define TEMPLATE_H

template <typename T>
T f();

#endif  // TEMPLATE_H
</code>```

template.cpp

```<code>#include "template.h"

template <typename T>
T f() {
  T val{ static_cast<T>(123) };
  return val;
}
</code>```

Compiling the project gave the following error.

```<code>/usr/bin/ld: /tmp/ccEH5mLC.o: in function `main':
main.cpp:(.text+0x9): undefined reference to `int f()'
collect2: error: ld returned 1 exit status
</code>```

Searching for the root of the problem here and there, I have found that it has something to do with template. ISO C++ provides 2 solutions:

Physically moving the definition of the template function into the .h file.

Adding the line template int f<int>(); (or template int f();) to the .cpp file.

The first solution may cause significant code bloat. Thus, as far as I understand, it's not widely used in real projects (I'm not a programmer, so, may be wrong).

The second one doesn't look flexible, since changing T type will require changing all template int f<int>(); (or template int f();) in all .cpp files. Or, if using multiple T types (int and double, for example) will require adding and/or modifying the exising lines.

So, the question is: What solutions (for compiling multiple files projects with many template functions) are used in real life?

Will be glad to hear about all solutions. (Maybe C++ macros can be somehow used? Or CMake features?)

Body:
Suppose, I'm writing a code that contains many template functions across many files. The code is supposed to be used with different datatypes. My first attempt was something like as follows (it's just an example, not my actual project):

main.cpp

#include <iostream>

#include "template.h"

int main() {
  using T = int;
  T val{ f<T>() };
  std::cout << val;
  return 0;
}

template.h

#ifndef TEMPLATE_H
#define TEMPLATE_H

template <typename T>
T f();

#endif  // TEMPLATE_H

template.cpp

#include "template.h"

template <typename T>
T f() {
  T val{ static_cast<T>(123) };
  return val;
}

Compiling the project gave the following error.

/usr/bin/ld: /tmp/ccEH5mLC.o: in function `main':
main.cpp:(.text+0x9): undefined reference to `int f()'
collect2: error: ld returned 1 exit status

Searching for the root of the problem here and there, I have found that it has something to do with template. ISO C++ provides 2 solutions:

Physically moving the definition of the template function into the .h file.

Adding the line template int f<int>(); (or template int f();) to the .cpp file.

The first solution may cause significant code bloat. Thus, as far as I understand, it's not widely used in real projects (I'm not a programmer, so, may be wrong).

The second one doesn't look flexible, since changing T type will require changing all template int f<int>(); (or template int f();) in all .cpp files. Or, if using multiple T types (int and double, for example) will require adding and/or modifying the exising lines.

So, the question is: What solutions (for compiling multiple files projects with many template functions) are used in real life?

Will be glad to hear about all solutions. (Maybe C++ macros can be somehow used? Or CMake features?)


问:
C++ socket connect port assignment issue
I have firewall opened for few ports in my network. I have created one listening port which will just listen for a connection and will create one and again enter into a listening port. I m using boost asio for connection establishment. Listening port is one for which firewall is opened. But the actual port on which connection has been established is assigned by OS. Does OS makes sure the port assigned on actual connection is enabled on firewall or how can I determine that.

Nothing but need to understand how it works


问:
WordPress theme not working on hosting server
I recently built a custom theme for my WordPress site and it works perfectly on my localhost. However, when I uploaded it to my hosting server and activated it, I received an error message saying 'Template is missing. Standalone themes need to have a templates/index.html or index.php template file. Child themes need to have a Template header in the style.css stylesheet.' I've double checked and all of my theme files are properly uploaded and organized on the server. I've also checked the file and directory permissions and they seem to be set correctly. I'm not sure what the issue could be. Any ideas on what I should try to fix this issue? Any help is greatly appreciated.
screen short

I tried the following steps to fix the issue with my theme:

```<code>I backed up my site using a WordPress plugin to ensure that I had a copy of my site's files and data in case something went wrong.
I checked the file and directory permissions on my hosting server to make sure that all of the theme files were set to the correct permissions.
I reviewed the style.css and index.php files to see if there were any issues or mistakes that might be causing the problem.
I made sure that my theme was properly activated in the WordPress dashboard.
</code>```

Despite these efforts, the issue persisted and my theme was still not displaying correctly on the live site. I was expecting the theme to display correctly and for all of its features to work as intended after activating it on the hosting server

Body:
I recently built a custom theme for my WordPress site and it works perfectly on my localhost. However, when I uploaded it to my hosting server and activated it, I received an error message saying 'Template is missing. Standalone themes need to have a templates/index.html or index.php template file. Child themes need to have a Template header in the style.css stylesheet.' I've double checked and all of my theme files are properly uploaded and organized on the server. I've also checked the file and directory permissions and they seem to be set correctly. I'm not sure what the issue could be. Any ideas on what I should try to fix this issue? Any help is greatly appreciated.
screen short

I tried the following steps to fix the issue with my theme:

I backed up my site using a WordPress plugin to ensure that I had a copy of my site's files and data in case something went wrong.
I checked the file and directory permissions on my hosting server to make sure that all of the theme files were set to the correct permissions.
I reviewed the style.css and index.php files to see if there were any issues or mistakes that might be causing the problem.
I made sure that my theme was properly activated in the WordPress dashboard.

Despite these efforts, the issue persisted and my theme was still not displaying correctly on the live site. I was expecting the theme to display correctly and for all of its features to work as intended after activating it on the hosting server


问:
Airflow v2.2.5 on MWAA v2.0.2 is queuing but not running DAG tasks
I'm running Airflow v2.2.5 on MWAA v2.0.2 locally on Docker v20.10.12. I checked the basic debugging checklist for such cases (see here) but I don't see any issue with scheduler or webserver not running, improper start date or schedule, etc.

Here's what I see when looking at (Task) Instance details:

Dagrun Running: Task instance's dagrun was not in the 'running' state but in the state 'queued'.

Task Instance State: Task is in the 'None' state.

I'm not sure what else to look up to fix this issue. Obviously, there are no logs since the task hasn't started.


问:
Running script code from a cell range in google sheets
I am trying to run a javascript from a cell. Suppose there is a javascript mentioned in the cell B4 of a sheet: var x = 'xyz';

Can I somehow get this script from the cell and run it in my javascript?

So that the javascript would return the value of x as xyz.

Please note: I am well aware I could simply type x = ..getRange(B4) and then simply type xyz in the B4 cell. But I am trying to run the entire script itself from the cell B4.

Reason for this is that I want be able to modify the functionality of the script from the cell itself.


问:
Combine two pandas dataframes with mixed indexes
I've split my data into train and test as usual. At this stage, the X and y are perfectly in match, regarding the indexes:

```<code>X_train,X_test,y_train,y_test = train_test_split(X ,y,test_size=0.2,random_state=336546,stratify=y)
</code>```

Then I scaled the train set and the test set:

```<code>from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)
</code>```

The X_train are the features of course, and it is a Numpy array:

```<code>X_train.shape
(4800, 4)

array([[ 0.23444561, -1.04844611, -1.52897964, -1.13790316],
       [ 1.96147606,  0.96211661,  1.26624996, -0.49688872],
       [-0.48043757, -0.49521782,  0.74656146, -0.09336162],
       ...,
       [ 1.11861903,  0.38236699,  0.88486507, -0.25510436],
       [ 0.62653567, -1.51043189, -0.71975475, -1.6024977 ],
       [-0.05089133,  0.15572395,  1.20849261, -1.2588301 ]])
</code>```

I turned it to a pd.DataFrame:

```<code>X_train = pd.DataFrame(X_train, columns = X.columns)
</code>```

and the y_train is the target feature, which is binary 1 or 0, and it is of type pandas.core.frame.DataFrame:

```<code>y_train.shape
(4800, 1)
</code>```

Now, I want to show some plots, using this code:

```<code>sns.pairplot(pd.concat([X_train,y_train],axis=1),hue="y")
plt.show()
</code>```

The problem is the indexes of y_train got all mixed up. The indexes in X_train are still in order from 0 to 4799:

```<code>X_train.index
RangeIndex(start=0, stop=4800, step=1)
</code>```

but in y_train it's like this:

```<code>y_train.index

Int64Index([4789, 3701, 5132, 2299, 5002, 3557, 2522, 2440, 4440, 1885,
            ...
            4317, 4581, 5474, 3481,  756, 4753, 5304, 4193, 2012, 4273],
           dtype='int64', length=4800)
</code>```

This arises an alert, that I might have done something wrong here. why did the y_train indexes get all mixed up, although everything was just fine before splitting the data. How do I make both X_train and y_train in match?

Body:
I've split my data into train and test as usual. At this stage, the X and y are perfectly in match, regarding the indexes:

X_train,X_test,y_train,y_test = train_test_split(X ,y,test_size=0.2,random_state=336546,stratify=y)

Then I scaled the train set and the test set:

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

The X_train are the features of course, and it is a Numpy array:

X_train.shape
(4800, 4)

array([[ 0.23444561, -1.04844611, -1.52897964, -1.13790316],
       [ 1.96147606,  0.96211661,  1.26624996, -0.49688872],
       [-0.48043757, -0.49521782,  0.74656146, -0.09336162],
       ...,
       [ 1.11861903,  0.38236699,  0.88486507, -0.25510436],
       [ 0.62653567, -1.51043189, -0.71975475, -1.6024977 ],
       [-0.05089133,  0.15572395,  1.20849261, -1.2588301 ]])

I turned it to a pd.DataFrame:

X_train = pd.DataFrame(X_train, columns = X.columns)

and the y_train is the target feature, which is binary 1 or 0, and it is of type pandas.core.frame.DataFrame:

y_train.shape
(4800, 1)

Now, I want to show some plots, using this code:

sns.pairplot(pd.concat([X_train,y_train],axis=1),hue="y")
plt.show()

The problem is the indexes of y_train got all mixed up. The indexes in X_train are still in order from 0 to 4799:

X_train.index
RangeIndex(start=0, stop=4800, step=1)

but in y_train it's like this:

y_train.index

Int64Index([4789, 3701, 5132, 2299, 5002, 3557, 2522, 2440, 4440, 1885,
            ...
            4317, 4581, 5474, 3481,  756, 4753, 5304, 4193, 2012, 4273],
           dtype='int64', length=4800)

This arises an alert, that I might have done something wrong here. why did the y_train indexes get all mixed up, although everything was just fine before splitting the data. How do I make both X_train and y_train in match?


问:
Implementing custom/no-model page in admin
I tried following this, but could not get it to work. I want to create a total custom site in admin (superuser login protected).

Here is what I tried:

admin.py:

```<code>class CampaignAdminSite(AdminSite):
    def get_urls(self):
        custom_urls = [re_path("campaigns/", self.admin_view(my_view)),]
        urls = super().get_urls()
        return custom_urls + urls

def my_view(request):
    return render(request, 'admin_campaign.html'
</code>```

I hoped for the extra link campaigns to show up as an item in the admin first page - but I do not see anything, and I cannot go to the link by directly addressing it in the navbar. Do I need more?

Body:
I tried following this, but could not get it to work. I want to create a total custom site in admin (superuser login protected).

Here is what I tried:

admin.py:

class CampaignAdminSite(AdminSite):
    def get_urls(self):
        custom_urls = [re_path("campaigns/", self.admin_view(my_view)),]
        urls = super().get_urls()
        return custom_urls + urls

def my_view(request):
    return render(request, 'admin_campaign.html'

I hoped for the extra link campaigns to show up as an item in the admin first page - but I do not see anything, and I cannot go to the link by directly addressing it in the navbar. Do I need more?


问:
405 method not accepted laravel on live server
I'm creating Api's in laravel 5.7 with php version 7.4 using passport
Its an Api of Signin.
The Api works fine on local server but when we try it on live server it gives an error of
405 method not accepted.
Don't know why its like that because its working fine on local server but not on live server</p>


问:
Login error: login failed errorCode:6 : Agora
When I try to call the login method in the agora client, I am getting

Login error: login failed errorCode: 6

Initiated the client successfully.

I tried the below method for login. I have given a valid user ID for generating tokens. UserId is an integer value converted to a string. Ex: "18".

```<code>void _login(BuildContext context) async {
String userId = _userId.text;
if (userId.isEmpty) {
  print('Please input your user id to login.');
  return;
}

try {
  await _client.login(token, userId);
  logController.addLog('Login success: ' + userId);
} catch (errorCode) {
  var value =  errorCode as AgoraRtmClientException;
  print('Login error: ' + value.reason);
}
</code>```

}

Body:
When I try to call the login method in the agora client, I am getting

Login error: login failed errorCode: 6

Initiated the client successfully.

I tried the below method for login. I have given a valid user ID for generating tokens. UserId is an integer value converted to a string. Ex: "18".

void _login(BuildContext context) async {
String userId = _userId.text;
if (userId.isEmpty) {
  print('Please input your user id to login.');
  return;
}

try {
  await _client.login(token, userId);
  logController.addLog('Login success: ' + userId);
} catch (errorCode) {
  var value =  errorCode as AgoraRtmClientException;
  print('Login error: ' + value.reason);
}

}


问:
Auto Class Completion of all the classes of a unit
I've created a function to extract Objects from a special JSON file extracted from SwaggerHub and create a unit for them. My functions is like this:

```<code>CreateUnit('d:\a.json', 'd:\MyAPI.pas');
</code>```

And creates a unit like this:

```<code>unit MyAPI;

interface

type
  TType1 = class;
  TType2 = class;
  TType3 = class;
  ...

  TType1 = class
    property p1: TType1;
    property p2: TType2;
    property p3: String;
    property p4: Integer;
  end;

  TType2 = class
    property p1: TType1;
    property p2: TType3;
    property p3: String;
    property p4: Integer;
    property p5: Integer;
    property p6: string;
  end;

  ...

implementation

end.
</code>```

This unit contains 133 classes and I want to apply the "Complete Class at Cursor" (Shift+Ctrl+C) on all classes. If I do it one by one, it takes a lot of time because every time I press Shift+Ctrl+C the cursor jumps to the bottom of the unit and I must go up and find the next uncompleted class.

Is there any Idea?

Body:
I've created a function to extract Objects from a special JSON file extracted from SwaggerHub and create a unit for them. My functions is like this:

CreateUnit('d:\a.json', 'd:\MyAPI.pas');

And creates a unit like this:

unit MyAPI;

interface

type
  TType1 = class;
  TType2 = class;
  TType3 = class;
  ...

  TType1 = class
    property p1: TType1;
    property p2: TType2;
    property p3: String;
    property p4: Integer;
  end;

  TType2 = class
    property p1: TType1;
    property p2: TType3;
    property p3: String;
    property p4: Integer;
    property p5: Integer;
    property p6: string;
  end;

  ...

implementation

end.

This unit contains 133 classes and I want to apply the "Complete Class at Cursor" (Shift+Ctrl+C) on all classes. If I do it one by one, it takes a lot of time because every time I press Shift+Ctrl+C the cursor jumps to the bottom of the unit and I must go up and find the next uncompleted class.

Is there any Idea?


问:
Is it good to use Python garbage collecter inside the program?
I have written an NLP GUI program with python. Everything works well and there is no problem. Since the program should process large corpus and make graphs, in order to free memory and let the processes to fit inside the RAM, i have used gc.collect() in several parts to delete some big variables.
My question is this: is it right and efficient to use gc.collect() manually in several parts when processing big datasets or let the python use its automatic garbage collector?? I mean, does it have a bad effect on the flow of the program or gc.collect() works well? I have heard that using gc.collect() when processing big datasets, have bad effects on the program flow and even some times it wastes more RAM space to delete and free variables. I really appreciate answers which guide me.


问:
How can I show colored text using curses without init_pair?
I had making a program with curses.
I want show colored text without curses.init_pair().
Code like this:

#! /usr/bin/env python

import curses

def allcolors():
    """Set the colors.

    The format is: fg*256+bg
    """
    if curses.COLORS**2 < curses.COLOR_PAIRS:
        raise Exception("Can't init all colors.")
    for i in range(8):
        for j in range(8):
            curses.init_pair(i*8+j, i, j)
            pass
        pass
    pass

try:
    stdscr=curses.initscr()
    curses.noecho()
    curses.cbreak()
    stdscr.keypad(True)
    try:
        curses.start_color()
        allcolors()
        canColor=True
    except:
        canColor=False
        pass

    # ---
    stdscr.addstr('%s' % curses.COLORS, curses.color_pair(curses.COLOR_RED*8+curses.COLOR_MAGENTA))
    stdscr.getch()
    # ---

finally:
    if 'stdscr' in locals():
        stdscr.keypad(False)
        curses.echo()
        curses.nocbreak()
        curses.endwin()
```

But it failed. Not any things showed.

How can I do that? Or how can I set the color pairs regularly?

Body:
I had making a program with curses.
I want show colored text without curses.init_pair().
Code like this:

#! /usr/bin/env python

import curses

def allcolors():
    """Set the colors.

    The format is: fg*256+bg
    """
    if curses.COLORS**2 < curses.COLOR_PAIRS:
        raise Exception("Can't init all colors.")
    for i in range(8):
        for j in range(8):
            curses.init_pair(i*8+j, i, j)
            pass
        pass
    pass

try:
    stdscr=curses.initscr()
    curses.noecho()
    curses.cbreak()
    stdscr.keypad(True)
    try:
        curses.start_color()
        allcolors()
        canColor=True
    except:
        canColor=False
        pass

    # ---
    stdscr.addstr('%s' % curses.COLORS, curses.color_pair(curses.COLOR_RED*8+curses.COLOR_MAGENTA))
    stdscr.getch()
    # ---

finally:
    if 'stdscr' in locals():
        stdscr.keypad(False)
        curses.echo()
        curses.nocbreak()
        curses.endwin()

But it failed. Not any things showed.

How can I do that? Or how can I set the color pairs regularly?


问:
how can i save contentype/mimetype of a file/image to node.js using expess and multer
Still a beginner, I was currently learning how to upload images, save them to a database and then display them to a client, in the database, i m trying to save the filename, contentType and base64 Encoding, all with the type String, but i keep getting the error: error    "uploads validation failed: ContentType: Path ContentType is required."

But I did specify the path, can anyone please help. find code below

schema.js

```<code>const mongoose = require('mongoose')

const uploadSchema = new mongoose.Schema({
    filename: {
        type: String,
        unique: true,
        required: true
    },
    ContentType: {
        type: String,
        required: true
    },
    imageBase64: {
        type: String,
        required: true
    }
})

module.exports = mongoose.model('uploads', uploadSchema)
</code>```

controller.js

```<code>const UploadModel = require('../model/schema')
const fs = require('fs')
const mongoose = require('mongoose')

exports.home = (req, res, next) => {
    res.render('index')
}

exports.uploads = (req, res, next) => {
    const files = req.files
    if (!files) {
        const err = new Error('Please choose files')
        err.httpStatusCode = 400
        return next(err)
    }

    // Convert images into based64 encoding
    let imgArray = files.map((file) => {
        let img = fs.readFileSync(file.path)

        return encode_image = img.toString('base64')
    })

    let results = imgArray.map((src, index) => {

        // Create object to store data in the collection
        let finalImg = {
            filename: files[index].originalname,
            contentType: files[index].mimetype,
            imageBase64: src
        }
        console.log(finalImg.contentType)

        let newUpload = new UploadModel(finalImg)
        return newUpload
        .save()
        .then(() => {
            return {msg: `${files[index].originalname} Uploaded Sucessfully...!`}
        })
        .catch((err) => {
            if(err) {
                if(err.name === 'MongoError' && err.code === 11000) {
                    return Promise.reject({err: `Duplicate ${files[index].originalname}.File Already exists!`})
                }
                return Promise.reject({error: err.message || `Cannot Upload ${files[index].originalname} Something missing!`})
            }
        })
    })

    Promise.all(results)
    .then(msg => {
        //res.redirect('/')
        res.json(msg)
    })
    .catch(err => {
        res.json(err)
    })

}
</code>```

Body:
Still a beginner, I was currently learning how to upload images, save them to a database and then display them to a client, in the database, i m trying to save the filename, contentType and base64 Encoding, all with the type String, but i keep getting the error: error    "uploads validation failed: ContentType: Path ContentType is required."

But I did specify the path, can anyone please help. find code below

schema.js

const mongoose = require('mongoose')

const uploadSchema = new mongoose.Schema({
    filename: {
        type: String,
        unique: true,
        required: true
    },
    ContentType: {
        type: String,
        required: true
    },
    imageBase64: {
        type: String,
        required: true
    }
})

module.exports = mongoose.model('uploads', uploadSchema)

controller.js

const UploadModel = require('../model/schema')
const fs = require('fs')
const mongoose = require('mongoose')

exports.home = (req, res, next) => {
    res.render('index')
}

exports.uploads = (req, res, next) => {
    const files = req.files
    if (!files) {
        const err = new Error('Please choose files')
        err.httpStatusCode = 400
        return next(err)
    }

    // Convert images into based64 encoding
    let imgArray = files.map((file) => {
        let img = fs.readFileSync(file.path)

        return encode_image = img.toString('base64')
    })

    let results = imgArray.map((src, index) => {

        // Create object to store data in the collection
        let finalImg = {
            filename: files[index].originalname,
            contentType: files[index].mimetype,
            imageBase64: src
        }
        console.log(finalImg.contentType)

        let newUpload = new UploadModel(finalImg)
        return newUpload
        .save()
        .then(() => {
            return {msg: `${files[index].originalname} Uploaded Sucessfully...!`}
        })
        .catch((err) => {
            if(err) {
                if(err.name === 'MongoError' && err.code === 11000) {
                    return Promise.reject({err: `Duplicate ${files[index].originalname}.File Already exists!`})
                }
                return Promise.reject({error: err.message || `Cannot Upload ${files[index].originalname} Something missing!`})
            }
        })
    })

    Promise.all(results)
    .then(msg => {
        //res.redirect('/')
        res.json(msg)
    })
    .catch(err => {
        res.json(err)
    })

}


问:
Proguard issues after upgrading gradle plugin
I have been trying to upgrade gradle plugin and i am running into proguard issues after the plugin update.

Proguard is removing all the required classes and i am facing run time issue.

Can anyone suggest me on debugging the proguard issues.

I have tried the following suggestion given in this link but failed to resolve the issues.


Title: Why does Transpose Function gives error at times in R

Body:
I wrote this code to transpose the Data frame, the odd part of this is this code works quite a lot of times and at times it doesn't work, which is baffling.

Book5<- read_excel("C:/X/X/X/X/1.1 Croston_Aplha-0.1.xlsx")
X1 <- transpose(Book5,keep.names="rn")

The error I get for this is:

Error in transpose(Book5, keep.names = "rn") :
  unused argument (keep.names = "rn")

Dput for the data frame is :

structure(list(`Row Labels` = c("2019-01-01", "2019-02-01", "2019-03-01",
"2019-04-01", "2019-05-01", "2019-06-01", "2019-07-01", "2019-08-01",
"2019-09-01", "2019-10-01", "2019-11-01", "2019-12-01", "2020-01-01",
"2020-02-01", "2020-03-01", "2020-04-01", "2020-05-01", "2020-06-01",
"2020-07-01", "2020-08-01", "2020-09-01", "2020-10-01", "2020-11-01",
"2020-12-01", "2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01",
"2021-05-01", "2021-06-01", "2021-07-01", "2021-08-01", "2021-09-01",
"2021-10-01", "2021-11-01", "2021-12-01", "2022-01-01", "2022-02-01",
"2022-03-01", "2022-04-01", "2022-05-01", "2022-06-01", "2022-07-01",
"2022-08-01", "2022-09-01", "2022-10-01"), `XYZ|146` = c(0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 18, 16, 16, 17, 12, 22, 6,
7, 6, 0, 15, 0, 17, 17, 5, 19, 16, 7, 25, 19, 34, 26, 41, 50,
29, 42, 20, 14, 16, 27, 10, 28, 21), `XYZ|666` = c(0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 45,
9, 21, 33, 3, 8, 11, 16, 3, 17, 14, 59, 26, 35, 26, 15, 7, 4,
4, 2, 7, 6, 2), `XYZ|574` = c(0, 0, 0, 0, 0, 0, 0, 0, 74, 179,
464, 880, 324, 184, 90, 170, 140, 96, 78, 83, 83, 121, 245, 740,
332, 123, 117, 138, 20, 42, 70, 70, 42, 103, 490, 641, 488, 245,
142, 95, 63, 343, 57, 113, 100, 105), `XYZ|851` = c(0, 0, 0,
0, 0, 0, 0, 0, 0, 206, 1814, 2324, 772, 1116, 1636, 1906, 957,
829, 911, 786, 938, 1313, 2384, 1554, 1777, 1635, 1534, 1015,
827, 982, 685, 767, 511, 239, 1850, 1301, 426, 261, 201, 33,
0, 0, 0, 0, 0, 0)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-46L))

Can someone tell me why is this acting like this? The expected output is given below:


问:
TypeError: Cannot read properties of undefined (reading 'userRoleDOList')
```<code>
TypeError: Cannot read properties of undefined (reading 'userRoleDOList')
at AppLayoutComponent.getMenu (http://localhost:9876/_karma_webpack_/webpack:/src/app/BaseFramework/base-ui/app-layout/app-layout.component.ts:405:52)
at AppLayoutComponent.ngOnInit (http://localhost:9876/_karma_webpack_/webpack:/src/app/BaseFramework/base-ui/app-layout/app-layout.component.ts:381:12)
</code>```

spec.ts file

```<code>import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppMetadataHandler } from 'app/BaseFramework/configs';
import { ApiRequestService, AuthenticationService, CommonUtilty, UserInfoService } from 'app/BaseFramework/core';
import { MenuService } from 'app/BaseFramework/core/services/menu/menu.service';
import { MultiLingualService } from 'app/BaseFramework/core/services/multi-lingual/multi-lingual.service';
import { NgZorroAntdModule } from 'app/ng-zorro.module';

import { AppLayoutComponent } from './app-layout.component';

describe('AppLayoutComponent', () => {
  let component: AppLayoutComponent;
  let fixture: ComponentFixture<AppLayoutComponent>;
  let mockMultiLingualService;
  let mockAppMetadataHandler;
  let mockAuthenticationService;
  let mockMenuService;
  let mockUserInfoService;
  let mockCommonUtilty;
  let mockApiRequestService;
  beforeEach(waitForAsync(() => {
    mockMultiLingualService = jasmine.createSpyObj('MultiLingualService',['setLanguage']);
    mockAppMetadataHandler = jasmine.createSpyObj('AppMetadataHandler', ['getAppMetadata']);
    mockAuthenticationService = jasmine.createSpyObj('AuthenticationService', ['logout']);
    mockMenuService = jasmine.createSpyObj('MenuService', ['getMenu']);
    mockUserInfoService = jasmine.createSpyObj('UserInfoService', ['getUserInfo','setUserInfo']);
    // mockUserInfoService.getUserInfo.and.returnValue('userRoleDOList')
    mockCommonUtilty= jasmine.createSpyObj('CommonUtility', ['getAppMetadata','isArrayIterable']);
    mockApiRequestService = jasmine.createSpyObj('ApiRequestService', ['get']);

    TestBed.configureTestingModule({
      declarations: [ AppLayoutComponent ],
      providers: [
        {provide: MultiLingualService, useValue: mockMultiLingualService},
        {provide: AppMetadataHandler, useValue: mockAppMetadataHandler},
        {provide: AuthenticationService, useValue: mockAuthenticationService},
        {provide: MenuService, useValue: mockMenuService},
        {provide: UserInfoService, useValue: mockUserInfoService},
        {provide: CommonUtilty, useValue: mockCommonUtilty},
        {provide: ApiRequestService, useValue: mockApiRequestService},
      ],
      imports:[NgZorroAntdModule,RouterTestingModule]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(AppLayoutComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
    component.getMenu()
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});
</code>```

.ts file

```<code>
ngOnInit() {
if (environment['hardcodedMenu']) {
//this.getDemoMenu()
this.getDemoProposedMenu();
}
else {
this.getMenu();
}

    this.organizationMetaData = this.appOrganizationSettings.getOrganizationMetaData();

    this.featureFlagsArray = this.extractFeatureFlags(this.featureFlags);

}

getMenu() {
    let userInfo = this.userInfoService.getUserInfo();
    let userRole = null;
    if (this.commonUtilty.isArrayIterable(userInfo.userRoleDOList)) {
      let userRoleDO = userInfo.userRoleDOList.find(item => true);
      userRole = userRoleDO.roleId;
    }
</code>```

is there any way to fake the getMenu method trying to read the userRoleDOList because I dont need the getMenu methods for my test as I am only testing an another function that is not inside the ngOnInIt.

Spec:

Angular CLI: 12.2.18

Node: 14.17.3

Package Manager: npm 6.14.13

OS: win32 x64

Angular: 12.2.17

Body:
TypeError: Cannot read properties of undefined (reading 'userRoleDOList')
at AppLayoutComponent.getMenu (http://localhost:9876/_karma_webpack_/webpack:/src/app/BaseFramework/base-ui/app-layout/app-layout.component.ts:405:52)
at AppLayoutComponent.ngOnInit (http://localhost:9876/_karma_webpack_/webpack:/src/app/BaseFramework/base-ui/app-layout/app-layout.component.ts:381:12)

spec.ts file

import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppMetadataHandler } from 'app/BaseFramework/configs';
import { ApiRequestService, AuthenticationService, CommonUtilty, UserInfoService } from 'app/BaseFramework/core';
import { MenuService } from 'app/BaseFramework/core/services/menu/menu.service';
import { MultiLingualService } from 'app/BaseFramework/core/services/multi-lingual/multi-lingual.service';
import { NgZorroAntdModule } from 'app/ng-zorro.module';

import { AppLayoutComponent } from './app-layout.component';

describe('AppLayoutComponent', () => {
  let component: AppLayoutComponent;
  let fixture: ComponentFixture<AppLayoutComponent>;
  let mockMultiLingualService;
  let mockAppMetadataHandler;
  let mockAuthenticationService;
  let mockMenuService;
  let mockUserInfoService;
  let mockCommonUtilty;
  let mockApiRequestService;
  beforeEach(waitForAsync(() => {
    mockMultiLingualService = jasmine.createSpyObj('MultiLingualService',['setLanguage']);
    mockAppMetadataHandler = jasmine.createSpyObj('AppMetadataHandler', ['getAppMetadata']);
    mockAuthenticationService = jasmine.createSpyObj('AuthenticationService', ['logout']);
    mockMenuService = jasmine.createSpyObj('MenuService', ['getMenu']);
    mockUserInfoService = jasmine.createSpyObj('UserInfoService', ['getUserInfo','setUserInfo']);
    // mockUserInfoService.getUserInfo.and.returnValue('userRoleDOList')
    mockCommonUtilty= jasmine.createSpyObj('CommonUtility', ['getAppMetadata','isArrayIterable']);
    mockApiRequestService = jasmine.createSpyObj('ApiRequestService', ['get']);

    TestBed.configureTestingModule({
      declarations: [ AppLayoutComponent ],
      providers: [
        {provide: MultiLingualService, useValue: mockMultiLingualService},
        {provide: AppMetadataHandler, useValue: mockAppMetadataHandler},
        {provide: AuthenticationService, useValue: mockAuthenticationService},
        {provide: MenuService, useValue: mockMenuService},
        {provide: UserInfoService, useValue: mockUserInfoService},
        {provide: CommonUtilty, useValue: mockCommonUtilty},
        {provide: ApiRequestService, useValue: mockApiRequestService},
      ],
      imports:[NgZorroAntdModule,RouterTestingModule]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(AppLayoutComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
    component.getMenu()
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});

.ts file

ngOnInit() {
if (environment['hardcodedMenu']) {
//this.getDemoMenu()
this.getDemoProposedMenu();
}
else {
this.getMenu();
}

    this.organizationMetaData = this.appOrganizationSettings.getOrganizationMetaData();

    this.featureFlagsArray = this.extractFeatureFlags(this.featureFlags);

}

getMenu() {
    let userInfo = this.userInfoService.getUserInfo();
    let userRole = null;
    if (this.commonUtilty.isArrayIterable(userInfo.userRoleDOList)) {
      let userRoleDO = userInfo.userRoleDOList.find(item => true);
      userRole = userRoleDO.roleId;
    }

is there any way to fake the getMenu method trying to read the userRoleDOList because I dont need the getMenu methods for my test as I am only testing an another function that is not inside the ngOnInIt.

Spec:

Angular CLI: 12.2.18

Node: 14.17.3

Package Manager: npm 6.14.13

OS: win32 x64

Angular: 12.2.17


问:
Error: HttpError: Resource not accessible by integration when using merge-schedule-action
I am attempting to use merge-schedule-action to update my webcomic. However the workflow job fails. The description goes like:
/schedule 2022-01-02(which is it)
But I get an error when it runs the job after creating the pull request.

```<code>Run gr[2](https://github.com/AHumanIBelieve/ahumanibelieve.github.io/actions/runs/3817569850/jobs/6493904876#step:2:2)m/merge-schedule-action@v2
  with:
    merge_method: merge
    time_zone: UTC
    require_statuses_success: false
    automerge_fail_label: automerge-fail
  env:
    GITHUB_TOKEN: ***
Handling pull request opened for https://github.com/AHumanIBelieve/ahumanibelieve.github.io/pull/[5](https://github.com/AHumanIBelieve/ahumanibelieve.github.io/actions/runs/3817569850/jobs/6493904876#step:2:4)
Schedule date found: "2022-01-02"
Error: HttpError: Resource not accessible by integration
</code>```

Is there something I am missing or is it just my repo? Do I need to give it permissions or something?
Link to pull request: AHumanIBelieve/ahumanibelieve.github.io#5

I have tried copy and pasting the workflow yaml file directly, but it doesn't work.

https://github.com/marketplace/actions/merge-schedule

Body:
I am attempting to use merge-schedule-action to update my webcomic. However the workflow job fails. The description goes like:
/schedule 2022-01-02(which is it)
But I get an error when it runs the job after creating the pull request.

Run gr[2](https://github.com/AHumanIBelieve/ahumanibelieve.github.io/actions/runs/3817569850/jobs/6493904876#step:2:2)m/merge-schedule-action@v2
  with:
    merge_method: merge
    time_zone: UTC
    require_statuses_success: false
    automerge_fail_label: automerge-fail
  env:
    GITHUB_TOKEN: ***
Handling pull request opened for https://github.com/AHumanIBelieve/ahumanibelieve.github.io/pull/[5](https://github.com/AHumanIBelieve/ahumanibelieve.github.io/actions/runs/3817569850/jobs/6493904876#step:2:4)
Schedule date found: "2022-01-02"
Error: HttpError: Resource not accessible by integration

Is there something I am missing or is it just my repo? Do I need to give it permissions or something?
Link to pull request: AHumanIBelieve/ahumanibelieve.github.io#5

I have tried copy and pasting the workflow yaml file directly, but it doesn't work.

https://github.com/marketplace/actions/merge-schedule


问:
How do I define color groups based on numerical threshold values for ggplot2 barplot
I want to make a bar plot in ggplors where the value below zero is in red color. However, I got this graph instead of red color below zero value. Can anyone help me to solve the problem above? I have tried following some manual code but could not find the answers still.
Greatly appreciate for your help.

I tried this code:

```<code>Central_Java %>%
  mutate(Category = factor(Category, levels = c("Minimum", "Medium", "Slightly Ideal", "Ideal"))) %>%
  ggplot(aes(Province, Above_Below_Required_Staff, fill = Available_Staff, color=ifelse(Above_Below_Required_Staff>0, "red", "blue"))) +
  xlab ("MPAs in Central Java\n(n=1)") + ylab ("Percent of Required Staff")+
  ylim(-100,100)+
  facet_wrap(~Category, ncol = 4)+
  geom_bar(stat="identity")+
  geom_hline(yintercept = 0, colour = "black") +
  theme_light(base_size = 20) +
  theme_bw()+
  theme(text=element_text(size=19))+
  ggtitle("Level of MPA Staff Capacity")+  theme(plot.title = element_text(hjust = 0.5))+
  theme(
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank()
  )

'''

Best,

[enter image description here] (https://i.stack.imgur.com/HPvZe.png)
</code>```

Body:
I want to make a bar plot in ggplors where the value below zero is in red color. However, I got this graph instead of red color below zero value. Can anyone help me to solve the problem above? I have tried following some manual code but could not find the answers still.
Greatly appreciate for your help.

I tried this code:

Central_Java %>%
  mutate(Category = factor(Category, levels = c("Minimum", "Medium", "Slightly Ideal", "Ideal"))) %>%
  ggplot(aes(Province, Above_Below_Required_Staff, fill = Available_Staff, color=ifelse(Above_Below_Required_Staff>0, "red", "blue"))) +
  xlab ("MPAs in Central Java\n(n=1)") + ylab ("Percent of Required Staff")+
  ylim(-100,100)+
  facet_wrap(~Category, ncol = 4)+
  geom_bar(stat="identity")+
  geom_hline(yintercept = 0, colour = "black") +
  theme_light(base_size = 20) +
  theme_bw()+
  theme(text=element_text(size=19))+
  ggtitle("Level of MPA Staff Capacity")+  theme(plot.title = element_text(hjust = 0.5))+
  theme(
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank()
  )

'''

Best,

[enter image description here] (https://i.stack.imgur.com/HPvZe.png)


问:
TinyMce Error "Your browser doesn't support copy/paste" how to resolve?
I am usign tinymce version 5.10.2
However when i try to paste something into tinymce using contextmenu. I am getting below error please help.

"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead."


问:
How to pass an array or list to a query in Realm Kotlin?
Help me please. I'm trying to find all matches of the field OWNER with array elements.

But the result is an error:

```<code>val persons = arrayOf("Anna", "Jon", "Mary")

val accounts = realm.query(AccountStorageItem::class, "owner IN $persons").find()
</code>```

I try different things but nothing works

This is how everything works fine, but I really need to pass an array:

```<code>val accounts = realm.query(AccountStorageItem::class, "owner IN {"Anna", "Jon", "Mary"}").find()
</code>```

Body:
Help me please. I'm trying to find all matches of the field OWNER with array elements.

But the result is an error:

val persons = arrayOf("Anna", "Jon", "Mary")

val accounts = realm.query(AccountStorageItem::class, "owner IN $persons").find()

I try different things but nothing works

This is how everything works fine, but I really need to pass an array:

val accounts = realm.query(AccountStorageItem::class, "owner IN {"Anna", "Jon", "Mary"}").find()