问:
VS2022 start debugging gives Failed to launch debug adapter. unable to attach to browser
I'm trying to start debugging a Blazor WASM solution and I get this error:

this is the console output windows:

```<code>got exception System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server
---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (127.0.0.1:1080)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.EstablishProxyTunnelAsync(Boolean async, HttpRequestHeaders headers, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
at Microsoft.WebAssembly.Diagnostics.DevToolsProxy.Run(Uri browserUri, WebSocket ideSocket)
at Microsoft.WebAssembly.Diagnostics.DebugExtensions.<>c__DisplayClass2_0.<<UseDebugProxy>g__ConnectProxy|5>d.MoveNext()
</code>```

Any help? what's causing the problem?

this is launchSettings.json

```<code>{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:13139",
      "sslPort": 44318
    }
  },
  "profiles": {
    "Bulut.Appraisal.Frontend": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:6080;http://localhost:6081",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}
</code>```

Body:
I'm trying to start debugging a Blazor WASM solution and I get this error:

this is the console output windows:

got exception System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server
---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (127.0.0.1:1080)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.EstablishProxyTunnelAsync(Boolean async, HttpRequestHeaders headers, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
at Microsoft.WebAssembly.Diagnostics.DevToolsProxy.Run(Uri browserUri, WebSocket ideSocket)
at Microsoft.WebAssembly.Diagnostics.DebugExtensions.<>c__DisplayClass2_0.<<UseDebugProxy>g__ConnectProxy|5>d.MoveNext()

Any help? what's causing the problem?

this is launchSettings.json

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:13139",
      "sslPort": 44318
    }
  },
  "profiles": {
    "Bulut.Appraisal.Frontend": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:6080;http://localhost:6081",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


来源: stackexchange

问:
Mosquitto client consuming is slowing down and data gap increasing
In a system with multiple devices, diagnostic data is published to separate topics for each device to Mosquitto Broker. A client application tries to consume data by subscribing to these topics separately for each device. The client receives 5 or 6 record per device per minute.

My problem is, after worker application started, the data received from Mosquitto Boroker starts to have delays on the client side. These delays start from 1 second, as time progresses, it lags behind by 1 day and 2 days during the time it is on. After stopping borker, the client continues to consume data.

Any ideas on what causes these delays?

```<code>protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
  string dataHost = _configuration.GetValue<string>("DataHost");
  mqttClient = new MqttClient(dataHost);
  mqttClient.MqttMsgPublishReceived += MqttClient_MqttMsgPublishReceived;
  var list = _configuration.GetValue<string>("DeviceList").Split(',').ToList();

  foreach (var deviceId in list)
  {

      mqttClient.Subscribe(
      new string[] { $"{deviceId}/#" },
      new byte[] { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE });

  }

  mqttClient.ConnectionClosed += MqttClient_ConnectionClosed;
  mqttClient.Connect("client", "username", "pass", false, 10);
}

private void MqttClient_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
{
  try
  {
      var message = Encoding.UTF8.GetString(e.Message);
      var messageArray = e.Topic.Split('/');

      if (IsValidJson(message))
      {
                      ItemValue itemValue = JsonConvert.DeserializeObject<ItemValue>(message);
                      _diagnosticRepository.InsertAsync(new DiagnosticDTO
                      {
                          value = messageArray[4].ToString(),
                          message = message,
                          messageTime = DateTime.Now,
                          deviceTime = itemValue.datetime,
                          sequenceNo = itemValue.sequenceNo,

                      });
       }

  }
  catch (Exception ex)
  {

        _logger.LogError(ex.Message, "Consumer Insert Error");

  }

</code>```

ContentLicense: CC BY-SA 4.0

Body:
In a system with multiple devices, diagnostic data is published to separate topics for each device to Mosquitto Broker. A client application tries to consume data by subscribing to these topics separately for each device. The client receives 5 or 6 record per device per minute.

My problem is, after worker application started, the data received from Mosquitto Boroker starts to have delays on the client side. These delays start from 1 second, as time progresses, it lags behind by 1 day and 2 days during the time it is on. After stopping borker, the client continues to consume data.

Any ideas on what causes these delays?

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
  string dataHost = _configuration.GetValue<string>("DataHost");
  mqttClient = new MqttClient(dataHost);
  mqttClient.MqttMsgPublishReceived += MqttClient_MqttMsgPublishReceived;
  var list = _configuration.GetValue<string>("DeviceList").Split(',').ToList();

  foreach (var deviceId in list)
  {

      mqttClient.Subscribe(
      new string[] { $"{deviceId}/#" },
      new byte[] { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE });

  }

  mqttClient.ConnectionClosed += MqttClient_ConnectionClosed;
  mqttClient.Connect("client", "username", "pass", false, 10);
}

