问:
can't consider radius of different angles in imageview
I'm facing a problem with the background in imageview. I have 2 drawable shapes as follows:

type_1 is:

```<code><?xml version="1.0" encoding="utf-8"?>
<shape
    android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="@dimen/dp24"/>
</shape>
</code>```

and the type_2 form:

```<code><?xml version="1.0" encoding="utf-8"?>
<shape
    android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <corners
        android:topRightRadius="@dimen/dp4"
        android:bottomRightRadius="@dimen/dp4"
        android:topLeftRadius="20dp"
        android:bottomLeftRadius="20dp"/>
</shape>
</code>```

it looks basically the same, i want to see it in java code with setBackgroundResource(R.drawable.bg_type_1);
it worked fine, the corners are all radius,here is the result. But when i consider type 2 what i get is this. I want the radius of the corners to look similar like this Can someone explain to me why and how to solve it, I load with Glide. Thank you all for reading, any help is greatly appreciated.

Body:
I'm facing a problem with the background in imageview. I have 2 drawable shapes as follows:

type_1 is:

<?xml version="1.0" encoding="utf-8"?>
<shape
    android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="@dimen/dp24"/>
</shape>

and the type_2 form:

<?xml version="1.0" encoding="utf-8"?>
<shape
    android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <corners
        android:topRightRadius="@dimen/dp4"
        android:bottomRightRadius="@dimen/dp4"
        android:topLeftRadius="20dp"
        android:bottomLeftRadius="20dp"/>
</shape>

it looks basically the same, i want to see it in java code with setBackgroundResource(R.drawable.bg_type_1);
it worked fine, the corners are all radius,here is the result. But when i consider type 2 what i get is this. I want the radius of the corners to look similar like this Can someone explain to me why and how to solve it, I load with Glide. Thank you all for reading, any help is greatly appreciated.


来源: stackexchange

问:
Laravel 9: Delete() brings an error League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, array given
I am using Filepond package to handle image uploads (multiple). When I want to delete a record with the attachments (images) I get this error:

This is the destroy method in the controller:

```<code>    /**
     * Delete Record from database.
     */
    public function destroy(Report $report)
    {
        $report->delete();
        return back()->with('success', 'Report deleted successfully');
    }
</code>```

and the delete is handled in the model like so:

```<code>// Delete record
    public function delete()
    {
        // handle deleting storage etc
        if(Storage::exists($this->attachments))
        {
            Storage::delete($this->attachments);
        }

        parent::delete();
    }
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am using Filepond package to handle image uploads (multiple). When I want to delete a record with the attachments (images) I get this error:

This is the destroy method in the controller:

    /**
     * Delete Record from database.
     */
    public function destroy(Report $report)
    {
        $report->delete();
        return back()->with('success', 'Report deleted successfully');
    }

and the delete is handled in the model like so:

// Delete record
    public function delete()
    {
        // handle deleting storage etc
        if(Storage::exists($this->attachments))
        {
            Storage::delete($this->attachments);
        }

        parent::delete();
    }


问:
Blazor file not opening
I have created a .razor file and have entered some code in the file.
I am unable to open the file and get an error as displayed below:

After I press enter I get the following:

Is there a way to repair the .razor file?

Title: Blazor file not opening


问:
How to export blogger with a big file to wordpress
I have an XML file exported from blogger with ~120MB, want to import it to wordpress.

It doesn't work, using the default blogger import in wordpress. Tried Using different plugins (All import, Blogger Importer...) many of them give an error while others complete the import but at the end nothing is found in wordpress.

Is there any solution? Even the algorithm that changes blogger XML to wordpress format would be good, or the code in any language (python, C, Java,..) So i would convert the file locally then upload it into wordpress.


问:
Can not start docker compose on win 11
I have a docker compose on Win 11.
When I start it, it has an error which does not exist on ubuntu

Error response from daemon: failed to mount local volume: mount c/Work/Docker/mycode:/var/lib/docker/volumes/docker_dir-site/_data: no such device```</p>
```version: "3"
services:
  xtlab-apache:
    image: "httpd:version2"
    container_name: c-httpd01
    restart: always
    hostname: httpd01
    networks:
      - my-network
    ports:
      - "8080:80"
      - "443:443"
    volumes:
      - dir-site:/home/sites/
  xtlab-php:
    image: "php:version2"
    container_name: php-product
    hostname: php01
    restart: always
    networks:
      - my-network
    volumes:
      - dir-site:/home/sites/
networks:
  my-network:
    driver: bridge
volumes:
  dir-site:
    driver_opts:
      type: none
      device: /c/Work/Docker/mycode
      o: bind

```
```I config docker on WSL2.
I find out some idea to share driver, but it still does not work. Something is not problem when I work docker on ubuntu
```

Title: Can not start docker compose on win 11

Body:
I have a docker compose on Win 11.
When I start it, it has an error which does not exist on ubuntu

Error response from daemon: failed to mount local volume: mount c/Work/Docker/mycode:/var/lib/docker/volumes/docker_dir-site/_data: no such device```

version: "3"
services:
  xtlab-apache:
    image: "httpd:version2"
    container_name: c-httpd01
    restart: always
    hostname: httpd01
    networks:
      - my-network
    ports:
      - "8080:80"
      - "443:443"
    volumes:
      - dir-site:/home/sites/
  xtlab-php:
    image: "php:version2"
    container_name: php-product
    hostname: php01
    restart: always
    networks:
      - my-network
    volumes:
      - dir-site:/home/sites/
networks:
  my-network:
    driver: bridge
volumes:
  dir-site:
    driver_opts:
      type: none
      device: /c/Work/Docker/mycode
      o: bind

I config docker on WSL2.
I find out some idea to share driver, but it still does not work. Something is not problem when I work docker on ubuntu


问:
PERN STACK - Connect to Database dynamically
I'm working on project in PERN STACK and I need to connect 2 different databases simultaneously..

I created 1 pool for the source DB then when user login to the system I take the credentials and connect him to another DB.

The 1st DB is global for all users

the 2nd DB is per customer dynamically

```<code>require("dotenv").config()

const { Pool } = require('pg')

const vam = new Pool({
  user: process.env.db_user,
  host: process.env.db_host,
  database: 'vam',
  password: process.env.db_password,
  port: process.env.db_port,
})

const anotherDB = new Pool({
  user: process.env.db_user,
  host: process.env.db_host,
  database: 'Here I need to bring the data from the user..',
  password: process.env.db_password,
  port: process.env.db_port,
})

module.exports = {
  query: (text, params) => pool.query(text, params),
}
</code>```

I've main file for server.js and another file for manage the connection to PostgreSQL.

Thank you for your time :)

Body:
I'm working on project in PERN STACK and I need to connect 2 different databases simultaneously..

I created 1 pool for the source DB then when user login to the system I take the credentials and connect him to another DB.

The 1st DB is global for all users

the 2nd DB is per customer dynamically

require("dotenv").config()

const { Pool } = require('pg')

const vam = new Pool({
  user: process.env.db_user,
  host: process.env.db_host,
  database: 'vam',
  password: process.env.db_password,
  port: process.env.db_port,
})

const anotherDB = new Pool({
  user: process.env.db_user,
  host: process.env.db_host,
  database: 'Here I need to bring the data from the user..',
  password: process.env.db_password,
  port: process.env.db_port,
})

module.exports = {
  query: (text, params) => pool.query(text, params),
}

I've main file for server.js and another file for manage the connection to PostgreSQL.

Thank you for your time :)


问:
Failed to load function definition from source: Failed to generate manifest from function source
I am trying to deploy the following code in firebase function but getting the following error :

```<code>Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Counter already defined for field "notification_id"
</code>```

When removing the notification_id the deployment is taking place successfully but as soon as I add notification_id it shows the error.

If someone can please help me resolve this issue.

node.js

```<code>const mongoose = require('mongoose');
const AutoIncrement = require('mongoose-sequence')(mongoose);

const userProjectSurveySchema = new mongoose.Schema({
    userId:
    {
        type: Number,
        required: true,
        trim: true
    },
    notification_id:
    {
        type: Number,
    },
    notification_type:
    {
        type: Number,
        required: true,

    },
    status:
    {
         type: String,
         required: true
    },

    questions: [
        {
            qn: {
            type: String,
            required: true
        },
        options: [
            {
                option: {
                    type: String
                },
                totalViews: {
                    type:Number
                }

             }
    ]
    },
    ],
    created_at:  {
    type: Date,
    required: true,
    default: Date.now(),
},

});

userProjectSurveySchema.plugin(AutoIncrement, {inc_field: 'notification_id'});

module.exports = mongoose.model('UserProjectSurveyDetails', userProjectSurveySchema);
</code>```

Body:
I am trying to deploy the following code in firebase function but getting the following error :

Error: Failed to load function definition from source: Failed to generate manifest from function source: Error: Counter already defined for field "notification_id"

When removing the notification_id the deployment is taking place successfully but as soon as I add notification_id it shows the error.

If someone can please help me resolve this issue.

node.js

const mongoose = require('mongoose');
const AutoIncrement = require('mongoose-sequence')(mongoose);

const userProjectSurveySchema = new mongoose.Schema({
    userId:
    {
        type: Number,
        required: true,
        trim: true
    },
    notification_id:
    {
        type: Number,
    },
    notification_type:
    {
        type: Number,
        required: true,

    },
    status:
    {
         type: String,
         required: true
    },

    questions: [
        {
            qn: {
            type: String,
            required: true
        },
        options: [
            {
                option: {
                    type: String
                },
                totalViews: {
                    type:Number
                }

             }
    ]
    },
    ],
    created_at:  {
    type: Date,
    required: true,
    default: Date.now(),
},

});

userProjectSurveySchema.plugin(AutoIncrement, {inc_field: 'notification_id'});

module.exports = mongoose.model('UserProjectSurveyDetails', userProjectSurveySchema);


问:
How to pass returnUrl to Azure B2C using Owin Middleware
I'm using asp.net MVC with Owin middleware to integrate with Azure B2C using authorization code flow.

I need to somehow retain the returnUrl so that upon successful login, user is redirected to requested page per returnURL.

I've tried below but SecurityTokenValidatedNotification.ProtocolMessage.State is NULL on OnSecurityTokenValidated notification.

```<code>  private Task OnRedirectToIdentityProvider(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
    {
        // only modify requests to the authorization endpoint
        if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication)
        {
            var stateQueryString = notification.ProtocolMessage.State.Split('=');
            var protectedState = stateQueryString[1];
            var state = notification.Options.StateDataFormat.Unprotect(protectedState);
            state.Dictionary.Add("mycustomparameter", "myvalue");
            notification.ProtocolMessage.State = stateQueryString[0] + "=" + notification.Options.StateDataFormat.Protect(state);
        }

        return Task.FromResult(0);
    }
