问:
SceneKit SCNPhysicsBody performance
SceneKit SCNPhysicsBody performance doesn't seem to take advantage of the multiple cores.
I created a quick bit of code that puts a bunch of small spheres on top of a cube where they drop under gravity.  As the number of spheres increases things get very slow.  I don't see a way of getting optimal multicore performance.  Anyone have any ideas?

I did some quick tests with a stopwatch and observing the simulation to a specific point launching 1,5 and 8 instances of the app.

1 instance running : 15 seconds

2 instances running : 25 seconds

8 instances running : 35 seconds

It is clear that the multcores are not being used optimally for simulation with just one instance.

```<code>func createCubeWithSpheres(bottomLeft: SCNVector3, topRight: SCNVector3, radiusOfSpheres: Double) -> SCNNode {
  // Create the box using the bottomLeft and topRight coordinates
  let box = SCNBox(
    width: topRight.x - bottomLeft.x,
    height: topRight.y - bottomLeft.y,
    length: topRight.z - bottomLeft.z,
    chamferRadius: 0.0
  )
  let node = SCNNode(geometry: box)

  // Add a static physics body to the box
  node.physicsBody = SCNPhysicsBody(type: .static, shape: nil)

  // Calculate the dimensions of the box
  let width = box.width
  let height = box.height
  let depth = box.length

  // Calculate the maximum number of spheres that can fit inside the box
  let maxNumSpheresWidth = Int(width / (radiusOfSpheres * 2))
  let maxNumSpheresHeight = Int(height / (radiusOfSpheres * 2))
  let maxNumSpheresDepth = Int(depth / (radiusOfSpheres * 2))
  let maxNumSpheres = maxNumSpheresWidth * maxNumSpheresHeight * maxNumSpheresDepth

  // Create an array to hold the spheres
  var spheres = [Sphere]()

  // Create the spheres and add them to the array
  for zIndex in 0..<maxNumSpheresDepth {
    for yIndex in 0..<maxNumSpheresHeight {
      for xIndex in 0..<maxNumSpheresWidth {
        let xPos = bottomLeft.x + radiusOfSpheres + (radiusOfSpheres * 2) * CGFloat(xIndex)
        let yPos = bottomLeft.y + radiusOfSpheres + (radiusOfSpheres * 2) * CGFloat(yIndex)
        let zPos = bottomLeft.z + radiusOfSpheres + (radiusOfSpheres * 2) * CGFloat(zIndex)
        let sphere = Sphere(radius: radiusOfSpheres, position: SCNVector3(xPos, yPos, zPos))
        spheres.append(sphere)
      }
    }
  }

  // Add the spheres to the box's node
  for sphere in spheres {
    node.addChildNode(sphere.node)
  }
  return node
}

class Sphere {
    let node = SCNNode()

    // Initialize the sphere with a radius and position.
    init(radius: CGFloat, position: SCNVector3? = nil) {
        node.geometry = SCNSphere(radius: radius)
        if let position = position {
            node.position = position
        }
        // Add a physics body to the sphere so that it can interact with other objects.
        node.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil)

        // Add a "stickiness" to the sphere by applying a static electric field to it.
//        let electricField = SCNPhysicsField.electric()
//        electricField.strength = 10 // Adjust this value to increase or decrease the stickiness of the sphere.
//        node.physicsField = electricField
    }
}

let box = createCubeWithSpheres(bottomLeft: SCNVector3(x: 0.0, y: 0.0, z: 0.0), topRight: SCNVector3(x: 5.0, y: 5.0, z: 5.0), radiusOfSpheres: 0.1)

scene.rootNode.addChildNode(box)
</code>```

Anyway to speed this up with one instance running without giving up collision accuracy?

Title: SceneKit SCNPhysicsBody performance

Body:
SceneKit SCNPhysicsBody performance doesn't seem to take advantage of the multiple cores.
I created a quick bit of code that puts a bunch of small spheres on top of a cube where they drop under gravity.  As the number of spheres increases things get very slow.  I don't see a way of getting optimal multicore performance.  Anyone have any ideas?

I did some quick tests with a stopwatch and observing the simulation to a specific point launching 1,5 and 8 instances of the app.

1 instance running : 15 seconds

2 instances running : 25 seconds

8 instances running : 35 seconds

It is clear that the multcores are not being used optimally for simulation with just one instance.

func createCubeWithSpheres(bottomLeft: SCNVector3, topRight: SCNVector3, radiusOfSpheres: Double) -> SCNNode {
  // Create the box using the bottomLeft and topRight coordinates
  let box = SCNBox(
    width: topRight.x - bottomLeft.x,
    height: topRight.y - bottomLeft.y,
    length: topRight.z - bottomLeft.z,
    chamferRadius: 0.0
  )
  let node = SCNNode(geometry: box)

  // Add a static physics body to the box
  node.physicsBody = SCNPhysicsBody(type: .static, shape: nil)

  // Calculate the dimensions of the box
  let width = box.width
  let height = box.height
  let depth = box.length

  // Calculate the maximum number of spheres that can fit inside the box
  let maxNumSpheresWidth = Int(width / (radiusOfSpheres * 2))
  let maxNumSpheresHeight = Int(height / (radiusOfSpheres * 2))
  let maxNumSpheresDepth = Int(depth / (radiusOfSpheres * 2))
  let maxNumSpheres = maxNumSpheresWidth * maxNumSpheresHeight * maxNumSpheresDepth

  // Create an array to hold the spheres
  var spheres = [Sphere]()

  // Create the spheres and add them to the array
  for zIndex in 0..<maxNumSpheresDepth {
    for yIndex in 0..<maxNumSpheresHeight {
      for xIndex in 0..<maxNumSpheresWidth {
        let xPos = bottomLeft.x + radiusOfSpheres + (radiusOfSpheres * 2) * CGFloat(xIndex)
        let yPos = bottomLeft.y + radiusOfSpheres + (radiusOfSpheres * 2) * CGFloat(yIndex)
        let zPos = bottomLeft.z + radiusOfSpheres + (radiusOfSpheres * 2) * CGFloat(zIndex)
        let sphere = Sphere(radius: radiusOfSpheres, position: SCNVector3(xPos, yPos, zPos))
        spheres.append(sphere)
      }
    }
  }

  // Add the spheres to the box's node
  for sphere in spheres {
    node.addChildNode(sphere.node)
  }
  return node
}

class Sphere {
    let node = SCNNode()

    // Initialize the sphere with a radius and position.
    init(radius: CGFloat, position: SCNVector3? = nil) {
        node.geometry = SCNSphere(radius: radius)
        if let position = position {
            node.position = position
        }
        // Add a physics body to the sphere so that it can interact with other objects.
        node.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil)

        // Add a "stickiness" to the sphere by applying a static electric field to it.
//        let electricField = SCNPhysicsField.electric()
//        electricField.strength = 10 // Adjust this value to increase or decrease the stickiness of the sphere.
//        node.physicsField = electricField
    }
}

let box = createCubeWithSpheres(bottomLeft: SCNVector3(x: 0.0, y: 0.0, z: 0.0), topRight: SCNVector3(x: 5.0, y: 5.0, z: 5.0), radiusOfSpheres: 0.1)

scene.rootNode.addChildNode(box)

Anyway to speed this up with one instance running without giving up collision accuracy?


来源: stackexchange

问:
Android - Set Adapter for Reconstructed Material Exposed Dropdown Menu
I am working on developing an app to help you manage recipes. When you are creating a recipe, if you want to add a step, you have the option of choosing to add a regular step with text, or a timer. If you add a timer, you have the option of choosing the time unit from a material Exposed Dropdown Menu that is created using a AutoCompleteTextView nested in a material TextInputLayout. The timer is created like this:

```<code>            val index = stepNumber - 1
            val ctx = ContextThemeWrapper(activity, R.style.timeUnitsMenu)
            val newView = LayoutInflater.from(ctx)
                .inflate(R.layout.timer, null)
            newView.findViewById<ImageButton>(R.id.delete_timer).setOnClickListener { view -> deleteStep(view) }
            stepsContainer = currentView.findViewById(R.id.recipe_steps_container)
            val timerContainer = newView.findViewById<LinearLayout>(R.id.timer_settings_container)
            val timeUnitsMenu = newView.findViewById<AutoCompleteTextView>(R.id.time_units_menu)
            val timer : LinearLayout = newView.findViewById(R.id.timer_field_layout)
            val timeUnits = resources.getStringArray(R.array.time_units)
            val arrayAdapter = ArrayAdapter(requireContext(), R.layout.dropdown_menu_item, timeUnits)
            timeUnitsMenu.setAdapter(arrayAdapter)
            timeUnitsMenu.addTextChangedListener { createTimerFields(timerContainer, timeUnitsMenu.text.toString(), index) }
            timeUnitsMenu.setText(getString(R.string.minutes), false)
            stepsContainer.addView(timer, stepNumber - 1)
            stepNumber++
</code>```

This works as intended. In the exposed dropdown, there are options to choose between seconds, minutes, hours, and days. However, if you return to the fragment where you create a recipe, I need to reconstruct these programmatically added views. I can add the views back with the same text, but the exposed dropdown menu doesn't have all the options in it anymore. It only has whatever option was previously selected. For example, if I created a timer with a unit of days, when I return to the fragment to restore the state of the recipe creation screen, days is the only option in the dropdown. I can't see what I am doing that isn't linking the array adapter to the exposed dropdown. Here is how I am recreating the timers in onCreateView():