private void MqttClient_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
{
  try
  {
      var message = Encoding.UTF8.GetString(e.Message);
      var messageArray = e.Topic.Split('/');

      if (IsValidJson(message))
      {
                      ItemValue itemValue = JsonConvert.DeserializeObject<ItemValue>(message);
                      _diagnosticRepository.InsertAsync(new DiagnosticDTO
                      {
                          value = messageArray[4].ToString(),
                          message = message,
                          messageTime = DateTime.Now,
                          deviceTime = itemValue.datetime,
                          sequenceNo = itemValue.sequenceNo,

                      });
       }

  }
  catch (Exception ex)
  {

        _logger.LogError(ex.Message, "Consumer Insert Error");

  }


问:
Changes since last successful build does not work in Jenkins after installation
I have installed- https://plugins.jenkins.io/changes-since-last-success/ in my jenkins. But now, when my build has failed then the commits done for that particular build are not visible in the next successful build.

I can't see this changes since last success option in UI-

Am I required to do anything else other than this plugin installation. I mean do I have to perform any configuration to use it or make it work?
Your answer will help me a lot.


问:
How can we integrate Microsoft AD with Terraform Enterprise
We have a Terraform Enterprise set-up. There are few use-cases which we want to work on. It requires Microsoft AD Group management e.g. creating an AD Group, adding users to the AD Group etc.

As per the available documentation and links, I can only see an experimental provider available which can be used and that too is still under testing.

Can anyone suggest me any alternative which can be used here or an approach, if I want to integrate and drive this AD integration through Terraform.

Thank You.

Am expecting an alternative/approach for the integration of Microsoft AD through Terraform


问:
Blazor page results show different with and without NavMenu
I am self study blazor from Microsoft Learning.
But I do not know why I follow original tutorual and keep using NavMenu.
And the result is quite different with what show in tutorual.

Can anyone help to answer?
Here is the Url what I learn from Microsoft
https://learn.microsoft.com/en-us/training/modules/interact-with-data-blazor-web-apps/3-exercise-create-user-interfaces-with-blazor-components


问:
kivy Carousel slides index set
how can I set indexes for slides in the carousel? I have a list which I receive from a DB.

```<code>[4, 30, 1, 2]
</code>```

I read a bunch of information but did not understand how this is possible. By standard, the index numbers in the carousel start from 0 and I can get each of these indexes:

```<code>on_current_slide: root.current_slide(self._index) # 0, 1, 2, 3
</code>```

but here's the problem, they do not match the indexes of the records from the database.

```<code>class NewsScreen(ScreenManager):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        sql_query = "SELECT id, title, image, date FROM news WHERE id > 0 ORDER BY date"
        id_list = [] # list for id's

        rows = con.execute(sql_query,)
        db.commit()

        for  row in rows:
            slide = NewsCards()
            id_list.append(int(row[0]))
            slide.title_text=str(row[1])
            slide.title_date=str(row[3])
            slide.img_path=str(row[2])

            self.ids.carousel.add_widget(slide)

        print(id_list) # [4, 30, 1, 2]

    # Getting slide index
    def current_slide(self, _index):
        cur_index = _index
        print("Current slide id :", cur_index)
</code>```

I want to set the indexes in the carousel slides to match the indexes from the database. Can anyone help?

Title: kivy Carousel slides index set

Body:
how can I set indexes for slides in the carousel? I have a list which I receive from a DB.

[4, 30, 1, 2]

I read a bunch of information but did not understand how this is possible. By standard, the index numbers in the carousel start from 0 and I can get each of these indexes:

on_current_slide: root.current_slide(self._index) # 0, 1, 2, 3

but here's the problem, they do not match the indexes of the records from the database.

class NewsScreen(ScreenManager):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        sql_query = "SELECT id, title, image, date FROM news WHERE id > 0 ORDER BY date"
        id_list = [] # list for id's

        rows = con.execute(sql_query,)
        db.commit()

        for  row in rows:
            slide = NewsCards()
            id_list.append(int(row[0]))
            slide.title_text=str(row[1])
            slide.title_date=str(row[3])
            slide.img_path=str(row[2])

            self.ids.carousel.add_widget(slide)

        print(id_list) # [4, 30, 1, 2]

    # Getting slide index
    def current_slide(self, _index):
        cur_index = _index
        print("Current slide id :", cur_index)

I want to set the indexes in the carousel slides to match the indexes from the database. Can anyone help?


问:
Swift build for linux/amd64 fails with strange error
I have a swift app with the following dependencies:

```<code>    .package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.41.1")),
    .package(url: "https://github.com/apple/swift-crypto.git", .upToNextMajor(from: "2.1.0"))
</code>```

Building it locally to run in a docker container works. This is the command I use for that:

```<code>docker build -t <image-name>:v1 .
</code>```

Given I am building on an M1 macbook, deploying the above to azure does not work, since it is built for arm64 arch. However, when I attempt to build for linux/amd64, the code fails. This is the docker command I am using:

```<code>docker build --platform=linux/amd64 -t <image-name>:v1 .
</code>```

I have tried with buildx, but the failure is similar:

```<code>docker buildx build --platform=linux/amd64 -t <image-name>:v1 .
</code>```

The command I use to build the app for production is this:

```<code>RUN swift build -c release --static-swift-stdlib
</code>```

Here is a snippet of the error message I am getting:

```<code>#0 35.45 warning: 'build': 'Build' was identified as an executable target given the presence of a 'main.swift' file. Starting with tools version 5.4.0 executable targets should be declared as 'executableTarget()'
#0 35.67 Building for production...
#0 36.08 [0/422] Compiling _AtomicsShims.c
#0 36.28 [1/422] Compiling CNIOWindows shim.c
#0 36.48 [2/422] Compiling CNIOWindows WSAStartup.c
#0 36.51 error: command Compiling CNIOLinux shim.c failed: failed to poll (Interrupted system call)
...
#0 44.33 remark: Incremental compilation has been disabled: it is not compatible with
whole module optimization
#0 44.34 error: command Compiling Swift Module 'NIOConcurrencyHelpers' (5 sources) failed: failed to poll (Interrupted system call)
#0 47.29 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_skey.c failed: failed to poll (Interrupted system call)
#0 47.64 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_purp.c failed: failed to poll (Interrupted system call)
</code>```

Body:
I have a swift app with the following dependencies:

    .package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.41.1")),
    .package(url: "https://github.com/apple/swift-crypto.git", .upToNextMajor(from: "2.1.0"))

Building it locally to run in a docker container works. This is the command I use for that:

docker build -t <image-name>:v1 .

Given I am building on an M1 macbook, deploying the above to azure does not work, since it is built for arm64 arch. However, when I attempt to build for linux/amd64, the code fails. This is the docker command I am using:

docker build --platform=linux/amd64 -t <image-name>:v1 .

I have tried with buildx, but the failure is similar:

docker buildx build --platform=linux/amd64 -t <image-name>:v1 .

The command I use to build the app for production is this:

RUN swift build -c release --static-swift-stdlib

Here is a snippet of the error message I am getting:

#0 35.45 warning: 'build': 'Build' was identified as an executable target given the presence of a 'main.swift' file. Starting with tools version 5.4.0 executable targets should be declared as 'executableTarget()'
#0 35.67 Building for production...
#0 36.08 [0/422] Compiling _AtomicsShims.c
#0 36.28 [1/422] Compiling CNIOWindows shim.c
#0 36.48 [2/422] Compiling CNIOWindows WSAStartup.c
#0 36.51 error: command Compiling CNIOLinux shim.c failed: failed to poll (Interrupted system call)
...
#0 44.33 remark: Incremental compilation has been disabled: it is not compatible with
whole module optimization
#0 44.34 error: command Compiling Swift Module 'NIOConcurrencyHelpers' (5 sources) failed: failed to poll (Interrupted system call)
#0 47.29 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_skey.c failed: failed to poll (Interrupted system call)
#0 47.64 error: command Compiling CCryptoBoringSSL crypto/x509v3/v3_purp.c failed: failed to poll (Interrupted system call)


问:
Intent get photo from gallery
I'm a newbie to android, I'm having a few small questions when working with Intent to get images from the gallery, the possible ways to get the images I can use like:
Type 1:

```<code>Intent getIntent = new Intent(Intent.ACTION_PICK,
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(getIntent, REQUEST_IMAGE_GALLERY);

</code>```

it return  uri content://media/external/images/media/...

Type 2:

```<code>
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), REQUEST_IMAGE_GALLERY);

</code>```

it return  uri content://com.android.providers.media.documents/document/image...

please help me explain the meaning of the above 2 types of uri and what should be used in what cases, i have searched but did not get the results i wanted, any help is worth it Best regards. Thanks everyone

Title: Intent get photo from gallery

Body:
I'm a newbie to android, I'm having a few small questions when working with Intent to get images from the gallery, the possible ways to get the images I can use like:
Type 1:

Intent getIntent = new Intent(Intent.ACTION_PICK,
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(getIntent, REQUEST_IMAGE_GALLERY);

it return  uri content://media/external/images/media/...

Type 2:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), REQUEST_IMAGE_GALLERY);

it return  uri content://com.android.providers.media.documents/document/image...

please help me explain the meaning of the above 2 types of uri and what should be used in what cases, i have searched but did not get the results i wanted, any help is worth it Best regards. Thanks everyone


问:
Given a matrix convert it into dictionary with keys as row number and value as a tuple?
Given a matrix convert it into dictionary with keys as row number and value as a tuple?

Refer to the displayed test cases for a better understanding.

Row indexing starts with 1.


问:
Do we have to purchase twilio numbers for every user we join in conference call in Twilio?
I'm working on web app which allow different users to create session and add participants in that session.

I'm implementing voice based feature in my web app. But having some questions which I didn't found perfectly on Twilio docs or may be I missed that.

Questions:

Is it necessary to give every participant new number when they join the conference call?

If I create 5 sessions at a time in my web app and each session contains 70 users, then do I have to purchase 70(Participant) * 5(Session) = 350 Numbers from Twilio to make 5 conference call of 70 participant at a time ?

Note : It's browser based calling system, No interaction with outer devices such as Mobile or any other physical devices apart from Laptop/Computer in which user is accessing my web app.

Thanks in advance for any suggestions here or to clear my doubts.


问:
how to solve module build failed after changing file extension ( *.ts => *.tsx )?
after changing a specific file's extension from .ts to .tsx I get:

Compiled with problems:X

ERROR in ./src/components/SomeComp/someFile.ts

Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):

Error: ENOENT: no such file or directory, open '.../someFile.ts'
ERROR

No files matching 'C:\Users...\src\components\SomeComp\someFile.ts' were found.

it has happened recently and somehow figured out on its own,
then i switched branches and when returned it happened again

I tried what was suggested here, clearing the browser cache How to get Chrome to reload source maps?

also restarted the react dev server couple of times

but still it tries to find the file with the old .ts extension...

searched as much as I could but didn't find a solve...

edit:

after changing the extension back and forth and restarting the dev server it has figured out, but I would still love to know what was happening and what perhaps what should be done to handle this situation correctly in the future


问:
How can I create a Wikimedia template for
...

I read this page about {{Quote}} but how can I create this as a template for my own Wikimedia wiki? Where can I find the content of that page?

Title: How can I create a Wikimedia template for <blockquote>...</blockquote>


问:
dynamically loading content in a single modal or repeating the modal for each row, which approach is faster and lighter
creating a single bootstrap modal and populating the data of each row with the help of javascript or jQuery, or creating the modal for each row in a loop and each row or record has its own modal rather than a single modal

which approach is faster and light weight, and is more suitable


问:
WebRTC page automation checkbox is not enabling in headless chrome
In chrome we have Webrtc-Internals page I am trying to automate this website but I have a problem in doing it when you click on "Create Dump" dropdown we have two checkbox's

and

I am trying to click this element using "--headless" chrome without headless if you click it opens "save as" dialog box which cannot be automated using selenium cause it os-dialog box but when it comes to headless by click nothing popups and check box is not enabling no exceptions was shown, If you have an idea to automates this it would be helpful,

Sample code (Java) :

```<code>driver.get("chrome://webrtc-internals/");
driver.findElement(By.xpath("/html/body/p/details/summary")).click();
driver.findElement(By.xpath("//*[@id='content-root']/details/div/p[5]/label/input")).click();
driver.findElement(By.xpath("//*[@id='content-root']/details/div/p[1]/label/input")).click();

</code>```

Thanks on advance!

Tried sendKeys also not working,
In a case it enables but can't save recording, Tried different type of chrome version

Body:
In chrome we have Webrtc-Internals page I am trying to automate this website but I have a problem in doing it when you click on "Create Dump" dropdown we have two checkbox's

and

I am trying to click this element using "--headless" chrome without headless if you click it opens "save as" dialog box which cannot be automated using selenium cause it os-dialog box but when it comes to headless by click nothing popups and check box is not enabling no exceptions was shown, If you have an idea to automates this it would be helpful,

Sample code (Java) :

driver.get("chrome://webrtc-internals/");
driver.findElement(By.xpath("/html/body/p/details/summary")).click();
driver.findElement(By.xpath("//*[@id='content-root']/details/div/p[5]/label/input")).click();
driver.findElement(By.xpath("//*[@id='content-root']/details/div/p[1]/label/input")).click();

Thanks on advance!

Tried sendKeys also not working,
In a case it enables but can't save recording, Tried different type of chrome version


问:
React state is empty inside stomp callback function
I'm trying to update react state afte getting data from the websocket connection.

