问:
Ping from .NET service fails after update to .NET 7
I recently updated a .NET 6 application running in AWS ECS to .NET 7. The application is simply making a ping to an IP address. Here's the code:

using Core.Services.Common.Interfaces.Logging;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using System;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
using Company.Redacted.Session.Core.Configuration;

namespace Company.Redacted.Session.API.v1.HealthChecks
{
    public class RedactedAvailabilityHealthCheck : IHealthCheck
    {
        #region fields

        private readonly RedactedConfiguration _redactedConfiguration;
        private readonly ILogger<RedactedAvailabilityHealthCheck> _logger;

        private static readonly int _timeout = 3000;

        #endregion

        #region ctor
        public RedactedAvailabilityHealthCheck(RedactedConfiguration redactedConfiguration, ILogger<RedactedAvailabilityHealthCheck> logger)
        {
            _redactedConfiguration = redactedConfiguration ?? throw new ArgumentNullException(nameof(redactedConfiguration));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }

        #endregion

        public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = new CancellationToken())
        {
            Ping ping = new Ping();
            PingReply reply;
            try
            {
                reply = await ping.SendPingAsync("IpAddress", _timeout, Array.Empty<byte>());
            }
            catch (PingException pingException)
            {
                _logger.LogException(pingException, "Exception occured");
                if (pingException.InnerException != null)
                {
                    _logger.LogException(pingException.InnerException, "Inner exception");
                    _logger.Error(pingException.InnerException.Message);
                }
                return Response.Failed();
            }
            catch (Exception e)
            {
                _logger.LogException(e, "Exception occured");
                return Response.Failed();
            }
            finally
            {
                ping.Dispose();
                _logger.Information("Ping disposed");
            }

            _logger.Information("Ping to {address} Status: {status}. Time: {time}ms",
                _redactedConfiguration.ServicePingAddress, reply.Status, reply.RoundtripTime);
            return reply.Status == IPStatus.Success ? HealthCheckResult.Healthy() : HealthCheckResult.Unhealthy();
        }
    }
}
```
<p>It works a couple of times and then SendPingAsync() always throws the following exception :</p>
```  "exceptions": [
{
  "ClassName": "System.Net.Sockets.SocketException",
  "Depth": 0,
  "HResult": -2147467259,
  "HelpURL": null,
  "Message": "Socket not connected",
  "RemoteStackIndex": 0,
  "RemoteStackTraceString": null,
  "Source": "System.Net.Sockets",
  "StackTraceString": "   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)\n   at System.Net.Sockets.Socket.get_RemoteEndPoint()\n   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\n   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)\n   at System.Net.NetworkInformation.Ping.GetRawSocket(SocketConfig socketConfig)\n   at System.Net.NetworkInformation.Ping.SendIcmpEchoRequestOverRawSocketAsync(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)\n   at System.Net.NetworkInformation.Ping.SendPingAsyncCore(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)\n   at System.Net.NetworkInformation.Ping.SendPingAsyncInternal(IPAddress address, Int32 timeout, Byte[] buffer, PingOptions options)"
}
```
<p>],</p>
<p>This code works when I try to downgrade to .NET 6.</p>
<p>Edit 15:20 2022-12-19: Here's the task definition.</p>
<pre class="lang-json prettyprint-override"><code>{
    "ipcMode": null,
    "executionRoleArn": "arn:aws:iam::redacted:role/stage-redacted-execution-role",
    "containerDefinitions": [
        {
            "dnsSearchDomains": null,
            "environmentFiles": null,
            "logConfiguration": {
                "logDriver": "awsfirelens",
                "secretOptions": null,
                "options": {
                    "RemoveKeys": "container_id,ecs_task_arn",
                    "LineFormat": "key_value",
                    "Labels": "{job=\"firelens\"}",
                    "LabelKeys": "container_name,ecs_task_definition,source,ecs_cluster",
                    "Name": "grafana-loki"
                }
            },
            "entryPoint": null,
            "portMappings": [
                {
                    "hostPort": 80,
                    "protocol": "tcp",
                    "containerPort": 80
                }
            ],
            "command": null,
            "linuxParameters": null,
            "cpu": 256,
            "environment": [
                {
                    "name": "DOTNET_ENVIRONMENT",
                    "value": "Staging"
                },
                {
                    "name": "AWS__Region",
                    "value": "eu-west-1"
                },
                {
                    "name": "ServiceName",
                    "value": "redacted"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [],
            "workingDirectory": null,
            "secrets": [],
            "dockerSecurityOptions": null,
            "memory": 512,
            "memoryReservation": null,
            "volumesFrom": [],
            "stopTimeout": null,
            "image": "redacted",
            "startTimeout": null,
            "firelensConfiguration": null,
            "dependsOn": null,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "redacted"
        },
        {
            "dnsSearchDomains": null,
            "environmentFiles": null,
            "logConfiguration": {
                "logDriver": "awslogs",
                "secretOptions": null,
                "options": {
                    "awslogs-group": "/ecs/redacted-logs-configfetcher",
                    "awslogs-region": "eu-west-1",
                    "awslogs-create-group": "true",
                    "awslogs-stream-prefix": "stage-cluster"
                }
            },
            "entryPoint": null,
            "portMappings": [],
            "command": null,
            "linuxParameters": null,
            "cpu": 8,
            "environment": [
                {
                    "name": "BUCKET",
                    "value": "stage-fluentbit-config"
                },
                {
                    "name": "BUCKET_KEY",
                    "value": "fluent-bit.conf,parsers.conf"
                },
                {
                    "name": "REGION",
                    "value": "eu-west-1"
                },
                {
                    "name": "TARGET_DIR",
                    "value": "/etc/configfetcher"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [
                {
                    "readOnly": null,
                    "containerPath": "/etc/configfetcher",
                    "sourceVolume": "config"
                }
            ],
            "workingDirectory": null,
            "secrets": [],
            "dockerSecurityOptions": null,
            "memory": 16,
            "memoryReservation": null,
            "volumesFrom": [],
            "stopTimeout": null,
            "image": "00000.dkr.ecr.eu-west-1.amazonaws.com/shared/configfetcher:1.1.0",
            "startTimeout": null,
            "firelensConfiguration": null,
            "dependsOn": null,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "redacted-logs-configfetcher"
        },
        {
            "dnsSearchDomains": null,
            "environmentFiles": null,
            "logConfiguration": {
                "logDriver": "awslogs",
                "secretOptions": null,
                "options": {
                    "awslogs-group": "/ecs/redacted-logrouter",
                    "awslogs-region": "eu-west-1",
                    "awslogs-create-group": "true",
                    "awslogs-stream-prefix": "stage-cluster"
                }
            },
            "entryPoint": null,
            "portMappings": [],
            "command": [
                "/fluent-bit/bin/fluent-bit",
                "-e",
                "/fluent-bit/bin/out_grafana_loki.so",
                "-c",
                "/etc/configfetcher/fluent-bit.conf"
            ],
            "linuxParameters": null,
            "cpu": 32,
            "environment": [
                {
                    "name": "LABELS",
                    "value": "{job=\"redacted\"}"
                },
                {
                    "name": "PARSERS_FILE",
                    "value": "/etc/configfetcher/parsers.conf"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [],
            "workingDirectory": null,
            "secrets": [
                {
                    "valueFrom": "//stage/integration/endpoint/loki",
                    "name": "LOKI_URL"
                }
            ],
            "dockerSecurityOptions": null,
            "memory": null,
            "memoryReservation": null,
            "volumesFrom": [
                {
                    "sourceContainer": "redacted-logs-configfetcher",
                    "readOnly": null
                }
            ],
            "stopTimeout": null,
            "image": "0000.dkr.ecr.eu-west-1.amazonaws.com/shared/fluent-bit-plugin-loki:2.3.0-amd64",
            "startTimeout": null,
            "firelensConfiguration": {
                "type": "fluentbit",
                "options": {
                    "enable-ecs-log-metadata": "true"
                }
            },
            "dependsOn": [
                {
                    "containerName": "redacted-logs-configfetcher",
                    "condition": "START"
                }
            ],
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": "0",
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "redacted-logrouter"
        }
    ],
    "placementConstraints": [],
    "memory": "1024",
    "taskRoleArn": "arn:aws:iam::redacted:role/stage-redacted-task-role",
    "compatibilities": [
        "EC2",
        "FARGATE"
    ],
    "taskDefinitionArn": "arn:aws:ecs:eu-west-1:redacted:task-definition/redacted:302",
    "family": "redacted",
    "requiresAttributes": [
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.execution-role-awslogs"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.ecr-auth"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.logging-driver.awsfirelens"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.task-iam-role"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.execution-role-ecr-pull"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.secrets.ssm.environment-variables"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.task-eni"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.firelens.fluentbit"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.container-ordering"
        }
    ],
    "pidMode": null,
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "networkMode": "awsvpc",
    "runtimePlatform": null,
    "cpu": "512",
    "revision": 302,
    "status": "ACTIVE",
    "inferenceAccelerators": null,
    "proxyConfiguration": null,
    "volumes": [
        {
            "fsxWindowsFileServerVolumeConfiguration": null,
            "efsVolumeConfiguration": null,
            "name": "config",
            "host": {
                "sourcePath": null
            },
            "dockerVolumeConfiguration": null
        }
    ]
}
</code>```

Thank you

Body:
I recently updated a .NET 6 application running in AWS ECS to .NET 7. The application is simply making a ping to an IP address. Here's the code:

using Core.Services.Common.Interfaces.Logging;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using System;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
using Company.Redacted.Session.Core.Configuration;

namespace Company.Redacted.Session.API.v1.HealthChecks
{
    public class RedactedAvailabilityHealthCheck : IHealthCheck
    {
        #region fields

        private readonly RedactedConfiguration _redactedConfiguration;
        private readonly ILogger<RedactedAvailabilityHealthCheck> _logger;

        private static readonly int _timeout = 3000;

        #endregion

        #region ctor
        public RedactedAvailabilityHealthCheck(RedactedConfiguration redactedConfiguration, ILogger<RedactedAvailabilityHealthCheck> logger)
        {
            _redactedConfiguration = redactedConfiguration ?? throw new ArgumentNullException(nameof(redactedConfiguration));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }

        #endregion

        public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = new CancellationToken())
        {
            Ping ping = new Ping();
            PingReply reply;
            try
            {
                reply = await ping.SendPingAsync("IpAddress", _timeout, Array.Empty<byte>());
            }
            catch (PingException pingException)
            {
                _logger.LogException(pingException, "Exception occured");
                if (pingException.InnerException != null)
                {
                    _logger.LogException(pingException.InnerException, "Inner exception");
                    _logger.Error(pingException.InnerException.Message);
                }
                return Response.Failed();
            }
            catch (Exception e)
            {
                _logger.LogException(e, "Exception occured");
                return Response.Failed();
            }
            finally
            {
                ping.Dispose();
                _logger.Information("Ping disposed");
            }

            _logger.Information("Ping to {address} Status: {status}. Time: {time}ms",
                _redactedConfiguration.ServicePingAddress, reply.Status, reply.RoundtripTime);
            return reply.Status == IPStatus.Success ? HealthCheckResult.Healthy() : HealthCheckResult.Unhealthy();
        }
    }
}

