问:
Raw use of parameterized class - when returning base class with generic parameter with factory design pattern
Background

I learned Factory pattern, and the power of generics and I'm attempting to piece them together.

Here are my efforts

Without generic input parameter - No warnings

```<code>public abstract class ArtifactCreator {
    public abstract void setArtifacts(String workflowInput);
}
</code>```

```<code>public class FooArtifactCreator extends ArtifactCreator {

    @Override
    public void setArtifacts(String input) {
        return null;

    }
}
</code>```

```<code>public class BarArtifactCreator extends ArtifactCreator {
    @Override
    public void setArtifacts(String input) {
        return null;

    }
}
</code>```

```<code>public class Factory {
    public ArtifactCreator getArtifactCreator(String domain) {
        if (domain == "foo") {
            return new FooArtifactCreator()
        } else if (domain == "bar") {
            return new BarArtifactCreator()
        }
        return null;
    }
}
</code>```

My whole problem is the workflowInput is relegated to the type String. But I want it to be some generic POJO.

With generics - I get warnings in Factory.java and Store.java that I want to get rid of correctly. (I want to be using generics for my use-case the right way).

Raw use of parameterized class 'ArtifactCreator' on both the files in Store.java and Factory.java

Unchecked call to 'setArtifacts(T)' as a member of raw type 'ArtifactCreator'  in Store.java

public abstract class ArtifactCreator {
public abstract void setArtifacts(T workflowInput);
}

```<code>public class FooArtifactCreator extends ArtifactCreator<FooInput> {

    @Override
    public void setArtifacts(FooInput input) {
        return null;
    }
}
</code>```

```<code>public class BarArtifactCreator extends ArtifactCreator<BarInput> {
    @Override
    public void setArtifacts(BarInput input) {
        return null;

    }
}
</code>```

```<code>public class Factory {
    public ArtifactCreator getArtifactCreator(String domain) {
        if (domain == "foo") {
            return new FooArtifactCreator()
        } else if (domain == "bar") {
            return new BarArtifactCreator()
        }
        return null;
    }
}
</code>```

```<code>public class Input {
    private String domain;
    private String otherInput;
}
</code>```

```<code>public class Store {

    private final Factory factory;
    public Store(Factory factory) {
        this.factory = factory;
    }

    public ArtifactCreator getCaseClosureArtifactFactory(Input req) {
        ArtifactCreator artifactCreator = factory.setArtifacts(req.getDomain());

        //In reality - Create either FooInput or BarInput depending on
        //`otherInput` field in `Input` POJO. Assume that there will be another
        //factory/HashMap to return the input needed

        FooInput input = new FooInput();
        artifactCreator.setArtifacts(input);
    }

}
</code>```

One way I can think of solving my problems is do something like:

```<code>public class WorkflowInput {
    private FooInput input;
    private BarInput input;
}

public abstract class ArtifactCreator {
    public abstract void setArtifacts(WorkflowInput workflowInput);
}

public class FooArtifactCreator extends ArtifactCreator {

    @Override
    public void setArtifacts(WorkflowInput input) {
        FooInput input = input.getFooInput(); //Extract specific input

    }
}

public class BarArtifactCreator extends ArtifactCreator {
    @Override
    public void setArtifacts(WorkflowInput input) {
        BarInput input = input.getBarInput(); //Extract specific input

    }
}
</code>```

This feels a bit unecessary to keep some fields in WorkflowInput null.

Body:
Background

I learned Factory pattern, and the power of generics and I'm attempting to piece them together.

Here are my efforts

Without generic input parameter - No warnings

public abstract class ArtifactCreator {
    public abstract void setArtifacts(String workflowInput);
}

public class FooArtifactCreator extends ArtifactCreator {

    @Override
    public void setArtifacts(String input) {
        return null;

    }
}

public class BarArtifactCreator extends ArtifactCreator {
    @Override
    public void setArtifacts(String input) {
        return null;

    }
}

public class Factory {
    public ArtifactCreator getArtifactCreator(String domain) {
        if (domain == "foo") {
            return new FooArtifactCreator()
        } else if (domain == "bar") {
            return new BarArtifactCreator()
        }
        return null;
    }
}

My whole problem is the workflowInput is relegated to the type String. But I want it to be some generic POJO.

With generics - I get warnings in Factory.java and Store.java that I want to get rid of correctly. (I want to be using generics for my use-case the right way).

Raw use of parameterized class 'ArtifactCreator' on both the files in Store.java and Factory.java

Unchecked call to 'setArtifacts(T)' as a member of raw type 'ArtifactCreator'  in Store.java

public abstract class ArtifactCreator {
public abstract void setArtifacts(T workflowInput);
}

public class FooArtifactCreator extends ArtifactCreator<FooInput> {

    @Override
    public void setArtifacts(FooInput input) {
        return null;
    }
}

public class BarArtifactCreator extends ArtifactCreator<BarInput> {
    @Override
    public void setArtifacts(BarInput input) {
        return null;

    }
}

public class Factory {
    public ArtifactCreator getArtifactCreator(String domain) {
        if (domain == "foo") {
            return new FooArtifactCreator()
        } else if (domain == "bar") {
            return new BarArtifactCreator()
        }
        return null;
    }
}

public class Input {
    private String domain;
    private String otherInput;
}

public class Store {

    private final Factory factory;
    public Store(Factory factory) {
        this.factory = factory;
    }

    public ArtifactCreator getCaseClosureArtifactFactory(Input req) {
        ArtifactCreator artifactCreator = factory.setArtifacts(req.getDomain());

        //In reality - Create either FooInput or BarInput depending on
        //`otherInput` field in `Input` POJO. Assume that there will be another
        //factory/HashMap to return the input needed

        FooInput input = new FooInput();
        artifactCreator.setArtifacts(input);
    }

}

One way I can think of solving my problems is do something like:

public class WorkflowInput {
    private FooInput input;
    private BarInput input;
}

public abstract class ArtifactCreator {
    public abstract void setArtifacts(WorkflowInput workflowInput);
}

public class FooArtifactCreator extends ArtifactCreator {

    @Override
    public void setArtifacts(WorkflowInput input) {
        FooInput input = input.getFooInput(); //Extract specific input

    }
}

public class BarArtifactCreator extends ArtifactCreator {
    @Override
    public void setArtifacts(WorkflowInput input) {
        BarInput input = input.getBarInput(); //Extract specific input

    }
}

This feels a bit unecessary to keep some fields in WorkflowInput null.


来源: stackexchange

问:
How to add the specific firm names to the efficient frontier in RStudio
I'm learning the optimization in R and I want to know how to allocate my limited money from the efficient frontier. I only got the figure as follows

I know that I'd keep my portfolio between these two red points but I cannot get detailed information about each point.

There is a plot I want to obtain in Rstudio. From this plot, I can know what percentage I should invest for each firm. My code is attached at the end. Is there anyone who can help me? Really appreciate it.