```<code>  cont[myState,setState] = useState([array of some values]);
      useEffect(() => {
    if (d1 && d2) {
      /* Begin Setup */
      const socket = new SockJS(WS_URL, {}, {CheckOrigin: () => false});
      socket.onopen = () => {
        // console.log('Connected to server');
      };
      socket.onclose = () => {
        // console.log('Disconnected from server');
      };

      stompClient = Stomp.over(socket);
      stompClient.connect({}, () => {
        stompClient?.subscribe(`/topic/chat/${d1.id}`,onMessageReceiveEvent);
        /// Subscribe for any user repliyng for the selected chat
        stompClient?.subscribe(`/topic/chat/status/${d1.id}`, onCurrentReplyEvent);
      });
    }
    return () => {
      stompClient?.disconnect();
    }
  },[d1,d2]);

  const onMessageReceiveEvent = (res) =>{
    console.log(mystate) //// printing [] array, althogh it has values.
  }
</code>```

I'm not able to get why myState is empty inside the callback function of stomp subscriber?

Please help.

Body:
I'm trying to update react state afte getting data from the websocket connection.

  cont[myState,setState] = useState([array of some values]);
      useEffect(() => {
    if (d1 && d2) {
      /* Begin Setup */
      const socket = new SockJS(WS_URL, {}, {CheckOrigin: () => false});
      socket.onopen = () => {
        // console.log('Connected to server');
      };
      socket.onclose = () => {
        // console.log('Disconnected from server');
      };

      stompClient = Stomp.over(socket);
      stompClient.connect({}, () => {
        stompClient?.subscribe(`/topic/chat/${d1.id}`,onMessageReceiveEvent);
        /// Subscribe for any user repliyng for the selected chat
        stompClient?.subscribe(`/topic/chat/status/${d1.id}`, onCurrentReplyEvent);
      });
    }
    return () => {
      stompClient?.disconnect();
    }
  },[d1,d2]);

  const onMessageReceiveEvent = (res) =>{
    console.log(mystate) //// printing [] array, althogh it has values.
  }

I'm not able to get why myState is empty inside the callback function of stomp subscriber?

Please help.


问:
Key manipulation not working for datetime type in python dictionary
I am trying to convert a datetime key (all keys infact) to string in a python dictionary (see last line of recursive_items) as below but I am getting non-updated keys in dictionary:

```<code>def recursive_items(dictionary):
    for key, value in dictionary.items():
        if type(value) is dict:
            yield (key, value)
            yield from recursive_items(value)
        elif type(value) is list:
            yield (key, value)
            for i in value:
                if type(i) is dict:
                    yield from recursive_items(i)
        else:

            yield (str(key), value)

item = {'dateCol': {'n': 1000,
  'type': 'Categorical',
  'n': 1000,
  'p': 100.0,
  'n1': 0,
  'p1': 0.0,
  'val': datetime.datetime(2000, 10, 1, 0, 0),
  'value_counts': {datetime.datetime(2000, 10, 1, 0, 0): 1,
   datetime.datetime(2000, 10, 2, 0, 0): 1,
   datetime.datetime(2000, 10, 11, 0, 0): 1}}}

res = dict()
for key, value in recursive_items(item):
    print(key, type(key))
    res[key]= value

</code>```

When I print key I am getting string as type but in dictionary named 'res' I am still getting datetime. Can someone please guide here?
Thanks.

Edited:
I am getting the output also but dictionary is not the same, is there a way to retain original nested dictionary?

Body:
I am trying to convert a datetime key (all keys infact) to string in a python dictionary (see last line of recursive_items) as below but I am getting non-updated keys in dictionary:

def recursive_items(dictionary):
    for key, value in dictionary.items():
        if type(value) is dict:
            yield (key, value)
            yield from recursive_items(value)
        elif type(value) is list:
            yield (key, value)
            for i in value:
                if type(i) is dict:
                    yield from recursive_items(i)
        else:

            yield (str(key), value)

item = {'dateCol': {'n': 1000,
  'type': 'Categorical',
  'n': 1000,
  'p': 100.0,
  'n1': 0,
  'p1': 0.0,
  'val': datetime.datetime(2000, 10, 1, 0, 0),
  'value_counts': {datetime.datetime(2000, 10, 1, 0, 0): 1,
   datetime.datetime(2000, 10, 2, 0, 0): 1,
   datetime.datetime(2000, 10, 11, 0, 0): 1}}}

res = dict()
for key, value in recursive_items(item):
    print(key, type(key))
    res[key]= value

When I print key I am getting string as type but in dictionary named 'res' I am still getting datetime. Can someone please guide here?
Thanks.

Edited:
I am getting the output also but dictionary is not the same, is there a way to retain original nested dictionary?


问:
Variations in sprite shape textures
I am currently trying out how to work with sprite shapes. I know how we can put different textures on different angles but Suppose i wanted to make variations with different images(sprites) on a single surface. For example, i want to make spots with puddle textures on a grass plain land. How will i do that?

I tried adding different textures in different angles but I couldn't figure out how i can change the repeating texture and make variations in a single surface in a sprite shape.

Title: Variations in sprite shape textures


问:
AWS Chime control region AP_SOUTHEAST_1 throwing error
I'm trying to connect to AWS Chime API.

When trying to use control region as AP_SOUTHEAST_1(Singapore) for chime, it is throwing error

According to this article: controlling Chime is available in AP_SOUTHEAST_1(Singapore) region

So in my requests, I'm using the region AP_SOUTHEAST_1 which is, according to article, allowed to control Chime.

But for any request I'm getting the error :

```<code>Exception in thread "main" software.amazon.awssdk.core.exception.SdkClientException: Received an UnknownHostException when attempting to interact with a service. See cause for the exact endpoint that is failing to resolve. This specific service is global in the same partition as the region configured on this client (ap-southeast-1). If this is the first time you're trying to talk to this service in this region, you should try configuring the global region on your client, instead: aws-global
</code>```

Only US_EAST_1(N. Virginia) is working

AP_SOUTHEAST_1(Singapore) is the nearest control region, would like to set it as control region not US_EAST_1(N. Virginia)

Body:
I'm trying to connect to AWS Chime API.

When trying to use control region as AP_SOUTHEAST_1(Singapore) for chime, it is throwing error

According to this article: controlling Chime is available in AP_SOUTHEAST_1(Singapore) region

So in my requests, I'm using the region AP_SOUTHEAST_1 which is, according to article, allowed to control Chime.

But for any request I'm getting the error :

Exception in thread "main" software.amazon.awssdk.core.exception.SdkClientException: Received an UnknownHostException when attempting to interact with a service. See cause for the exact endpoint that is failing to resolve. This specific service is global in the same partition as the region configured on this client (ap-southeast-1). If this is the first time you're trying to talk to this service in this region, you should try configuring the global region on your client, instead: aws-global

Only US_EAST_1(N. Virginia) is working

AP_SOUTHEAST_1(Singapore) is the nearest control region, would like to set it as control region not US_EAST_1(N. Virginia)


问:
platformio can't access local directory
Open PlatformIO Project

I have reinstalled  the platformio, but it stll dont't work!

then  i tried to create a new project and create a new project dir -gd32_test,
i got these errors as follows:
OS_MAKE_DIRS
Server error: {"type":"PermissionError","args":[13,"Permission denied"],"message":"[Errno 13] Permission denied: '/home/fy\\gd32_test'"}

i guess there is something wrong with the formate of the path created

by the way, i'm a student from china, i'm grately graceful for your help, thanks!

Title: platformio can't access local directory


