问:
Why is this an ambiguous call to Constructor (const path& -vs- const vector<path>&)?
I have a class, DataHandler, with two constructors:

namespace fs = std::filesystem;

class DataHandler {
public:
  explicit DataHandler(const fs::path & dataPath);
  DataHandler(const std::vector<fs::path> &dataPaths);
  ...
}
```
<p>In <code>int main()</code>, I instantiate a <code>DataHandler</code>, attempting to initialize using the 2nd CTOR using a initializer list:</p>
<pre class="lang-cpp prettyprint-override"><code>const fs::path basePath = "../data";
std::vector<fs::path> dataPaths;
fs::path trainCsv = basePath / "train.csv";
fs::path testCsv = basePath / "test.csv";
dataPaths.push_back(trainCsv);
dataPaths.push_back(testCsv);

//DataHandler dh(dataPaths);
DataHandler dh({trainCsv, testCsv});
</code>```

Instead of creating a vector and calling CTOR#2, the compiler says that this is an ambiguous call. I've looked at the various filesystem::path constructors, and can't figure out which one would conflict with CTOR#2.

Compiler errors:

.../src/main.cpp:36:17: error: call to constructor of 'DataHandler' is ambiguous
    DataHandler dh({trainCsv, testCsv});
                ^  ~~~~~~~~~~~~~~~~~~~
.../include/DataHandler.hpp:49:14: note: candidate constructor
    explicit DataHandler(const fs::path & dataPath);
             ^
.../include/DataHandler.hpp:50:5: note: candidate constructor
    DataHandler(const std::vector<fs::path> &dataPaths);
    ^
1 error generated.
```
<p>Can someone please describe what the compiler is seeing that I am not?</p>
<h2>Rewritten to reproduce with minimal code</h2>
<p>I am getting same errors with the following code:</p>
<pre class="lang-cpp prettyprint-override"><code>namespace fs = std::filesystem;

class DataHandler {
public:
    explicit DataHandler(const fs::path & dataPath) {
        cout << "In path CTOR" << endl;
    };
    DataHandler(const std::vector<fs::path> &dataPaths) {
        cout << "In vector CTOR" << endl;
    }
};

int main()
{
    const fs::path basePath = "../data";
    std::vector<fs::path> dataPaths;
    fs::path trainCsv = basePath / "train.csv";
    fs::path testCsv = basePath / "test.csv";
    dataPaths.push_back(trainCsv);
    dataPaths.push_back(testCsv);

    //DataHandler dh(dataPaths);
    DataHandler dh({trainCsv, testCsv});
}
</code>```

Building an fs::path with init_list of two items:

fs::path p({"/path1", "path2"}); yields following candidates:

_LIBCPP_INLINE_VISIBILITY path(path&& __p) noexcept : __pn_(_VSTD::move(__p.__pn_)) {}

_LIBCPP_INLINE_VISIBILITY path(const path& __p) : __pn_(__p.__pn_) {}

_LIBCPP_INLINE_VISIBILITY path(string_type&& __s, format = format::auto_format) noexcept : __pn_(_VSTD::move(__s)) {}

Body:
I have a class, DataHandler, with two constructors:

namespace fs = std::filesystem;

class DataHandler {
public:
  explicit DataHandler(const fs::path & dataPath);
  DataHandler(const std::vector<fs::path> &dataPaths);
  ...
}

In int main(), I instantiate a DataHandler, attempting to initialize using the 2nd CTOR using a initializer list:

const fs::path basePath = "../data";
std::vector<fs::path> dataPaths;
fs::path trainCsv = basePath / "train.csv";
fs::path testCsv = basePath / "test.csv";
dataPaths.push_back(trainCsv);
dataPaths.push_back(testCsv);

//DataHandler dh(dataPaths);
DataHandler dh({trainCsv, testCsv});

Instead of creating a vector and calling CTOR#2, the compiler says that this is an ambiguous call. I've looked at the various filesystem::path constructors, and can't figure out which one would conflict with CTOR#2.

Compiler errors:

.../src/main.cpp:36:17: error: call to constructor of 'DataHandler' is ambiguous
    DataHandler dh({trainCsv, testCsv});
                ^  ~~~~~~~~~~~~~~~~~~~
.../include/DataHandler.hpp:49:14: note: candidate constructor
    explicit DataHandler(const fs::path & dataPath);
             ^
.../include/DataHandler.hpp:50:5: note: candidate constructor
    DataHandler(const std::vector<fs::path> &dataPaths);
    ^
1 error generated.

Can someone please describe what the compiler is seeing that I am not?

Rewritten to reproduce with minimal code

I am getting same errors with the following code:

namespace fs = std::filesystem;

class DataHandler {
public:
    explicit DataHandler(const fs::path & dataPath) {
        cout << "In path CTOR" << endl;
    };
    DataHandler(const std::vector<fs::path> &dataPaths) {
        cout << "In vector CTOR" << endl;
    }
};

int main()
{
    const fs::path basePath = "../data";
    std::vector<fs::path> dataPaths;
    fs::path trainCsv = basePath / "train.csv";
    fs::path testCsv = basePath / "test.csv";
    dataPaths.push_back(trainCsv);
    dataPaths.push_back(testCsv);

    //DataHandler dh(dataPaths);
    DataHandler dh({trainCsv, testCsv});
}

Building an fs::path with init_list of two items:

fs::path p({"/path1", "path2"}); yields following candidates:

_LIBCPP_INLINE_VISIBILITY path(path&& __p) noexcept : __pn_(_VSTD::move(__p.__pn_)) {}

_LIBCPP_INLINE_VISIBILITY path(const path& __p) : __pn_(__p.__pn_) {}

_LIBCPP_INLINE_VISIBILITY path(string_type&& __s, format = format::auto_format) noexcept : __pn_(_VSTD::move(__s)) {}


来源: stackexchange

问:
Laravel Passport Passport::hashClientSecrets() always gives unathenticated error Error
I am using laravel 9 passport for authenticating user by issuing personal access token.
First I generated client id and client secret by running the following command

```<code>php artisan passport:client --personal
</code>```

and then generated personal access token for a user which is working fine. But when I create hashed secret key by adding

```<code>Passport::hashClientSecrets();
</code>```

into AuthServiceProvider.php and try to create token, I always get the following error

```<code>League\OAuth2\Server\Exception\OAuthServerException: client authentication failed...
</code>```

But when I uncomment the following then everything starts working fine

```<code>Passport::hashClientSecrets();
</code>```

Can anyone explain what I am missing and how can I create personal access token using hashed secret key?

ContentLicense: CC BY-SA 4.0

Body:
I am using laravel 9 passport for authenticating user by issuing personal access token.
First I generated client id and client secret by running the following command

php artisan passport:client --personal

and then generated personal access token for a user which is working fine. But when I create hashed secret key by adding

Passport::hashClientSecrets();

into AuthServiceProvider.php and try to create token, I always get the following error

League\OAuth2\Server\Exception\OAuthServerException: client authentication failed...

But when I uncomment the following then everything starts working fine

Passport::hashClientSecrets();

Can anyone explain what I am missing and how can I create personal access token using hashed secret key?


问:
how can i get the grid representation of the integer
I need to create a method set_from_integer(self, integer_encoding) that sets the colours of all points of the board according to the given integer_encoding which does not change the size of the board. To convert an integer n to ternary representation, as required by set_from_integer(), get the last digit by computing n mod 3. You get the next digit by computing [n/3]mod 3 and so on. For example, to get the last two digits of the ternary representation of 7473:

```<code>#This is the problematic part
   def set_from_integer(self, integer_encoding):
        n = int(integer_encoding)
        list1 = []
        while n != 0:
            rem = n % 3
            list1.append(rem)
            n = n // 3
        list1.reverse()
        for i in list1:
            print(i, end="")
</code>```

So for now the above is what i came up with to get the ternary base of the decimal number but i need to convert this into a grid of symbols according to the given :

(empty = 0, white = 1, black = 2)

My entire code is as follows:

```<code>
def load_board(filename):
    result = "  "
    with open(filename) as f:
        print(f)
        for index, line in enumerate(f):
            if index == 0:
                result += ' '+' '.join([chr(alphabets + 65) for alphabets in range(len(line) - 1)]) + '\n'  # the alphabetical column heading
            result += f"{19 - index:2d}"
            result += ' ' + ' '.join(line.strip()) + '\n'
        return result

def save_board(filename, board):
    with open(filename, "wt") as f:
        f.write(board)

from string import ascii_uppercase as letters
class Board:
#Dictionary created for the colours and the respected symbols
    points = {'E': '.', 'B': '@', 'W': 'O'}

#Constructor
    def __init__(self,size=19,from_strings=None):
        assert 2 <= size <= 26, "Illegal board size: must be between 2 and 26."

        if from_strings != None:
               if type(from_strings) != list:
                   raise AssertionError("input is not a list")
               if len(from_strings) != size:
                   raise AssertionError("length of input list does not match size")
               for i in range(size):
                   if type(from_strings[i]) != str:
                       raise AssertionError("row " + str(i) + " is not a string")
                   if len(from_strings[i]) != size:
                       raise AssertionError("length of row " + str(i) + " does not match size")
                   for j in range(size):
                       if from_strings[i][j] not in ".@O":
                           raise AssertionError("invalid character in row " + str(i))
        self.size = size
        self.grid = [['E'] * size for _ in range(size)]
        self.from_strings = [] if from_strings is None else from_strings

    def get_size(self): #Returns the size of the grid created by the constructor
        return self.size

    def __str__(self):  # creating the grid
        padding = ' '  # Creating a variable with a space assigned so that it acts as a padding to the rows that have a single digit
        heading = '   ' + ' '.join(letters[:self.size])  # Alphabetical heading is created
        lines = [heading]  # adding the alphabetical heading into a list named lines to which the rows will be added later
        for r, row in enumerate(self.grid):
            if len(self.grid) < 10:  # for the grid with a size less than 10 to add the space to the start of the row for the single digits to be aligned
                if (self.from_strings):
                    line = " " + f'{self.size - r} ' + ' '.join(self.from_strings[r])
                else:
                    line = " " + f'{self.size - r} ' + ' '.join(self.points[x] for x in row)
                lines.append(line)
            else:  # for the grids that are larger than 9
                if r > 9:  # for rows 1 to 9 the single digits are aligned according to the first digit from the right of the two digit rows
                    if (self.from_strings):
                        line = f'{self.size - r} ' + ' '.join(self.from_strings[r])
                    else:
                        line = f'{self.size - r} ' + ' '.join(self.points[x] for x in row)
                    line = padding + line  # adding the space using the variable padding to the row created
                    lines.append(line)  # adding the row to the list of rows
                else:  # for the rows 10 onwards - as there is no requirement to add a padding it is not added here
                    if (self.from_strings):
                        line = f'{self.size - r} ' + ' '.join(self.from_strings[r])
                    else:
                        line = f'{self.size - r} ' + ' '.join(self.points[x] for x in row)  # creation of the row
                    lines.append(line)  # adding the newly created row to the list of rows
        return '\n'.join(lines)

    def _to_row_and_column(self, coords):
        # destructure coordinates like "B2" to "B" and 2
        alpha, num = coords
        colnum = ord(alpha) - ord('A') + 1
        rownum = self.size - int(num) + 1
        assert 1 <= rownum <= self.size,"row out of range"
        assert 1 <= colnum <= self.size,'column out of range'
        return rownum, colnum

    def set_colour(self, coords, colour_name):
        rownum, colnum = self._to_row_and_column(coords)
        assert len(coords)==2 or len(coords)==3, "invalid coordinates"
        assert colour_name in self.points,"invalid colour name"
        self.grid[rownum - 1][colnum - 1] = colour_name

    def get_colour(self, coords):
        rownum, colnum = self._to_row_and_column(coords)
        return self.grid[rownum - 1][colnum - 1]

    def to_strings(self):
          padding = ' '
          lines = []
          for r, row in enumerate(self.grid):
                 if self.from_strings:
                      lines.append(''.join(self.from_strings[r]))
                 else:
                      lines.append(''.join(self.points[x] for x in row))
          return lines

    def to_integer(self):
        digit_colour=""
        for line in self.to_strings():
            for character in line:
                if character=='.':
                    character=0
                elif character=='O':
                    character=1
                elif character=='@':
                    character=2
                character=str(character)
                digit_colour+=character
        return int(digit_colour,3)

       # return ''.join(self.to_int[x] for line in self.grid for x in line)

    def set_from_integer(self, integer_encoding):
        n = int(integer_encoding)
        list1 = []
        while n != 0:
            rem = n % 3
            list1.append(rem)
            n = n // 3
        list1.reverse()
        for i in list1:
            print(i, end="")
        print(type(list1))
        print(list1)
        for i in range(self.size):
            for j in range(self.size):
                if list1[i * self.size + j] == "0":
                    self.grid[i][j] = "."
                elif list1[i * self.size + j] == "1":
                    self.grid[i][j] = "@"
                elif list1[i * self.size + j] == "2":
                    self.grid[i][j] = "O"
c = Board(3)
c.set_from_integer(14676)
print(c)
d = Board(5)
d.set_from_integer(1)
print(d)
</code>```

and the expected output is shown below:

```<code>   A B C
 3 @ . @
 2 . O .
 1 O @ .

   A B C D E
 5 . . . . .
 4 . . . . .
 3 . . . . .
 2 . . . . .
 1 . . . . O
</code>```

Body:
I need to create a method set_from_integer(self, integer_encoding) that sets the colours of all points of the board according to the given integer_encoding which does not change the size of the board. To convert an integer n to ternary representation, as required by set_from_integer(), get the last digit by computing n mod 3. You get the next digit by computing [n/3]mod 3 and so on. For example, to get the last two digits of the ternary representation of 7473:

#This is the problematic part
   def set_from_integer(self, integer_encoding):
        n = int(integer_encoding)
        list1 = []
        while n != 0:
            rem = n % 3
            list1.append(rem)
            n = n // 3
        list1.reverse()
        for i in list1:
            print(i, end="")

So for now the above is what i came up with to get the ternary base of the decimal number but i need to convert this into a grid of symbols according to the given :

(empty = 0, white = 1, black = 2)

My entire code is as follows:

def load_board(filename):
    result = "  "
    with open(filename) as f:
        print(f)
        for index, line in enumerate(f):
            if index == 0:
                result += ' '+' '.join([chr(alphabets + 65) for alphabets in range(len(line) - 1)]) + '\n'  # the alphabetical column heading
            result += f"{19 - index:2d}"
            result += ' ' + ' '.join(line.strip()) + '\n'
        return result

def save_board(filename, board):
    with open(filename, "wt") as f:
        f.write(board)

from string import ascii_uppercase as letters
class Board:
#Dictionary created for the colours and the respected symbols
    points = {'E': '.', 'B': '@', 'W': 'O'}

#Constructor
    def __init__(self,size=19,from_strings=None):
        assert 2 <= size <= 26, "Illegal board size: must be between 2 and 26."

        if from_strings != None:
               if type(from_strings) != list:
                   raise AssertionError("input is not a list")
               if len(from_strings) != size:
                   raise AssertionError("length of input list does not match size")
               for i in range(size):
                   if type(from_strings[i]) != str:
                       raise AssertionError("row " + str(i) + " is not a string")
                   if len(from_strings[i]) != size:
                       raise AssertionError("length of row " + str(i) + " does not match size")
                   for j in range(size):
                       if from_strings[i][j] not in ".@O":
                           raise AssertionError("invalid character in row " + str(i))
        self.size = size
        self.grid = [['E'] * size for _ in range(size)]
        self.from_strings = [] if from_strings is None else from_strings

    def get_size(self): #Returns the size of the grid created by the constructor
        return self.size

    def __str__(self):  # creating the grid
        padding = ' '  # Creating a variable with a space assigned so that it acts as a padding to the rows that have a single digit
        heading = '   ' + ' '.join(letters[:self.size])  # Alphabetical heading is created
        lines = [heading]  # adding the alphabetical heading into a list named lines to which the rows will be added later
        for r, row in enumerate(self.grid):
            if len(self.grid) < 10:  # for the grid with a size less than 10 to add the space to the start of the row for the single digits to be aligned
                if (self.from_strings):
                    line = " " + f'{self.size - r} ' + ' '.join(self.from_strings[r])
                else:
                    line = " " + f'{self.size - r} ' + ' '.join(self.points[x] for x in row)
                lines.append(line)
            else:  # for the grids that are larger than 9
                if r > 9:  # for rows 1 to 9 the single digits are aligned according to the first digit from the right of the two digit rows
                    if (self.from_strings):
                        line = f'{self.size - r} ' + ' '.join(self.from_strings[r])
                    else:
                        line = f'{self.size - r} ' + ' '.join(self.points[x] for x in row)
                    line = padding + line  # adding the space using the variable padding to the row created
                    lines.append(line)  # adding the row to the list of rows
                else:  # for the rows 10 onwards - as there is no requirement to add a padding it is not added here
                    if (self.from_strings):
                        line = f'{self.size - r} ' + ' '.join(self.from_strings[r])
                    else:
                        line = f'{self.size - r} ' + ' '.join(self.points[x] for x in row)  # creation of the row
                    lines.append(line)  # adding the newly created row to the list of rows
        return '\n'.join(lines)

    def _to_row_and_column(self, coords):
        # destructure coordinates like "B2" to "B" and 2
        alpha, num = coords
        colnum = ord(alpha) - ord('A') + 1
        rownum = self.size - int(num) + 1
        assert 1 <= rownum <= self.size,"row out of range"
        assert 1 <= colnum <= self.size,'column out of range'
        return rownum, colnum

    def set_colour(self, coords, colour_name):
        rownum, colnum = self._to_row_and_column(coords)
        assert len(coords)==2 or len(coords)==3, "invalid coordinates"
        assert colour_name in self.points,"invalid colour name"
        self.grid[rownum - 1][colnum - 1] = colour_name

    def get_colour(self, coords):
        rownum, colnum = self._to_row_and_column(coords)
        return self.grid[rownum - 1][colnum - 1]

    def to_strings(self):
          padding = ' '
          lines = []
          for r, row in enumerate(self.grid):
                 if self.from_strings:
                      lines.append(''.join(self.from_strings[r]))
                 else:
                      lines.append(''.join(self.points[x] for x in row))
          return lines

    def to_integer(self):
        digit_colour=""
        for line in self.to_strings():
            for character in line:
                if character=='.':
                    character=0
                elif character=='O':
                    character=1
                elif character=='@':
                    character=2
                character=str(character)
                digit_colour+=character
        return int(digit_colour,3)

       # return ''.join(self.to_int[x] for line in self.grid for x in line)

    def set_from_integer(self, integer_encoding):
        n = int(integer_encoding)
        list1 = []
        while n != 0:
            rem = n % 3
            list1.append(rem)
            n = n // 3
        list1.reverse()
        for i in list1:
            print(i, end="")
        print(type(list1))
        print(list1)
        for i in range(self.size):
            for j in range(self.size):
                if list1[i * self.size + j] == "0":
                    self.grid[i][j] = "."
                elif list1[i * self.size + j] == "1":
                    self.grid[i][j] = "@"
                elif list1[i * self.size + j] == "2":
                    self.grid[i][j] = "O"
c = Board(3)
c.set_from_integer(14676)
print(c)
d = Board(5)
d.set_from_integer(1)
print(d)

and the expected output is shown below:

   A B C
 3 @ . @
 2 . O .
 1 O @ .

   A B C D E
 5 . . . . .
 4 . . . . .
 3 . . . . .
 2 . . . . .
 1 . . . . O