```<code>
library(quantmod)
library(ggplot2)
library(magrittr)
library(broom)
library(lubridate)
library(tidyquant)
library(plotly)
library(timetk)
library(tidyverse)

# Get the stock tickers for five high tech firms
ticker_ht <- c("GOOGL", "AMZN", "AAPL", "META", "MSFT")

# Get the stock price for five high tech firms
stock_price_ht1 <- tq_get(ticker_ht,
                          from = "2013-01-01",
                          to = "2020-01-01",
                          get = "stock.prices")

head(stock_price_ht1)

# Calculate the daily returns and use the logarithmic returns
log_daily_return_ht1 <- stock_price_ht1 %>%
  group_by(symbol) %>%
  tq_transmute(select = adjusted,
               mutate_fun = periodReturn,
               period = 'daily',
               col_rename = 'ret',
               type = 'log')

# Check the data frame
head(log_daily_return_ht1)

# Covert it into a wide format with pivot_wider
log_daily_return_wider_ht1 <- log_daily_return_ht1 %>%
  pivot_wider(names_from = symbol, values_from = ret)
head(log_daily_return_wider_ht1)

# Extract the stock part
log_daily_return_wider_cal_ht1 <- log_daily_return_wider_ht1[, 2:6]
head(log_daily_return_wider_cal_ht1)

#### Calculate the mean value for each stock

# Calculate the mean daily returns for each stock
mean_daily_return_ht1 <- colMeans(log_daily_return_wider_cal_ht1)
head(round(mean_daily_return_ht1, 6))

# Calculate the covariance matrix for each stock and then annualize it by multiplying by 252 since it's the number of trading days in a year
cov_mat_ht1 <- cov(log_daily_return_wider_cal_ht1) *252
head(round(cov_mat_ht1, 6))

#### Demonstrate in a single portfolio

# Calculate the random weights
set.seed(620)
random_weights_ht1 <- runif(n = length(ticker_ht))
random_weights_ht1
sum(random_weights_ht1)

random_weights_fix_ht1 <- random_weights_ht1/sum(random_weights_ht1)
random_weights_fix_ht1

sum(random_weights_fix_ht1)

# Calculate the annulized portfolio returns
portfolio_return_ht1 <- (sum(random_weights_fix_ht1 * mean_daily_return_ht1)+1)^252-1
portfolio_return_ht1

# Calculate the portfolio risk, aka Standard deviation
portfolio_risk_ht1 <- sqrt(t(random_weights_fix_ht1) %*%  (cov_mat_ht1 %*% random_weights_fix_ht1))
portfolio_risk_ht1

# Calculate the Sharpe Ratio with assumption 0% risk free rate
sharpe_ratio_ht1 <- portfolio_return_ht1 / portfolio_risk_ht1
sharpe_ratio_ht1

# Perform this optimization on 5000 random portfolios
N <- 10000

# Creating an empty matrix to store the weights
all_wts_ht1 <- matrix(nrow = N, ncol = length(ticker_ht))

# Creating an empty vector to store portfolio returns
port_return_ht1 <- vector('numeric', length = N)

# Creating an empty vector to store portfolio risk
port_risk_ht1 <- vector('numeric', length = N)

# Creating an empty vector to store portfolio Sharpe Ratio
port_sharpe_ratio_ht1 <- vector('numeric', length = N)

# Run for N times
for (i in seq_along(port_return_ht1)){
  random_weights_ht1 <- runif(length(ticker_ht))
  random_weights_fix_ht1 <- random_weights_ht1 /sum(random_weights_ht1)

  # Store weights in the established matrix
  all_wts_ht1[i, ]<- random_weights_fix_ht1

  # Portfolio returns
  port_re_ht1 <- sum(random_weights_fix_ht1 * mean_daily_return_ht1)
  port_re_ht1 <- ((port_re_ht1+1)^252) -1
  # Store portfolio returns value
  port_return_ht1[i] <- port_re_ht1

  # Portfolio risk
  port_sd_ht1 <- sqrt(t(random_weights_fix_ht1) %*% (cov_mat_ht1 %*% random_weights_fix_ht1))
  port_risk_ht1[i] <- port_sd_ht1

  # Portfolio Sharpe Ratios with assumption 0% risk free rate
  sr_ht1 <- port_re_ht1/port_sd_ht1
  port_sharpe_ratio_ht1[i] <- sr_ht1
}

# Create a data table to store all the values
portfolio_value_ht1 <- tibble(Return = port_return_ht1,
                              Risk = port_risk_ht1,
                              Sharpe_Ratio = port_sharpe_ratio_ht1)

# Convert matrix to a tibble and change column names
all_wts_ht1 <- tk_tbl(all_wts_ht1)
colnames(all_wts_ht1) <- colnames(log_daily_return_wider_cal_ht1)

# Combing all the values together
portfolio_value_ht1 <- tk_tbl(cbind(all_wts_ht1, portfolio_value_ht1))
head(portfolio_value_ht1)

min_var_ht1 <- portfolio_value_ht1[which.min(portfolio_value_ht1$Risk), ]
max_sr_ht1 <- portfolio_value_ht1[which.max(portfolio_value_ht1$Sharpe_Ratio), ]

# Visualize the efficient frontier
p3_ht1 <- portfolio_value_ht1 %>%
  ggplot(aes(x = Risk, y = Return, color = Sharpe_Ratio)) +
  geom_point() +
  theme_classic() +
  scale_y_continuous(labels = scales::percent) +
  scale_x_continuous(labels = scales::percent) +
  labs(x = 'Annualized Risk',
       y = 'Annualized Returns',
       title = "Portfolio Optimization & Efficient Frontier") +
  geom_point(aes(x = Risk,
                 y = Return), data = min_var_ht1, color = 'red') +
  geom_point(aes(x = Risk,
                 y = Return), data = max_sr_ht1, color = 'red') #+

ggplotly(p3_ht1)

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm learning the optimization in R and I want to know how to allocate my limited money from the efficient frontier. I only got the figure as follows

I know that I'd keep my portfolio between these two red points but I cannot get detailed information about each point.

There is a plot I want to obtain in Rstudio. From this plot, I can know what percentage I should invest for each firm. My code is attached at the end. Is there anyone who can help me? Really appreciate it.

library(quantmod)
library(ggplot2)
library(magrittr)
library(broom)
library(lubridate)
library(tidyquant)
library(plotly)
library(timetk)
library(tidyverse)

# Get the stock tickers for five high tech firms
ticker_ht <- c("GOOGL", "AMZN", "AAPL", "META", "MSFT")

# Get the stock price for five high tech firms
stock_price_ht1 <- tq_get(ticker_ht,
                          from = "2013-01-01",
                          to = "2020-01-01",
                          get = "stock.prices")

head(stock_price_ht1)

# Calculate the daily returns and use the logarithmic returns
log_daily_return_ht1 <- stock_price_ht1 %>%
  group_by(symbol) %>%
  tq_transmute(select = adjusted,
               mutate_fun = periodReturn,
               period = 'daily',
               col_rename = 'ret',
               type = 'log')

# Check the data frame
head(log_daily_return_ht1)

# Covert it into a wide format with pivot_wider
log_daily_return_wider_ht1 <- log_daily_return_ht1 %>%
  pivot_wider(names_from = symbol, values_from = ret)
head(log_daily_return_wider_ht1)

# Extract the stock part
log_daily_return_wider_cal_ht1 <- log_daily_return_wider_ht1[, 2:6]
head(log_daily_return_wider_cal_ht1)

#### Calculate the mean value for each stock

# Calculate the mean daily returns for each stock
mean_daily_return_ht1 <- colMeans(log_daily_return_wider_cal_ht1)
head(round(mean_daily_return_ht1, 6))

# Calculate the covariance matrix for each stock and then annualize it by multiplying by 252 since it's the number of trading days in a year
cov_mat_ht1 <- cov(log_daily_return_wider_cal_ht1) *252
head(round(cov_mat_ht1, 6))

#### Demonstrate in a single portfolio

# Calculate the random weights
set.seed(620)
random_weights_ht1 <- runif(n = length(ticker_ht))
random_weights_ht1
sum(random_weights_ht1)

random_weights_fix_ht1 <- random_weights_ht1/sum(random_weights_ht1)
random_weights_fix_ht1

sum(random_weights_fix_ht1)

# Calculate the annulized portfolio returns
portfolio_return_ht1 <- (sum(random_weights_fix_ht1 * mean_daily_return_ht1)+1)^252-1
portfolio_return_ht1

# Calculate the portfolio risk, aka Standard deviation
portfolio_risk_ht1 <- sqrt(t(random_weights_fix_ht1) %*%  (cov_mat_ht1 %*% random_weights_fix_ht1))
portfolio_risk_ht1

# Calculate the Sharpe Ratio with assumption 0% risk free rate
sharpe_ratio_ht1 <- portfolio_return_ht1 / portfolio_risk_ht1
sharpe_ratio_ht1

# Perform this optimization on 5000 random portfolios
N <- 10000

# Creating an empty matrix to store the weights
all_wts_ht1 <- matrix(nrow = N, ncol = length(ticker_ht))

# Creating an empty vector to store portfolio returns
port_return_ht1 <- vector('numeric', length = N)

# Creating an empty vector to store portfolio risk
port_risk_ht1 <- vector('numeric', length = N)

# Creating an empty vector to store portfolio Sharpe Ratio
port_sharpe_ratio_ht1 <- vector('numeric', length = N)

# Run for N times
for (i in seq_along(port_return_ht1)){
  random_weights_ht1 <- runif(length(ticker_ht))
  random_weights_fix_ht1 <- random_weights_ht1 /sum(random_weights_ht1)

  # Store weights in the established matrix
  all_wts_ht1[i, ]<- random_weights_fix_ht1

  # Portfolio returns
  port_re_ht1 <- sum(random_weights_fix_ht1 * mean_daily_return_ht1)
  port_re_ht1 <- ((port_re_ht1+1)^252) -1
  # Store portfolio returns value
  port_return_ht1[i] <- port_re_ht1

  # Portfolio risk
  port_sd_ht1 <- sqrt(t(random_weights_fix_ht1) %*% (cov_mat_ht1 %*% random_weights_fix_ht1))
  port_risk_ht1[i] <- port_sd_ht1

  # Portfolio Sharpe Ratios with assumption 0% risk free rate
  sr_ht1 <- port_re_ht1/port_sd_ht1
  port_sharpe_ratio_ht1[i] <- sr_ht1
}

# Create a data table to store all the values
portfolio_value_ht1 <- tibble(Return = port_return_ht1,
                              Risk = port_risk_ht1,
                              Sharpe_Ratio = port_sharpe_ratio_ht1)

# Convert matrix to a tibble and change column names
all_wts_ht1 <- tk_tbl(all_wts_ht1)
colnames(all_wts_ht1) <- colnames(log_daily_return_wider_cal_ht1)

# Combing all the values together
portfolio_value_ht1 <- tk_tbl(cbind(all_wts_ht1, portfolio_value_ht1))
head(portfolio_value_ht1)

min_var_ht1 <- portfolio_value_ht1[which.min(portfolio_value_ht1$Risk), ]
max_sr_ht1 <- portfolio_value_ht1[which.max(portfolio_value_ht1$Sharpe_Ratio), ]

# Visualize the efficient frontier
p3_ht1 <- portfolio_value_ht1 %>%
  ggplot(aes(x = Risk, y = Return, color = Sharpe_Ratio)) +
  geom_point() +
  theme_classic() +
  scale_y_continuous(labels = scales::percent) +
  scale_x_continuous(labels = scales::percent) +
  labs(x = 'Annualized Risk',
       y = 'Annualized Returns',
       title = "Portfolio Optimization & Efficient Frontier") +
  geom_point(aes(x = Risk,
                 y = Return), data = min_var_ht1, color = 'red') +
  geom_point(aes(x = Risk,
                 y = Return), data = max_sr_ht1, color = 'red') #+

ggplotly(p3_ht1)


Title: How do I display centroids for only categorical variables and rescale the plot to fit all the vectors in a CAP in R?

Body:
I want to use the package ggord to display the different regions in the plot. It's the only package I'm aware of that allows modification of CAP (dbRDA is similar).

These are my two dataframes:

community data:

 structure(list(Acanthonus = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.409086382733873, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.253076441863264,
    0, 0, 0, 0, 0, 0, 0, 0, 0.447373246236085, 0, 0.204791470114672,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Acanthurus = c(0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0), Aldrovandia = c(0, 0, 0, 0.0796439397337164,
    0, 0, 0, 0, 0.0760932761503312, 0.149887719136926, 0.0874257797686096,
    0, 0.133216413700984, 0.206960588768036, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0349113548351592, 0, 0, 0,
    0, 0.0423598256313366, 0.0844863115929602, 0, 0, 0, 0.248726495992451,
    0, 0, 0, 0, 0, 0.122418317927505, 0, 0, 0, 0.0624900214089904,
    0, 0, 0, 0.0612926139966559, 0, 0, 0, 0, 0, 0, 0.052842923305949,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0337418520233154, 0, 0, 0, 0,
    0.053619193225485, 0.226695094688782, 0.0909748789717281, 0,
    0, 0, 0.0835044082015746, 0, 0, 0, 0.0528188732834582, 0.068251527924203,
    0, 0, 0, 0.145975184007386, 0, 0, 0, 0, 0, 0, 0.0197167709331403,
    0.246548128121271, 0, 0, 0, 0.011950571139452, 0, 0.0251023300788565,
    0, 0, 0, 0, 0, 0, 0, 0.0697419696879898, 0, 0.0302111441441872,
    0, 0.0335867806368106, 0, 0, 0, 0, 0.0301843709070749, 0, 0.020339693242487,
    0, 0, 0, 0, 0, 0, 0.0182251161396416, 0.0456598407437877, 0,
    0.0418028837879481, 0, 0.0748399351419802, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0.125186896273215, 0.231607570988704, 0.206480357470319,
    0.208427571473165, 0, 0, 0, 0, 0, 0.398111693806485, 0.276348848288375,
    0, 0.173299124890665, 0.367944995515802, 0.19433168280042, 0,
    0, 0, 0, 0, 0), Alepisaurus = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0.20294715434726, 0, 0, 0, 0, 0, 0, 0,
    0), Antigonia = c(0, 0, 0, 0, 0, 0, 0.136091405336316, 0.135564400781754,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.131182061149935, 0, 0.0389845396483402,
    0, 0.0510737713958991, 0, 0, 0.0221211834386518, 0, 0, 0, 0.0635780315084416,
    0.0843272855140658, 0, 0.00969129179463516, 0, 0.0269670493849506,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0275457411403295, 0, 0.0199710333843078,
    0, 0, 0, 0.153103328930802, 0, 0, 0, 0, 0, 0, 0, 0.0068045857988553,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0123377361000331, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.122022283604252,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0202714454722745,
    0, 0, 0, 0, 0, 0, 0, 0.0171274770056515, 0, 0, 0, 0.0814911809202789,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0176697814895969, 0.0203710077376416,
    0.0359920456421683, 0.0151930578639143, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0.0238428677953716, 0)), row.names = c(NA, -174L), class = "data.frame")

Environmental data:

structure(list(Region = c("NWHI", "NWHI", "NWHI", "NWHI", "MHI",
"MHI", "MHI", "MHI", "Johnston Atoll", "Johnston Atoll", "NWHI",
"NWHI", "NWHI", "NWHI", "NWHI", "NWHI", "NWHI", "Southern Marianas",
"Southern Marianas", "Southern Marianas", "Southern Marianas",
"Southern Marianas", "Southern Marianas", "Southern Marianas",
"Southern Marianas", "Southern Marianas", "Northern Marianas",
"Northern Marianas", "Northern Marianas", "Northern Marianas",
"Northern Marianas", "Northern Marianas", "Northern Marianas",
"Northern Marianas", "Northern Marianas", "Wake Island", "Wake Island",
"Wake Island", "Wake Island", "Wake Island", "Wake Island", "Wake Island",
"Wake Island", "American Samoa", "American Samoa", "American Samoa",
"American Samoa", "American Samoa", "American Samoa", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge",
"Tokelau Ridge", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "MHI", "Johnston Atoll", "Johnston Atoll", "Johnston Atoll",
"Johnston Atoll", "Johnston Atoll", "Johnston Atoll", "Johnston Atoll",
"Johnston Atoll", "Musicians Seamounts", "Musicians Seamounts",
"Musicians Seamounts", "Musicians Seamounts", "Musicians Seamounts",
"Musicians Seamounts", "Musicians Seamounts", "MHI", "MHI", "NWHI",
"NWHI", "NWHI", "NWHI", "NWHI", "NWHI", "NWHI", "NWHI", "Line Islands",
"Line Islands", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "Line Islands", "American Samoa", "American Samoa",
"American Samoa", "American Samoa", "American Samoa", "American Samoa",
"American Samoa", "American Samoa", "American Samoa", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge", "Tokelau Ridge",
"Tokelau Ridge", "Tokelau Ridge", "Johnston Atoll", "Johnston Atoll",
"Johnston Atoll", "Johnston Atoll", "Johnston Atoll", "Johnston Atoll",
"Line Islands", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "Line Islands", "Line Islands", "Line Islands",
"Line Islands", "Line Islands", "MHI", "MHI", "MHI", "MHI", "MHI",
"MHI", "MHI", "MHI", "Line Islands", "Line Islands", "MHI", "MHI",
"MHI", "MHI", "MHI", "MHI", "MHI", "MHI", "MHI", "MHI", "MHI",
"MHI"), Depth = c(1217.94385, 1890.1868, 2195.07133333333, 1512.42446153846,
387.792933333333, 449.665, 329.155036144578, 371.994773913044,
1292.5147037037, 1562.64341666667, 1303.7334375, 2330.941, 1397.34381818182,
1157.54766666667, 696.306526315789, 850.155818181818, 1927.704375,
386.639476190476, 565.945142857143, 346.8115, 1212.73853846154,
389.623466666667, 567.487125, 308.739717391304, 383.131978723404,
519.960666666667, 492.636857142857, 518.141447368421, 315.994173913044,
373.780866666667, 297.179698529412, 293.820041884817, 906.472879310345,
371.01677, 2456.81266666667, 2549.50033333333, 2120.943625, 905.894588235294,
1431.50836363636, 472.784454545455, 526.7544, 1211.19973076923,
1278.365, 415.648464285714, 704.230958333333, 367.742115384615,
621.193444444444, 372.782911764706, 1058.38411111111, 305.648152317881,
1694.32833333333, 1141.32952173913, 1471.5255, 1858.89925, 441.992473684211,
649.762390243902, 2325.49425, 404.126556701031, 555.494461538461,
2161.982, 1747.52870833333, 1171.3605, 1400.93542857143, 1159.16291666667,
480.9545, 601.248258064516, 848.4155, 400.788661971831, 654.129610169492,
785.357166666667, 1868.53766666667, 1055.23104761905, 918.714025974026,
375.157086956522, 1022.28727272727, 486.9999, 428.088397058823,
550.745933333333, 1231.98318181818, 1148.8948, 1543.322, 1526.948625,
2445.893, 1872.94626666667, 2420.43516666667, 2881.09533333333,
2336.35925, 2743.81875, 1777.77992857143, 2485.00971428571, 2203.72563636364,
356.745694444444, 805.868508196721, 1740.504275, 1492.89024230769,
1897.56145882353, 2118.47387692308, 2340.61252, 2365.6595875,
2321.09413333333, 2433.14078333333, 1696.25937142857, 2349.06244285714,
1534.24487655172, 1651.34193684211, 2372.21722258065, 1141.43543991525,
938.854654415584, 1286.46528617647, 939.599923642384, 1207.66209278261,
335.090406084656, 646.995759761905, 867.322951985816, 422.742369473684,
623.161037625, 1705.00445714286, 469.159297647059, 639.003445957447,
369.176854814815, 565.918798076923, 430.926200909091, 590.030892380952,
373.073811086957, 638.412642666667, 1316.03258143373, 2082.39259853333,
1345.23038911934, 666.453888053788, 889.343100163235, 1220.76502577083,
477.455971340909, 651.8567311, 900.365511222705, 1570.29270756061,
2373.84600896429, 1693.3715968, 2354.80891233333, 2493.39255405882,
1411.70887837838, 398.005944444444, 540.964862068965, 421.734415896414,
533.864779545455, 430.782192972973, 598.236145714286, 782.439401052632,
424.313034868421, 613.197921714285, 367.324416129032, 661.258433333333,
805.976225, 674.334, 845.678, 1100.82228571429, 948.692666666666,
1548.828, 315.830158730159, 277.570212765957, 301.629898989899,
399.626604615385, 675.772078974359, 1112.9, 915.43, 311.75, 1011.66328125,
1543.6388, 825.875, 397.5364, 408.7526, 410.123859649123, 416.994347826087,
410.313023255814, 382.411022727272), Oxygen = c(1.20847142857143,
2.57508333333333, 2.89406666666667, 2.16714545454545, 2.58889545454545,
1.89665238095238, 3.91657647058823, 3.22893245614035, 1.79512666666667,
2.3983625, 1.92327142857143, 3.56028333333333, 1.82468, 1.19853333333333,
2.41061666666667, 1.36466666666667, 2.80991666666667, 3.0321906779661,
2.4164, 3.34045135135135, 2.70026666666667, 4.99228620689655,
2.327095, 5.23935641025641, 3.52004567901235, 2.38223333333333,
2.65832857142857, 2.36768947368421, 5.83262666666667, 5.91189787234043,
6.38387659574468, 6.4204306010929, 1.900625, 5.94442065217391,
3.56258333333333, 3.89145, 3.2808375, 2.04632142857143, 2.5449,
4.33206842105263, 2.64427777777778, 2.50826666666667, 2.22762,
3.86717916666667, 4.84973333333333, 4.28550869565217, 4.91774615384615,
4.12885409836066, 3.737225, 2.72380402684564, 3.64241666666667,
3.00083157894737, 3.15955555555556, 3.12725, 2.53676111111111,
2.28392243589744, 3.61304, 2.37899545454545, 2.15917083333333,
3.43135, 3.11690476190476, 2.64353333333333, 3.11561111111111,
2.82281666666667, 3.46205833333333, 3.37263411764706, 3.36749411764706,
2.49427307692308, 2.03933125, 2.36016818181818, 3.20395, 2.66528205128205,
2.5296780952381, 0.888090909090909, 1.63292727272727, 2.4385,
2.9974890625, 1.51645333333333, 1.774625, 1.60715, 2.31605454545454,
2.34480769230769, 3.59308333333333, 2.90728, 3.39641666666667,
3.57494285714286, 2.91464285714286, 3.382285, 2.43443333333333,
3.04539230769231, 2.89304285714286, 5.91775567010309, 1.38309318181818,
2.15744662142857, 1.64315053571429, 2.2430678, 2.66842835454545,
2.93248654615385, 2.9257291, 2.977565475, 1.74050845714286, 2.05206012105263,
2.58168857777778, 1.76918733552632, 1.881115615, 2.5944560047619,
1.87667291428571, 1.93646662676056, 1.9981353359375, 1.94779278230088,
2.00005485121951, 1.18663067730769, 1.31255347238806, 1.98604797307692,
0.566267159333333, 1.13418384017699, 3.3375422, 4.12625594117647,
3.98456393846154, 3.97315342553191, 4.14338875555556, 4.07103463684211,
4.24388898666667, 4.03436079142857, 4.36254044615385, 2.1122055917451,
2.70120948, 2.15063770467742, 1.56112973717857, 1.9693495682,
2.05162161433898, 1.36964316592593, 1.51470840360833, 2.08095808053438,
2.39066620833333, 2.89844674053846, 1.8986157115, 2.6127854875,
2.79598680275, 1.62874493753125, 1.42614512577419, 0.748291307476191,
1.04839949398268, 0.937635636428571, 1.12239180875817, 0.869672949047619,
1.1436794, 1.1468510084252, 0.9241510528, 1.09177037037037, 1.1358,
1.34054285714286, 4.5, 3.9, 2.33, 2.33, 2.8, 4.15665384615385,
4.5108717948718, 4.67568181818182, 1.1969066992623, 1.13890091642857,
2.33, 2.33, 5.502, 1.58239130434783, 1.58444444444444, 5.63928571428571,
5.3225, 2.87314285714286, 2.84, 2.81545454545455, 2.74324324324324,
6.4562), Temperature = c(3.09382857142857, 2.02188333333333,
1.84328333333333, 2.6182, 8.2132, 7.36540317460318, 8.83248627450981,
8.50561842105263, 3.34150666666667, 2.8152625, 3.15202857142857,
1.67811666666667, 2.73836, 3.24096666666667, 5.05586666666667,
4.2607, 2.04035, 8.54459745762712, 5.72415, 9.26484594594595,
3.55305, 11.4580344827586, 6.82491, 15.6686282051282, 9.63436296296296,
7.19514444444444, 7.01192857142857, 6.47526578947368, 14.3303666666667,
13.6547340425532, 15.8816914893617, 16.2982131147541, 4.541790625,
14.1477163043478, 1.8177, 1.59996666666667, 1.95815, 4.44304642857143,
2.87650666666667, 8.97471052631579, 7.10277222222222, 3.48801111111111,
3.75844666666667, 10.8363416666667, 5.66639166666667, 14.3534913043478,
6.74427692307692, 12.2404983606557, 4.33935, 13.3377697986577,
2.54441666666667, 4.0800052631579, 3.14114444444444, 2.4872625,
8.53641111111111, 6.70295961538461, 1.97274, 9.76084772727273,
6.8395375, 2.14488333333333, 2.52895714285714, 4.05914166666667,
3.24958888888889, 3.98238333333333, 8.1722, 7.33911764705882,
5.03232352941176, 9.52217692307692, 6.56579583333333, 5.71185454545455,
2.39668333333333, 4.53570769230769, 5.1725780952381, 9.14686363636364,
4.55253636363636, 6.99042, 8.14825, 6.75329333333333, 4.0456375,
4.2516, 2.96784545454545, 2.98142307692308, 1.76388333333333,
2.26532, 1.66415, 1.58494285714286, 1.74258571428571, 1.583725,
2.2071, 1.77798461538462, 1.93285714285714, 11.0652412371134,
4.77779090909091, 2.09671765714286, 2.50476876428571, 1.99610303636364,
1.77900259090909, 1.70248658461538, 1.7188061875, 1.72452205,
1.69948537142857, 2.59694892105263, 1.99038747777778, 3.06101642631579,
2.841645985, 2.02162555714286, 4.19566207142857, 4.82901857183099,
3.8720876921875, 4.96609747433628, 4.03154127439024, 11.0474073846154,
6.81516108059702, 5.32162458538461, 9.05439890833333, 7.10476619734513,
2.6192327875, 8.80704985294118, 6.01193974615385, 12.9037271595745,
6.88269992777778, 9.82793212631579, 6.74009037333333, 13.7873928428571,
6.05048243076923, 3.62757656637255, 2.14119331644444, 3.55886975034409,
6.51580777297619, 5.173877204425, 4.15152826028814, 8.52861481603704,
6.73609567620833, 5.1490081971625, 2.77227992980952, 1.88251417861538,
2.6643367743, 1.89809865033333, 1.723843842625, 2.9016221311875,
8.01163936812903, 6.39361769085714, 8.64938031558442, 7.76125507142858,
8.70847479281046, 6.93764717619048, 5.9071819625, 8.73404515748031,
7.132172744, 9.19494814814815, 6.11578333333333, 5.4293, 5.6,
5.6, 4.4, 3.4, 3.39, 11.1963461538462, 13.6830769230769, 12.2380681818182,
9.22578549180328, 6.41249001785714, 4.478, 3.764, 11.74, 4.21086956521739,
4.45555555555556, 5.275, 16.1475, 7.95771428571429, 8.15675,
8.19318181818181, 8.57972972972973, 8.59063829787234), Salinity = c(34.4669714285714,
34.6106, 34.6307666666667, 34.5636, 34.2134681818182, 34.2364888888889,
34.127337254902, 34.1187877192983, 34.56524, 34.5992, 34.5341571428571,
34.6519, 34.52296, 34.4369166666667, 34.1113, 34.2427666666667,
34.61405, 34.3692669491525, 34.4880285714286, 34.3676540540541,
34.5674833333333, 34.3228068965517, 34.292165, 34.6999051282051,
34.3251901234568, 34.3256444444444, 34.2705571428572, 34.3079315789474,
34.4985733333333, 34.4650957446808, 34.6251021276596, 34.6619803278689,
34.398953125, 34.4842923913044, 34.6401833333333, 34.6666666666667,
34.6357375, 34.4595714285714, 34.57106, 34.1692894736842, 34.1970555555556,
34.5464555555556, 34.55622, 34.7300375, 34.4461958333333, 35.0519565217391,
34.4565846153846, 34.8574295081967, 34.52315, 34.9962100671141,
34.6206166666667, 34.5590131578947, 34.5951, 34.629625, 34.6298888888889,
34.5629717948718, 34.65497, 34.7022193181818, 34.5633479166667,
34.6449666666667, 34.6256142857143, 34.566025, 34.5904333333333,
34.5643333333333, 34.610775, 34.5722717647059, 34.5279352941176,
34.6983365384615, 34.5633083333333, 34.5470409090909, 34.6329666666667,
34.5545333333333, 34.5450933333333, 34.6515545454545, 34.5613181818182,
34.1974, 34.19761875, 34.3245466666667, 34.5454375, 34.5393666666667,
34.5830818181818, 34.5875538461538, 34.65465, 34.6223, 34.6502666666667,
34.6593285714286, 34.6397714285714, 34.65842, 34.59485, 34.6370769230769,
34.6283857142857, 34.2168835051546, 34.4310772727273, 34.5682640714286,
34.5289236428571, 34.5836439090909, 34.6071859090909, 34.6185414615385,
34.619477125, 34.620476125, 34.6245417142857, 34.616208368421,
34.6468284444444, 34.5962239868421, 34.6051373, 34.6444938571429,
34.5556088333333, 34.539945056338, 34.568001765625, 34.5373758849557,
34.5413022804878, 34.7682187692308, 34.5463839850746, 34.5158022769231,
34.6604025, 34.5670052123894, 34.59664125, 34.5439970588235,
34.4655656153846, 34.9140893617021, 34.4760058333333, 34.6508099473684,
34.4669309333333, 34.9559129142857, 34.4323181538461, 34.5696579896078,
34.6329770722222, 34.5762220410753, 34.5537610538095, 34.53703647125,
34.5574027301695, 34.6265635192593, 34.5615002240833, 34.5365289745938,
34.605358437619, 34.6486663130769, 34.604569821, 34.64698581,
34.64899554375, 34.5796742896875, 34.2927015432258, 34.3723125380952,
34.9294450389611, 34.9340205178571, 34.9467800130719, 34.9357943333333,
34.9256775, 34.9453811181102, 34.94336, 34.9496259259259, 34.9544666666667,
34.9559428571429, 34.67, 34.8, 34.6, 34.6, 35.3, 34.6288461538461,
34.9128205128205, 34.8022727272727, 35.5906385081967, 35.3090589285714,
34.6, 34.74, 34.512, 34.5402173913043, 34.5588888888889, 35.0464285714286,
34.79, 34.376, 34.20375, 34.2613636363636, 34.3118918918919,
34.2870212765957)), row.names = c(NA, -174L), class = c("tbl_df",
"tbl", "data.frame"))

I use the capscale function:

ca= capscale(co1 ~ Depth + Oxygen + Salinity + Water_Mass + POC_Flux, data= en, dist = "bray", scannf = FALSE)

And then tried to only include Water_Mass (the categorical variable) as the centroids

cent<- data.frame(ca$CCA$centroids)
cent

cent$Water_Mass <- row.names(cent)

p <- ggord(ca, en$Region, cols = c('blue','red', 'green', 'orange', 'pink','purple', 'aquamarine', 'yellow', 'limegreen', 'coral3', display = 'centroid') +
             geom_text(data= cent))

p

It hasn't been working, if anyone could help me I would greatly appreciate it!


问:
Import issue with 'flatpickr' missing package index.js in @carbon components

I am having trouble with parcel because of @carbon component's latest package where the DatePicker's flatpickr dependency has issue not having index.js so parcel bundler can't resolve the import.

@parcel/core: Failed to resolve 'flatpickr' from './node_modules/@carbon/react/es/components/DatePicker/DatePicker.js'

current package version:

```<code>{
    "carbon-components": "^10.58.3",
    "carbon-components-react": "^8.19.0"
}
</code>```

Is there a workaround or additional settings for this that should be added? I can't find any in their docs. Any suggestion would be much appreciated.

Body:
I am having trouble with parcel because of @carbon component's latest package where the DatePicker's flatpickr dependency has issue not having index.js so parcel bundler can't resolve the import.

@parcel/core: Failed to resolve 'flatpickr' from './node_modules/@carbon/react/es/components/DatePicker/DatePicker.js'

current package version:

{
    "carbon-components": "^10.58.3",
    "carbon-components-react": "^8.19.0"
}

Is there a workaround or additional settings for this that should be added? I can't find any in their docs. Any suggestion would be much appreciated.


问:
GitHub Pages and Relative Paths: <base> element didn't seem to work
I made a stenciljs component and tried to host it on GitHub pages, but ran into issues with (I think) relative paths. I did get some functionality by changing the


问:
Fabricjs matrix multiply not working when using `.rotate`
Following the docs around matrix transformations here: http://fabricjs.com/using-transformations

I replicated their demo at the bottom but instead of the new matrix being set to the minions on an event I am programmatically calling .rotate

The minion rotates correctly but it's position is off by a bit even with calling setCoords

What I expect to happen is that the blue minion stays in the same position relative to the red boss as it rotates but instead it moves as it rotates

Codesandbox: https://codesandbox.io/s/sharp-brook-st24pb?file=/src/index.js:812-820


问:
Unable to run DSJOB command from script but the same command is running in command line
I am trying to run the command mention below to get the status of the DataStage job in a script,

```<code>JOBSTATUS = $(dsjob -jobinfo "$Project_Name" "$Job_Name" | head -l | cut -d"(" -f2 | cut -d")" -f1)
echo $JOBSTATUS
</code>```

I tried using  (Tilde)

```<code>JOBSTATUS = `dsjob -jobinfo "$Project_Name" "$Job_Name" | head -l | cut -d"(" -f2 | cut -d")" -f1`
echo $JOBSTATUS
</code>```

But still getting the error:

JOBSTATUS: not found [no such file or directory]

At the same time if try to run this command in command line, it is running fine and giving the output.

I am new to Unix, am I missing anything?

Body:
I am trying to run the command mention below to get the status of the DataStage job in a script,

JOBSTATUS = $(dsjob -jobinfo "$Project_Name" "$Job_Name" | head -l | cut -d"(" -f2 | cut -d")" -f1)
echo $JOBSTATUS

I tried using  (Tilde)

JOBSTATUS = `dsjob -jobinfo "$Project_Name" "$Job_Name" | head -l | cut -d"(" -f2 | cut -d")" -f1`
echo $JOBSTATUS

But still getting the error:

JOBSTATUS: not found [no such file or directory]

At the same time if try to run this command in command line, it is running fine and giving the output.

I am new to Unix, am I missing anything?


问:
Does Vuetify's data-table work with Static Site Generation?
Can I use an SSG tool for Vue.js, like Nuxt, to generate a single-page application using Vuetify and have its data-table component (instantiated with v-data-table) work, i.e. be able to display tabular data loaded as JSON (via a totally separate REST API, nowhere near Vue.js), enable editing its rows and having script handlers make REST calls in response to edit events which data-table provides? If so, what steps does that involve?

Or am I confused about the requirements, e.g. the meaning of static? (I understand it as content, i.e. HTML mostly, being ready on the server and send in response to requests, as opposed to generated on the fly. But maybe the in Vue.js it means something different.)


问:
Why do my submit buttons lose their functionality after a new child is added to the DOM
within my JavaScript code I am creating html children elements using JS text literals and am incrementing them into an HTML container. I am also incrementing their classes with a JS variable. Once they are added into the DOM, I would like for them all to have functionality. Here's where there is a problem. Each of my children's submit button will work as soon as its created, but if I add another child to the container before I click in a value for the last button it wont work.  Any advice or help is appreciated. Thank you.

HTML below

```<code><!DOCTYPE html>
<html>
<head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Order Divs</title>
      <link rel="stylesheet" href="style.css">