问:
/bin/sh: mysql_config: not found while making docker image in django app
Collecting mysqlclient==2.1.1
Downloading mysqlclient-2.1.1.tar.gz (88 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 6.3 MB/s eta 0:00:00

```<code>  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
   ╰─> [16 lines of output]
     mysql_config --version
      /bin/sh: mysql_config: not found
      mariadb_config --version
      /bin/sh: mariadb_config: not found
      mysql_config --libs
</code>```

I just run docker build . -t docker-django-v0.0 and encountered above issue.

Body:
Collecting mysqlclient==2.1.1
Downloading mysqlclient-2.1.1.tar.gz (88 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 6.3 MB/s eta 0:00:00

  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
   ╰─> [16 lines of output]
     mysql_config --version
      /bin/sh: mysql_config: not found
      mariadb_config --version
      /bin/sh: mariadb_config: not found
      mysql_config --libs

I just run docker build . -t docker-django-v0.0 and encountered above issue.


问:
Installation error LuaHPDF while installing
I want to install LuaHPDF. But it gives an error as follows. The LuaHPDF link is https://github.com/jung-kurt/luahpdf.

When I apply in terminal

```<code>$make
</code>```

The error is

```<code>cc -shared -fPIC -o hpdf.so hpdf.o -lhpdf -lz -lpng -lm
/usr/bin/ld: cannot find -lz: No such file or directory
/usr/bin/ld: cannot find -lpng: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:45: hpdf.so] Error 1
</code>```

Can anyone help me?

I install libharu as requested.
https://github.com/libharu/libharu/wiki/Installation#documentation-for-version-v230

Then I tried to install luaHPDF.

Body:
I want to install LuaHPDF. But it gives an error as follows. The LuaHPDF link is https://github.com/jung-kurt/luahpdf.

When I apply in terminal

$make

The error is

cc -shared -fPIC -o hpdf.so hpdf.o -lhpdf -lz -lpng -lm
/usr/bin/ld: cannot find -lz: No such file or directory
/usr/bin/ld: cannot find -lpng: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:45: hpdf.so] Error 1

Can anyone help me?

I install libharu as requested.
https://github.com/libharu/libharu/wiki/Installation#documentation-for-version-v230

Then I tried to install luaHPDF.


问:
How to send a reply in telegram using the response from the nodejs parser
If you just parse the page and output the answer to the console, then everything works correctly and the desired answer comes.

if this answer is added to the telegram bot's response using the await ctx.reply telegraph, an error occurs.

Unhandled error while processing..

```<code>node_modules\telegraf\lib\core\network\client.js:293
            throw new error_1.default(data, { method, payload });
</code>```
```<code>response: {
    ok: false,
    error_code: 400,
    description: 'Bad Request: message text is empty'
  },
  on: {
    method: 'sendMessage',
    payload: { chat_id: 27190544, message_thread_id: undefined }
  }
}

Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...
</code>```

how do I add a parser response to a bot? help me please

```<code>const { Telegraf, Markup } = require('telegraf');
const BOT_TOKEN = "*****************************************";
const bot = new Telegraf(BOT_TOKEN);
const axios = require("axios");
const cheerio = require("cheerio");

async function getString() {
    await axios.get("https://www.federalreserve.gov/releases/h10/current/").then((response) => {
      const $ = cheerio.load(response.data);
      const table = $("table");

      for (let i = 0; i < table.length; i++) {
        let tr = $(table[i]).find("tr")[4];
        console.log(tr.tostring());
        return $(tr).text();
      }
    })
    .catch((err) => console.log("Fetch error " + err));
  }

bot.start((ctx) => {
    ctx.reply('restart!')
});

bot.command('test', async (ctx) => {
    ctx.reply("Click it", Markup.inlineKeyboard(
        [
            [Markup.button.callback('PEACE', 'PEACE')]
        ]
    ))
});

bot.action('PEACE', async (ctx) => {
    await ctx.answerCbQuery()
    await ctx.reply(getString())
});

bot.launch();
</code>```

Body:
If you just parse the page and output the answer to the console, then everything works correctly and the desired answer comes.

if this answer is added to the telegram bot's response using the await ctx.reply telegraph, an error occurs.

Unhandled error while processing..

node_modules\telegraf\lib\core\network\client.js:293
            throw new error_1.default(data, { method, payload });

response: {
    ok: false,
    error_code: 400,
    description: 'Bad Request: message text is empty'
  },
  on: {
    method: 'sendMessage',
    payload: { chat_id: 27190544, message_thread_id: undefined }
  }
}

Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...

how do I add a parser response to a bot? help me please

const { Telegraf, Markup } = require('telegraf');
const BOT_TOKEN = "*****************************************";
const bot = new Telegraf(BOT_TOKEN);
const axios = require("axios");
const cheerio = require("cheerio");

async function getString() {
    await axios.get("https://www.federalreserve.gov/releases/h10/current/").then((response) => {
      const $ = cheerio.load(response.data);
      const table = $("table");

      for (let i = 0; i
 console.log("Fetch error " + err));
  }

bot.start((ctx) => {
    ctx.reply('restart!')
});

bot.command('test', async (ctx) => {
    ctx.reply("Click it", Markup.inlineKeyboard(
        [
            [Markup.button.callback('PEACE', 'PEACE')]
        ]
    ))
});

bot.action('PEACE', async (ctx) => {
    await ctx.answerCbQuery()
    await ctx.reply(getString())
});

bot.launch();


问:
Prevent JSF Session Timeout while working in iFrame
I have an JSF Primefaces application which on one page shows an iFrame. In this iFrame the user can work for quite a while, afterwards he can press a button which navigates to one of my JSF handled pages. I implemented this using the window.parent.postMessage event, this works well.

But still there remains one problem: While working in the iFrame, the Session times out and the user gets redirected to the login screen.

I already tried using

with

```<code>public String interact() {
        HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
        ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession(false);
        return null;
    }
</code>```

in order to keep the session alive. In my interact function I tried different things. I read in other StackOverflow posts that getting the session should be enough to keep it open.

Debugging the function shows that session.getLastAccessedTime() is updated every time the poll is executing. The session ID is always the same.

But still, after my defined session timeout, the user gets redirected to the login screen the moment the poll is fired.

My .xhtml file hosting the frame looks as follows:

```<code><ui:define name="content">
    <h:form>
        <p:remoteCommand name="finish" action="#{bean.finish()}"/>
        <p:remoteCommand name="back" action="#{bean.back()}"/>
        <script type="text/javascript">
            window.addEventListener('message', (e) => {
                if(e.data === 'finished') {
                    finish();
                } else if(e.data === 'back') {
                    back();
                }
            });
        </script>
        <iframe src="https://myUrl/#{bean.queryParameterEncrypted()}"/>
        <p:poll interval="1500" listener="#{bean.interact}"/>
    </h:form>
</ui:define>
</code>```

Body:
I have an JSF Primefaces application which on one page shows an iFrame. In this iFrame the user can work for quite a while, afterwards he can press a button which navigates to one of my JSF handled pages. I implemented this using the window.parent.postMessage event, this works well.

But still there remains one problem: While working in the iFrame, the Session times out and the user gets redirected to the login screen.

I already tried using

with

public String interact() {
        HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
        ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession(false);
        return null;
    }

in order to keep the session alive. In my interact function I tried different things. I read in other StackOverflow posts that getting the session should be enough to keep it open.

Debugging the function shows that session.getLastAccessedTime() is updated every time the poll is executing. The session ID is always the same.

But still, after my defined session timeout, the user gets redirected to the login screen the moment the poll is fired.

My .xhtml file hosting the frame looks as follows:

<ui:define name="content">
    <h:form>

    </h:form>
</ui:define>


问:
How to run django-channels + nginx + gunicorn + redis in docker?
I am trying run an django asgi app with nginx + gunicorn + redis in docker.so far my wsgi application is running by gunicorn smoothly but somehow my django channels consumers are not connecting.

Docker-Compose

```<code>version: '3.9'

services:
  db:
   image: postgres
   volumes:
     - ./data/db:/var/lib/postgresql/data
   environment:
     - POSTGRES_DB=LiveSafer
     - POSTGRES_USER=postgres
     - POSTGRES_PASSWORD=demo1234
  ports:
    - "5432:5432"

  web:
   build: .
   command: >
    bash -c " python manage.py makemigrations &&
              python manage.py migrate &&
              gunicorn --bind 0.0.0.0:8000 LiveSafer.wsgi &&
              daphne -b 0.0.0.0 -p 8001 LiveSafer.routing:application
            "
   volumes:
    - .:/app
    - static_files:/app/static
   expose:
    - 8000
   ports:
    - 8001:8001
   links:
    - redis
   depends_on:
    - db

 nginx:
   build: ./nginx/
   ports:
    - 80:80
   volumes:
    - ./nginx/conf.d/:/etc/nginx/conf.d/
    - static_files:/home/app/static
   depends_on:
    - web

 # database controller
 adminer:
   image: adminer:latest
   restart: always
   environment:
    - ADMINER_DEFAULT_SERVER=db
    - ADMINER_DESIGN=flat
    - ADMINER_PLUGINS=tables-filter
   ports:
    - 8080:8080

 redis:
  image: redis:latest
  command: ["redis-server", "--bind", "redis", "--port", "6379"]
</code>```

volumes:
static_files:
db:

nginx

```<code>upstream django{
   server web:8000;
}

upstream channels-backend {
   server 127.0.0.1:8001;
}

server {
 listen 80;
 client_max_body_size 60M;

 location / {
    proxy_pass http://django;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header HOST $host;
 }

 location /ws/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_redirect off;
    proxy_pass http://127.0.0.1:8001;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
 }

 location /media/ {
    alias /app/media/;
 }

 location /static/ {
    alias /home/app/static/;
 }
</code>```

}

Terminal

```<code>lifvesafer-nginx-1    | 2022/12/20 07:00:56 [error] 31#31: *10 connect() failed (113:
No route to host) while connecting to upstream, client: 172.19.0.1, server: , request:
"GET /favicon.ico HTTP/1.1", upstream: "http://172.19.0.5:8000/favicon.ico", host:
"127.0.0.1", referrer: "http://127.0.0.1/"
</code>```

now i am not understanding why this is happening and how do i solve this

Body:
I am trying run an django asgi app with nginx + gunicorn + redis in docker.so far my wsgi application is running by gunicorn smoothly but somehow my django channels consumers are not connecting.

Docker-Compose

version: '3.9'

services:
  db:
   image: postgres
   volumes:
     - ./data/db:/var/lib/postgresql/data
   environment:
     - POSTGRES_DB=LiveSafer
     - POSTGRES_USER=postgres
     - POSTGRES_PASSWORD=demo1234
  ports:
    - "5432:5432"

  web:
   build: .
   command: >
    bash -c " python manage.py makemigrations &&
              python manage.py migrate &&
              gunicorn --bind 0.0.0.0:8000 LiveSafer.wsgi &&
              daphne -b 0.0.0.0 -p 8001 LiveSafer.routing:application
            "
   volumes:
    - .:/app
    - static_files:/app/static
   expose:
    - 8000
   ports:
    - 8001:8001
   links:
    - redis
   depends_on:
    - db

 nginx:
   build: ./nginx/
   ports:
    - 80:80
   volumes:
    - ./nginx/conf.d/:/etc/nginx/conf.d/
    - static_files:/home/app/static
   depends_on:
    - web

 # database controller
 adminer:
   image: adminer:latest
   restart: always
   environment:
    - ADMINER_DEFAULT_SERVER=db
    - ADMINER_DESIGN=flat
    - ADMINER_PLUGINS=tables-filter
   ports:
    - 8080:8080

 redis:
  image: redis:latest
  command: ["redis-server", "--bind", "redis", "--port", "6379"]

volumes:
static_files:
db:

nginx

upstream django{
   server web:8000;
}

upstream channels-backend {
   server 127.0.0.1:8001;
}

server {
 listen 80;
 client_max_body_size 60M;

 location / {
    proxy_pass http://django;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header HOST $host;
 }

 location /ws/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_redirect off;
    proxy_pass http://127.0.0.1:8001;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
 }

 location /media/ {
    alias /app/media/;
 }

 location /static/ {
    alias /home/app/static/;
 }

}