问:
How to normalize array of images in python?
I am trying to write a model that can classify between images of cats and dogs. All the code I have written so far works. However, Once I get to normalizing the images in the array and run it, the runtime crashes (I'm using Colaboratory) as all the available Memory gets used.

```<code>import glob
import cv2
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
from keras.models import Sequential
from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Dropout
from tensorflow.keras import layers
from keras.utils import to_categorical
import numpy as np
plt.style.use('fivethirtyeight')

</code>```
```<code>files_train = '/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/training_set/*.jpg'
files_test = '/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/test_set/*.jpg'
glob.glob(files_train)
glob.glob(files_test)
images_train = np.array([cv2.imread(image) for image in glob.glob(files_train)])
images_test = np.array([cv2.imread(image) for image in glob.glob(files_test)])
</code>```
```<code>import os
text_train_list = os.listdir('/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/training_set')
text_train = [item[0] for item in text_train_list]
text_test_list = os.listdir('/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/test_set')
text_test = [item[0] for item in text_test_list]
text_train = np.array(text_train)
text_test = np.array(text_test)

</code>```
```<code>from sklearn.preprocessing import LabelEncoder
label_enc = LabelEncoder()
vec_1 = label_enc.fit_transform(text_train)
vec_2 = label_enc.fit_transform(text_test)

text_train = to_categorical(vec_1)
text_test = to_categorical(vec_2)
</code>```
```<code>images_train = images_train / 255
images_test = images_test / 255
</code>```

First I tried running it in a local runtime as I have 12GB of RAM on my machine, but it still uses up everything and crashes. I then tried cutting down the number of training images from 8000 to 3000 and simplifying my code yet it still crashes. Finally, after googling, I found that I must normalize each image one at a time. I tried doing so:

```<code>img_train = np.array([])

for x in images_train:
  img_train[x] = images_train[x] / 255
</code>```

Yet I still crash, what is the best way to do this without setting fire to my computer?

Body:
I am trying to write a model that can classify between images of cats and dogs. All the code I have written so far works. However, Once I get to normalizing the images in the array and run it, the runtime crashes (I'm using Colaboratory) as all the available Memory gets used.

import glob
import cv2
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
from keras.models import Sequential
from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Dropout
from tensorflow.keras import layers
from keras.utils import to_categorical
import numpy as np
plt.style.use('fivethirtyeight')

files_train = '/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/training_set/*.jpg'
files_test = '/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/test_set/*.jpg'
glob.glob(files_train)
glob.glob(files_test)
images_train = np.array([cv2.imread(image) for image in glob.glob(files_train)])
images_test = np.array([cv2.imread(image) for image in glob.glob(files_test)])

import os
text_train_list = os.listdir('/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/training_set')
text_train = [item[0] for item in text_train_list]
text_test_list = os.listdir('/content/drive/MyDrive/Colab Notebooks/Cats_Dogs/test_set')
text_test = [item[0] for item in text_test_list]
text_train = np.array(text_train)
text_test = np.array(text_test)

from sklearn.preprocessing import LabelEncoder
label_enc = LabelEncoder()
vec_1 = label_enc.fit_transform(text_train)
vec_2 = label_enc.fit_transform(text_test)

text_train = to_categorical(vec_1)
text_test = to_categorical(vec_2)

images_train = images_train / 255
images_test = images_test / 255

First I tried running it in a local runtime as I have 12GB of RAM on my machine, but it still uses up everything and crashes. I then tried cutting down the number of training images from 8000 to 3000 and simplifying my code yet it still crashes. Finally, after googling, I found that I must normalize each image one at a time. I tried doing so:

img_train = np.array([])

for x in images_train:
  img_train[x] = images_train[x] / 255

Yet I still crash, what is the best way to do this without setting fire to my computer?


问:
How to handle Unexpected Null pointer exception at this situation
I am trying to getting data based on EpcohSecond but it gives null pointer error, and a warning that

Here:
billingPointValues = timeSeriesReadServiceFacade.fetchBillingPointValues(billingPoint, fromEpochSecond, toEpochSecond);

For this line I am getting warning that unboxing of fromEpochSecond may occur null pointer exception. No I idea about this issue at this situation.

The code block is as below:

```<code>Long fromEpochSecond = getStartExportEpochSecond(billingPoint, from);
    try {
        validateStartAndEnd(billingPoint, fromEpochSecond, toEpochSecond);
        billingPointValues = timeSeriesReadServiceFacade.fetchBillingPointValues(billingPoint, fromEpochSecond,toEpochSecond);
}
</code>```

A solution will be a great help.

Body:
I am trying to getting data based on EpcohSecond but it gives null pointer error, and a warning that

Here:
billingPointValues = timeSeriesReadServiceFacade.fetchBillingPointValues(billingPoint, fromEpochSecond, toEpochSecond);

For this line I am getting warning that unboxing of fromEpochSecond may occur null pointer exception. No I idea about this issue at this situation.

The code block is as below:

Long fromEpochSecond = getStartExportEpochSecond(billingPoint, from);
    try {
        validateStartAndEnd(billingPoint, fromEpochSecond, toEpochSecond);
        billingPointValues = timeSeriesReadServiceFacade.fetchBillingPointValues(billingPoint, fromEpochSecond,toEpochSecond);
}

A solution will be a great help.


问:
Problem when I add font in react-pdf to customize i have module parse
When i add the font i have the problem module parse for the react pdf. I try to modify the theme of my pdf. I try to resolve the issue i can't .
When i add the font i have the problem module parse for the react pdf. I try to modify the theme of my pdf. I try to resolve the issue i can't .

I have this error :

```<code>Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
window.console.error @ next-dev.js?3515:32
handleErrors @ hot-dev-client.js?1600:117
processMessage @ hot-dev-client.js?1600:167
eval @ hot-dev-client.js?1600:29
eval @ websocket.js?a9be:58
handleMessage @ websocket.js?a9be:57
</code>```
```<code>My code :
`
import React from 'react';
import { Page, Text, View, Document, StyleSheet,Font } from '@react-pdf/renderer';
import { Table } from './table'

import Roboto from "../../public/font/Roboto-Black.ttf"

Font.register({
    family: 'Roboto',
    format: "truetype",
    src: Roboto
  });

// Create styles
const styles = StyleSheet.create({
  page: {
    // flexDirection: 'row',
    backgroundColor: 'white'
  },
  sectionLogo: {
   position:"absolute",
   left:"30px",
   top:"20px",
  },
  logoText:{
    fontSize:"40px",
    //fontWeight:"600",
    fontFamily: 'Roboto',
    color:"red"
  },
  sectionNumber:{
    position:"absolute",
    right:"90px"
  },

  colorText:{
    color:"red",
    marginTop:"10px",
  }
});

const MyDocument = (props) => (
  <Document>
    <Page size="A4" style={styles.page}>
      <View style={styles.sectionLogo}>
      <Text style={styles.logoText}>Facture</Text>
      </View>
</Page>
</Document

</code>```

Body:
When i add the font i have the problem module parse for the react pdf. I try to modify the theme of my pdf. I try to resolve the issue i can't .
When i add the font i have the problem module parse for the react pdf. I try to modify the theme of my pdf. I try to resolve the issue i can't .

I have this error :

Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
window.console.error @ next-dev.js?3515:32
handleErrors @ hot-dev-client.js?1600:117
processMessage @ hot-dev-client.js?1600:167
eval @ hot-dev-client.js?1600:29
eval @ websocket.js?a9be:58
handleMessage @ websocket.js?a9be:57

My code :
`
import React from 'react';
import { Page, Text, View, Document, StyleSheet,Font } from '@react-pdf/renderer';
import { Table } from './table'

import Roboto from "../../public/font/Roboto-Black.ttf"

Font.register({
    family: 'Roboto',
    format: "truetype",
    src: Roboto
  });

// Create styles
const styles = StyleSheet.create({
  page: {
    // flexDirection: 'row',
    backgroundColor: 'white'
  },
  sectionLogo: {
   position:"absolute",
   left:"30px",
   top:"20px",
  },
  logoText:{
    fontSize:"40px",
    //fontWeight:"600",
    fontFamily: 'Roboto',
    color:"red"
  },
  sectionNumber:{
    position:"absolute",
    right:"90px"
  },

  colorText:{
    color:"red",
    marginTop:"10px",
  }
});

const MyDocument = (props) => (
  <Document>
    <Page size="A4" style={styles.page}>
      <View style={styles.sectionLogo}>
      <Text style={styles.logoText}>Facture</Text>
      </View>
</Page>
</Document


问:
org.thymeleaf.exceptions.TemplateInputException
customers.html is not rendering.
enter image description here

My Controller Class
enter image description here

My Model Class
enter image description here

Error Logs
enter image description here

Can someone please suggest me what is needed to be done here?


问:
can't link my mongodb compass application(local machine) with database in a digital ocean droplet
I had created a droplet in digital ocean and tried to visualize my hosted database in my local machine (ubuntu 20.04).

So the workflow is Database (droplet) <-> nginx (droplet) <-> MongoDB Compass (local machine).

I tried to expose a specific port in the droplet and then binding this port to my local port (local machine) but with no success. Am I wrong? And if not - what could cause my problem?


问:
Laravel eloquent orderByRaw error with two withCount() value
-Likes table migration:

public function up()
  {
      Schema::create('likes', function (Blueprint $table) {
          $table->id();
          $table->bigInteger('user_id')->unsigned();
          $table->boolean('direction');
          $table->morphs('likeable');
          $table->timestamps();
      });
      Schema::table('likes', function ($table) {
          $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
      });
  }
```
<p>Like model:</p>
<pre class="lang-php prettyprint-override"><code>    public function likeable()
    {
        return $this->morphTo();
    }
</code>```

In Entry model:

    public function likes(): morphMany
    {
        return $this->morphMany(Like::class, 'likeable')->where('direction', true);
    }

    public function dislikes(): morphMany
    {
        return $this->morphMany(Like::class, 'likeable')->where('direction', false);
    }

    public function likesAndDislikes(): morphMany
    {
        return $this->morphMany(Like::class, 'likeable');
    }
```
<p>I run this query:</p>
<pre class="lang-php prettyprint-override"><code>Entry::withCount(['likes', 'dislikes'])
        ->orderByRaw('(likes_count + (dislikes_count * -1)) desc')
        ->paginate();

</code>```

I got error:

quote
Illuminate\Database\ QueryException
PHP 8.1.3
9.45.1
SQLSTATE[42703]: Undefined column: 7 ERROR: column "likes_count" does not exist LINE 1: ... $4) as "dislikes_count" from "entries" order by (likes_coun... ^
SELECT
"entries".,
(
SELECT
count()
FROM
"likes"
WHERE
"entries"."id" = "likes"."likeable_id"
AND "likes"."likeable_type" = entries
AND "direction" = 1
) AS "likes_count",
(
SELECT
count(*)
FROM
"likes"
WHERE
"entries"."id" = "likes"."likeable_id"
AND "likes"."likeable_type" = entries
AND "direction" = 0
) AS "dislikes_count"
FROM
"entries"
ORDER BY
(likes_count + (dislikes_count * -1)) DESC
limit
15 OFFSET 0

Body:
-Likes table migration:

public function up()
  {
      Schema::create('likes', function (Blueprint $table) {
          $table->id();
          $table->bigInteger('user_id')->unsigned();
          $table->boolean('direction');
          $table->morphs('likeable');
          $table->timestamps();
      });
      Schema::table('likes', function ($table) {
          $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
      });
  }

Like model:

    public function likeable()
    {
        return $this->morphTo();
    }

In Entry model:

    public function likes(): morphMany
    {
        return $this->morphMany(Like::class, 'likeable')->where('direction', true);
    }

    public function dislikes(): morphMany
    {
        return $this->morphMany(Like::class, 'likeable')->where('direction', false);
    }

    public function likesAndDislikes(): morphMany
    {
        return $this->morphMany(Like::class, 'likeable');
    }

I run this query:

Entry::withCount(['likes', 'dislikes'])
        ->orderByRaw('(likes_count + (dislikes_count * -1)) desc')
        ->paginate();

I got error:

quote
Illuminate\Database\ QueryException
PHP 8.1.3
9.45.1
SQLSTATE[42703]: Undefined column: 7 ERROR: column "likes_count" does not exist LINE 1: ... $4) as "dislikes_count" from "entries" order by (likes_coun... ^
SELECT
"entries".,
(
SELECT
count()
FROM
"likes"
WHERE
"entries"."id" = "likes"."likeable_id"
AND "likes"."likeable_type" = entries
AND "direction" = 1
) AS "likes_count",
(
SELECT
count(*)
FROM
"likes"
WHERE
"entries"."id" = "likes"."likeable_id"
AND "likes"."likeable_type" = entries
AND "direction" = 0
) AS "dislikes_count"
FROM
"entries"
ORDER BY
(likes_count + (dislikes_count * -1)) DESC
limit
15 OFFSET 0


问:
issue with react Quill text editor . why output with Html tag?
issue with react Quill text editor . why output with Html tag? like this

this is my code everything is fine then why output has a html tag ? i just write zzzzzzz but output is with html

```<code>
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';

  const [body, setBody] = useState("");

  const  modules  = {
    toolbar: [
        [{ font: [] }],
        [{ header: [1, 2, 3, 4, 5, 6, false] }],
        ["bold", "italic", "underline", "strike"],
        [{ color: [] }, { background: [] }],
        [{ script:  "sub" }, { script:  "super" }],
        ["blockquote", "code-block"],
        [{ list:  "ordered" }, { list:  "bullet" }],
        [{ indent:  "-1" }, { indent:  "+1" }, { align: [] }],
        ["link", "image", "video"],
        ["clean"],
    ],
};

              <ReactQuill theme="snow" modules={modules} value={body} onChange={setBody} />

</code>```

what is wrong with my code why out put is full of html tag ?
can not understand at all even jodit editor is like this

but it works with uiwjs editor

I want use react quill but I put value={body} and onChange={setBody}

Body:
issue with react Quill text editor . why output with Html tag? like this

this is my code everything is fine then why output has a html tag ? i just write zzzzzzz but output is with html

import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';

  const [body, setBody] = useState("");

  const  modules  = {
    toolbar: [
        [{ font: [] }],
        [{ header: [1, 2, 3, 4, 5, 6, false] }],
        ["bold", "italic", "underline", "strike"],
        [{ color: [] }, { background: [] }],
        [{ script:  "sub" }, { script:  "super" }],
        ["blockquote", "code-block"],
        [{ list:  "ordered" }, { list:  "bullet" }],
        [{ indent:  "-1" }, { indent:  "+1" }, { align: [] }],
        ["link", "image", "video"],
        ["clean"],
    ],
};

              <ReactQuill theme="snow" modules={modules} value={body} onChange={setBody} />

what is wrong with my code why out put is full of html tag ?
can not understand at all even jodit editor is like this

but it works with uiwjs editor

I want use react quill but I put value={body} and onChange={setBody}


问:
Handle drag gesture entering composeable bounds
I have a (non-lazy) column of text buttons (say, they contain the letters A-Z). I have on-click modifiers applied on each of these buttons that perform an action corresponding to the button clicked. I would like to perform these same actions when the user drags their finger across buttons. That is, if the user presses A and then drags their finger down to D (passing through B and C in the process), I would like to trigger the on-click behaviors for A, B, C, and D in order. There is no other "draggable" effect required on these buttons.

I tried logging the series of MotionEvents that were triggered via pointerInteropFilter when such an action occurred, but only received events on the starting and ending buttons (A & D).


问:
How to handle resizing of rotated elements?
I am using the InteractJS library to enable resizing of DOM elements. However, I am having trouble getting the resizing to work correctly when the element has been rotated.

For example, consider the following code, which rotates an element by 45 degrees and then attempts to resize it.

When you resize the rectangle, the shape tends to move. i.e. you are dragging the bottom-right corner, but somehow the top-left corner is also moving. Also, the distance you drag horizontally or vertically does not quite match with the change in size you perceive in the rotated shape.

There are some usefull resource how explain the what problem is in Math lang. However, i'm really not good at Math so maybe anyone would understand.

https://shihn.ca/posts/2020/resizing-rotated-elements/

https://www.nmattia.com/posts/2020-03-03-drag-resize-rotate.html

Expected:

interact('.resize-drag')
  .resizable({
    preserveAspectRatio: true,
    edges: { left: true, right: true, bottom: true, top: true }
  })
  .on('resizemove', function (event) {
    var target = event.target,
    x = (parseFloat(target.getAttribute('data-x')) || 0),
    y = (parseFloat(target.getAttribute('data-y')) || 0);

    // update the element's style
    target.style.width  = event.rect.width + 'px';
    target.style.height = event.rect.height + 'px';

    // translate when resizing from top or left edges
    x += event.deltaRect.left;
    y += event.deltaRect.top;

    target.style.webkitTransform = 'translate(' + x + 'px,' + y + 'px)';
    target.style.transform = 'translate(' + x + 'px,' + y + 'px)';
    target.setAttribute('data-x', x);
    target.setAttribute('data-y', y);
    target.textContent = Math.round(event.rect.width) + '×' + Math.round(event.rect.height);
  });```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.resize-drag {
  background-color: #29e;
  color: white;
  font-size: 13px;
  font-family: sans-serif;
  border-radius: 8px;
  padding: 20px;
  margin: 30px 20px;
  text-align: center;
  width: 120px;
  rotate: 1.2rad;
  /* This makes things *much* easier */
  box-sizing: border-box;
}

.resize-container {
  width: 240px;
  height: 240px;
  background: #ccc;
}</code>```

     Resize from any edge or tr

```

Any help would be appreciated. Thank you!

Body:
I am using the InteractJS library to enable resizing of DOM elements. However, I am having trouble getting the resizing to work correctly when the element has been rotated.

For example, consider the following code, which rotates an element by 45 degrees and then attempts to resize it.

When you resize the rectangle, the shape tends to move. i.e. you are dragging the bottom-right corner, but somehow the top-left corner is also moving. Also, the distance you drag horizontally or vertically does not quite match with the change in size you perceive in the rotated shape.

There are some usefull resource how explain the what problem is in Math lang. However, i'm really not good at Math so maybe anyone would understand.

https://shihn.ca/posts/2020/resizing-rotated-elements/

https://www.nmattia.com/posts/2020-03-03-drag-resize-rotate.html

Expected:

interact('.resize-drag')
  .resizable({
    preserveAspectRatio: true,
    edges: { left: true, right: true, bottom: true, top: true }
  })
  .on('resizemove', function (event) {
    var target = event.target,
    x = (parseFloat(target.getAttribute('data-x')) || 0),
    y = (parseFloat(target.getAttribute('data-y')) || 0);

    // update the element's style
    target.style.width  = event.rect.width + 'px';
    target.style.height = event.rect.height + 'px';

    // translate when resizing from top or left edges
    x += event.deltaRect.left;
    y += event.deltaRect.top;

    target.style.webkitTransform = 'translate(' + x + 'px,' + y + 'px)';
    target.style.transform = 'translate(' + x + 'px,' + y + 'px)';
    target.setAttribute('data-x', x);
    target.setAttribute('data-y', y);
    target.textContent = Math.round(event.rect.width) + '×' + Math.round(event.rect.height);
  });

.resize-drag {
  background-color: #29e;
  color: white;
  font-size: 13px;
  font-family: sans-serif;
  border-radius: 8px;
  padding: 20px;
  margin: 30px 20px;
  text-align: center;
  width: 120px;
  rotate: 1.2rad;
  /* This makes things *much* easier */
  box-sizing: border-box;
}

.resize-container {
  width: 240px;
  height: 240px;
  background: #ccc;
}

     Resize from any edge or tr

Any help would be appreciated. Thank you!


问:
"Import "pygame" could not be resolvedPylance" in VScode
I am unable to import pygame module.
I have checked the python version and made sure that it matches the one with the interpreter in the env(vitual environment name).
I have tried the existing solutions to similar problems but nothing worked.

I tried in the VS Code terminal:

```<code>pip install numpy
</code>```

and numpy was successfully installed but then I ran the program and it shows the error:

```<code>ModuleNotFoundError: No module named 'numpy'
</code>```

I have tried to add the site-package path to "Python › Analysis: Extra Paths" in VS Code settings.
I also tried:

```<code>pip install --upgrade setuptools
</code>```

Am I supposed to copy the site-package path from "C:\Users\pande\VScodeWorkspace\env\Lib\site-packages"
or: "C:\Python310\Lib\site-packages"
Note that I am using python 3.11.1 in my env but in the above directory in C drive the folders name is Python310. I have installed Anaconda a few days ago and VS Code just today.
Kindly help I am very new to this. Thank you.

Body:
I am unable to import pygame module.
I have checked the python version and made sure that it matches the one with the interpreter in the env(vitual environment name).
I have tried the existing solutions to similar problems but nothing worked.

I tried in the VS Code terminal:

pip install numpy

and numpy was successfully installed but then I ran the program and it shows the error:

ModuleNotFoundError: No module named 'numpy'

I have tried to add the site-package path to "Python › Analysis: Extra Paths" in VS Code settings.
I also tried:

pip install --upgrade setuptools

Am I supposed to copy the site-package path from "C:\Users\pande\VScodeWorkspace\env\Lib\site-packages"
or: "C:\Python310\Lib\site-packages"
Note that I am using python 3.11.1 in my env but in the above directory in C drive the folders name is Python310. I have installed Anaconda a few days ago and VS Code just today.
Kindly help I am very new to this. Thank you.


问:
TextMask in Angular, with no length limit
I am using textmask module in angular and I was wondering is there any way to use text mask with the following regex and not specifying length?

```<code>public regexMask: any = [/^([1-9]+|[ -,.()]+|[\u10D0-\u10F0]+)$/];
</code>```

Following example above limits my input to 1 length, is there a way to make sure that input text is validated by regex and not by length

Body:
I am using textmask module in angular and I was wondering is there any way to use text mask with the following regex and not specifying length?

public regexMask: any = [/^([1-9]+|[ -,.()]+|[\u10D0-\u10F0]+)$/];

Following example above limits my input to 1 length, is there a way to make sure that input text is validated by regex and not by length


问:
Embed File in a table cell in word document using python
I am trying to embed a file in a certain table cell in a word document but instead it's added to the very start of the document, i am using a variable to find the range using

```<code>rng1.Find.Execute(FindText= "ReqFile")
</code>```

after executing the line rng1 becomes ReqFile, then i use inline addobject and it adds the file at the start of the docment

here's the code i am using

```<code>word = Dispatch("Word.Application")
word.Documents.Open('C:/Users/momar/Documents/Generator/'+filename+'.docx')
doc = word.ActiveDocument
rng1 = doc.Range()

if rng1.Find.Execute(FindText= "ReqFile") == True:

    doc.InlineShapes.AddOLEObject(ClassType='txt', FileName='C:/Users/momar/Documents/Generator/GetAccountIssuedCheckBooksRequest.xsd',DisplayAsIcon=1,Range=rng1,IconLabel="txt")

</code>```

where ReqFile is text in a table cell where i want to place the file

Body:
I am trying to embed a file in a certain table cell in a word document but instead it's added to the very start of the document, i am using a variable to find the range using

rng1.Find.Execute(FindText= "ReqFile")

after executing the line rng1 becomes ReqFile, then i use inline addobject and it adds the file at the start of the docment

here's the code i am using

word = Dispatch("Word.Application")
word.Documents.Open('C:/Users/momar/Documents/Generator/'+filename+'.docx')
doc = word.ActiveDocument
rng1 = doc.Range()

if rng1.Find.Execute(FindText= "ReqFile") == True:

    doc.InlineShapes.AddOLEObject(ClassType='txt', FileName='C:/Users/momar/Documents/Generator/GetAccountIssuedCheckBooksRequest.xsd',DisplayAsIcon=1,Range=rng1,IconLabel="txt")

where ReqFile is text in a table cell where i want to place the file


问:
Is it possible to hand-off a websocket connection request to a different service?
Does the web socket protocol allow for a server web-socket endpoint to indicate to a client to attempt the connection elsewhere? I suppose this would be the equivalent of an HTTP redirect.

If the protocol doesn't allow it, is there a common way to use an intermediary service to allocate web-sockets dynamically between servers?

If it helps narrow the scope, I'm mostly interested in techniques using the Python FastAPI tools or nginx.


问:
Visual Studio 2022 - Debug.WriteLine not show in output
I'm having trouble displaying information from Debug.WriteLine() in Visual Studio 2022. My settings seem to be correct however still no output when debugging.

```<code>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Biblio.Poli
{
    public class BaseBody
    {
        public virtual string Name{get;set;}
        public virtual float Longitude{get;set;}
        public virtual float Latitude{get;set;}
        public virtual void CreateBase(string Name, float Longitude, float Latitude)
        {
            Debug.WriteLine("BaseBody - Name: " + Name);
            Debug.WriteLine("BaseBody - Localizatiozation: " + Longitude + " | " + Latitude);
        }
    }
}
</code>```

Body:
I'm having trouble displaying information from Debug.WriteLine() in Visual Studio 2022. My settings seem to be correct however still no output when debugging.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Biblio.Poli
{
    public class BaseBody
    {
        public virtual string Name{get;set;}
        public virtual float Longitude{get;set;}
        public virtual float Latitude{get;set;}
        public virtual void CreateBase(string Name, float Longitude, float Latitude)
        {
            Debug.WriteLine("BaseBody - Name: " + Name);
            Debug.WriteLine("BaseBody - Localizatiozation: " + Longitude + " | " + Latitude);
        }
    }
}


问:
there is an error is custom_scaffold.dart after adding custom navigator. there error in the file is shown below
enter image description herethe assertion of custom_scaffold has failed i dont know for what reason all the indexing are correct in my point of view.  the code which have written is. the material library is included in the code. is there any mistake that i am doing? kindly help me its quite irritating This is my code. i am not able to fix it. have tried everything but this error wont go.

ERROR:

```<code>EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building BottomBar(dirty, state: _BottomBarState#21af2):
Assertion failed:
file:///Users/ASM/flutter/.pub-cache/hosted/pub.dartlang.org/custom_navigator-0.3.0/lib/custom_scaffold.dart:33:9
../…/lib/custom_scaffold.dart:33
(scaffold.bottomNavigationBar as BottomNavigationBar)
            .items
            .length ==
            children.length
"[BottomNavigationBar] and `children` should be the same size"
The relevant error-causing widget was:
BottomBar
lib/main.dart:39
When the exception was thrown, this was the stack:
</code>```

My code:  categoryscreen.dart

```<code>    import 'package:custom_bottom_navigation_bar/custom_bottom_navigation_bar.dart';
    import 'package:custom_navigation_bar/custom_navigation_bar.dart';
    import 'package:custom_navigator/custom_scaffold.dart';
    import 'package:custom_navigator/custom_navigator.dart';
    import 'package:my_fapp/styles/categoryscreenstyles.dart';

    class CategoryScreen extends StatefulWidget {
      @override
      _CategoryScreenState createState() => _CategoryScreenState();
    }

    class _CategoryScreenState extends State<CategoryScreen> {
      AppBar buildAppBar() {
        return AppBar(
          backgroundColor: Colors.transparent,
          elevation: 0,
          centerTitle: true,
          title: Text(
            "Welcome",
            style: CategoryScreenStyle.categoryTitleStyles,
          ),
          actions: [
            RotationTransition(
              turns: AlwaysStoppedAnimation(90 / 360),
              child: IconButton(
                onPressed: () {},
                icon: SvgPicture.asset(
                  SvgImages.filter,
                  color: AppColors.baseBlackColor,
                  width: 35,
                ),
              ),
            ),
            IconButton(
              icon: SvgPicture.asset(
                SvgImages.search,
                color: AppColors.baseBlackColor,
                width: 35,
              ),
              onPressed: () {},
            )
          ],
          bottom: TabBar(
            indicator: BoxDecoration(color: Colors.transparent),
            labelStyle: TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.w600,
            ),
            unselectedLabelColor: AppColors.baseBlackColor,
            labelColor: AppColors.baseDarkPinkColor,
            automaticIndicatorColorAdjustment: false,
            tabs: [
              Text("All"),
              Text("Men"),
              Text("Woman"),
              Text("Kids"),
            ],
          ),
        );
      }

      @override
      Widget build(BuildContext context) {
        return DefaultTabController(
          length: 4,
          child: Scaffold(
            backgroundColor: AppColors.baseWhiteColor,
            appBar: buildAppBar(),
            body: TabBarView(
              children: [
                //All Place
                CategoryAllTabBar(),
                //Men  Place
                CategoryMenTabBar(
                  categoryProductModel: menCategoryData,
                ),
                //woman Place
                CategoryMenTabBar(
                  categoryProductModel: womenCategoryData,
                ),
                //Kids place
                CategoryMenTabBar(
                  categoryProductModel: forKids,
                ),
              ],
            ),
          ),
        );
      }
    }
</code>```
```<code>
    class BottomBar extends StatefulWidget {
  @override
  State<BottomBar> createState() => _BottomBarState();
}

/// This is the private State class that goes with BottomBar.
class _BottomBarState extends State<BottomBar> {
  static List<Widget> _widgetOptions = <Widget>[
    Homepage(),
    CategoryScreen(),
    // YourBagScreen(),
    // WishListScreen(),
    // ProfileScreen(),
  ];

  int _selectedIndex = 0;

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return CustomScaffold(
      children: _widgetOptions,
      onItemTap: _onItemTapped,
      scaffold: Scaffold(
        body: Center(
          child: _widgetOptions.elementAt(_selectedIndex),
        ),
          bottomNavigationBar: BottomNavigationBar(
          showSelectedLabels: false,
          showUnselectedLabels: false,
          unselectedFontSize: 0.0,
          selectedFontSize: 0.0,
          type: BottomNavigationBarType.fixed,
          unselectedItemColor: AppColors.baseGrey40Color,
          items: const <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.grid_view),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.shopping_cart_outlined),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.favorite_border),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: '',
            ),
          ],
          currentIndex: _selectedIndex,
          selectedIconTheme: IconThemeData(
            color: AppColors.baseDarkPinkColor,
          ),
          // selectedItemColor: AppColors.baseDarkPinkColor,
          onTap: _onItemTapped,
        ),
      ),
    );
  }
}
</code>```

Body:
enter image description herethe assertion of custom_scaffold has failed i dont know for what reason all the indexing are correct in my point of view.  the code which have written is. the material library is included in the code. is there any mistake that i am doing? kindly help me its quite irritating This is my code. i am not able to fix it. have tried everything but this error wont go.

ERROR:

EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building BottomBar(dirty, state: _BottomBarState#21af2):
Assertion failed:
file:///Users/ASM/flutter/.pub-cache/hosted/pub.dartlang.org/custom_navigator-0.3.0/lib/custom_scaffold.dart:33:9
../…/lib/custom_scaffold.dart:33
(scaffold.bottomNavigationBar as BottomNavigationBar)
            .items
            .length ==
            children.length
"[BottomNavigationBar] and `children` should be the same size"
The relevant error-causing widget was:
BottomBar
lib/main.dart:39
When the exception was thrown, this was the stack:

My code:  categoryscreen.dart

    import 'package:custom_bottom_navigation_bar/custom_bottom_navigation_bar.dart';
    import 'package:custom_navigation_bar/custom_navigation_bar.dart';
    import 'package:custom_navigator/custom_scaffold.dart';
    import 'package:custom_navigator/custom_navigator.dart';
    import 'package:my_fapp/styles/categoryscreenstyles.dart';

    class CategoryScreen extends StatefulWidget {
      @override
      _CategoryScreenState createState() => _CategoryScreenState();
    }

    class _CategoryScreenState extends State<CategoryScreen> {
      AppBar buildAppBar() {
        return AppBar(
          backgroundColor: Colors.transparent,
          elevation: 0,
          centerTitle: true,
          title: Text(
            "Welcome",
            style: CategoryScreenStyle.categoryTitleStyles,
          ),
          actions: [
            RotationTransition(
              turns: AlwaysStoppedAnimation(90 / 360),
              child: IconButton(
                onPressed: () {},
                icon: SvgPicture.asset(
                  SvgImages.filter,
                  color: AppColors.baseBlackColor,
                  width: 35,
                ),
              ),
            ),
            IconButton(
              icon: SvgPicture.asset(
                SvgImages.search,
                color: AppColors.baseBlackColor,
                width: 35,
              ),
              onPressed: () {},
            )
          ],
          bottom: TabBar(
            indicator: BoxDecoration(color: Colors.transparent),
            labelStyle: TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.w600,
            ),
            unselectedLabelColor: AppColors.baseBlackColor,
            labelColor: AppColors.baseDarkPinkColor,
            automaticIndicatorColorAdjustment: false,
            tabs: [
              Text("All"),
              Text("Men"),
              Text("Woman"),
              Text("Kids"),
            ],
          ),
        );
      }

      @override
      Widget build(BuildContext context) {
        return DefaultTabController(
          length: 4,
          child: Scaffold(
            backgroundColor: AppColors.baseWhiteColor,
            appBar: buildAppBar(),
            body: TabBarView(
              children: [
                //All Place
                CategoryAllTabBar(),
                //Men  Place
                CategoryMenTabBar(
                  categoryProductModel: menCategoryData,
                ),
                //woman Place
                CategoryMenTabBar(
                  categoryProductModel: womenCategoryData,
                ),
                //Kids place
                CategoryMenTabBar(
                  categoryProductModel: forKids,
                ),
              ],
            ),
          ),
        );
      }
    }

    class BottomBar extends StatefulWidget {
  @override
  State<BottomBar> createState() => _BottomBarState();
}

/// This is the private State class that goes with BottomBar.
class _BottomBarState extends State<BottomBar> {
  static List<Widget> _widgetOptions = <Widget>[
    Homepage(),
    CategoryScreen(),
    // YourBagScreen(),
    // WishListScreen(),
    // ProfileScreen(),
  ];

  int _selectedIndex = 0;

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return CustomScaffold(
      children: _widgetOptions,
      onItemTap: _onItemTapped,
      scaffold: Scaffold(
        body: Center(
          child: _widgetOptions.elementAt(_selectedIndex),
        ),
          bottomNavigationBar: BottomNavigationBar(
          showSelectedLabels: false,
          showUnselectedLabels: false,
          unselectedFontSize: 0.0,
          selectedFontSize: 0.0,
          type: BottomNavigationBarType.fixed,
          unselectedItemColor: AppColors.baseGrey40Color,
          items: const <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.grid_view),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.shopping_cart_outlined),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.favorite_border),
              label: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: '',
            ),
          ],
          currentIndex: _selectedIndex,
          selectedIconTheme: IconThemeData(
            color: AppColors.baseDarkPinkColor,
          ),
          // selectedItemColor: AppColors.baseDarkPinkColor,
          onTap: _onItemTapped,
        ),
      ),
    );
  }
}


问:
Is there a way to convert html to pdf and save it to an javascript byte array without downloading
Can we convert html to pdf and save the pdf as an byte array in javascript array.

Regards,
Pramod

I am trying to convert html to pdf->byte array and then send this byte array to my controller code to save these bytes in to database.


问:
HowTo using Late Bindings for creating Vb.Net Application using LibVLCSharp that runs on Windows and also on Linux using Mono
I have an existing VB.Net application, that runs (without changing anything) on Windows and also on Linux (Raspi) using Mono.
In some cases I have to switch (Environment.OSVersion.Platform) e.g. for the different folder names.

Now I want to add a simple VLC Player window (without any Buttons). As far as I understand, I cannot reference the DLL directly due to this DLL is platform dependent. So I have to do a late binding of the DLLs? My question is now: how to do this

Can anyone help please?

Thanks in advance.

```<code>Dim objAssemblyVlc As Reflection.Assembly
Dim MyVlc As Object

