问:
Push fields if record is matching in group aggregation in MongoDB
I have these "$group" parameters in the aggregation query :

{
 _id: {
    user_uuid: "$actor.user.uuid",

    date_string: {
        $dateToString: {
            format: "%Y-%m-%d",
            date: {
                $toDate: "$time",
            },
            timezone: "America/New_York",
        },
    },

  },

  exit_time: {$max: "$time"},
  entry_time: {$min: "$time"},

  records: {
      $push: {
          time: "$time",
          user_name: "$actor.user.name",
          email: "$actor.user.email",
          door:"$door.name",
          //entry_door:{$cond: { if: { $eq: [ "$entry_time", "$time" ] }, then: "$door.name", else: "$$REMOVE" }},
          //exit_door:{$cond: { if: { $eq: [ "$exit_time", "$time" ] }, then: "$door.name", else: "$$REMOVE" }},

      },
  }

}
```
<p>and this is my sample document :</p>
<pre class="lang-json prettyprint-override"><code>{

  "time": {
    "$date": {
      "$numberLong": "1654061180000"
    }
  },

  "actor": {
    "type": "USER",
    "user": {
      "uuid": "6fff0a80-8409-4008-9850-9ec8fb8431ee",
      "name": "firstname lastname",
      "email": "firstname.lastname@example.com",
      "department": "Sales",
      "employee_number": null,
      "cost_center": "USA",
      "role": "ADMIN",

    }
  },

  "door": {
    "uuid": "42ac456e-df9b-4146-afb7-619dd584a524",
    "name": "Door Plaza Parking entry 2",
    "is_elevator_door": false,
    "elevator_door_type": null,
    "is_door_force_masked": true,
    "is_door_held_masked": true,
    "is_door_force_seen": false,
    "is_temperature_screening": false
  },

}
</code>```

For your understanding this is related to access control. We need to track the attendance according to who is coming and going from the door so for that particular user on that date if user is making first entrance from the door then this is entry time and last exit is exit time.

I am first matching the records and then grouping it as per above query. I want the data of the users on that particular date to track the attendance after calculating the entry and exit time. Till here I am on track and query is fine but with this I also want which is the door from which user entered and which one is the door from which the user took exit because a lot of doors are there but we need to take only entry and exit door.

I was trying the method like at the time of calculating the max and min time I can store the door information at that time but I am not able to figure out what to do. I have commented out the entry and exit door condition because it is not correct.

Please help me out in this.

Let me know if more details are required.

Thanks

Body:
I have these "$group" parameters in the aggregation query :

{
 _id: {
    user_uuid: "$actor.user.uuid",

    date_string: {
        $dateToString: {
            format: "%Y-%m-%d",
            date: {
                $toDate: "$time",
            },
            timezone: "America/New_York",
        },
    },

  },

  exit_time: {$max: "$time"},
  entry_time: {$min: "$time"},

  records: {
      $push: {
          time: "$time",
          user_name: "$actor.user.name",
          email: "$actor.user.email",
          door:"$door.name",
          //entry_door:{$cond: { if: { $eq: [ "$entry_time", "$time" ] }, then: "$door.name", else: "$$REMOVE" }},
          //exit_door:{$cond: { if: { $eq: [ "$exit_time", "$time" ] }, then: "$door.name", else: "$$REMOVE" }},

      },
  }

}

and this is my sample document :

{

  "time": {
    "$date": {
      "$numberLong": "1654061180000"
    }
  },

  "actor": {
    "type": "USER",
    "user": {
      "uuid": "6fff0a80-8409-4008-9850-9ec8fb8431ee",
      "name": "firstname lastname",
      "email": "firstname.lastname@example.com",
      "department": "Sales",
      "employee_number": null,
      "cost_center": "USA",
      "role": "ADMIN",

    }
  },

  "door": {
    "uuid": "42ac456e-df9b-4146-afb7-619dd584a524",
    "name": "Door Plaza Parking entry 2",
    "is_elevator_door": false,
    "elevator_door_type": null,
    "is_door_force_masked": true,
    "is_door_held_masked": true,
    "is_door_force_seen": false,
    "is_temperature_screening": false
  },

}

For your understanding this is related to access control. We need to track the attendance according to who is coming and going from the door so for that particular user on that date if user is making first entrance from the door then this is entry time and last exit is exit time.

I am first matching the records and then grouping it as per above query. I want the data of the users on that particular date to track the attendance after calculating the entry and exit time. Till here I am on track and query is fine but with this I also want which is the door from which user entered and which one is the door from which the user took exit because a lot of doors are there but we need to take only entry and exit door.

I was trying the method like at the time of calculating the max and min time I can store the door information at that time but I am not able to figure out what to do. I have commented out the entry and exit door condition because it is not correct.

Please help me out in this.

Let me know if more details are required.

Thanks


来源: stackexchange

问:
Getting Unable to load class 'org.gradle.initialization.BuildCancellationToken' error
My project was running good but suddenly getting this error

Unable to load class 'org.gradle.initialization.BuildCancellationToken'.

This is an unexpected error. Please file a bug containing the idea.log file.

I have re installed the Android Studio but still getting this error

ContentLicense: CC BY-SA 4.0


问:
CORS policy blocks DELETE request despite allowing all methods in web.config
I have C# WebAPI and an Angular front end application. All the http requests work well in the dev environment, but deploying both server and UI on IIS was having issues with the CORS policy restrictions.

I was able to read through some material and modify my code to allow the communication. So I am allowing all headers and methods using the IIS CORS module, in my web.config file deployed on IIS here is the relevant code that i put :

```<code>    <system.webServer>
    <cors enabled="true">
      <add origin="*">
        <allowHeaders allowAllRequestedHeaders="true" />
        <allowMethods>
            <add method="GET" />
            <add method="HEAD" />
            <add method="POST" />
            <add method="PUT" />
            <add method="DELETE" />
        </allowMethods>
        <exposeHeaders>
            <add header="header1" />
            <add header="header2" />
        </exposeHeaders>
      </add>
    </cors>

</system.webServer>
</code>```

So now my GET and POST requests work as expected but my DELETE requests keep getting the same error :

```<code>Failed to load resource: the server responded with a status of 405 (Method Not Allowed
</code>```