It works a couple of times and then SendPingAsync() always throws the following exception :

  "exceptions": [
{
  "ClassName": "System.Net.Sockets.SocketException",
  "Depth": 0,
  "HResult": -2147467259,
  "HelpURL": null,
  "Message": "Socket not connected",
  "RemoteStackIndex": 0,
  "RemoteStackTraceString": null,
  "Source": "System.Net.Sockets",
  "StackTraceString": "   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)\n   at System.Net.Sockets.Socket.get_RemoteEndPoint()\n   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\n   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)\n   at System.Net.NetworkInformation.Ping.GetRawSocket(SocketConfig socketConfig)\n   at System.Net.NetworkInformation.Ping.SendIcmpEchoRequestOverRawSocketAsync(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)\n   at System.Net.NetworkInformation.Ping.SendPingAsyncCore(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)\n   at System.Net.NetworkInformation.Ping.SendPingAsyncInternal(IPAddress address, Int32 timeout, Byte[] buffer, PingOptions options)"
}

],

This code works when I try to downgrade to .NET 6.

Edit 15:20 2022-12-19: Here's the task definition.

{
    "ipcMode": null,
    "executionRoleArn": "arn:aws:iam::redacted:role/stage-redacted-execution-role",
    "containerDefinitions": [
        {
            "dnsSearchDomains": null,
            "environmentFiles": null,
            "logConfiguration": {
                "logDriver": "awsfirelens",
                "secretOptions": null,
                "options": {
                    "RemoveKeys": "container_id,ecs_task_arn",
                    "LineFormat": "key_value",
                    "Labels": "{job=\"firelens\"}",
                    "LabelKeys": "container_name,ecs_task_definition,source,ecs_cluster",
                    "Name": "grafana-loki"
                }
            },
            "entryPoint": null,
            "portMappings": [
                {
                    "hostPort": 80,
                    "protocol": "tcp",
                    "containerPort": 80
                }
            ],
            "command": null,
            "linuxParameters": null,
            "cpu": 256,
            "environment": [
                {
                    "name": "DOTNET_ENVIRONMENT",
                    "value": "Staging"
                },
                {
                    "name": "AWS__Region",
                    "value": "eu-west-1"
                },
                {
                    "name": "ServiceName",
                    "value": "redacted"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [],
            "workingDirectory": null,
            "secrets": [],
            "dockerSecurityOptions": null,
            "memory": 512,
            "memoryReservation": null,
            "volumesFrom": [],
            "stopTimeout": null,
            "image": "redacted",
            "startTimeout": null,
            "firelensConfiguration": null,
            "dependsOn": null,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "redacted"
        },
        {
            "dnsSearchDomains": null,
            "environmentFiles": null,
            "logConfiguration": {
                "logDriver": "awslogs",
                "secretOptions": null,
                "options": {
                    "awslogs-group": "/ecs/redacted-logs-configfetcher",
                    "awslogs-region": "eu-west-1",
                    "awslogs-create-group": "true",
                    "awslogs-stream-prefix": "stage-cluster"
                }
            },
            "entryPoint": null,
            "portMappings": [],
            "command": null,
            "linuxParameters": null,
            "cpu": 8,
            "environment": [
                {
                    "name": "BUCKET",
                    "value": "stage-fluentbit-config"
                },
                {
                    "name": "BUCKET_KEY",
                    "value": "fluent-bit.conf,parsers.conf"
                },
                {
                    "name": "REGION",
                    "value": "eu-west-1"
                },
                {
                    "name": "TARGET_DIR",
                    "value": "/etc/configfetcher"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [
                {
                    "readOnly": null,
                    "containerPath": "/etc/configfetcher",
                    "sourceVolume": "config"
                }
            ],
            "workingDirectory": null,
            "secrets": [],
            "dockerSecurityOptions": null,
            "memory": 16,
            "memoryReservation": null,
            "volumesFrom": [],
            "stopTimeout": null,
            "image": "00000.dkr.ecr.eu-west-1.amazonaws.com/shared/configfetcher:1.1.0",
            "startTimeout": null,
            "firelensConfiguration": null,
            "dependsOn": null,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "redacted-logs-configfetcher"
        },
        {
            "dnsSearchDomains": null,
            "environmentFiles": null,
            "logConfiguration": {
                "logDriver": "awslogs",
                "secretOptions": null,
                "options": {
                    "awslogs-group": "/ecs/redacted-logrouter",
                    "awslogs-region": "eu-west-1",
                    "awslogs-create-group": "true",
                    "awslogs-stream-prefix": "stage-cluster"
                }
            },
            "entryPoint": null,
            "portMappings": [],
            "command": [
                "/fluent-bit/bin/fluent-bit",
                "-e",
                "/fluent-bit/bin/out_grafana_loki.so",
                "-c",
                "/etc/configfetcher/fluent-bit.conf"
            ],
            "linuxParameters": null,
            "cpu": 32,
            "environment": [
                {
                    "name": "LABELS",
                    "value": "{job=\"redacted\"}"
                },
                {
                    "name": "PARSERS_FILE",
                    "value": "/etc/configfetcher/parsers.conf"
                }
            ],
            "resourceRequirements": null,
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [],
            "workingDirectory": null,
            "secrets": [
                {
                    "valueFrom": "//stage/integration/endpoint/loki",
                    "name": "LOKI_URL"
                }
            ],
            "dockerSecurityOptions": null,
            "memory": null,
            "memoryReservation": null,
            "volumesFrom": [
                {
                    "sourceContainer": "redacted-logs-configfetcher",
                    "readOnly": null
                }
            ],
            "stopTimeout": null,
            "image": "0000.dkr.ecr.eu-west-1.amazonaws.com/shared/fluent-bit-plugin-loki:2.3.0-amd64",
            "startTimeout": null,
            "firelensConfiguration": {
                "type": "fluentbit",
                "options": {
                    "enable-ecs-log-metadata": "true"
                }
            },
            "dependsOn": [
                {
                    "containerName": "redacted-logs-configfetcher",
                    "condition": "START"
                }
            ],
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": "0",
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": null,
            "name": "redacted-logrouter"
        }
    ],
    "placementConstraints": [],
    "memory": "1024",
    "taskRoleArn": "arn:aws:iam::redacted:role/stage-redacted-task-role",
    "compatibilities": [
        "EC2",
        "FARGATE"
    ],
    "taskDefinitionArn": "arn:aws:ecs:eu-west-1:redacted:task-definition/redacted:302",
    "family": "redacted",
    "requiresAttributes": [
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.execution-role-awslogs"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.ecr-auth"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.logging-driver.awsfirelens"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.task-iam-role"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.execution-role-ecr-pull"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.secrets.ssm.environment-variables"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.task-eni"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.firelens.fluentbit"
        },
        {
            "targetId": null,
            "targetType": null,
            "value": null,
            "name": "ecs.capability.container-ordering"
        }
    ],
    "pidMode": null,
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "networkMode": "awsvpc",
    "runtimePlatform": null,
    "cpu": "512",
    "revision": 302,
    "status": "ACTIVE",
    "inferenceAccelerators": null,
    "proxyConfiguration": null,
    "volumes": [
        {
            "fsxWindowsFileServerVolumeConfiguration": null,
            "efsVolumeConfiguration": null,
            "name": "config",
            "host": {
                "sourcePath": null
            },
            "dockerVolumeConfiguration": null
        }
    ]
}

Thank you


来源: stackexchange

问:
How to obtain the Request URL in the headers of Google Chrome dev tool with only Python?
I'm trying to see whether it is possible to automatically acquire the media link from the website. This link is stored in the path: Network-Media-Headers-Request URL.

I tried the method using python mentioned in the last answer of: access network panel with selenium

But failed at the row of defining the "driver" with the report: "Message: Service chromedriver unexpectedly exited. Status code was: -6"

Really appreciate it if anybody could help.

ContentLicense: CC BY-SA 4.0


问:
Is it possible to remove unused CSS in JS files that Angular generates?
I have an Angular application with a lot of CSS. Most of this is written at the component level.

I know that Angular writes the CSS inside the output bundle.

Is it possible to remove unused CSS in this JS file?

After I try purgecss I found that it works only on CSS files (style.scss), but I was not able to make it work on "CSS in JS" files.


问:
How to bring back a forced locale in notifications?
Out of a sudden, my vscode started to translate the notifications (pop-ups on the bottom-right of the window), despite the UI being in English (I am French but the overall OS is in English with French as a locale for the keyboard, time format etc.). This leads to some surreal translations such as the one below for Python's black formatter

I looked in the settings for some relevant entries, but it seems that it was the default behaviour that was changed with one of the recent updates.

How can I now force the notifications to be in a specific language?


问:
SonarQube exclude whole folder except one file in it
I am trying to set up my sonar-project.properties file and faced a little problem.

I want sonar.exclusions and sonar.coverage.exclusions to exclude one folder except for one file.

```<code>folder to exclude:
  - folder a
  - folder b
  - file x
  - file y
  - file z
</code>```

Expected:
sonar.exclusions=**/<folder to exclude>/** but not **/<folder to exlude>/<file y>.type

Body:
I am trying to set up my sonar-project.properties file and faced a little problem.

I want sonar.exclusions and sonar.coverage.exclusions to exclude one folder except for one file.

folder to exclude:
  - folder a
  - folder b
  - file x
  - file y
  - file z

Expected:
sonar.exclusions=**/<folder to exclude>/** but not **/<folder to exlude>/<file y>.type


问:
Occur Fatal Error when trying to run command 'flutter create xxx;cd xxx;flutter run'
I have 'rock5b SBC' on arm64 arch, and installed 'debian11' and 'flutter'.

% uname -a

```<code>Linux rock-5b 5.10.110-34-rockchip-gca15bbe36e6c #rockchip SMP Wed Dec 7 06:54:05 UTC 2022 aarch64 GNU/Linux
</code>```

(% flutter channel stable) # already changed stable

% flutter --version

```<code>Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter
Framework • revision 135454af32 (4 days ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0
</code>```

% flutter doctor

```<code>Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.10, on Debian GNU/Linux 11 (bullseye) 5.10.110-34-rockchip-gca15bbe36e6c, locale
    ja_JP.UTF-8)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[✓] VS Code (version 1.74.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.
</code>```

% flutter create sample

% cd sample

% flutter run

```<code>Launching lib/main.dart on Linux in debug mode...
Building Linux application...
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
[FATAL:flutter/shell/gpu/gpu_surface_gl_delegate.cc(57)] Check failed: gl_version_string. The GL proc resolver's glGetString(GL_VERSION) failed
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Linux.
</code>```

hope it runs fine on linux.

Body:
I have 'rock5b SBC' on arm64 arch, and installed 'debian11' and 'flutter'.

% uname -a

Linux rock-5b 5.10.110-34-rockchip-gca15bbe36e6c #rockchip SMP Wed Dec 7 06:54:05 UTC 2022 aarch64 GNU/Linux

(% flutter channel stable) # already changed stable

% flutter --version

Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter
Framework • revision 135454af32 (4 days ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

% flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.10, on Debian GNU/Linux 11 (bullseye) 5.10.110-34-rockchip-gca15bbe36e6c, locale
    ja_JP.UTF-8)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[✓] VS Code (version 1.74.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

% flutter create sample

% cd sample

% flutter run

Launching lib/main.dart on Linux in debug mode...
Building Linux application...
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
libGL error: failed to create dri screen
libGL error: failed to load driver: rockchip
[FATAL:flutter/shell/gpu/gpu_surface_gl_delegate.cc(57)] Check failed: gl_version_string. The GL proc resolver's glGetString(GL_VERSION) failed
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
Error launching application on Linux.

hope it runs fine on linux.


问:
How to put icon above image and move it to top right using Tailwindcss
I want to make bookmark icon on top of the image using tailwind, but it seems not work for me

```<code> <div class="overflow-hidden rounded-lg h-40">
      <img src="https://i.stack.imgur.com/y9DpT.jpg" alt="placeholder" />
      <i class="fa-solid fa-heart"></i>
    </div>
</code>```

i already try like this

```<code><span class="flex absolute items-end justify-end top-2 left-2"><i class="fa-solid fa-heart"></i></span>
</code>```

and use top-2 or left-2 but the icon offside from the container and also the icon always behinde the image

here is the code pen
https://codepen.io/paresiqbal/pen/yLqLRYe

Body:
I want to make bookmark icon on top of the image using tailwind, but it seems not work for me

i already try like this

and use top-2 or left-2 but the icon offside from the container and also the icon always behinde the image

here is the code pen
https://codepen.io/paresiqbal/pen/yLqLRYe


问:
Access the cell for a free variable from the frame only
Suppose that you have a closure, e.g.,

```<code>def f():
    x = 0
    def g():
        nonlocal x
        x += 1
        print(x)
    return g
</code>```

Given g1 = f(), you can access the cell that holds the free variable of g x by looking at g1.__closure__. So far so good.

Now, let's suppose we are using the frame evaluation API to interpose at the frame when we start executing the body of g. At this point in time, we only have a FrameType; in particular, let's assume we do NOT have access to g anymore.  Is there a way to still get the cell for x?

The first most obvious place to look is f_locals. However, we find that the cell has already been dereferenced here.

```<code>def f():
    x = 0
    def g():
        r = None
        nonlocal x
        frame = inspect.currentframe()
        print(frame.f_locals)
        x += 1
        print(x)
    return g
</code>```

There do not seem to be any more fields.

If we could manually execute the LOAD_CLOSURE opcode, this would work:

```<code>import inspect
import dis
from torch._dynamo.bytecode_transformation import assemble, transform_code_object, create_instruction
import types

def f():
    x = 0
    def g():
        r = None
        nonlocal x
        frame = inspect.currentframe()
        print(frame.f_locals)
        x += 1
        print(x)
    return g

print(f().__closure__[0])
g = f()
g()

def transformations(instructions, code_options):
    instructions[:] = [create_instruction("LOAD_CLOSURE", 0), create_instruction("RETURN_VALUE")]
new_code = transform_code_object(g.__code__, transformations)
new_g = types.FunctionType(new_code, globals(), "g", None, g.__closure__)
print(new_g().cell_contents)
</code>```

Is there not any simpler way?

Body:
Suppose that you have a closure, e.g.,

def f():
    x = 0
    def g():
        nonlocal x
        x += 1
        print(x)
    return g

Given g1 = f(), you can access the cell that holds the free variable of g x by looking at g1.__closure__. So far so good.

Now, let's suppose we are using the frame evaluation API to interpose at the frame when we start executing the body of g. At this point in time, we only have a FrameType; in particular, let's assume we do NOT have access to g anymore.  Is there a way to still get the cell for x?

The first most obvious place to look is f_locals. However, we find that the cell has already been dereferenced here.

def f():
    x = 0
    def g():
        r = None
        nonlocal x
        frame = inspect.currentframe()
        print(frame.f_locals)
        x += 1
        print(x)
    return g

There do not seem to be any more fields.

If we could manually execute the LOAD_CLOSURE opcode, this would work:

import inspect
import dis
from torch._dynamo.bytecode_transformation import assemble, transform_code_object, create_instruction
import types

def f():
    x = 0
    def g():
        r = None
        nonlocal x
        frame = inspect.currentframe()
        print(frame.f_locals)
        x += 1
        print(x)
    return g

print(f().__closure__[0])
g = f()
g()

def transformations(instructions, code_options):
    instructions[:] = [create_instruction("LOAD_CLOSURE", 0), create_instruction("RETURN_VALUE")]
new_code = transform_code_object(g.__code__, transformations)
new_g = types.FunctionType(new_code, globals(), "g", None, g.__closure__)
print(new_g().cell_contents)

Is there not any simpler way?


问:
Run node.js in interactive mode in terminal like "python -i ..."?
Dumb question alert: I know that it is possible to run node.js in interactive mode like "python -i foo.py" where it runs the code in foo.py but then leaves you at the prompt ">>>" to interact, but how do I do it in node? I know it's possible bc I've done before, just can't remember how. Thank you</p>


问:
How to detect Blurry document? (file type .pdf)
A folder contain documents some of them are blur. So, manual processing needed? That's why I want to detect blurry documents..Documents are not image file. All are in PDF format.

If document is blurry it will return a string "blurry".


问:
Prestashop Axon social login facebook redirect page is not exist
Prestashop version is 1.7.8.0. I have installed Axon Soical Login plugin. It has Facebook OAuth support. So I want to use its OAuth login for the client login. I enabled it and filled in the Facebook ID and Secret, it shows up https://[www.domain.com]/module/nrtsociallogin/facebook as OAuth redirect link. I pasted it into Facebook OAuth redirect URL setting and check the URL, return failed. So I pasted it into browser, return 404.

Obviously, the error is caused by OAuth redirect page does not exist! How to fix it?


问:
Spring Boot throws EOFException when reading from Redis
I recently started to work with Redis in a Spring Boot project.
I configured Redis in Spring Boot like the following:

```<code>@Bean
public RedisTemplate<String, Long> redisTemplate() {
    var redisConfiguration = new RedisStandaloneConfiguration();
    redisConfiguration.setHostName("localhost");
    redisConfiguration.setPort(6379);
    JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(redisConfiguration);
    jedisConnectionFactory.afterPropertiesSet();
    RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(jedisConnectionFactory);
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new LongSerializer());
    redisTemplate.setEnableTransactionSupport(true);
    redisTemplate.afterPropertiesSet();
    return redisTemplate;
}
</code>```

And the code for LongSerializer is simply the following:

```<code>static class LongSerializer implements RedisSerializer<Long>{

    @Override
    public byte[] serialize(Long aLong) throws SerializationException {
        return Longs.toByteArray(aLong);
    }

    @Override
    public Long deserialize(byte[] bytes) throws SerializationException {
        return Longs.fromByteArray(bytes);
    }
}
</code>```

I read and write to Redis like the following:

```<code>public class RedisUrlOutputPort implements UrlOutputPort{

    // https://www.techgeeknext.com/spring-boot/spring-boot-redis-example
    public static final String HASH_KEY_NAME = "URL-ITEM";
    private final RedisTemplate<String, Long> redisTemplate;

    public RedisUrlOutputPort(RedisTemplate<String, Long> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @Override
    public Long incrementUrl(String url) {
        return redisTemplate.opsForHash().increment(HASH_KEY_NAME, url, 1);
    }

    @Override
    public Cursor<Map.Entry<String, Long>> findAllUrl() {
        return redisTemplate.<String, Long>opsForHash().scan(HASH_KEY_NAME, ScanOptions.scanOptions().count(300).build());
    }

    @Override
    public Long findUrl(String url) {
        return redisTemplate.<String, Long>opsForHash().get(HASH_KEY_NAME,url);
    }

    public void deleteUrl(String url){
        redisTemplate.opsForHash().delete(HASH_KEY_NAME, url);
    }
}
</code>```

When I call findUrl(String url) it throws exception, you can see the stacktrace:

```<code>org.springframework.messaging.MessageHandlingException: error occurred in message handler [bean 'getElasticSearchMessageHandler' for component 'prepareForElasticSearchFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0'; defined in: 'class path resource [com/hatef/config/AppConfig.class]'; from source: 'com.hatef.config.AppConfig.getElasticSearchMessageHandler(org.springframework.messaging.PollableChannel,com.hatef.output.UrlOutputPort)'], failedMessage=GenericMessage [payload=https://gibson.tr/test, headers={kafka_offset=3083000, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@6bd4cce5, kafka_timestampType=CREATE_TIME, kafka_receivedPartitionId=0, kafka_receivedMessageKey=aeb2b906-0d2c-a571-9953-5b12b8fb81d1, kafka_receivedTopic=si.topic, kafka_receivedTimestamp=1671437327112, kafka_groupId=si.group}]
    at org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:191)
    at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:109)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:74)
    at org.springframework.integration.endpoint.PollingConsumer.handleMessage(PollingConsumer.java:158)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.messageReceived(AbstractPollingEndpoint.java:474)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:460)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:412)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$4(AbstractPollingEndpoint.java:348)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$5(AbstractPollingEndpoint.java:341)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:96)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.data.redis.serializer.SerializationException: Cannot deserialize
    at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:84)
    at org.springframework.data.redis.core.AbstractOperations.deserializeHashValue(AbstractOperations.java:380)
    at org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:53)
    at com.hatef.output.RedisUrlOutputPort.findUrl(RedisUrlOutputPort.java:34)
    at com.hatef.handler.WindowCountMessageHandler.handleMessageInternal(WindowCountMessageHandler.java:51)
    at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:106)
    ... 18 more
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:78)
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:36)
    at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:82)
    ... 23 more
Caused by: java.io.EOFException
    at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2893)
    at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3388)
    at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:959)
    at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:397)
    at org.springframework.core.ConfigurableObjectInputStream.<init>(ConfigurableObjectInputStream.java:65)
    at org.springframework.core.ConfigurableObjectInputStream.<init>(ConfigurableObjectInputStream.java:51)
    at org.springframework.core.serializer.DefaultDeserializer.deserialize(DefaultDeserializer.java:69)
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:73)
    ... 25 more
</code>```

I wanted to know the reason and the solution for this.
If you need the source code I pushed it here. in the WindowCountMessageHandler class method handleMessageInternal I write to and read from Redis. this is just a test and don't make any sense yet.

Body:
I recently started to work with Redis in a Spring Boot project.
I configured Redis in Spring Boot like the following:

@Bean
public RedisTemplate<String, Long> redisTemplate() {
    var redisConfiguration = new RedisStandaloneConfiguration();
    redisConfiguration.setHostName("localhost");
    redisConfiguration.setPort(6379);
    JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(redisConfiguration);
    jedisConnectionFactory.afterPropertiesSet();
    RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(jedisConnectionFactory);
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new LongSerializer());
    redisTemplate.setEnableTransactionSupport(true);
    redisTemplate.afterPropertiesSet();
    return redisTemplate;
}

And the code for LongSerializer is simply the following:

static class LongSerializer implements RedisSerializer<Long>{

    @Override
    public byte[] serialize(Long aLong) throws SerializationException {
        return Longs.toByteArray(aLong);
    }

    @Override
    public Long deserialize(byte[] bytes) throws SerializationException {
        return Longs.fromByteArray(bytes);
    }
}

I read and write to Redis like the following:

public class RedisUrlOutputPort implements UrlOutputPort{

    // https://www.techgeeknext.com/spring-boot/spring-boot-redis-example
    public static final String HASH_KEY_NAME = "URL-ITEM";
    private final RedisTemplate<String, Long> redisTemplate;

    public RedisUrlOutputPort(RedisTemplate<String, Long> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @Override
    public Long incrementUrl(String url) {
        return redisTemplate.opsForHash().increment(HASH_KEY_NAME, url, 1);
    }

    @Override
    public Cursor<Map.Entry<String, Long>> findAllUrl() {
        return redisTemplate.<String, Long>opsForHash().scan(HASH_KEY_NAME, ScanOptions.scanOptions().count(300).build());
    }

    @Override
    public Long findUrl(String url) {
        return redisTemplate.<String, Long>opsForHash().get(HASH_KEY_NAME,url);
    }

    public void deleteUrl(String url){
        redisTemplate.opsForHash().delete(HASH_KEY_NAME, url);
    }
}

When I call findUrl(String url) it throws exception, you can see the stacktrace:

org.springframework.messaging.MessageHandlingException: error occurred in message handler [bean 'getElasticSearchMessageHandler' for component 'prepareForElasticSearchFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#0'; defined in: 'class path resource [com/hatef/config/AppConfig.class]'; from source: 'com.hatef.config.AppConfig.getElasticSearchMessageHandler(org.springframework.messaging.PollableChannel,com.hatef.output.UrlOutputPort)'], failedMessage=GenericMessage [payload=https://gibson.tr/test, headers={kafka_offset=3083000, kafka_consumer=org.apache.kafka.clients.consumer.KafkaConsumer@6bd4cce5, kafka_timestampType=CREATE_TIME, kafka_receivedPartitionId=0, kafka_receivedMessageKey=aeb2b906-0d2c-a571-9953-5b12b8fb81d1, kafka_receivedTopic=si.topic, kafka_receivedTimestamp=1671437327112, kafka_groupId=si.group}]
    at org.springframework.integration.support.utils.IntegrationUtils.wrapInHandlingExceptionIfNecessary(IntegrationUtils.java:191)
    at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:109)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:74)
    at org.springframework.integration.endpoint.PollingConsumer.handleMessage(PollingConsumer.java:158)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.messageReceived(AbstractPollingEndpoint.java:474)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:460)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:412)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$4(AbstractPollingEndpoint.java:348)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$5(AbstractPollingEndpoint.java:341)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:96)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.data.redis.serializer.SerializationException: Cannot deserialize
    at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:84)
    at org.springframework.data.redis.core.AbstractOperations.deserializeHashValue(AbstractOperations.java:380)
    at org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:53)
    at com.hatef.output.RedisUrlOutputPort.findUrl(RedisUrlOutputPort.java:34)
    at com.hatef.handler.WindowCountMessageHandler.handleMessageInternal(WindowCountMessageHandler.java:51)
    at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:106)
    ... 18 more
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:78)
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:36)
    at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:82)
    ... 23 more