objAssemblyVlc = Reflection.Assembly.LoadFrom("C:\Users\...\bin\LibVLCSharp.3.6.7\lib\net40\LibVLCSharp.dll")
MyVlc = objAssemblyVlc.CreateInstance("LibVLCSharp.Shared.Core", True)

MyVlc.Initialize()
</code>```

I get an "System.MissingMethodException was unhandled"

Body:
I have an existing VB.Net application, that runs (without changing anything) on Windows and also on Linux (Raspi) using Mono.
In some cases I have to switch (Environment.OSVersion.Platform) e.g. for the different folder names.

Now I want to add a simple VLC Player window (without any Buttons). As far as I understand, I cannot reference the DLL directly due to this DLL is platform dependent. So I have to do a late binding of the DLLs? My question is now: how to do this

Can anyone help please?

Thanks in advance.

Dim objAssemblyVlc As Reflection.Assembly
Dim MyVlc As Object

objAssemblyVlc = Reflection.Assembly.LoadFrom("C:\Users\...\bin\LibVLCSharp.3.6.7\lib\net40\LibVLCSharp.dll")
MyVlc = objAssemblyVlc.CreateInstance("LibVLCSharp.Shared.Core", True)

MyVlc.Initialize()

I get an "System.MissingMethodException was unhandled"


问:
Flutter curve shape slider
How can I make this slider bar in Flutter?

Title: Flutter curve shape slider


问:
docker compose up throws error, after i install docker desktop
```<code>Os Ubuntu 20.04.5 LTS
Docker version 20.10.22, build 3a2c30b
docker-compose version 1.29.2, build 5becea4
Docker desktop version 4.15
</code>```

till date i am working with docker and docker compose without any issue, but when i installed Docker desktop today, on terminal when executing docker-compose up -d, it throws the following error, but when i uninstall the docker desktop, the below command works just fine.

FYI i don't have su permissions to "Enable Docker Compose V1/V2 compatibility mode" in docker desktop

docker-compose up -d

```<code>Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1277, in request
  File "http/client.py", line 1323, in _send_request
  File "http/client.py", line 1272, in endheaders
  File "http/client.py", line 1032, in _send_output
  File "http/client.py", line 972, in send
  File "docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 449, in send
  File "urllib3/connectionpool.py", line 727, in urlopen
  File "urllib3/util/retry.py", line 410, in increment
  File "urllib3/packages/six.py", line 734, in reraise
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1277, in request
  File "http/client.py", line 1323, in _send_request
  File "http/client.py", line 1272, in endheaders
  File "http/client.py", line 1032, in _send_output
  File "http/client.py", line 972, in send
  File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker/api/client.py", line 214, in _retrieve_server_version
  File "docker/api/daemon.py", line 181, in version
  File "docker/utils/decorators.py", line 46, in inner
  File "docker/api/client.py", line 237, in _get
  File "requests/sessions.py", line 543, in get
  File "requests/sessions.py", line 530, in request
  File "requests/sessions.py", line 643, in send
  File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 200, in perform_command
  File "compose/cli/command.py", line 70, in project_from_options
  File "compose/cli/command.py", line 153, in get_project
  File "compose/cli/docker_client.py", line 43, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "docker/api/client.py", line 197, in __init__
  File "docker/api/client.py", line 222, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