Could it be because of a missing configuration or is it anything to do with the actual delete request, which is sending an email address at the end of the delete request (e.g. in the above example, I'm sending an email : NewReq@NewReq.com)?

Can someone please help me figure this out?

Body:
I have C# WebAPI and an Angular front end application. All the http requests work well in the dev environment, but deploying both server and UI on IIS was having issues with the CORS policy restrictions.

I was able to read through some material and modify my code to allow the communication. So I am allowing all headers and methods using the IIS CORS module, in my web.config file deployed on IIS here is the relevant code that i put :

    <system.webServer>
    <cors enabled="true">
      <add origin="*">
        <allowHeaders allowAllRequestedHeaders="true" />
        <allowMethods>
            <add method="GET" />
            <add method="HEAD" />
            <add method="POST" />
            <add method="PUT" />
            <add method="DELETE" />
        </allowMethods>
        <exposeHeaders>
            <add header="header1" />
            <add header="header2" />
        </exposeHeaders>
      </add>
    </cors>

</system.webServer>

So now my GET and POST requests work as expected but my DELETE requests keep getting the same error :

Failed to load resource: the server responded with a status of 405 (Method Not Allowed

Could it be because of a missing configuration or is it anything to do with the actual delete request, which is sending an email address at the end of the delete request (e.g. in the above example, I'm sending an email : NewReq@NewReq.com)?

Can someone please help me figure this out?


问:
Using PyPXE with dhcp-proxy
I'm trying to setup a simple PXE server using PyPXE in DHCP-Proxy mode, but I keep getting server response timeout from when I try to netboot

Does anyone have experience setting up and using PyPXE in DHCP-Proxy mode?

Here is the debug output

```<code>2022-12-05 07:04:43,940 [INFO] PyPXE Starting TFTP server...
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP NOTICE: TFTP server started in debug mode. TFTP server is using the following:
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP Server IP: 10.2.230.2
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP Server Port: 69
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP Network Boot Directory: netboot
2022-12-05 07:04:43,941 [INFO] PyPXE Starting DHCP server in ProxyDHCP mode...
2022-12-05 07:04:43,941 [DEBUG] PyPXE.DHCP NOTICE: DHCP server started in debug mode. DHCP server is using the following:
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP DHCP Server IP: 10.2.230.2
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP DHCP Server Port: 67
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP File Server IP: 10.2.230.5
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP File Name: http://10.2.230.5/boot.http.ipxe
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP ProxyDHCP Mode: True
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP Using iPXE: True
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP Using HTTP Server: True
2022-12-05 07:04:43,942 [INFO] PyPXE Starting HTTP server...
2022-12-05 07:04:43,942 [DEBUG] PyPXE.HTTP NOTICE: HTTP server started in debug mode. HTTP server is using the following:
2022-12-05 07:04:43,942 [INFO] PyPXE.HTTP Server IP: 10.2.230.5
2022-12-05 07:04:43,942 [INFO] PyPXE.HTTP Server Port: 80
2022-12-05 07:04:43,942 [INFO] PyPXE.HTTP Network Boot Directory: netboot
2022-12-05 07:04:43,942 [INFO] PyPXE PyPXE successfully initialized and running!
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP Received message
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--BEGIN MESSAGE-->
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP b'\x01\x01\x06\x00\xb0pL\xe8\x00\x04\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xbf\x01:H\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x019\x02\x05\xc07#\x01\x02\x03\x04\x05\x06\x0c\r\x0f\x11\x12\x16\x17\x1c()*+236:;<BCa\x80\x81\x82\x83\x84\x85\x86\x87a\x11\x00\xa2O\xc5\x00\xbcZ\x11\xe7\x90n\x00\x17\xa4@5b^\x03\x01\x03\x10]\x02\x00\x07< PXEClient:Arch:00007:UNDI:003016\xff'
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--END MESSAGE-->
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP Parsed received options
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--BEGIN OPTIONS-->
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP {53: [b'\x01'], 57: [b'\x05\xc0'], 55: [b'\x01\x02\x03\x04\x05\x06\x0c\r\x0f\x11\x12\x16\x17\x1c()*+236:;<BCa\x80\x81\x82\x83\x84\x85\x86\x87'], 97: [b'\x00\xa2O\xc5\x00\xbcZ\x11\xe7\x90n\x00\x17\xa4@5b'], 94: [b'\x01\x03\x10'], 93: [b'\x00\x07'], 60: [b'PXEClient:Arch:00007:UNDI:003016']}
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--END OPTIONS-->
2022-12-05 07:04:44,539 [INFO] PyPXE.DHCP PXE client request received from A4:BF:01:3A:48:C4
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP Sending DHCPOFFER to A4:BF:01:3A:48:C4
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP DHCPOFFER - Sending the following
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--BEGIN HEADER-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP b'\x02\x01\x06\x00\xb0pL\xe8\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x02\xe6\x05\x00\x00\x00\x00\xa4\xbf\x01:H\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00http://10.2.230.5/boot.http.ipxe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc'
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--END HEADER-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--BEGIN OPTIONS-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP b'5\x01\x026\x04\n\x02\xe6\x02B\n10.2.230.5C\x0fchainload.kpxe\x00<\tPXEClient+\n\x06\x01\x08\n\x04\x00PXE\xff\xff'
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--END OPTIONS-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--BEGIN RESPONSE-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP b'\x02\x01\x06\x00\xb0pL\xe8\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x02\xe6\x05\x00\x00\x00\x00\xa4\xbf\x01:H\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00http://10.2.230.5/boot.http.ipxe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x026\x04\n\x02\xe6\x02B\n10.2.230.5C\x0fchainload.kpxe\x00<\tPXEClient+\n\x06\x01\x08\n\x04\x00PXE\xff\xff'
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--END RESPONSE-->
</code>```

Title: Using PyPXE with dhcp-proxy

Body:
I'm trying to setup a simple PXE server using PyPXE in DHCP-Proxy mode, but I keep getting server response timeout from when I try to netboot

Does anyone have experience setting up and using PyPXE in DHCP-Proxy mode?

Here is the debug output

2022-12-05 07:04:43,940 [INFO] PyPXE Starting TFTP server...
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP NOTICE: TFTP server started in debug mode. TFTP server is using the following:
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP Server IP: 10.2.230.2
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP Server Port: 69
2022-12-05 07:04:43,941 [DEBUG] PyPXE.TFTP Network Boot Directory: netboot
2022-12-05 07:04:43,941 [INFO] PyPXE Starting DHCP server in ProxyDHCP mode...
2022-12-05 07:04:43,941 [DEBUG] PyPXE.DHCP NOTICE: DHCP server started in debug mode. DHCP server is using the following:
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP DHCP Server IP: 10.2.230.2
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP DHCP Server Port: 67
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP File Server IP: 10.2.230.5
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP File Name: http://10.2.230.5/boot.http.ipxe
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP ProxyDHCP Mode: True
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP Using iPXE: True
2022-12-05 07:04:43,941 [INFO] PyPXE.DHCP Using HTTP Server: True
2022-12-05 07:04:43,942 [INFO] PyPXE Starting HTTP server...
2022-12-05 07:04:43,942 [DEBUG] PyPXE.HTTP NOTICE: HTTP server started in debug mode. HTTP server is using the following:
2022-12-05 07:04:43,942 [INFO] PyPXE.HTTP Server IP: 10.2.230.5
2022-12-05 07:04:43,942 [INFO] PyPXE.HTTP Server Port: 80
2022-12-05 07:04:43,942 [INFO] PyPXE.HTTP Network Boot Directory: netboot
2022-12-05 07:04:43,942 [INFO] PyPXE PyPXE successfully initialized and running!
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP Received message
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--BEGIN MESSAGE-->
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP b'\x01\x01\x06\x00\xb0pL\xe8\x00\x04\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xbf\x01:H\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x019\x02\x05\xc07#\x01\x02\x03\x04\x05\x06\x0c\r\x0f\x11\x12\x16\x17\x1c()*+236:;<BCa\x80\x81\x82\x83\x84\x85\x86\x87a\x11\x00\xa2O\xc5\x00\xbcZ\x11\xe7\x90n\x00\x17\xa4@5b^\x03\x01\x03\x10]\x02\x00\x07< PXEClient:Arch:00007:UNDI:003016\xff'
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--END MESSAGE-->
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP Parsed received options
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--BEGIN OPTIONS-->
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP {53: [b'\x01'], 57: [b'\x05\xc0'], 55: [b'\x01\x02\x03\x04\x05\x06\x0c\r\x0f\x11\x12\x16\x17\x1c()*+236:;<BCa\x80\x81\x82\x83\x84\x85\x86\x87'], 97: [b'\x00\xa2O\xc5\x00\xbcZ\x11\xe7\x90n\x00\x17\xa4@5b'], 94: [b'\x01\x03\x10'], 93: [b'\x00\x07'], 60: [b'PXEClient:Arch:00007:UNDI:003016']}
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--END OPTIONS-->
2022-12-05 07:04:44,539 [INFO] PyPXE.DHCP PXE client request received from A4:BF:01:3A:48:C4
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP Sending DHCPOFFER to A4:BF:01:3A:48:C4
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP DHCPOFFER - Sending the following
2022-12-05 07:04:44,539 [DEBUG] PyPXE.DHCP <--BEGIN HEADER-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP b'\x02\x01\x06\x00\xb0pL\xe8\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x02\xe6\x05\x00\x00\x00\x00\xa4\xbf\x01:H\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00http://10.2.230.5/boot.http.ipxe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc'
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--END HEADER-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--BEGIN OPTIONS-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP b'5\x01\x026\x04\n\x02\xe6\x02B\n10.2.230.5C\x0fchainload.kpxe\x00<\tPXEClient+\n\x06\x01\x08\n\x04\x00PXE\xff\xff'
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--END OPTIONS-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--BEGIN RESPONSE-->
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP b'\x02\x01\x06\x00\xb0pL\xe8\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x02\xe6\x05\x00\x00\x00\x00\xa4\xbf\x01:H\xc4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00http://10.2.230.5/boot.http.ipxe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x026\x04\n\x02\xe6\x02B\n10.2.230.5C\x0fchainload.kpxe\x00<\tPXEClient+\n\x06\x01\x08\n\x04\x00PXE\xff\xff'
2022-12-05 07:04:44,540 [DEBUG] PyPXE.DHCP <--END RESPONSE-->


问:
ASP.NET Core 6 MVC and Entity Framework Core 7.0 - can't connect to Sqlite
I just upgraded from EF 6 -> EF Core 7 in my ASP.NET Core 6 MVC app because I needed the context.Database.SqlQuery<T>() functionality; however, when I try to run any query via EF it now appears unable to connect at all when I build & run or execute migration cmds:

```<code>C:\Path\To\My\Project\Ui>dotnet ef database update --context sqliteascertodbcontext
Build started...
Build succeeded.
  Debug: Registered integration with EF Core.
</code>```

An error occurred using the connection to database 'main' on server 'C:\Path\To\My\Project\Ui\db.sqlite3'.

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: ''.

at Microsoft.Data.Sqlite.SqliteConnection.LoadExtensionCore(String file, String proc)

at Microsoft.Data.Sqlite.SqliteConnection.Open()

at     Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)

SQLite Error 1: ''.

CSProject contents:

```<code><ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.11" />
   <PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0" />
   <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
   <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
   <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
       <PrivateAssets>all</PrivateAssets>
   </PackageReference>
   <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0" />
   <PackageReference Include="Microsoft.Owin" Version="4.2.0" />
   <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.17.0" />
   <PackageReference Include="Microsoft.Owin.Security" Version="4.2.0" />
   <PackageReference Include="Microsoft.Owin.Security.OAuth" Version="4.2.0" />
   <PackageReference Include="Microsoft.Owin.Security.Jwt" Version="4.2.0" />
   <PackageReference Include="Microsoft.Identity.Web" Version="1.23.1" />
   <PackageReference Include="Sentry.AspNetCore" Version="3.22.0" />
   <PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.2" />
   <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.3" />
   <PackageReference Include="VueCliMiddleware" Version="3.1.2" />
</ItemGroup>
</code>```

Is there anything missing, or?

Body:
I just upgraded from EF 6 -> EF Core 7 in my ASP.NET Core 6 MVC app because I needed the context.Database.SqlQuery<T>() functionality; however, when I try to run any query via EF it now appears unable to connect at all when I build & run or execute migration cmds:

C:\Path\To\My\Project\Ui>dotnet ef database update --context sqliteascertodbcontext
Build started...
Build succeeded.
  Debug: Registered integration with EF Core.

An error occurred using the connection to database 'main' on server 'C:\Path\To\My\Project\Ui\db.sqlite3'.

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: ''.

at Microsoft.Data.Sqlite.SqliteConnection.LoadExtensionCore(String file, String proc)

at Microsoft.Data.Sqlite.SqliteConnection.Open()

at     Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)

SQLite Error 1: ''.

CSProject contents:

<ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.11" />
   <PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0" />
   <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
   <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
   <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
   <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
       <PrivateAssets>all</PrivateAssets>
   </PackageReference>
   <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0" />
   <PackageReference Include="Microsoft.Owin" Version="4.2.0" />
   <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.17.0" />
   <PackageReference Include="Microsoft.Owin.Security" Version="4.2.0" />
   <PackageReference Include="Microsoft.Owin.Security.OAuth" Version="4.2.0" />
   <PackageReference Include="Microsoft.Owin.Security.Jwt" Version="4.2.0" />
   <PackageReference Include="Microsoft.Identity.Web" Version="1.23.1" />
   <PackageReference Include="Sentry.AspNetCore" Version="3.22.0" />
   <PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.2" />
   <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.3" />
   <PackageReference Include="VueCliMiddleware" Version="3.1.2" />
</ItemGroup>

Is there anything missing, or?


问:
react native Task :expo-dev-launcher:compileReleaseWithDevLauncherKotlin
When I try to run my app using the command: npx react-native run-android --deviceId=xyz I get this build error related to expo-dev-client. Although, when I run using npx react-native run-android --variant=DevDebug (for android simulator) it builds and runs successfully (although all the image assets are not rendered - only white backgrounds - maybe happened due to different productFlavours set by other dev... this is another issue). Below is the error log and my environment, project info:-

Build Error:

```<code>> Task :expo-dev-launcher:compileReleaseWithDevLauncherKotlin FAILED

e: /Users/username/Desktop/project/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (17, 8): Unresolved reference: devmenu
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (18, 8): Unresolved reference: devmenu
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (47, 7): Unresolved reference: RNGestureHandlerPackage
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (48, 7): Unresolved reference: SafeAreaContextPackage
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (15, 33): Unresolved reference: rncompatibility
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (27, 37): Unresolved reference: DevLauncherDevSupportManager
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (38, 34): Unresolved reference: DevLauncherDevSupportManager
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (40, 103): Unresolved reference: DevLauncherDevSupportManager
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (15, 97): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (19, 109): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (21, 121): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (23, 101): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (25, 96): Unresolved reference: DevLauncherPackageDelegate

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo-dev-launcher:compileReleaseWithDevLauncherKotlin'.
> Compilation error. See log for more details
</code>```

package.json:

```<code>"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",
"expo": "^46.0.0",
"expo-dev-client": "~1.3.1",
</code>```

I couldn't find anything relevant related to this error on GitHub, if anyone got any ideas on solving this issue, it would be really helpful because right now I got no clue about this error.

If anyone needs any more info, please just ask and I'll provide.

Thank you!

Body:
When I try to run my app using the command: npx react-native run-android --deviceId=xyz I get this build error related to expo-dev-client. Although, when I run using npx react-native run-android --variant=DevDebug (for android simulator) it builds and runs successfully (although all the image assets are not rendered - only white backgrounds - maybe happened due to different productFlavours set by other dev... this is another issue). Below is the error log and my environment, project info:-

Build Error:

> Task :expo-dev-launcher:compileReleaseWithDevLauncherKotlin FAILED

e: /Users/username/Desktop/project/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (17, 8): Unresolved reference: devmenu
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (18, 8): Unresolved reference: devmenu
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (47, 7): Unresolved reference: RNGestureHandlerPackage
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/launcher/DevLauncherClientHost.kt: (48, 7): Unresolved reference: SafeAreaContextPackage
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (15, 33): Unresolved reference: rncompatibility
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (27, 37): Unresolved reference: DevLauncherDevSupportManager
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (38, 34): Unresolved reference: DevLauncherDevSupportManager
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/react/DevLauncherDevSupportManagerSwapper.kt: (40, 103): Unresolved reference: DevLauncherDevSupportManager
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (15, 97): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (19, 109): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (21, 121): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (23, 101): Unresolved reference: DevLauncherPackageDelegate
e: /Users/username/Desktop/project/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt: (25, 96): Unresolved reference: DevLauncherPackageDelegate

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo-dev-launcher:compileReleaseWithDevLauncherKotlin'.
> Compilation error. See log for more details

package.json:

"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",
"expo": "^46.0.0",
"expo-dev-client": "~1.3.1",

I couldn't find anything relevant related to this error on GitHub, if anyone got any ideas on solving this issue, it would be really helpful because right now I got no clue about this error.

If anyone needs any more info, please just ask and I'll provide.

Thank you!


问:
How to select HTML <title> tag using only CSS?
I was wondering if it is possible to have a CSS property that is only applied if an HTML  tag is present and with the expected value, I have a component that is rendered several times however in 1 particular case I need it to have a different margin value.

I understand I can write a JS script that does this however I was wondering if it is possible to do this using only CSS.

I tried using the :not and :where CSS selectors for this specific case however was unable to properly select this HTML  as shown below:

```<code>&:not(title[value="Phone"]) {
  .css-class & {
    margin-top: 20px;
  }
}
</code>```

Body:
I was wondering if it is possible to have a CSS property that is only applied if an HTML  tag is present and with the expected value, I have a component that is rendered several times however in 1 particular case I need it to have a different margin value.

I understand I can write a JS script that does this however I was wondering if it is possible to do this using only CSS.

I tried using the :not and :where CSS selectors for this specific case however was unable to properly select this HTML  as shown below:

&:not(title[value="Phone"]) {
  .css-class & {
    margin-top: 20px;
  }
}


问:
Calculate new values in dataframe from values from a separate dataframe with same field prefix (dplyover/dyplyr)
Hi I had asked a question earlier about calculating new sums for a column based on field name patterns in R and Tim TeaFan had gave me a solution with his dylpyover package.

Now I need to do some more calculations using a similar method but have an added complication that some of those calculations need to grab a cell value from a different dataframe but has a matching prefix to the cut_names from the dataframe being altered.

Here is the basic equation I need done, but the "{.x}_LB_SUM" and "{.x}_UB_SUM" don't live exist in the ClusterFinal dataframe but within AOIsummary, a single row dataframe with a different field structure than the ClusterFinal dataframe. I've included the first couple rows & columns of both dataframes below.

```<code>FinalALL <- ClusterFinal %>%
  mutate(
    over(cut_names("_EST$"),
         list(LB_LQ = ~ round((.("{.x}_LB")/(.("{.x}_LB_SUM"))))/(ClusterFinal$TOTPOPRACE_LB/SUM_TOTPOP_LB), digits = 2),
              UB_LQ = ~ round((.("{.x}_UB")/(.("{.x}_UB_SUM"))))/(ClusterFinal$TOTPOPRACE_UB/SUM_TOTPOP_UB), digits = 2),

    )
  )
</code>```
```<code>> dput(head(st_drop_geometry(AOIsummary[1:20])))
structure(list(TOTPOPRACE_LB_SUM = 151945, TOTPOPRACE_EST_SUM = 155886,
    TOTPOPRACE_UB_SUM = 159827, TOTPOPRACE_LB_PCT_SUM = 100,
    TOTPOPRACE_UB_PCT_SUM = 100, HSPBIPOC_LB_SUM = 25871, HSPBIPOC_EST_SUM = 28037,
    HSPBIPOC_UB_SUM = 30203, HSPBIPOC_LB_PCT_SUM = 17.0265556615881,
    HSPBIPOC_UB_PCT_SUM = 18.8973077139657, NHSPWHTALN_LB_SUM = 124238,
    NHSPWHTALN_EST_SUM = 127849, NHSPWHTALN_UB_SUM = 131460,
    NHSPWHTALN_LB_PCT_SUM = 81.7651123761888, NHSPWHTALN_UB_PCT_SUM = 82.2514343634054,
    NHSPBLKALN_LB_SUM = 805, NHSPBLKALN_EST_SUM = 1113, NHSPBLKALN_UB_SUM = 1421,
    NHSPBLKALN_LB_PCT_SUM = 0.529796966007437, NHSPBLKALN_UB_PCT_SUM = 0.889086324588461), row.names = 1L, class = "data.frame")
</code>```
```<code>> dput(head(st_drop_geometry(ClusterFinal[5:32])))
structure(list(TOTPOPRACE_EST = c(1134, 13396, 35275, 20924,
14351), TOTPOPRACE_CV = c(0.283044659944356, 0.0549543862201148,
0.0307605467404691, 0.041019248793624, 0.0462602994322089), TOTPOPRACE_SE = c(320.9726443769,
736.168957804657, 1085.07828627005, 858.286761757789, 663.88155715163
), TOTPOPRACE_SESQD = c(103023.4384383, 541944.734435195, 1177394.88733474,
736656.165408671, 440738.721926072), TOTPOPRACE_MOE = c(528,
1211, 1785, 1412, 1092), TOTPOPRACE_LB = c(606, 12185, 33490,
19512, 13259), TOTPOPRACE_UB = c(1662, 14607, 37060, 22336, 15443
), HSPBIPOC_EST = c(468, 3744, 10016, 5907, 4109), HSPBIPOC_CV = c(0.385961515530025,
0.118166392157128, 0.0833061826764167, 0.109830626279308, 0.127695904080848
), HSPBIPOC_SE = c(180.629989268052, 442.414972236288, 834.394725686989,
648.769509431874, 524.702469868202), HSPBIPOC_SESQD = c(32627.1930229765,
195731.007658835, 696214.558254266, 420901.876368474, 275312.681885792
), HSPBIPOC_MOE = c(297, 728, 1373, 1067, 863), HSPBIPOC_LB = c(171,
3016, 8643, 4840, 3246), HSPBIPOC_UB = c(765, 4472, 11389, 6974,
4972), NHSPWHTALN_EST = c(666, 9652, 25259, 15017, 10242), NHSPWHTALN_CV = c(0.411657858466369,
0.0689992419410154, 0.0363261839688132, 0.0491849956570817, 0.0531540683299724
), NHSPWHTALN_SE = c(274.164133738602, 665.98068321468, 917.563080868252,
738.611079782396, 544.403967835577), NHSPWHTALN_SESQD = c(75165.972228638,
443530.270415092, 841922.007372437, 545546.327177317, 296375.68019512
), NHSPWHTALN_MOE = c(451, 1096, 1509, 1215, 896), NHSPWHTALN_LB = c(215,
8556, 23750, 13802, 9346), NHSPWHTALN_UB = c(1117, 10748, 26768,
16232, 11138), NHSPBLKALN_EST = c(170, 180, 200, 118, 82), NHSPBLKALN_CV = c(0.557840157339532,
0.438442946192193, 0.334277417565133, 0.402329064204202, 0.574051766108857
), NHSPBLKALN_SE = c(94.8328267477204, 78.9197303145948, 66.8554835130266,
47.4748295760959, 47.0722448209263), NHSPBLKALN_SESQD = c(8993.26502896315,
6228.32383292837, 4469.65567576057, 2253.85944327935, 2215.79623248122
), NHSPBLKALN_MOE = c(156, 130, 110, 78, 77), NHSPBLKALN_LB = c(14,
50, 90, 40, 5), NHSPBLKALN_UB = c(326, 310, 310, 196, 159)), row.names = c(NA,
5L), class = "data.frame")
</code>```

So far I've tried piping to both dataframes and then doing the cut_names and I've also tried creating a new dataframe with both datasets in it as a tibble and then passing that into my FinalAll code (see below). That didn't work. I'm wondering now about finding a way to grab the cut_name and use that with grep somehow to grab the specific column I need for the calculation. Any help would be much appreciated. Thanks!

CombDF <- tibble(d = paste0("d", 1:2), data = list(as_tibble(ClusterFinal),as_tibble(AOIsummary)))

Body:
Hi I had asked a question earlier about calculating new sums for a column based on field name patterns in R and Tim TeaFan had gave me a solution with his dylpyover package.

Now I need to do some more calculations using a similar method but have an added complication that some of those calculations need to grab a cell value from a different dataframe but has a matching prefix to the cut_names from the dataframe being altered.

Here is the basic equation I need done, but the "{.x}_LB_SUM" and "{.x}_UB_SUM" don't live exist in the ClusterFinal dataframe but within AOIsummary, a single row dataframe with a different field structure than the ClusterFinal dataframe. I've included the first couple rows & columns of both dataframes below.

FinalALL <- ClusterFinal %>%
  mutate(
    over(cut_names("_EST$"),
         list(LB_LQ = ~ round((.("{.x}_LB")/(.("{.x}_LB_SUM"))))/(ClusterFinal$TOTPOPRACE_LB/SUM_TOTPOP_LB), digits = 2),
              UB_LQ = ~ round((.("{.x}_UB")/(.("{.x}_UB_SUM"))))/(ClusterFinal$TOTPOPRACE_UB/SUM_TOTPOP_UB), digits = 2),

    )
  )