```<code>for (i in 0 until stepsList.size) {
        if (stepsList[i] is MutableList<*>) {
            val list = stepsList[i] as MutableList<*>
            val ctx = ContextThemeWrapper(activity, R.style.timeUnitsMenu)
            val timerLayout = LayoutInflater.from(ctx).inflate(R.layout.timer, null)
            timerLayout.findViewById<ImageButton>(R.id.delete_timer).setOnClickListener { timerView -> deleteStep(timerView) }
            val timerContainer = timerLayout.findViewById<LinearLayout>(R.id.timer_settings_container)
            val timeUnitsMenu = timerLayout.findViewById<AutoCompleteTextView>(R.id.time_units_menu)
            val timeUnits = resources.getStringArray(R.array.time_units)
            val arrayAdapter = ArrayAdapter(timerLayout.context, R.layout.dropdown_menu_item, timeUnits)
            println("${arrayAdapter.getItem(0)} ${arrayAdapter.getItem(1)} ${arrayAdapter.getItem(2)} ${arrayAdapter.getItem(3)}")
            timeUnitsMenu.setAdapter(arrayAdapter)
            timeUnitsMenu.addTextChangedListener { restoreTimerFields(timerContainer, i) }
            val timeUnitsList = ArrayList(listOf(*resources.getStringArray(R.array.time_units)))
            timeUnitsMenu.setText(timeUnitsList[list.size - 1], false)
            stepsContainer.addView(timerLayout, i)
        }
    }
</code>```

Please not I have left some code out of the onCreateView() because it is the condition for recreating a normal step (which works correctly), rather than a timer. Any guidance would be appreciated. Additionally, stepsList is a mutableList of Views or Arrays of Views to allow me to reconstruct the fragment. This array also contains the correct information, and is accessing the correct information when it is used.

ContentLicense: CC BY-SA 4.0

Body:
I am working on developing an app to help you manage recipes. When you are creating a recipe, if you want to add a step, you have the option of choosing to add a regular step with text, or a timer. If you add a timer, you have the option of choosing the time unit from a material Exposed Dropdown Menu that is created using a AutoCompleteTextView nested in a material TextInputLayout. The timer is created like this:

            val index = stepNumber - 1
            val ctx = ContextThemeWrapper(activity, R.style.timeUnitsMenu)
            val newView = LayoutInflater.from(ctx)
                .inflate(R.layout.timer, null)
            newView.findViewById<ImageButton>(R.id.delete_timer).setOnClickListener { view -> deleteStep(view) }
            stepsContainer = currentView.findViewById(R.id.recipe_steps_container)
            val timerContainer = newView.findViewById<LinearLayout>(R.id.timer_settings_container)
            val timeUnitsMenu = newView.findViewById<AutoCompleteTextView>(R.id.time_units_menu)
            val timer : LinearLayout = newView.findViewById(R.id.timer_field_layout)
            val timeUnits = resources.getStringArray(R.array.time_units)
            val arrayAdapter = ArrayAdapter(requireContext(), R.layout.dropdown_menu_item, timeUnits)
            timeUnitsMenu.setAdapter(arrayAdapter)
            timeUnitsMenu.addTextChangedListener { createTimerFields(timerContainer, timeUnitsMenu.text.toString(), index) }
            timeUnitsMenu.setText(getString(R.string.minutes), false)
            stepsContainer.addView(timer, stepNumber - 1)
            stepNumber++

This works as intended. In the exposed dropdown, there are options to choose between seconds, minutes, hours, and days. However, if you return to the fragment where you create a recipe, I need to reconstruct these programmatically added views. I can add the views back with the same text, but the exposed dropdown menu doesn't have all the options in it anymore. It only has whatever option was previously selected. For example, if I created a timer with a unit of days, when I return to the fragment to restore the state of the recipe creation screen, days is the only option in the dropdown. I can't see what I am doing that isn't linking the array adapter to the exposed dropdown. Here is how I am recreating the timers in onCreateView():

for (i in 0 until stepsList.size) {
        if (stepsList[i] is MutableList<*>) {
            val list = stepsList[i] as MutableList<*>
            val ctx = ContextThemeWrapper(activity, R.style.timeUnitsMenu)
            val timerLayout = LayoutInflater.from(ctx).inflate(R.layout.timer, null)
            timerLayout.findViewById<ImageButton>(R.id.delete_timer).setOnClickListener { timerView -> deleteStep(timerView) }
            val timerContainer = timerLayout.findViewById<LinearLayout>(R.id.timer_settings_container)
            val timeUnitsMenu = timerLayout.findViewById<AutoCompleteTextView>(R.id.time_units_menu)
            val timeUnits = resources.getStringArray(R.array.time_units)
            val arrayAdapter = ArrayAdapter(timerLayout.context, R.layout.dropdown_menu_item, timeUnits)
            println("${arrayAdapter.getItem(0)} ${arrayAdapter.getItem(1)} ${arrayAdapter.getItem(2)} ${arrayAdapter.getItem(3)}")
            timeUnitsMenu.setAdapter(arrayAdapter)
            timeUnitsMenu.addTextChangedListener { restoreTimerFields(timerContainer, i) }
            val timeUnitsList = ArrayList(listOf(*resources.getStringArray(R.array.time_units)))
            timeUnitsMenu.setText(timeUnitsList[list.size - 1], false)
            stepsContainer.addView(timerLayout, i)
        }
    }

Please not I have left some code out of the onCreateView() because it is the condition for recreating a normal step (which works correctly), rather than a timer. Any guidance would be appreciated. Additionally, stepsList is a mutableList of Views or Arrays of Views to allow me to reconstruct the fragment. This array also contains the correct information, and is accessing the correct information when it is used.


问:
How do I send messages to a group chat using whatsapp Api for JavaScript
I'm able to send messages to a number using the contact ID but I want to send to a group chat and don't know how to.</p>
```<code>client.on('ready', () => {

 console.log('Client is ready!');

  // Number where you want to send the message.

 const number = "+911234567890";

  // Your message.

 const text = "Hey john";

  // Getting chatId from the number.

  // we have to delete "+" from the beginning and add "@c.us" at the end of the number.

 const chatId = number.substring(1) + "@c.us";

 // Sending message.

 client.sendMessage(chatId, text);

});
</code>```

Body:
I'm able to send messages to a number using the contact ID but I want to send to a group chat and don't know how to.

client.on('ready', () => {

 console.log('Client is ready!');

  // Number where you want to send the message.

 const number = "+911234567890";

  // Your message.

 const text = "Hey john";

  // Getting chatId from the number.

  // we have to delete "+" from the beginning and add "@c.us" at the end of the number.

 const chatId = number.substring(1) + "@c.us";

 // Sending message.

 client.sendMessage(chatId, text);

});


问:
Multi-class imbalance with a dataset of logical columns
I have a dataset (df) that looks like this:

Item_1
Item_2
Item_3
Item_n
Type

TRUE
FALSE
FALSE
TRUE
Type A

TRUE
FALSE
FALSE
FALSE
Type B

TRUE
TRUE
FALSE
FALSE
Type_n

where the number of observations per type is (table(df$Type)):

Type A
Type B
Type C
Type D
Type E

7
15
36
18
80

I would like to ideally have a similar number of observations per each type, to try to classify them. I have tried, without success to use SMOTE (from several packages) but I have not had success as:

the columns have T/F values. If I convert them to 0/1 I get numerical values (as 0.15, 0.88, etc.) rather than binary values.

I have more than one minority class/type.

I think at this point that SMOTE is not the best option for me. Do you reccommend any alternatives to have a more balanced dataset?

Thank you in advance for all your help!


问:
How can Django keep an API user logged in without a browser or return token?
https://github.com/mugartec/django-ninja-auth/blob/bf36b4583a37213001131678d5ecda07f92ba2f6/ninja_auth/api.py#L33

It doesn't return any token, so how to does it identify them post-login for subsequent requests?


问:
How to make the node.js wait the "for" loop to be completed before running it again?
I'm writing this code, but as new guy in node.js i'm having some problems... Looks like the "for" loop is being executed again before it even complete it's function. I was expecting it to run, then print the "url", then make the https.get request, wait the response, and, only after the response being received for complete and all the code inside the "for" loop being executed, it run again. But actually what's happening is that it's print in the console log two "url", and after that, it print the two responses headers. (suposing that the "for" loop is running twice)

```<code>const express = require('express');
const https = require('https');
const server = express();

server.listen(someport);

server.get('/duplicateorder', (request, response) => {
  let storeid = request.query.store;
  let orderid = request.query.id;

  let amountoforders = orderid.length;

  for (let actualorder = 0; actualorder < orderid.length; actualorder++) {
    let url = `https://api.somedomain.com/v1/${storeid}/orders/${orderid[actualorder]}`;
    console.log({link: url});

    https.get(url, response2 => {
      let data = [];
      let header = response2.headers ? response2.headers : 'no response header';
      console.log('Status Code:', response.statusCode);
      console.log('Response header:', header);

      response2.on('data', chunk => {
        data.push(chunk);
        console.log(chunk)
      });
      response2.on('end', () => {
        console.log(data)
      });
    });
  };

  let res = {length: orderid.length};

  return response.json(res);
});
</code>```

i tried adding the

```<code>      response2.on('end', () => {
        console.log(data)
      });
</code>```

but it did not worked as well.

Body:
I'm writing this code, but as new guy in node.js i'm having some problems... Looks like the "for" loop is being executed again before it even complete it's function. I was expecting it to run, then print the "url", then make the https.get request, wait the response, and, only after the response being received for complete and all the code inside the "for" loop being executed, it run again. But actually what's happening is that it's print in the console log two "url", and after that, it print the two responses headers. (suposing that the "for" loop is running twice)

const express = require('express');
const https = require('https');
const server = express();

server.listen(someport);

server.get('/duplicateorder', (request, response) => {
  let storeid = request.query.store;
  let orderid = request.query.id;

  let amountoforders = orderid.length;

  for (let actualorder = 0; actualorder < orderid.length; actualorder++) {
    let url = `https://api.somedomain.com/v1/${storeid}/orders/${orderid[actualorder]}`;
    console.log({link: url});

    https.get(url, response2 => {
      let data = [];
      let header = response2.headers ? response2.headers : 'no response header';
      console.log('Status Code:', response.statusCode);
      console.log('Response header:', header);

      response2.on('data', chunk => {
        data.push(chunk);
        console.log(chunk)
      });
      response2.on('end', () => {
        console.log(data)
      });
    });
  };

  let res = {length: orderid.length};

  return response.json(res);
});