Caused by: java.io.EOFException
    at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2893)
    at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3388)
    at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:959)
    at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:397)
    at org.springframework.core.ConfigurableObjectInputStream.<init>(ConfigurableObjectInputStream.java:65)
    at org.springframework.core.ConfigurableObjectInputStream.<init>(ConfigurableObjectInputStream.java:51)
    at org.springframework.core.serializer.DefaultDeserializer.deserialize(DefaultDeserializer.java:69)
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:73)
    ... 25 more

I wanted to know the reason and the solution for this.
If you need the source code I pushed it here. in the WindowCountMessageHandler class method handleMessageInternal I write to and read from Redis. this is just a test and don't make any sense yet.


问:
How to programmatically save wifi ssid and password on a device (Android 10 or higher)?
Does anyone know how to force WifiNetworkSpecifier to save wifi ssid and password in android system? It's a hidden network.
I am setting up my wifi connection like below.

```<code>    @RequiresApi(Build.VERSION_CODES.Q)
    private fun buildWifiNetworkSpecifier(ssid: String, password: String)=
        WifiNetworkSpecifier.Builder()
            .setIsHiddenSsid(true)
            .setSsid(ssid)
            .setWpa2Passphrase(password)
            .build()

</code>```

This only connects you to the wifi network, but does not save the password in the system. How to force save password for a specific ssid on a device?