</head>
<body>
  <input type="number" id="point-input">
  <button id="sub-btn">Submit</button>
   <!--8 <button id="add-btn">Add</button>-->
    <div id="container"></div>
    <script src="main.js"></script>
</body>
</html>
</code>```

**Javascipt Below **

```<code>
//variables below

let addBtn=document.getElementById("add-btn")
console.log(addBtn)

const container=document.getElementById("container")
console.log(container)

let numInc=1;

let numArr=[]

let subBtn=document.getElementById("sub-btn")
console.log(subBtn)

let pointInput=document.getElementById("point-input")
console.log(pointInput)

                                                //adding an event listener to the submit button below

subBtn.addEventListener("click",()=>{
                                                    //Adding html literals on the onclick   below

        container.innerHTML+=
        `<span class="child${numInc}">
        <div class="numbers${numInc}"></div>
                <div class="name-display${numInc}"></div>
                    <input class="name-input${numInc}">
                    <button class="name-sub-btn${numInc}">Submit</button>

        </span>`

                                console.log(`child${numInc}`)
                                empty()

                                                    // Name variables per constainer

                                let child=document.querySelector(`.child${numInc}`)
                                console.log(child)

                                let nameDisplay=document.querySelector(`.name-display${numInc}`)
                                console.log(nameDisplay)

                                let nameSubBtn=document.querySelector(`.name-sub-btn${numInc}`)
                                console.log(nameSubBtn);

                                let nameInput=document.querySelector(`.name-input${numInc}`)
                                console.log(nameInput);

                            child.querySelector(`.name-sub-btn${numInc}`).addEventListener("click",()=>{
                                nameDisplay.innerText=nameInput.value;
                            })

numInc=numInc+1;

})//end of sub-btn eventlistener