private async Task OnAuthorizationCodeReceived(AuthorizationCodeReceivedNotification nofication)
    {
        // only when authorization code is being swapped for tokens
        if (nofication.TokenEndpointRequest?.GrantType == OpenIdConnectGrantTypes.AuthorizationCode)
        {

            var authority = "xxx";
            try
            {
                var confidentialClient = ConfidentialClientApplicationBuilder.Create(ConfigurationManager.AppSettings["ClientId"].ToString())
                .WithClientSecret("xxxx")
                .WithB2CAuthority(authority)
                .WithRedirectUri(ConfigurationManager.AppSettings["redirectUri"].ToString())
                .Build();

                var result = await confidentialClient.AcquireTokenByAuthorizationCode(new[] { string.Format("{0} {1}",clientId,OpenIdConnectScope.OfflineAccess) }, code)
                .WithSpaAuthorizationCode()
                .WithPkceCodeVerifier("ff38b3685b613c1d461ac0c5624baddf3d4243cf0d61f135abfa164c")
                .ExecuteAsync();

                nofication.HandleCodeRedemption(result.AccessToken, result.IdToken);

            }
            catch (Exception ex)
            {
               // Log.Error("Azure B2C Authorization Code Received Method. " + ex, nameof(bla));
                throw ex;
            }
        }

 private Task OnSecurityTokenValidated(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
    {
        string mycustomparameter;
        //THIS LINE THROWS NULL EXCEPTION GIVEN ProtocolMessage.State is NULL
        var protectedState = notification.ProtocolMessage.State.Split('=')[1];
        var state = notification.Options.StateDataFormat.Unprotect(protectedState);
        state.Dictionary.TryGetValue("mycustomparameter", out mycustomparameter);

        return Task.CompletedTask;

    }
</code>```

Observations:

I can only get ProtocolMessage.State value if I use ResponseType idtoken or CodeIdToken

Any idea on how to pass returnUrl to azure b2c and get it back when using authorization code flow with OWIN.

Body:
I'm using asp.net MVC with Owin middleware to integrate with Azure B2C using authorization code flow.

I need to somehow retain the returnUrl so that upon successful login, user is redirected to requested page per returnURL.

I've tried below but SecurityTokenValidatedNotification.ProtocolMessage.State is NULL on OnSecurityTokenValidated notification.

  private Task OnRedirectToIdentityProvider(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
    {
        // only modify requests to the authorization endpoint
        if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication)
        {
            var stateQueryString = notification.ProtocolMessage.State.Split('=');
            var protectedState = stateQueryString[1];
            var state = notification.Options.StateDataFormat.Unprotect(protectedState);
            state.Dictionary.Add("mycustomparameter", "myvalue");
            notification.ProtocolMessage.State = stateQueryString[0] + "=" + notification.Options.StateDataFormat.Protect(state);
        }

        return Task.FromResult(0);
    }
private async Task OnAuthorizationCodeReceived(AuthorizationCodeReceivedNotification nofication)
    {
        // only when authorization code is being swapped for tokens
        if (nofication.TokenEndpointRequest?.GrantType == OpenIdConnectGrantTypes.AuthorizationCode)
        {

            var authority = "xxx";
            try
            {
                var confidentialClient = ConfidentialClientApplicationBuilder.Create(ConfigurationManager.AppSettings["ClientId"].ToString())
                .WithClientSecret("xxxx")
                .WithB2CAuthority(authority)
                .WithRedirectUri(ConfigurationManager.AppSettings["redirectUri"].ToString())
                .Build();

                var result = await confidentialClient.AcquireTokenByAuthorizationCode(new[] { string.Format("{0} {1}",clientId,OpenIdConnectScope.OfflineAccess) }, code)
                .WithSpaAuthorizationCode()
                .WithPkceCodeVerifier("ff38b3685b613c1d461ac0c5624baddf3d4243cf0d61f135abfa164c")
                .ExecuteAsync();

                nofication.HandleCodeRedemption(result.AccessToken, result.IdToken);

            }
            catch (Exception ex)
            {
               // Log.Error("Azure B2C Authorization Code Received Method. " + ex, nameof(bla));
                throw ex;
            }
        }

 private Task OnSecurityTokenValidated(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
    {
        string mycustomparameter;
        //THIS LINE THROWS NULL EXCEPTION GIVEN ProtocolMessage.State is NULL
        var protectedState = notification.ProtocolMessage.State.Split('=')[1];
        var state = notification.Options.StateDataFormat.Unprotect(protectedState);
        state.Dictionary.TryGetValue("mycustomparameter", out mycustomparameter);

        return Task.CompletedTask;

    }

Observations:

I can only get ProtocolMessage.State value if I use ResponseType idtoken or CodeIdToken

Any idea on how to pass returnUrl to azure b2c and get it back when using authorization code flow with OWIN.


问:
Receiving objects in springboot using the PAYPAL REST API
My first attempt to integrate PAYPAL into JAVA. But it seems that PAYPAL has recently archived many of its API libraries. Well, I tried to follow the tutorial at https://developer.paypal.com/api/rest/webhooks/

If you need the official example code in here, it in the end.

Note: I can't debug it in local tests, so I use ngrok to simulate HTTPS.

And there i got a false response

```<code>      Boolean result = Event.validateReceivedEvent(apiContext,getHeadersInfo(req), getBody(req));
</code>```

How should I extract payload it, I mean I didn't find a subscription or order or customer class to get the response data. Am I missing something?

```<code>package com.paypal.api.payments.servlet;
import com.paypal.api.payments.CreditCard;
import com.paypal.api.payments.Event;
import com.paypal.api.payments.util.ResultPrinter;
import com.paypal.base.Constants;
import com.paypal.base.rest.APIContext;
import com.paypal.base.rest.PayPalRESTException;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import static com.paypal.api.payments.util.SampleConstants.*;
public class ValidateWebhookServlet extends HttpServlet {
  private static final long serialVersionUID = 1 L;
  private static final Logger LOGGER = Logger.getLogger(ValidateWebhookServlet.class);
  public static final String WebhookId = "4JH86294D6297924G";
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
  throws ServletException, IOException {
    doPost(req, resp);
  }
  // ##Validate Webhook
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
  throws ServletException, IOException {
    try {
      // ### Api Context
      APIContext apiContext = new APIContext(clientID, clientSecret, mode);
      // Set the webhookId that you received when you created this webhook.
      apiContext.addConfiguration(Constants.PAYPAL_WEBHOOK_ID, WebhookId);
      Boolean result = Event.validateReceivedEvent(apiContext, getHeadersInfo(
        req), getBody(req));
      System.out.println("Result is " + result);
      LOGGER.info("Webhook Validated:  " + result);
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        CreditCard.getLastResponse(), null);
    } catch (PayPalRESTException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    } catch (InvalidKeyException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    } catch (NoSuchAlgorithmException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    } catch (SignatureException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    }
  }
  // Simple helper method to help you extract the headers from HttpServletRequest object.
  private static Map < String, String > getHeadersInfo(HttpServletRequest request) {
    Map < String, String > map = new HashMap < String, String > ();
    @SuppressWarnings("rawtypes")
    Enumeration headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
      String key = (String) headerNames.nextElement();
      String value = request.getHeader(key);
      map.put(key, value);
    }
    return map;
  }
  // Simple helper method to fetch request data as a string from HttpServletRequest object.
  private static String getBody(HttpServletRequest request) throws IOException {
    String body;
    StringBuilder stringBuilder = new StringBuilder();
    BufferedReader bufferedReader = null;
    try {
      InputStream inputStream = request.getInputStream();
      if (inputStream != null) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        char[] charBuffer = new char[128];
        int bytesRead = -1;
        while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
          stringBuilder.append(charBuffer, 0, bytesRead);
        }
      } else {
        stringBuilder.append("");
      }
    } catch (IOException ex) {
      throw ex;
    } finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        } catch (IOException ex) {
          throw ex;
        }
      }
    }
    body = stringBuilder.toString();
    return body;
  }
}
</code>```

Body:
My first attempt to integrate PAYPAL into JAVA. But it seems that PAYPAL has recently archived many of its API libraries. Well, I tried to follow the tutorial at https://developer.paypal.com/api/rest/webhooks/

If you need the official example code in here, it in the end.

Note: I can't debug it in local tests, so I use ngrok to simulate HTTPS.

And there i got a false response

      Boolean result = Event.validateReceivedEvent(apiContext,getHeadersInfo(req), getBody(req));

How should I extract payload it, I mean I didn't find a subscription or order or customer class to get the response data. Am I missing something?

package com.paypal.api.payments.servlet;
import com.paypal.api.payments.CreditCard;
import com.paypal.api.payments.Event;
import com.paypal.api.payments.util.ResultPrinter;
import com.paypal.base.Constants;
import com.paypal.base.rest.APIContext;
import com.paypal.base.rest.PayPalRESTException;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import static com.paypal.api.payments.util.SampleConstants.*;
public class ValidateWebhookServlet extends HttpServlet {
  private static final long serialVersionUID = 1 L;
  private static final Logger LOGGER = Logger.getLogger(ValidateWebhookServlet.class);
  public static final String WebhookId = "4JH86294D6297924G";
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
  throws ServletException, IOException {
    doPost(req, resp);
  }
  // ##Validate Webhook
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
  throws ServletException, IOException {
    try {
      // ### Api Context
      APIContext apiContext = new APIContext(clientID, clientSecret, mode);
      // Set the webhookId that you received when you created this webhook.
      apiContext.addConfiguration(Constants.PAYPAL_WEBHOOK_ID, WebhookId);
      Boolean result = Event.validateReceivedEvent(apiContext, getHeadersInfo(
        req), getBody(req));
      System.out.println("Result is " + result);
      LOGGER.info("Webhook Validated:  " + result);
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        CreditCard.getLastResponse(), null);
    } catch (PayPalRESTException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    } catch (InvalidKeyException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    } catch (NoSuchAlgorithmException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    } catch (SignatureException e) {
      LOGGER.error(e.getMessage());
      ResultPrinter.addResult(req, resp, "Webhook Validated:  ", CreditCard.getLastRequest(),
        null, e.getMessage());
    }
  }
  // Simple helper method to help you extract the headers from HttpServletRequest object.
  private static Map < String, String > getHeadersInfo(HttpServletRequest request) {
    Map < String, String > map = new HashMap < String, String > ();
    @SuppressWarnings("rawtypes")
    Enumeration headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
      String key = (String) headerNames.nextElement();
      String value = request.getHeader(key);
      map.put(key, value);
    }
    return map;
  }
  // Simple helper method to fetch request data as a string from HttpServletRequest object.
  private static String getBody(HttpServletRequest request) throws IOException {
    String body;
    StringBuilder stringBuilder = new StringBuilder();
    BufferedReader bufferedReader = null;
    try {
      InputStream inputStream = request.getInputStream();
      if (inputStream != null) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        char[] charBuffer = new char[128];
        int bytesRead = -1;
        while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
          stringBuilder.append(charBuffer, 0, bytesRead);
        }
      } else {
        stringBuilder.append("");
      }
    } catch (IOException ex) {
      throw ex;
    } finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        } catch (IOException ex) {
          throw ex;
        }
      }
    }
    body = stringBuilder.toString();
    return body;
  }
}


问:
Providing a unique ID when writing a Linux kernel driver
I've written an I2C driver.  The chip can provide a unique ID.

Is there a generic way of providing chip UIDs to userspace?

Or should I just create /sys/mydriver/uid and call it a day?


问:
Getting "No current user" from aws-amplify and Cognito in react native
I am getting error saying "No current user" from aws-amplify if a user try to verify email after successful Sign Up.

I am trying to verify email and then fetch token from aws Auth to save in global state from Auth.currentSession(). And, this throws this error.

My Code:

```<code>import { Auth } from "aws-amplify";