Body:
Does anyone know how to force WifiNetworkSpecifier to save wifi ssid and password in android system? It's a hidden network.
I am setting up my wifi connection like below.

    @RequiresApi(Build.VERSION_CODES.Q)
    private fun buildWifiNetworkSpecifier(ssid: String, password: String)=
        WifiNetworkSpecifier.Builder()
            .setIsHiddenSsid(true)
            .setSsid(ssid)
            .setWpa2Passphrase(password)
            .build()

This only connects you to the wifi network, but does not save the password in the system. How to force save password for a specific ssid on a device?


问:
Flutter - break markdown into pages with different sizes
I have a blog page in my app with pagination, but as the phone font size affects it, the data comes from the backend as a single markdown and should break into pages in the app.

Also on the first page, I have the title widget and at the end of the last page should show the tags, so the pages that I want to render markdown into, has different sizes.

Currently, I'm using TextPainter to estimate the Text widget size and break the string to pages.

Here is my code generating pages:

```<code>  Future<List<Widget>> _generatePages(double blogContentHeight) async {
    final content = widget.content;

    final firstPage = genFirstPage(blogContentHeight, content);
    final otherPages = genOtherPages(blogContentHeight, content, firstPage);

    int lastPageStartIndex = firstPage.length;
    for (int i = 0; i < otherPages.length - 1; i++) {
      lastPageStartIndex += otherPages[i].length;
    }

    final lastPage =
        genLastPage(blogContentHeight, content, lastPageStartIndex);

    return genPageWidgets(firstPage, otherPages, lastPage);
  }

  String genFirstPage(double blogContentHeight, String content) {
    final headerHeight = _getHeaderHeight();
    final firstPageContentHeight = blogContentHeight - headerHeight;
    return TextSplitter()
        .getSplittedText(
            context,
            Size(MediaQuery.of(context).size.width - (horizontalPadding * 2),
                firstPageContentHeight),
            _textStyle,
            content)
        .first;
  }

  List<String> genOtherPages(
      double blogContentHeight, String content, String firstPage) {
    final otherPagesContentHeight = blogContentHeight;
    return TextSplitter().getSplittedText(
        context,
        Size(MediaQuery.of(context).size.width - (horizontalPadding * 2),
            otherPagesContentHeight),
        _textStyle,
        content.substring(firstPage.length));
  }

  List<String> genLastPage(
      double blogContentHeight, String content, int lastPageStartIndex) {
    final tagsHeight = _getTagsHeight();
    final lastPageContentHeight = blogContentHeight - tagsHeight;
    return TextSplitter().getSplittedText(
        context,
        Size(MediaQuery.of(context).size.width - (horizontalPadding * 2),
            lastPageContentHeight),
        _textStyle,
        content.substring(lastPageStartIndex));
  }

  List<Widget> genPageWidgets(
    String firstPage,
    List<String> otherPages,
    List<String> lastPage,
  ) {
    _pages.clear();

    _pages.add(Column(
      children: [
        widget.title,
        Markdown(
          data: firstPage,
        ),
      ],
    ));
    for (int i = 0; i < otherPages.length; i++) {
      if (i + 1 != otherPages.length) {
        _pages.add(Column(
          children: [
            Markdown(
              data: otherPages[i],
            ),
          ],
        ));
      } else {
        if (lastPage.length == 1) {
          _pages.add(Column(
            children: [
              Markdown(
                data: otherPages[i],
              ),
              widget.tags,
            ],
          ));
        } else {
          _pages.add(Column(
            children: [
              Markdown(
                data: otherPages[i],
              ),
            ],
          ));
          _pages.add(Column(
            children: [widget.tags],
          ));
        }
      }
    }

    return _pages;
  }
</code>```