Terminal

lifvesafer-nginx-1    | 2022/12/20 07:00:56 [error] 31#31: *10 connect() failed (113:
No route to host) while connecting to upstream, client: 172.19.0.1, server: , request:
"GET /favicon.ico HTTP/1.1", upstream: "http://172.19.0.5:8000/favicon.ico", host:
"127.0.0.1", referrer: "http://127.0.0.1/"

now i am not understanding why this is happening and how do i solve this


问:
WSO2 - Error while Calling Secured Proxy Service
I'm a Beginner in WSO2
I Passed the User name and password for the proxy user and also add the time stamp in the header using SOAP UI

Can someone help to resolve the error I'm facing,

```<code>[2022-12-20 12:38:25,793] ERROR {org.apache.axis2.engine.AxisEngine} - System error org.apache.axis2.AxisFault: System error
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:337)
    at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:459)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:182)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.axiom.soap.SOAPProcessingException: Hello is not supported here. Envelope can not have elements other than Header and Body.
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:392)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:265)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
    at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
    at org.apache.axiom.om.impl.llom.OMElementImpl.buildWithAttachments(OMElementImpl.java:1086)
    at org.wso2.carbon.security.pox.POXSecurityHandler.setAuthHeaders(POXSecurityHandler.java:371)
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:292)
    ... 10 more

[2022-12-20 12:38:25,850] ERROR {org.apache.synapse.transport.passthru.ServerWorker} - Error processing POST request for : /services/WebServer_Proxy.WebServer_ProxyHttpsSoap11Endpoint org.apache.axis2.AxisFault: System error
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:337)
    at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:459)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:182)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.axiom.soap.SOAPProcessingException: Hello is not supported here. Envelope can not have elements other than Header and Body.
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:392)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:265)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
    at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
    at org.apache.axiom.om.impl.llom.OMElementImpl.buildWithAttachments(OMElementImpl.java:1086)
    at org.wso2.carbon.security.pox.POXSecurityHandler.setAuthHeaders(POXSecurityHandler.java:371)
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:292)
 10 more
</code>```

Body:
I'm a Beginner in WSO2
I Passed the User name and password for the proxy user and also add the time stamp in the header using SOAP UI

Can someone help to resolve the error I'm facing,

[2022-12-20 12:38:25,793] ERROR {org.apache.axis2.engine.AxisEngine} - System error org.apache.axis2.AxisFault: System error
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:337)
    at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:459)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:182)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.axiom.soap.SOAPProcessingException: Hello is not supported here. Envelope can not have elements other than Header and Body.
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:392)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:265)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
    at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
    at org.apache.axiom.om.impl.llom.OMElementImpl.buildWithAttachments(OMElementImpl.java:1086)
    at org.wso2.carbon.security.pox.POXSecurityHandler.setAuthHeaders(POXSecurityHandler.java:371)
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:292)
    ... 10 more

[2022-12-20 12:38:25,850] ERROR {org.apache.synapse.transport.passthru.ServerWorker} - Error processing POST request for : /services/WebServer_Proxy.WebServer_ProxyHttpsSoap11Endpoint org.apache.axis2.AxisFault: System error
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:337)
    at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:459)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:182)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.axiom.soap.SOAPProcessingException: Hello is not supported here. Envelope can not have elements other than Header and Body.
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:392)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:265)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
    at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
    at org.apache.axiom.om.impl.llom.OMElementImpl.buildWithAttachments(OMElementImpl.java:1086)
    at org.wso2.carbon.security.pox.POXSecurityHandler.setAuthHeaders(POXSecurityHandler.java:371)
    at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:292)
 10 more


问:
How to improve the Mediator algorithm when new widgets are added?
i want improve mediator algorithm when the new widgets are added.How do I make changes in this form? and also in the code ? plas help me

```<code>When I want to add one more widget, I have to deal with 3 problems:

    I need to add MyNewWidget class. (it's not a problem)
    I need to change the FontDialogDirector class implementation and add MyNewWidget* _myNewWidget;.
    Add _myNewWidget= new MyNewWidget(this);
    Change the WidgetChanged method implementation, and add else if (theChangedWidget == _myNewWidget) //... to it.

Is there any solution that I don't have to hard code, when a new widget arrives?
</code>```

Body:
i want improve mediator algorithm when the new widgets are added.How do I make changes in this form? and also in the code ? plas help me