try {
      setLoading(true);
await Auth.confirmSignUp(username, code); // email confirm

const token = (await Auth.currentSession())
        .getAccessToken()
        .getJwtToken();

}catch(err){
 console.log(err);  // error
}

</code>```

Error:  LOG  No current user

Sometimes, I don't get this error.

Why I am getting this error? And How can I solve it?

Body:
I am getting error saying "No current user" from aws-amplify if a user try to verify email after successful Sign Up.

I am trying to verify email and then fetch token from aws Auth to save in global state from Auth.currentSession(). And, this throws this error.

My Code:

import { Auth } from "aws-amplify";

try {
      setLoading(true);
await Auth.confirmSignUp(username, code); // email confirm

const token = (await Auth.currentSession())
        .getAccessToken()
        .getJwtToken();

}catch(err){
 console.log(err);  // error
}

Error:  LOG  No current user

Sometimes, I don't get this error.

Why I am getting this error? And How can I solve it?


问:
Need Encryption usage in Google Maps iOS SDK for Apple Appstore connect declaration
We are using GoogleMaps Framework, GoogleMapsBase Framework, GoogleMapsCore Framework, GooglePlaces Frameworks in our iOS app.

Apple requires us to declare the encryption that we are using inside our app, while submitting the app to App store. Since our iOS app uses the above Google frameworks, we need to declare any encryption(s) (if being used inside the SDK) to the Apple in App store.

https://help.apple.com/app-store-connect/#/devc3f64248f

How to know, what all encryptions are being used in GMaps and how to contact the GMaps team about this? any suggestions?


问:
Implementing web socket channel on flutter and getting Bad state : stream has already been listened when calling the event again
I am facing the issue described above when I am calling the bloc after the app resumes from an inactive state, so that I get a fresh data stream from the websocket.

I have shared my code block with most of the instructions.

The problem is somewhere in subscription management of the websocket stream, I have tried a lot, but I am blocked at some point and couldn't proceed further

```<code>///Important///
///---packages needed
///web_socket_channel
///flutter_bloc
///---for multi bloc provider
///BlocProvider(create: (context) => SampleStreamBloc()),
///---reproduce the issue
///call the bloc with event as below from more than one screen
///context.read<SampleStreamBloc>().add(SampleStreamConnect());

import 'dart:convert';
import 'dart:developer';

import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:web_socket_channel/io.dart';

IOWebSocketChannel channelStocks = IOWebSocketChannel.connect(Uri.parse('wss://ws.eodhistoricaldata.com/ws/forex?api_token=demo'));

class SampleStreamBloc extends Bloc<SampleStreamEvent, SampleStreamState> {
  SampleStreamBloc() : super(SampleStreamInitial()) {

    //event for listening from socket
    on<SampleStreamConnect>((event, emit) async {
      emit(SampleStreamProgress());
      await emit.forEach(channelStocks.stream, onData: ((data) {
        Map<String, dynamic> message = jsonDecode(data);
        log(message.toString(), name: "Stream Response");
        if (message['message'] == "Authorized") {
          var data = jsonEncode({"action": "subscribe", "symbols": "EURUSD"});
          channelStocks.sink.add(data);
        }
        return SampleStreamSuccess();
      }), onError: (e, stackTrace) {
        log(e.toString(), error: e, stackTrace: stackTrace);
        return SampleStreamSuccess();
      });
    });
  }
}

//states
abstract class SampleStreamState {}

//events
abstract class SampleStreamEvent {}

//states implementation
class SampleStreamInitial extends SampleStreamState {}

class SampleStreamProgress extends SampleStreamState {}

class SampleStreamSuccess extends SampleStreamState {}

//events implementation
class SampleStreamConnect extends SampleStreamEvent {}

</code>```

And shared the error too.

Body:
I am facing the issue described above when I am calling the bloc after the app resumes from an inactive state, so that I get a fresh data stream from the websocket.

I have shared my code block with most of the instructions.

The problem is somewhere in subscription management of the websocket stream, I have tried a lot, but I am blocked at some point and couldn't proceed further

///Important///
///---packages needed
///web_socket_channel
///flutter_bloc
///---for multi bloc provider
///BlocProvider(create: (context) => SampleStreamBloc()),
///---reproduce the issue
///call the bloc with event as below from more than one screen
///context.read<SampleStreamBloc>().add(SampleStreamConnect());

import 'dart:convert';
import 'dart:developer';

import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:web_socket_channel/io.dart';

IOWebSocketChannel channelStocks = IOWebSocketChannel.connect(Uri.parse('wss://ws.eodhistoricaldata.com/ws/forex?api_token=demo'));

class SampleStreamBloc extends Bloc<SampleStreamEvent, SampleStreamState> {
  SampleStreamBloc() : super(SampleStreamInitial()) {

    //event for listening from socket
    on<SampleStreamConnect>((event, emit) async {
      emit(SampleStreamProgress());
      await emit.forEach(channelStocks.stream, onData: ((data) {
        Map<String, dynamic> message = jsonDecode(data);
        log(message.toString(), name: "Stream Response");
        if (message['message'] == "Authorized") {
          var data = jsonEncode({"action": "subscribe", "symbols": "EURUSD"});
          channelStocks.sink.add(data);
        }
        return SampleStreamSuccess();
      }), onError: (e, stackTrace) {
        log(e.toString(), error: e, stackTrace: stackTrace);
        return SampleStreamSuccess();
      });
    });
  }
}

//states
abstract class SampleStreamState {}

//events
abstract class SampleStreamEvent {}

//states implementation
class SampleStreamInitial extends SampleStreamState {}

class SampleStreamProgress extends SampleStreamState {}

class SampleStreamSuccess extends SampleStreamState {}

//events implementation
class SampleStreamConnect extends SampleStreamEvent {}

And shared the error too.


问:
share file from file system to external user
I want to create a link to share a file from devextreme file manager to any user (similar to google drive, can get a link and share that with anybody) in ASP.NET MVC application

Can I use GoogleDriveFileSystemProvider for file sharing?


Title: Time series: Why does this data have seasonality on periods where observed values are zero

Body:
I'm a novice to time series and am using seasonal_decompose() to split a time series into three components: trend, seasonality, and residuals as below:

As shown in the observed value at the top, most of the values are 0 except for some periods in year 2020 and 2021. However, the seasonal plot shows the same recurring pattern of seasonality across "all" years, not for periods where the observed values are non-zero.

I'm confused as to:

why there is a seasonality in years 2016 - 2019 where observed values are 0

why the seasonality has the same recurring pattern across all years.

Here is the reproducible data for your reference:

import pandas as pd
from statsmodels.tsa.seasonal import seasonal_decompose

bb_dict = {'YYYY-MM': {0: '2016-01',
  1: '2016-02',
  2: '2016-03',
  3: '2016-04',
  4: '2016-05',
  5: '2016-06',
  6: '2016-07',
  7: '2016-08',
  8: '2016-09',
  9: '2016-10',
  10: '2016-11',
  11: '2016-12',
  12: '2017-01',
  13: '2017-02',
  14: '2017-03',
  15: '2017-04',
  16: '2017-05',
  17: '2017-06',
  18: '2017-07',
  19: '2017-08',
  20: '2017-09',
  21: '2017-10',
  22: '2017-11',
  23: '2017-12',
  24: '2018-01',
  25: '2018-02',
  26: '2018-03',
  27: '2018-04',
  28: '2018-05',
  29: '2018-06',
  30: '2018-07',
  31: '2018-08',
  32: '2018-09',
  33: '2018-10',
  34: '2018-11',
  35: '2018-12',
  36: '2019-01',
  37: '2019-02',
  38: '2019-03',
  39: '2019-04',
  40: '2019-05',
  41: '2019-06',
  42: '2019-07',
  43: '2019-08',
  44: '2019-09',
  45: '2019-10',
  46: '2019-11',
  47: '2019-12',
  48: '2020-01',
  49: '2020-02',
  50: '2020-03',
  51: '2020-04',
  52: '2020-05',
  53: '2020-06',
  54: '2020-07',
  55: '2020-08',
  56: '2020-09',
  57: '2020-10',
  58: '2020-11',
  59: '2020-12',
  60: '2021-01',
  61: '2021-02',
  62: '2021-03',
  63: '2021-04',
  64: '2021-05',
  65: '2021-06',
  66: '2021-07',
  67: '2021-08',
  68: '2021-09',
  69: '2021-10',
  70: '2021-11',
  71: '2021-12'},
 'DE': {0: 0.0,
  1: 0.0,
  2: 0.0,
  3: 0.0,
  4: 0.0,
  5: 0.0,
  6: 0.0,
  7: 0.0,
  8: 0.0,
  9: 0.0,
  10: 0.0,
  11: 0.0,
  12: 0.0,
  13: 0.0,
  14: 0.0,
  15: 0.0,
  16: 0.0,
  17: 0.0,
  18: 0.0,
  19: 0.0,
  20: 0.0,
  21: 0.0,
  22: 0.0,
  23: 0.0,
  24: 0.0,
  25: 0.0,
  26: 0.0,
  27: 0.0,
  28: 0.0,
  29: 0.0,
  30: 0.0,
  31: 0.0,
  32: 0.0,
  33: 0.0,
  34: 0.0,
  35: 0.0,
  36: 0.0,
  37: 0.0,
  38: 0.0,
  39: 0.0,
  40: 0.0,
  41: 0.0,
  42: 0.0,
  43: 0.0,
  44: 0.0,
  45: 0.0,
  46: 0.0,
  47: 0.0,
  48: 0.0,
  49: 0.0,
  50: 0.0,
  51: 0.0,
  52: 0.0,
  53: 0.0,
  54: -10.31,
  55: -13.85,
  56: -1.79,
  57: 0.0,
  58: 0.0,
  59: 0.0,
  60: 0.0,
  61: 0.0,
  62: 0.0,
  63: 0.0,
  64: 0.0,
  65: -35.82,
  66: -35.52,
  67: -12.02,
  68: -15.44,
  69: -13.17,
  70: 0.0,
  71: 0.0}}

bb = pd.DataFrame.from_dict(bb_dict)
bb['YYYY-MM'] = pd.to_datetime(bb['YYYY-MM'], format='%Y-%m')
bb = bb.set_index('YYYY-MM')

result = seasonal_decompose(bb['DE'], model = 'additive')
result.plot();


问:
How to test IF each cell in array meets criteria and use only values(cells) in same row to compute
I have two problems.

I just realized using averageif on divisions do not give me the correct average value and I have to change the formula in thousands of cells. I cannot use Find and Replace (Ctrl+H) because I have to change multiple different segments withing formula and not all of them are the same formula. (For example, some look for name, some look for size and some look for item#). Is there an efficient way to fix them?

My new formula is getting a bit too complicated for me and I am not sure why it is not returning value for me. What I have on first cell of the array is this:
=IFERROR(IF(INDIRECT("D"&ROW(A1)&"!$M$8:$M$11='750㎖'"),INDIRECT("(60*SUM(D"&ROW(A1)&"!BB8:BB11))/(SUMPRODUCT(D"&ROW(A1)&"!BI8:BI11,D"&ROW(A1)&"!BO8:BO11))")),"")
I used to have this and was working but returning wrong value(obviously cuz I was using AVERAGEIF() for divisions):
=IFERROR(AVERAGEIF(INDIRECT("D"&ROW(A1)&"!$M$8:$M$11"),"=750㎖",INDIRECT("D"&ROW(A1)&"!$BC$8:$BC$11")),"")
Now, after I fixed it, it is not returning any value.

I'm using INDIRECT and ROW to point to different sheets from D1 through D31.
I want it to to (60*(sum of BB))/(sum of BI * sum of BO). (For BB,BI,BO only where D meets criteria on the same row)

Please help my brain is not big enough for so much thinking.

OLD:
=IFERROR(AVERAGEIF(INDIRECT("D"&ROW(A1)&"!$M$8:$M$11"),"=750㎖",INDIRECT("D"&ROW(A1)&"!$BC$8:$BC$11")),"")
NEW:
=IFERROR(IF(INDIRECT("D"&ROW(A1)&"!$M$8:$M$11='750㎖'"),INDIRECT("(60*SUM(D"&ROW(A1)&"!BB8:BB11))/(SUMPRODUCT(D"&ROW(A1)&"!BI8:BI11,D"&ROW(A1)&"!BO8:BO11))")),"")

This is where I got to after tinkering with the formula:
=IF(COUNTIF(INDIRECT("'D"&ROW(A1)&"'!$E$60:$E$63"),"*홈스타*"),(60*SUM(INDIRECT("'D"&ROW(A1)&"'!$BB$60:$BB$63"))/(SUMPRODUCT(INDIRECT("'D"&ROW(A1)&"'!$BI$60:$BI$63"),INDIRECT("'D"&ROW(A1)&"'!$BO$60:$BO$63")))),"")
P.S. This one is from a different cell but it's basically doing the same thing -> Looking for "text","size", or "ERP#" to look up if a product has been manufacturing for Day(1-31) and calculate stuff by pulling up certain numbers from the same day and the same machinary(which is by Row numbers vary from 4-91, in this case 60-63)


问:
Dead-band module not working properly for EPWM1 (TMS320F28335)
I am working on vector control of PMSM. I've got a problem with the dead-band module, and I don't understand what I'm actually doing wrong here. The register setting for EPWM modules 1 and 2 is given as follows:

For EPWM module 1 configuration

```<code>  EPwm1Regs.TBPRD = PERIOD;// Period =  TBCLK counts
  EPwm1Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
  EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
  EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Master module
  EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
  EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module
  EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
  EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
  EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // set actions for EPWM1A
  EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
  EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable Dead-band module
  EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active Hi complementary
  EPwm1Regs.DBFED = DEAD_TIME; //
  EPwm1Regs.DBRED = DEAD_TIME; //