Here is my TextSplitter:

```<code>List<String> getSplittedText(
    BuildContext context, Size pageSize, TextStyle textStyle, String text) {
  final List<String> pageTexts = [];

  final textSpan = TextSpan(text: text, style: textStyle);
  final textPainter = TextPainter(
    text: textSpan,
    textDirection: TextDirection.rtl,
    textAlign: TextAlign.justify,
  );
  textPainter.layout(
    minWidth: 0,
    maxWidth: pageSize.width,
  );

  List<LineMetrics> lines = textPainter.computeLineMetrics();
  double currentPageBottom = pageSize.height;
  int currentPageStartIndex = 0;
  int currentPageEndIndex = 0;
  for (int i = 0; i < lines.length; i++) {
    final line = lines[i];
    final left = line.left;
    final top = line.baseline - line.ascent;
    final bottom = line.baseline + line.ascent;

    //current line overflow
    if (currentPageBottom < bottom) {
      currentPageEndIndex =
          textPainter.getPositionForOffset(Offset(left, top)).offset - 1;
      //finish the current word
      for (int j = 0; currentPageEndIndex + j < text.length; j++) {
        if (text[currentPageEndIndex + j] == ' ') {
          currentPageEndIndex = currentPageEndIndex + j;
          break;
        }
      }

      final pageText =
          text.substring(currentPageStartIndex, currentPageEndIndex);
      pageTexts.add(pageText);
      currentPageStartIndex = currentPageEndIndex;
      currentPageBottom = top + pageSize.height;
    }
  }

  final lastPageText = text.substring(currentPageStartIndex);
  pageTexts.add(lastPageText);

  return pageTexts;
}
</code>```