[10] Failed to execute script docker-compose
</code>```

Body:
Os Ubuntu 20.04.5 LTS
Docker version 20.10.22, build 3a2c30b
docker-compose version 1.29.2, build 5becea4
Docker desktop version 4.15

till date i am working with docker and docker compose without any issue, but when i installed Docker desktop today, on terminal when executing docker-compose up -d, it throws the following error, but when i uninstall the docker desktop, the below command works just fine.

FYI i don't have su permissions to "Enable Docker Compose V1/V2 compatibility mode" in docker desktop

docker-compose up -d

Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1277, in request
  File "http/client.py", line 1323, in _send_request
  File "http/client.py", line 1272, in endheaders
  File "http/client.py", line 1032, in _send_output
  File "http/client.py", line 972, in send
  File "docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 449, in send
  File "urllib3/connectionpool.py", line 727, in urlopen
  File "urllib3/util/retry.py", line 410, in increment
  File "urllib3/packages/six.py", line 734, in reraise
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1277, in request
  File "http/client.py", line 1323, in _send_request
  File "http/client.py", line 1272, in endheaders
  File "http/client.py", line 1032, in _send_output
  File "http/client.py", line 972, in send
  File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker/api/client.py", line 214, in _retrieve_server_version
  File "docker/api/daemon.py", line 181, in version
  File "docker/utils/decorators.py", line 46, in inner
  File "docker/api/client.py", line 237, in _get
  File "requests/sessions.py", line 543, in get
  File "requests/sessions.py", line 530, in request
  File "requests/sessions.py", line 643, in send
  File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 200, in perform_command
  File "compose/cli/command.py", line 70, in project_from_options
  File "compose/cli/command.py", line 153, in get_project
  File "compose/cli/docker_client.py", line 43, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "docker/api/client.py", line 197, in __init__
  File "docker/api/client.py", line 222, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
[10] Failed to execute script docker-compose


问:
Javascript - How to grouping matrix array element and sum their value
I have and array like:

```<code>let ARRAY = [
    {P1: A, P2: 1, P3: 1.1, P4: G, val: 10},
    {P1: A, P2: 1, P3: 1.2, P4: G, val: 10},
    {P1: B, P2: 1, P3: 1.1, P4: G, val: 10},
    {P1: B, P2: 1, P3: 1.2, P4: G, val: 10},
    {P1: C, P2: 1, P3: 1.1, P4: G, val: 10},
    {P1: C, P2: 1, P3: 1.2, P4: G, val: 10},
];
</code>```

and I would like to obtain a less element array like:

grouping criteria: same value of P1 and P4

```<code>New array = [
    {P1: A, P2: 1, P3: "", P4: G, val: 20},
    {P1: B, P2: 1, P3: "", P4: G, val: 20},
    {P1: C, P2: 1, P3: "", P4: G, val: 20},
];
</code>```

P3 has null value because the P3 value is not the same for the grouped elements

or other case
grouping criteria: same value of P3

```<code>New array = [
    {P1: "", P2: 1, P3: 1.1, P4: G, val: 30},
    {P1: "", P2: 1, P3: 1.2, P4: G, val: 30},
];
</code>```

any tips?
thanks

I've tried to define a "key" (like key=P1+P4) to group elements and to use the 'reduce' function but I don't know how to properly use it.

Body:
I have and array like:

let ARRAY = [
    {P1: A, P2: 1, P3: 1.1, P4: G, val: 10},
    {P1: A, P2: 1, P3: 1.2, P4: G, val: 10},
    {P1: B, P2: 1, P3: 1.1, P4: G, val: 10},
    {P1: B, P2: 1, P3: 1.2, P4: G, val: 10},
    {P1: C, P2: 1, P3: 1.1, P4: G, val: 10},
    {P1: C, P2: 1, P3: 1.2, P4: G, val: 10},
];

and I would like to obtain a less element array like:

grouping criteria: same value of P1 and P4

New array = [
    {P1: A, P2: 1, P3: "", P4: G, val: 20},
    {P1: B, P2: 1, P3: "", P4: G, val: 20},
    {P1: C, P2: 1, P3: "", P4: G, val: 20},
];

P3 has null value because the P3 value is not the same for the grouped elements

or other case
grouping criteria: same value of P3

New array = [
    {P1: "", P2: 1, P3: 1.1, P4: G, val: 30},
    {P1: "", P2: 1, P3: 1.2, P4: G, val: 30},
];

any tips?
thanks

I've tried to define a "key" (like key=P1+P4) to group elements and to use the 'reduce' function but I don't know how to properly use it.


问:
Adding background image to qbutton using qss with setting position?
I have added two pictures to my qss and I have one on the pressed event while the other is the button's normal state.

However, it is showing a few images of the picture in one button:

How can I make it so that I only have one image and I can move the image to anywhere in the button?

Here is the stylesheet applied:

```<code>self.button1.setStyleSheet("QPushButton{background-image: url(resources/picture1.png); border-radius: 8px; background-color:lightgrey;} QPushButton:pressed{background-image: url(resources/picture2.png); border-radius: 8px; background-color:red;}")
</code>```

Body:
I have added two pictures to my qss and I have one on the pressed event while the other is the button's normal state.

However, it is showing a few images of the picture in one button:

How can I make it so that I only have one image and I can move the image to anywhere in the button?

Here is the stylesheet applied:

self.button1.setStyleSheet("QPushButton{background-image: url(resources/picture1.png); border-radius: 8px; background-color:lightgrey;} QPushButton:pressed{background-image: url(resources/picture2.png); border-radius: 8px; background-color:red;}")


问:
Issue with qt while using opencv
I tried to run simple code:

```<code>import cv2
import os