function empty(){
    document.getElementById("point-input").value="";    // empty the input field after a submit
}

</code>```

CSS below

```<code>
#container{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    background:hsl(0,100%,80%);

}
.child{
    padding:10px;
    background:hsl(180,100%,70%);
    border:solid black 3px;
    /*margin:10px;
    width:3em;*/
    text-align:center;
}

.child1{
    background: hsl(60,100%,230%);
}
</code>```

Body:
within my JavaScript code I am creating html children elements using JS text literals and am incrementing them into an HTML container. I am also incrementing their classes with a JS variable. Once they are added into the DOM, I would like for them all to have functionality. Here's where there is a problem. Each of my children's submit button will work as soon as its created, but if I add another child to the container before I click in a value for the last button it wont work.  Any advice or help is appreciated. Thank you.

HTML below

<!DOCTYPE html>

      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Order Divs</title>
      <link rel="stylesheet" href="style.css">

  <input type="number" id="point-input">
  <button id="sub-btn">Submit</button>

**Javascipt Below **

//variables below

let addBtn=document.getElementById("add-btn")
console.log(addBtn)

const container=document.getElementById("container")
console.log(container)

let numInc=1;

let numArr=[]

let subBtn=document.getElementById("sub-btn")
console.log(subBtn)

let pointInput=document.getElementById("point-input")
console.log(pointInput)

                                                //adding an event listener to the submit button below

subBtn.addEventListener("click",()=>{
                                                    //Adding html literals on the onclick   below

        container.innerHTML+=
        `

                    <input class="name-input${numInc}">
                    <button class="name-sub-btn${numInc}">Submit</button>

        `

                                console.log(`child${numInc}`)
                                empty()

                                                    // Name variables per constainer

                                let child=document.querySelector(`.child${numInc}`)
                                console.log(child)

                                let nameDisplay=document.querySelector(`.name-display${numInc}`)
                                console.log(nameDisplay)

                                let nameSubBtn=document.querySelector(`.name-sub-btn${numInc}`)
                                console.log(nameSubBtn);

                                let nameInput=document.querySelector(`.name-input${numInc}`)
                                console.log(nameInput);

                            child.querySelector(`.name-sub-btn${numInc}`).addEventListener("click",()=>{
                                nameDisplay.innerText=nameInput.value;
                            })

numInc=numInc+1;

})//end of sub-btn eventlistener

function empty(){
    document.getElementById("point-input").value="";    // empty the input field after a submit
}

CSS below

#container{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    background:hsl(0,100%,80%);

}
.child{
    padding:10px;
    background:hsl(180,100%,70%);
    border:solid black 3px;
    /*margin:10px;
    width:3em;*/
    text-align:center;
}

.child1{
    background: hsl(60,100%,230%);
}


问:
How do I fix ResNet2D50.__init__() missing 1 required positional argument: 'inputs' error?
I'm working on a Diabetic Retinopathy Detection project and I'm using ResNet50. My create_model function has this problem. I enter my model parameters seperately. So the height, width, and canal parameters are at a seperate place.</p>
```<code>TypeError                                 Traceback (most recent call last)
/Users/berkesozer/Desktop/aptos2019-blindness-detection/DRDetection_ResNet50.ipynb Cell 10' in <cell line: 1>()
----> 1 model = create_model(input_shape=(HEIGHT, WIDTH, CANAL), n_out=N_CLASSES)
      3 for layer in model.layers:
      4     layer.trainable = False