> dput(head(st_drop_geometry(AOIsummary[1:20])))
structure(list(TOTPOPRACE_LB_SUM = 151945, TOTPOPRACE_EST_SUM = 155886,
    TOTPOPRACE_UB_SUM = 159827, TOTPOPRACE_LB_PCT_SUM = 100,
    TOTPOPRACE_UB_PCT_SUM = 100, HSPBIPOC_LB_SUM = 25871, HSPBIPOC_EST_SUM = 28037,
    HSPBIPOC_UB_SUM = 30203, HSPBIPOC_LB_PCT_SUM = 17.0265556615881,
    HSPBIPOC_UB_PCT_SUM = 18.8973077139657, NHSPWHTALN_LB_SUM = 124238,
    NHSPWHTALN_EST_SUM = 127849, NHSPWHTALN_UB_SUM = 131460,
    NHSPWHTALN_LB_PCT_SUM = 81.7651123761888, NHSPWHTALN_UB_PCT_SUM = 82.2514343634054,
    NHSPBLKALN_LB_SUM = 805, NHSPBLKALN_EST_SUM = 1113, NHSPBLKALN_UB_SUM = 1421,
    NHSPBLKALN_LB_PCT_SUM = 0.529796966007437, NHSPBLKALN_UB_PCT_SUM = 0.889086324588461), row.names = 1L, class = "data.frame")