</code>```

For EPWM Module 2 Configuration

```<code>  EPwm2Regs.TBPRD = PERIOD; // Period = 1600 TBCLK counts
  EPwm2Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
  EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
  EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE; // Slave module
  EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
  EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; // sync flow-through
  EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
  EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
  EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm2Regs.AQCTLA.bit.CAU = AQ_SET; // set actions for EPWM2A
  EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR;
  EPwm2Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable Dead-band module
  EPwm2Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active Hi complementary
  EPwm2Regs.DBFED = DEAD_TIME; //
  EPwm2Regs.DBRED = DEAD_TIME; //
</code>```

I'm following an example (3.4) from the technical manual "sprug04a."
the compare values are initially initialized as

```<code>  EPwm1Regs.CMPA.half.CMPA = 0; // adjust duty for output EPWM1A
  EPwm2Regs.CMPA.half.CMPA = 0; // adjust duty for output EPWM2A
</code>```

and compare values are updated in the code like:

```<code>    EPwm1Regs.CMPA.half.CMPA = PERIOD - Sa;
    EPwm2Regs.CMPA.half.CMPA = PERIOD - Sb;

</code>```

where S_ab are the values obtained from modulation technique.

EPWM2 module is working well but EPWM1 isn't working. we are suppose to have EPWM1A complimentary signal across EPWM1B but EPWM1B shows same as EPWM1A. The scope is attached for better understanding.  Need recommendation in this regards.EPWM1A&B EPWM2A&B reference, what should i need to check? as i checked technical manual and example codes but still i didnt get what i am doing wrong. Your suggestions will be valuable in this regards.

Body:
I am working on vector control of PMSM. I've got a problem with the dead-band module, and I don't understand what I'm actually doing wrong here. The register setting for EPWM modules 1 and 2 is given as follows:

For EPWM module 1 configuration

  EPwm1Regs.TBPRD = PERIOD;// Period =  TBCLK counts
  EPwm1Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
  EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
  EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Master module
  EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
  EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module
  EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
  EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
  EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // set actions for EPWM1A
  EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
  EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable Dead-band module
  EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active Hi complementary
  EPwm1Regs.DBFED = DEAD_TIME; //
  EPwm1Regs.DBRED = DEAD_TIME; //

For EPWM Module 2 Configuration

  EPwm2Regs.TBPRD = PERIOD; // Period = 1600 TBCLK counts
  EPwm2Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
  EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
  EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE; // Slave module
  EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
  EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; // sync flow-through
  EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
  EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
  EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
  EPwm2Regs.AQCTLA.bit.CAU = AQ_SET; // set actions for EPWM2A
  EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR;
  EPwm2Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable Dead-band module
  EPwm2Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active Hi complementary
  EPwm2Regs.DBFED = DEAD_TIME; //
  EPwm2Regs.DBRED = DEAD_TIME; //

I'm following an example (3.4) from the technical manual "sprug04a."
the compare values are initially initialized as

  EPwm1Regs.CMPA.half.CMPA = 0; // adjust duty for output EPWM1A
  EPwm2Regs.CMPA.half.CMPA = 0; // adjust duty for output EPWM2A

and compare values are updated in the code like:

    EPwm1Regs.CMPA.half.CMPA = PERIOD - Sa;
    EPwm2Regs.CMPA.half.CMPA = PERIOD - Sb;

where S_ab are the values obtained from modulation technique.

EPWM2 module is working well but EPWM1 isn't working. we are suppose to have EPWM1A complimentary signal across EPWM1B but EPWM1B shows same as EPWM1A. The scope is attached for better understanding.  Need recommendation in this regards.EPWM1A&B EPWM2A&B reference, what should i need to check? as i checked technical manual and example codes but still i didnt get what i am doing wrong. Your suggestions will be valuable in this regards.


Title: Derivatives of the design matrix for a B spline in python

Body:
I am trying to get the derivatives of the basis functions for a B-spline in Python from one of the bigger libraries. This can be done in R using the splines::splineDesign() function as follows:

library(splines)
points <- seq(0.1, .9, length.out = 10)
knots <- c(0, 0, 0, 0, .25, .75, 1, 1, 1, 1)
(X <- splineDesign(knots=knots, x=points))
#R>         [,1]     [,2]    [,3]    [,4]     [,5]   [,6]
#R>  [1,] 0.2160 6.52e-01 0.12622 0.00533 0.00e+00 0.0000
#R>  [2,] 0.0146 6.06e-01 0.34322 0.03594 0.00e+00 0.0000
#R>  [3,] 0.0000 3.74e-01 0.51151 0.11401 7.62e-05 0.0000
#R>  [4,] 0.0000 2.00e-01 0.55374 0.24033 5.65e-03 0.0000
#R>  [5,] 0.0000 9.08e-02 0.49766 0.38070 3.09e-02 0.0000
#R>  [6,] 0.0000 3.09e-02 0.38070 0.49766 9.08e-02 0.0000
#R>  [7,] 0.0000 5.65e-03 0.24033 0.55374 2.00e-01 0.0000
#R>  [8,] 0.0000 7.62e-05 0.11401 0.51151 3.74e-01 0.0000
#R>  [9,] 0.0000 0.00e+00 0.03594 0.34322 6.06e-01 0.0146
#R> [10,] 0.0000 0.00e+00 0.00533 0.12622 6.52e-01 0.2160

# can I get these in Python?
(Xd <- splineDesign(knots=knots, x=points, derivs = 1))
#R>         [,1]     [,2]   [,3]   [,4]     [,5]  [,6]
#R>  [1,] -4.320  1.97333  2.187  0.160  0.00000 0.000
#R>  [2,] -0.717 -2.28280  2.429  0.571  0.00000 0.000
#R>  [3,]  0.000 -2.37860  1.169  1.202  0.00823 0.000
#R>  [4,]  0.000 -1.56741 -0.148  1.570  0.14519 0.000
#R>  [5,]  0.000 -0.92477 -1.044  1.518  0.45070 0.000
#R>  [6,]  0.000 -0.45070 -1.518  1.044  0.92477 0.000
#R>  [7,]  0.000 -0.14519 -1.570  0.148  1.56741 0.000
#R>  [8,]  0.000 -0.00823 -1.202 -1.169  2.37860 0.000
#R>  [9,]  0.000  0.00000 -0.571 -2.429  2.28280 0.717
#R> [10,]  0.000  0.00000 -0.160 -2.187 -1.97333 4.320
(Xdd <- splineDesign(knots=knots, x=points, derivs = 2))
#R>       [,1]    [,2]   [,3]   [,4]    [,5] [,6]
#R>  [1,] 57.6 -72.533  11.73   3.20   0.000  0.0
#R>  [2,] 23.5 -23.230  -6.28   6.04   0.000  0.0
#R>  [3,]  0.0  10.074 -17.19   6.52   0.593  0.0
#R>  [4,]  0.0   8.178 -12.44   1.78   2.489  0.0
#R>  [5,]  0.0   6.281  -7.70  -2.96   4.385  0.0
#R>  [6,]  0.0   4.385  -2.96  -7.70   6.281  0.0
#R>  [7,]  0.0   2.489   1.78 -12.44   8.178  0.0
#R>  [8,]  0.0   0.593   6.52 -17.19  10.074  0.0
#R>  [9,]  0.0   0.000   6.04  -6.28 -23.230 23.5
#R> [10,]  0.0   0.000   3.20  11.73 -72.533 57.6

# illustration that they are derivatives (with some numerical errors due to numerical differentiation)
library(numDeriv)
coefs <- c(.1, .2, .1, .2, .4, .3)
func <- Vectorize(\(x) sum(splineDesign(knots=knots, x=x, outer.ok = TRUE) * coefs))
drop(Xd %*% coefs)
#R>  [1]  0.2133 -0.1712 -0.1152  0.0439  0.1945  0.3367  0.4705  0.5959  0.5853  0.0533
all.equal(sapply(points, \(x) grad(func, x)), drop(Xd %*% coefs))
#R> [1] TRUE
drop(Xdd %*% coefs)
#R>  [1] -6.93 -1.72  1.84  1.74  1.65  1.55  1.46  1.36 -2.90 -9.07
all.equal(sapply(points, \(x) hessian(func, x)), drop(Xdd %*% coefs))
#R> [1] "Mean relative difference: 2.88e-06"

scipy allows you to get the design matrix but not the derivatives of it as far as I gather. You can though evaluate the spline's derivative for given coefficients but I want the derivatives of the basis functions as I need to pass these on to another function. An illustration like the R code is given below.

from scipy.interpolate import BSpline
import numpy as np

np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)})

points = np.linspace(0.1, 0.9, 10)
coefs = [0.1, 0.2, 0.1, 0.2, 0.4, 0.3]
knots = [0, 0, 0, 0, 0.25, 0.75, 1, 1, 1, 1]
b_spline = BSpline(t=knots, c=coefs, k=3)

# can get the design matrix but not the derivatives of it
print(b_spline.design_matrix(x=points, t=knots, k=3).todense())

# this works though
print("f(x) f'(x) and f''(x)")
print(b_spline(points))
print(b_spline(points, nu=1))
print(b_spline(points, nu=2))

The result is

#> [[0.216 0.652 0.126 0.005 0.000 0.000]
#>  [0.015 0.606 0.343 0.036 0.000 0.000]
#>  [0.000 0.374 0.512 0.114 0.000 0.000]
#>  [0.000 0.200 0.554 0.240 0.006 0.000]
#>  [0.000 0.091 0.498 0.381 0.031 0.000]
#>  [0.000 0.031 0.381 0.498 0.091 0.000]
#>  [0.000 0.006 0.240 0.554 0.200 0.000]
#>  [0.000 0.000 0.114 0.512 0.374 0.000]
#>  [0.000 0.000 0.036 0.343 0.606 0.015]
#>  [0.000 0.000 0.005 0.126 0.652 0.216]]
#> f(x) f'(x) and f''(x)
#> [0.166 0.164 0.149 0.146 0.156 0.180 0.216 0.263 0.319 0.352]
#> [0.213 -0.171 -0.115 0.044 0.195 0.337 0.471 0.596 0.585 0.053]
#> [-6.933 -1.719 1.837 1.742 1.647 1.553 1.458 1.363 -2.904 -9.067]

I know that the derivatives can be computed from another B-spline but it would be nice to use a trusted implementation. Is there such an implementation in one of the bigger libraries?

For the record, I think this would be a valid implementation:

from scipy.interpolate import BSpline
import numpy as np
from numpy import typing as npt

np.set_printoptions(formatter={"float": lambda x: "{0:0.3f}".format(x)})

points = np.linspace(0.1, 0.9, 10)
coefs = [0.1, 0.2, 0.1, 0.2, 0.4, 0.3]
knots = [0, 0, 0, 0, 0.25, 0.75, 1, 1, 1, 1]

def _b_spline_deriv_inner(spline: BSpline, deriv_basis: npt.NDArray[np.double]) -> npt.NDArray[np.double]:
    out = np.zeros((deriv_basis.shape[0], deriv_basis.shape[1] - 1))

    for col_index in range(out.shape[1] - 1):
        scale = spline.t[col_index + spline.k + 1] - spline.t[col_index + 1]
        if scale != 0:
            out[:, col_index] = -deriv_basis[:, col_index + 1] / scale

    for col_index in range(1, out.shape[1]):
        scale = spline.t[col_index + spline.k] - spline.t[col_index]
        if scale != 0:
            out[:, col_index] += deriv_basis[:, col_index] / scale

    return spline.k * out

def first_order_deriv(spline: BSpline, points: npt.NDArray[np.double]) -> npt.NDArray[np.double]:
    return _b_spline_deriv_inner(
        spline=spline, deriv_basis=spline.design_matrix(x=points, t=spline.t, k=spline.k - 1).todense()
    )

def second_order_deriv(spline: BSpline, points: npt.NDArray[np.double]) -> npt.NDArray[np.double]:
    deriv_basis = first_order_deriv(
        BSpline(t=spline.t, k=spline.k - 1, c=np.zeros(spline.c.shape[0] + 1)), points=points
    )
    return _b_spline_deriv_inner(spline=spline, deriv_basis=deriv_basis)

print(first_order_deriv(BSpline(t=knots, c=coefs, k=3), points))
print(second_order_deriv(BSpline(t=knots, c=coefs, k=3), points))

Here is the output:

#> [[-4.320 1.973 2.187 0.160 0.000 0.000]
#>  [-0.717 -2.283 2.429 0.571 0.000 0.000]
#>  [-0.000 -2.379 1.169 1.202 0.008 0.000]
#>  [-0.000 -1.567 -0.148 1.570 0.145 0.000]
#>  [-0.000 -0.925 -1.044 1.518 0.451 0.000]
#>  [-0.000 -0.451 -1.518 1.044 0.925 0.000]
#>  [-0.000 -0.145 -1.570 0.148 1.567 0.000]
#> [-0.000 -0.008 -1.202 -1.169 2.379 0.000]
#>  [-0.000 0.000 -0.571 -2.429 2.283 0.717]
#>  [-0.000 0.000 -0.160 -2.187 -1.973 4.320]]
#> [[57.600 -72.533 11.733 3.200 0.000 0.000]
#>  [23.467 -23.230 -6.281 6.044 0.000 0.000]
#>  [0.000 10.074 -17.185 6.519 0.593 0.000]
#>  [0.000 8.178 -12.444 1.778 2.489 0.000]
#>  [0.000 6.281 -7.704 -2.963 4.385 0.000]
#>  [0.000 4.385 -2.963 -7.704 6.281 0.000]
#>  [0.000 2.489 1.778 -12.444 8.178 0.000]
#>  [0.000 0.593 6.519 -17.185 10.074 0.000]
#>  [0.000 -0.000 6.044 -6.281 -23.230 23.467]
#>  [0.000 -0.000 3.200 11.733 -72.533 57.600]]


问:
CSS dedicated to Social Media viewers
Our site appears to we working decently (written with PHP, HTML and CSS) on big and small screens. However, when we link to it on social media (Facebook prominently) the rendering  no longer works as we would like. Is there a way to provide CSS dedicated to social media rendering?</p>

Title: CSS dedicated to Social Media viewers


问:
Catch exception in dynamically added scripts in ReactJs
I have a function that adds an external script dynamically. here is my code

```<code>try {
   const script = document.createElement('script');
   script.src = 'script url';
   script.async = isAsync;
   document.body.appendChild(script);
 } catch(e){
   console.log(e);
 }
