问:
Ordering on parent-aggregations based on sub-aggregrations
I am using elasticsearch 6.3 . I have an index event_v4 which store the data of all events handled by our company. Now i need to get a list of cities that satisfy a certain conditions. But if the count is less than required then i need to drop the filter one by one to get required number of results. In order to achieve this i used function_score. Now i can order the parent aggregation on the score but now i need to order in this way, first order based on score then order based on the doc_count for that score.

Here is the query i have worked on so far:

```<code>GET event_v4/_search
{
  "_source": false,
  "size": 0,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": [
            {
              "term": {
                "published": 1
              }
            },
            {
              "term": {
                "functionality": "open"
              }
            },
            {
              "term": {
                "city_searchable": 1
              }
            }
          ],
          "must_not": [
            {
              "term": {
                "status": "U"
              }
            }
          ],
          "should": null
        }
      },
      "functions": [
        {
          "filter": {
            "term": {
              "category": "27"
            }
          },
          "weight": 20
        },
        {
          "filter": {
            "term": {
              "country": "IN"
            }
          },
          "weight": 40
        },
        {
          "filter": {
            "terms": {
              "event_type": [
                "Tradeshow"
              ]
            }
          },
          "weight": 10
        }
      ],
      "score_mode": "sum",
      "boost_mode": "replace"
    }
  },
  "aggs": {
    "all_event_count": {
      "terms": {
        "field": "city",
        "size": 30000
      },
      "aggs": {
        "total_count": {
          "terms": {
            "script": "_score",
            "value_type": "integer",
            "order": {
              "_key": "desc"
            },
            "min_doc_count": 5
          }
        },
        "score": {
          "max_bucket": {
            "buckets_path": "total_count._key" // to get the score of the max bucket after min_doc_count is applied
          }
        },
        "select_bucket": {
          "bucket_selector": {
            "buckets_path": {
              "total_count": "total_count._bucket_count"
            },
            "script": "params.total_count >= 1" // to remove null buckets in child-aggs after min_doc_count is applied
          }
        },
       "sort_city": {
          "bucket_sort": {
            "sort": [
              {
                "score": "desc"
              },
              {
                "_count": "desc" // need to sort on doc_count of the score not the count of the parent aggs
              }
            ],
            "from": 0,
            "size": 50
          }
        }
      }
    }
  }
}
</code>```

The result of the query is as follows:

```{
  "took": 75,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 17789,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "all_event_count": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "70469",
          "doc_count": 406,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 70,
                "doc_count": 12
              },
              {
                "key": 60,
                "doc_count": 13
              },
              {
                "key": 50,
                "doc_count": 213
              },
              {
                "key": 40,
                "doc_count": 168
              }
            ]
          },
          "score": {
            "value": 70,
            "keys": [
              "70"
            ]
          }
        },
        {
          "key": "70624",
          "doc_count": 340,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 70,
                "doc_count": 13
              },
              {
                "key": 60,
                "doc_count": 14
              },
              {
                "key": 50,
                "doc_count": 198
              },
              {
                "key": 40,
                "doc_count": 115
              }
            ]
          },
          "score": {
            "value": 70,
            "keys": [
              "70"
            ]
          }
        },
        {
          "key": "70532",
          "doc_count": 182,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 70,
                "doc_count": 6
              },
              {
                "key": 60,
                "doc_count": 6
              },
              {
                "key": 50,
                "doc_count": 95
              },
              {
                "key": 40,
                "doc_count": 75
              }
            ]
          },
          "score": {
            "value": 70,
            "keys": [
              "70"
            ]
          }
        },
        {
          "key": "70699",
          "doc_count": 127,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 60,
                "doc_count": 5
              },
              {
                "key": 50,
                "doc_count": 79
              },
              {
                "key": 40,
                "doc_count": 41
              }
            ]
          },
          "score": {
            "value": 60,
            "keys": [
              "60"
            ]
          }
        },
        {
          "key": "70435",
          "doc_count": 107,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 60,
                "doc_count": 9
              },
              {
                "key": 50,
                "doc_count": 51
              },
              {
                "key": 40,
                "doc_count": 43
              }
            ]
          },
          "score": {
            "value": 60,
            "keys": [
              "60"
            ]
          }
        },
        {
          "key": "70630",
          "doc_count": 64,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 60,
                "doc_count": 5
              },
              {
                "key": 50,
                "doc_count": 29
              },
              {
                "key": 40,
                "doc_count": 30
              }
            ]
          },
          "score": {
            "value": 60,
            "keys": [
              "60"
            ]
          }
        },
        {
          "key": "70751",
          "doc_count": 193,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 71
              },
              {
                "key": 40,
                "doc_count": 121
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "90429",
          "doc_count": 91,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 14
              },
              {
                "key": 40,
                "doc_count": 76
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70472",
          "doc_count": 73,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 52
              },
              {
                "key": 40,
                "doc_count": 15
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70772",
          "doc_count": 56,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 32
              },
              {
                "key": 40,
                "doc_count": 22
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70672",
          "doc_count": 38,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 22
              },
              {
                "key": 40,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70425",
          "doc_count": 26,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 20
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70479",
          "doc_count": 24,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 19
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70466",
          "doc_count": 22,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70701",
          "doc_count": 22,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 16
              },
              {
                "key": 40,
                "doc_count": 6
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70497",
          "doc_count": 21,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 11
              },
              {
                "key": 40,
                "doc_count": 9
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70490",
          "doc_count": 17,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70592",
          "doc_count": 17,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 14
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70746",
          "doc_count": 15,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 9
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70487",
          "doc_count": 15,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 13
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70563",
          "doc_count": 13,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 8
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70464",
          "doc_count": 11,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 10
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "83849",
          "doc_count": 11,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 6
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70626",
          "doc_count": 10,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 6
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70625",
          "doc_count": 9,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 6
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "73797",
          "doc_count": 8,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 8
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "84025",
          "doc_count": 7,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 7
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70452",
          "doc_count": 7,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 40,
            "keys": [
              "40"
            ]
          }
        },
        {
          "key": "1",
          "doc_count": 1409,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 17
              },
              {
                "key": 20,
                "doc_count": 50
              },
              {
                "key": 10,
                "doc_count": 571
              },
              {
                "key": 1,
                "doc_count": 771
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "81795",
          "doc_count": 387,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 10
              },
              {
                "key": 20,
                "doc_count": 35
              },
              {
                "key": 10,
                "doc_count": 167
              },
              {
                "key": 1,
                "doc_count": 175
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "68873",
          "doc_count": 313,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 13
              },
              {
                "key": 20,
                "doc_count": 31
              },
              {
                "key": 10,
                "doc_count": 126
              },
              {
                "key": 1,
                "doc_count": 143
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70834",
          "doc_count": 285,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 20,
                "doc_count": 20
              },
              {
                "key": 10,
                "doc_count": 136
              },
              {
                "key": 1,
                "doc_count": 123
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70824",
          "doc_count": 236,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 16
              },
              {
                "key": 10,
                "doc_count": 152
              },
              {
                "key": 1,
                "doc_count": 63
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69091",
          "doc_count": 228,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 17
              },
              {
                "key": 10,
                "doc_count": 167
              },
              {
                "key": 1,
                "doc_count": 42
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69308",
          "doc_count": 173,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 10
              },
              {
                "key": 10,
                "doc_count": 107
              },
              {
                "key": 1,
                "doc_count": 51
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70038",
          "doc_count": 156,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 8
              },
              {
                "key": 20,
                "doc_count": 7
              },
              {
                "key": 10,
                "doc_count": 75
              },
              {
                "key": 1,
                "doc_count": 66
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69058",
          "doc_count": 137,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 5
              },
              {
                "key": 10,
                "doc_count": 98
              },
              {
                "key": 1,
                "doc_count": 29
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70194",
          "doc_count": 123,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 10,
                "doc_count": 100
              },
              {
                "key": 1,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "97467",
          "doc_count": 109,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 7
              },
              {
                "key": 10,
                "doc_count": 98
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69966",
          "doc_count": 108,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 10,
                "doc_count": 49
              },
              {
                "key": 1,
                "doc_count": 51
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "81673",
          "doc_count": 104,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 20,
                "doc_count": 5
              },
              {
                "key": 10,
                "doc_count": 81
              },
              {
                "key": 1,
                "doc_count": 12
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69222",
          "doc_count": 88,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 7
              },
              {
                "key": 10,
                "doc_count": 43
              },
              {
                "key": 1,
                "doc_count": 33
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        }
      ]
    }
  }
}
```