dir_path = './images'
images = [cv2.imread(f'{dir_path}/{file_name}') for file_name in os.listdir(dir_path)]
cv2.imshow('bike', images[0])
</code>```

And then I got this error:

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "pathtoproject/venv/lib/python3.10/site-packages/cv2/qt/plugins"

My system:

Ubuntu 22.04.1 LTS x86_64

Pip list:

```<code>numpy                    1.24.1
opencv-python            4.7.0.68
qtconsole                5.4.0
QtPy                     2.3.0
</code>```

I tried different solutions like install pywayland, qt5-waylnad, etc. I think I should put file with plugin in /plugins dir, but I can't it.

Title: Issue with qt while using opencv

Body:
I tried to run simple code:

import cv2
import os

dir_path = './images'
images = [cv2.imread(f'{dir_path}/{file_name}') for file_name in os.listdir(dir_path)]
cv2.imshow('bike', images[0])

And then I got this error:

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "pathtoproject/venv/lib/python3.10/site-packages/cv2/qt/plugins"

My system:

Ubuntu 22.04.1 LTS x86_64

Pip list:

numpy                    1.24.1
opencv-python            4.7.0.68
qtconsole                5.4.0
QtPy                     2.3.0

I tried different solutions like install pywayland, qt5-waylnad, etc. I think I should put file with plugin in /plugins dir, but I can't it.


问:
pgadmin's insert data inserts empty row instead of values
I have a table of Employee which is like this

```<code>CREATE TABLE public."Employee"
(
    nid integer NOT NULL UNIQUE,
    fname character varying COLLATE pg_catalog."default",
    surname character varying COLLATE pg_catalog."default",
    date_of_birth date,
    speciality character varying COLLATE pg_catalog."default",
    doctor integer,
    CONSTRAINT "ID" PRIMARY KEY (nid)
);
</code>```

And I've been trying to insert data into this table using the following code:

```<code>INSERT into "Employee" (fname,surname,nid,date_of_birth,speciality,doctor) values
('Joseph','Ward',1,'12-10-1970','Orthodontics',1);
</code>```

but when I try to view the data I inserted, Pgadmin shows an empty row to me. There are no Error messages shown just "INSERT 0 1"

Body:
I have a table of Employee which is like this

CREATE TABLE public."Employee"
(
    nid integer NOT NULL UNIQUE,
    fname character varying COLLATE pg_catalog."default",
    surname character varying COLLATE pg_catalog."default",
    date_of_birth date,
    speciality character varying COLLATE pg_catalog."default",
    doctor integer,
    CONSTRAINT "ID" PRIMARY KEY (nid)
);

And I've been trying to insert data into this table using the following code:

INSERT into "Employee" (fname,surname,nid,date_of_birth,speciality,doctor) values
('Joseph','Ward',1,'12-10-1970','Orthodontics',1);

but when I try to view the data I inserted, Pgadmin shows an empty row to me. There are no Error messages shown just "INSERT 0 1"


问:
How do I put the RefreshControl on top of a the header in StackNavigator (not NativeStackNavigator)?
I'm trying recreate the iOS headerLarge experience of pull-to-refresh where they put the refresh indicator above the header area.

but I can't seem to relocate the refreshControl to go above the header.  progressViewOffset does not appear to do anything.


问:
How can I send an image editing request to the OpenAI endpoint from an Android App written in Kotlin?
I'm new to Android development and I want to create an app that makes use of the OpenAI API. This is my first time using APIs and HTTP. The most important feature uses a photo taken by the user's camera and a custom prompt to edit it using the v1/images/edits endpoint. I'm having a hard time sending the request because every time I get an error. The biggest confusion I have is how to send the image.

I've tried using community libraries, but they are buggy and don't seem to be updated very often. I've tried sending the request with Retrofit, but the way I send the image seems to be the problem, I get a 415 code as response.

```<code>    fun editImage(){
        val retrofit = Retrofit.Builder()
            .baseUrl("https://api.openai.com")
            .addConverterFactory(MoshiConverterFactory.create())
            .build()

        val openAi = retrofit.create(OpenAI::class.java)

        val txtRequest = "A giant mice with a hat"
        val requestBody = EditRequest(
            image = FilePath(imgUri.value.toString()),
            prompt = txtRequest)

        viewModelScope.launch {
            try {
                val response = openAi.sendImageRequest(API_KEY, requestBody)
                Log.i("URL", response.toString())
            } catch (e: Exception){
                Log.e("Exception", e.toString())
            }
        }
    }