When I want to add one more widget, I have to deal with 3 problems:

    I need to add MyNewWidget class. (it's not a problem)
    I need to change the FontDialogDirector class implementation and add MyNewWidget* _myNewWidget;.
    Add _myNewWidget= new MyNewWidget(this);
    Change the WidgetChanged method implementation, and add else if (theChangedWidget == _myNewWidget) //... to it.

Is there any solution that I don't have to hard code, when a new widget arrives?


问:
How to catch if deeplink not found in javascript
I can open deeplink in google chrome as

```<code>window.open('bank100000000005://domain.com/', '_self');
</code>```

then in developer console found this message:

```<code>Launched external handler for 'bank100000000005://domain.com/
</code>```

Now if application was found it will be opened, but if not found I want to show notice message abount it.

Body:
I can open deeplink in google chrome as

window.open('bank100000000005://domain.com/', '_self');

then in developer console found this message:

Launched external handler for 'bank100000000005://domain.com/

Now if application was found it will be opened, but if not found I want to show notice message abount it.


问:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types. in .Net core mvc
Error image

I have asp.net core mvc application which we are migrating from MVC5 application and when I try to run the application after pull from azure repository, i getting this error in program.cs page itself and eventhough i googled with the same topic i didnt get relavant answer .
(Im  using visual studio 2022 - version 17.4.3)

could you pls give a exact solution for my problem
Thanks for ur assistance.

I need to resolve this issue and run the application

"System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types.
Could not load type 'Kendo.Mvc.UI.Fluent.DropDownListBuilderBase`2' from assembly
'Kendo.Mvc, Version=2022.2.621.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4'.'"


问:
How to add a cron job in lua
Here I'm trying to add a cron job for a lua project. What I need to do is run specific instructions set daily at a given time. Is there a specific way to schedule a task?  How can I do it.. Is it possible in lua scripts.</p>

Title: How to add a cron job in lua


问:
Retrieve a value from MongoDB collection based on another identifier
I have a mongo collection like below

```<code>[
  {
    _id: ObjectId("63a03f729755062cbced5298"),
    bat: 30,
    ball: 45,
    version: 1
  },
  {
    _id: ObjectId("63a03f729755062cbced5299"),
    bat: 100,
    ball: 50,
    version: 2
  }
]
</code>```

Now using PyMongo based on the "version", I want to extract the price of the "bat". Say for version 1, I am using the below query. Is the below query optimised? I want to avoid the list conversion and lookup using indexes, rather do it using Mongo query itself. Any idea?

```<code>price = list(collection.aggregate([{"$match": {"version": 1}}]))[0]["bat"]
</code>```

Body:
I have a mongo collection like below

[
  {
    _id: ObjectId("63a03f729755062cbced5298"),
    bat: 30,
    ball: 45,
    version: 1
  },
  {
    _id: ObjectId("63a03f729755062cbced5299"),
    bat: 100,
    ball: 50,
    version: 2
  }
]

Now using PyMongo based on the "version", I want to extract the price of the "bat". Say for version 1, I am using the below query. Is the below query optimised? I want to avoid the list conversion and lookup using indexes, rather do it using Mongo query itself. Any idea?

price = list(collection.aggregate([{"$match": {"version": 1}}]))[0]["bat"]


问:
why software can't access my usb web cam on my rasberry pi 3?
please, I would like to know why my usb webcam does not work on my rasberry pi 3 model B+, when I enter the command "lsusb", I see that the webcam is detected, but when I launch "cheese", it shows me that no device is detected

the v4l2-ctl -V command display this:

```<code>Format Video Capture:
Width/Height : 640/360
Pixel Format : 'YUYV' (YUYV 4:2:2)
Field : None
Bytes per Line : 1280
Size Image : 460800
Colorspace : sRGB
Transfer Function : Rec. 709
YCbCr/HSV Encoding: ITU-R 601
Quantization : Default (maps to Limited Range)
Flags :
</code>```

I tried to lunch cheese in terminal with and without sudo:

capture

Body:
please, I would like to know why my usb webcam does not work on my rasberry pi 3 model B+, when I enter the command "lsusb", I see that the webcam is detected, but when I launch "cheese", it shows me that no device is detected

the v4l2-ctl -V command display this:

Format Video Capture:
Width/Height : 640/360
Pixel Format : 'YUYV' (YUYV 4:2:2)
Field : None
Bytes per Line : 1280
Size Image : 460800
Colorspace : sRGB
Transfer Function : Rec. 709
YCbCr/HSV Encoding: ITU-R 601
Quantization : Default (maps to Limited Range)
Flags :

I tried to lunch cheese in terminal with and without sudo:

capture


问:
Make Spring Boot 3 Actuator aware of X-Forwarded-Prefix header?
This question is similar to Make Spring Boot 2.7.x Actuator aware of X-Forwarded-Prefix header?, but for Spring Boot 3.

We're using Spring Boot 3 with spring-boot-starter-actuator that we're exposing on port 8081 under the /management context path. The proxy sets several X-Forwarded-* headers, including the X-Forwarded-Prefix header that is set to /service. But when navigating to https://www.company.com/management this is what is returned:

```<code>{
    "_links": {
        "self": {
            "href": "https://www.company.com/management",
            "templated": false
        },
        "beans": {
            "href": "https://www.company.com/management/beans",
            "templated": false
        },
        "caches-cache": {
            "href": "https://www.company.com/management/caches/{cache}",
            "templated": true
        },
        "caches": {
            "href": "https://www.company.com/management/caches",
            "templated": false
        },
        "health": {
            "href": "https://www.company.com/management/health",
            "templated": false
        },
        "health-path": {
            "href": "https://www.company.com/management/health/{*path}",
            "templated": true
        },
        "info": {
            "href": "https://www.company.com/management/info",
            "templated": false
        },
        "conditions": {
            "href": "https://www.company.com/management/conditions",
            "templated": false
        },
        "configprops": {
            "href": "https://www.company.com/management/configprops",
            "templated": false
        },
        "configprops-prefix": {
            "href": "https://www.company.com/management/configprops/{prefix}",
            "templated": true
        },
        "env": {
            "href": "https://www.company.com/management/env",
            "templated": false
        },
        "env-toMatch": {
            "href": "https://www.company.com/management/env/{toMatch}",
            "templated": true
        },
        "integrationgraph": {
            "href": "https://www.company.com/management/integrationgraph",
            "templated": false
        },
        "loggers": {
            "href": "https://www.company.com/management/loggers",
            "templated": false
        },
        "loggers-name": {
            "href": "https://www.company.com/management/loggers/{name}",
            "templated": true
        },
        "heapdump": {
            "href": "https://www.company.com/management/heapdump",
            "templated": false
        },
        "threaddump": {
            "href": "https://www.company.com/management/threaddump",
            "templated": false
        },
        "metrics-requiredMetricName": {
            "href": "https://www.company.com/management/metrics/{requiredMetricName}",
            "templated": true
        },
        "metrics": {
            "href": "https://www.company.com/management/metrics",
            "templated": false
        },
        "scheduledtasks": {
            "href": "https://www.company.com/management/scheduledtasks",
            "templated": false
        },
        "sessions-sessionId": {
            "href": "https://www.company.com/management/sessions/{sessionId}",
            "templated": true
        },
        "sessions": {
            "href": "https://www.company.com/management/sessions",
            "templated": false
        },
        "mappings": {
            "href": "https://www.company.com/management/mappings",
            "templated": false
        },
        "refresh": {
            "href": "https://www.company.com/management/refresh",
            "templated": false
        },
        "features": {
            "href": "https://www.company.com/management/features",
            "templated": false
        },
        "traces": {
            "href": "https://www.company.com/management/traces",
            "templated": false
        }
    }
}
</code>```

I want the href's in the response to start with https://www.company.com/service due to the supplied X-Forwarded-Prefix header. It won't work by simply adding a ForwardedHeaderFilter:

```<code>@Bean
public FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilterFilterRegistrationBean() {
    ForwardedHeaderFilter forwardedHeaderFilter = new ForwardedHeaderFilter();
    FilterRegistrationBean<ForwardedHeaderFilter> bean = new FilterRegistrationBean<>(forwardedHeaderFilter);
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return bean;
}
</code>```

I added an issue at Spring Boot GitHub, and they acknowledged that the behavior is a bit confusing (since it works in webflux). However, in Spring Boot 2.7, this workaround could be applied to make it work:

@Component
@ConditionalOnManagementPort(ManagementPortType.DIFFERENT)
public class ManagementContextFactoryBeanPostProcessor
        implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName)
            throws BeansException {
        if (bean instanceof ManagementContextFactory managementContextFactory) {
            return (ManagementContextFactory) (parent, configurationClasses) -> {
                var context = managementContextFactory.createManagementContext(parent, configurationClasses);
                if (context instanceof GenericWebApplicationContext genericWebApplicationContext) {
                    genericWebApplicationContext.registerBean(ForwardedHeaderFilterRegistrationBean.class);
                }
                return context;
            };
        }
        return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName);
    }

    public static class ForwardedHeaderFilterRegistrationBean
            extends FilterRegistrationBean<ForwardedHeaderFilter> {

        public ForwardedHeaderFilterRegistrationBean() {
            setFilter(new ForwardedHeaderFilter());
            setOrder(Ordered.HIGHEST_PRECEDENCE);
        }

    }

}
```

But this no longer works in Spring Boot 3. The ManagementContextFactory is no longer an interface but rather a final class, and the signature of the createManagementContext method has changed.

So my question is, how can I make actuator take the X-Forwarded-Prefix header into account when generating the links to the endpoints behind a proxy in Spring Boot 3?

Body:
This question is similar to Make Spring Boot 2.7.x Actuator aware of X-Forwarded-Prefix header?, but for Spring Boot 3.

We're using Spring Boot 3 with spring-boot-starter-actuator that we're exposing on port 8081 under the /management context path. The proxy sets several X-Forwarded-* headers, including the X-Forwarded-Prefix header that is set to /service. But when navigating to https://www.company.com/management this is what is returned:

{
    "_links": {
        "self": {
            "href": "https://www.company.com/management",
            "templated": false
        },
        "beans": {
            "href": "https://www.company.com/management/beans",
            "templated": false
        },
        "caches-cache": {
            "href": "https://www.company.com/management/caches/{cache}",
            "templated": true
        },
        "caches": {
            "href": "https://www.company.com/management/caches",
            "templated": false
        },
        "health": {
            "href": "https://www.company.com/management/health",
            "templated": false
        },
        "health-path": {
            "href": "https://www.company.com/management/health/{*path}",
            "templated": true
        },
        "info": {
            "href": "https://www.company.com/management/info",
            "templated": false
        },
        "conditions": {
            "href": "https://www.company.com/management/conditions",
            "templated": false
        },
        "configprops": {
            "href": "https://www.company.com/management/configprops",
            "templated": false
        },
        "configprops-prefix": {
            "href": "https://www.company.com/management/configprops/{prefix}",
            "templated": true
        },
        "env": {
            "href": "https://www.company.com/management/env",
            "templated": false
        },
        "env-toMatch": {
            "href": "https://www.company.com/management/env/{toMatch}",
            "templated": true
        },
        "integrationgraph": {
            "href": "https://www.company.com/management/integrationgraph",
            "templated": false
        },
        "loggers": {
            "href": "https://www.company.com/management/loggers",
            "templated": false
        },
        "loggers-name": {
            "href": "https://www.company.com/management/loggers/{name}",
            "templated": true
        },
        "heapdump": {
            "href": "https://www.company.com/management/heapdump",
            "templated": false
        },
        "threaddump": {
            "href": "https://www.company.com/management/threaddump",
            "templated": false
        },
        "metrics-requiredMetricName": {
            "href": "https://www.company.com/management/metrics/{requiredMetricName}",
            "templated": true
        },
        "metrics": {
            "href": "https://www.company.com/management/metrics",
            "templated": false
        },
        "scheduledtasks": {
            "href": "https://www.company.com/management/scheduledtasks",
            "templated": false
        },
        "sessions-sessionId": {
            "href": "https://www.company.com/management/sessions/{sessionId}",
            "templated": true
        },
        "sessions": {
            "href": "https://www.company.com/management/sessions",
            "templated": false
        },
        "mappings": {
            "href": "https://www.company.com/management/mappings",
            "templated": false
        },
        "refresh": {
            "href": "https://www.company.com/management/refresh",
            "templated": false
        },
        "features": {
            "href": "https://www.company.com/management/features",
            "templated": false
        },
        "traces": {
            "href": "https://www.company.com/management/traces",
            "templated": false
        }
    }
}

I want the href's in the response to start with https://www.company.com/service due to the supplied X-Forwarded-Prefix header. It won't work by simply adding a ForwardedHeaderFilter:

@Bean
public FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilterFilterRegistrationBean() {
    ForwardedHeaderFilter forwardedHeaderFilter = new ForwardedHeaderFilter();
    FilterRegistrationBean<ForwardedHeaderFilter> bean = new FilterRegistrationBean<>(forwardedHeaderFilter);
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return bean;
}

I added an issue at Spring Boot GitHub, and they acknowledged that the behavior is a bit confusing (since it works in webflux). However, in Spring Boot 2.7, this workaround could be applied to make it work:

@Component
@ConditionalOnManagementPort(ManagementPortType.DIFFERENT)
public class ManagementContextFactoryBeanPostProcessor
        implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName)
            throws BeansException {
        if (bean instanceof ManagementContextFactory managementContextFactory) {
            return (ManagementContextFactory) (parent, configurationClasses) -> {
                var context = managementContextFactory.createManagementContext(parent, configurationClasses);
                if (context instanceof GenericWebApplicationContext genericWebApplicationContext) {
                    genericWebApplicationContext.registerBean(ForwardedHeaderFilterRegistrationBean.class);
                }
                return context;
            };
        }
        return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName);
    }

    public static class ForwardedHeaderFilterRegistrationBean
            extends FilterRegistrationBean<ForwardedHeaderFilter> {

        public ForwardedHeaderFilterRegistrationBean() {
            setFilter(new ForwardedHeaderFilter());
            setOrder(Ordered.HIGHEST_PRECEDENCE);
        }

    }

}

But this no longer works in Spring Boot 3. The ManagementContextFactory is no longer an interface but rather a final class, and the signature of the createManagementContext method has changed.

So my question is, how can I make actuator take the X-Forwarded-Prefix header into account when generating the links to the endpoints behind a proxy in Spring Boot 3?


问:
Nestjs Passport google Oauth2 with custom JWT
What I need to achieve -

I need to have a dynamic redirect URL (not google's refer Current Flow last step) based on the query param sent by Frontend.

I need to send my custom JWT token instead of google token which can have roles and permission in it. (Not sure if we can add claims to google token as well)

In my app, I have 2 roles - candidate, and recruiter. I need to use Gmail auth and create a user in my DB according to roles, which again I could achieve via query param pass by Frontend.

Current Flow -

Frontend calls google/login -> GoogleAuthGaurd -> GoogleStrategy -> google/redirect -> Generate custom JWT token -> redirect to frontend with access token and refresh token in URL.

Problem -

In Passport, we have GoogleAuthGaurd, and GoogleStrategy. I have read somewhere that Auth Gaurd decides which strategy to be used and it internally calls the strategy and further execution.

If I pass query param to google/login it totally ignores it and redirects to strategy. We can access contecxt (ExecutionContext) in AuthGaurd, so we can get query param there but how to pass it to strategy? or may be invoke custom strategy from auth guard not sure if we can.

Is there any way I could pass the query param to strategy then I could write a logic to update the redirect URI or roles?

```<code>import { TokenResponsePayload } from '@identity/payloads/responses/token-response.payload';
import { Controller, Get, Inject, Req, Res, UseGuards } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Request, Response } from 'express';
import {
  AuthServiceInterface,
  AuthServiceSymbol,
} from '../interfaces/services/auth-service.interface';
import { AccessTokenGaurd } from '../utils/access-token.guard';
import { GoogleAuthGaurd } from '../utils/google-auth-guard';
import { RefreshTokenGuard } from '../utils/refresh-token.guard';