Kindly provide a way to sort on the doc_count of the score in child aggs. Also any suggestions to achieve this requirement of dropping filters without using score is also welcomed.

Body:
I am using elasticsearch 6.3 . I have an index event_v4 which store the data of all events handled by our company. Now i need to get a list of cities that satisfy a certain conditions. But if the count is less than required then i need to drop the filter one by one to get required number of results. In order to achieve this i used function_score. Now i can order the parent aggregation on the score but now i need to order in this way, first order based on score then order based on the doc_count for that score.

Here is the query i have worked on so far:

GET event_v4/_search
{
  "_source": false,
  "size": 0,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": [
            {
              "term": {
                "published": 1
              }
            },
            {
              "term": {
                "functionality": "open"
              }
            },
            {
              "term": {
                "city_searchable": 1
              }
            }
          ],
          "must_not": [
            {
              "term": {
                "status": "U"
              }
            }
          ],
          "should": null
        }
      },
      "functions": [
        {
          "filter": {
            "term": {
              "category": "27"
            }
          },
          "weight": 20
        },
        {
          "filter": {
            "term": {
              "country": "IN"
            }
          },
          "weight": 40
        },
        {
          "filter": {
            "terms": {
              "event_type": [
                "Tradeshow"
              ]
            }
          },
          "weight": 10
        }
      ],
      "score_mode": "sum",
      "boost_mode": "replace"
    }
  },
  "aggs": {
    "all_event_count": {
      "terms": {
        "field": "city",
        "size": 30000
      },
      "aggs": {
        "total_count": {
          "terms": {
            "script": "_score",
            "value_type": "integer",
            "order": {
              "_key": "desc"
            },
            "min_doc_count": 5
          }
        },
        "score": {
          "max_bucket": {
            "buckets_path": "total_count._key" // to get the score of the max bucket after min_doc_count is applied
          }
        },
        "select_bucket": {
          "bucket_selector": {
            "buckets_path": {
              "total_count": "total_count._bucket_count"
            },
            "script": "params.total_count >= 1" // to remove null buckets in child-aggs after min_doc_count is applied
          }
        },
       "sort_city": {
          "bucket_sort": {
            "sort": [
              {
                "score": "desc"
              },
              {
                "_count": "desc" // need to sort on doc_count of the score not the count of the parent aggs
              }
            ],
            "from": 0,
            "size": 50
          }
        }
      }
    }
  }
}

The result of the query is as follows:

{
  "took": 75,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 17789,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "all_event_count": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "70469",
          "doc_count": 406,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 70,
                "doc_count": 12
              },
              {
                "key": 60,
                "doc_count": 13
              },
              {
                "key": 50,
                "doc_count": 213
              },
              {
                "key": 40,
                "doc_count": 168
              }
            ]
          },
          "score": {
            "value": 70,
            "keys": [
              "70"
            ]
          }
        },
        {
          "key": "70624",
          "doc_count": 340,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 70,
                "doc_count": 13
              },
              {
                "key": 60,
                "doc_count": 14
              },
              {
                "key": 50,
                "doc_count": 198
              },
              {
                "key": 40,
                "doc_count": 115
              }
            ]
          },
          "score": {
            "value": 70,
            "keys": [
              "70"
            ]
          }
        },
        {
          "key": "70532",
          "doc_count": 182,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 70,
                "doc_count": 6
              },
              {
                "key": 60,
                "doc_count": 6
              },
              {
                "key": 50,
                "doc_count": 95
              },
              {
                "key": 40,
                "doc_count": 75
              }
            ]
          },
          "score": {
            "value": 70,
            "keys": [
              "70"
            ]
          }
        },
        {
          "key": "70699",
          "doc_count": 127,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 60,
                "doc_count": 5
              },
              {
                "key": 50,
                "doc_count": 79
              },
              {
                "key": 40,
                "doc_count": 41
              }
            ]
          },
          "score": {
            "value": 60,
            "keys": [
              "60"
            ]
          }
        },
        {
          "key": "70435",
          "doc_count": 107,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 60,
                "doc_count": 9
              },
              {
                "key": 50,
                "doc_count": 51
              },
              {
                "key": 40,
                "doc_count": 43
              }
            ]
          },
          "score": {
            "value": 60,
            "keys": [
              "60"
            ]
          }
        },
        {
          "key": "70630",
          "doc_count": 64,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 60,
                "doc_count": 5
              },
              {
                "key": 50,
                "doc_count": 29
              },
              {
                "key": 40,
                "doc_count": 30
              }
            ]
          },
          "score": {
            "value": 60,
            "keys": [
              "60"
            ]
          }
        },
        {
          "key": "70751",
          "doc_count": 193,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 71
              },
              {
                "key": 40,
                "doc_count": 121
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "90429",
          "doc_count": 91,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 14
              },
              {
                "key": 40,
                "doc_count": 76
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70472",
          "doc_count": 73,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 52
              },
              {
                "key": 40,
                "doc_count": 15
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70772",
          "doc_count": 56,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 32
              },
              {
                "key": 40,
                "doc_count": 22
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70672",
          "doc_count": 38,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 22
              },
              {
                "key": 40,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70425",
          "doc_count": 26,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 20
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70479",
          "doc_count": 24,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 19
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70466",
          "doc_count": 22,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70701",
          "doc_count": 22,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 16
              },
              {
                "key": 40,
                "doc_count": 6
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70497",
          "doc_count": 21,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 11
              },
              {
                "key": 40,
                "doc_count": 9
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70490",
          "doc_count": 17,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70592",
          "doc_count": 17,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 14
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70746",
          "doc_count": 15,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 9
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70487",
          "doc_count": 15,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 13
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70563",
          "doc_count": 13,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 8
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70464",
          "doc_count": 11,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 10
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "83849",
          "doc_count": 11,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 6
              },
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70626",
          "doc_count": 10,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 6
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70625",
          "doc_count": 9,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 6
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "73797",
          "doc_count": 8,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 8
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "84025",
          "doc_count": 7,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 50,
                "doc_count": 7
              }
            ]
          },
          "score": {
            "value": 50,
            "keys": [
              "50"
            ]
          }
        },
        {
          "key": "70452",
          "doc_count": 7,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 40,
                "doc_count": 5
              }
            ]
          },
          "score": {
            "value": 40,
            "keys": [
              "40"
            ]
          }
        },
        {
          "key": "1",
          "doc_count": 1409,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 17
              },
              {
                "key": 20,
                "doc_count": 50
              },
              {
                "key": 10,
                "doc_count": 571
              },
              {
                "key": 1,
                "doc_count": 771
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "81795",
          "doc_count": 387,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 10
              },
              {
                "key": 20,
                "doc_count": 35
              },
              {
                "key": 10,
                "doc_count": 167
              },
              {
                "key": 1,
                "doc_count": 175
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "68873",
          "doc_count": 313,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 13
              },
              {
                "key": 20,
                "doc_count": 31
              },
              {
                "key": 10,
                "doc_count": 126
              },
              {
                "key": 1,
                "doc_count": 143
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70834",
          "doc_count": 285,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 20,
                "doc_count": 20
              },
              {
                "key": 10,
                "doc_count": 136
              },
              {
                "key": 1,
                "doc_count": 123
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70824",
          "doc_count": 236,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 16
              },
              {
                "key": 10,
                "doc_count": 152
              },
              {
                "key": 1,
                "doc_count": 63
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69091",
          "doc_count": 228,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 17
              },
              {
                "key": 10,
                "doc_count": 167
              },
              {
                "key": 1,
                "doc_count": 42
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69308",
          "doc_count": 173,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 10
              },
              {
                "key": 10,
                "doc_count": 107
              },
              {
                "key": 1,
                "doc_count": 51
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70038",
          "doc_count": 156,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 8
              },
              {
                "key": 20,
                "doc_count": 7
              },
              {
                "key": 10,
                "doc_count": 75
              },
              {
                "key": 1,
                "doc_count": 66
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69058",
          "doc_count": 137,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 5
              },
              {
                "key": 10,
                "doc_count": 98
              },
              {
                "key": 1,
                "doc_count": 29
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "70194",
          "doc_count": 123,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 10,
                "doc_count": 100
              },
              {
                "key": 1,
                "doc_count": 16
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "97467",
          "doc_count": 109,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 7
              },
              {
                "key": 10,
                "doc_count": 98
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69966",
          "doc_count": 108,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 10,
                "doc_count": 49
              },
              {
                "key": 1,
                "doc_count": 51
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "81673",
          "doc_count": 104,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 6
              },
              {
                "key": 20,
                "doc_count": 5
              },
              {
                "key": 10,
                "doc_count": 81
              },
              {
                "key": 1,
                "doc_count": 12
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        },
        {
          "key": "69222",
          "doc_count": 88,
          "total_count": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": 30,
                "doc_count": 5
              },
              {
                "key": 20,
                "doc_count": 7
              },
              {
                "key": 10,
                "doc_count": 43
              },
              {
                "key": 1,
                "doc_count": 33
              }
            ]
          },
          "score": {
            "value": 30,
            "keys": [
              "30"
            ]
          }
        }
      ]
    }
  }
}

Kindly provide a way to sort on the doc_count of the score in child aggs. Also any suggestions to achieve this requirement of dropping filters without using score is also welcomed.


来源: stackexchange