i tried adding the

      response2.on('end', () => {
        console.log(data)
      });

but it did not worked as well.


问:
I want to turn off the default hoverOut behavior of the legend item
I have scoured the amcharts4 docs to find this answer but could not. I have a PieChart with a legend. On slice clicks I apply a 'selected' state to the slice. However when the user hovers on the legend and mouse out from the legend that state is removed. I do not want this.

I want hoveringOut of the legend to have no effect on my PieChart slice state.

```<code>function createLegend({ chart, config }) {
  const legend = new am4charts.Legend();
  legend.position = 'right';

  const markerTemplate = legend.markers.template;
  markerTemplate.width = 10;
  markerTemplate.height = 12;

  legend.hoverable = false;

  legend.labels.template.fontSize = 12;
  legend.valueLabels.template.disabled = true;
  legend.itemContainers.template.togglable = false;

  chart.legend = legend;
}
</code>```

Body:
I have scoured the amcharts4 docs to find this answer but could not. I have a PieChart with a legend. On slice clicks I apply a 'selected' state to the slice. However when the user hovers on the legend and mouse out from the legend that state is removed. I do not want this.

I want hoveringOut of the legend to have no effect on my PieChart slice state.

function createLegend({ chart, config }) {
  const legend = new am4charts.Legend();
  legend.position = 'right';

  const markerTemplate = legend.markers.template;
  markerTemplate.width = 10;
  markerTemplate.height = 12;

  legend.hoverable = false;

  legend.labels.template.fontSize = 12;
  legend.valueLabels.template.disabled = true;
  legend.itemContainers.template.togglable = false;

  chart.legend = legend;
}


问:
Installing Docker and running ASP.NET project on Ubuntu Droplet led to ERR_CONNECTION_TIMED_OUT sitewide
I must say before starting this was a production server for my site that was hosting a laravel API + vuejs webapp. It uses NGINX to do so.

Before I installed Docker I figured there might be issues with the server when doing so, so I saved all the /nginx/ folder data and I made a droplet snapshot (none of which helped to restore old state).

Then I installed docker, pulled my repository and ran the image using docker run.

I then visited my website, and it was completely crashed. Nothing would load. Everything would end up in ERR_CONNECTION_TIMED_OUT

So I uninstalled docker, that didn't help.
I tried replacing NGINX sites-enabled, .conf (every file) with the old version, didn't help.
Lastly, I restored the droplet snapshot using my hosting company, but that didn't help.

Anyone have any ideas why this might've happened?

So I uninstalled docker, that didn't help.
I tried replacing NGINX sites-enabled, .conf (every file) with the old version, didn't help.
Lastly, I restored the droplet snapshot using my hosting company, but that didn't help.


问:
Grid system is broken
Grid system is moving out of the container. "gallery-item div1, gallery-item div2, gallery-item div2, gallery-item div3, gallery-item div4, gallery-item div5, gallery-item div5, gallery-item div6," in "Parent" seems to have a problem when I write them together, but the same problem persists when I include "gallery-item" as a separate class "div1, div2 ...". I don't know exactly what the problem is. When I deleted and rewrote it, I saw that the same problem still persists. I want the grid-areas to be like this. Thanks

.gallery .gallery-filter .filter-item {
  color: #000;
  background: #fff;
  font-size: 13px;
  border: 1px solid #d3d3d3;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.gallery .gallery-filter .filter-item.active {
  color: white;
  background: #0d6efd;
}

.gallery .gallery-item.show {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.gallery .gallery-item.hide {
  display: none;
}

section .gallery .parent {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  grid-column-gap: 0px;
  grid-row-gap: 0px;
  position: relative;
  display: block;
}

.div1 {      grid-area: 1 / 1 / 2 / 2;    }
.div2 {      grid-area: 1 / 2 / 3 / 3;    }
.div3 {      grid-area: 1 / 3 / 2 / 4;    }
.div4 {      grid-area: 1 / 4 / 3 / 5;    }
.div5 {      grid-area: 2 / 1 / 3 / 2;    }
.div6 {      grid-area: 2 / 3 / 3 / 4;    }

section .gallery .parent .gallery-item-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(161, 0, 161, 0.75);
  opacity: 0;
  transition: opacity ease-in-out 0.5s;
}

section .gallery .parent .gallery-item-inner h6 {
  padding: 5px 12px;
  font-size: 13px;
  border: none;
  background: #fff;
  border-radius: 13px;
  width: 86.5px;
}

section .gallery .parent .gallery-item-inner .a-down {
  background-color: #fff;
  width: 40px;
  height: 40px;
  text-align: center;
}

section .gallery .parent .gallery-item-inner .a-sub a:hover {
  opacity: .8;
}

section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner {
  opacity: 1;
}

@media (max-width: 991.98px) {
  section .gallery .parent {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 0px;
  }
  section .div1 {
    grid-area: 1 / 1 / 2 / 2;
  }
  section .div2 {
    grid-area: 1 / 2 / 3 / 3;
  }
  section .div3 {
    grid-area: 2 / 1 / 3 / 2;
  }
  section .div4 {
    grid-area: 3 / 1 / 5 / 2;
  }
  section .div5 {
    grid-area: 3 / 2 / 4 / 3;
  }
  section .div6 {
    grid-area: 4 / 2 / 5 / 3;
  }
}