> dput(head(st_drop_geometry(ClusterFinal[5:32])))
structure(list(TOTPOPRACE_EST = c(1134, 13396, 35275, 20924,
14351), TOTPOPRACE_CV = c(0.283044659944356, 0.0549543862201148,
0.0307605467404691, 0.041019248793624, 0.0462602994322089), TOTPOPRACE_SE = c(320.9726443769,
736.168957804657, 1085.07828627005, 858.286761757789, 663.88155715163
), TOTPOPRACE_SESQD = c(103023.4384383, 541944.734435195, 1177394.88733474,
736656.165408671, 440738.721926072), TOTPOPRACE_MOE = c(528,
1211, 1785, 1412, 1092), TOTPOPRACE_LB = c(606, 12185, 33490,
19512, 13259), TOTPOPRACE_UB = c(1662, 14607, 37060, 22336, 15443
), HSPBIPOC_EST = c(468, 3744, 10016, 5907, 4109), HSPBIPOC_CV = c(0.385961515530025,
0.118166392157128, 0.0833061826764167, 0.109830626279308, 0.127695904080848
), HSPBIPOC_SE = c(180.629989268052, 442.414972236288, 834.394725686989,
648.769509431874, 524.702469868202), HSPBIPOC_SESQD = c(32627.1930229765,
195731.007658835, 696214.558254266, 420901.876368474, 275312.681885792
), HSPBIPOC_MOE = c(297, 728, 1373, 1067, 863), HSPBIPOC_LB = c(171,
3016, 8643, 4840, 3246), HSPBIPOC_UB = c(765, 4472, 11389, 6974,
4972), NHSPWHTALN_EST = c(666, 9652, 25259, 15017, 10242), NHSPWHTALN_CV = c(0.411657858466369,
0.0689992419410154, 0.0363261839688132, 0.0491849956570817, 0.0531540683299724
), NHSPWHTALN_SE = c(274.164133738602, 665.98068321468, 917.563080868252,
738.611079782396, 544.403967835577), NHSPWHTALN_SESQD = c(75165.972228638,
443530.270415092, 841922.007372437, 545546.327177317, 296375.68019512
), NHSPWHTALN_MOE = c(451, 1096, 1509, 1215, 896), NHSPWHTALN_LB = c(215,
8556, 23750, 13802, 9346), NHSPWHTALN_UB = c(1117, 10748, 26768,
16232, 11138), NHSPBLKALN_EST = c(170, 180, 200, 118, 82), NHSPBLKALN_CV = c(0.557840157339532,
0.438442946192193, 0.334277417565133, 0.402329064204202, 0.574051766108857
), NHSPBLKALN_SE = c(94.8328267477204, 78.9197303145948, 66.8554835130266,
47.4748295760959, 47.0722448209263), NHSPBLKALN_SESQD = c(8993.26502896315,
6228.32383292837, 4469.65567576057, 2253.85944327935, 2215.79623248122
), NHSPBLKALN_MOE = c(156, 130, 110, 78, 77), NHSPBLKALN_LB = c(14,
50, 90, 40, 5), NHSPBLKALN_UB = c(326, 310, 310, 196, 159)), row.names = c(NA,
5L), class = "data.frame")