问:
Response caching not working in apache ubuntu
I am trying to cache all static files (any extension) ignoring any Cache-Control rules/headers. However, I always see X-Cache: MISS from 127.0.1.1 on the browser. Also the files are not getting cached in the mentioned CacheRoot directive. I have tried logging the cache results for every request and I see "cache miss: attempting entity save" for every request.

What am I missing in the apache config?

Below is my sites-available/000-default.conf file:

```<code><VirtualHost *:80>
#ServerName 10.133.220.56

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

#Include conf-available/serve-cgi-bin.conf

CacheEnable disk /
CacheRoot /var/cache/apache2/mod_cache_disk/routing

CacheQuickHandler on
CacheLock on
CacheLockPath /tmp/mod_cache-lock
CacheLockMaxAge 5
CacheHeader on

CacheIgnoreHeaders Cache-Control Expires Set-Cookie
CacheIgnoreCacheControl on
CacheIgnoreNoLastMod on

ExpiresActive off

</VirtualHost>

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to cache all static files (any extension) ignoring any Cache-Control rules/headers. However, I always see X-Cache: MISS from 127.0.1.1 on the browser. Also the files are not getting cached in the mentioned CacheRoot directive. I have tried logging the cache results for every request and I see "cache miss: attempting entity save" for every request.

What am I missing in the apache config?

Below is my sites-available/000-default.conf file:

<VirtualHost *:80>
#ServerName 10.133.220.56

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

#Include conf-available/serve-cgi-bin.conf

CacheEnable disk /
CacheRoot /var/cache/apache2/mod_cache_disk/routing

CacheQuickHandler on
CacheLock on
CacheLockPath /tmp/mod_cache-lock
CacheLockMaxAge 5
CacheHeader on

CacheIgnoreHeaders Cache-Control Expires Set-Cookie
CacheIgnoreCacheControl on
CacheIgnoreNoLastMod on

ExpiresActive off

</VirtualHost>


问:
How to show the contents of a tab in a different window?
The first window has several tabs, a button to open a window where you can view their content (slide show), in this window there are two buttons: back and forward, to flip through the tabs. How to implement this? In my code, can I already add text and pictures to the tabs

```<code>from PyQt5.QtWidgets import QWidget, QMainWindow, QFileDialog, QInputDialog, QLabel, QApplication
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtCore import QRect
from PyQt5 import uic
import sys

class FirstForm(QMainWindow):
    def __init__(self):
        super().__init__()
        uic.loadUi('form1.ui', self)
        self.secondForm = SecondForm()
        self.slideshow = SlideShow()
        self.pushButton.clicked.connect(self.secondForm.show)
        self.secondForm.btn2_2.clicked.connect(self.addImage)
        self.secondForm.btn2.clicked.connect(self.addText)
        self.pushButton_2.clicked.connect(self.openshow)

    def getWidgetGeometry(self):
        try:
            x = int(self.secondForm.height_2.text())
            y = int(self.secondForm.lineEdit_2.text())
            w = int(self.secondForm.lineEdit_3.text())
            h = int(self.secondForm.lineEdit_4.text())
        except:
            x = 0
            y = 0
            w = 100
            h = 100
        return QRect(x, y, w, h)

    def openshow(self):
        self.slideshow.show()

    def addImage(self):
        result = QFileDialog.getOpenFileName(self.secondForm, 'Выбрать картинку', '')
        if result[1]:
            image = QImage(result[0])
            label = QLabel('', self.tabWidget.currentWidget())
            label.setPixmap(QPixmap.fromImage(image))
            label.setGeometry(self.getWidgetGeometry())
            label.show()

    def addText(self):
        result = QInputDialog.getText(self.secondForm, '', 'введите текст')
        if result[1]:
            label = QLabel(result[0], self.tabWidget.currentWidget())
            label.setGeometry(self.getWidgetGeometry())
            label.show()

class SecondForm(QWidget):
    def __init__(self):
        super().__init__()
        uic.loadUi('form2.ui', self)

class SlideShow(QWidget):
    def __init__(self):
        super().__init__()
        uic.loadUi('form3.ui', self)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = FirstForm()
    ex.show()
    sys.exit(app.exec_())
</code>```

uic the main window with the tabs:

```<code><?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QTabWidget" name="tabWidget">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
      <width>541</width>
      <height>471</height>
     </rect>
    </property>
    <widget class="QWidget" name="tab">
     <attribute name="title">
      <string>Tab 1</string>
     </attribute>
    </widget>
    <widget class="QWidget" name="tab_2">
     <attribute name="title">
      <string>Tab 2</string>
     </attribute>
    </widget>
   </widget>
   <widget class="QPushButton" name="pushButton">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>480</y>
      <width>181</width>
      <height>71</height>
     </rect>
    </property>
    <property name="text">
     <string>Открыть второе окно</string>
    </property>
   </widget>
   <widget class="QPushButton" name="pushButton_2">
    <property name="geometry">
     <rect>
      <x>270</x>
      <y>480</y>
      <width>211</width>
      <height>61</height>
     </rect>
    </property>
    <property name="text">
     <string>содержимое табов(слайд-шоу)</string>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>
uic редактора( здесь можно вставлять картинки и тексты в табы первого окна):
`<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="btn2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>40</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>текст</string>
   </property>
  </widget>
  <widget class="QPushButton" name="btn2_2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>130</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>картинка</string>
   </property>
  </widget>
  <widget class="QLabel" name="label">
   <property name="geometry">
    <rect>
     <x>190</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Положение</string>
   </property>
  </widget>
  <widget class="QLabel" name="label_2">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Размеры</string>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_2">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_3">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_4">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>
uic третьего окна( здесь нужно реализовать показ содержимого табов первого окна):
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>622</width>
    <height>475</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="pushButton">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Назад</string>
   </property>
  </widget>
  <widget class="QPushButton" name="pushButton_2">
   <property name="geometry">
    <rect>
     <x>110</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Вперед</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>`