Body:
I have a blog page in my app with pagination, but as the phone font size affects it, the data comes from the backend as a single markdown and should break into pages in the app.

Also on the first page, I have the title widget and at the end of the last page should show the tags, so the pages that I want to render markdown into, has different sizes.

Currently, I'm using TextPainter to estimate the Text widget size and break the string to pages.

Here is my code generating pages:

  Future<List<Widget>> _generatePages(double blogContentHeight) async {
    final content = widget.content;

    final firstPage = genFirstPage(blogContentHeight, content);
    final otherPages = genOtherPages(blogContentHeight, content, firstPage);

    int lastPageStartIndex = firstPage.length;
    for (int i = 0; i < otherPages.length - 1; i++) {
      lastPageStartIndex += otherPages[i].length;
    }

    final lastPage =
        genLastPage(blogContentHeight, content, lastPageStartIndex);

    return genPageWidgets(firstPage, otherPages, lastPage);
  }

  String genFirstPage(double blogContentHeight, String content) {
    final headerHeight = _getHeaderHeight();
    final firstPageContentHeight = blogContentHeight - headerHeight;
    return TextSplitter()
        .getSplittedText(
            context,
            Size(MediaQuery.of(context).size.width - (horizontalPadding * 2),
                firstPageContentHeight),
            _textStyle,
            content)
        .first;
  }

  List<String> genOtherPages(
      double blogContentHeight, String content, String firstPage) {
    final otherPagesContentHeight = blogContentHeight;
    return TextSplitter().getSplittedText(
        context,
        Size(MediaQuery.of(context).size.width - (horizontalPadding * 2),
            otherPagesContentHeight),
        _textStyle,
        content.substring(firstPage.length));
  }

  List<String> genLastPage(
      double blogContentHeight, String content, int lastPageStartIndex) {
    final tagsHeight = _getTagsHeight();
    final lastPageContentHeight = blogContentHeight - tagsHeight;
    return TextSplitter().getSplittedText(
        context,
        Size(MediaQuery.of(context).size.width - (horizontalPadding * 2),
            lastPageContentHeight),
        _textStyle,
        content.substring(lastPageStartIndex));
  }

  List<Widget> genPageWidgets(
    String firstPage,
    List<String> otherPages,
    List<String> lastPage,
  ) {
    _pages.clear();

    _pages.add(Column(
      children: [
        widget.title,
        Markdown(
          data: firstPage,
        ),
      ],
    ));
    for (int i = 0; i < otherPages.length; i++) {
      if (i + 1 != otherPages.length) {
        _pages.add(Column(
          children: [
            Markdown(
              data: otherPages[i],
            ),
          ],
        ));
      } else {
        if (lastPage.length == 1) {
          _pages.add(Column(
            children: [
              Markdown(
                data: otherPages[i],
              ),
              widget.tags,
            ],
          ));
        } else {
          _pages.add(Column(
            children: [
              Markdown(
                data: otherPages[i],
              ),
            ],
          ));
          _pages.add(Column(
            children: [widget.tags],
          ));
        }
      }
    }

    return _pages;
  }

Here is my TextSplitter:

List<String> getSplittedText(
    BuildContext context, Size pageSize, TextStyle textStyle, String text) {
  final List<String> pageTexts = [];

  final textSpan = TextSpan(text: text, style: textStyle);
  final textPainter = TextPainter(
    text: textSpan,
    textDirection: TextDirection.rtl,
    textAlign: TextAlign.justify,
  );
  textPainter.layout(
    minWidth: 0,
    maxWidth: pageSize.width,
  );

  List<LineMetrics> lines = textPainter.computeLineMetrics();
  double currentPageBottom = pageSize.height;
  int currentPageStartIndex = 0;
  int currentPageEndIndex = 0;
  for (int i = 0; i < lines.length; i++) {
    final line = lines[i];
    final left = line.left;
    final top = line.baseline - line.ascent;
    final bottom = line.baseline + line.ascent;

    //current line overflow
    if (currentPageBottom < bottom) {
      currentPageEndIndex =
          textPainter.getPositionForOffset(Offset(left, top)).offset - 1;
      //finish the current word
      for (int j = 0; currentPageEndIndex + j < text.length; j++) {
        if (text[currentPageEndIndex + j] == ' ') {
          currentPageEndIndex = currentPageEndIndex + j;
          break;
        }
      }

      final pageText =
          text.substring(currentPageStartIndex, currentPageEndIndex);
      pageTexts.add(pageText);
      currentPageStartIndex = currentPageEndIndex;
      currentPageBottom = top + pageSize.height;
    }
  }

  final lastPageText = text.substring(currentPageStartIndex);
  pageTexts.add(lastPageText);

  return pageTexts;
}


问:
Target Machine Actively refused at - Invoke-RestMethod "http://localhost:xxx/api/http/routers
When I am running up.ps1 script while setting up my local to run XM Cloud, I'm getting the below error.

Background: my system got restarted and after that am facing this issue, docker containers are in the exited state, and not able to restart.

Tried fix: I completely deleted all my docker containers and ran up.ps1 script to install containers again and then the script was running fine.

Docker installed: docker for windows and running in windows containers

Error:

```<code>strconv.Atoi: parsing "": invalid syntax
Waiting for CM to become available...
Invoke-RestMethod: C:\pathtoxmcloudproject\up.ps1:59:19
Line |
  59 |  …   $status = Invoke-RestMethod "http://localhost:xxxx/api/http/routers …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No connection could be made because the target machine actively refused it.
</code>```

I tried deleting all containers and re-running the up.ps1 script.

Body:
When I am running up.ps1 script while setting up my local to run XM Cloud, I'm getting the below error.

Background: my system got restarted and after that am facing this issue, docker containers are in the exited state, and not able to restart.

Tried fix: I completely deleted all my docker containers and ran up.ps1 script to install containers again and then the script was running fine.

Docker installed: docker for windows and running in windows containers

Error:

strconv.Atoi: parsing "": invalid syntax
Waiting for CM to become available...
Invoke-RestMethod: C:\pathtoxmcloudproject\up.ps1:59:19
Line |
  59 |  …   $status = Invoke-RestMethod "http://localhost:xxxx/api/http/routers …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No connection could be made because the target machine actively refused it.

I tried deleting all containers and re-running the up.ps1 script.


问:
Make Navbar stick to the top after redirecting to another html with href
I just finished learning the basics and trying to get some practice in. My problem is that I can't get the navbar/sidebar to stick at all times even after redirecting to another HTML.
How do I do that?

Thanks

I basically tried out any relevant video/source I had but they only show how to make a navbar/sidebar but not how to keep it after changing the page.

body {
    margin: 0;
}

* {
    font-family: "Google Sans Regular";
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    list-style: none;
    text-decoration: none;
}