@media (max-width: 767.98px) {
  section .gallery .parent {
    display: grid;
    grid-template-columns: repeat(1fr);
    grid-template-rows: repeat(8, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 0px;
  }
  section .div1 {
    grid-area: 1 / 1 / 2 / 3;
  }
  section .div2 {
    grid-area: 2 / 1 / 4 / 3;
  }
  section .div3 {
    grid-area: 4 / 1 / 5 / 3;
  }
  section .div4 {
    grid-area: 5 / 1 / 7 / 3;
  }
  section .div5 {
    grid-area: 7 / 1 / 8 / 3;
  }
  section .div6 {
    grid-area: 8 / 1 / 9 / 3;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
<section>
  <div class="container gallery">
    <div class="row text-center py-4 col-lg-8 m-auto">
      <h6 class="fw-semibold text-primary">PROJECTS</h6>
      <h2 class="fw-bolder">Our Latest Cases</h2>
      <p class="fw-normal text-muted">There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form.</p>
    </div>
    <div class="row">
      <div class="gallery-filter text-center pt-2 pb-5">
        <span class="filter-item active rounded-5 px-3 py-2 me-2" data-filter="all">Show All</span>
        <span class="filter-item rounded-5 px-3 py-2 me-2" data-filter="marketing">Marketing</span>
        <span class="filter-item rounded-5 px-3 py-2 me-2" data-filter="business">Business</span>
        <span class="filter-item rounded-5 px-3 py-2 me-2 mt-3 mt-sm-0" data-filter="finance">Finance</span>
        <span class="filter-item rounded-5 px-3 py-2 mt-3 mt-md-0" data-filter="consulting">Consulting</span>
      </div>
    </div>
    <div class="row parent pb-5 g-0">
      <div class="gallery-item marketing div1">
        <div class="gallery-item-inner p-4 d-flex flex-column justify-content-between">
          <div class="d-flex flex-column">
            <h6 class="text-dark mb-3">Marketing</h6>
            Stock Market
                                Analysis
          </div>

            <i class="lni lni-arrow-right text-primary fw-semibold"></i>

        </div>
        <img src="https://picsum.photos/id/870/250" alt="..">
      </div>
      <div class="gallery-item business div2">
        <div class="gallery-item-inner p-4 d-flex flex-column justify-content-between">
          <div class="d-flex flex-column">
            <h6 class="text-dark mb-3">Business</h6>
            Sales Analysis
          </div>

            <i class="lni lni-arrow-right text-primary fw-semibold"></i>

        </div>
        <img src="https://picsum.photos/id/872/250" alt="..">
      </div>
      <div class="gallery-item marketing div3">
        <div class="gallery-item-inner p-4 d-flex flex-column justify-content-between">
          <div class="d-flex flex-column">
            <h6 class="text-dark mb-3">Marketing</h6>
            Stock Investments
          </div>

            <i class="lni lni-arrow-right text-primary fw-semibold"></i>

        </div>
        <img src="https://picsum.photos/id/873/250" alt="..">
      </div>
      <div class="gallery-item business div4">
        <div class="gallery-item-inner p-4 d-flex flex-column justify-content-between">
          <div class="d-flex flex-column">
            <h6 class="text-dark mb-3">Marketing</h6>
            Big Data
                            Services
          </div>

            <i class="lni lni-arrow-right text-primary fw-semibold"></i>

        </div>
        <img src="https://picsum.photos/id/874/250" alt="..">
      </div>
      <div class="gallery-item finance div5">
        <div class="gallery-item-inner p-4 d-flex flex-column justify-content-between">
          <div class="d-flex flex-column">
            <h6 class="text-dark mb-3">Finance</h6>
            Sales
                            Enablement
          </div>

            <i class="lni lni-arrow-right text-primary fw-semibold"></i>

        </div>
        <img src="https://picsum.photos/id/875/250" alt="..">
      </div>
      <div class="gallery-item consulting div6">
        <div class="gallery-item-inner p-4 d-flex flex-column justify-content-between">
          <div class="d-flex flex-column">
            <h6 class="text-dark mb-3">Consulting</h6>
            Consulting
                            Services
          </div>

            <i class="lni lni-arrow-right text-primary fw-semibold"></i>

        </div>
        <img src="https://picsum.photos/id/876/250" alt="..">
      </div>
    </div>
  </div>
</section></code>```

Title: Grid system is broken

Body:
Grid system is moving out of the container. "gallery-item div1, gallery-item div2, gallery-item div2, gallery-item div3, gallery-item div4, gallery-item div5, gallery-item div5, gallery-item div6," in "Parent" seems to have a problem when I write them together, but the same problem persists when I include "gallery-item" as a separate class "div1, div2 ...". I don't know exactly what the problem is. When I deleted and rewrote it, I saw that the same problem still persists. I want the grid-areas to be like this. Thanks

.gallery .gallery-filter .filter-item {
  color: #000;
  background: #fff;
  font-size: 13px;
  border: 1px solid #d3d3d3;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.gallery .gallery-filter .filter-item.active {
  color: white;
  background: #0d6efd;
}

.gallery .gallery-item.show {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.gallery .gallery-item.hide {
  display: none;
}

section .gallery .parent {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  grid-column-gap: 0px;
  grid-row-gap: 0px;
  position: relative;
  display: block;
}

.div1 {      grid-area: 1 / 1 / 2 / 2;    }
.div2 {      grid-area: 1 / 2 / 3 / 3;    }
.div3 {      grid-area: 1 / 3 / 2 / 4;    }
.div4 {      grid-area: 1 / 4 / 3 / 5;    }
.div5 {      grid-area: 2 / 1 / 3 / 2;    }
.div6 {      grid-area: 2 / 3 / 3 / 4;    }

section .gallery .parent .gallery-item-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(161, 0, 161, 0.75);
  opacity: 0;
  transition: opacity ease-in-out 0.5s;
}

section .gallery .parent .gallery-item-inner h6 {
  padding: 5px 12px;
  font-size: 13px;
  border: none;
  background: #fff;
  border-radius: 13px;
  width: 86.5px;
}

section .gallery .parent .gallery-item-inner .a-down {
  background-color: #fff;
  width: 40px;
  height: 40px;
  text-align: center;
}

section .gallery .parent .gallery-item-inner .a-sub a:hover {
  opacity: .8;
}

section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner,
section .gallery .parent .gallery-item:hover .gallery-item-inner {
  opacity: 1;
}

@media (max-width: 991.98px) {
  section .gallery .parent {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 0px;
  }
  section .div1 {
    grid-area: 1 / 1 / 2 / 2;
  }
  section .div2 {
    grid-area: 1 / 2 / 3 / 3;
  }
  section .div3 {
    grid-area: 2 / 1 / 3 / 2;
  }
  section .div4 {
    grid-area: 3 / 1 / 5 / 2;
  }
  section .div5 {
    grid-area: 3 / 2 / 4 / 3;
  }
  section .div6 {
    grid-area: 4 / 2 / 5 / 3;
  }
}

@media (max-width: 767.98px) {
  section .gallery .parent {
    display: grid;
    grid-template-columns: repeat(1fr);
    grid-template-rows: repeat(8, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 0px;
  }
  section .div1 {
    grid-area: 1 / 1 / 2 / 3;
  }
  section .div2 {
    grid-area: 2 / 1 / 4 / 3;
  }
  section .div3 {
    grid-area: 4 / 1 / 5 / 3;
  }
  section .div4 {
    grid-area: 5 / 1 / 7 / 3;
  }
  section .div5 {
    grid-area: 7 / 1 / 8 / 3;
  }
  section .div6 {
    grid-area: 8 / 1 / 9 / 3;
  }
}

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">

PROJECTS

Our Latest Cases

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form.

        Show All
        Marketing
        Business
        Finance
        Consulting

Marketing

            Stock Market
                                Analysis

Business

            Sales Analysis

Marketing

            Stock Investments

Marketing

            Big Data
                            Services

Finance

            Sales
                            Enablement

Consulting

            Consulting
                            Services


问:
Finding error in my WordPress plugin template
I generated a WordPress plugin. However: When I include css and js file I get an error when I edit a page where I added the shortcode.
So what I do: I create a page, add the shortcode, it loads the plugin and my Hello World text. But then, when I save the edited page, it shows the error, hat there were errors during saving and this could be up to server limitations. But I am pretty sure, it has nothing to do with that. Also it does not matter what theme or builder I use. (Mostly I use Divi)

So the question is: Do you see any error in my plugin code? In folder plugins I have a folder called "myPlugin" containing a main.php containing this code:

```<code><?php
/*
 * Plugin Name: My Plugin
 * Plugin URI:  https://example.com
 * Description: A brief description of my plugin
 * Version:     1.0.0
 * Author:      Your Name
 * Author URI:  https://example.com
 * License:     GPL2
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: my-plugin
 * Domain Path: /languages
 */

function my_shortcode_function() {
  echo "<p class='myxxx'>Hello world</p>";
}

add_shortcode('my_shortcode', 'my_shortcode_function');

function my_plugin_init() {
  wp_enqueue_style('my-plugin-style', plugins_url('css/style.css', __FILE__));
  wp_enqueue_script('my-plugin-script', plugins_url('js/script.js', __FILE__));
}
add_action('wp', 'my_plugin_init');

</code>```

The css file styles.css contains only:

```<code>/* css file */
.myxxx { color:red; }

</code>```

Very important: On lets say page /test I put [my_shortcode] to run the plugin. Works. It shows in red "Hello World". BUT when I save its giving the saving error. (But only when I enqueue the css and js.) Then I can load the page /test in non-builder mode and the see the plugin loaded and showing Hello World also. So it works but I get the saving error. I really need to get rid of it.

Any ideas?
Thx
CC

I tried many template also also used a new generated template using chat gpt. ;D
But I tried a lot how to integrate the css and js.

Body:
I generated a WordPress plugin. However: When I include css and js file I get an error when I edit a page where I added the shortcode.
So what I do: I create a page, add the shortcode, it loads the plugin and my Hello World text. But then, when I save the edited page, it shows the error, hat there were errors during saving and this could be up to server limitations. But I am pretty sure, it has nothing to do with that. Also it does not matter what theme or builder I use. (Mostly I use Divi)

So the question is: Do you see any error in my plugin code? In folder plugins I have a folder called "myPlugin" containing a main.php containing this code:

<?php
/*
 * Plugin Name: My Plugin
 * Plugin URI:  https://example.com
 * Description: A brief description of my plugin
 * Version:     1.0.0
 * Author:      Your Name
 * Author URI:  https://example.com
 * License:     GPL2
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: my-plugin
 * Domain Path: /languages
 */

function my_shortcode_function() {
  echo "
Hello world
";
}

add_shortcode('my_shortcode', 'my_shortcode_function');

function my_plugin_init() {
  wp_enqueue_style('my-plugin-style', plugins_url('css/style.css', __FILE__));
  wp_enqueue_script('my-plugin-script', plugins_url('js/script.js', __FILE__));
}
add_action('wp', 'my_plugin_init');

The css file styles.css contains only:

/* css file */
.myxxx { color:red; }

Very important: On lets say page /test I put [my_shortcode] to run the plugin. Works. It shows in red "Hello World". BUT when I save its giving the saving error. (But only when I enqueue the css and js.) Then I can load the page /test in non-builder mode and the see the plugin loaded and showing Hello World also. So it works but I get the saving error. I really need to get rid of it.

Any ideas?
Thx
CC

I tried many template also also used a new generated template using chat gpt. ;D
But I tried a lot how to integrate the css and js.


问:
Flutter Error: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
When running flutter build apk --release, I get the following:

```<code>w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.10/e80fe6ac3c3573a80305f5ec43f86b829e8ab53d/kotlin-stdlib-jdk8-1.6.10.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.21/568c1b78a8e17a4f35b31f0a74e2916095ed74c2/kotlin-stdlib-jdk7-1.6.21.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar (version 1.7)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: C:/Users/rizky/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.5.0/857678d6b4ca7b28571ef7935c668bdb57e15027/annotation-1.5.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.10/e80fe6ac3c3573a80305f5ec43f86b829e8ab53d/kotlin-stdlib-jdk8-1.6.10.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.21/568c1b78a8e17a4f35b31f0a74e2916095ed74c2/kotlin-stdlib-jdk7-1.6.21.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar (version 1.7)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
</code>```

I have already done some of the suggestions I've found online but so far nothing have worked. In android/build.gradle:

```<code>buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

And in app/build.gradle:

```<code>def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        coreLibraryDesugaringEnabled true

        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.lindu"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName

        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
</code>```

I've been able to build my apk no problem before, I added workmanager to my pubsec.yaml and this issue started coming up. Any help appreciated I've been stuck on this for awhile! Thank you!

Body:
When running flutter build apk --release, I get the following:

w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.10/e80fe6ac3c3573a80305f5ec43f86b829e8ab53d/kotlin-stdlib-jdk8-1.6.10.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.21/568c1b78a8e17a4f35b31f0a74e2916095ed74c2/kotlin-stdlib-jdk7-1.6.21.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar (version 1.7)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: C:/Users/rizky/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.5.0/857678d6b4ca7b28571ef7935c668bdb57e15027/annotation-1.5.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.10/e80fe6ac3c3573a80305f5ec43f86b829e8ab53d/kotlin-stdlib-jdk8-1.6.10.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.21/568c1b78a8e17a4f35b31f0a74e2916095ed74c2/kotlin-stdlib-jdk7-1.6.21.jar (version 1.6)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar (version 1.7)
    C:/Users/rizky/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath

I have already done some of the suggestions I've found online but so far nothing have worked. In android/build.gradle:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And in app/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        coreLibraryDesugaringEnabled true

        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.lindu"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName

        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}

I've been able to build my apk no problem before, I added workmanager to my pubsec.yaml and this issue started coming up. Any help appreciated I've been stuck on this for awhile! Thank you!


问:
Module not found: Can't resolve 'dns' Error on NextJS Page
Im new to NextJS and try to implement a symple Login Page. When the user types in valid credentials than he gets redirected to another page, else he gets an error. I use an MongoDB Database to check with the credentials the user provided. I followed a Video from the MongoDB YouTube Channel and ChatGPT helped as well but now I`m stuck with the error that a module was not found: Module not found: Can't resolve 'dns'.
Has somebody an idea what Im doing wrong?

This is my Login Page, the functions get called when the user submits the form.

`

```<code>import Head from "next/head"
import styles from "../styles/Login.module.scss"
import { connectToDatabase } from '../util/mongodb';

export default function Login() {

    async function checkCredentials(username, password) {
        try {

            //Connect to Database
            const { db } = await connectToDatabase()

            //get Data from Collection userdata
            const collection = db.collection('userdata');

            // Find the user with the specified username and password
            const user = await collection.findOne({ username, password });

            if (user) {
                // User was found, credentials are valid
                console.log('Valid credentials');
                return true;
            } else {
                // User was not found, credentials are invalid
                console.log('Invalid credentials');
                return false;
            }
        } catch (error) {
            console.error(error);
        }
         finally {
            db.close();
        }
    }

    function handleSubmit(event) {
        event.preventDefault();

        const username = event.target.elements.username.value;
        const password = event.target.elements.password.value;

        checkCredentials(username, password).then((result) => {
            if (result) {
                // Credentials are valid, log the user in
                // ...
                console.log("Login succesfull")
            } else {
                // Credentials are invalid, show an error message
                // ...
                console.log("Login not successfull")
            }
        });
    }

    return (
        <div>
            <Head>
                <title>Login</title>
            </Head>
            <main className={styles.login}>
                <section>
                    <img src="/images/Bild_SD.jpg" alt="Beispielbild Squaredance" />
                </section>
                <section>
                    <h1>Login</h1>
                    <p>Hier kannst du dich einloggen, um auf Interne Informationen zugreifen zu koennen. </p>
                    <form onSubmit={handleSubmit}>
                        <label htmlFor="username">Benutzername:</label>
                        <input type="text" id="username" name="username" />
                        <br />
                        <label htmlFor="password">Passwort:</label>
                        <input type="password" id="password" name="password" />
                        <br />
                        <button type="submit">Anmelden</button>
                    </form>
                </section>
            </main>
        </div>
    )
}

</code>```

And here is the mongodb.js file, where I connect with the database. The code here is entirely from a YouTube Video from the official MongoDB Channel and I use it on another Page, so there should be nothing wrong there.

```<code>import { MongoClient } from "mongodb";

const { MONGODB_URI, MONGODB_DB } = process.env

if (!MONGODB_URI) {
    throw new Error(
        'Bitte bestimme die MONGODB_URI Variable in .env.local'
    )
}

if (!MONGODB_DB) {
    throw new Error(
        'Bitte bestimme die MONGODB_DB Variable in .env.local'
    )
}

/**
 * Globall is used here to maintain a chached connection across hot reloads
 * in development. This prevents connections growing exponentially
 * during api Route usage.
 */
let cached = global.mongo

if (!cached) {
    cached = global.mongo = { conn: null, promise: null }
}

export async function connectToDatabase() {
    if (cached.conn) {
        return cached.conn
    }

    if (!cached.promise) {
        const opts = {
            useNewUrlParser: true,
            useUnifiedTopology: true,
        }

        cached.promise = MongoClient.connect(MONGODB_URI, opts).then((client) => {
            return {
                client,
                db: client.db(MONGODB_DB),
            }
        })
        cached.conn = await cached.promise
        return cached.conn
    }
}

</code>```

`
I looked a bit for myself and found out the error occurs probably because I connect to the Database in Frontend. I have a folder called api inside the pages folder. Should I put the checkCredentials function in a file there? Is the function then in the backend? How could this look like?
It would be great if somebody could help!

Body:
Im new to NextJS and try to implement a symple Login Page. When the user types in valid credentials than he gets redirected to another page, else he gets an error. I use an MongoDB Database to check with the credentials the user provided. I followed a Video from the MongoDB YouTube Channel and ChatGPT helped as well but now I`m stuck with the error that a module was not found: Module not found: Can't resolve 'dns'.
Has somebody an idea what Im doing wrong?

This is my Login Page, the functions get called when the user submits the form.

`

import Head from "next/head"
import styles from "../styles/Login.module.scss"
import { connectToDatabase } from '../util/mongodb';

export default function Login() {

    async function checkCredentials(username, password) {
        try {

            //Connect to Database
            const { db } = await connectToDatabase()

            //get Data from Collection userdata
            const collection = db.collection('userdata');

            // Find the user with the specified username and password
            const user = await collection.findOne({ username, password });

            if (user) {
                // User was found, credentials are valid
                console.log('Valid credentials');
                return true;
            } else {
                // User was not found, credentials are invalid
                console.log('Invalid credentials');
                return false;
            }
        } catch (error) {
            console.error(error);
        }
         finally {
            db.close();
        }
    }

    function handleSubmit(event) {
        event.preventDefault();

        const username = event.target.elements.username.value;
        const password = event.target.elements.password.value;

        checkCredentials(username, password).then((result) => {
            if (result) {
                // Credentials are valid, log the user in
                // ...
                console.log("Login succesfull")
            } else {
                // Credentials are invalid, show an error message
                // ...
                console.log("Login not successfull")
            }
        });
    }

    return (

                <title>Login</title>

Login

Hier kannst du dich einloggen, um auf Interne Informationen zugreifen zu koennen.

                    <form onSubmit={handleSubmit}>
                        Benutzername:
                        <input type="text" id="username" name="username" />

                        Passwort:
                        <input type="password" id="password" name="password" />

                        <button type="submit">Anmelden</button>
                    </form>

    )
}

And here is the mongodb.js file, where I connect with the database. The code here is entirely from a YouTube Video from the official MongoDB Channel and I use it on another Page, so there should be nothing wrong there.

import { MongoClient } from "mongodb";

const { MONGODB_URI, MONGODB_DB } = process.env

if (!MONGODB_URI) {
    throw new Error(
        'Bitte bestimme die MONGODB_URI Variable in .env.local'
    )
}

if (!MONGODB_DB) {
    throw new Error(
        'Bitte bestimme die MONGODB_DB Variable in .env.local'
    )
}

/**
 * Globall is used here to maintain a chached connection across hot reloads
 * in development. This prevents connections growing exponentially
 * during api Route usage.
 */
let cached = global.mongo

if (!cached) {
    cached = global.mongo = { conn: null, promise: null }
}

export async function connectToDatabase() {
    if (cached.conn) {
        return cached.conn
    }

    if (!cached.promise) {
        const opts = {
            useNewUrlParser: true,
            useUnifiedTopology: true,
        }

        cached.promise = MongoClient.connect(MONGODB_URI, opts).then((client) => {
            return {
                client,
                db: client.db(MONGODB_DB),
            }
        })
        cached.conn = await cached.promise
        return cached.conn
    }
}

`
I looked a bit for myself and found out the error occurs probably because I connect to the Database in Frontend. I have a folder called api inside the pages folder. Should I put the checkCredentials function in a file there? Is the function then in the backend? How could this look like?
It would be great if somebody could help!


问:
I'm trying to set a strategy with CE indicator
I want to add this:

```<code>When CE (Chandelier Exit) indicator in buy --> Only Long Signals
When CE (Chandelier Exit) indicator in sell --> Only Short Signals
</code>```

At my script:

```<code>longcondition = rsi>80 and macd>0
shortcondition = rsi<20 and macd<0
</code>```

In addition to these conditions, I am trying to add what I want in the CE indicator, can you help me?

I tried to add buySignal variable, but it works poorly. When I tried to add this, it gave me only the CE changes

I'm trying to get signals with rsi and macd. The CE indicator will filter it with buy and sell lines. I hope I explain myself.

Body:
I want to add this:

When CE (Chandelier Exit) indicator in buy --> Only Long Signals
When CE (Chandelier Exit) indicator in sell --> Only Short Signals

At my script:

longcondition = rsi>80 and macd>0
shortcondition = rsi<20 and macd<0

In addition to these conditions, I am trying to add what I want in the CE indicator, can you help me?

I tried to add buySignal variable, but it works poorly. When I tried to add this, it gave me only the CE changes

I'm trying to get signals with rsi and macd. The CE indicator will filter it with buy and sell lines. I hope I explain myself.


问:
Wildcard match a string in an array using the -notlike operator in PowerShell
Making a wildcard match in a string is simple using the -like operator:

```<code>$myString = "abcdefghi"

if ($myString -like "*ef*") {
  return $true
} else {return $false}
#Returns: True
</code>```

And it also works on arrays like this:

```<code>$myArray = @("abc", "def", "ghi")

if ($myArray -like "*ef*") {
  return $true
} else {return $false}
#Returns: True

if ($myArray -like "*xyz*" ) {
  return $true
} else {return $false}
#Returns: False

if ($myArray -like "*efg*") {
  return $true
} else {return $false}
#Returns: False
</code>```

As you can see in the last example, the statement did not evaluate to true, so we can assume the -like operator applies the wildcard match to every item in the array individually, which is great. (the g i efg is in the next item)

But here comes the kicker; the -notlike operator does not follow any of the logic above!

```<code>$myArray = @("abc", "def", "ghi")

if ($myArray -notlike "*ef*") {
  return $true
} else {return $false}
#Returns: True

if ($myArray -notlike "*xyz*") {
  return $true
} else {return $false}
#Returns: True
</code>```

No matter what string you try to match it always returns true.

Weirdly enough if you use the -not operator to negate a statement with a -like operator the logic works.

```<code>$myArray = @("abc", "def", "ghi")

if (-not($myArray -like "*ef*")) {
  return $true
} else {return $false}
#Returns: False

if (-not($myArray -like "*xyz*")) {
  return $true
} else {return $false}
#Returns: True
</code>```

This solution is probably the best way to go about this, but it's not very legible and it's frustrating not being able to use the -notlike operator intuitively. You could cast the array into a string and use the -notlike operator but then you miss out on the functionality that each item is matched individually. Although when you cast an array into a string the items are separated by a space so it kind of works...:

```<code>$myArray = @("abc", "def", "ghi")

if ([string]$myArray -notlike "*ef*") {
  return $true
} else {return $false}
#Returns: False

if ([string]$myArray -notlike "*efg*") {
  return $true
} else {return $false}
#Returns: True

if ([string]$myArray -notlike "*ef g*") {
  return $true
} else {return $false}
#Returns: False
</code>```

So my questions are:

Is there any way I can use the -notlike operator to validate if a wildcard match does not exist in any item of an array?

If not, What is the cleanest way to validate if a wildcard match does not exist in any item of an array. I have tried the -notmatch, -notcontains and -notin operators as well but neither works to accomplish my goal.

Body:
Making a wildcard match in a string is simple using the -like operator:

$myString = "abcdefghi"

if ($myString -like "*ef*") {
  return $true
} else {return $false}
#Returns: True

And it also works on arrays like this:

$myArray = @("abc", "def", "ghi")

if ($myArray -like "*ef*") {
  return $true
} else {return $false}
#Returns: True

if ($myArray -like "*xyz*" ) {
  return $true
} else {return $false}
#Returns: False

if ($myArray -like "*efg*") {
  return $true
} else {return $false}
#Returns: False

As you can see in the last example, the statement did not evaluate to true, so we can assume the -like operator applies the wildcard match to every item in the array individually, which is great. (the g i efg is in the next item)

But here comes the kicker; the -notlike operator does not follow any of the logic above!

$myArray = @("abc", "def", "ghi")

if ($myArray -notlike "*ef*") {
  return $true
} else {return $false}
#Returns: True

if ($myArray -notlike "*xyz*") {
  return $true
} else {return $false}
#Returns: True

No matter what string you try to match it always returns true.

Weirdly enough if you use the -not operator to negate a statement with a -like operator the logic works.

$myArray = @("abc", "def", "ghi")

if (-not($myArray -like "*ef*")) {
  return $true
} else {return $false}
#Returns: False

if (-not($myArray -like "*xyz*")) {
  return $true
} else {return $false}
#Returns: True

This solution is probably the best way to go about this, but it's not very legible and it's frustrating not being able to use the -notlike operator intuitively. You could cast the array into a string and use the -notlike operator but then you miss out on the functionality that each item is matched individually. Although when you cast an array into a string the items are separated by a space so it kind of works...:

$myArray = @("abc", "def", "ghi")

if ([string]$myArray -notlike "*ef*") {
  return $true
} else {return $false}
#Returns: False

if ([string]$myArray -notlike "*efg*") {
  return $true
} else {return $false}
#Returns: True

if ([string]$myArray -notlike "*ef g*") {
  return $true
} else {return $false}
#Returns: False

So my questions are:

Is there any way I can use the -notlike operator to validate if a wildcard match does not exist in any item of an array?

If not, What is the cleanest way to validate if a wildcard match does not exist in any item of an array. I have tried the -notmatch, -notcontains and -notin operators as well but neither works to accomplish my goal.


问:
#ifdef and #define equivalent in Python (to switch between sorting by date and cost)?
I have a class in Python:

```<code>class purchase:
    name: str
    day: int
    month: int
    year: int
    date: int #works by Julian Day Number
    cost: Decimal
</code>```

I want to write a function to sort a list of objects of this class either by date or by cost, chosen by the user.

I can make 2 copy-pasted functions with only the sorting field replaced, but a much more elegant solution I would make in C++ is to use something like

```<code>#ifdef flag == 1

#define SORTING_FIELD cost

#else

#define SORTING_FIELD date

</code>```

,and only have 1 function. Can I make something like this in Python?

Body:
I have a class in Python:

class purchase:
    name: str
    day: int
    month: int
    year: int
    date: int #works by Julian Day Number
    cost: Decimal

I want to write a function to sort a list of objects of this class either by date or by cost, chosen by the user.

I can make 2 copy-pasted functions with only the sorting field replaced, but a much more elegant solution I would make in C++ is to use something like

#ifdef flag == 1

#define SORTING_FIELD cost

#else

#define SORTING_FIELD date

,and only have 1 function. Can I make something like this in Python?


问:
Detect peer port number, knowing only the IP address
I want to have 2 applications that communicate over internet, socket base. Each is a server and a client. Each applications will only know the IP address of the other peer, but not the port number. Port number is random, whatever is free on the system when the application starts.

Idea would be one application sends some kind of discovery message containing its own port number as payload data. The other receives the message and starts communication using the received port number.

Could someone recommend how to send this "discovery message" to detect the port number used by the other peer, without using a server to exchange the information?

Thanks


问:
Dividing by the i-th element of a vector in Python
I have a statistics homework assignment where I am asked to compute a vector of likelihoods. The i-th element of the likelihood vector is a function of the i-th observation of explanatory variables times a parameter. In the function, I also divide by the i-th observation of explanatory variables times a parameter.

When I write this function in matrix notation, the multiplication of explanatory variables with the parameter yields an (n,1) vector.

How can I tell Python to compute the i-th element of my likelihood vector by dividing by the i-th element of the explanatory variables times the parameter, instead of trying to divide by a whole vector?

I hope this question makes sense, I'm just getting into Python and am at my wits end.

I have tried two things that can't work: Since my vector of explanatory variables times the parameter is not square, I can't invert it to represent the division. I also can't simply divide by it, since it's not a scalar.

Here is the code from my two failed attempts with an example function (phi is a parameter and X @ beta is an (n,1) vector):

```<code>import numpy as np
import math

loglike = np.log(math.gamma((phi * np.exp(X @ beta)) / (np.ones([n,1]) + np.exp(X @ beta))))

</code>```

And this is my attempt at inversing, obviously failed as well:

```<code>import numpy as np
import math

loglike = np.log(math.gamma((phi * np.exp(X @ beta)) * np.linalg.inv(np.ones([n,1]) + np.exp(X @ beta))))

</code>```

Body:
I have a statistics homework assignment where I am asked to compute a vector of likelihoods. The i-th element of the likelihood vector is a function of the i-th observation of explanatory variables times a parameter. In the function, I also divide by the i-th observation of explanatory variables times a parameter.

When I write this function in matrix notation, the multiplication of explanatory variables with the parameter yields an (n,1) vector.

How can I tell Python to compute the i-th element of my likelihood vector by dividing by the i-th element of the explanatory variables times the parameter, instead of trying to divide by a whole vector?

I hope this question makes sense, I'm just getting into Python and am at my wits end.

I have tried two things that can't work: Since my vector of explanatory variables times the parameter is not square, I can't invert it to represent the division. I also can't simply divide by it, since it's not a scalar.

Here is the code from my two failed attempts with an example function (phi is a parameter and X @ beta is an (n,1) vector):

import numpy as np
import math

loglike = np.log(math.gamma((phi * np.exp(X @ beta)) / (np.ones([n,1]) + np.exp(X @ beta))))

And this is my attempt at inversing, obviously failed as well:

import numpy as np
import math

loglike = np.log(math.gamma((phi * np.exp(X @ beta)) * np.linalg.inv(np.ones([n,1]) + np.exp(X @ beta))))


问:
Cannot resolve MVC view "..."
I started studying Spring MVC and ran into such a problem that when creating a get request using the Controller annotation, the server gives an error 404. I searched for many solutions to this problem, but nothing came up. Perhaps the error is related to the server (Apache Tomcat).

Code from controller
message_page.jsp locate in /WEB-INF/views/

```<code>@Controller
public class HelloController {
    @GetMapping("/get-message")
    public String sayMessage(){
        return "message_page";
    }
}
</code>```

File applicationContextMVC.xml located inside directory /WEB-INF

```<code>    <context:component-scan base-package="ru.obukhov.springlearn"/>

    <mvc:annotation-driven/>

    <bean id="templateResolver" class="org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver">
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".html"/>
    </bean>

    <bean id="templateEngine" class="org.thymeleaf.spring5.SpringTemplateEngine">
        <property name="templateResolver" ref="templateResolver"/>
        <property name="enableSpringELCompiler" value="true"/>
    </bean>

    <bean class="org.thymeleaf.spring5.view.ThymeleafViewResolver">
        <property name="templateEngine" ref="templateEngine"/>
        <property name="order" value="1"/>
        <property name="viewNames" value="*"/>
    </bean>

</code>```

web.xml exactly the same inside /WEB-INF

```<code>  <display-name>spring-mvc-app1</display-name>

  <absolute-ordering/>

  <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContextMVC.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</code>```

I try install new appache Tomcat server version: 10 instead of 9, but it's not help

Title: Cannot resolve MVC view "..."

Body:
I started studying Spring MVC and ran into such a problem that when creating a get request using the Controller annotation, the server gives an error 404. I searched for many solutions to this problem, but nothing came up. Perhaps the error is related to the server (Apache Tomcat).

Code from controller
message_page.jsp locate in /WEB-INF/views/

@Controller
public class HelloController {
    @GetMapping("/get-message")
    public String sayMessage(){
        return "message_page";
    }
}

File applicationContextMVC.xml located inside directory /WEB-INF

    <context:component-scan base-package="ru.obukhov.springlearn"/>

    <mvc:annotation-driven/>

    <bean id="templateResolver" class="org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver">
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".html"/>
    </bean>

    <bean id="templateEngine" class="org.thymeleaf.spring5.SpringTemplateEngine">
        <property name="templateResolver" ref="templateResolver"/>
        <property name="enableSpringELCompiler" value="true"/>
    </bean>

    <bean class="org.thymeleaf.spring5.view.ThymeleafViewResolver">
        <property name="templateEngine" ref="templateEngine"/>
        <property name="order" value="1"/>
        <property name="viewNames" value="*"/>
    </bean>

web.xml exactly the same inside /WEB-INF

  <display-name>spring-mvc-app1</display-name>

  <absolute-ordering/>

  <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContextMVC.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

I try install new appache Tomcat server version: 10 instead of 9, but it's not help


问:
How to document feature-gated derived traits?
I understand that I can use the cfg_attr attribute to conditionally derive Trait implementations for types. For example, A struct MyStruct which always implements Clone, Copy, and Debug, but which implements PartialEq if and only if the my-feature feature is enabled, can be defined as follows:

#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "my-feature", derive(PartialEq)]
struct MyStruct;
```

But is it possible to make the generated documentation reflect this? I would like the rustdoc-generated documentation to state that PartialEq is implemented for MyStruct if and only if the my-feature feature is enabled.

So far, I have only accomplished two outcomes, neither of which I want:

If I compile the docs with the my-feature feature enabled, the generated documentation just says that MyStruct implements PartialEq, with no mention of feature gating

If I compile the docs without the my-feautre feature enabled, generated documentation does not indicate that PartialEq is or can be implemented for MyStruct.

Body:
I understand that I can use the cfg_attr attribute to conditionally derive Trait implementations for types. For example, A struct MyStruct which always implements Clone, Copy, and Debug, but which implements PartialEq if and only if the my-feature feature is enabled, can be defined as follows:

#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "my-feature", derive(PartialEq)]
struct MyStruct;

But is it possible to make the generated documentation reflect this? I would like the rustdoc-generated documentation to state that PartialEq is implemented for MyStruct if and only if the my-feature feature is enabled.

So far, I have only accomplished two outcomes, neither of which I want:

If I compile the docs with the my-feature feature enabled, the generated documentation just says that MyStruct implements PartialEq, with no mention of feature gating

If I compile the docs without the my-feautre feature enabled, generated documentation does not indicate that PartialEq is or can be implemented for MyStruct.


问:
How can I access Tkinter widgets outside of the init scope
Good evening,
I'm trying to do a little program with a GUI in python with Tkinter.

```<code>import tkinter as tk
import tkinter.font as tkFont

class WindowCreator:
    def __init__(self, root):
        user_Ids = []
        # setting title
        root.title("Instagram Giveaway auto Filler")
        # setting window size
        width = 318
        height = 395
        screenwidth = root.winfo_screenwidth()
        screenheight = root.winfo_screenheight()
        alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
        root.geometry(alignstr)
        root.resizable(width=False, height=False)

        label_title = tk.Label(root)
        label_title["bg"] = "#000000"
        label_title["fg"] = "#ffd700"
        label_title["text"] = "Instagram Giveaway Auto Filler"
        label_title.place(x=50, y=10, width=201, height=31)

        label_urlPost = tk.Label(root)
        label_urlPost["bg"] = "#000000"
        label_urlPost["fg"] = "#ffd700"
        label_urlPost["text"] = "URL to post"
        label_urlPost.place(x=0, y=70, width=70, height=25)

        entry_urlPost = tk.Entry(root)
        entry_urlPost["borderwidth"] = "1px"
        entry_urlPost["fg"] = "#333333"
        entry_urlPost["text"] = "Entry"
        entry_urlPost.place(x=0, y=90, width=310, height=30)

        list_userIds = tk.Listbox(root)
        list_userIds["borderwidth"] = "1px"
        list_userIds["fg"] = "#333333"
        list_userIds.place(x=0, y=130, width=132, height=251)

        button_addId = tk.Button(root)
        button_addId["text"] = "New id"
        button_addId.place(x=140, y=320, width=70, height=25)
        button_addId["command"] = lambda: button_addId_command(user_Ids, root)

        button_comment = tk.Button(root)
        button_comment["text"] = "Comment"
        button_comment.place(x=140, y=350, width=70, height=25)
        button_comment["command"] = button_comment_command

        label_loggedIn = tk.Label(root)
        label_loggedIn["text"] = "Logged in: "
        label_loggedIn.place(x=150, y=150, width=70, height=25)

        label_postActive = tk.Label(root)
        label_postActive["text"] = "Post active?"
        label_postActive.place(x=150, y=190, width=70, height=25)

        label_nrEntries = tk.Label(root)
        label_nrEntries["text"] = "Number of Entries :"
        label_nrEntries.place(x=150, y=230, width=110, height=30)

        entry_nrEntries = tk.Entry(root)
        entry_nrEntries["text"] = "Entry"
        entry_nrEntries.place(x=270, y=230, width=33, height=30)

        check_loggedIn = tk.Checkbutton(root)
        check_loggedIn["text"] = ""
        check_loggedIn.place(x=210, y=150, width=41, height=30)
        check_loggedIn["offvalue"] = "0"
        check_loggedIn["onvalue"] = "1"
        check_loggedIn["command"] = check_loggedIn_command

        check_postActive = tk.Checkbutton(root)
        check_postActive["text"] = ""
        check_postActive.place(x=210, y=190, width=41, height=30)
        check_postActive["offvalue"] = "0"
        check_postActive["onvalue"] = "1"
        check_postActive["command"] = check_postActive_command

        button_login = tk.Button(root)
        button_login["text"] = "Login"
        button_login.place(x=250, y=150, width=44, height=30)
        button_login["command"] = button_login_command

        user_Ids = read_user_from_file("C:/Users/bruno/OneDrive/Documentos/userIds.txt")
        for users in user_Ids:
            list_userIds.insert('end', users)

    def refresh_user_list(self, user_list):
        global user_Ids
        for users in user_list:
            root.list_userIds.insert('end', users)

def read_user_from_file(file_path):
    user_txt = open(file_path, 'r')
    userIds = user_txt.readlines()
    return userIds

@staticmethod
def button_comment_command():
    print("command")

@staticmethod
def check_loggedIn_command():
    print("command")

@staticmethod
def check_postActive_command():
    print("command")

@staticmethod
def button_login_command():
    print("command")

def add_user_id(new_user, user_list, root, main_root):
    print(new_user)
    print(user_list)
    user_list.append(new_user)
    print(user_list)

    main_root.refresh_user_list(main_root, user_list)
    root.destroy()

def button_addId_command(user_list, main_root):
    root2 = tk.Toplevel(main_root)
    label_title = tk.Label(root2, text="Insert the new ID you want to add to the list ")
    entry_userID = tk.Entry(root2)
    button_register = tk.Button(root2, text="Register",
                                command=lambda: add_user_id(entry_userID.get(), user_list, root2, main_root))
    label_title.pack()
    entry_userID.pack()
    button_register.pack()
    root2.mainloop

if __name__ == "__main__":
    root = tk.Tk()
    windows = WindowCreator(root)

    root.mainloop()
</code>```

When I try to add a new user, I click the New Id button, and then a new windows pops up. In that new window, i've a entry widget and a button. I want to, when I click the register button in that new windows, to acess refresh_user_list, so I can refresh the ListBox widget of the first window list_userIds.
I'm having several troubles with passing objects, and acessing then within other scope.
I can't find a proper website that explains it. Can someone help me?
I tried to reduce the amount of code to post, but I couldn't

I tried to pass the objects as parameters ( the root ob

```<code>Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\Users\bruno\PycharmProjects\InstagramCommentBot\WindowCreator.py", line 135, in <lambda>
    button_register = tk.Button(root2, text="Register", command= lambda : add_user_id(entry_userID.get(), user_list, root2, main_root))
  File "C:\Users\bruno\PycharmProjects\InstagramCommentBot\WindowCreator.py", line 127, in add_user_id
    main_root.refresh_user_list(main_root,user_list)
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2354, in __getattr__
    return getattr(self.tk, attr)
AttributeError: '_tkinter.tkapp' object has no attribute 'refresh_user_list'
</code>```

jects of Tk()) but im always getting the error

Body:
Good evening,
I'm trying to do a little program with a GUI in python with Tkinter.

import tkinter as tk
import tkinter.font as tkFont

class WindowCreator:
    def __init__(self, root):
        user_Ids = []
        # setting title
        root.title("Instagram Giveaway auto Filler")
        # setting window size
        width = 318
        height = 395
        screenwidth = root.winfo_screenwidth()
        screenheight = root.winfo_screenheight()
        alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
        root.geometry(alignstr)
        root.resizable(width=False, height=False)

        label_title = tk.Label(root)
        label_title["bg"] = "#000000"
        label_title["fg"] = "#ffd700"
        label_title["text"] = "Instagram Giveaway Auto Filler"
        label_title.place(x=50, y=10, width=201, height=31)

        label_urlPost = tk.Label(root)
        label_urlPost["bg"] = "#000000"
        label_urlPost["fg"] = "#ffd700"
        label_urlPost["text"] = "URL to post"
        label_urlPost.place(x=0, y=70, width=70, height=25)

        entry_urlPost = tk.Entry(root)
        entry_urlPost["borderwidth"] = "1px"
        entry_urlPost["fg"] = "#333333"
        entry_urlPost["text"] = "Entry"
        entry_urlPost.place(x=0, y=90, width=310, height=30)

        list_userIds = tk.Listbox(root)
        list_userIds["borderwidth"] = "1px"
        list_userIds["fg"] = "#333333"
        list_userIds.place(x=0, y=130, width=132, height=251)

        button_addId = tk.Button(root)
        button_addId["text"] = "New id"
        button_addId.place(x=140, y=320, width=70, height=25)
        button_addId["command"] = lambda: button_addId_command(user_Ids, root)

        button_comment = tk.Button(root)
        button_comment["text"] = "Comment"
        button_comment.place(x=140, y=350, width=70, height=25)
        button_comment["command"] = button_comment_command

        label_loggedIn = tk.Label(root)
        label_loggedIn["text"] = "Logged in: "
        label_loggedIn.place(x=150, y=150, width=70, height=25)

        label_postActive = tk.Label(root)
        label_postActive["text"] = "Post active?"
        label_postActive.place(x=150, y=190, width=70, height=25)

        label_nrEntries = tk.Label(root)
        label_nrEntries["text"] = "Number of Entries :"
        label_nrEntries.place(x=150, y=230, width=110, height=30)

        entry_nrEntries = tk.Entry(root)
        entry_nrEntries["text"] = "Entry"
        entry_nrEntries.place(x=270, y=230, width=33, height=30)

        check_loggedIn = tk.Checkbutton(root)
        check_loggedIn["text"] = ""
        check_loggedIn.place(x=210, y=150, width=41, height=30)
        check_loggedIn["offvalue"] = "0"
        check_loggedIn["onvalue"] = "1"
        check_loggedIn["command"] = check_loggedIn_command

        check_postActive = tk.Checkbutton(root)
        check_postActive["text"] = ""
        check_postActive.place(x=210, y=190, width=41, height=30)
        check_postActive["offvalue"] = "0"
        check_postActive["onvalue"] = "1"
        check_postActive["command"] = check_postActive_command

        button_login = tk.Button(root)
        button_login["text"] = "Login"
        button_login.place(x=250, y=150, width=44, height=30)
        button_login["command"] = button_login_command

        user_Ids = read_user_from_file("C:/Users/bruno/OneDrive/Documentos/userIds.txt")
        for users in user_Ids:
            list_userIds.insert('end', users)

    def refresh_user_list(self, user_list):
        global user_Ids
        for users in user_list:
            root.list_userIds.insert('end', users)

def read_user_from_file(file_path):
    user_txt = open(file_path, 'r')
    userIds = user_txt.readlines()
    return userIds

@staticmethod
def button_comment_command():
    print("command")

@staticmethod
def check_loggedIn_command():
    print("command")

@staticmethod
def check_postActive_command():
    print("command")

@staticmethod
def button_login_command():
    print("command")

def add_user_id(new_user, user_list, root, main_root):
    print(new_user)
    print(user_list)
    user_list.append(new_user)
    print(user_list)

    main_root.refresh_user_list(main_root, user_list)
    root.destroy()

def button_addId_command(user_list, main_root):
    root2 = tk.Toplevel(main_root)
    label_title = tk.Label(root2, text="Insert the new ID you want to add to the list ")
    entry_userID = tk.Entry(root2)
    button_register = tk.Button(root2, text="Register",
                                command=lambda: add_user_id(entry_userID.get(), user_list, root2, main_root))
    label_title.pack()
    entry_userID.pack()
    button_register.pack()
    root2.mainloop

if __name__ == "__main__":
    root = tk.Tk()
    windows = WindowCreator(root)

    root.mainloop()

When I try to add a new user, I click the New Id button, and then a new windows pops up. In that new window, i've a entry widget and a button. I want to, when I click the register button in that new windows, to acess refresh_user_list, so I can refresh the ListBox widget of the first window list_userIds.
I'm having several troubles with passing objects, and acessing then within other scope.
I can't find a proper website that explains it. Can someone help me?
I tried to reduce the amount of code to post, but I couldn't

I tried to pass the objects as parameters ( the root ob

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\Users\bruno\PycharmProjects\InstagramCommentBot\WindowCreator.py", line 135, in <lambda>
    button_register = tk.Button(root2, text="Register", command= lambda : add_user_id(entry_userID.get(), user_list, root2, main_root))
  File "C:\Users\bruno\PycharmProjects\InstagramCommentBot\WindowCreator.py", line 127, in add_user_id
    main_root.refresh_user_list(main_root,user_list)
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2354, in __getattr__
    return getattr(self.tk, attr)
AttributeError: '_tkinter.tkapp' object has no attribute 'refresh_user_list'

jects of Tk()) but im always getting the error


问:
WebClient doesn't fetch data as expected
I'm trying to reactively fetch data from external API using two methods from some Service class.

I'm new to reactive and Spring in general, so it could be a very obvious mistake but I just can't find it

These are the two methods:

    public Mono<SomeClass> get(int value) {
        return webClient.get()
                .uri("/" + value)
                .retrieve()
                .onRawStatus(HttpStatus.CONFLICT::equals, clientResponse -> {
                    return Mono.error(new SomeException1("Some message", clientResponse.rawStatusCode()));
                })
                .onRawStatus(HttpStatus.NOT_FOUND::equals, clientResponse -> {
                    return requestGeneration(value)
                        .flatMap(res -> Mono.error(new SomeException1("Some message", clientResponse.rawStatusCode())));
                })
                .bodyToMono(SomeClass.class)
                .retryWhen(Retry.backoff(5, Duration.ofSeconds(8))
                        .filter(throwable -> throwable instanceof SomeException1));
    }

    private Mono<Void> requestGeneration(int value) {
        return webClient.post()
                .uri("/" + value)
                .retrieve()
                .onRawStatus(HttpStatus.BAD_REQUEST::equals, clientResponse -> {
                    return Mono.error(new SomeException2("Wrong value", clientResponse.rawStatusCode()));
                })
                .bodyToMono(Void.class);
    }

```
<p>Baasically what I'm trying to achieve is:</p>
<ul>
<li>first <code>GET</code> from <code>http://api.examplepage.com/{value}</code></li>
<li>if that API returns HTTP404 it means I need to first call <code>POST</code> to the same URL, because the data is not yet generated</li>
<li>the second function does the <code>POST</code> call and returns <code>Mono<Void></code> because it is just HTTP200 or HTTP400 on bad generation seed (i don't need to process the response)</li>
<li>first function (<code>GET</code> call) could also return HTTP429 which means the data is generating right now, so I need to call again after some time period (5-300 seconds) and check if data has been generated already</li>
<li>then after some time it results in HTTP200 with generated data which I want to map to <code>SomeClass</code> and then return mapped data in controller below</li>
</ul>
<pre class="lang-java prettyprint-override"><code>    @PostMapping("/follow/{value}")
    public Mono<ResponseEntity<?>> someFunction(@PathVariable int value)  {
            return Mono.just(ResponseEntity.ok(service.get(value)));
    }
</code>```

all the code I posted is very simplified to the issues I'm struggling with and doesn't contain some things I think are not important in this question

and now the actual question:
it doesn't actually make the call? i really don't know what is happening
program doesn't enter onRawStatus, even if i change it to onStatus 2xx or whatever other httpstatus and log inside i see nothing as if it doesn't even enter the chains

when i manually call with postman it seems like the program calls have never been made because the GET call returns 404 (the program didn't request to generate data)

the controller only returns "scanAvailable": true, when i expect it to return mapped SomeClass json

// edit

i changed the code to be a full chain as suggested and it didn't solve the problem. all the status are still unreachable (code inside any onStatus nor onRawStatus never executes)

Body:
I'm trying to reactively fetch data from external API using two methods from some Service class.

I'm new to reactive and Spring in general, so it could be a very obvious mistake but I just can't find it

These are the two methods:

    public Mono<SomeClass> get(int value) {
        return webClient.get()
                .uri("/" + value)
                .retrieve()
                .onRawStatus(HttpStatus.CONFLICT::equals, clientResponse -> {
                    return Mono.error(new SomeException1("Some message", clientResponse.rawStatusCode()));
                })
                .onRawStatus(HttpStatus.NOT_FOUND::equals, clientResponse -> {
                    return requestGeneration(value)
                        .flatMap(res -> Mono.error(new SomeException1("Some message", clientResponse.rawStatusCode())));
                })
                .bodyToMono(SomeClass.class)
                .retryWhen(Retry.backoff(5, Duration.ofSeconds(8))
                        .filter(throwable -> throwable instanceof SomeException1));
    }

    private Mono<Void> requestGeneration(int value) {
        return webClient.post()
                .uri("/" + value)
                .retrieve()
                .onRawStatus(HttpStatus.BAD_REQUEST::equals, clientResponse -> {
                    return Mono.error(new SomeException2("Wrong value", clientResponse.rawStatusCode()));
                })
                .bodyToMono(Void.class);
    }

Baasically what I'm trying to achieve is:

first GET from http://api.examplepage.com/{value}

if that API returns HTTP404 it means I need to first call POST to the same URL, because the data is not yet generated

the second function does the POST call and returns Mono<Void> because it is just HTTP200 or HTTP400 on bad generation seed (i don't need to process the response)

first function (GET call) could also return HTTP429 which means the data is generating right now, so I need to call again after some time period (5-300 seconds) and check if data has been generated already

then after some time it results in HTTP200 with generated data which I want to map to SomeClass and then return mapped data in controller below

    @PostMapping("/follow/{value}")
    public Mono<ResponseEntity<?>> someFunction(@PathVariable int value)  {
            return Mono.just(ResponseEntity.ok(service.get(value)));
    }

all the code I posted is very simplified to the issues I'm struggling with and doesn't contain some things I think are not important in this question

and now the actual question:
it doesn't actually make the call? i really don't know what is happening
program doesn't enter onRawStatus, even if i change it to onStatus 2xx or whatever other httpstatus and log inside i see nothing as if it doesn't even enter the chains

when i manually call with postman it seems like the program calls have never been made because the GET call returns 404 (the program didn't request to generate data)

the controller only returns "scanAvailable": true, when i expect it to return mapped SomeClass json

// edit

i changed the code to be a full chain as suggested and it didn't solve the problem. all the status are still unreachable (code inside any onStatus nor onRawStatus never executes)