</code>```

but when exception occurs in the script, try catch not catching that error. Also my code is inside react error boundary but still my react app crashes on script error. Even error boundary is not catch that error

Body:
I have a function that adds an external script dynamically. here is my code

try {
   const script = document.createElement('script');
   script.src = 'script url';
   script.async = isAsync;
   document.body.appendChild(script);
 } catch(e){
   console.log(e);
 }

but when exception occurs in the script, try catch not catching that error. Also my code is inside react error boundary but still my react app crashes on script error. Even error boundary is not catch that error


问:
How do I collect all elements of a tuple?
Given a tuple:
let t = (1, 2, 3);

How can I collect all values of t into, say a Vec<u8>, without explicitly referencing each item (e.g. t.0)?

It seems I cannot iterate or collect them the way I was expecting.

I was expecting something like this to work:
let v: Vec<u8> = t.collect();

I want to be able to easily extract all values from any tuple, such that if I have a tuple of n elements (of the same type), I can use the same method to get all of them into an iterable.


问:
Can Prometheus Queries be stored and the results be sent further to Grafana?
I am working with creating metrics using Pushgateway+Prometheus. Question is that prometheus received metrics along with labels, In Prometheus query language we make use of many operators or inbuilt functions such as increase(), rate(), sort() . These are used in querying the data incoming . Now, i apply these functions and query my incoming data (metrics), can the results of my queries be stored somewhere and further sent to GRAFANA(or any where for that matter). Or these functions can just be used for querying and viewing results in prometheus interface only. Does prometheus have any kind of inbuilt support for my requirement?

Also, I suppose We can use Prometheus functions directly in Grafana and create queries in Grafana to meet the above requirement? Please correct me and provide insights.


问:
Module not found in Nx project
I'm building a monorepo with Nx. I'm a newbie to Nx monorepo.

I've created 5 libs and a single app. When I build the libs, everything works fine, and the libs are built successfully. But as I try to build the app, Nx first builds all the libs that the app depends upon. After that, upon building the app, it fails to find files of libs. I've been debugging the issue since two days. Even tried to recreate the whole thing from scratch, but stuck on same thing. The error stack is quite large, so I'm putting a repo link here.

https://github.com/mwaqar666/sca

The application works fine until this commit:
https://github.com/mwaqar666/sca/tree/f6670477f53c60b25fc46d2ce028c7be202c4ce3

After adding the application, and linking the libs with the application code at this commit:
https://github.com/mwaqar666/sca/tree/5f4b96033ace59e8e59b032b649c77d06c8c35ec

Example error

```<code>ERROR in ./libs/sca-command/src/commander/command-loader.ts 5:15-32
Module not found: Error: Can't resolve '~/base' in '/home/mwaqar666/code/sca/libs/sca-command/src/commander'
resolve '~/base' in '/home/mwaqar666/code/sca/libs/sca-command/src/commander'
  Parsed request is a module
  using description file: /home/mwaqar666/code/sca/libs/sca-command/package.json (relative path: ./src/commander)
    resolve as module
      /home/mwaqar666/code/sca/libs/sca-command/src/commander/node_modules doesn't exist or is not a directory
      /home/mwaqar666/code/sca/libs/sca-command/src/node_modules doesn't exist or is not a directory
      /home/mwaqar666/code/sca/libs/sca-command/node_modules doesn't exist or is not a directory
      /home/mwaqar666/code/sca/libs/node_modules doesn't exist or is not a directory
      looking for modules in /home/mwaqar666/code/sca/node_modules
        /home/mwaqar666/code/sca/node_modules/~ doesn't exist
      /home/mwaqar666/code/node_modules doesn't exist or is not a directory
      /home/mwaqar666/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./libs/sca-command/src/commander/index.ts 6:21-48
 @ ./libs/sca-command/src/index.ts 4:21-43
 @ ./libs/sca-db/src/migrator/command-provider/migration.command-provider.ts 4:18-41
 @ ./libs/sca-db/src/migrator/command-provider/index.ts 4:21-60
 @ ./libs/sca-db/src/migrator/index.ts 4:21-50
 @ ./libs/sca-db/src/index.ts 7:21-42
 @ ./apps/sca-be/src/app-module/app.module.ts 9:13-31
 @ ./apps/sca-be/src/main.ts 5:21-55