</code>```
```<code>    @POST("/v1/images/edits")
    suspend fun sendImageRequest(
        @Header("Authorization") apiKey: String,
        @Body request: EditRequest
    ): EditResponse
</code>```

Maybe uploading the official OpenAI Python or Node.js code to a serverless solution could be an option, but I think that's too much. Thank you for your time :)

Body:
I'm new to Android development and I want to create an app that makes use of the OpenAI API. This is my first time using APIs and HTTP. The most important feature uses a photo taken by the user's camera and a custom prompt to edit it using the v1/images/edits endpoint. I'm having a hard time sending the request because every time I get an error. The biggest confusion I have is how to send the image.

I've tried using community libraries, but they are buggy and don't seem to be updated very often. I've tried sending the request with Retrofit, but the way I send the image seems to be the problem, I get a 415 code as response.

    fun editImage(){
        val retrofit = Retrofit.Builder()
            .baseUrl("https://api.openai.com")
            .addConverterFactory(MoshiConverterFactory.create())
            .build()

        val openAi = retrofit.create(OpenAI::class.java)

        val txtRequest = "A giant mice with a hat"
        val requestBody = EditRequest(
            image = FilePath(imgUri.value.toString()),
            prompt = txtRequest)

        viewModelScope.launch {
            try {
                val response = openAi.sendImageRequest(API_KEY, requestBody)
                Log.i("URL", response.toString())
            } catch (e: Exception){
                Log.e("Exception", e.toString())
            }
        }
    }

    @POST("/v1/images/edits")
    suspend fun sendImageRequest(
        @Header("Authorization") apiKey: String,
        @Body request: EditRequest
    ): EditResponse

Maybe uploading the official OpenAI Python or Node.js code to a serverless solution could be an option, but I think that's too much. Thank you for your time :)


问:
Exporting million rows in postgres/Pgadmin but return empty CSV file
I did a union all for 12 tables and the output is around 5.7 million rows. And when i tried to download it then save it as a CSV file, it says 0 bytes. Can someone explain what should i do about it please ???

like this


问:
Configure node packages to use socks proxy
Is there a way to make all npm packages proxy aware (on MacOS Ventura)?

There's this, on how to make npm itself proxy aware, but at the moment, I find myself sitting on a network that uses pi-hole, and is blocking at least one and possibly many of the destinations that my NextJS backend needs to reach.

Specifically, I'm using the Klaviyo node sdk, which under the covers uses superagent. There's an open issue from way back in March 2020 on how to configure superagent to use a proxy, so I guess there's no native way or it would have been answered.

So I'm wondering if there's a generic way to tell any requests to go over the proxy connection for any installed package.


问:
Custom events are registering but i can't make new funnel
I have started using UGS, and started registering custom events a couple of hours ago.

The custom events are registering correctly in the dashboard.

Suppose to be a "New funnel" or "create new funnel" button, but it is missing.

Any idea why?


问:
div.d precision in MIPS
```<code> .data
input1: .asciiz "Please enter what unit do you want to convert it into: \n"
ask:    .asciiz "Please enter the length\n"
mmtocm: .double 10.0
test:   .double 100.0
result: .asciiz "The result is: %.2f\n"