.navbar {
    height: 100vh;
    width: 100px;
    background: #191735;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    flex-direction: column;
    position: fixed;
    z-index: 1;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="./Kalkulator/css/style.css">
    <title>TÜV i-sec</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
  </head>
  <body>

  <nav class="navbar">
            Managed Security Service
            EPP Managed Service
  </nav>
  </body>

  <script src="./Kalkulator/js/startInterface.js"></script>
</html></code>```

Body:
I just finished learning the basics and trying to get some practice in. My problem is that I can't get the navbar/sidebar to stick at all times even after redirecting to another HTML.
How do I do that?

Thanks

I basically tried out any relevant video/source I had but they only show how to make a navbar/sidebar but not how to keep it after changing the page.

body {
    margin: 0;
}

* {
    font-family: "Google Sans Regular";
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    list-style: none;
    text-decoration: none;
}

.navbar {
    height: 100vh;
    width: 100px;
    background: #191735;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    flex-direction: column;
    position: fixed;
    z-index: 1;
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <link rel="stylesheet" href="./Kalkulator/css/style.css">
    <title>TÜV i-sec</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

            Managed Security Service
            EPP Managed Service


问:
Forgot Password: How do You Pipe a String Into a Given Program's Text Box in PowerShell?
My experience in scripting is solely in the bash shell and my problem is in Windows 10.

I forgot a password to use a program in Windows 10, but I do remember the key words I chose.  There are also a collection of numbers I believe are in the password, in mixed order between the key words.  I wrote a python script to generate permutations of these key words and numbers in a .txt file and while the number of possibilities is tractable it would take many hours to manually brute force my way past the password.

Is there any way to use PowerShell to automate piping of strings from a .txt file to a specific program's text box?  I know how to execute the program from PowerShell (PS C:> 'filepath\program.exe'), executing the program essentially opens a GUI with a text box to input the password.  I also know how to kill the program from PowerShell (PS C:> stop-process -Name "program_name").

I don't know how to specify the clicking of the text box for this program once it is opened in a PowerShell script.  My limited exposure to JavaScript leads me to think this will involve an event listener, or something analogous in the PowerShell context, which perhaps has a different name than event listener.

If I can get PowerShell to identify events in this program, I envision figuring out what the "wrong password" event is as well.  Then I would create some kind of loop that opens the program, clicks the text box, pipes a string from my .txt of password guesses, hits the enter key, and then listens for the "wrong password" event.  If the "wrong password" event is activated, the next iteration of the loop (next password guess from the .txt file) executes after the program is killed and then re-executed.  If the "wrong password" event is not activated in a given iteration, then I've found the right password and would write that string to some other file and the script would terminate.

This is obviously a high level question.  I don't mind high level answers.  If anybody could point me in the right direction, specifically related to identifying events in a Windows GUI program from PowerShell, and then automating clicking on the text box, field population, and clicking the enter key for the text box of that program from PowerShell, I can probably, eventually, figure it out.

I would also appreciate if technical jargon could be limited in answers.  I am not a computer scientist / programmer, but rather a physical scientist who often works with computers.

Thanks so much!

I tried using the "Get-Event" command in PowerShell, but I'm not using it correctly.  It returned nothing.  I then tried:

```<code>PS C:> $Events = Get-Event
PS C:> $Events[0] | Format-List -Property *
</code>```

But it returns an error message: "Cannot index into a null array"

Body:
My experience in scripting is solely in the bash shell and my problem is in Windows 10.

I forgot a password to use a program in Windows 10, but I do remember the key words I chose.  There are also a collection of numbers I believe are in the password, in mixed order between the key words.  I wrote a python script to generate permutations of these key words and numbers in a .txt file and while the number of possibilities is tractable it would take many hours to manually brute force my way past the password.

Is there any way to use PowerShell to automate piping of strings from a .txt file to a specific program's text box?  I know how to execute the program from PowerShell (PS C:> 'filepath\program.exe'), executing the program essentially opens a GUI with a text box to input the password.  I also know how to kill the program from PowerShell (PS C:> stop-process -Name "program_name").

I don't know how to specify the clicking of the text box for this program once it is opened in a PowerShell script.  My limited exposure to JavaScript leads me to think this will involve an event listener, or something analogous in the PowerShell context, which perhaps has a different name than event listener.

If I can get PowerShell to identify events in this program, I envision figuring out what the "wrong password" event is as well.  Then I would create some kind of loop that opens the program, clicks the text box, pipes a string from my .txt of password guesses, hits the enter key, and then listens for the "wrong password" event.  If the "wrong password" event is activated, the next iteration of the loop (next password guess from the .txt file) executes after the program is killed and then re-executed.  If the "wrong password" event is not activated in a given iteration, then I've found the right password and would write that string to some other file and the script would terminate.

This is obviously a high level question.  I don't mind high level answers.  If anybody could point me in the right direction, specifically related to identifying events in a Windows GUI program from PowerShell, and then automating clicking on the text box, field population, and clicking the enter key for the text box of that program from PowerShell, I can probably, eventually, figure it out.

I would also appreciate if technical jargon could be limited in answers.  I am not a computer scientist / programmer, but rather a physical scientist who often works with computers.

Thanks so much!

I tried using the "Get-Event" command in PowerShell, but I'm not using it correctly.  It returned nothing.  I then tried:

PS C:> $Events = Get-Event
PS C:> $Events[0] | Format-List -Property *

But it returns an error message: "Cannot index into a null array"


问:
Looking for ideas on a configurable table with functionality modules
I am looking for suggestions as I am developing an app which provides table configurability and when clicking on a particular cell, it would redirect you to a page containing a particular set of Database Records. I was wondering if there are any particular premade modules which includes that possibility or something similar. Similar to the configurability to the Tables of Microsoft Word ie. Split cells or additional columns or rows in a particular cell and being able to provide the metadata of the table to add additional functionality like redirecting to another page when clicking on a cell.

The idea is to configure the table into something similar of a shelving unit and being able to split is compartment within the shelving unit in to sub-compartments and accessing what is stored in the compartments when clicking on a cell. Any suggestions would be appreciated.


问:
Why I'm getting error when Import csv file into PGADMIN
I'm trying to import csv file which have 6 different datas. But It getting an error. How can I fix this.  I attached all the important images. Please check.

Basically I added,
6 different categories in csv file which are Client_Id(1 to 10 numbers), Name(Single 10 names), Age(under 100 10 different ages), Weight(10 different weights), Company(Acme Inc like this 10 company names), Preference_Id(10 different small numbers)

Then I added table in pgadmin add all the above columns and numbers as integer and others as character varying. But when I import I'm getting an error. How can I fix this?
Pgadmin screenshot


问:
Oracle Hyperion, Business Rule(Calc Manager) for copy data from BSO to BSO?
As I want to copy data from BSO(Custom Cube) to BSO(Module based cube) in ORACLE HYPERION.
I know the logic but do not know the syntax to write that logic.
What Level of Generation should be fix?

Thanks in Advance.

Previous approach was copying data through smart push. But now Business rule is require.


问:
How to convert column with multiple elements into a list?
I have a problem. I hope, someone can solve it. I have a df of:

Nr
Units

123
M2, KG, Piece

Second
KG, PAIR, Piece

I need the "Unit" column to be converted into an array and each element to be in single quotation marks

Nr
Units

123
['M2', 'KG', 'Piece']

Second
['KG', 'PAIR', 'Piece']


问:
un-used variables in vscode
What would be the setting entry in settings.json that controls the color of un-used variables.

I was playing around with editor.tokenColorCustomiztion entries but with no luck.

Title: un-used variables in vscode


问:
Unable to add incoming Webhook to MS Team as a connector
Error
:-(
Something went wrong.
The remote server returned an error: (403) Forbidden.:Unified groups aren't supported.
RequestId: b47dce03-3b1b-e0ca-589c-4340a4fd3ea9
Server: BN6PR1001MB2353
Date: 12/19/2022 8:40:05 AM

Unable to add incoming webhook to MS team for Servicenow integration


问:
SSRS 2008 R2 Will NOT Open in IE
I have tried every solution I can find on the internet, and still nothing. This is the most common error I get: "The underlying connection was closed: An unexpected error occurred on a receive."...with other random attempts I get a blank page, IE freezes, or I am prompted for credentials endlessly. I am running W7 Home Premiun, with IIS using port 80, SQLExpress Advanced - I do have a WAMP server also, as I need to run WordPress, etc and other PHP. I think I have tried every variation in the configuration manager. Any ideas appreciated. Thanks.</p>

ContentLicense: CC BY-SA 3.0

Title: SSRS 2008 R2 Will NOT Open in IE


问:
Kotlin jetpack compose canvas circle with multiple segments
I was trying to implement the apple face id feature but using kotlin jetpack compose.

I was able to get the circular ring in a circle by first creating a single marker point using this code

```<code>internal fun Marker(
    angle: Int,
    active: Boolean,
    modifier: Modifier = Modifier
) {
Box(
        modifier
            .fillMaxSize()
            .drawBehind {
                val theta = (angle - 90) * PI.toFloat() / 180f
                val startRadius = size.width / 2 * .72f
                val endRadius = size.width / 2 * .8f
                val startPos = Offset(cos(theta) * startRadius, sin(theta) * startRadius)
                val endPos = Offset(cos(theta) * endRadius, sin(theta) * endRadius)
                drawLine(
                    color = if (active) light_white else primaryColor.copy(alpha = .6f),
                    start = center + startPos,
                    end = center + endPos,
                    strokeWidth = 5f,
                    cap = StrokeCap.Round
                )
            }
    )
</code>```

and then grouping the markers to get the circle using this code

```<code>fun CircularMarkers(
    seconds: Int = 60,
    modifier: Modifier = Modifier
) {
    val nbMarker = 60
    val progressAngle by animateFloatAsState(
        targetValue = 360f / 30f * seconds,
        animationSpec = tween(500)
    )
    val markerActives by animateFloatAsState(
        targetValue = nbMarker / 30f * seconds,
        animationSpec = tween(500)
    )
    Box(
        modifier
            .fillMaxSize()
    ) {

        for (i in 0 until nbMarker) {
            Marker(
                angle = i * (360 / nbMarker),
                active = i < markerActives
            )
        }
    }
}
</code>```

which gives this result

now I wanted to control different sections as the current code only fills them in a certain direction but I wanted for example to fill left direction and then the bottom left direction just like apples and animated the marker when filling them

Body:
I was trying to implement the apple face id feature but using kotlin jetpack compose.

I was able to get the circular ring in a circle by first creating a single marker point using this code

internal fun Marker(
    angle: Int,
    active: Boolean,
    modifier: Modifier = Modifier
) {
Box(
        modifier
            .fillMaxSize()
            .drawBehind {
                val theta = (angle - 90) * PI.toFloat() / 180f
                val startRadius = size.width / 2 * .72f
                val endRadius = size.width / 2 * .8f
                val startPos = Offset(cos(theta) * startRadius, sin(theta) * startRadius)
                val endPos = Offset(cos(theta) * endRadius, sin(theta) * endRadius)
                drawLine(
                    color = if (active) light_white else primaryColor.copy(alpha = .6f),
                    start = center + startPos,
                    end = center + endPos,
                    strokeWidth = 5f,
                    cap = StrokeCap.Round
                )
            }
    )

and then grouping the markers to get the circle using this code

fun CircularMarkers(
    seconds: Int = 60,
    modifier: Modifier = Modifier
) {
    val nbMarker = 60
    val progressAngle by animateFloatAsState(
        targetValue = 360f / 30f * seconds,
        animationSpec = tween(500)
    )
    val markerActives by animateFloatAsState(
        targetValue = nbMarker / 30f * seconds,
        animationSpec = tween(500)
    )
    Box(
        modifier
            .fillMaxSize()
    ) {

        for (i in 0 until nbMarker) {
            Marker(
                angle = i * (360 / nbMarker),
                active = i < markerActives
            )
        }
    }
}

which gives this result

now I wanted to control different sections as the current code only fills them in a certain direction but I wanted for example to fill left direction and then the bottom left direction just like apples and animated the marker when filling them


问:
Hangfire Console App using Memory and MySQL
I have a console app with dependency injection and a dynamic recurring job. It uses a MySQL repository as the initial setup then saves it to the memory. Every time the job is triggered it checks if the schedule has been updated on the database thus updating the memory as well.

Here is the database model and database context:

```<code>public class Schedule
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Cron { get; set; }
    public string Task { get; set; }
}

public class HangfireServiceContext : DbContext
{
    public HangfireServiceContext(DbContextOptions<HangfireServiceContext> options) :base(options)
    {

    }

    public DbSet<Schedule> Schedules { get; set; }
}
</code>```

Here is the Program class:

```<code>internal class Program
{
    static void Main(string[] args)
    {
        var host = CreateHostBuilder().Build();
        var serviceProvider = host.Services;
        serviceProvider.GetService<IScheduler>().Execute();
    }

    public static IHostBuilder CreateHostBuilder()
    {
        return Host.CreateDefaultBuilder()
            .ConfigureAppConfiguration((hostingContext, config) =>
            {
                config.SetBasePath(Directory.GetCurrentDirectory())
                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                    .AddEnvironmentVariables();
            })
            .ConfigureServices((context, services) =>
            {
                var connectionString = context.Configuration.GetConnectionString("Default");
                services.AddDbContext<HangfireServiceContext>(options =>
                {
                    options.UseMySql(connectionString);
                });
                services.AddHangfire(x => x.UseMemoryStorage());
                services.AddHangfireServer();
                services.AddTransient<IScheduler, Scheduler>();
            });
    }
}

</code>```

Here is the executed class:

```<code>public class Scheduler : IScheduler
{
    private List<Schedule> _schedules;
    private readonly HangfireServiceContext _context;

    public Scheduler(HangfireServiceContext context)
    {
        _context = context;
        Initialize();
    }

    private void Initialize()
    {
        _schedules = _context.Schedules.ToList();
    }

    public void Execute()
    {
        GlobalConfiguration.Configuration
            .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
            .UseColouredConsoleLogProvider()
            .UseSimpleAssemblyNameTypeSerializer()
            .UseRecommendedSerializerSettings()
            .UseMemoryStorage();

        foreach (var schedule in _schedules)
        {
            RecurringJob.AddOrUpdate($"job-id-{schedule.Id}", () => PrintCurrentTime(schedule.Id), schedule.Cron);
        }

        using (var server = new BackgroundJobServer())
        {
            Console.ReadLine();
        }

    }

    public void PrintCurrentTime(int scheduleId)
    {
        Console.WriteLine($"Schedule {scheduleId}: {DateTime.Now.TimeOfDay}");

        var dbSchedule = _context.Schedules.FirstOrDefault(s => s.Id == scheduleId);
        var existingSchedule = _schedules.FirstOrDefault(s => s.Id == scheduleId);

        if (dbSchedule.Task != existingSchedule.Task || dbSchedule.Name != existingSchedule.Name)
        {

        }

    }
}
</code>```

There is no particular line on where the error happened but I am assuming that it is because it fails to get the dependency injected context from the class. Here is the complete error every recursion:

```<code>2022-12-19 09:52:09 [WARN]  (Hangfire.AutomaticRetryAttribute) Failed to process the job 'ea5c50a5-7615-4e45-9cbc-69dfbc866d92': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:33.
System.MissingMethodException
No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at Hangfire.JobActivator.SimpleJobActivatorScope.Resolve(Type type)
   at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
   at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_0.<PerformJobWithFilters>b__0()
   at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
   at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
   at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
   at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)