@ApiTags('Auth')
@Controller('auth')
export class AuthController {
  constructor(
    @Inject(AuthServiceSymbol)
    private authService: AuthServiceInterface,
  ) {}

  @Get('google/login')
  @UseGuards(GoogleAuthGaurd)
  handleGoogleLogin() {}

  @Get('google/redirect')
  @UseGuards(GoogleAuthGaurd)
  async handleGoogleRedirect(@Req() req, @Res() res: Response) {
    const tokens = await this.authService.signInWithGoogle(req);
    res.redirect(302,`http://127.0.0.1:4200?access_token=${tokens.accessToken}&refresh_token=${tokens.refreshToken}`)
  }

  @Get('logout')
  @UseGuards(AccessTokenGaurd)
  async remove(@Req() req: Request): Promise<void> {
    return this.authService.removeSession(req.user['sessionId']);
  }

  @UseGuards(RefreshTokenGuard)
  @Get('refresh')
  async refreshToken(@Req() req: Request): Promise<TokenResponsePayload> {
    const sessionId = req.user['sessionId'];
    const refreshToken = req.user['refreshToken'];
    return this.authService.refreshTokens(sessionId, refreshToken);
  }
}
import { Injectable } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport';

@Injectable() export class GoogleAuthGaurd extends AuthGuard('google') {}

import { CalConfigService, ConfigEnum } from '@cawstudios/calibrate.common';
import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Profile, Strategy } from 'passport-google-oauth20';
import { VerifiedCallback } from 'passport-jwt';

const configService = new CalConfigService();
@Injectable()
export class GoogleStrategy extends PassportStrategy(Strategy) {
  constructor() {
    super({
      clientID: configService.get(ConfigEnum.CLIENT_ID),
      clientSecret: configService.get(ConfigEnum.CLIENT_SECRET),
      callbackURL: configService.get('CALLBACK_URL'),
      scope: ['profile', 'email'],
    });
  }
  async validate(
    accessToken: string,
    refreshToken: string,
    profile: Profile,
    done: VerifiedCallback,
  ): Promise<any> {
    const email = profile.emails[0].value;
    done(null, email);
  }
}
</code>```

Body:
What I need to achieve -

I need to have a dynamic redirect URL (not google's refer Current Flow last step) based on the query param sent by Frontend.

I need to send my custom JWT token instead of google token which can have roles and permission in it. (Not sure if we can add claims to google token as well)

In my app, I have 2 roles - candidate, and recruiter. I need to use Gmail auth and create a user in my DB according to roles, which again I could achieve via query param pass by Frontend.

Current Flow -

Frontend calls google/login -> GoogleAuthGaurd -> GoogleStrategy -> google/redirect -> Generate custom JWT token -> redirect to frontend with access token and refresh token in URL.

Problem -

In Passport, we have GoogleAuthGaurd, and GoogleStrategy. I have read somewhere that Auth Gaurd decides which strategy to be used and it internally calls the strategy and further execution.

If I pass query param to google/login it totally ignores it and redirects to strategy. We can access contecxt (ExecutionContext) in AuthGaurd, so we can get query param there but how to pass it to strategy? or may be invoke custom strategy from auth guard not sure if we can.

Is there any way I could pass the query param to strategy then I could write a logic to update the redirect URI or roles?

import { TokenResponsePayload } from '@identity/payloads/responses/token-response.payload';
import { Controller, Get, Inject, Req, Res, UseGuards } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Request, Response } from 'express';
import {
  AuthServiceInterface,
  AuthServiceSymbol,
} from '../interfaces/services/auth-service.interface';
import { AccessTokenGaurd } from '../utils/access-token.guard';
import { GoogleAuthGaurd } from '../utils/google-auth-guard';
import { RefreshTokenGuard } from '../utils/refresh-token.guard';

@ApiTags('Auth')
@Controller('auth')
export class AuthController {
  constructor(
    @Inject(AuthServiceSymbol)
    private authService: AuthServiceInterface,
  ) {}

  @Get('google/login')
  @UseGuards(GoogleAuthGaurd)
  handleGoogleLogin() {}

  @Get('google/redirect')
  @UseGuards(GoogleAuthGaurd)
  async handleGoogleRedirect(@Req() req, @Res() res: Response) {
    const tokens = await this.authService.signInWithGoogle(req);
    res.redirect(302,`http://127.0.0.1:4200?access_token=${tokens.accessToken}&refresh_token=${tokens.refreshToken}`)
  }

  @Get('logout')
  @UseGuards(AccessTokenGaurd)
  async remove(@Req() req: Request): Promise<void> {
    return this.authService.removeSession(req.user['sessionId']);
  }

  @UseGuards(RefreshTokenGuard)
  @Get('refresh')
  async refreshToken(@Req() req: Request): Promise<TokenResponsePayload> {
    const sessionId = req.user['sessionId'];
    const refreshToken = req.user['refreshToken'];
    return this.authService.refreshTokens(sessionId, refreshToken);
  }
}
import { Injectable } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport';

@Injectable() export class GoogleAuthGaurd extends AuthGuard('google') {}

import { CalConfigService, ConfigEnum } from '@cawstudios/calibrate.common';
import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Profile, Strategy } from 'passport-google-oauth20';
import { VerifiedCallback } from 'passport-jwt';