</code>```

This is one error from the whole list of stack errors

Title: Module not found in Nx project

Body:
I'm building a monorepo with Nx. I'm a newbie to Nx monorepo.

I've created 5 libs and a single app. When I build the libs, everything works fine, and the libs are built successfully. But as I try to build the app, Nx first builds all the libs that the app depends upon. After that, upon building the app, it fails to find files of libs. I've been debugging the issue since two days. Even tried to recreate the whole thing from scratch, but stuck on same thing. The error stack is quite large, so I'm putting a repo link here.

https://github.com/mwaqar666/sca

The application works fine until this commit:
https://github.com/mwaqar666/sca/tree/f6670477f53c60b25fc46d2ce028c7be202c4ce3

After adding the application, and linking the libs with the application code at this commit:
https://github.com/mwaqar666/sca/tree/5f4b96033ace59e8e59b032b649c77d06c8c35ec

Example error

ERROR in ./libs/sca-command/src/commander/command-loader.ts 5:15-32
Module not found: Error: Can't resolve '~/base' in '/home/mwaqar666/code/sca/libs/sca-command/src/commander'
resolve '~/base' in '/home/mwaqar666/code/sca/libs/sca-command/src/commander'
  Parsed request is a module
  using description file: /home/mwaqar666/code/sca/libs/sca-command/package.json (relative path: ./src/commander)
    resolve as module
      /home/mwaqar666/code/sca/libs/sca-command/src/commander/node_modules doesn't exist or is not a directory
      /home/mwaqar666/code/sca/libs/sca-command/src/node_modules doesn't exist or is not a directory
      /home/mwaqar666/code/sca/libs/sca-command/node_modules doesn't exist or is not a directory
      /home/mwaqar666/code/sca/libs/node_modules doesn't exist or is not a directory
      looking for modules in /home/mwaqar666/code/sca/node_modules
        /home/mwaqar666/code/sca/node_modules/~ doesn't exist
      /home/mwaqar666/code/node_modules doesn't exist or is not a directory
      /home/mwaqar666/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./libs/sca-command/src/commander/index.ts 6:21-48
 @ ./libs/sca-command/src/index.ts 4:21-43
 @ ./libs/sca-db/src/migrator/command-provider/migration.command-provider.ts 4:18-41
 @ ./libs/sca-db/src/migrator/command-provider/index.ts 4:21-60
 @ ./libs/sca-db/src/migrator/index.ts 4:21-50
 @ ./libs/sca-db/src/index.ts 7:21-42
 @ ./apps/sca-be/src/app-module/app.module.ts 9:13-31
 @ ./apps/sca-be/src/main.ts 5:21-55

This is one error from the whole list of stack errors


问:
Hashicorp Packer "build" command is hanging in docker "run stage"
I am using,
Windows 10
Packer version : 1.8.4
Docker version 20.10.21, build baeda1f
When using any base image to build another docker image in packer using "packer build " command , the command aways gets hung in "docker run stage" , the logs are provided below :

$ packer build spark2223.prk.json
docker: output will be in this color.

==> docker: Creating a temporary directory for sharing data...
==> docker: Starting docker container...
docker: Run command: docker run -v C:\Users\mwandre\AppData\Roaming\packer.d\tmp2854382545:/packer-files -d -i -t --entrypoint=/bin/sh -- openjdk:8-jre-alpine

I am not sure how suddenly this problem started happening in my machine , untill yesterday it was working properly .
Any help would be apreciated .


问:
Adding multiple items in cart for multiple types of products clicked. Ecom app Android Kotlin
As of now I have fetched some product data from api and showing it on homescreen. Now I have detailed screen for each product and from detailed screen user can add that product with whatever quantity into cart screen. Now I want to add multiple products with any number of quantity into cart screen and each product is shown on different cards into cart screen.
How can I achieve that? Currently I am able to do it for one product but quantity value is same for all types of products on click.

This is my ProductDetail fragment for each product from where I am adding items and it's quantity to the cart.

```<code>package com.example.ecomapp.view

import android.app.Application
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import androidx.fragment.app.*
import com.example.ecomapp.CartFragment
import com.example.ecomapp.R
import com.example.ecomapp.databinding.FragmentProductDetailBinding
import com.example.ecomapp.viewmodel.MainViewModel
import com.google.android.material.bottomnavigation.BottomNavigationView
import java.util.*
import kotlin.collections.ArrayList

class ProductDetailFragment : Fragment() {
    lateinit var binding: FragmentProductDetailBinding
    //var quantityValue = 0
    private val viewmodel:MainViewModel by activityViewModels()

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
       /// return inflater.inflate(R.layout.fragment_product_detail, container, false)
        binding = FragmentProductDetailBinding.inflate(inflater,container,false)
        // Log.d("PriceAmount", binding.priceAmount.text.toString())
        Log.d("Price", binding.price.toString())
        Log.d("Title", binding.titleDetail.toString())
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        val navBar:BottomNavigationView = requireActivity().findViewById(R.id.bottomNavigation)
       // navBar.visibility = View.GONE

        binding.productDetails1 = arguments?.getParcelable("product")
        var productDetail = binding.productDetails1
        val currency:Currency = Currency.getInstance(Locale.getDefault())
        val symbol = currency.symbol
        binding.price.text = "$symbol ${productDetail?.price}"
        binding.lifecycleOwner = viewLifecycleOwner
        viewmodel.idsList.add(productDetail?.id)
        val array = viewmodel.idsList
        Log.d("List of ids",array.toString())

        // var priceAmount = binding.priceAmount.text.toString().toFloat()

      //  Log.d("PriceAmount", binding.priceAmount.toString())

        // Log.d("ProductTitle", binding.productDetails1.title)
        binding.addButton.setOnClickListener {
            // Log.d("ProductDetail",initialValue.toString())

                if (productDetail == null) return@setOnClickListener
                viewmodel.quantityValue = viewmodel.quantityValue + 1
                //   binding.totalPriceText.text = "Total price"
                binding.quantityText.text = viewmodel.quantityValue.toString()
                //  binding.priceAmount.text =
                //     (productDetail.price * viewmodel.quantityValue).toString()

        }
        binding.addCartButton.setOnClickListener{
            viewmodel.quantityValue = viewmodel.quantityValue + 1
            binding.quantityText.text = viewmodel.quantityValue.toString()
            Toast.makeText(activity, "Item added to cart", Toast.LENGTH_SHORT).show()
        }

        // Log.d("ProductDetail",priceAmount.toString())

        /*  binding.removeButton.setOnClickListener {
              if (quantityValue != 0) {
                  if (productDetail == null) return@setOnClickListener
                  quantityValue = quantityValue - 1
                  binding.quantityText.text = quantityValue.toString()
                  //   binding.priceAmount.text = (priceAmount*quantityValue).toString()
                  binding.priceAmount.text = (productDetail.price * quantityValue).toString()

              }
          } */

        binding.continueButton.setOnClickListener{
            val bundle = Bundle()
            bundle.putString("quantity_text", String.format("%d",viewmodel.quantityValue))
            val cartFragment = CartFragment()
            cartFragment.arguments = bundle

            val ft = fragmentManager?.beginTransaction()
            ft?.replace(R.id.flFragment,cartFragment)
            ft?.addToBackStack("")
            ft?.commit()
            // Create the transaction
            // Create the transaction
        }
        Toast.makeText(activity,"onCreateViewCalled",Toast.LENGTH_SHORT).show()