</code>```

Body:
I have a console app with dependency injection and a dynamic recurring job. It uses a MySQL repository as the initial setup then saves it to the memory. Every time the job is triggered it checks if the schedule has been updated on the database thus updating the memory as well.

Here is the database model and database context:

public class Schedule
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Cron { get; set; }
    public string Task { get; set; }
}

public class HangfireServiceContext : DbContext
{
    public HangfireServiceContext(DbContextOptions<HangfireServiceContext> options) :base(options)
    {

    }

    public DbSet<Schedule> Schedules { get; set; }
}

Here is the Program class:

internal class Program
{
    static void Main(string[] args)
    {
        var host = CreateHostBuilder().Build();
        var serviceProvider = host.Services;
        serviceProvider.GetService<IScheduler>().Execute();
    }

    public static IHostBuilder CreateHostBuilder()
    {
        return Host.CreateDefaultBuilder()
            .ConfigureAppConfiguration((hostingContext, config) =>
            {
                config.SetBasePath(Directory.GetCurrentDirectory())
                    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                    .AddEnvironmentVariables();
            })
            .ConfigureServices((context, services) =>
            {
                var connectionString = context.Configuration.GetConnectionString("Default");
                services.AddDbContext<HangfireServiceContext>(options =>
                {
                    options.UseMySql(connectionString);
                });
                services.AddHangfire(x => x.UseMemoryStorage());
                services.AddHangfireServer();
                services.AddTransient<IScheduler, Scheduler>();
            });
    }
}

Here is the executed class:

public class Scheduler : IScheduler
{
    private List<Schedule> _schedules;
    private readonly HangfireServiceContext _context;

    public Scheduler(HangfireServiceContext context)
    {
        _context = context;
        Initialize();
    }

    private void Initialize()
    {
        _schedules = _context.Schedules.ToList();
    }

    public void Execute()
    {
        GlobalConfiguration.Configuration
            .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
            .UseColouredConsoleLogProvider()
            .UseSimpleAssemblyNameTypeSerializer()
            .UseRecommendedSerializerSettings()
            .UseMemoryStorage();

        foreach (var schedule in _schedules)
        {
            RecurringJob.AddOrUpdate($"job-id-{schedule.Id}", () => PrintCurrentTime(schedule.Id), schedule.Cron);
        }

        using (var server = new BackgroundJobServer())
        {
            Console.ReadLine();
        }

    }

    public void PrintCurrentTime(int scheduleId)
    {
        Console.WriteLine($"Schedule {scheduleId}: {DateTime.Now.TimeOfDay}");

        var dbSchedule = _context.Schedules.FirstOrDefault(s => s.Id == scheduleId);
        var existingSchedule = _schedules.FirstOrDefault(s => s.Id == scheduleId);

        if (dbSchedule.Task != existingSchedule.Task || dbSchedule.Name != existingSchedule.Name)
        {

        }

    }
}

There is no particular line on where the error happened but I am assuming that it is because it fails to get the dependency injected context from the class. Here is the complete error every recursion:

2022-12-19 09:52:09 [WARN]  (Hangfire.AutomaticRetryAttribute) Failed to process the job 'ea5c50a5-7615-4e45-9cbc-69dfbc866d92': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:33.
System.MissingMethodException
No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at Hangfire.JobActivator.SimpleJobActivatorScope.Resolve(Type type)
   at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context)
   at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass9_0.<PerformJobWithFilters>b__0()
   at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func`1 continuation)
   at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable`1 filters)
   at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context)
   at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)