/Users/berkesozer/Desktop/aptos2019-blindness-detection/DRDetection_ResNet50.ipynb Cell 9' in create_model(input_shape, n_out)
      1 def create_model(input_shape, n_out):
      2     input_tensor = Input(shape=input_shape)
----> 3     base_model = ResNet50(weights='imagenet',
      4                                        include_top=False,
      5                                        input_tensor=input_tensor)
      7     x = GlobalAveragePooling2D()(base_model.output)
      8     x = Dropout(0.5)(x)

TypeError: ResNet2D50.__init__() missing 1 required positional argument: 'inputs'
</code>```
```<code>def create_model(input_shape, n_out):
    input_tensor = Input(shape=input_shape)
    base_model = ResNet50(weights='imagenet',
                                       include_top=False,
                                       input_tensor=input_tensor)

    x = GlobalAveragePooling2D()(base_model.output)
    x = Dropout(0.5)(x)
    x = Dense(2048, activation='relu')(x)
    x = Dropout(0.5)(x)
    final_output = Dense(n_out, activation='softmax', name='final_output')(x)
    model = Model(input_tensor, final_output)

    return model
</code>```
```<code>model = create_model(input_shape=(HEIGHT, WIDTH, CANAL), n_out=N_CLASSES)

for layer in model.layers:
    layer.trainable = False

for i in range(-5, 0):
    model.layers[i].trainable = True

metric_list = ["accuracy"]
optimizer = optimizers.Adam(lr=WARMUP_LEARNING_RATE)
model.compile(optimizer=optimizer, loss="categorical_crossentropy",  metrics=metric_list)
model.summary()
</code>```

Body:
I'm working on a Diabetic Retinopathy Detection project and I'm using ResNet50. My create_model function has this problem. I enter my model parameters seperately. So the height, width, and canal parameters are at a seperate place.

TypeError                                 Traceback (most recent call last)
/Users/berkesozer/Desktop/aptos2019-blindness-detection/DRDetection_ResNet50.ipynb Cell 10' in <cell line: 1>()
----> 1 model = create_model(input_shape=(HEIGHT, WIDTH, CANAL), n_out=N_CLASSES)
      3 for layer in model.layers:
      4     layer.trainable = False

/Users/berkesozer/Desktop/aptos2019-blindness-detection/DRDetection_ResNet50.ipynb Cell 9' in create_model(input_shape, n_out)
      1 def create_model(input_shape, n_out):
      2     input_tensor = Input(shape=input_shape)
----> 3     base_model = ResNet50(weights='imagenet',
      4                                        include_top=False,
      5                                        input_tensor=input_tensor)
      7     x = GlobalAveragePooling2D()(base_model.output)
      8     x = Dropout(0.5)(x)

TypeError: ResNet2D50.__init__() missing 1 required positional argument: 'inputs'

def create_model(input_shape, n_out):
    input_tensor = Input(shape=input_shape)
    base_model = ResNet50(weights='imagenet',
                                       include_top=False,
                                       input_tensor=input_tensor)

    x = GlobalAveragePooling2D()(base_model.output)
    x = Dropout(0.5)(x)
    x = Dense(2048, activation='relu')(x)
    x = Dropout(0.5)(x)
    final_output = Dense(n_out, activation='softmax', name='final_output')(x)
    model = Model(input_tensor, final_output)

    return model

model = create_model(input_shape=(HEIGHT, WIDTH, CANAL), n_out=N_CLASSES)

for layer in model.layers:
    layer.trainable = False

for i in range(-5, 0):
    model.layers[i].trainable = True

metric_list = ["accuracy"]
optimizer = optimizers.Adam(lr=WARMUP_LEARNING_RATE)
model.compile(optimizer=optimizer, loss="categorical_crossentropy",  metrics=metric_list)
model.summary()


问:
Compile ad-hoc route string
I'm looking for a way in Laravel/Symfony to provide an arbitrary route string, including any parameters, along with the associated values for those parameters, and get back the compiled version of the string.  For example:

$route = new RouteCompiler('foo/{id}', ['id' => 123]); // returns 'foo/123'
```