const configService = new CalConfigService();
@Injectable()
export class GoogleStrategy extends PassportStrategy(Strategy) {
  constructor() {
    super({
      clientID: configService.get(ConfigEnum.CLIENT_ID),
      clientSecret: configService.get(ConfigEnum.CLIENT_SECRET),
      callbackURL: configService.get('CALLBACK_URL'),
      scope: ['profile', 'email'],
    });
  }
  async validate(
    accessToken: string,
    refreshToken: string,
    profile: Profile,
    done: VerifiedCallback,
  ): Promise<any> {
    const email = profile.emails[0].value;
    done(null, email);
  }
}


问:
Can't figure out how to improve/fix animation
https://codepen.io/llllllllqqq/pen/eYjYxmz

Trying to open a text box and a few buttons onclick with a cool animation but something just feels off can't figure out how to improve it

Any advice will be greatly appreciated !

Tried to open them one after another but with the number of components It takes way too long then tried to open/ close them from the left and right simeltaneously but just looks off

`

```<code>

function Test() {
  const [active, setActive] = React.useState(false);

  function handleChange() {
    setActive(!active);
  }

  return (
    <>
      <div className="cont">
        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "0px" : "125px",
            fontSize: active ? "0em" : "1em",
            padding: active ? "0px" : "2px 4px 2px 4px",
            transitionDelay: active ? "300ms" : "0ms",
          }}
          onClick={handleChange}
        >
          Create Team
        </button>

        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "0px" : "125px",
            fontSize: active ? "0em" : "1em",
            padding: active ? "0px" : "2px 4px 2px 4px",
            transitionDelay: active ? "0ms" : "300ms",
          }}
          onClick={handleChange}
        >
          Join Team
        </button>
        <input
          type="text"
          id="first_name"
          class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 testtransition"
          placeholder="Enter Team Code"
          required
          style={{
            width: active ? "350px" : "0px",
            fontSize: active ? "1em" : "0em",
            padding: active ? "2px 4px 2px 4px" : "0px",
            borderWidth: active ? "1px" : "0px",
            transitionDelay: active ? "0ms" : "600ms",
          }}
        ></input>
        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "125px" : "0px",
            fontSize: active ? "1em" : "0em",
            padding: active ? "2px 4px 2px 4px" : "0px",
            transitionDelay: active ? "300ms" : "300ms",
          }}
          onClick={handleChange}
        >
          Join
        </button>
        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "125px" : "0px",
            fontSize: active ? "1em" : "0em",
            padding: active ? "2px 4px 2px 4px" : "0px",
            transitionDelay: active ? "600ms" : "0ms",
          }}
          onClick={handleChange}
        >
          Cancel
        </button>
      </div>
    </>
  );
}

ReactDOM.render(<Test />, document.getElementById('app'));
</code>```

`

Body:
https://codepen.io/llllllllqqq/pen/eYjYxmz

Trying to open a text box and a few buttons onclick with a cool animation but something just feels off can't figure out how to improve it

Any advice will be greatly appreciated !

Tried to open them one after another but with the number of components It takes way too long then tried to open/ close them from the left and right simeltaneously but just looks off

`

function Test() {
  const [active, setActive] = React.useState(false);

  function handleChange() {
    setActive(!active);
  }

  return (
    <>

        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "0px" : "125px",
            fontSize: active ? "0em" : "1em",
            padding: active ? "0px" : "2px 4px 2px 4px",
            transitionDelay: active ? "300ms" : "0ms",
          }}
          onClick={handleChange}
        >
          Create Team
        </button>

        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "0px" : "125px",
            fontSize: active ? "0em" : "1em",
            padding: active ? "0px" : "2px 4px 2px 4px",
            transitionDelay: active ? "0ms" : "300ms",
          }}
          onClick={handleChange}
        >
          Join Team
        </button>
        <input
          type="text"
          id="first_name"
          class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 testtransition"
          placeholder="Enter Team Code"
          required
          style={{
            width: active ? "350px" : "0px",
            fontSize: active ? "1em" : "0em",
            padding: active ? "2px 4px 2px 4px" : "0px",
            borderWidth: active ? "1px" : "0px",
            transitionDelay: active ? "0ms" : "600ms",
          }}
        ></input>
        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "125px" : "0px",
            fontSize: active ? "1em" : "0em",
            padding: active ? "2px 4px 2px 4px" : "0px",
            transitionDelay: active ? "300ms" : "300ms",
          }}
          onClick={handleChange}
        >
          Join
        </button>
        <button
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded testtransition"
          style={{
            width: active ? "125px" : "0px",
            fontSize: active ? "1em" : "0em",
            padding: active ? "2px 4px 2px 4px" : "0px",
            transitionDelay: active ? "600ms" : "0ms",
          }}
          onClick={handleChange}
        >
          Cancel
        </button>

    </>
  );
}

ReactDOM.render(<Test />, document.getElementById('app'));

`


问:
How to solve the error reported by installing pytorch on the Raspberry Pi?
ERROR Image

At the beginning, the Raspberry Pi environment was 3.9.2 (armv7l).

After searching the Internet, pytorch found that it only supports 3.8; after installing the conda environment, install pytorch under the (py36) python version 3.6.6; but as shown in the picture,
it can't Install.

Is there anyone on the forum who has encountered this problem and solved it?

Thanks.

At the beginning, when installing pytorch according to the official process, it will report that /home/pi/pytorch/third_party/eigen lacks the extraction file and cannot be installed.

After finding and installing the pytorch.whl file on the Internet and reporting an error, try to install the conda environment; but in conda Environment can't be installed.

Off topic, my second question is if I go to train mobilenet SSD v2 after success, can I directly use the lens for visual recognition?

Before using the public mobilenet to detect, the number of frames was only about 4.4. Later, because I felt that the FPS was too low, I wanted to train mibilenet by myself.

How about someone who has used Raspberry Pi to use FPS after training? If the FPS is too low, is it better to use NVIDIA Jetson Nano for training and detection?


问:
Can you continue execution without redis when the redis server is down?
I have a java spring boot api rest service.
I put in this service some annotations to cache methods @Cacheable @CachePut @CacheEvict..
We want to continue execution of these methods when redis server is down without cache.

Is there any way through some method or parameter to configure, to tell the service to continue without cache?


问:
How to make my android webview to fit contents or adapt width as my browser does?

My browser fits the contents of my website accurately on all devices but the android webview does exactly the opposite. Please help me to make the android webview adapt width . by changing or adding a few lines in my mainactivity.k file.

i tried changing  the user agent of the webview app. but it gave me no results.


问:
How to create a nested select query along with foreach
Consider the table named school

I am trying to create a MyBatis Query with the below conditions

1. If the teacher value is not null

Get the top 2 rows of that teacher, sorted on the basis of created_time

2. If the teacher value is null

Get all the data from the table "school" in such a way that the top two rows of each teacher is obtained, which are sorted on the basis of created_time

The result should be:

The MyBatis query I tried is :

I have created a List<String> of teachers and tried to get the rows using for each, but this didn't work

```<code>@Select({"<script>", "SELECT", " * ", "FROM school a ",
            "WHERE"
            "<if test=\"teacher != null\"> a.teacher = #{teacher} </if>",
            "<if test=\"teacher == null\">",
            "<foreach collection='teacherList' item='t' index='i' open=' AND a.teacher IN (' separator=',' close=')'>",
            "<script>",
            "SELECT teacher FROM school WHERE teacher=#{t}",
            "</foreach>",
            "</script>",
            "</if>" +
            "ORDER BY created_time DESC",
            "LIMIT #{size}",
            "</script>"})
</code>```

Body:
Consider the table named school

I am trying to create a MyBatis Query with the below conditions

1. If the teacher value is not null

Get the top 2 rows of that teacher, sorted on the basis of created_time

2. If the teacher value is null

Get all the data from the table "school" in such a way that the top two rows of each teacher is obtained, which are sorted on the basis of created_time

The result should be:

The MyBatis query I tried is :

I have created a List<String> of teachers and tried to get the rows using for each, but this didn't work

@Select({"",
            "</if>" +
            "ORDER BY created_time DESC",
            "LIMIT #{size}",
            "</script>"})


问:
Hi all #lwc Updating field in custom object on uploading Excel
The requirement is we have to update custom field on uploading excel file.

For this We have created a lwc component (action button) that upload file, this file getting into file object till here all okay  but how to attach this file from file object(we need to fetch reference id( LinkedEntityId )) to custom object so that we can update field? and also can we try using Screen flow


问:
Is is possible to create a captive portal using CoovaChilli that doesn't need a login
This is my first time creating a captive portal and I'm exploring how to do it using CoovaChilli. I'm trying to create a welcome page with instructions on how to access the main webpage/file for those accessing our network without the need to login. I just want to place a continue/close button. Is this possible? Or is there another way to create a welcome page for those connecting to our network without needing a captive portal? Thank you so much!

For now i think I have successfully installed CoovaChilli. I'm still in the process of learning about it and about the other requirements like RADIUS. I'm just wondering if what I want to do is possible with what I'm studying or if there's another, more efficient way to create a welcome page. Thank you!