</code>```

uic window in which you can add pictures and text to the tabs:

```<code><?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="btn2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>40</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>текст</string>
   </property>
  </widget>
  <widget class="QPushButton" name="btn2_2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>130</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>картинка</string>
   </property>
  </widget>
  <widget class="QLabel" name="label">
   <property name="geometry">
    <rect>
     <x>190</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Положение</string>
   </property>
  </widget>
  <widget class="QLabel" name="label_2">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Размеры</string>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_2">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_3">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_4">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>
</code>```

uic window in which the contents of the tabs should be displayed

```<code><?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>622</width>
    <height>475</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="pushButton">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Назад</string>
   </property>
  </widget>
  <widget class="QPushButton" name="pushButton_2">
   <property name="geometry">
    <rect>
     <x>110</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Вперед</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>

</code>```

I tried the show method, but without success

Body:
The first window has several tabs, a button to open a window where you can view their content (slide show), in this window there are two buttons: back and forward, to flip through the tabs. How to implement this? In my code, can I already add text and pictures to the tabs

from PyQt5.QtWidgets import QWidget, QMainWindow, QFileDialog, QInputDialog, QLabel, QApplication
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtCore import QRect
from PyQt5 import uic
import sys

class FirstForm(QMainWindow):
    def __init__(self):
        super().__init__()
        uic.loadUi('form1.ui', self)
        self.secondForm = SecondForm()
        self.slideshow = SlideShow()
        self.pushButton.clicked.connect(self.secondForm.show)
        self.secondForm.btn2_2.clicked.connect(self.addImage)
        self.secondForm.btn2.clicked.connect(self.addText)
        self.pushButton_2.clicked.connect(self.openshow)

    def getWidgetGeometry(self):
        try:
            x = int(self.secondForm.height_2.text())
            y = int(self.secondForm.lineEdit_2.text())
            w = int(self.secondForm.lineEdit_3.text())
            h = int(self.secondForm.lineEdit_4.text())
        except:
            x = 0
            y = 0
            w = 100
            h = 100
        return QRect(x, y, w, h)

    def openshow(self):
        self.slideshow.show()

    def addImage(self):
        result = QFileDialog.getOpenFileName(self.secondForm, 'Выбрать картинку', '')
        if result[1]:
            image = QImage(result[0])
            label = QLabel('', self.tabWidget.currentWidget())
            label.setPixmap(QPixmap.fromImage(image))
            label.setGeometry(self.getWidgetGeometry())
            label.show()

    def addText(self):
        result = QInputDialog.getText(self.secondForm, '', 'введите текст')
        if result[1]:
            label = QLabel(result[0], self.tabWidget.currentWidget())
            label.setGeometry(self.getWidgetGeometry())
            label.show()

class SecondForm(QWidget):
    def __init__(self):
        super().__init__()
        uic.loadUi('form2.ui', self)

class SlideShow(QWidget):
    def __init__(self):
        super().__init__()
        uic.loadUi('form3.ui', self)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = FirstForm()
    ex.show()
    sys.exit(app.exec_())

uic the main window with the tabs:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QTabWidget" name="tabWidget">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
      <width>541</width>
      <height>471</height>
     </rect>
    </property>
    <widget class="QWidget" name="tab">
     <attribute name="title">
      <string>Tab 1</string>
     </attribute>
    </widget>
    <widget class="QWidget" name="tab_2">
     <attribute name="title">
      <string>Tab 2</string>
     </attribute>
    </widget>
   </widget>
   <widget class="QPushButton" name="pushButton">
    <property name="geometry">
     <rect>
      <x>60</x>
      <y>480</y>
      <width>181</width>
      <height>71</height>
     </rect>
    </property>
    <property name="text">
     <string>Открыть второе окно</string>
    </property>
   </widget>
   <widget class="QPushButton" name="pushButton_2">
    <property name="geometry">
     <rect>
      <x>270</x>
      <y>480</y>
      <width>211</width>
      <height>61</height>
     </rect>
    </property>
    <property name="text">
     <string>содержимое табов(слайд-шоу)</string>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>
uic редактора( здесь можно вставлять картинки и тексты в табы первого окна):
`<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="btn2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>40</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>текст</string>
   </property>
  </widget>
  <widget class="QPushButton" name="btn2_2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>130</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>картинка</string>
   </property>
  </widget>
  <widget class="QLabel" name="label">
   <property name="geometry">
    <rect>
     <x>190</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Положение</string>
   </property>
  </widget>
  <widget class="QLabel" name="label_2">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Размеры</string>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_2">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_3">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_4">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>
uic третьего окна( здесь нужно реализовать показ содержимого табов первого окна):
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>622</width>
    <height>475</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="pushButton">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Назад</string>
   </property>
  </widget>
  <widget class="QPushButton" name="pushButton_2">
   <property name="geometry">
    <rect>
     <x>110</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Вперед</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>`

uic window in which you can add pictures and text to the tabs:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="btn2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>40</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>текст</string>
   </property>
  </widget>
  <widget class="QPushButton" name="btn2_2">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>130</y>
     <width>101</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>картинка</string>
   </property>
  </widget>
  <widget class="QLabel" name="label">
   <property name="geometry">
    <rect>
     <x>190</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Положение</string>
   </property>
  </widget>
  <widget class="QLabel" name="label_2">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>40</y>
     <width>61</width>
     <height>21</height>
    </rect>
   </property>
   <property name="text">
    <string>Размеры</string>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_2">
   <property name="geometry">
    <rect>
     <x>200</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_3">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>70</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
  <widget class="QLineEdit" name="lineEdit_4">
   <property name="geometry">
    <rect>
     <x>290</x>
     <y>130</y>
     <width>31</width>
     <height>20</height>
    </rect>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>

uic window in which the contents of the tabs should be displayed

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>622</width>
    <height>475</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <widget class="QPushButton" name="pushButton">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Назад</string>
   </property>
  </widget>
  <widget class="QPushButton" name="pushButton_2">
   <property name="geometry">
    <rect>
     <x>110</x>
     <y>430</y>
     <width>91</width>
     <height>31</height>
    </rect>
   </property>
   <property name="text">
    <string>Вперед</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>

I tried the show method, but without success


问:
How to make my modal shown in the other component
Component where i want modal to be shown on click

```<code>import Modal from "../Modal/Modal";