I've looked into Symfony\Component\Routing\Route, Symfony\Component\Routing\RouteCompiler, and Symfony\Component\Routing\CompiledRoute which seem to get me pretty close, but I can't figure out the last bit (if it's even possible).

The Node module path-to-regexp (which Express uses under the hood) offers an example of what I'm looking for; see https://github.com/pillarjs/path-to-regexp#compile-reverse-path-to-regexp

Title: Compile ad-hoc route string

Body:
I'm looking for a way in Laravel/Symfony to provide an arbitrary route string, including any parameters, along with the associated values for those parameters, and get back the compiled version of the string.  For example:

$route = new RouteCompiler('foo/{id}', ['id' => 123]); // returns 'foo/123'

I've looked into Symfony\Component\Routing\Route, Symfony\Component\Routing\RouteCompiler, and Symfony\Component\Routing\CompiledRoute which seem to get me pretty close, but I can't figure out the last bit (if it's even possible).

The Node module path-to-regexp (which Express uses under the hood) offers an example of what I'm looking for; see https://github.com/pillarjs/path-to-regexp#compile-reverse-path-to-regexp


问:
Call or merge two individual API Request functions in a new Function
How can I call two different individual functions -postStudent and triggerScoring- in a new function? Here's my use case:

postStudent has to run first. It returns an id as its resp.data.  That id is what I need to set/pass as the id of the Post request in triggerScoring.

So what I want to do is create a new function that would:

call postStudent and wait for it to run and return its response. The expected response is an id.

If the request is a success and the id is returned, grab and save the id to a variable.

pass the saved id as the param in triggerScoring, and then call the triggerScoring function.

finally return a success message if both functions successfully run and is completed.

How can I implement this? using Async await? The new function can be called mergeFunctions:

student.js

```<code>const BASE_URL = htttp://localhost:3000

const postStudent = async (req, res, next) => {
  const headers = {
    "Content-type": "application/json",
  };
  const body = { name: 'Adam Lawrence' };
  try {
    const resp = await axios.post(`${BASE_URL}/student`, body, { headers });
    const response = resp.data;
    res.send(response);
  } catch (err) {
    if (err.response) {
      res.status(err.response.status).send(err.response.data);
    } else if (err.request) {
      res.send(err.request);
    }
    next(err);
  }
};

const triggerScoring = async (req, res, next) => {
  const { id } =
  const headers = {
    "Score-API-Version": "v2",
  };
  try {
    const resp = await axios.post(`${BASE_URL}/start/${id}`, { headers });
    const response = resp.data;
    res.send(response);
  } catch (err) {
    if (err.response) {
      res.status(err.response.status).send(err.response.data);
    } else if (err.request) {
      res.send(err.request);
    }
    next(err);
  }
};
</code>```

new function

Body:
How can I call two different individual functions -postStudent and triggerScoring- in a new function? Here's my use case:

postStudent has to run first. It returns an id as its resp.data.  That id is what I need to set/pass as the id of the Post request in triggerScoring.

So what I want to do is create a new function that would:

call postStudent and wait for it to run and return its response. The expected response is an id.

If the request is a success and the id is returned, grab and save the id to a variable.

pass the saved id as the param in triggerScoring, and then call the triggerScoring function.

finally return a success message if both functions successfully run and is completed.

How can I implement this? using Async await? The new function can be called mergeFunctions:

student.js

const BASE_URL = htttp://localhost:3000

const postStudent = async (req, res, next) => {
  const headers = {
    "Content-type": "application/json",
  };
  const body = { name: 'Adam Lawrence' };
  try {
    const resp = await axios.post(`${BASE_URL}/student`, body, { headers });
    const response = resp.data;
    res.send(response);
  } catch (err) {
    if (err.response) {
      res.status(err.response.status).send(err.response.data);
    } else if (err.request) {
      res.send(err.request);
    }
    next(err);
  }
};

const triggerScoring = async (req, res, next) => {
  const { id } =
  const headers = {
    "Score-API-Version": "v2",
  };
  try {
    const resp = await axios.post(`${BASE_URL}/start/${id}`, { headers });
    const response = resp.data;
    res.send(response);
  } catch (err) {
    if (err.response) {
      res.status(err.response.status).send(err.response.data);
    } else if (err.request) {
      res.send(err.request);
    }
    next(err);
  }
};

new function


问:
Angular (nginx) CSP advised settings do no allow a service worker as trusted
I  have been trying to get the serviceWorker to function as well as a jQuery slider. I realized that

jQuery = bad practice
so fine, got rid of jQuery and used angular tabs instead.

But your own service worker does not work because of trust values that you say to add in the CSPs:

```<code>Service worker registration failed: TypeError: Failed to execute 'register' on 'ServiceWorkerContainer': This document requires 'TrustedScriptURL' assignment.
</code>```

I get not wanting to use jQuery, but please advise on how to get around your own serviceWorker trust issue

Adding this:

```<code> navigator.serviceWorker.register('/ngsw-worker.js').then((registration) => {
        console.log('Service worker registration succeeded:', registration);
      }, /*catch*/ (error) => {
        console.error(`Service worker registration failed: ${error}`);
      });
</code>```

will not let you register the ngsw-worker.js because of your CSP advised settings???

Please advise

Body:
I  have been trying to get the serviceWorker to function as well as a jQuery slider. I realized that

jQuery = bad practice
so fine, got rid of jQuery and used angular tabs instead.

But your own service worker does not work because of trust values that you say to add in the CSPs:

Service worker registration failed: TypeError: Failed to execute 'register' on 'ServiceWorkerContainer': This document requires 'TrustedScriptURL' assignment.

I get not wanting to use jQuery, but please advise on how to get around your own serviceWorker trust issue

Adding this:

 navigator.serviceWorker.register('/ngsw-worker.js').then((registration) => {
        console.log('Service worker registration succeeded:', registration);
      }, /*catch*/ (error) => {
        console.error(`Service worker registration failed: ${error}`);
      });

will not let you register the ngsw-worker.js because of your CSP advised settings???

Please advise


问:
I can't seems to use my python code to print with my thermal printer
so I bought a thermal printer thinking I could use his usb port with python 3.9.7 to print with it but I get this error message:

```<code>c:/Users/gabpe/OneDrive/Documents/Python/Projet/Billing/TP_Test.py
Traceback (most recent call last):
  File "c:\Users\gabpe\OneDrive\Documents\Python\Projet\Billing\TP_Test.py", line 6, in <module>
    p = Usb(0x416, 0x5011)
  File "C:\ProgramData\AnacondaML\lib\site-packages\escpos\printer.py", line 51, in __init__
    self.open()
  File "C:\ProgramData\AnacondaML\lib\site-packages\escpos\printer.py", line 68, in open
    self.device.detach_kernel_driver(0)
  File "C:\ProgramData\AnacondaML\lib\site-packages\usb\core.py", line 1121, in detach_kernel_driver
    self._ctx.backend.detach_kernel_driver(
  File "C:\ProgramData\AnacondaML\lib\site-packages\usb\backend\libusb0.py", line 662, in detach_kernel_driver
    raise NotImplementedError(self.detach_kernel_driver.__name__)
NotImplementedError: detach_kernel_driver
</code>```

This is the code I'm using for now:

```<code>from escpos.printer import Usb

TPrinter = Usb(0x416, 0x5011)
TPrinter.text("Please work\n")
TPrinter.close()
</code>```

Just a basic thing to get me started. '0x416', '0x5011', '0x8', '0x1' this is my printer: idVendor, idProduct, address and bus. I'm using Windows 10 and I didn't install any driver for the thermal printer, which seems to be the problem as I saw on another post, but I don't know if I can do it without or if I need and driver or something and which driver to use, or maybe if there's another library I could use. Thx

Body:
so I bought a thermal printer thinking I could use his usb port with python 3.9.7 to print with it but I get this error message:

c:/Users/gabpe/OneDrive/Documents/Python/Projet/Billing/TP_Test.py
Traceback (most recent call last):
  File "c:\Users\gabpe\OneDrive\Documents\Python\Projet\Billing\TP_Test.py", line 6, in <module>
    p = Usb(0x416, 0x5011)
  File "C:\ProgramData\AnacondaML\lib\site-packages\escpos\printer.py", line 51, in __init__
    self.open()
  File "C:\ProgramData\AnacondaML\lib\site-packages\escpos\printer.py", line 68, in open
    self.device.detach_kernel_driver(0)
  File "C:\ProgramData\AnacondaML\lib\site-packages\usb\core.py", line 1121, in detach_kernel_driver
    self._ctx.backend.detach_kernel_driver(
  File "C:\ProgramData\AnacondaML\lib\site-packages\usb\backend\libusb0.py", line 662, in detach_kernel_driver
    raise NotImplementedError(self.detach_kernel_driver.__name__)
NotImplementedError: detach_kernel_driver

This is the code I'm using for now:

from escpos.printer import Usb

TPrinter = Usb(0x416, 0x5011)
TPrinter.text("Please work\n")
TPrinter.close()

Just a basic thing to get me started. '0x416', '0x5011', '0x8', '0x1' this is my printer: idVendor, idProduct, address and bus. I'm using Windows 10 and I didn't install any driver for the thermal printer, which seems to be the problem as I saw on another post, but I don't know if I can do it without or if I need and driver or something and which driver to use, or maybe if there's another library I could use. Thx


问:
Source of methods of string, Math and array Objects
I cannot find the source code of the method of JavaScript defaut object like string, Math, and array.

for example when I call the method trim()  without parentheses to get the source it only says:-

function trim() { [native code] }

Where is this Native code???


问:
How can I get a C# console application to return a securestring as output to a powershell console
I need to build a C# console application that will allow me to pass in a string, convert it to a secure string, and pass it out to PowerShell

The reason for this is that we have PowerShell event logging enabled in our environment. When you use the function ConvertTo-SecureString, the clear text password gets logged in the Event log which is a security issue.

I have the code that will accept a string input, and convert it to a securestring, but I cannot find a way to return a securestring. Most ideally, it would instead create an encrypted string like ConvertFrom-Securestring does in PowerShell.

I cannot seem to find a way to do this, but I am still digging into it


问:
AWS Amplify Deployment on ReactJS - Module Not Found AWS Exports
Currently have my login page working in my local environment that I am coding in ReactJS.

My code is:

import React, { useState } from 'react';
import { Amplify } from 'aws-amplify';

import NavBar from "../components/navbar";

import { Authenticator } from '@aws-amplify/ui-react';
import '@aws-amplify/ui-react';

import awsmobile from '../aws-exports';
Amplify.configure(awsmobile);

const Login = () =>{

  return (

Login

      <NavBar />
      <Authenticator>
        {({ signOut, user }) => (

Hello {user.username}

            <button onClick={signOut}>Sign out</button>

        )}
      </Authenticator>

  );
}
export default Login;```

The page locally doesn't present any errors int he code but when I publish my changes to GitHJub and Amplify picks up the new copy of the repo it errors out.

The error from the log in Amplify is:
Module not found: Error: Can't resolve '../aws-exports' in '/codebuild/output/src319668361/src/MyProject/src/pages'

I have seen that the issue could lie with importing the aws-exports file as it should be set as a path in an evironment variable. Is there a way to disable that for now as I am just playing around and learning the library for the first or does my issue lie in something else?

Also, I saw a similar post and tried the `change aws-exports to awsmobile' since it is exported from that generated file as "awsmobile" and I still run into the same issue.

Let me know if I can offer anymore information that can help pinpoint to the cause! Thank you in advance.

Body:
Currently have my login page working in my local environment that I am coding in ReactJS.

My code is:

import React, { useState } from 'react';
import { Amplify } from 'aws-amplify';

import NavBar from "../components/navbar";

import { Authenticator } from '@aws-amplify/ui-react';
import '@aws-amplify/ui-react';

import awsmobile from '../aws-exports';
Amplify.configure(awsmobile);

const Login = () =>{

  return (

Login

      <NavBar />
      <Authenticator>
        {({ signOut, user }) => (

Hello {user.username}

            <button onClick={signOut}>Sign out</button>

        )}
      </Authenticator>

  );
}
export default Login;

The page locally doesn't present any errors int he code but when I publish my changes to GitHJub and Amplify picks up the new copy of the repo it errors out.

The error from the log in Amplify is:
Module not found: Error: Can't resolve '../aws-exports' in '/codebuild/output/src319668361/src/MyProject/src/pages'

I have seen that the issue could lie with importing the aws-exports file as it should be set as a path in an evironment variable. Is there a way to disable that for now as I am just playing around and learning the library for the first or does my issue lie in something else?

Also, I saw a similar post and tried the `change aws-exports to awsmobile' since it is exported from that generated file as "awsmobile" and I still run into the same issue.

Let me know if I can offer anymore information that can help pinpoint to the cause! Thank you in advance.


问:
JavaCV overlay FFmpegFrameFilter not working
When I use overlay in JavaCV to overlay two videos, it does'nt work.

video1 info:Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1512x982, 2208 kb/s, SAR 1:1 DAR 756:491, 29.37 fps, 29.42 tbr, 16k tbn (default)

video2 info: png (png  / 0x20676E70), rgba(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 470102 kb/s, 50 fps, 50 tbr, 12800 tbn (default)

video2 has a transparent background, and it was converted with a chromakey filter.

I can do it with ffmpeg command:
ffmpeg -i bg.mp4 -i out1.mov -filter_complex overlay  xx.mp4

But when I use JavaCV to do the same thing, it does'nt work. The output video lost color, and it was divided into three equal parts, each with the same content.

Here is the code:

```<code>        String bgMp4 = "bg.mp4";
        String mov = "front.mov";

        FFmpegFrameGrabber video1 = new FFmpegFrameGrabber(bgMp4);
        FFmpegFrameGrabber video2 = new FFmpegFrameGrabber(mov);

        // Open the videos for reading
        video1.start();
        video2.start();

        // Create an instance of the FFmpegFrameFilter class to handle the video overlay
        FFmpegFrameFilter overlayFilter = new FFmpegFrameFilter("[0:v][1:v]overlay=10:10[v]", video1.getImageWidth(), video1.getImageHeight());
        overlayFilter.setVideoInputs(2);
        overlayFilter.start();

        FFmpegFrameRecorder recorder = new FFmpegFrameRecorder("out.mp4", video1.getImageWidth(), video1.getImageHeight());
        recorder.setFrameRate(video1.getFrameRate());
        // wether AV_CODEC_ID_PNG or AV_CODEC_ID_H264, not work.
        recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
        recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
        recorder.start();

        // Read in the frames from the input videos and apply the overlay filter
        Frame frame1, frame2;
        while ((frame1 = video1.grabImage()) != null && (frame2 = video2.grabImage()) != null) {
            overlayFilter.push(0, frame1);
            overlayFilter.push(1, frame2);
            Frame frame = overlayFilter.pullImage();
            recorder.record(frame);
        }

        // Close the videos and filter
        video1.stop();
        video2.stop();
        overlayFilter.stop();
        recorder.stop();
</code>```

Body:
When I use overlay in JavaCV to overlay two videos, it does'nt work.

video1 info:Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1512x982, 2208 kb/s, SAR 1:1 DAR 756:491, 29.37 fps, 29.42 tbr, 16k tbn (default)

video2 info: png (png  / 0x20676E70), rgba(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 470102 kb/s, 50 fps, 50 tbr, 12800 tbn (default)

video2 has a transparent background, and it was converted with a chromakey filter.

I can do it with ffmpeg command:
ffmpeg -i bg.mp4 -i out1.mov -filter_complex overlay  xx.mp4

But when I use JavaCV to do the same thing, it does'nt work. The output video lost color, and it was divided into three equal parts, each with the same content.

Here is the code:

        String bgMp4 = "bg.mp4";
        String mov = "front.mov";

        FFmpegFrameGrabber video1 = new FFmpegFrameGrabber(bgMp4);
        FFmpegFrameGrabber video2 = new FFmpegFrameGrabber(mov);

        // Open the videos for reading
        video1.start();
        video2.start();

        // Create an instance of the FFmpegFrameFilter class to handle the video overlay
        FFmpegFrameFilter overlayFilter = new FFmpegFrameFilter("[0:v][1:v]overlay=10:10[v]", video1.getImageWidth(), video1.getImageHeight());
        overlayFilter.setVideoInputs(2);
        overlayFilter.start();

        FFmpegFrameRecorder recorder = new FFmpegFrameRecorder("out.mp4", video1.getImageWidth(), video1.getImageHeight());
        recorder.setFrameRate(video1.getFrameRate());
        // wether AV_CODEC_ID_PNG or AV_CODEC_ID_H264, not work.
        recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
        recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
        recorder.start();

        // Read in the frames from the input videos and apply the overlay filter
        Frame frame1, frame2;
        while ((frame1 = video1.grabImage()) != null && (frame2 = video2.grabImage()) != null) {
            overlayFilter.push(0, frame1);
            overlayFilter.push(1, frame2);
            Frame frame = overlayFilter.pullImage();
            recorder.record(frame);
        }

        // Close the videos and filter
        video1.stop();
        video2.stop();
        overlayFilter.stop();
        recorder.stop();


问:
The certificate data cannot be read with the provided password, the password may be incorrect when running .Net 6 API with Docker Support on Mac M1
Error:

The certificate data cannot be read with the provided password, the
password may be incorrect.
System.Security.Cryptography.X509Certificates

I am using Visual Studio 2022 for Mac M1 with Docker Support.

I wanted also to containerize my .Net 6 API and run this on Docker Desktop so that I can debug other Web App using this API.

Already run the following commands to reconfigure my certificate and Manage User Secrets and still not working.

dotnet dev-certs https --clean

dotnet dev-certs https --trust

Thanks in advance for any help and support.


问:
Difference between Intel EPT and AMD NPT
In EPT,  The first step of address translation like this：

gpa = guest CR3 + gva[top index]

hpa = EPT(gpa)

In NPT,  The first step of address translation like this：

hpa = NPT(guest CR3)

hpa += gva[top index]

Both get the same result, which one is best?


问:
Logstash pagination quits early
I'm having a problem that i could not crack by googling, we are doing a load with jdbc plugin, using explicit pagination. when pipeline runs it is loading about 3.2 million records and then quits without errors like it finished successfully, but it should load around 6.4 million records. Here are our configuration:

```<code>input {
            jdbc {
                        id => "NightlyRun"
                        jdbc_connection_string => "*******"
                        jdbc_driver_class => "Driver"
                        jdbc_user => "${USER}"
                        jdbc_password => "${PASS}"
                        lowercase_column_names => "false"
                        jdbc_paging_enabled => true
                        jdbc_page_size => 50000
                        jdbc_paging_mode => "explicit"
                        schedule => "5 2 * * *"
                        statement_filepath => "/usr/share/logstash/sql-files/sqlQuery1.sql"
                        }
}
}
output {
  elasticsearch {
      hosts => ["${ELASTIC_HOST}:9200"]
      index => "index"
      user => logstash
      password => "${PASSWORD}"
      document_id => "%{NUMBER}-%{value}"
  }
}
And sql query we use:
declare @PageSize int
declare  @Offset integer
set @PageSize=:size
set @Offset=:offset;
WITH cte AS
         (
             SELECT
                 id
             FROM
                 entry
             ORDER BY CREATE_TIMESTAMP
             OFFSET @Offset ROWS
                 FETCH NEXT @PageSize ROWS ONLY
         )
select * from entry
where entry.id=cte.id
</code>```

the cte select count(*) from entry returns the expected 6.4 million records but logstash loads only 3.2 million before quitting. How can I ensure logstash loads all the records.

I tried running the query in database and setting offset to 3200000 and page size to 50000, database returns results, so it is not likely a database issue.

Title: Logstash pagination quits early

Body:
I'm having a problem that i could not crack by googling, we are doing a load with jdbc plugin, using explicit pagination. when pipeline runs it is loading about 3.2 million records and then quits without errors like it finished successfully, but it should load around 6.4 million records. Here are our configuration:

input {
            jdbc {
                        id => "NightlyRun"
                        jdbc_connection_string => "*******"
                        jdbc_driver_class => "Driver"
                        jdbc_user => "${USER}"
                        jdbc_password => "${PASS}"
                        lowercase_column_names => "false"
                        jdbc_paging_enabled => true
                        jdbc_page_size => 50000
                        jdbc_paging_mode => "explicit"
                        schedule => "5 2 * * *"
                        statement_filepath => "/usr/share/logstash/sql-files/sqlQuery1.sql"
                        }
}
}
output {
  elasticsearch {
      hosts => ["${ELASTIC_HOST}:9200"]
      index => "index"
      user => logstash
      password => "${PASSWORD}"
      document_id => "%{NUMBER}-%{value}"
  }
}
And sql query we use:
declare @PageSize int
declare  @Offset integer
set @PageSize=:size
set @Offset=:offset;
WITH cte AS
         (
             SELECT
                 id
             FROM
                 entry
             ORDER BY CREATE_TIMESTAMP
             OFFSET @Offset ROWS
                 FETCH NEXT @PageSize ROWS ONLY
         )
select * from entry
where entry.id=cte.id

the cte select count(*) from entry returns the expected 6.4 million records but logstash loads only 3.2 million before quitting. How can I ensure logstash loads all the records.

I tried running the query in database and setting offset to 3200000 and page size to 50000, database returns results, so it is not likely a database issue.


问:
React native expo custom tab navigation unique add button center using react-navigation/bottom-tabs
I'm trying to create a custom navigation in react native according to the design (shown below the picture). But I don't know how I can make this perfectly. I also attached my current implementation but its far from the actual design. I use @react-navigation/bottom-tabs package and do a little tweaking. If there's a suggestion for what library has this. I would gladly listen to. I would like to do some box shadow and border radius on bottom tabs. Also the truncated part semi circle part on add button in the center.

Here's what I want:
actual_design_UI

I'm using android studio emulator.

Heres the screenshot of my work:

my_current_design_UI

Tab guide based on the code: bottom_navigator

BottomNavigator.js

```<code>
import React from 'react';
import Search from '../screens/Search';
import Profile from '../screens/Profile';
import WeeklyRanking from '../screens/WeeklyRanking';
import Home from '../screens/Home';

import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import DiscoverSvg from '../../assets/icons/discover.svg';
import AwardsSvg from '../../assets/icons/awards.svg';
import ProfileSvg from '../../assets/icons/profile.svg';
import BellSvg from '../../assets/icons/bell.svg';
import Search from '../screens/Search';
import WeeklyRanking from '../screens/WeeklyRanking';
import Profile from '../screens/Profile';

const Tab = createBottomTabNavigator();

const BottomNavigator = () =\> {
const navigation = useNavigation();
const route = useRoute();

    const [activeIndex, setActiveIndex] = useState(0);

    const handleShowOptions = () => {
    navigation.navigate('OptionStack')
    }

    const token = useSelector(state => state.user?.token)

    useEffect(() => {
        if(token){
            navigation.navigate('MedicalRecords');
        }
    },[token])

    return (
            <Tab.Navigator
                initialRouteName='Home'
                screenOptions={{
                tabBarShowLabel: false,
                headerStyle: {
                    backgroundColor: '#F2F6F9',

                    elevation: 0, // remove shadow on Android
                    shadowOpacity: 0, // remove shadow on iOS
                    borderBottomWidth: 0
                },
                headerTintColor: '#0A0C2B',
                headerTitleAlign: 'center',
                headerTitleStyle: {
                    fontWeight: '900',
                    fontSize: 18,
                    lineHeight: 27,
                    fontFamily: 'Noto-Sans-Bold'
                },
                tabBarStyle:{
                    height:65,
                },
                tabBarItemStyle: {
                    paddingBottom: 10
                },
                tabBarIconStyle:{
                },
                gestureEnabled: true,
                gestureDirection: "horizontal",
                ...TransitionPresets.SlideFromRightIOS
            }}>
                <Tab.Screen name="Home" component={Home} options={{
                            title: 'ホーム',
                            headerRight: () => (<View className="mr-4"><BellSvg width={23} height={23} /></View>),
                            tabBarIcon: ({color, size, focused}) => (<HomeSvg width={25} height={25} fill={focused ? '#0A0C2B': '#CCCCCC'} />),
                }}/>
                <Tab.Screen name="Search" component={Search} options={{
                            title: '調べる',
                            tabBarIcon: ({color, size, focused}) => (<DiscoverSvg width={75} height={50} stroke={ focused ? '#0A0C2B': '#CCCCCC'} />),
                }}/>
                {/* #f2f6f7 */}
                <Tab.Screen name="Add" component={MedicalRecordsStack} options={{
                            tabBarIcon: ({color, size}) => (
                                <View style={{
                                    position: 'relative',
                                    bottom: 0,}}>
                                    <View style={{
                                        position: 'absolute',
                                        alignSelf: 'center',
                                        backgroundColor: '#f2f6f7',
                                        width: 80,
                                        height: 70,
                                        borderRadius: 35,
                                        bottom: 0,
                                        zIndex: 10,
                                    }}>
                                            <Ionicons style={{marginLeft: 8, marginTop: -1}} name="add-circle" color={'#31b9b9'} size={68}></Ionicons>
                                    </View>
                                </View>
                            ),
                }}/>
                <Tab.Screen name="WeeklyRanking" component={WeeklyRanking} options={{
                            title: '週間ランキング',
                            tabBarIcon: ({color, size, focused}) => (<AwardsSvg width={25} height={25} stroke={ focused ? '#0A0C2B': '#CCCCCC'}/>),
                }}/>
                <Tab.Screen name="Profile" component={Profile} options={{
                            title: 'プロフィール',
                            tabBarIcon: ({color, size, focused}) => (<ProfileSvg width={25} height={25} stroke={ focused ? '#0A0C2B': '#CCCCCC'}/>),
                            headerRight: (props) => (
                            <TouchableOpacity
                                android_ripple={{
                                color: '#fff',
                                foreground: true,
                                borderless: true,
                                }} onPress={handleShowOptions}>
                                <View className='pr-3'>
                                <Image source={require('../../assets/ic_nav_cog.png')} style={{width:24, height:24}}/>
                                </View>

                            </TouchableOpacity>
                            )
                }}/>
            </Tab.Navigator>
    );

}
</code>```

------------------------------------------

package.json

```<code>
  "name": "testing-app",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/webpack-config": "^0.17.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.2.0",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.0",
    "@react-navigation/stack": "^6.3.2",
    "@reduxjs/toolkit": "^1.8.6",
    "axios": "^1.1.2",
    "babel-preset-expo": "~9.2.0",
    "expo": "~46.0.13",
    "expo-checkbox": "~2.2.0",
    "expo-font": "~10.2.0",
    "expo-image-picker": "~13.3.1",
    "expo-status-bar": "~1.4.0",
    "lottie-react-native": "5.1.3",
    "moment": "^2.29.4",
    "radio-buttons-react-native": "^1.0.4",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-native": "0.69.6",
    "react-native-calendar-picker": "^7.1.2",
    "react-native-dropdown": "^0.0.6",
    "react-native-dropdown-picker": "^5.4.2",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-image-slider-box": "github:megamaxs1234/react-native-image-slider-box",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "5.4.24",
    "react-native-reanimated": "~2.9.1",
    "react-native-safe-area-context": "4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-select-dropdown": "^2.0.4",
    "react-native-size-matters": "^0.4.0",
    "react-native-svg": "12.3.0",
    "react-native-tab-view": "^3.3.0",
    "react-native-user-avatar": "^1.0.8",
    "react-native-web": "~0.18.7",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-redux": "^8.0.4",
    "tailwindcss-react-native": "^1.7.10"
  },
  "devDependencies": {
    "@babel/core": "^7.18.6",
    "react-native-svg-transformer": "^1.0.0",
    "tailwindcss": "^3.1.8"
  },
  "private": true
}
</code>```

Body:
I'm trying to create a custom navigation in react native according to the design (shown below the picture). But I don't know how I can make this perfectly. I also attached my current implementation but its far from the actual design. I use @react-navigation/bottom-tabs package and do a little tweaking. If there's a suggestion for what library has this. I would gladly listen to. I would like to do some box shadow and border radius on bottom tabs. Also the truncated part semi circle part on add button in the center.

Here's what I want:
actual_design_UI

I'm using android studio emulator.

Heres the screenshot of my work:

my_current_design_UI

Tab guide based on the code: bottom_navigator

BottomNavigator.js

import React from 'react';
import Search from '../screens/Search';
import Profile from '../screens/Profile';
import WeeklyRanking from '../screens/WeeklyRanking';
import Home from '../screens/Home';

import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import DiscoverSvg from '../../assets/icons/discover.svg';
import AwardsSvg from '../../assets/icons/awards.svg';
import ProfileSvg from '../../assets/icons/profile.svg';
import BellSvg from '../../assets/icons/bell.svg';
import Search from '../screens/Search';
import WeeklyRanking from '../screens/WeeklyRanking';
import Profile from '../screens/Profile';

const Tab = createBottomTabNavigator();

const BottomNavigator = () =\> {
const navigation = useNavigation();
const route = useRoute();

    const [activeIndex, setActiveIndex] = useState(0);

    const handleShowOptions = () => {
    navigation.navigate('OptionStack')
    }

    const token = useSelector(state => state.user?.token)

    useEffect(() => {
        if(token){
            navigation.navigate('MedicalRecords');
        }
    },[token])

    return (
            <Tab.Navigator
                initialRouteName='Home'
                screenOptions={{
                tabBarShowLabel: false,
                headerStyle: {
                    backgroundColor: '#F2F6F9',

                    elevation: 0, // remove shadow on Android
                    shadowOpacity: 0, // remove shadow on iOS
                    borderBottomWidth: 0
                },
                headerTintColor: '#0A0C2B',
                headerTitleAlign: 'center',
                headerTitleStyle: {
                    fontWeight: '900',
                    fontSize: 18,
                    lineHeight: 27,
                    fontFamily: 'Noto-Sans-Bold'
                },
                tabBarStyle:{
                    height:65,
                },
                tabBarItemStyle: {
                    paddingBottom: 10
                },
                tabBarIconStyle:{
                },
                gestureEnabled: true,
                gestureDirection: "horizontal",
                ...TransitionPresets.SlideFromRightIOS
            }}>
                <Tab.Screen name="Home" component={Home} options={{
                            title: 'ホーム',
                            headerRight: () => (<View className="mr-4"><BellSvg width={23} height={23} /></View>),
                            tabBarIcon: ({color, size, focused}) => (<HomeSvg width={25} height={25} fill={focused ? '#0A0C2B': '#CCCCCC'} />),
                }}/>
                <Tab.Screen name="Search" component={Search} options={{
                            title: '調べる',
                            tabBarIcon: ({color, size, focused}) => (<DiscoverSvg width={75} height={50} stroke={ focused ? '#0A0C2B': '#CCCCCC'} />),
                }}/>
                {/* #f2f6f7 */}
                <Tab.Screen name="Add" component={MedicalRecordsStack} options={{
                            tabBarIcon: ({color, size}) => (
                                <View style={{
                                    position: 'relative',
                                    bottom: 0,}}>
                                    <View style={{
                                        position: 'absolute',
                                        alignSelf: 'center',
                                        backgroundColor: '#f2f6f7',
                                        width: 80,
                                        height: 70,
                                        borderRadius: 35,
                                        bottom: 0,
                                        zIndex: 10,
                                    }}>
                                            <Ionicons style={{marginLeft: 8, marginTop: -1}} name="add-circle" color={'#31b9b9'} size={68}></Ionicons>
                                    </View>
                                </View>
                            ),
                }}/>
                <Tab.Screen name="WeeklyRanking" component={WeeklyRanking} options={{
                            title: '週間ランキング',
                            tabBarIcon: ({color, size, focused}) => (<AwardsSvg width={25} height={25} stroke={ focused ? '#0A0C2B': '#CCCCCC'}/>),
                }}/>
                <Tab.Screen name="Profile" component={Profile} options={{
                            title: 'プロフィール',
                            tabBarIcon: ({color, size, focused}) => (<ProfileSvg width={25} height={25} stroke={ focused ? '#0A0C2B': '#CCCCCC'}/>),
                            headerRight: (props) => (
                            <TouchableOpacity
                                android_ripple={{
                                color: '#fff',
                                foreground: true,
                                borderless: true,
                                }} onPress={handleShowOptions}>
                                <View className='pr-3'>
                                <Image source={require('../../assets/ic_nav_cog.png')} style={{width:24, height:24}}/>
                                </View>

                            </TouchableOpacity>
                            )
                }}/>
            </Tab.Navigator>
    );

}

------------------------------------------

package.json

  "name": "testing-app",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/webpack-config": "^0.17.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.2.0",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.0",
    "@react-navigation/stack": "^6.3.2",
    "@reduxjs/toolkit": "^1.8.6",
    "axios": "^1.1.2",
    "babel-preset-expo": "~9.2.0",
    "expo": "~46.0.13",
    "expo-checkbox": "~2.2.0",
    "expo-font": "~10.2.0",
    "expo-image-picker": "~13.3.1",
    "expo-status-bar": "~1.4.0",
    "lottie-react-native": "5.1.3",
    "moment": "^2.29.4",
    "radio-buttons-react-native": "^1.0.4",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-native": "0.69.6",
    "react-native-calendar-picker": "^7.1.2",
    "react-native-dropdown": "^0.0.6",
    "react-native-dropdown-picker": "^5.4.2",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-image-slider-box": "github:megamaxs1234/react-native-image-slider-box",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "5.4.24",
    "react-native-reanimated": "~2.9.1",
    "react-native-safe-area-context": "4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-select-dropdown": "^2.0.4",
    "react-native-size-matters": "^0.4.0",
    "react-native-svg": "12.3.0",
    "react-native-tab-view": "^3.3.0",
    "react-native-user-avatar": "^1.0.8",
    "react-native-web": "~0.18.7",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-redux": "^8.0.4",
    "tailwindcss-react-native": "^1.7.10"
  },
  "devDependencies": {
    "@babel/core": "^7.18.6",
    "react-native-svg-transformer": "^1.0.0",
    "tailwindcss": "^3.1.8"
  },
  "private": true
}


问:
what is __google_connectivity_prober of GCP SQL insight
I have 2 GCP projects, and both of them have enabled Query Insight recently.

I was wondering what is
__google_connectivity_prober
of Query Insight User of GCP SQL? It just appear in one of projects, and document not explain the user.

DB version:MySQL 8.0.26
region:asia-east2-b

info

I've survey document of Query Insight, but not explain the user.

why only one of my projects have __google_connectivity_prober user?
and what is it?

thanks.


问:
Nuxt 405 error on generate and build for production
When running nuxt generate the app will return a 405 error, I believe for each of the /api routes that exist.
generate error pic. Its deployed with gh-pages -d dist to GitHub Pages w/ custom domain. 404 and 405 errors are returned when trying to access a page which makes axios calls to /api routes. production error pic. The app runs fine on localhost:3000 and can make all GET and POST calls to /api routes successfully.Tried tinkering with the nuxt.config.js but with no luck. It's possibly narrowed down to the nuxt.config.js settings and probably something to do with the production URL. Let me know what else I can provide to help you help me. Thanks.

App stack: Nuxt, nodejs, express, axios, knex, jwt, nuxt/auth

nuxt.config.js

```<code>export default {

  target: 'static',

  head: {
    title: '',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [{
        charset: 'utf-8'
      },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1'
      },
      {
        hid: 'description',
        name: 'description',
        content: ''
      },
      {
        name: 'format-detection',
        content: 'telephone=no'
      }
    ],
    link: [{
        rel: 'icon',
        type: 'image/x-icon',
        href: '/icon.ico'
      },
    ]
  },

  css: [],

  loading: {
    color: '#4caf50',
    height: '6px'
  },

  plugins: [{
    src: '~/plugins/imagezoom.client.js'
  }],

  components: true,

  buildModules: [
  ],

  server: {
    port: process.env.PORT || 3000,
    host: '0.0.0.0'
  },

  modules: [
    // https://go.nuxtjs.dev/bootstrap
    'bootstrap-vue/nuxt',
    '@nuxtjs/axios',
    '@nuxtjs/auth-next',
    'nuxt-lazy-load'
  ],

  serverMiddleware: [
    '~/api/index.js'
  ],

  auth: {
    strategies: {
      local: {
        scheme: 'local',
        endpoints: {
          login: {
            url: "api/auth/login",
            method: "post",
            propertyName: "token"
          },
          user: {
            url: "/api/auth/user",
            method: "get",
            propertyName: "user"
          },
          logout: true
        },
        // tokenType: ''
      }
    }
  },

  generate: {
    fallback: "404.html"
  },

  axios: {
    baseURL: (process.env.NODE_ENV !== 'production' ? 'http://localhost:3000/' : 'https://<my-site-redacted>.com/'),
    credentials: false
  },
  publicRuntimeConfig: {
    axios: {
      browserBaseURL: process.env.BROWSER_BASE_URL
    },
    googleAnalytics: {
      id: process.env.GOOGLE_ANALYTICS_ID
    }
  },
  privateRuntimeConfig: {
    axios: {
      baseURL: process.env.BASE_URL
    }
  },

  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",

  ssr: true,
  router: {
    middleware: ['auth'],
    base: '/'
  },

  build: {
    standalone: true,
    publicPath: 'https://<my-site-redacted>.com/'
  },
  vue: {
    config: {
      productionTip: false,
      devtools: (process.env.NODE_ENV === "production" ? false : true)
    }
  }
}