      //  binding.productDetails = viewModel.products.value!!.get(0)
      //  binding.lifecycleOwner = viewLifecycleOwner
    }
    override fun onResume() {
        super.onResume()
        (activity as AppCompatActivity?)!!.supportActionBar!!.hide()
        binding.quantityText.text = viewmodel.quantityValue.toString()
       // binding.priceAmount.text = (binding.productDetails1!!.price!! * viewmodel.quantityValue).toString()
        Toast.makeText(activity,"onResumeCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onStop() {
        super.onStop()
       // (activity as AppCompatActivity?)!!.supportActionBar!!.show()
        Toast.makeText(activity,"onStopCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onPause() {
        super.onPause()
        Toast.makeText(activity,"onPauseCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onDestroyView() {
        super.onDestroyView()
        Toast.makeText(activity,"onDestroyViewCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onDestroy() {
        super.onDestroy()
        Toast.makeText(activity,"onDestroyCalled",Toast.LENGTH_SHORT).show()
    }

}
</code>```

And this is my MainViewModel from where I am getting data of quantity value throughout the fragments.

```<code>package com.example.ecomapp.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.ecomapp.data.Repository
import com.example.ecomapp.model.ProductDataModel
import com.example.ecomapp.model.ProductsData
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch

class MainViewModel: ViewModel(){

    private val repository = Repository()

    private val _products = MutableLiveData<List<ProductDataModel>>()
    val products:LiveData<List<ProductDataModel>> = _products

    private val _isLoading = MutableStateFlow(true)
    val isLoading = _isLoading.asStateFlow()

    private var quantity_value = 0
    var quantityValue = quantity_value

    init {
        viewModelScope.launch {
            delay(3000)
            _isLoading.value = false
        }
        getProducts()

    }
    fun addQuantityValue(): Int? {
        quantity_value = quantityValue + 1
        return quantity_value
    }

   /* fun productPrice(quantity:Int):Float {
        _price.value =

    } */
   private fun getProducts() {
       viewModelScope.launch {
           val data = repository.getProducts()
           _products.postValue(data)
       }
   }

}
</code>```

Body:
As of now I have fetched some product data from api and showing it on homescreen. Now I have detailed screen for each product and from detailed screen user can add that product with whatever quantity into cart screen. Now I want to add multiple products with any number of quantity into cart screen and each product is shown on different cards into cart screen.
How can I achieve that? Currently I am able to do it for one product but quantity value is same for all types of products on click.

This is my ProductDetail fragment for each product from where I am adding items and it's quantity to the cart.

package com.example.ecomapp.view

import android.app.Application
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import androidx.fragment.app.*
import com.example.ecomapp.CartFragment
import com.example.ecomapp.R
import com.example.ecomapp.databinding.FragmentProductDetailBinding
import com.example.ecomapp.viewmodel.MainViewModel
import com.google.android.material.bottomnavigation.BottomNavigationView
import java.util.*
import kotlin.collections.ArrayList

class ProductDetailFragment : Fragment() {
    lateinit var binding: FragmentProductDetailBinding
    //var quantityValue = 0
    private val viewmodel:MainViewModel by activityViewModels()

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
       /// return inflater.inflate(R.layout.fragment_product_detail, container, false)
        binding = FragmentProductDetailBinding.inflate(inflater,container,false)
        // Log.d("PriceAmount", binding.priceAmount.text.toString())
        Log.d("Price", binding.price.toString())
        Log.d("Title", binding.titleDetail.toString())
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        val navBar:BottomNavigationView = requireActivity().findViewById(R.id.bottomNavigation)
       // navBar.visibility = View.GONE

        binding.productDetails1 = arguments?.getParcelable("product")
        var productDetail = binding.productDetails1
        val currency:Currency = Currency.getInstance(Locale.getDefault())
        val symbol = currency.symbol
        binding.price.text = "$symbol ${productDetail?.price}"
        binding.lifecycleOwner = viewLifecycleOwner
        viewmodel.idsList.add(productDetail?.id)
        val array = viewmodel.idsList
        Log.d("List of ids",array.toString())

        // var priceAmount = binding.priceAmount.text.toString().toFloat()

      //  Log.d("PriceAmount", binding.priceAmount.toString())

        // Log.d("ProductTitle", binding.productDetails1.title)
        binding.addButton.setOnClickListener {
            // Log.d("ProductDetail",initialValue.toString())

                if (productDetail == null) return@setOnClickListener
                viewmodel.quantityValue = viewmodel.quantityValue + 1
                //   binding.totalPriceText.text = "Total price"
                binding.quantityText.text = viewmodel.quantityValue.toString()
                //  binding.priceAmount.text =
                //     (productDetail.price * viewmodel.quantityValue).toString()

        }
        binding.addCartButton.setOnClickListener{
            viewmodel.quantityValue = viewmodel.quantityValue + 1
            binding.quantityText.text = viewmodel.quantityValue.toString()
            Toast.makeText(activity, "Item added to cart", Toast.LENGTH_SHORT).show()
        }

        // Log.d("ProductDetail",priceAmount.toString())

        /*  binding.removeButton.setOnClickListener {
              if (quantityValue != 0) {
                  if (productDetail == null) return@setOnClickListener
                  quantityValue = quantityValue - 1
                  binding.quantityText.text = quantityValue.toString()
                  //   binding.priceAmount.text = (priceAmount*quantityValue).toString()
                  binding.priceAmount.text = (productDetail.price * quantityValue).toString()

              }
          } */

        binding.continueButton.setOnClickListener{
            val bundle = Bundle()
            bundle.putString("quantity_text", String.format("%d",viewmodel.quantityValue))
            val cartFragment = CartFragment()
            cartFragment.arguments = bundle

            val ft = fragmentManager?.beginTransaction()
            ft?.replace(R.id.flFragment,cartFragment)
            ft?.addToBackStack("")
            ft?.commit()
            // Create the transaction
            // Create the transaction
        }
        Toast.makeText(activity,"onCreateViewCalled",Toast.LENGTH_SHORT).show()

      //  binding.productDetails = viewModel.products.value!!.get(0)
      //  binding.lifecycleOwner = viewLifecycleOwner
    }
    override fun onResume() {
        super.onResume()
        (activity as AppCompatActivity?)!!.supportActionBar!!.hide()
        binding.quantityText.text = viewmodel.quantityValue.toString()
       // binding.priceAmount.text = (binding.productDetails1!!.price!! * viewmodel.quantityValue).toString()
        Toast.makeText(activity,"onResumeCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onStop() {
        super.onStop()
       // (activity as AppCompatActivity?)!!.supportActionBar!!.show()
        Toast.makeText(activity,"onStopCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onPause() {
        super.onPause()
        Toast.makeText(activity,"onPauseCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onDestroyView() {
        super.onDestroyView()
        Toast.makeText(activity,"onDestroyViewCalled",Toast.LENGTH_SHORT).show()
    }

    override fun onDestroy() {
        super.onDestroy()
        Toast.makeText(activity,"onDestroyCalled",Toast.LENGTH_SHORT).show()
    }

}

And this is my MainViewModel from where I am getting data of quantity value throughout the fragments.

package com.example.ecomapp.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.ecomapp.data.Repository
import com.example.ecomapp.model.ProductDataModel
import com.example.ecomapp.model.ProductsData
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch

class MainViewModel: ViewModel(){

    private val repository = Repository()

    private val _products = MutableLiveData<List<ProductDataModel>>()
    val products:LiveData<List<ProductDataModel>> = _products

    private val _isLoading = MutableStateFlow(true)
    val isLoading = _isLoading.asStateFlow()

    private var quantity_value = 0
    var quantityValue = quantity_value

    init {
        viewModelScope.launch {
            delay(3000)
            _isLoading.value = false
        }
        getProducts()

    }
    fun addQuantityValue(): Int? {
        quantity_value = quantityValue + 1
        return quantity_value
    }

   /* fun productPrice(quantity:Int):Float {
        _price.value =

    } */
   private fun getProducts() {
       viewModelScope.launch {
           val data = repository.getProducts()
           _products.postValue(data)
       }
   }

}


问:
MongoNetworkTimeoutError: connection 11 to 127.0.0.1:27017 timed out
I based on Meteorjs and the database Mongodb used mongoose to connect Mongodb, but I got an error when 4+ users request at the same time I don't know because of my connection or any issue.
here my connection:

import { Meteor } from 'meteor/meteor'
import Mongoose from 'mongoose'

let HOST = '127.0.0.1'
const DB_NAME = 'myDb'
const PORT = 27017

var mongoUrl = `mongodb://${HOST}:${PORT}/${DB_NAME}`

Mongoose.connect(mongoUrl, {
  maxPoolSize: 10,
  socketTimeoutMS: 45000,
  serverSelectionTimeoutMS: 5000,
  autoIndex: false,
  family: 4,
}).catch((err) => console.log('connect error', err.reason))

Mongoose.Promise = global.Promise

var db = Mongoose.connection

db.on('error', (err) => {
  console.log('Mongoose default connect error' + err)
})
db.on('reconnected', () => {
  console.log('Connection Reestablished')
})
db.on('disconnected', () => {
  console.log('Connection Disconnected')
})

```

Got error :

Body:
I based on Meteorjs and the database Mongodb used mongoose to connect Mongodb, but I got an error when 4+ users request at the same time I don't know because of my connection or any issue.
here my connection:

import { Meteor } from 'meteor/meteor'
import Mongoose from 'mongoose'

let HOST = '127.0.0.1'
const DB_NAME = 'myDb'
const PORT = 27017

var mongoUrl = `mongodb://${HOST}:${PORT}/${DB_NAME}`

Mongoose.connect(mongoUrl, {
  maxPoolSize: 10,
  socketTimeoutMS: 45000,
  serverSelectionTimeoutMS: 5000,
  autoIndex: false,
  family: 4,
}).catch((err) => console.log('connect error', err.reason))

Mongoose.Promise = global.Promise

var db = Mongoose.connection

db.on('error', (err) => {
  console.log('Mongoose default connect error' + err)
})
db.on('reconnected', () => {
  console.log('Connection Reestablished')
})
db.on('disconnected', () => {
  console.log('Connection Disconnected')
})

Got error :


问:
Saving many to many relations with a nested array in Laravel
So I have a many to many relation in Laravel. provider_locations has a ManyToMany relationship with transport_modes so I've made a pivot table, provider_locations_transport_modes

I have a form which generates a nested array like so:

```<code>  0 => array [
    "full_address" => "Full Address"
    "phone_number" => "5555555"

     "transport_modes" => array [
      0 => "2"
      1 => "1"
    ]
  ]
</code>```

So on creation, I'm attempting something like

```<code>// First create Provider
$provider = Provider::create([
'name' => $data['providerName'],
'provider_code' => $data['providerCode'],
'phone_number' => $data['phoneNumber'],
 ]);

 // Then create provider_location, associated with provider
 foreach ($data['providerLocations'] as $providerLocation) {
     $provider->ProviderLocations()->create([
     'full_address' => $providerLocation['full_address'],
     'phone_number' => $providerLocation['phone_number'],
      ]);

      // Now attach values to pivot table?
      foreach ($providerLocation['transport_modes'] as $transportMode) {
          $provider->ProviderLocations()->TransportModes()->attach($transportMode);
          }
      }
</code>```

It's been giving me the error that "Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::TransportModes()"

TransportMode.php has a belongsToMany relation with provider_locations, and ProviderLocation.php has a belongsToMany relation with transport_modes, so the relation should be set up correctly.

What am I doing wrong?

Body:
So I have a many to many relation in Laravel. provider_locations has a ManyToMany relationship with transport_modes so I've made a pivot table, provider_locations_transport_modes

I have a form which generates a nested array like so:

  0 => array [
    "full_address" => "Full Address"
    "phone_number" => "5555555"

     "transport_modes" => array [
      0 => "2"
      1 => "1"
    ]
  ]

So on creation, I'm attempting something like

// First create Provider
$provider = Provider::create([
'name' => $data['providerName'],
'provider_code' => $data['providerCode'],
'phone_number' => $data['phoneNumber'],
 ]);

 // Then create provider_location, associated with provider
 foreach ($data['providerLocations'] as $providerLocation) {
     $provider->ProviderLocations()->create([
     'full_address' => $providerLocation['full_address'],
     'phone_number' => $providerLocation['phone_number'],
      ]);

      // Now attach values to pivot table?
      foreach ($providerLocation['transport_modes'] as $transportMode) {
          $provider->ProviderLocations()->TransportModes()->attach($transportMode);
          }
      }

It's been giving me the error that "Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::TransportModes()"

TransportMode.php has a belongsToMany relation with provider_locations, and ProviderLocation.php has a belongsToMany relation with transport_modes, so the relation should be set up correctly.

What am I doing wrong?


问:
The output should be a single line containing a string that is the part of the word
let me explain how can I get output

I need output is there


问:
Table height width not matching with flex div while overflow (scrolling)
I am having two div inside a flex div. A table is in 1st area div and a few select-option in the second area div. Now, I want an overflow (scroll) table after the 30% width of flexbox (as flex set width), and height overflow should start when the height is more than the 2nd area div. I have put fixed height in pixels to achieve this but I want to make it responsive.
Both the flex div (1st area and 2nd area) should show in a single row, and as the screen width is more than 30% of the flex width, it should show a scrolling option. Also when the height of the table reaches the height more than 2nd area div, it should show scrolling. Please give me suggestions; how can I get this?

1st Area
            <select style="font-size:16px;float:right">
                <option value="1" selected>X1-Y1-Y2-Y3</option>
                <option value="2">X1-Y1-X2-Y2</option>
            </select>

	Sample 1	Sample 2	Sample 3	Sample 4	Sample 5

X1	Y1	Y2	Y3	Y4	Y5

2nd Area

        <select size="6" style="width:100%;font-size:16px">
            <option value="1" selected>Graph1</option>
            <option value="2">Graph2</option>
            <option value="3">Graph3</option>
            <option value="4">Graph4</option>
            <option value="2">Graph5</option>
            <option value="3">Graph6</option>
            <option value="3">Graph7</option>
            <option value="4">Graph8</option>
            <option value="1">Graph9</option>
            <option value="3">Graph10</option>
            <option value="4">Graph11</option>
        </select>

```


问:
Active Navbar State in React is Resetting
I am trying to make the actively selected navbar element change the background color via react state. However it does not fully work. When I click on an element in my navbar, it briefly gets styled correctly, but after a moment is reverted and my homepage element in the navbar becomes styled once more.

I have my (simplified) navbar code below:

```<code>function Navbar(props) {
  const [clickedNavbarItem, setClickedNavbarItem] = React.useState("/");

  return (
    <ul>

      <li>
        <a
          onClick={() => setClickedNavbarItem("/")}
          className={clickedNavbarItem === "/" && "active"}
          href="/"
          >Solve
        </a>
      </li>

      <li>
        <a
          onClick={() => setClickedNavbarItem("/about")}
          className={clickedNavbarItem === "/about" && "active"}
          href="/about"
        >About
        </a>
      </li>
    </ul>
  )
}
</code>```

To my understanding: When the user clicks a given anchor tag, it should run the onClick handler, which will re-assign the state. The navbar should then re-render, and the classname for the appropriately clicked item should have the "active" class, which should change the styling.

Additionally, the href should redirect the page as such (this is my React router code):

```<code>function App() {

  return (
    <>
      <Navbar />
      <Routes>
        <Route path="/" element={<Solve />} />
        <Route path="/about" element={<About />} />
        <Route path="/explain" element={<Explain />} />
      </Routes>
    </>
  )
}
</code>```

I believe there is some interaction where the Navbar is getting reset perhaps when the href is activated, but I'm not entirely sure. Any help is appreciated.

Body:
I am trying to make the actively selected navbar element change the background color via react state. However it does not fully work. When I click on an element in my navbar, it briefly gets styled correctly, but after a moment is reverted and my homepage element in the navbar becomes styled once more.

I have my (simplified) navbar code below:

function Navbar(props) {
  const [clickedNavbarItem, setClickedNavbarItem] = React.useState("/");

  return (

         setClickedNavbarItem("/")}
          className={clickedNavbarItem === "/" && "active"}
          href="/"
          >Solve

         setClickedNavbarItem("/about")}
          className={clickedNavbarItem === "/about" && "active"}
          href="/about"
        >About

  )
}

To my understanding: When the user clicks a given anchor tag, it should run the onClick handler, which will re-assign the state. The navbar should then re-render, and the classname for the appropriately clicked item should have the "active" class, which should change the styling.

Additionally, the href should redirect the page as such (this is my React router code):

function App() {

  return (
    <>
      <Navbar />
      <Routes>
        <Route path="/" element={<Solve />} />
        <Route path="/about" element={<About />} />
        <Route path="/explain" element={<Explain />} />
      </Routes>
    </>
  )
}

I believe there is some interaction where the Navbar is getting reset perhaps when the href is activated, but I'm not entirely sure. Any help is appreciated.


问:
Google Geochart dynamic size
I am developing an website with an unfoldable sidebar so the size of the screen i can work with is limited and must adjust itself each time the sidebar is (un)folded.

Thought i had solved this by using percentages instead of fixed values, but it looks like i cant do that with geochart.

Here is the options i used in the js:

```<code>options['width'] = '90%'
options['height'] = '50%'
</code>```

And here is my div with styling (the map is displayed in regions_div):

```<code><div class="worldmap"><div id="regions_div" style="width: 90%; height: 50%; padding: 0px; margin: 0px;"></div></div>
</code>```

Title: Google Geochart dynamic size

Body:
I am developing an website with an unfoldable sidebar so the size of the screen i can work with is limited and must adjust itself each time the sidebar is (un)folded.

Thought i had solved this by using percentages instead of fixed values, but it looks like i cant do that with geochart.

Here is the options i used in the js:

options['width'] = '90%'
options['height'] = '50%'

And here is my div with styling (the map is displayed in regions_div):


问:
Can't get .foreach iterator to post multiple lines

```<code>function myFunction() {
  /////////////////////////////////////Fill planning/decor package
var managementSheet = SpreadsheetApp.openById("1P3EF4Edu0efzJVV1Sx-0ayAPaAAiRK8Sl0Y1qZHmcf4");
var packageSheet = managementSheet.getSheetByName("Order Contents");

//Order Contents iterater
var c = packageSheet.getMaxColumns();
var n = packageSheet.getLastRow();
var items = packageSheet.getRange(2,1,n,c).getValues();
var filteredItems = items.filter(function(row) {
  if(row[2].toString().includes(firstName +" "+lastName))
  {
var results =new Array();
var info = new Array();
info[0]=row[3];
info[1]=row[5];
info[2]=row[9];
info[3]=row[14];
info[4]=row[15];
info[5]=row[16];
results[0]= info;
// result = results.every().valueOf();
 Logger.log(results)
  var row=22
  results.forEach(function(value, index)  {
  Logger.log("The value at index " + index + " is " + value + ".");
 generatedInvoice.getRange(22,1,1,7).setValues([[info[0],,info[1],info[2],info[3],info[4],info[5]]])
  row= index + 22+1
})}})
}
</code>```

Hello. First off, I'm new to appscript/javascript/script in general... Secondly, I'm the worst at explaining things and am so over this as I've been working on it for 2 days with only a few food/water/sleep breaks and just can't figure it out.

I'm trying to take rows from one sheet and copy only some of that row's values to a template...

Customer orders are on one sheet.

Order CONTENTS(for all customers' orders) are on another sheet.

I want to generate an invoice containing everything that the customer has ordered. The code I have currently lists only the final row of the "results" array into my template sheet. I want all of the items that the customer ordered to be added to the invoice. I'm trying to figure out how to use "index" to move to the next line and add the next set of values, but I'm not sure what I'm doing wrong. By logging info, I see that everything is being called correctly and adding to the correct spot in the template. The problem is that it only adds the final line of data into the template when I want all of the lines that match a customer's name.

Body:
function myFunction() {
  /////////////////////////////////////Fill planning/decor package
var managementSheet = SpreadsheetApp.openById("1P3EF4Edu0efzJVV1Sx-0ayAPaAAiRK8Sl0Y1qZHmcf4");
var packageSheet = managementSheet.getSheetByName("Order Contents");

//Order Contents iterater
var c = packageSheet.getMaxColumns();
var n = packageSheet.getLastRow();
var items = packageSheet.getRange(2,1,n,c).getValues();
var filteredItems = items.filter(function(row) {
  if(row[2].toString().includes(firstName +" "+lastName))
  {
var results =new Array();
var info = new Array();
info[0]=row[3];
info[1]=row[5];
info[2]=row[9];
info[3]=row[14];
info[4]=row[15];
info[5]=row[16];
results[0]= info;
// result = results.every().valueOf();
 Logger.log(results)
  var row=22
  results.forEach(function(value, index)  {
  Logger.log("The value at index " + index + " is " + value + ".");
 generatedInvoice.getRange(22,1,1,7).setValues([[info[0],,info[1],info[2],info[3],info[4],info[5]]])
  row= index + 22+1
})}})
}

Hello. First off, I'm new to appscript/javascript/script in general... Secondly, I'm the worst at explaining things and am so over this as I've been working on it for 2 days with only a few food/water/sleep breaks and just can't figure it out.

I'm trying to take rows from one sheet and copy only some of that row's values to a template...

Customer orders are on one sheet.

Order CONTENTS(for all customers' orders) are on another sheet.

I want to generate an invoice containing everything that the customer has ordered. The code I have currently lists only the final row of the "results" array into my template sheet. I want all of the items that the customer ordered to be added to the invoice. I'm trying to figure out how to use "index" to move to the next line and add the next set of values, but I'm not sure what I'm doing wrong. By logging info, I see that everything is being called correctly and adding to the correct spot in the template. The problem is that it only adds the final line of data into the template when I want all of the lines that match a customer's name.


问:
How to pass parameter to groovy post build in jenkins?
I have the following Groovy Postbuild script in a jenkins job:

```<code>import java.io.BufferedReader
    import java.io.InputStreamReader
    import java.io.OutputStreamWriter
    import java.net.URL
    import java.net.URLConnection

    def sendPostRequest(urlString, paramString) {
        def url = new URL(urlString)
        def conn = url.openConnection()
        conn.setDoOutput(true)
        def writer = new OutputStreamWriter(conn.getOutputStream())

        writer.write(paramString)
        writer.flush()
        String line
        def reader = new BufferedReader(new     InputStreamReader(conn.getInputStream()))
        while ((line = reader.readLine()) != null) {
            println line
        }
        writer.close()
        reader.close()
    }

    def result =" Project: *Autotests* \n Version *manager.build.buildVariables.get("VERSION_CURR")* \n"

    sendPostRequest("https://api.telegram.org/bot{token}/sendMessage", "parse_mode=Markdown&chat_id={id_Chat}&reply_to_message_id=&text=${result}")
</code>```

But I am getting an error: "groovy.lang.MissingPropertyException: No such property: VERSION_CURR for class: Script1"

However, I have a string parameter:

i also tried: def result =' Project: *Autotests* \n Version *${VERSION_CURR}* \n'

Body:
I have the following Groovy Postbuild script in a jenkins job:

import java.io.BufferedReader
    import java.io.InputStreamReader
    import java.io.OutputStreamWriter
    import java.net.URL
    import java.net.URLConnection

    def sendPostRequest(urlString, paramString) {
        def url = new URL(urlString)
        def conn = url.openConnection()
        conn.setDoOutput(true)
        def writer = new OutputStreamWriter(conn.getOutputStream())

        writer.write(paramString)
        writer.flush()
        String line
        def reader = new BufferedReader(new     InputStreamReader(conn.getInputStream()))
        while ((line = reader.readLine()) != null) {
            println line
        }
        writer.close()
        reader.close()
    }

    def result =" Project: *Autotests* \n Version *manager.build.buildVariables.get("VERSION_CURR")* \n"

    sendPostRequest("https://api.telegram.org/bot{token}/sendMessage", "parse_mode=Markdown&chat_id={id_Chat}&reply_to_message_id=&text=${result}")

But I am getting an error: "groovy.lang.MissingPropertyException: No such property: VERSION_CURR for class: Script1"

However, I have a string parameter:

i also tried: def result =' Project: *Autotests* \n Version *${VERSION_CURR}* \n'


问:
How to create SSRS Pie chart with only 2 report items, or 2 values
How to create SSRS Pie chart with only 2 report items, or 2 values
the attached pic show the 2 expression report items which represents % complete, and the remaining of 100%

it asks for category, but there is no category, just 2 values

I tried to add 2 report items on values,
it keeps asking for the category

enter image description here


问:
Nom errors over bytes dont actually implement Error
I am building a pretty simple parser over &[u8]. Unfortunately, when I try to convert the errors I get into anyhow errors, it informs me that the various nom Error types (nom::error::Error and nom::error::VerboseError) don't implement Display, and thus don't actually implement std::error:Error. Is there anything I can do to make these errors propagate?


问:
When we validate the model after one epoch training in Pytorch Lightning, can we just use one GPU?
I try to run a code written by Pytorch Lightning. I want to run it on one machine multi GPUs.

```<code>##The running setting is

--gpus=1,2,3,4
--strategy=ddp

</code>```

There is no problem when training. But when we validate the model after one epoch training. It still runs on multi-GPUs(multi-processings), so that, the validation dataset will be split and assigned to different GPUs. So when the code try to write the prdict file and compute the scores with the gold file, it will have problems. Source Code

So I just want to shut down the ddp when I validate the model. Just run it on local_rank 0.

Body:
I try to run a code written by Pytorch Lightning. I want to run it on one machine multi GPUs.

##The running setting is

--gpus=1,2,3,4
--strategy=ddp

There is no problem when training. But when we validate the model after one epoch training. It still runs on multi-GPUs(multi-processings), so that, the validation dataset will be split and assigned to different GPUs. So when the code try to write the prdict file and compute the scores with the gold file, it will have problems. Source Code

So I just want to shut down the ddp when I validate the model. Just run it on local_rank 0.


问:
Call https endpoints in spring boot
How to call https endpoint with httpclient5. I cant use this way</p>
```<code>SSLConnectionSocketFactory socketFactory =
                new SSLConnectionSocketFactory(sslContext);

HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
</code>```

Title: Call https endpoints in spring boot

Body:
How to call https endpoint with httpclient5. I cant use this way

SSLConnectionSocketFactory socketFactory =
                new SSLConnectionSocketFactory(sslContext);

HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();