So far I've tried piping to both dataframes and then doing the cut_names and I've also tried creating a new dataframe with both datasets in it as a tibble and then passing that into my FinalAll code (see below). That didn't work. I'm wondering now about finding a way to grab the cut_name and use that with grep somehow to grab the specific column I need for the calculation. Any help would be much appreciated. Thanks!

CombDF <- tibble(d = paste0("d", 1:2), data = list(as_tibble(ClusterFinal),as_tibble(AOIsummary)))


问:
request to https://registry.npm.ouryahoo.com:4443/npm-registry/api/npm/npm-registry/uglify-js/-/uglify-js-3.15.1.tgz failed, reason: connect ETIMEDOUT
Given I cloned this repository:

```<code>git clone https://github.com/daquinoaldo/https-localhost.git
</code>```

When I installed it

```<code>npm i
</code>```

Then i got this error:

```<code>1622 verbose stack FetchError: request to https://registry.npm.ouryahoo.com:4443/npm-registry/api/npm/npm-registry/uglify-js/-/uglify-js-3.15.1.tgz failed, reason: connect ETIMEDOUT 13.52.144.254:4443
</code>```

But the domain "registry.npm.ouryahoo.com" sounds bogus, is this a legit domain?

Body:
Given I cloned this repository:

git clone https://github.com/daquinoaldo/https-localhost.git

When I installed it

npm i

Then i got this error:

1622 verbose stack FetchError: request to https://registry.npm.ouryahoo.com:4443/npm-registry/api/npm/npm-registry/uglify-js/-/uglify-js-3.15.1.tgz failed, reason: connect ETIMEDOUT 13.52.144.254:4443

But the domain "registry.npm.ouryahoo.com" sounds bogus, is this a legit domain?


问:
Order scope results by closest match
I have three models: Doctor, Appointment, Patient. A Doctor has many patients through appointments and a Patient has many doctors, also through appointments.

I have a search query where you can filter doctors by patients, so if you input the names of the patients it will show you any doctor that has assigned any of those patients.

Here is the scope I use to search within the Doctor model:

```<code>scope :by_patient, lambda { |*names|
    names_array = names.map { |name| "%#{name}%" }
    joins(appointments: :patient).where('lower(patients.name) LIKE ANY (array[?])', names_array)
}
</code>```

E.g.

Dr. Smith -> Patients: Karen, Joe, Kate, Mary

Dr. Johnson -> Patients: Kate, Mary

Dr. Spears -> Patients: John

If you look for Patients Kate and Mary the query will return both
Dr. Smith and Dr. Johnson, however, Dr. Smith should be shown first
because he has both patients while Dr. Johnson only has one.

How could I order the search results by those doctors who have the most patients?

Title: Order scope results by closest match

Body:
I have three models: Doctor, Appointment, Patient. A Doctor has many patients through appointments and a Patient has many doctors, also through appointments.

I have a search query where you can filter doctors by patients, so if you input the names of the patients it will show you any doctor that has assigned any of those patients.

Here is the scope I use to search within the Doctor model:

scope :by_patient, lambda { |*names|
    names_array = names.map { |name| "%#{name}%" }
    joins(appointments: :patient).where('lower(patients.name) LIKE ANY (array[?])', names_array)
}

E.g.

Dr. Smith -> Patients: Karen, Joe, Kate, Mary

Dr. Johnson -> Patients: Kate, Mary

Dr. Spears -> Patients: John

If you look for Patients Kate and Mary the query will return both
Dr. Smith and Dr. Johnson, however, Dr. Smith should be shown first
because he has both patients while Dr. Johnson only has one.

How could I order the search results by those doctors who have the most patients?


问:
Change item currency in cart Big Commerce
Using {{cart.items.0.price.currency}} in the "/cart.php" page of my store, I can see the currency of each item in my cart.

Occasionally, some of them are the wrong currency and I'd like to change them. (E.g. they're USD and I want them to be CAD)

How would I go about changing one specific cart item's currency?

I attempted to use cart APIs to modify an item, but I would need cart ID.
I looked to see how to change values retrieved using handlebars and found a bunch of solutions using helpers that didn't work for my scenario


问:
Run python code from jenkins groovy pipeline
Is there a way to run python script and code (not as a commandline) directly from a jenking Groovy pipeline?

or from inside a groovy class in a sharedLib


问:
why returned flow in room is collecting for each of my SELECT after any changes in database(INSERT,UPDATE,DELETE) MVVM
I am using flow to get data after any changes in my room database ,my app is note and it use SELECT by searching and filter by priority [High,Normal,Low]. and it has delete and update and insert too. I get flows from model and in viewModel by search and filter I Collect my data from flows and post it to my single liveData and in the last I get them in my Observer in the view
my problem is after in SELECT when I use UPDATE or INSERTT or DELETE , all of my old SELECT(search and filter) repeat in the moment. it means if I search 1000 once, and use filter to my notes 99 once; I will collect 1099 flows in the moment again and my observer in the my view will be bombing!!!

My Dao:

```<code>
@Dao
interface NoteDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun saveNote(entity : NoteEntity)

    @Delete
    suspend fun deleteNote(note : NoteEntity)

    @Update
    suspend fun updateNote(note : NoteEntity)

    @Query("SELECT * FROM $NOTE_TABLE")
    fun getAllNotes() : Flow<MutableList<NoteEntity>>

    @Query("SELECT * FROM $NOTE_TABLE WHERE id == :id")
    fun getNote(id : Int) : Flow<NoteEntity>

    @Query("SELECT * FROM $NOTE_TABLE WHERE priority == :priority")
    fun fileNote(priority : String) : Flow<MutableList<NoteEntity>>

    @Query("SELECT * FROM $NOTE_TABLE WHERE title LIKE '%' || :title || '%'")
    fun searchNote(title : String) : Flow<MutableList<NoteEntity>>

}
</code>```

My Repository:

```<code>
class MainRepository @Inject constructor(private val dao : NoteDao) {
fun getAllNotes() = dao.getAllNotes()
fun getNotesByPriority(priority : String) = dao.fileNote(priority)
fun getNotesBySearch(title : String) = dao.searchNote(title)
suspend fun deleteNote(note: NoteEntity) = dao.deleteNote(note)
}
</code>```

My ViewModel:

```<code>@HiltViewModel
class MainViewModel @Inject constructor(private val repository: MainRepository) : ViewModel() {

    val notesData = object : MutableLiveData<DataStatus<MutableList<NoteEntity>>>(){
        override fun postValue(value: DataStatus<MutableList<NoteEntity>>?) {
            super.postValue(value)
            Log.e("TAGJH", "postValue: ${value?.data?.size}")
        }
    }

    fun getAllNotes() = viewModelScope.launch {
        repository.getAllNotes().collect {
            Log.e("TAGJH", "getAll: ${it.size}")
            notesData.postValue(DataStatus.success(it, it.isEmpty()))
        }
    }

    fun getNoteByPriority(priority: String) = viewModelScope.launch {
        repository.getNotesByPriority(priority).collect {
            Log.e("TAGJH", "priority ${it.size }->$priority")
            notesData.postValue(DataStatus.success(it, it.isEmpty()))
        }
    }

    fun getNoteBySearch(characters: String) = viewModelScope.launch {
        repository.getNotesBySearch(characters).collect {
            Log.e("TAGJH", "collect: ${it.size}")
            notesData.postValue(DataStatus.success(it, it.isEmpty()))
        }
    }

    fun deleteNote(note: NoteEntity) = viewModelScope.launch {
        repository.deleteNote(note)
    }

}
</code>```

My View:

```<code>
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

    private var selectedItem: Int = 0
    private var _binding: ActivityMainBinding? = null
    private val binding get() = _binding

    @Inject
    lateinit var noteAdapter: NoteAdapter

    @Inject
    lateinit var noteEntity: NoteEntity

    private val viewModel: MainViewModel by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding?.root)

        binding?.apply {
            setSupportActionBar(notesToolbar)
            addNoteBtn.setOnClickListener {
                NoteFragment().show(supportFragmentManager, NoteFragment().tag)
            }

            viewModel.notesData.observe(this@MainActivity) {

                showEmpty(it.isEmpty)

                noteAdapter.setData(it.data!!)
                noteList.apply {
                    layoutManager =
                        StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
                    adapter = noteAdapter
                }
            }

            viewModel.getAllNotes()

            notesToolbar.setOnMenuItemClickListener {
                when (it.itemId) {
                    R.id.actionFilter -> {
                        filterByProperty()
                        return@setOnMenuItemClickListener true
                    }
                    else -> return@setOnMenuItemClickListener false
                }
            }

            deleteAndUpdateListener()

        }
    }

    private fun deleteAndUpdateListener() =
        noteAdapter.onItemClickListener { note, title ->
            when (title) {

                DELETE -> {
                    noteEntity.id = note.id
                    noteEntity.title = note.title
                    noteEntity.des = note.des
                    noteEntity.priority = note.priority
                    noteEntity.category = note.category
                    viewModel.deleteNote(noteEntity)
                }
                EDIT -> {
                    val noteFragment = NoteFragment()
                    val bundle = Bundle()
                    bundle.putInt(BUNDLE_ID, note.id)
                    noteFragment.arguments = bundle
                    noteFragment.show(supportFragmentManager, NoteFragment().tag)
                }
            }

        }

    private fun showEmpty(isShown: Boolean) {
        binding?.apply {
            if (isShown) {
                emptyShowing.visibility = View.VISIBLE
                noteList.visibility = View.GONE
            } else {
                emptyShowing.visibility = View.GONE
                noteList.visibility = View.VISIBLE
            }
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        _binding = null
    }

    override fun onCreateOptionsMenu(menu: Menu): Boolean {
        menuInflater.inflate(R.menu.menu_toolbar, menu)
        val search = menu.findItem(R.id.actionSearch)
        val searchView = search.actionView as SearchView
        searchView.queryHint = getString(R.string.search)
        searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
            override fun onQueryTextSubmit(query: String?): Boolean {
                return false
            }

            override fun onQueryTextChange(newText: String): Boolean {
                viewModel.getNoteBySearch(newText)
                Log.e("TAGJH", "searching")
                return true
            }
        })
        return super.onCreateOptionsMenu(menu)
    }

    private fun filterByProperty() {
        val builder = AlertDialog.Builder(this)
        val priories = arrayOf(ALL, HIGH, NORMAL, LOW)
        builder.setSingleChoiceItems(priories, selectedItem) { dialog, item ->
            when (item) {
                0 -> {
                    viewModel.getAllNotes()
                }
                in 1..3 -> {
                    viewModel.getNoteByPriority(priories[item])
                }
            }

            selectedItem = item
            dialog.dismiss()
        }

        val dialog: AlertDialog = builder.create()
        dialog.show()
    }

}
</code>```

I want to see my note after any update or delete or insert is updating in my last SELECT from room database

Body:
I am using flow to get data after any changes in my room database ,my app is note and it use SELECT by searching and filter by priority [High,Normal,Low]. and it has delete and update and insert too. I get flows from model and in viewModel by search and filter I Collect my data from flows and post it to my single liveData and in the last I get them in my Observer in the view
my problem is after in SELECT when I use UPDATE or INSERTT or DELETE , all of my old SELECT(search and filter) repeat in the moment. it means if I search 1000 once, and use filter to my notes 99 once; I will collect 1099 flows in the moment again and my observer in the my view will be bombing!!!

My Dao:

@Dao
interface NoteDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun saveNote(entity : NoteEntity)

    @Delete
    suspend fun deleteNote(note : NoteEntity)

    @Update
    suspend fun updateNote(note : NoteEntity)

    @Query("SELECT * FROM $NOTE_TABLE")
    fun getAllNotes() : Flow<MutableList<NoteEntity>>

    @Query("SELECT * FROM $NOTE_TABLE WHERE id == :id")
    fun getNote(id : Int) : Flow<NoteEntity>

    @Query("SELECT * FROM $NOTE_TABLE WHERE priority == :priority")
    fun fileNote(priority : String) : Flow<MutableList<NoteEntity>>

    @Query("SELECT * FROM $NOTE_TABLE WHERE title LIKE '%' || :title || '%'")
    fun searchNote(title : String) : Flow<MutableList<NoteEntity>>

}

My Repository:

class MainRepository @Inject constructor(private val dao : NoteDao) {
fun getAllNotes() = dao.getAllNotes()
fun getNotesByPriority(priority : String) = dao.fileNote(priority)
fun getNotesBySearch(title : String) = dao.searchNote(title)
suspend fun deleteNote(note: NoteEntity) = dao.deleteNote(note)
}

My ViewModel:

@HiltViewModel
class MainViewModel @Inject constructor(private val repository: MainRepository) : ViewModel() {

    val notesData = object : MutableLiveData<DataStatus<MutableList<NoteEntity>>>(){
        override fun postValue(value: DataStatus<MutableList<NoteEntity>>?) {
            super.postValue(value)
            Log.e("TAGJH", "postValue: ${value?.data?.size}")
        }
    }

    fun getAllNotes() = viewModelScope.launch {
        repository.getAllNotes().collect {
            Log.e("TAGJH", "getAll: ${it.size}")
            notesData.postValue(DataStatus.success(it, it.isEmpty()))
        }
    }

    fun getNoteByPriority(priority: String) = viewModelScope.launch {
        repository.getNotesByPriority(priority).collect {
            Log.e("TAGJH", "priority ${it.size }->$priority")
            notesData.postValue(DataStatus.success(it, it.isEmpty()))
        }
    }