</code>```

Tried altering setup in nuxt.config.js (axios, path, URL, router, build)

Body:
When running nuxt generate the app will return a 405 error, I believe for each of the /api routes that exist.
generate error pic. Its deployed with gh-pages -d dist to GitHub Pages w/ custom domain. 404 and 405 errors are returned when trying to access a page which makes axios calls to /api routes. production error pic. The app runs fine on localhost:3000 and can make all GET and POST calls to /api routes successfully.Tried tinkering with the nuxt.config.js but with no luck. It's possibly narrowed down to the nuxt.config.js settings and probably something to do with the production URL. Let me know what else I can provide to help you help me. Thanks.

App stack: Nuxt, nodejs, express, axios, knex, jwt, nuxt/auth

nuxt.config.js

export default {

  target: 'static',

  head: {
    title: '',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [{
        charset: 'utf-8'
      },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1'
      },
      {
        hid: 'description',
        name: 'description',
        content: ''
      },
      {
        name: 'format-detection',
        content: 'telephone=no'
      }
    ],
    link: [{
        rel: 'icon',
        type: 'image/x-icon',
        href: '/icon.ico'
      },
    ]
  },

  css: [],

  loading: {
    color: '#4caf50',
    height: '6px'
  },

  plugins: [{
    src: '~/plugins/imagezoom.client.js'
  }],

  components: true,

  buildModules: [
  ],

  server: {
    port: process.env.PORT || 3000,
    host: '0.0.0.0'
  },

  modules: [
    // https://go.nuxtjs.dev/bootstrap
    'bootstrap-vue/nuxt',
    '@nuxtjs/axios',
    '@nuxtjs/auth-next',
    'nuxt-lazy-load'
  ],

  serverMiddleware: [
    '~/api/index.js'
  ],

  auth: {
    strategies: {
      local: {
        scheme: 'local',
        endpoints: {
          login: {
            url: "api/auth/login",
            method: "post",
            propertyName: "token"
          },
          user: {
            url: "/api/auth/user",
            method: "get",
            propertyName: "user"
          },
          logout: true
        },
        // tokenType: ''
      }
    }
  },

  generate: {
    fallback: "404.html"
  },

  axios: {
    baseURL: (process.env.NODE_ENV !== 'production' ? 'http://localhost:3000/' : 'https://<my-site-redacted>.com/'),
    credentials: false
  },
  publicRuntimeConfig: {
    axios: {
      browserBaseURL: process.env.BROWSER_BASE_URL
    },
    googleAnalytics: {
      id: process.env.GOOGLE_ANALYTICS_ID
    }
  },
  privateRuntimeConfig: {
    axios: {
      baseURL: process.env.BASE_URL
    }
  },

  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",

  ssr: true,
  router: {
    middleware: ['auth'],
    base: '/'
  },

  build: {
    standalone: true,
    publicPath: 'https://<my-site-redacted>.com/'
  },
  vue: {
    config: {
      productionTip: false,
      devtools: (process.env.NODE_ENV === "production" ? false : true)
    }
  }
}

Tried altering setup in nuxt.config.js (axios, path, URL, router, build)