const CarProductDetails = ({handleOpenModal) => {

    <>
    <Modal />
   <Swiper />
<button onClick={handleOpenMoodal}> Submit </button>

export default CarProductDetails;
</code>```

Modal css

```<code>import styled from "styled-components";

export const ModalOuter = styled.div`

  display: ${({ showModal }) => (showModal ? "block" : "none")};
`;

export const ModalForm = styled.div`
  opacity: ${({ showModal }) => (showModal ? "1" : "0")};
  top: ${({showModal}) => (showModal ? '50%' : '-100%')};

</code>```

Main page (where the function is stored and used on this page as well)

```<code>import React, { useState } from "react";

import Modal from "../components/Modal/Modal";

const Main = () => {
  const [modalState, setModalState] = useState(false);
  const handleCloseModal = () => setModalState(false);
  const handleOpenModal = () => setModalState(true);
  return (
    <>
      <Modal showModal={modalState} closeModal={handleCloseModal} />
      <BannerSection openModal={handleOpenModal} />
      <CarsSection />
    </>
  );
};

export default Main;

</code>```

Modal component

```<code>import React from "react";

const Modal = ({ showModal, closeModal }) => {
  return (
    <>
    <ModalOuter onClick={closeModal} showModal={showModal}  />
      <ModalForm showModal={showModal}>
        <ModalIcon >
          <CloseIcon onClick={closeModal} />
        </ModalIcon>
        <ModalHeading>test</ModalHeading>
        <ModalFormItem>
          <LabelName htmlFor="name">test</LabelName>
          <ModalInput type="text"></ModalInput>
        </ModalFormItem>
        <ModalFormItem>
          <LabelName htmlFor="phone">test</LabelName>
          <ModalInput type="tel"></ModalInput>
        </ModalFormItem>
        <SubmitButton>Submit</SubmitButton>
      </ModalForm>
      </>
  );
};

export default Modal;
</code>```

How can i make my modal shown on click of the button in the CarProductDetails component?

Sorry for stupid question, i'm new to react.

Body:
Component where i want modal to be shown on click

import Modal from "../Modal/Modal";

const CarProductDetails = ({handleOpenModal) => {

    <>
    <Modal />
   <Swiper />
<button onClick={handleOpenMoodal}> Submit </button>

export default CarProductDetails;

Modal css

import styled from "styled-components";

export const ModalOuter = styled.div`

  display: ${({ showModal }) => (showModal ? "block" : "none")};
`;

export const ModalForm = styled.div`
  opacity: ${({ showModal }) => (showModal ? "1" : "0")};
  top: ${({showModal}) => (showModal ? '50%' : '-100%')};

Main page (where the function is stored and used on this page as well)

import React, { useState } from "react";

import Modal from "../components/Modal/Modal";

const Main = () => {
  const [modalState, setModalState] = useState(false);
  const handleCloseModal = () => setModalState(false);
  const handleOpenModal = () => setModalState(true);
  return (
    <>
      <Modal showModal={modalState} closeModal={handleCloseModal} />
      <BannerSection openModal={handleOpenModal} />
      <CarsSection />
    </>
  );
};

export default Main;

Modal component

import React from "react";

const Modal = ({ showModal, closeModal }) => {
  return (
    <>
    <ModalOuter onClick={closeModal} showModal={showModal}  />
      <ModalForm showModal={showModal}>
        <ModalIcon >
          <CloseIcon onClick={closeModal} />
        </ModalIcon>
        <ModalHeading>test</ModalHeading>
        <ModalFormItem>
          <LabelName htmlFor="name">test</LabelName>
          <ModalInput type="text"></ModalInput>
        </ModalFormItem>
        <ModalFormItem>
          <LabelName htmlFor="phone">test</LabelName>
          <ModalInput type="tel"></ModalInput>
        </ModalFormItem>
        <SubmitButton>Submit</SubmitButton>
      </ModalForm>
      </>
  );
};

export default Modal;

How can i make my modal shown on click of the button in the CarProductDetails component?

Sorry for stupid question, i'm new to react.


问:
Qt: get a random value in the full 32-bit range of int
In the docs, it's written:

int QRandomGenerator::bounded(int highest)

Note that this function cannot be used to obtain values in the full 32-bit range of int. Instead, use generate() and cast to int.

But generate() returns quint32.

So it looks like it's suggested to use static_cast<int>(QRandomGenerator::global()->generate()) and get a signed overflow and -- this way -- get a signed random 32bit integer. But is not a signed overflow an undefined behavior? Or do I understand anything wrong? What is a proper way to get a random int in Qt?


问:
Stop scrolling on a specific Slide when hover a section - Sliver Revolution
I made a Slider Revolution and inserted in a slide a custom html code with the form of a timeline with a scrollbar. Slider Revolution works with Mouse Wheel Navigation, but the problem is that when I'm on the timeline slide, I can't scroll inside the script, because when I scroll, it takes me to the next slide.

I would like if it is possible to stop scroll navigation only for a specific slide.

Html code scroll example: https://brandinginsports.com/bulls/#basketball_path

If I turn off the Mouse Wheel Navigation, the scroll inside the section works perfectly, you can scroll with the mouse wheel, if I activate it instead, the scroll works only by placing and pulling the scroll bar, and when I scroll with the mouse wheel, it goes to next slide.

Html:

```<code><div class="scroll">
Lorem ipsum dolor sit amet consectetur adipiscing elit imperdiet dictum nullam, pretium posuere quam neque sem cursus torquent sapien in inceptos, proin erat hac mollis odio natoque placerat nibh senectus.
<br><br>
Lorem ipsum dolor sit amet consectetur adipiscing elit imperdiet dictum nullam, pretium posuere quam neque sem cursus torquent sapien in inceptos, proin erat hac mollis odio natoque placerat nibh senectus.
<br><br>
Lorem ipsum dolor sit amet consectetur adipiscing elit imperdiet dictum nullam, pretium posuere quam neque sem cursus torquent sapien in inceptos, proin erat hac mollis odio natoque placerat nibh senectus.
</div>
</code>```

Css:

```<code>.vertical-scrollable>.row {
            position: absolute;
            top: 120px;
            bottom: 100px;
            left: 180px;
            width: 50%;
            overflow-y: scroll;
        }
        .col-sm-8 {
            color: white;
            font-size: 24px;
            padding-bottom: 20px;
            padding-top: 18px;
        }
        .col-sm-8:nth-child(2n+1) {
            background: green;
        }
        .col-sm-8:nth-child(2n+2) {
            background: black;
        }

      div.scroll {
        background-color: rgba(0,0,0,0.0);
        width: 100%;
        height: 400px;
        overflow-x: hidden;
        overflow-y: auto;
        text-align: center;
        padding: 20px;
      }

/* width */
::-webkit-scrollbar {
  width: 6px;
}

/* Track */
::-webkit-scrollbar-track {
  background: #FFFFFF;

}

/* Handle */
::-webkit-scrollbar-thumb {
  background: #555;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: #555;
}
</code>```

Body:
I made a Slider Revolution and inserted in a slide a custom html code with the form of a timeline with a scrollbar. Slider Revolution works with Mouse Wheel Navigation, but the problem is that when I'm on the timeline slide, I can't scroll inside the script, because when I scroll, it takes me to the next slide.

I would like if it is possible to stop scroll navigation only for a specific slide.

Html code scroll example: https://brandinginsports.com/bulls/#basketball_path

If I turn off the Mouse Wheel Navigation, the scroll inside the section works perfectly, you can scroll with the mouse wheel, if I activate it instead, the scroll works only by placing and pulling the scroll bar, and when I scroll with the mouse wheel, it goes to next slide.

Html:

Lorem ipsum dolor sit amet consectetur adipiscing elit imperdiet dictum nullam, pretium posuere quam neque sem cursus torquent sapien in inceptos, proin erat hac mollis odio natoque placerat nibh senectus.

Lorem ipsum dolor sit amet consectetur adipiscing elit imperdiet dictum nullam, pretium posuere quam neque sem cursus torquent sapien in inceptos, proin erat hac mollis odio natoque placerat nibh senectus.

Lorem ipsum dolor sit amet consectetur adipiscing elit imperdiet dictum nullam, pretium posuere quam neque sem cursus torquent sapien in inceptos, proin erat hac mollis odio natoque placerat nibh senectus.

Css:

.vertical-scrollable>.row {
            position: absolute;
            top: 120px;
            bottom: 100px;
            left: 180px;
            width: 50%;
            overflow-y: scroll;
        }
        .col-sm-8 {
            color: white;
            font-size: 24px;
            padding-bottom: 20px;
            padding-top: 18px;
        }
        .col-sm-8:nth-child(2n+1) {
            background: green;
        }
        .col-sm-8:nth-child(2n+2) {
            background: black;
        }

      div.scroll {
        background-color: rgba(0,0,0,0.0);
        width: 100%;
        height: 400px;
        overflow-x: hidden;
        overflow-y: auto;
        text-align: center;
        padding: 20px;
      }

/* width */
::-webkit-scrollbar {
  width: 6px;
}

/* Track */
::-webkit-scrollbar-track {
  background: #FFFFFF;

}

/* Handle */
::-webkit-scrollbar-thumb {
  background: #555;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: #555;
}


问:
What is the reason that DynamicResource cannot be used in theme templates for Win 10?
The question is not so much because of practical necessity, but because of the desire to understand the intricacies.

In Win 7 it was possible to override keys used in theme item templates.

As far as I understand, this was due to the fact that such templates were possible in the topics:

    <SolidColorBrush x:Key="SomeControl.Background">Red</SolidColorBrush>

```
<p>In Win 10, DynamicResource will no longer be able to find the resource specified in the template. Therefore it is necessary to set StaticResource.<br />
Because of this, the solutions used in Win 7 will not work in Win 10.</p>
<pre class="lang-xml prettyprint-override"><code>    <ns:SomeControl>
        <ns:SomeControl.Resources>
            <SolidColorBrush x:Key="SomeControl.Background">Green</SolidColorBrush>
        </ns:SomeControl.Resources>
    </ns:SomeControl>
</code>```

I'm wondering what caused it, what changed in the system, that it stopped working?

Supplementing the question in connection with @BionicCode
comment.

XAML of an example using DynamicResource in a theme template:

    <UniformGrid Columns="1" >
        <ns:SomeControl/>
        <ns:SomeControl>
            <ns:SomeControl.Resources>
                <SolidColorBrush x:Key="SomeControl.Background">Green</SolidColorBrush>
            </ns:SomeControl.Resources>
        </ns:SomeControl>
    </UniformGrid>
```

The example runs on OS Win 10 and Visual Studio 2022 with all the latest updates at the moment.

Window after launch:

At the moment, I do not have a computer with Win7 available, so I cannot clearly demonstrate the execution of the same XAML.

But if someone runs the same example on Win 7, they will get this result:

Body:
The question is not so much because of practical necessity, but because of the desire to understand the intricacies.

In Win 7 it was possible to override keys used in theme item templates.

As far as I understand, this was due to the fact that such templates were possible in the topics:

    <SolidColorBrush x:Key="SomeControl.Background">Red</SolidColorBrush>

In Win 10, DynamicResource will no longer be able to find the resource specified in the template. Therefore it is necessary to set StaticResource.

Because of this, the solutions used in Win 7 will not work in Win 10.

    <ns:SomeControl>
        <ns:SomeControl.Resources>
            <SolidColorBrush x:Key="SomeControl.Background">Green</SolidColorBrush>
        </ns:SomeControl.Resources>
    </ns:SomeControl>

I'm wondering what caused it, what changed in the system, that it stopped working?

Supplementing the question in connection with @BionicCode
comment.

XAML of an example using DynamicResource in a theme template:

    <UniformGrid Columns="1" >
        <ns:SomeControl/>
        <ns:SomeControl>
            <ns:SomeControl.Resources>
                <SolidColorBrush x:Key="SomeControl.Background">Green</SolidColorBrush>
            </ns:SomeControl.Resources>
        </ns:SomeControl>
    </UniformGrid>

The example runs on OS Win 10 and Visual Studio 2022 with all the latest updates at the moment.

Window after launch:

At the moment, I do not have a computer with Win7 available, so I cannot clearly demonstrate the execution of the same XAML.

But if someone runs the same example on Win 7, they will get this result:


问:
loss flared up during training and then returned to normal，Is it normal?
I was doing a binary semantic segmentation. There were 900 pictures for training. During the training, the training loss (red line) suddenly increased, and the iou (blue line) of the divided part suddenly decreased to 0. What's the reason?
In addition, red line - training set loss, green line - verification set loss, blue line segmentation part iou, orange line -miou. I'm using the official code for pytorch deeplabv3+

My data set was converted from remote sensing images to jpg. At first, I thought it was the problem of image color, so I enhanced the image to reduce some color errors as much as possible.But the result is still the same.enter image description here


问:
when deleting flutter_slidable ListTile, next tile is outdented
I have a list of tiles. When I drag a tile to the left and tap delete, it will be deleted. However, the tile following the deleted becomes outdented (moved left). The deleted and the the edit button are not visible. When I further drag the outdented tile to the left, the buttons become visible as if the tile would not have been outdented. In other words, I have the right hand border of the tile 1cm away from the right screen border and if I drag it left, the buttons become slowly visible in the area between right tile border and right screen border.

I am using flutter_slidable: ^2.0.0

class _PropertiesListViewState extends State<PropertiesListView> {
  @override
  Widget build(BuildContext context) {
    final List<PropertiesListViewmodel> properties =
      context.select((PropertiesListBloc bloc)
        => bloc.state.propertiesList);

    return Scaffold(
      appBar: AppBar(
        title: Text('Properties List'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          children: [
            properties.length == 0
            ? Text('Add a property with the button below')
            : Expanded(
                child: SlidableAutoCloseBehavior(
                  child: ListView.builder(
                    itemCount: properties.length,
                    itemBuilder: (context, i) {
                      return PropertiesListCard(properties[i], ValueKey(i));
                  },))),
          ]),
        ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => Navigator.of(context).push(PropertyEditPage.route()),
        backgroundColor: Colors.blue,
        child: const Icon(Icons.add),
      ),
    );
  }
}
```
<pre class="lang-dart prettyprint-override"><code>class PropertiesListCard extends StatelessWidget{
  PropertiesListCard(this.prop, this.key);
  final PropertiesListViewmodel prop;
  final ValueKey key;

  @override
  Widget build(BuildContext context) {
    PropertiesListBloc bloc = context.read<PropertiesListBloc>();
    return Slidable(
      key: key,
      groupTag: '0',
      endActionPane: ActionPane(
        motion: BehindMotion(),
        children: [
          SlidableAction(
            onPressed:  (context) => bloc
                .add(PropertiesListPropertySelected(prop.propertyId)),
            backgroundColor: Color(0xFF7BC043),
            foregroundColor: Colors.white,
            icon: Icons.edit,
            label: 'Edit',
          ),
          SlidableAction(
            onPressed: (context) => bloc
                .add(PropertiesListPropertyDeleted(prop.propertyId)),
            backgroundColor: Colors.red,
            foregroundColor: Colors.white,
            icon: Icons.delete,
            label: 'Delete',
          ),
        ],
      ),
      child: ListTile(
        title: Text('title'),
      ),
    );
  }
}
</code>```

Body:
I have a list of tiles. When I drag a tile to the left and tap delete, it will be deleted. However, the tile following the deleted becomes outdented (moved left). The deleted and the the edit button are not visible. When I further drag the outdented tile to the left, the buttons become visible as if the tile would not have been outdented. In other words, I have the right hand border of the tile 1cm away from the right screen border and if I drag it left, the buttons become slowly visible in the area between right tile border and right screen border.

I am using flutter_slidable: ^2.0.0

class _PropertiesListViewState extends State<PropertiesListView> {
  @override
  Widget build(BuildContext context) {
    final List<PropertiesListViewmodel> properties =
      context.select((PropertiesListBloc bloc)
        => bloc.state.propertiesList);

    return Scaffold(
      appBar: AppBar(
        title: Text('Properties List'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          children: [
            properties.length == 0
            ? Text('Add a property with the button below')
            : Expanded(
                child: SlidableAutoCloseBehavior(
                  child: ListView.builder(
                    itemCount: properties.length,
                    itemBuilder: (context, i) {
                      return PropertiesListCard(properties[i], ValueKey(i));
                  },))),
          ]),
        ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => Navigator.of(context).push(PropertyEditPage.route()),
        backgroundColor: Colors.blue,
        child: const Icon(Icons.add),
      ),
    );
  }
}

class PropertiesListCard extends StatelessWidget{
  PropertiesListCard(this.prop, this.key);
  final PropertiesListViewmodel prop;
  final ValueKey key;

  @override
  Widget build(BuildContext context) {
    PropertiesListBloc bloc = context.read<PropertiesListBloc>();
    return Slidable(
      key: key,
      groupTag: '0',
      endActionPane: ActionPane(
        motion: BehindMotion(),
        children: [
          SlidableAction(
            onPressed:  (context) => bloc
                .add(PropertiesListPropertySelected(prop.propertyId)),
            backgroundColor: Color(0xFF7BC043),
            foregroundColor: Colors.white,
            icon: Icons.edit,
            label: 'Edit',
          ),
          SlidableAction(
            onPressed: (context) => bloc
                .add(PropertiesListPropertyDeleted(prop.propertyId)),
            backgroundColor: Colors.red,
            foregroundColor: Colors.white,
            icon: Icons.delete,
            label: 'Delete',
          ),
        ],
      ),
      child: ListTile(
        title: Text('title'),
      ),
    );
  }
}