    fun getNoteBySearch(characters: String) = viewModelScope.launch {
        repository.getNotesBySearch(characters).collect {
            Log.e("TAGJH", "collect: ${it.size}")
            notesData.postValue(DataStatus.success(it, it.isEmpty()))
        }
    }

    fun deleteNote(note: NoteEntity) = viewModelScope.launch {
        repository.deleteNote(note)
    }

}

My View:

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

    private var selectedItem: Int = 0
    private var _binding: ActivityMainBinding? = null
    private val binding get() = _binding

    @Inject
    lateinit var noteAdapter: NoteAdapter

    @Inject
    lateinit var noteEntity: NoteEntity

    private val viewModel: MainViewModel by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding?.root)

        binding?.apply {
            setSupportActionBar(notesToolbar)
            addNoteBtn.setOnClickListener {
                NoteFragment().show(supportFragmentManager, NoteFragment().tag)
            }

            viewModel.notesData.observe(this@MainActivity) {

                showEmpty(it.isEmpty)

                noteAdapter.setData(it.data!!)
                noteList.apply {
                    layoutManager =
                        StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
                    adapter = noteAdapter
                }
            }

            viewModel.getAllNotes()

            notesToolbar.setOnMenuItemClickListener {
                when (it.itemId) {
                    R.id.actionFilter -> {
                        filterByProperty()
                        return@setOnMenuItemClickListener true
                    }
                    else -> return@setOnMenuItemClickListener false
                }
            }

            deleteAndUpdateListener()

        }
    }

    private fun deleteAndUpdateListener() =
        noteAdapter.onItemClickListener { note, title ->
            when (title) {

                DELETE -> {
                    noteEntity.id = note.id
                    noteEntity.title = note.title
                    noteEntity.des = note.des
                    noteEntity.priority = note.priority
                    noteEntity.category = note.category
                    viewModel.deleteNote(noteEntity)
                }
                EDIT -> {
                    val noteFragment = NoteFragment()
                    val bundle = Bundle()
                    bundle.putInt(BUNDLE_ID, note.id)
                    noteFragment.arguments = bundle
                    noteFragment.show(supportFragmentManager, NoteFragment().tag)
                }
            }

        }

    private fun showEmpty(isShown: Boolean) {
        binding?.apply {
            if (isShown) {
                emptyShowing.visibility = View.VISIBLE
                noteList.visibility = View.GONE
            } else {
                emptyShowing.visibility = View.GONE
                noteList.visibility = View.VISIBLE
            }
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        _binding = null
    }

    override fun onCreateOptionsMenu(menu: Menu): Boolean {
        menuInflater.inflate(R.menu.menu_toolbar, menu)
        val search = menu.findItem(R.id.actionSearch)
        val searchView = search.actionView as SearchView
        searchView.queryHint = getString(R.string.search)
        searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
            override fun onQueryTextSubmit(query: String?): Boolean {
                return false
            }

            override fun onQueryTextChange(newText: String): Boolean {
                viewModel.getNoteBySearch(newText)
                Log.e("TAGJH", "searching")
                return true
            }
        })
        return super.onCreateOptionsMenu(menu)
    }

    private fun filterByProperty() {
        val builder = AlertDialog.Builder(this)
        val priories = arrayOf(ALL, HIGH, NORMAL, LOW)
        builder.setSingleChoiceItems(priories, selectedItem) { dialog, item ->
            when (item) {
                0 -> {
                    viewModel.getAllNotes()
                }
                in 1..3 -> {
                    viewModel.getNoteByPriority(priories[item])
                }
            }

            selectedItem = item
            dialog.dismiss()
        }

        val dialog: AlertDialog = builder.create()
        dialog.show()
    }

}

I want to see my note after any update or delete or insert is updating in my last SELECT from room database


问:
What are the responsibilities of size_allocate() in a custom container class? How does it relate to adjust_size_allocation()?
I try to create a proper container Class for Gtk in Python (MyBin in the code below). There seems to be no authoritative documentation on how to do that, only bits and pieces, which I glued together with trial and error. – There are many open questions, but let me focus on size_allocate() here:

What is the the original size_allocate() function doing? And what is my overlaid version in my container class supposed to do?

I already do 95% know that I have to replace the original method with my own by prepending “do_” to form the do_size_allocate() method (by trial and error – see code below; I could not find anything talking about all those “do_*” functions).

I found so far, that calling self.set_allocation(allocation) seems to be a good idea as is self.get_child().size_allocate(...) to give the child some working space (see code). – Any other obligations I have to fulfill? What is the original function doing additionally?

Regarding the allocation I pass down to the child: I need to adapt it (not in the code below yet). I successfully(?) used a fresh Gdk.Rectangle() on which I set x, y, width and height, but I somehow feel that it’s wrong and something with (do_)adjust_size_allocation() should be used instead. But how?

Lets look into the documentation of do_size_allocate():

This function is only used by Gtk.Container subclasses, to assign a
size and position to their child widgets. [“Only used”? Only called from? Only implemented at? Only overwritten by? – Well, I’m doing it already, but the doc wasn’t helpful in finding out how.]

In this function, the allocation may be adjusted. [How?] It will be forced to
a 1x1 minimum size [Can confirm only that get_allocation() will return a 1x1 if I don’t set anything.],and the adjust_size_allocation virtual method on
the child will be used to adjust the allocation. [What? For my own allocation? Or for the one I set on the child via ...get_child().size_allocate()? Who calls that adjust method? In which conditions is it not called before size_allocate()?] Standard adjustments
include removing the widget’s margins, and applying the widget’s
Gtk.Widget :halign and Gtk.Widget :valign properties.

```<code>#!/usr/bin/python3

import gi

gi.require_version('Gtk', '3.0')

from gi.repository import Gtk

class MyBin(Gtk.Bin):
    def __init__(self):
        super().__init__()

    def do_size_allocate(self, allocation):
        print('PARENT METHOD do_size_allocate', allocation.width)
        # if not called, `get_allocation()` in `do_draw()` will return a 1x1 rectangle
        self.set_allocation(allocation)
        # strangely required so that `do_draw()` will be called even on this class!
        self.get_child().size_allocate(allocation)

    def do_draw(self, c):
        allocation = self.get_allocation()
        print('PARENT do_draw()', allocation.width)
        self.propagate_draw(self.get_child(), c)

class MyChild(Gtk.Button):
    def __init__(self):
        super().__init__()
        self.connect('size-allocate', self.size_allocate_handler)
        self.connect('draw', self.draw_handler)

    def size_allocate_handler(self, self2, allocation):
        print('CHILD signal size-allocate', allocation.width)

    def draw_handler(self, self2, c):
        allocation = self.get_allocation()
        print('CHILD signal draw', allocation.width)

class MainWindow(Gtk.Window):
    def __init__(self):
        super().__init__(title='d2see test pattern')
        the_child = MyChild()
        my_container = MyBin()
        my_container.add(the_child)
        self.add(my_container)
        self.show_all()

if __name__ == '__main__':
    MainWindow()
    Gtk.main()
</code>```

Body:
I try to create a proper container Class for Gtk in Python (MyBin in the code below). There seems to be no authoritative documentation on how to do that, only bits and pieces, which I glued together with trial and error. – There are many open questions, but let me focus on size_allocate() here:

What is the the original size_allocate() function doing? And what is my overlaid version in my container class supposed to do?

I already do 95% know that I have to replace the original method with my own by prepending “do_” to form the do_size_allocate() method (by trial and error – see code below; I could not find anything talking about all those “do_*” functions).

I found so far, that calling self.set_allocation(allocation) seems to be a good idea as is self.get_child().size_allocate(...) to give the child some working space (see code). – Any other obligations I have to fulfill? What is the original function doing additionally?

Regarding the allocation I pass down to the child: I need to adapt it (not in the code below yet). I successfully(?) used a fresh Gdk.Rectangle() on which I set x, y, width and height, but I somehow feel that it’s wrong and something with (do_)adjust_size_allocation() should be used instead. But how?

Lets look into the documentation of do_size_allocate():

This function is only used by Gtk.Container subclasses, to assign a
size and position to their child widgets. [“Only used”? Only called from? Only implemented at? Only overwritten by? – Well, I’m doing it already, but the doc wasn’t helpful in finding out how.]