.text
MAIN:
    # print prompt
    li $v0, 4
    la $a0, ask
    syscall

    # read length
    li $v0, 7
    syscall

    #divide length by mmtocm and store result in $f12
    l.d $f4, mmtocm
    div.d $f12, $f0, $f4

    # print result
    #li $v0, 3
        la $a0, result
        li $v0, 3
        syscall

Exit:
    li $v0, 10
    syscall

</code>```

so heres is my instruction when i input 20 , it will print 2.0 which is fine , but when i input 20.3, it will input 2.03000000000002 , and i want the answer up to 2 deciamal only, this only happen when i use div.d instruction when is use mul.d for instace , and i input 20.3 it will give me 203.0 , and also theres certain number that work e.g , 10.5 , and it will give me 1.05 which is correct whcih also fine , anyone can help , thank you in advance

i expect to get 2.03 as an answer when in input 20.3

Title: div.d precision in MIPS

Body:
 .data
input1: .asciiz "Please enter what unit do you want to convert it into: \n"
ask:    .asciiz "Please enter the length\n"
mmtocm: .double 10.0
test:   .double 100.0
result: .asciiz "The result is: %.2f\n"

.text
MAIN:
    # print prompt
    li $v0, 4
    la $a0, ask
    syscall

    # read length
    li $v0, 7
    syscall

    #divide length by mmtocm and store result in $f12
    l.d $f4, mmtocm
    div.d $f12, $f0, $f4

    # print result
    #li $v0, 3
        la $a0, result
        li $v0, 3
        syscall

Exit:
    li $v0, 10
    syscall

so heres is my instruction when i input 20 , it will print 2.0 which is fine , but when i input 20.3, it will input 2.03000000000002 , and i want the answer up to 2 deciamal only, this only happen when i use div.d instruction when is use mul.d for instace , and i input 20.3 it will give me 203.0 , and also theres certain number that work e.g , 10.5 , and it will give me 1.05 which is correct whcih also fine , anyone can help , thank you in advance

i expect to get 2.03 as an answer when in input 20.3


问:
Flutter YouTube Player I frame full screen button is not working
I am not able to open full screen in youtube player (youtube_player_iframe: ^4.0.1). when I click on Fullscreen button so its not working (it means no action perfom or i can say on click event is not working). When I rotate my mobile to show landscape video, so its give me error and video is stop.
One more thing, one error continuously fired when i load youtube player page. "updateAcquireFence: Did not find frame"

following are my code:

```<code>import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
import 'package:http/http.dart' as http;
import '../Models/Hexa color.dart';
import '../Models/LinkModel.dart';

class fullScreen extends StatefulWidget {
  const fullScreen({Key? key}) : super(key: key);

  @override
  State<fullScreen> createState() => _fullScreenState();
}

class _fullScreenState extends State<fullScreen> {

  late YoutubePlayerController _controller;

  Future<LinkModel> getAllLinks() async {
    var url = "youtubeLinks.php";
    var response = await http.get(Uri.parse(url));
    var jsondata = jsonDecode(response.body.toString());
    print("****" + jsondata.toString());

    if (response.statusCode == 200) {
      return LinkModel.fromJson(jsondata);
    } else {
      return LinkModel.fromJson(jsondata);
    }
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    _controller = YoutubePlayerController(
      params: YoutubePlayerParams(
        showControls: true,
        mute: false,
        showFullscreenButton: true,
        loop: false,
      )
    );

  }

  @override
  Widget build(BuildContext context) {
    return YoutubePlayerScaffold(
      controller: _controller,
      aspectRatio: 16 / 9,
      builder: (context, player) {
        return SafeArea(
            child: Scaffold(
              appBar: AppBar(title: Text("Live Program",
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 25
                ),),
                centerTitle: true,
                backgroundColor: Color(hexColors('006064')),
              ),
              body: FutureBuilder<LinkModel>(
                future: getAllLinks(),
                builder: (context,snapshot){
                  if(snapshot.hasData){
                    return ListView.builder(
                      itemCount: snapshot.data!.data!.length-1,
                        itemBuilder: (context, index){
                      var allItem = snapshot.data!.data![index];
                      var videoId = allItem.link!.substring(17);
                      print("///////////////////");
                      print(videoId);
                      return Card(
                        color: Color(hexColors("03A9F4")),
                        elevation: 6,
                        shape: RoundedRectangleBorder(
                            borderRadius:
                            BorderRadius.circular(10.0)),
                        child: Expanded(
                          child: Column(
                            children: [
                             YoutubePlayer(
                               controller: _controller = YoutubePlayerController.fromVideoId(videoId: videoId,
                               autoPlay: false,
                               params: YoutubePlayerParams(showFullscreenButton: true ))
                                 ),

                            ],
                          ),
                        ),

                      );
                    }
                    );
                  }else{
                    return Container(child: Center(child: CircularProgressIndicator(),),);
                  }

                },
              ),
            )
        );
      },
    );
}
}
</code>```

1)How I can able to watch video in fullscreen?
2)How I can get titles of links?

Body:
I am not able to open full screen in youtube player (youtube_player_iframe: ^4.0.1). when I click on Fullscreen button so its not working (it means no action perfom or i can say on click event is not working). When I rotate my mobile to show landscape video, so its give me error and video is stop.
One more thing, one error continuously fired when i load youtube player page. "updateAcquireFence: Did not find frame"

following are my code:

import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
import 'package:http/http.dart' as http;
import '../Models/Hexa color.dart';
import '../Models/LinkModel.dart';

class fullScreen extends StatefulWidget {
  const fullScreen({Key? key}) : super(key: key);

  @override
  State<fullScreen> createState() => _fullScreenState();
}

class _fullScreenState extends State<fullScreen> {

  late YoutubePlayerController _controller;

  Future<LinkModel> getAllLinks() async {
    var url = "youtubeLinks.php";
    var response = await http.get(Uri.parse(url));
    var jsondata = jsonDecode(response.body.toString());
    print("****" + jsondata.toString());

    if (response.statusCode == 200) {
      return LinkModel.fromJson(jsondata);
    } else {
      return LinkModel.fromJson(jsondata);
    }
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    _controller = YoutubePlayerController(
      params: YoutubePlayerParams(
        showControls: true,
        mute: false,
        showFullscreenButton: true,
        loop: false,
      )
    );

  }

  @override
  Widget build(BuildContext context) {
    return YoutubePlayerScaffold(
      controller: _controller,
      aspectRatio: 16 / 9,
      builder: (context, player) {
        return SafeArea(
            child: Scaffold(
              appBar: AppBar(title: Text("Live Program",
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 25
                ),),
                centerTitle: true,
                backgroundColor: Color(hexColors('006064')),
              ),
              body: FutureBuilder<LinkModel>(
                future: getAllLinks(),
                builder: (context,snapshot){
                  if(snapshot.hasData){
                    return ListView.builder(
                      itemCount: snapshot.data!.data!.length-1,
                        itemBuilder: (context, index){
                      var allItem = snapshot.data!.data![index];
                      var videoId = allItem.link!.substring(17);
                      print("///////////////////");
                      print(videoId);
                      return Card(
                        color: Color(hexColors("03A9F4")),
                        elevation: 6,
                        shape: RoundedRectangleBorder(
                            borderRadius:
                            BorderRadius.circular(10.0)),
                        child: Expanded(
                          child: Column(
                            children: [
                             YoutubePlayer(
                               controller: _controller = YoutubePlayerController.fromVideoId(videoId: videoId,
                               autoPlay: false,
                               params: YoutubePlayerParams(showFullscreenButton: true ))
                                 ),

                            ],
                          ),
                        ),

                      );
                    }
                    );
                  }else{
                    return Container(child: Center(child: CircularProgressIndicator(),),);
                  }

                },
              ),
            )
        );
      },
    );
}
}

1)How I can able to watch video in fullscreen?
2)How I can get titles of links?


问:
How do I convert a phone number to a ContactJid in Whatsapp4j?
how do I convert a phone number to a ContactJid?.
For example I have a certain phone number:

int PhoneNumber = 12313112;

I want to sent a message to that number through Whatsapp4j but in order to do this we have to get the chat.

```<code>var chat = api.store()
 .findChatByJid(ContactJid);
</code>```

how can I replace the ContactJid with a phone number?. I don't really know how to make a ContactJid.

Body:
how do I convert a phone number to a ContactJid?.
For example I have a certain phone number:

int PhoneNumber = 12313112;

I want to sent a message to that number through Whatsapp4j but in order to do this we have to get the chat.

var chat = api.store()
 .findChatByJid(ContactJid);

how can I replace the ContactJid with a phone number?. I don't really know how to make a ContactJid.