In this function, the allocation may be adjusted. [How?] It will be forced to
a 1x1 minimum size [Can confirm only that get_allocation() will return a 1x1 if I don’t set anything.],and the adjust_size_allocation virtual method on
the child will be used to adjust the allocation. [What? For my own allocation? Or for the one I set on the child via ...get_child().size_allocate()? Who calls that adjust method? In which conditions is it not called before size_allocate()?] Standard adjustments
include removing the widget’s margins, and applying the widget’s
Gtk.Widget :halign and Gtk.Widget :valign properties.

#!/usr/bin/python3

import gi

gi.require_version('Gtk', '3.0')

from gi.repository import Gtk

class MyBin(Gtk.Bin):
    def __init__(self):
        super().__init__()

    def do_size_allocate(self, allocation):
        print('PARENT METHOD do_size_allocate', allocation.width)
        # if not called, `get_allocation()` in `do_draw()` will return a 1x1 rectangle
        self.set_allocation(allocation)
        # strangely required so that `do_draw()` will be called even on this class!
        self.get_child().size_allocate(allocation)

    def do_draw(self, c):
        allocation = self.get_allocation()
        print('PARENT do_draw()', allocation.width)
        self.propagate_draw(self.get_child(), c)

class MyChild(Gtk.Button):
    def __init__(self):
        super().__init__()
        self.connect('size-allocate', self.size_allocate_handler)
        self.connect('draw', self.draw_handler)

    def size_allocate_handler(self, self2, allocation):
        print('CHILD signal size-allocate', allocation.width)

    def draw_handler(self, self2, c):
        allocation = self.get_allocation()
        print('CHILD signal draw', allocation.width)

class MainWindow(Gtk.Window):
    def __init__(self):
        super().__init__(title='d2see test pattern')
        the_child = MyChild()
        my_container = MyBin()
        my_container.add(the_child)
        self.add(my_container)
        self.show_all()

if __name__ == '__main__':
    MainWindow()
    Gtk.main()


问:
@DeclareMixin not being called on SpringBoot
I'm trying to use @DeclareMixin to add a common behavior in some classes, but I couldn't make it work.

I've created a simple example here, if you want to reproduce just run ExampleResourceTest.

My interface:

```<code>public interface ExampleInterface {
  String world();
}
</code>```

Default implementation:

```<code>public class ExampleInterfaceImpl implements ExampleInterface {
  @Override
  public String world() {
    return " world!";
  }
}
</code>```

Aspect:

```<code>@Aspect
@Component
public class ExampleAspect {

  @DeclareMixin(value = "com.example.service.* *")
  public ExampleInterface exampleInterface() {
    return new ExampleInterfaceImpl();
  }
}
</code>```

The service that should receive the ExampleInterface's behavior:

```<code>package com.example.demo.service;

@Service
@ExampleAnnotation
public class ExampleService {

  @ExampleAnnotation
  public String hello() {
    String output = "Hello";
    if (this instanceof ExampleInterface) {
      output += ((ExampleInterface) this).world();
    }
    return output;
  }

}
</code>```

The expected behavior should return "Hello world!" for the given request, but as the aspect is being ignored, it just returns "Hello".

To make sure that the @Aspect is being read, I've added an @Around and it's working as expected. I'm pretty sure I'm missing something to make @DeclareMixin works, but unfortunately I couldn't find any solution. Any help is appreciated!

Body:
I'm trying to use @DeclareMixin to add a common behavior in some classes, but I couldn't make it work.

I've created a simple example here, if you want to reproduce just run ExampleResourceTest.

My interface:

public interface ExampleInterface {
  String world();
}

Default implementation:

public class ExampleInterfaceImpl implements ExampleInterface {
  @Override
  public String world() {
    return " world!";
  }
}

Aspect:

@Aspect
@Component
public class ExampleAspect {

  @DeclareMixin(value = "com.example.service.* *")
  public ExampleInterface exampleInterface() {
    return new ExampleInterfaceImpl();
  }
}

The service that should receive the ExampleInterface's behavior:

package com.example.demo.service;

@Service
@ExampleAnnotation
public class ExampleService {

  @ExampleAnnotation
  public String hello() {
    String output = "Hello";
    if (this instanceof ExampleInterface) {
      output += ((ExampleInterface) this).world();
    }
    return output;
  }

}

The expected behavior should return "Hello world!" for the given request, but as the aspect is being ignored, it just returns "Hello".

To make sure that the @Aspect is being read, I've added an @Around and it's working as expected. I'm pretty sure I'm missing something to make @DeclareMixin works, but unfortunately I couldn't find any solution. Any help is appreciated!


问:
Pygame moving backround (downward) image not loading
i'm learning how to make a moving backround in pygame.
i learnd how to do it horizontal and trying now to do it vertical.
My problem is that my loop is not fully working , i manged to make it so the backround moves downward, but it wont make a third / fourth etc screen it just stops after 2 screens.
Thank you in advance for the help/ explenation. ^-^</p>
```<code>import sys

import pygame

pygame.init()
fps = 60
framepersec = pygame.time.Clock()

white = (255, 255, 255)

screen_width = 400
screen_height = 600

display = pygame.display.set_mode((screen_width, screen_height))
display.fill(white)
pygame.display.set_caption("Backround test")

class Backround():

    def __init__(self):
        self.bgimage = pygame.image.load("image/test.png").convert()
        self.rectbgimg = self.bgimage.get_rect()

        self.bgy1 = 0
        self.bgx1 = 0

        self.bgy2 = -self.rectbgimg.height
        self.bgx2 = 0

        self.moving_speed = 3

    def update(self):
        self.bgy1 += self.moving_speed
        self.bgy2 += self.moving_speed
        if -self.rectbgimg.height >= self.bgy1:
            self.bgy1 = self.rectbgimg.height
        if -self.rectbgimg.height >= self.bgy2:
            self.bgy2 = self.rectbgimg.height

    def render(self):
        display.blit(self.bgimage, (self.bgx1, self.bgy1))
        display.blit(self.bgimage, (self.bgx2, self.bgy2))

backround = Backround()

while True:
    framepersec.tick(fps)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    backround.update()
    backround.render()
    pygame.display.update()

</code>```

Body:
i'm learning how to make a moving backround in pygame.
i learnd how to do it horizontal and trying now to do it vertical.
My problem is that my loop is not fully working , i manged to make it so the backround moves downward, but it wont make a third / fourth etc screen it just stops after 2 screens.
Thank you in advance for the help/ explenation. ^-^

import sys

import pygame

pygame.init()
fps = 60
framepersec = pygame.time.Clock()

white = (255, 255, 255)

screen_width = 400
screen_height = 600

display = pygame.display.set_mode((screen_width, screen_height))
display.fill(white)
pygame.display.set_caption("Backround test")

class Backround():

    def __init__(self):
        self.bgimage = pygame.image.load("image/test.png").convert()
        self.rectbgimg = self.bgimage.get_rect()

        self.bgy1 = 0
        self.bgx1 = 0

        self.bgy2 = -self.rectbgimg.height
        self.bgx2 = 0

        self.moving_speed = 3

    def update(self):
        self.bgy1 += self.moving_speed
        self.bgy2 += self.moving_speed
        if -self.rectbgimg.height >= self.bgy1:
            self.bgy1 = self.rectbgimg.height
        if -self.rectbgimg.height >= self.bgy2:
            self.bgy2 = self.rectbgimg.height

    def render(self):
        display.blit(self.bgimage, (self.bgx1, self.bgy1))
        display.blit(self.bgimage, (self.bgx2, self.bgy2))

backround = Backround()

while True:
    framepersec.tick(fps)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    backround.update()
    backround.render()
    pygame.display.update()


问:
Is there a tool to highlight the features generated by tfidf in the original text?
Let's say tfidf.get_feature_names_out() gave me the following as the features: [able, some insight]

and I have the following sentence: "I am able to provide you some insight."
I want to highlight the words able and some insight to maybe an html file with those features highlighted with let's say blue color or just bold:

I am able to provide you some insight.

Is there a tool for that?


问:
How to request full access to an external directory in unity on android 11 or higher?
I have an app on Unity that should manage phone files to make some actions easier, this app works fine on android 10 and below, but on android 11-13 it just refuses to work, I'm wondering if it's possible to somehow request the ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION on click  button.

I tried adding the line <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" in the manifest but it didn't work for me.  I also tried to request this permission through a plugin written in android studio, but I also didn’t succeed, perhaps this is due to poor knowledge of java.
Hope you can help and thanks in advance.