问:
ImagePicker showing duplicate photos
I am trying to understand why when I add a photo in my view it is duplicating the photo?
I want the user to add a photo to each card separately. I have tried to directly add selectedImage to my struct item image within the [Expense] array but xcode is screaming at me.

I know it has to with the @State selectedImage with its @Binding but Im not 100% sure how to enable this to work in my current scenario?

Here is the struct it is conforming to:

```<code>struct Card: Identifiable {
    var id = UUID()
    var title: String
    var expenses: [Expense]

    mutating func addExpenses() {
        expenses.append(Expense(expensetype: "", amount: 0.0))
    }
}

struct Expense: Identifiable {

    var id = UUID()
    var expensetype: String
    var amount: Double = 0.0
    var image: UIImage?

}
</code>```

I am creating an array of cards on a button press in my contentview {

```<code>struct ContentView: View {

    @State private var cards = [Card]()

    @State private var sourceType: UIImagePickerController.SourceType = .photoLibrary
    @State private var selectedImage: UIImage?
    @State private var isImagePickerDisplay = false
    @State private var showingOptions = false

    var title = ""
    var expensetype = ""
    var amount: Double = 0.0
    var image: UIImage?

    var body: some View {
        NavigationStack {
            Form {
                List {

                    Button("Add card") {
                        addCard()
                    }
                    ForEach($cards) { a in
                        Section {
                            TextField("Title", text: a.title)

                            Button("Add expense") {
                                a.wrappedValue.addExpenses()
                            }
                            ForEach(a.expenses) { b in
                                if a.expenses.isEmpty == false {
                                    TextField("my expense", text: b.expensetype)
                                    TextField("amount", value: b.amount, format: .number)
                                    Button("Add image") {
                                        withAnimation {
                                            showingOptions = true
                                        }
                                    }
                                    .confirmationDialog("", isPresented: $showingOptions, titleVisibility: .hidden) {
                                        Button("Take photo") {
                                            self.sourceType = .camera
                                            self.isImagePickerDisplay.toggle()
                                        }
                                        Button("Choose photo") {
                                            self.sourceType = .photoLibrary
                                            self.isImagePickerDisplay.toggle()
                                        }
                                    }
                                    if selectedImage != nil {
                                        Image(uiImage: self.selectedImage!)
                                            .resizable()
                                            .aspectRatio(contentMode: .fit)
                                            .frame(width: 150, height: 150)
                                    } else {
                                        Image(systemName: "snow")
                                            .resizable()
                                            .aspectRatio(contentMode: .fit)
                                            .frame(width: 150, height: 150)
                                    }
                                }
                            }
                        }
                    }
                }
            }
            .sheet(isPresented: self.$isImagePickerDisplay) {
                ImagePickerView(selectedImage: self.$selectedImage, sourceType: self.sourceType)
            }
        }
    }
    func addCard() {
        cards.append(Card(title: title, expenses: []))
    }
}
</code>```

Here is my ImagePickerView

```<code>struct ImagePickerView: UIViewControllerRepresentable {
    @Binding var selectedImage: UIImage?
    @Environment(\.presentationMode) var isPresented

    var sourceType: UIImagePickerController.SourceType

    func makeUIViewController(context: Context) -> some UIViewController {
        let imagePicker = UIImagePickerController()
        imagePicker.sourceType = self.sourceType
        imagePicker.delegate = context.coordinator
        return imagePicker
    }
    func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {

    }
    func makeCoordinator() -> Coordinator {
        return Coordinator(picker: self)
    }
}
</code>```

Title: ImagePicker showing duplicate photos

Body:
I am trying to understand why when I add a photo in my view it is duplicating the photo?
I want the user to add a photo to each card separately. I have tried to directly add selectedImage to my struct item image within the [Expense] array but xcode is screaming at me.

I know it has to with the @State selectedImage with its @Binding but Im not 100% sure how to enable this to work in my current scenario?

Here is the struct it is conforming to:

struct Card: Identifiable {
    var id = UUID()
    var title: String
    var expenses: [Expense]

    mutating func addExpenses() {
        expenses.append(Expense(expensetype: "", amount: 0.0))
    }
}

struct Expense: Identifiable {

    var id = UUID()
    var expensetype: String
    var amount: Double = 0.0
    var image: UIImage?

}

I am creating an array of cards on a button press in my contentview {

struct ContentView: View {

    @State private var cards = [Card]()

    @State private var sourceType: UIImagePickerController.SourceType = .photoLibrary
    @State private var selectedImage: UIImage?
    @State private var isImagePickerDisplay = false
    @State private var showingOptions = false

    var title = ""
    var expensetype = ""
    var amount: Double = 0.0
    var image: UIImage?

    var body: some View {
        NavigationStack {
            Form {
                List {

                    Button("Add card") {
                        addCard()
                    }
                    ForEach($cards) { a in
                        Section {
                            TextField("Title", text: a.title)

                            Button("Add expense") {
                                a.wrappedValue.addExpenses()
                            }
                            ForEach(a.expenses) { b in
                                if a.expenses.isEmpty == false {
                                    TextField("my expense", text: b.expensetype)
                                    TextField("amount", value: b.amount, format: .number)
                                    Button("Add image") {
                                        withAnimation {
                                            showingOptions = true
                                        }
                                    }
                                    .confirmationDialog("", isPresented: $showingOptions, titleVisibility: .hidden) {
                                        Button("Take photo") {
                                            self.sourceType = .camera
                                            self.isImagePickerDisplay.toggle()
                                        }
                                        Button("Choose photo") {
                                            self.sourceType = .photoLibrary
                                            self.isImagePickerDisplay.toggle()
                                        }
                                    }
                                    if selectedImage != nil {
                                        Image(uiImage: self.selectedImage!)
                                            .resizable()
                                            .aspectRatio(contentMode: .fit)
                                            .frame(width: 150, height: 150)
                                    } else {
                                        Image(systemName: "snow")
                                            .resizable()
                                            .aspectRatio(contentMode: .fit)
                                            .frame(width: 150, height: 150)
                                    }
                                }
                            }
                        }
                    }
                }
            }
            .sheet(isPresented: self.$isImagePickerDisplay) {
                ImagePickerView(selectedImage: self.$selectedImage, sourceType: self.sourceType)
            }
        }
    }
    func addCard() {
        cards.append(Card(title: title, expenses: []))
    }
}

Here is my ImagePickerView

struct ImagePickerView: UIViewControllerRepresentable {
    @Binding var selectedImage: UIImage?
    @Environment(\.presentationMode) var isPresented

    var sourceType: UIImagePickerController.SourceType

    func makeUIViewController(context: Context) -> some UIViewController {
        let imagePicker = UIImagePickerController()
        imagePicker.sourceType = self.sourceType
        imagePicker.delegate = context.coordinator
        return imagePicker
    }
    func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {

    }
    func makeCoordinator() -> Coordinator {
        return Coordinator(picker: self)
    }
}


来源: stackexchange

问:
Add uploaded PDF file to Word doc generated in front end
Looking for a way to add a user-uploaded PDF file to a Word document generated in the browser.

The user fills out a questionnaire and has the option to upload a document. At the end, the user clicks on a button and a Word document is generated with the gathered data (using docxtemplater).

The JSON data used for the doc generation is not stored anywhere after these steps.

Is there

a) a library that allows the uploaded file (which will be a PDF) to be added to/embedded in the generated Word document in the front end or
b) a way to display the file in the Word document by referencing the data URL in the template?

Example JSON (after generating the document):

```<code>"attachmentUpload": [
{
"name": "Example.pdf",
"type: "application/pdf",
"content": "data:application/pdf;base64,[.......]"
}
]
</code>```

All I have found so far are libraries to merge two or more PDF files.

Any pointers would be highly appreciated!

Thanks!

ContentLicense: CC BY-SA 4.0

Body:
Looking for a way to add a user-uploaded PDF file to a Word document generated in the browser.

The user fills out a questionnaire and has the option to upload a document. At the end, the user clicks on a button and a Word document is generated with the gathered data (using docxtemplater).

The JSON data used for the doc generation is not stored anywhere after these steps.

Is there

a) a library that allows the uploaded file (which will be a PDF) to be added to/embedded in the generated Word document in the front end or
b) a way to display the file in the Word document by referencing the data URL in the template?

Example JSON (after generating the document):

"attachmentUpload": [
{
"name": "Example.pdf",
"type: "application/pdf",
"content": "data:application/pdf;base64,[.......]"
}
]

All I have found so far are libraries to merge two or more PDF files.

Any pointers would be highly appreciated!

Thanks!


问:
Moving groups of shapes on canvas: shape moves every couple of frames to opposite x and y position
I'm working on a schoolproject were I need to make a drawing app and use design patterns.
When I'm dragging a group of shapes over the canvas with the mouse. They move in the right directionbut it every couple of frames it glitches in the oposite direction. For example if the location of shape is x = 100 y = 50, every couple of frames it glitches to x = -100 y = -50. What can it be?

Note: The shapes are grouped in groups and the visitor is executed on every shape of a group when a dragevent occurs.

```<code>                DragEventArgs dragEvent = (DragEventArgs)e;
                Point dropPosition = dragEvent.GetPosition(MyCanvas);
                double x = dropPosition.X;
                double y = dropPosition.Y;

                var moveVisitor = new MoveVisitor(MyCanvas,x, y, e);

</code>```
```<code>                    matchingCompoundShape.parent.Accept(moveVisitor);
</code>```
```<code>        public void VisitShape(CompoundShape compoundShape)
        {

            double oldTop = Canvas.GetTop(compoundShape.shape) ;
            double oldLeft = Canvas.GetLeft(compoundShape.shape);

            double newLeft = (xc - (oldLeft - xc)) - 50;
            double newTop = (yc - (oldTop - yc)) - 50;

            Canvas.SetLeft(compoundShape.shape, newLeft);
            Canvas.SetTop(compoundShape.shape, newTop);

        }
</code>```

If I set the left andTop  for testing to the mouse position the shapes move without glitching.

Body:
I'm working on a schoolproject were I need to make a drawing app and use design patterns.
When I'm dragging a group of shapes over the canvas with the mouse. They move in the right directionbut it every couple of frames it glitches in the oposite direction. For example if the location of shape is x = 100 y = 50, every couple of frames it glitches to x = -100 y = -50. What can it be?

Note: The shapes are grouped in groups and the visitor is executed on every shape of a group when a dragevent occurs.

                DragEventArgs dragEvent = (DragEventArgs)e;
                Point dropPosition = dragEvent.GetPosition(MyCanvas);
                double x = dropPosition.X;
                double y = dropPosition.Y;

                var moveVisitor = new MoveVisitor(MyCanvas,x, y, e);

                    matchingCompoundShape.parent.Accept(moveVisitor);

        public void VisitShape(CompoundShape compoundShape)
        {

            double oldTop = Canvas.GetTop(compoundShape.shape) ;
            double oldLeft = Canvas.GetLeft(compoundShape.shape);

            double newLeft = (xc - (oldLeft - xc)) - 50;
            double newTop = (yc - (oldTop - yc)) - 50;

            Canvas.SetLeft(compoundShape.shape, newLeft);
            Canvas.SetTop(compoundShape.shape, newTop);

        }

If I set the left andTop  for testing to the mouse position the shapes move without glitching.


问:
How to compare two images in detecting dots in python?
Imagine that two kids drew some objects (look like dots) in two white papers, which are similar in size and dimension.
I want to detect these objects, and count objects which are in a same x and y-axis, How can we count the similar objects? And measure the agreement between them?
I found some similarity methods, but for these small objects did not work.
You can see image examples here. A machine learning methods can be used here? Or a simple method of OpenCV ?

These two images are input (resized images of original images).

And these are my code, I tried this code from another similar post.
The point is that the SSIM is not accurate in my case.

from skimage.metrics import structural_similarity
import numpy as np
import cv2
image1=cv2.imread("E:/image1.png")
image2=cv2.imread("E:/image2.png")

image1gray=cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
image2gray=cv2.cvtColor(image2, cv2.COLOR_BGR2GRAY)

# Compute SSIM between the two images
(score, diff) = structural_similarity(image1gray, image2gray, full=True)
print("Image Similarity: {:.4f}%".format(score * 100))

# The diff image contains the actual image differences between the two images
# and is represented as a floating point data type in the range [0,1]
# so we must convert the array to 8-bit unsigned integers in the range
# [0,255] before we can use it with OpenCV
diff = (diff * 255).astype("uint8")
diff_box = cv2.merge([diff, diff, diff])

# Threshold the difference image, followed by finding contours to
# obtain the regions of the two input images that differ
thresh = cv2.threshold(diff, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
contours = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
contours = contours[0] if len(contours) == 2 else contours[1]

mask = np.zeros(image1.shape, dtype='uint8')
filled_image2 = image2.copy()
filled_image1=image1.copy()

for c in contours:
    area = cv2.contourArea(c)
    if area > 40:
        x,y,w,h = cv2.boundingRect(c)
        cv2.rectangle(image1, (x, y), (x + w, y + h), (36,255,12), 2)
        cv2.rectangle(image2, (x, y), (x + w, y + h), (36,255,12), 2)
        cv2.rectangle(diff_box, (x, y), (x + w, y + h), (36,255,12), 2)
        cv2.drawContours(mask, [c], 0, (255,255,255), -1)
        cv2.drawContours(filled_image2, [c], 0, (0,255,0), -1)
        cv2.drawContours(filled_image1, [c], 0, (0,255,0), -1)

cv2.imwrite('E:/Outout/image11.png', image1)
cv2.imwrite('E:/Outout/image22.png', image2)
cv2.imwrite('E:/Outout/diff_img.png', diff)
cv2.imwrite('E:/Outout/diff_box.png', diff_box)
cv2.imwrite('E:/Outout/mask.png', mask)
cv2.imwrite('E:/Outout/filled image2.png', filled_image2)
```

You can see the output that are not accurate as well.

What I want is a contour for each spot in the image, but by using this method I can get some patterns of dots in a contour.

Body:
Imagine that two kids drew some objects (look like dots) in two white papers, which are similar in size and dimension.
I want to detect these objects, and count objects which are in a same x and y-axis, How can we count the similar objects? And measure the agreement between them?
I found some similarity methods, but for these small objects did not work.
You can see image examples here. A machine learning methods can be used here? Or a simple method of OpenCV ?

These two images are input (resized images of original images).

And these are my code, I tried this code from another similar post.
The point is that the SSIM is not accurate in my case.

from skimage.metrics import structural_similarity
import numpy as np
import cv2
image1=cv2.imread("E:/image1.png")
image2=cv2.imread("E:/image2.png")

image1gray=cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
image2gray=cv2.cvtColor(image2, cv2.COLOR_BGR2GRAY)

# Compute SSIM between the two images
(score, diff) = structural_similarity(image1gray, image2gray, full=True)
print("Image Similarity: {:.4f}%".format(score * 100))

# The diff image contains the actual image differences between the two images
# and is represented as a floating point data type in the range [0,1]
# so we must convert the array to 8-bit unsigned integers in the range
# [0,255] before we can use it with OpenCV
diff = (diff * 255).astype("uint8")
diff_box = cv2.merge([diff, diff, diff])

# Threshold the difference image, followed by finding contours to
# obtain the regions of the two input images that differ
thresh = cv2.threshold(diff, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
contours = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
contours = contours[0] if len(contours) == 2 else contours[1]

mask = np.zeros(image1.shape, dtype='uint8')
filled_image2 = image2.copy()
filled_image1=image1.copy()

for c in contours:
    area = cv2.contourArea(c)
    if area > 40:
        x,y,w,h = cv2.boundingRect(c)
        cv2.rectangle(image1, (x, y), (x + w, y + h), (36,255,12), 2)
        cv2.rectangle(image2, (x, y), (x + w, y + h), (36,255,12), 2)
        cv2.rectangle(diff_box, (x, y), (x + w, y + h), (36,255,12), 2)
        cv2.drawContours(mask, [c], 0, (255,255,255), -1)
        cv2.drawContours(filled_image2, [c], 0, (0,255,0), -1)
        cv2.drawContours(filled_image1, [c], 0, (0,255,0), -1)

cv2.imwrite('E:/Outout/image11.png', image1)
cv2.imwrite('E:/Outout/image22.png', image2)
cv2.imwrite('E:/Outout/diff_img.png', diff)
cv2.imwrite('E:/Outout/diff_box.png', diff_box)
cv2.imwrite('E:/Outout/mask.png', mask)
cv2.imwrite('E:/Outout/filled image2.png', filled_image2)

You can see the output that are not accurate as well.

What I want is a contour for each spot in the image, but by using this method I can get some patterns of dots in a contour.


问:
XGBoostError: ../src/gbm/gbtree.cc:588: Check failed: common::AllVisibleGPUs() >= 1 (0 vs. 1) : No visible GPU is found for XGBoost
When I'm trying to run hyper parameter Bayesian optimization using:
from skopt import BayesSearchCV

I'm getting this error on a JupterLab AWS platform with pip environment.

The full error:

```<code>---------------------------------------------------------------------------
XGBoostError                              Traceback (most recent call last)
Input In [49], in <cell line: 1>()
----> 1 opt.fit(X_train, y_train['dr_with_pp_assumption_dpd30'])

File ~/wd/venv/lib/python3.8/site-packages/skopt/searchcv.py:466, in BayesSearchCV.fit(self, X, y, groups, callback, **fit_params)
    463 else:
    464     self.optimizer_kwargs_ = dict(self.optimizer_kwargs)
--> 466 super().fit(X=X, y=y, groups=groups, **fit_params)
    468 # BaseSearchCV never ranked train scores,
    469 # but apparently we used to ship this (back-compat)
    470 if self.return_train_score:

File ~/wd/venv/lib/python3.8/site-packages/sklearn/model_selection/_search.py:891, in BaseSearchCV.fit(self, X, y, groups, **fit_params)
    885     results = self._format_results(
    886         all_candidate_params, n_splits, all_out, all_more_results
    887     )
    889     return results
--> 891 self._run_search(evaluate_candidates)
    893 # multimetric is determined here because in the case of a callable
    894 # self.scoring the return type is only known after calling
    895 first_test_score = all_out[0]["test_scores"]

File ~/wd/venv/lib/python3.8/site-packages/skopt/searchcv.py:512, in BayesSearchCV._run_search(self, evaluate_candidates)
    508 while n_iter > 0:
    509     # when n_iter < n_points points left for evaluation
    510     n_points_adjusted = min(n_iter, n_points)
--> 512     optim_result = self._step(
    513         search_space, optimizer,
    514         evaluate_candidates, n_points=n_points_adjusted
    515     )
    516     n_iter -= n_points
    518     if eval_callbacks(callbacks, optim_result):

File ~/wd/venv/lib/python3.8/site-packages/skopt/searchcv.py:408, in BayesSearchCV._step(self, search_space, optimizer, evaluate_candidates, n_points)
    405 # make lists into dictionaries
    406 params_dict = [point_asdict(search_space, p) for p in params]
--> 408 all_results = evaluate_candidates(params_dict)
    409 # Feed the point and objective value back into optimizer
    410 # Optimizer minimizes objective, hence provide negative score
    411 local_results = all_results["mean_test_score"][-len(params):]

File ~/wd/venv/lib/python3.8/site-packages/sklearn/model_selection/_search.py:838, in BaseSearchCV.fit.<locals>.evaluate_candidates(candidate_params, cv, more_results)
    830 if self.verbose > 0:
    831     print(
    832         "Fitting {0} folds for each of {1} candidates,"
    833         " totalling {2} fits".format(
    834             n_splits, n_candidates, n_candidates * n_splits
    835         )
    836     )
--> 838 out = parallel(
    839     delayed(_fit_and_score)(
    840         clone(base_estimator),
    841         X,
    842         y,
    843         train=train,
    844         test=test,
    845         parameters=parameters,
    846         split_progress=(split_idx, n_splits),
    847         candidate_progress=(cand_idx, n_candidates),
    848         **fit_and_score_kwargs,
    849     )
    850     for (cand_idx, parameters), (split_idx, (train, test)) in product(
    851         enumerate(candidate_params), enumerate(cv.split(X, y, groups))
    852     )
    853 )
    855 if len(out) < 1:
    856     raise ValueError(
    857         "No fits were performed. "
    858         "Was the CV iterator empty? "
    859         "Were there no candidates?"
    860     )

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:1085, in Parallel.__call__(self, iterable)
   1076 try:
   1077     # Only set self._iterating to True if at least a batch
   1078     # was dispatched. In particular this covers the edge
   (...)
   1082     # was very quick and its callback already dispatched all the
   1083     # remaining jobs.
   1084     self._iterating = False
-> 1085     if self.dispatch_one_batch(iterator):
   1086         self._iterating = self._original_iterator is not None
   1088     while self.dispatch_one_batch(iterator):

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:901, in Parallel.dispatch_one_batch(self, iterator)
    899     return False
    900 else:
--> 901     self._dispatch(tasks)
    902     return True

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:819, in Parallel._dispatch(self, batch)
    817 with self._lock:
    818     job_idx = len(self._jobs)
--> 819     job = self._backend.apply_async(batch, callback=cb)
    820     # A job can complete so quickly than its callback is
    821     # called before we get here, causing self._jobs to
    822     # grow. To ensure correct results ordering, .insert is
    823     # used (rather than .append) in the following line
    824     self._jobs.insert(job_idx, job)

File ~/wd/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py:208, in SequentialBackend.apply_async(self, func, callback)
    206 def apply_async(self, func, callback=None):
    207     """Schedule a func to be run"""
--> 208     result = ImmediateResult(func)
    209     if callback:
    210         callback(result)

File ~/wd/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py:597, in ImmediateResult.__init__(self, batch)
    594 def __init__(self, batch):
    595     # Don't delay the application, to avoid keeping the input
    596     # arguments in memory
--> 597     self.results = batch()

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:288, in BatchedCalls.__call__(self)
    284 def __call__(self):
    285     # Set the default nested backend to self._backend but do not set the
    286     # change the default number of processes to -1
    287     with parallel_backend(self._backend, n_jobs=self._n_jobs):
--> 288         return [func(*args, **kwargs)
    289                 for func, args, kwargs in self.items]

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:288, in <listcomp>(.0)
    284 def __call__(self):
    285     # Set the default nested backend to self._backend but do not set the
    286     # change the default number of processes to -1
    287     with parallel_backend(self._backend, n_jobs=self._n_jobs):
--> 288         return [func(*args, **kwargs)
    289                 for func, args, kwargs in self.items]

File ~/wd/venv/lib/python3.8/site-packages/sklearn/utils/fixes.py:216, in _FuncWrapper.__call__(self, *args, **kwargs)
    214 def __call__(self, *args, **kwargs):
    215     with config_context(**self.config):
--> 216         return self.function(*args, **kwargs)

File ~/wd/venv/lib/python3.8/site-packages/sklearn/model_selection/_validation.py:680, in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, return_estimator, split_progress, candidate_progress, error_score)
    678         estimator.fit(X_train, **fit_params)
    679     else:
--> 680         estimator.fit(X_train, y_train, **fit_params)
    682 except Exception:
    683     # Note fit time as time until error
    684     fit_time = time.time() - start_time

File ~/wd/venv/lib/python3.8/site-packages/xgboost/core.py:506, in _deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
    504 for k, arg in zip(sig.parameters, args):
    505     kwargs[k] = arg
--> 506 return f(**kwargs)

File ~/wd/venv/lib/python3.8/site-packages/xgboost/sklearn.py:789, in XGBModel.fit(self, X, y, sample_weight, base_margin, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks)
    786     obj = None
    788 model, feval, params = self._configure_fit(xgb_model, eval_metric, params)
--> 789 self._Booster = train(
    790     params,
    791     train_dmatrix,
    792     self.get_num_boosting_rounds(),
    793     evals=evals,
    794     early_stopping_rounds=early_stopping_rounds,
    795     evals_result=evals_result,
    796     obj=obj,
    797     feval=feval,
    798     verbose_eval=verbose,
    799     xgb_model=model,
    800     callbacks=callbacks,
    801 )
    803 self._set_evaluation_result(evals_result)
    804 return self

File ~/wd/venv/lib/python3.8/site-packages/xgboost/training.py:188, in train(params, dtrain, num_boost_round, evals, obj, feval, maximize, early_stopping_rounds, evals_result, verbose_eval, xgb_model, callbacks)
    115 def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None,
    116           maximize=None, early_stopping_rounds=None, evals_result=None,
    117           verbose_eval=True, xgb_model=None, callbacks=None):
    118     # pylint: disable=too-many-statements,too-many-branches, attribute-defined-outside-init
    119     """Train a booster with given parameters.
    120
    121     Parameters
   (...)
    186     Booster : a trained booster model
    187     """
--> 188     bst = _train_internal(params, dtrain,
    189                           num_boost_round=num_boost_round,
    190                           evals=evals,
    191                           obj=obj, feval=feval,
    192                           xgb_model=xgb_model, callbacks=callbacks,
    193                           verbose_eval=verbose_eval,
    194                           evals_result=evals_result,
    195                           maximize=maximize,
    196                           early_stopping_rounds=early_stopping_rounds)
    197     return bst

File ~/wd/venv/lib/python3.8/site-packages/xgboost/training.py:81, in _train_internal(params, dtrain, num_boost_round, evals, obj, feval, xgb_model, callbacks, evals_result, maximize, verbose_eval, early_stopping_rounds)
     79 if callbacks.before_iteration(bst, i, dtrain, evals):
     80     break
---> 81 bst.update(dtrain, i, obj)
     82 if callbacks.after_iteration(bst, i, dtrain, evals):
     83     break

File ~/wd/venv/lib/python3.8/site-packages/xgboost/core.py:1680, in Booster.update(self, dtrain, iteration, fobj)
   1677 self._validate_features(dtrain)
   1679 if fobj is None:
-> 1680     _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
   1681                                             ctypes.c_int(iteration),
   1682                                             dtrain.handle))
   1683 else:
   1684     pred = self.predict(dtrain, output_margin=True, training=True)

File ~/wd/venv/lib/python3.8/site-packages/xgboost/core.py:218, in _check_call(ret)
    207 """Check the return value of C API call
    208
    209 This function will raise exception when error occurs.
   (...)
    215     return value from API calls
    216 """
    217 if ret != 0:
--> 218     raise XGBoostError(py_str(_LIB.XGBGetLastError()))

XGBoostError: [13:46:18] ../src/gbm/gbtree.cc:588: Check failed: common::AllVisibleGPUs() >= 1 (0 vs. 1) : No visible GPU is found for XGBoost.
Stack trace:
  [bt] (0) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x179459) [0x7f00362cb459]
  [bt] (1) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x179b82) [0x7f00362cbb82]
  [bt] (2) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x17a1da) [0x7f00362cc1da]
  [bt] (3) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x1b46e5) [0x7f00363066e5]
  [bt] (4) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(XGBoosterUpdateOneIter+0x68) [0x7f00361eb4e8]
  [bt] (5) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f01f861cdae]
  [bt] (6) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f01f861c71f]
  [bt] (7) /root/wd/venv/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x8ce) [0x7f01f883234e]
  [bt] (8) /root/wd/venv/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(+0xe4e4) [0x7f01f882d4e4]
</code>```

Any suggestions how to make it work?

I tried to solve this using the answers from here:

XGBoostError: [10:10:03] /workspace/src/tree/updater_gpu_hist.cu:1407: Exception in gpu_hist: NCCL failure

but it didn't work

Body:
When I'm trying to run hyper parameter Bayesian optimization using:
from skopt import BayesSearchCV

I'm getting this error on a JupterLab AWS platform with pip environment.

The full error:

---------------------------------------------------------------------------
XGBoostError                              Traceback (most recent call last)
Input In [49], in <cell line: 1>()
----> 1 opt.fit(X_train, y_train['dr_with_pp_assumption_dpd30'])

File ~/wd/venv/lib/python3.8/site-packages/skopt/searchcv.py:466, in BayesSearchCV.fit(self, X, y, groups, callback, **fit_params)
    463 else:
    464     self.optimizer_kwargs_ = dict(self.optimizer_kwargs)
--> 466 super().fit(X=X, y=y, groups=groups, **fit_params)
    468 # BaseSearchCV never ranked train scores,
    469 # but apparently we used to ship this (back-compat)
    470 if self.return_train_score:

File ~/wd/venv/lib/python3.8/site-packages/sklearn/model_selection/_search.py:891, in BaseSearchCV.fit(self, X, y, groups, **fit_params)
    885     results = self._format_results(
    886         all_candidate_params, n_splits, all_out, all_more_results
    887     )
    889     return results
--> 891 self._run_search(evaluate_candidates)
    893 # multimetric is determined here because in the case of a callable
    894 # self.scoring the return type is only known after calling
    895 first_test_score = all_out[0]["test_scores"]

File ~/wd/venv/lib/python3.8/site-packages/skopt/searchcv.py:512, in BayesSearchCV._run_search(self, evaluate_candidates)
    508 while n_iter > 0:
    509     # when n_iter < n_points points left for evaluation
    510     n_points_adjusted = min(n_iter, n_points)
--> 512     optim_result = self._step(
    513         search_space, optimizer,
    514         evaluate_candidates, n_points=n_points_adjusted
    515     )
    516     n_iter -= n_points
    518     if eval_callbacks(callbacks, optim_result):

File ~/wd/venv/lib/python3.8/site-packages/skopt/searchcv.py:408, in BayesSearchCV._step(self, search_space, optimizer, evaluate_candidates, n_points)
    405 # make lists into dictionaries
    406 params_dict = [point_asdict(search_space, p) for p in params]
--> 408 all_results = evaluate_candidates(params_dict)
    409 # Feed the point and objective value back into optimizer
    410 # Optimizer minimizes objective, hence provide negative score
    411 local_results = all_results["mean_test_score"][-len(params):]

File ~/wd/venv/lib/python3.8/site-packages/sklearn/model_selection/_search.py:838, in BaseSearchCV.fit.<locals>.evaluate_candidates(candidate_params, cv, more_results)
    830 if self.verbose > 0:
    831     print(
    832         "Fitting {0} folds for each of {1} candidates,"
    833         " totalling {2} fits".format(
    834             n_splits, n_candidates, n_candidates * n_splits
    835         )
    836     )
--> 838 out = parallel(
    839     delayed(_fit_and_score)(
    840         clone(base_estimator),
    841         X,
    842         y,
    843         train=train,
    844         test=test,
    845         parameters=parameters,
    846         split_progress=(split_idx, n_splits),
    847         candidate_progress=(cand_idx, n_candidates),
    848         **fit_and_score_kwargs,
    849     )
    850     for (cand_idx, parameters), (split_idx, (train, test)) in product(
    851         enumerate(candidate_params), enumerate(cv.split(X, y, groups))
    852     )
    853 )
    855 if len(out) < 1:
    856     raise ValueError(
    857         "No fits were performed. "
    858         "Was the CV iterator empty? "
    859         "Were there no candidates?"
    860     )

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:1085, in Parallel.__call__(self, iterable)
   1076 try:
   1077     # Only set self._iterating to True if at least a batch
   1078     # was dispatched. In particular this covers the edge
   (...)
   1082     # was very quick and its callback already dispatched all the
   1083     # remaining jobs.
   1084     self._iterating = False
-> 1085     if self.dispatch_one_batch(iterator):
   1086         self._iterating = self._original_iterator is not None
   1088     while self.dispatch_one_batch(iterator):

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:901, in Parallel.dispatch_one_batch(self, iterator)
    899     return False
    900 else:
--> 901     self._dispatch(tasks)
    902     return True

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:819, in Parallel._dispatch(self, batch)
    817 with self._lock:
    818     job_idx = len(self._jobs)
--> 819     job = self._backend.apply_async(batch, callback=cb)
    820     # A job can complete so quickly than its callback is
    821     # called before we get here, causing self._jobs to
    822     # grow. To ensure correct results ordering, .insert is
    823     # used (rather than .append) in the following line
    824     self._jobs.insert(job_idx, job)

File ~/wd/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py:208, in SequentialBackend.apply_async(self, func, callback)
    206 def apply_async(self, func, callback=None):
    207     """Schedule a func to be run"""
--> 208     result = ImmediateResult(func)
    209     if callback:
    210         callback(result)

File ~/wd/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py:597, in ImmediateResult.__init__(self, batch)
    594 def __init__(self, batch):
    595     # Don't delay the application, to avoid keeping the input
    596     # arguments in memory
--> 597     self.results = batch()

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:288, in BatchedCalls.__call__(self)
    284 def __call__(self):
    285     # Set the default nested backend to self._backend but do not set the
    286     # change the default number of processes to -1
    287     with parallel_backend(self._backend, n_jobs=self._n_jobs):
--> 288         return [func(*args, **kwargs)
    289                 for func, args, kwargs in self.items]

File ~/wd/venv/lib/python3.8/site-packages/joblib/parallel.py:288, in <listcomp>(.0)
    284 def __call__(self):
    285     # Set the default nested backend to self._backend but do not set the
    286     # change the default number of processes to -1
    287     with parallel_backend(self._backend, n_jobs=self._n_jobs):
--> 288         return [func(*args, **kwargs)
    289                 for func, args, kwargs in self.items]

File ~/wd/venv/lib/python3.8/site-packages/sklearn/utils/fixes.py:216, in _FuncWrapper.__call__(self, *args, **kwargs)
    214 def __call__(self, *args, **kwargs):
    215     with config_context(**self.config):
--> 216         return self.function(*args, **kwargs)

File ~/wd/venv/lib/python3.8/site-packages/sklearn/model_selection/_validation.py:680, in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, return_estimator, split_progress, candidate_progress, error_score)
    678         estimator.fit(X_train, **fit_params)
    679     else:
--> 680         estimator.fit(X_train, y_train, **fit_params)
    682 except Exception:
    683     # Note fit time as time until error
    684     fit_time = time.time() - start_time

File ~/wd/venv/lib/python3.8/site-packages/xgboost/core.py:506, in _deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
    504 for k, arg in zip(sig.parameters, args):
    505     kwargs[k] = arg
--> 506 return f(**kwargs)

File ~/wd/venv/lib/python3.8/site-packages/xgboost/sklearn.py:789, in XGBModel.fit(self, X, y, sample_weight, base_margin, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks)
    786     obj = None
    788 model, feval, params = self._configure_fit(xgb_model, eval_metric, params)
--> 789 self._Booster = train(
    790     params,
    791     train_dmatrix,
    792     self.get_num_boosting_rounds(),
    793     evals=evals,
    794     early_stopping_rounds=early_stopping_rounds,
    795     evals_result=evals_result,
    796     obj=obj,
    797     feval=feval,
    798     verbose_eval=verbose,
    799     xgb_model=model,
    800     callbacks=callbacks,
    801 )
    803 self._set_evaluation_result(evals_result)
    804 return self

File ~/wd/venv/lib/python3.8/site-packages/xgboost/training.py:188, in train(params, dtrain, num_boost_round, evals, obj, feval, maximize, early_stopping_rounds, evals_result, verbose_eval, xgb_model, callbacks)
    115 def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None,
    116           maximize=None, early_stopping_rounds=None, evals_result=None,
    117           verbose_eval=True, xgb_model=None, callbacks=None):
    118     # pylint: disable=too-many-statements,too-many-branches, attribute-defined-outside-init
    119     """Train a booster with given parameters.
    120
    121     Parameters
   (...)
    186     Booster : a trained booster model
    187     """
--> 188     bst = _train_internal(params, dtrain,
    189                           num_boost_round=num_boost_round,
    190                           evals=evals,
    191                           obj=obj, feval=feval,
    192                           xgb_model=xgb_model, callbacks=callbacks,
    193                           verbose_eval=verbose_eval,
    194                           evals_result=evals_result,
    195                           maximize=maximize,
    196                           early_stopping_rounds=early_stopping_rounds)
    197     return bst

File ~/wd/venv/lib/python3.8/site-packages/xgboost/training.py:81, in _train_internal(params, dtrain, num_boost_round, evals, obj, feval, xgb_model, callbacks, evals_result, maximize, verbose_eval, early_stopping_rounds)
     79 if callbacks.before_iteration(bst, i, dtrain, evals):
     80     break
---> 81 bst.update(dtrain, i, obj)
     82 if callbacks.after_iteration(bst, i, dtrain, evals):
     83     break

File ~/wd/venv/lib/python3.8/site-packages/xgboost/core.py:1680, in Booster.update(self, dtrain, iteration, fobj)
   1677 self._validate_features(dtrain)
   1679 if fobj is None:
-> 1680     _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
   1681                                             ctypes.c_int(iteration),
   1682                                             dtrain.handle))
   1683 else:
   1684     pred = self.predict(dtrain, output_margin=True, training=True)

File ~/wd/venv/lib/python3.8/site-packages/xgboost/core.py:218, in _check_call(ret)
    207 """Check the return value of C API call
    208
    209 This function will raise exception when error occurs.
   (...)
    215     return value from API calls
    216 """
    217 if ret != 0:
--> 218     raise XGBoostError(py_str(_LIB.XGBGetLastError()))

XGBoostError: [13:46:18] ../src/gbm/gbtree.cc:588: Check failed: common::AllVisibleGPUs() >= 1 (0 vs. 1) : No visible GPU is found for XGBoost.
Stack trace:
  [bt] (0) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x179459) [0x7f00362cb459]
  [bt] (1) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x179b82) [0x7f00362cbb82]
  [bt] (2) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x17a1da) [0x7f00362cc1da]
  [bt] (3) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x1b46e5) [0x7f00363066e5]
  [bt] (4) /root/wd/venv/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(XGBoosterUpdateOneIter+0x68) [0x7f00361eb4e8]
  [bt] (5) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f01f861cdae]
  [bt] (6) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f01f861c71f]
  [bt] (7) /root/wd/venv/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x8ce) [0x7f01f883234e]
  [bt] (8) /root/wd/venv/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(+0xe4e4) [0x7f01f882d4e4]

Any suggestions how to make it work?

I tried to solve this using the answers from here:

XGBoostError: [10:10:03] /workspace/src/tree/updater_gpu_hist.cu:1407: Exception in gpu_hist: NCCL failure

but it didn't work


问:
HttpClient always send Unauthorized for calling anonymous method
clinet.PostAsJsonAsync("http://localhost:5088/AuthValidator",Email)
I am trying call another service using httpClient, but always have the same status code:Unauthorized. Attributes of method which should invoked.

[HttpPost]
[AllowAnonymous]
public async Task<ActionResult> Validate([FromBody] string Email)
```

I really want to know how I should Invoke this method

Body:
clinet.PostAsJsonAsync("http://localhost:5088/AuthValidator",Email)
I am trying call another service using httpClient, but always have the same status code:Unauthorized. Attributes of method which should invoked.

[HttpPost]
[AllowAnonymous]
public async Task<ActionResult> Validate([FromBody] string Email)

I really want to know how I should Invoke this method


问:
State update causes another render even if using primitive value
Hello I am using the last version of Expo (47.0.8) in my react native project.
React version is : 18.1.0

Edit : I produce that even in a bare React Native project without Expo. (react 18)

No strict mode enabled.

It seems that updating a state with the same value cause another render, only once.
Even if the value is a primitive, like a number ( not an object )

```<code>import { useState } from "react";
import { Text, TouchableOpacity } from "react-native";

export default function App() {
  const [value, setValue] = useState(10);

  function updateValue() {
    setValue(11);
  }

  console.log("RENDER !", value);

  return (
    <>
      <TouchableOpacity style={{marginTop:200}} onPress={updateValue}>
        <Text style={{ fontSize: 40 }}>Update value</Text>
      </TouchableOpacity>
      <Text style={{ fontSize: 40 }}>{value}</Text>
    </>
  );
}
</code>```

So when the app start the output :

RENDER! 10

First click on the TouchableOpacity :

RENDER! 11

Second click on the TouchableOpacity :

RENDER! 11

Then, other clicks don't display anything.

Snack example (check only on mobile it does not happen on expo web) :

https://snack.expo.dev/yalexm1mw?platform=ios

Body:
Hello I am using the last version of Expo (47.0.8) in my react native project.
React version is : 18.1.0

Edit : I produce that even in a bare React Native project without Expo. (react 18)

No strict mode enabled.

It seems that updating a state with the same value cause another render, only once.
Even if the value is a primitive, like a number ( not an object )

import { useState } from "react";
import { Text, TouchableOpacity } from "react-native";

export default function App() {
  const [value, setValue] = useState(10);

  function updateValue() {
    setValue(11);
  }

  console.log("RENDER !", value);

  return (
    <>
      <TouchableOpacity style={{marginTop:200}} onPress={updateValue}>
        <Text style={{ fontSize: 40 }}>Update value</Text>
      </TouchableOpacity>
      <Text style={{ fontSize: 40 }}>{value}</Text>
    </>
  );
}

So when the app start the output :

RENDER! 10

First click on the TouchableOpacity :

RENDER! 11

Second click on the TouchableOpacity :

RENDER! 11

Then, other clicks don't display anything.

Snack example (check only on mobile it does not happen on expo web) :

https://snack.expo.dev/yalexm1mw?platform=ios


问:
Next.js Link Tag does not scroll the page on top
I am using the overflow tailwind class in my div which is supposedly causing this issue.
The class which I am using is

```<code>// the scrollable navbar component in the left side of the web page
    <div className="overflow-y-auto mb-20 pb-4">
      <div className="max-w-[15rem] text-neutral-300 pl-4">
        {o.items?.map((data) => (
          <Link href={`/data/${data.id}`} key={data.id} scroll={true}>
            <p
              className="leading-loose text-sm font-semibold truncate ..."
              key={data.id}
            >
              {data.name}
            </p>
          </Link>
        ))}
      </div>
    </div>

//this data changes when item id is changed from the navbar but it does not scroll to top.
<div className="h-screen flex flex-col bg-neutral-900">
  <div className="grow max-w-7xl m-4 mb-20 pb-4 overflow-y-scroll">
    {data}
  </div>
</div>
</code>```

If this class is removed, the page is updated and the scroll works properly.
I need assistance in solving this question, some help is appreciated

Body:
I am using the overflow tailwind class in my div which is supposedly causing this issue.
The class which I am using is

// the scrollable navbar component in the left side of the web page

        {o.items?.map((data) => (
          <Link href={`/data/${data.id}`} key={data.id} scroll={true}>

              {data.name}

          </Link>
        ))}

//this data changes when item id is changed from the navbar but it does not scroll to top.

    {data}

If this class is removed, the page is updated and the scroll works properly.
I need assistance in solving this question, some help is appreciated


问:
Can’t bind to “cdkDropListData” since it isn’t a known property of ‘div’.?
I’m trying to use Drag-Drop evet in Angular with cdk but when I tried to import codes to my proects (imports etc.) the terminal says Can’t bind to “cdkDropListData” since it isn’t a known property of ‘div’. What is solution of this?

imported cdk from angular core


问:
Problems with UNLOAD and the DELIMITER Informix
I am using UNLOAD in Informix with the DELIMITER "|" but I have problems because in some fields it has as part of the data the value | and then it gives me more fields than the correct ones, I tried with other separators but it's the same.
Is there a better way to export the data than UNLOAD or is there a way to export each field enclosed in double quotes and delimited by "|"?

I am using the following:

```<code>UNLOAD TO "/ruta/al/archivo/nombre_tabla.txt' DELIMITER '|'
SELECT * FROM nombre_tabla;
</code>```

Body:
I am using UNLOAD in Informix with the DELIMITER "|" but I have problems because in some fields it has as part of the data the value | and then it gives me more fields than the correct ones, I tried with other separators but it's the same.
Is there a better way to export the data than UNLOAD or is there a way to export each field enclosed in double quotes and delimited by "|"?

I am using the following:

UNLOAD TO "/ruta/al/archivo/nombre_tabla.txt' DELIMITER '|'
SELECT * FROM nombre_tabla;


问:
Start Camunda instance from React
I am trying to start using camunda.

So far I have created a spring boot service in order to build an api and later use it in my react application to start a process instance. This is my spring boot code :

```<code>package com.example.camundaNewTest;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

import static io.camunda.zeebe.client.impl.util.VersionUtil.LOG;

@RestController
public class RestCalls {

    @Qualifier("zeebeClientLifecycle")
    @Autowired
    private ZeebeClient client;

    @CrossOrigin(origins = "http://localhost:3000")
    @PostMapping("/start")
    public void startInstance(@RequestHeader(value="var") String var) {
        final ProcessInstanceEvent event =
                client
                        .newCreateInstanceCommand()
                        .bpmnProcessId("demo")
                        .latestVersion()
                        .variables(Map.of("var", var))
                        .send()
                        .join();

        LOG.info("Started instance for processDefinitionKey='{}', bpmnProcessId='{}', version='{}' with processInstanceKey='{}'",
                event.getProcessDefinitionKey(), event.getBpmnProcessId(), event.getVersion(), event.getProcessInstanceKey());
    }

}
</code>```

This is working as expected. Now I want to do this call directly from my react app without a third service (spring). However, I can't find anything useful to achieve this. According to camunda documentation, it uses a grpc call to start the instance. So far, I have found some resources talking about react hooks (https://reactjsexample.com/a-react-hook-which-helps-you-to-deal-with-grpc-apis/) but I cannot make it work. Are there any ideas? Or similar situation that may hint the solution? Thank you!!

Title: Start Camunda instance from React

Body:
I am trying to start using camunda.

So far I have created a spring boot service in order to build an api and later use it in my react application to start a process instance. This is my spring boot code :

package com.example.camundaNewTest;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

import static io.camunda.zeebe.client.impl.util.VersionUtil.LOG;

@RestController
public class RestCalls {

    @Qualifier("zeebeClientLifecycle")
    @Autowired
    private ZeebeClient client;

    @CrossOrigin(origins = "http://localhost:3000")
    @PostMapping("/start")
    public void startInstance(@RequestHeader(value="var") String var) {
        final ProcessInstanceEvent event =
                client
                        .newCreateInstanceCommand()
                        .bpmnProcessId("demo")
                        .latestVersion()
                        .variables(Map.of("var", var))
                        .send()
                        .join();

        LOG.info("Started instance for processDefinitionKey='{}', bpmnProcessId='{}', version='{}' with processInstanceKey='{}'",
                event.getProcessDefinitionKey(), event.getBpmnProcessId(), event.getVersion(), event.getProcessInstanceKey());
    }

}

This is working as expected. Now I want to do this call directly from my react app without a third service (spring). However, I can't find anything useful to achieve this. According to camunda documentation, it uses a grpc call to start the instance. So far, I have found some resources talking about react hooks (https://reactjsexample.com/a-react-hook-which-helps-you-to-deal-with-grpc-apis/) but I cannot make it work. Are there any ideas? Or similar situation that may hint the solution? Thank you!!


问:
PHP-CLI crash with no logs on the server
I have got a cron in PHP that crash without any log into the php_errors on a debian. Most of the time (99% of the time), it's work fine and I have no problem with it.
But randomly, it just stop and I have nothing in any log on the server. I have got the issue on 2 different server (with very similar install), always when the load increase.

I installed systemd-coredump on the server because I suspected a segfault into one of php library (the script is complex and make a lot of webservices call) but it didn't log anything on the last crash.
Out of memory are well log into the php_errors, so it doesn't seem to be the problem.

What can I do to gather any logs that can give me a hint on what happen and why my pid just stop ?


问:
Font preload. Does this warning mean that woff wasn't loaded at all or it's okay for a fallback font?
I added preload to woff2 and woff fonts, but only woff2 was preloaded (I guess).

This is what I have in html :

```<code><link
      rel="preload"
      href="/assets/fonts/aclonica-latin-regular-65f8adef.woff2"
      as="font"
      type="font/woff2"
      crossorigin
    />

<link
      rel="preload"
      href="/assets/fonts/aclonica-latin-regular-f5a98d57.woff"
      as="font"
      type="font/woff"
      crossorigin
    />
</code>```

Console warning message:

```<code>The resource at “http://localhost:3000/assets/fonts/aclonica-latin-regular-f5a98d57.woff” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly.
</code>```

Body:
I added preload to woff2 and woff fonts, but only woff2 was preloaded (I guess).

This is what I have in html :

<link
      rel="preload"
      href="/assets/fonts/aclonica-latin-regular-65f8adef.woff2"
      as="font"
      type="font/woff2"
      crossorigin
    />

<link
      rel="preload"
      href="/assets/fonts/aclonica-latin-regular-f5a98d57.woff"
      as="font"
      type="font/woff"
      crossorigin
    />

Console warning message:

The resource at “http://localhost:3000/assets/fonts/aclonica-latin-regular-f5a98d57.woff” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly.


问:
Problem Encounter when install bigchaindb driver
I want to install bigchaindb-driver based on this documentation https://docs.bigchaindb.com/projects/py-driver/en/latest/quickstart.html. Here are my pip and python specification :

Pip version : pip 22.3.1

Python version : Python 3.10.6

I have encounter this error

```<code>Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: python-rapidjson, pycparser, cffi, PyNaCl, cryptography, cryptoconditions, bigchaindb-driver
  DEPRECATION: python-rapidjson is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for python-rapidjson ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-rapidjson did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      running install
      /home/pc1/backend/python-connector/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'rapidjson' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYTHON_RAPIDJSON_VERSION=0.6.3 -I./rapidjson/include -I/home/pc1/backend/python-connector/venv/include -I/usr/include/python3.10 -c ./rapidjson.cpp -o build/temp.linux-x86_64-3.10/./rapidjson.o -pedantic -Wno-long-long
      ./rapidjson.cpp: In function ‘PyObject* RawJSON_new(PyTypeObject*, PyObject*, PyObject*)’:
      ./rapidjson.cpp:444:9: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
        444 |         "value",
            |         ^~~~~~~
      In file included from /usr/include/python3.10/Python.h:74,
                       from ./rapidjson.cpp:9:
      ./rapidjson.cpp: In function ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode)’:
      /usr/include/python3.10/object.h:249:38: error: expected ‘(’ before ‘_PyObject_TypeCheck’
        249 | #define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type)
            |                                      ^~~~~~~~~~~~~~~~~~~
      ./rapidjson.cpp:2742:13: note: in expansion of macro ‘PyObject_TypeCheck’
       2742 |     else if PyObject_TypeCheck(object, &RawJSON_Type) {
            |             ^~~~~~~~~~~~~~~~~~
      ./rapidjson.cpp:2751:5: error: ‘else’ without a previous ‘if’
       2751 |     else if (defaultFn) {
            |     ^~~~
      In file included from ./rapidjson.cpp:21:
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::ASCII<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::ASCII<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::ASCII<> >, rapidjson::UTF8<>, rapidjson::ASCII<> >; PyObject = _object]’
      ./rapidjson.cpp:3189:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
        465 |             const Ch c = is.Peek();
            |                      ^
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >; PyObject = _object]’
      ./rapidjson.cpp:3194:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<PyWriteStreamWrapper, rapidjson::UTF8<>, rapidjson::ASCII<> >; PyObject = _object]’
      ./rapidjson.cpp:3235:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<PyWriteStreamWrapper>; PyObject = _object]’
      ./rapidjson.cpp:3239:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rapidjson

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure
</code>```

Did anybody encountered this issue before ?

cmake already installed on local

cryptography already installed on local

wheel already installed on local

Body:
I want to install bigchaindb-driver based on this documentation https://docs.bigchaindb.com/projects/py-driver/en/latest/quickstart.html. Here are my pip and python specification :

Pip version : pip 22.3.1

Python version : Python 3.10.6

I have encounter this error

Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: python-rapidjson, pycparser, cffi, PyNaCl, cryptography, cryptoconditions, bigchaindb-driver
  DEPRECATION: python-rapidjson is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for python-rapidjson ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-rapidjson did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      running install
      /home/pc1/backend/python-connector/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'rapidjson' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYTHON_RAPIDJSON_VERSION=0.6.3 -I./rapidjson/include -I/home/pc1/backend/python-connector/venv/include -I/usr/include/python3.10 -c ./rapidjson.cpp -o build/temp.linux-x86_64-3.10/./rapidjson.o -pedantic -Wno-long-long
      ./rapidjson.cpp: In function ‘PyObject* RawJSON_new(PyTypeObject*, PyObject*, PyObject*)’:
      ./rapidjson.cpp:444:9: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
        444 |         "value",
            |         ^~~~~~~
      In file included from /usr/include/python3.10/Python.h:74,
                       from ./rapidjson.cpp:9:
      ./rapidjson.cpp: In function ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode)’:
      /usr/include/python3.10/object.h:249:38: error: expected ‘(’ before ‘_PyObject_TypeCheck’
        249 | #define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type)
            |                                      ^~~~~~~~~~~~~~~~~~~
      ./rapidjson.cpp:2742:13: note: in expansion of macro ‘PyObject_TypeCheck’
       2742 |     else if PyObject_TypeCheck(object, &RawJSON_Type) {
            |             ^~~~~~~~~~~~~~~~~~
      ./rapidjson.cpp:2751:5: error: ‘else’ without a previous ‘if’
       2751 |     else if (defaultFn) {
            |     ^~~~
      In file included from ./rapidjson.cpp:21:
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::ASCII<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::ASCII<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::ASCII<> >, rapidjson::UTF8<>, rapidjson::ASCII<> >; PyObject = _object]’
      ./rapidjson.cpp:3189:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
        465 |             const Ch c = is.Peek();
            |                      ^
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >; PyObject = _object]’
      ./rapidjson.cpp:3194:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::ASCII<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<PyWriteStreamWrapper, rapidjson::UTF8<>, rapidjson::ASCII<> >; PyObject = _object]’
      ./rapidjson.cpp:3235:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
      ./rapidjson/include/rapidjson/writer.h: In instantiation of ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::WriteRawValue(const Ch*, std::size_t) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’:
      ./rapidjson/include/rapidjson/writer.h:276:25:   required from ‘bool rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::RawValue(const Ch*, std::size_t, rapidjson::Type) [with OutputStream = PyWriteStreamWrapper; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator; unsigned int writeFlags = 0; rapidjson::Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags>::Ch = char; std::size_t = long unsigned int]’
      ./rapidjson.cpp:2221:25:   required from ‘bool dumps_internal(WriterT*, PyObject*, bool, PyObject*, bool, NumberMode, DatetimeMode, UuidMode) [with WriterT = rapidjson::Writer<PyWriteStreamWrapper>; PyObject = _object]’
      ./rapidjson.cpp:3239:20:   required from here
      ./rapidjson/include/rapidjson/writer.h:465:22: warning: unused variable ‘c’ [-Wunused-variable]
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-rapidjson

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure

Did anybody encountered this issue before ?

cmake already installed on local

cryptography already installed on local

wheel already installed on local


问:
How do I resolve conflicting assertion types in Angular?
I am developing an Angular application that uses the Jasmine framework for regular unit testing and the Cypress framework for end-to-end testing.

While I have had no trouble conducting my E2E tests with Cypress, the spec. files used with Jasmine inside my source code folder src all underline the toBe method calls in red and display the following error message:

TS2339: Property 'toBe' does not exist on type 'Assertion'

A code sample for one my tests is displayed below:

```<code>it('Should have a category of \'A\'', () => {(
    expect(category.category).toBe('A');
})
</code>```

After doing research, I have discovered that the problem is due to both frameworks using the same assertion library. I have tried applying solutions from the following two posts but neither have worked.

Cypress causing type errors in jest assertions

How do I resolve conflicting type identifiers for Cypress and jQuery?

Both solutions suggest editing one or more of the tsconfigjson files, though since I have started to use Cypress at version 10 and above, the cypress root folder has not come with its own config file.

Body:
I am developing an Angular application that uses the Jasmine framework for regular unit testing and the Cypress framework for end-to-end testing.

While I have had no trouble conducting my E2E tests with Cypress, the spec. files used with Jasmine inside my source code folder src all underline the toBe method calls in red and display the following error message:

TS2339: Property 'toBe' does not exist on type 'Assertion'

A code sample for one my tests is displayed below:

it('Should have a category of \'A\'', () => {(
    expect(category.category).toBe('A');
})

After doing research, I have discovered that the problem is due to both frameworks using the same assertion library. I have tried applying solutions from the following two posts but neither have worked.

Cypress causing type errors in jest assertions

How do I resolve conflicting type identifiers for Cypress and jQuery?

Both solutions suggest editing one or more of the tsconfigjson files, though since I have started to use Cypress at version 10 and above, the cypress root folder has not come with its own config file.


问:
Create conan package for specific commit ID and use it as dependencies on other packages
I am currently using Jenkins to build C/C++ projects. The projects uses conan packages as dependencies. I am trying to create a package with specific commit ID which can be later used by other packages.

For example:

RepoA is dependent on package created by RepoB. When RepoA build is trigged in jenkins RepoB build is triggered first in the pipeline and the packages are deployed in local cache which can be used by the RepoA later from the local cache.

RepoA has branch name called X and RepoB will also have same branch name called X. I need to use packages created from RepoB branch X for RepoA. Is there a way in conan to make RepoA use package created from RepoB branch X. I already can use the branch name as channel and use the right packages accordingly for RepoA as the branch name will be kept same. But apart from using the branch name is there any other way to create packages with commit ID as package ID and use it later for RepoA. If anyone knows the answer would be a great help.

The link below explains different package revision but I am cannot get a grasp of how to use it. It would be great if someone can give an example for the solution
Conan package revisions


问:
ELOQUENT LARAVEL Cast integer to string column value in hasOne relationship
I want create one-to-one relationship into two tables.

One of my tables have column typed in int but the second have foreign key column typed in string.

Into database :

```<code>user table:
id: int
</code>```

```<code>life table:
user_id: string
</code>```

in User model :

```<code>public function life(Builder $query): HasOne
{
    return $query->hasOne(Life::class, 'user_id', 'id');
}
</code>```

Any help is appreciated to answer my question

Body:
I want create one-to-one relationship into two tables.

One of my tables have column typed in int but the second have foreign key column typed in string.

Into database :

user table:
id: int

life table:
user_id: string

in User model :

public function life(Builder $query): HasOne
{
    return $query->hasOne(Life::class, 'user_id', 'id');
}

Any help is appreciated to answer my question


问:
The problem is the disappearance of the player
I have one rather ambiguous problem in my C# (Unity) code. It lies in the fact that my player disappears because of the prescribed lines about the spawnpoint. Because of them, my player simply disappears when I run the game
The lines where the problem is possible are 22, 109-112. Please help me with this problem. Thank you very much in advance
But I need spawnpoint for further work. Thank you very much in advance!

Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{
    public static GameManager instance;
    private void Awake()
    {
        if(GameManager.instance != null)
        {
            Destroy(gameObject);
            Destroy(player.gameObject);
            Destroy(floatingTextManager.gameObject);
            Destroy(HUD);
            Destroy(menu);
            return;
        }
        instance = this;
        SceneManager.sceneLoaded += LoadState;
        SceneManager.sceneLoaded += OnSceneLoaded;
    }

    public List<Sprite> playerSprites;
    public List<Sprite> weaponSprites;
    public List<int> weaponPrices;
    public List<int> xpTable;

    public Player player;
    public Weapon weapon;
    public FloatingTextManager floatingTextManager;
    public Animator misMenuAnim;
    public RectTransform hitpointBar;
    public GameObject HUD;
    public GameObject menu;

    public int pesos;
    public int experience;

    public void ShowText(string msg, int fontSize, Color color, Vector3 position, Vector3 motion, float duration)
    {
        floatingTextManager.Show(msg, fontSize, color, position, motion, duration);
    }

    public bool TryUpgradeWeapon()
    {
        if (weaponPrices.Count <= weapon.weaponLevel)
            return false;

        if(pesos >= weaponPrices[weapon.weaponLevel])
        {
            pesos -= weaponPrices[weapon.weaponLevel];
            weapon.UpgradeWeapon();
            return true;
        }

        return false;
    }

    public void OnHitpointChange()
    {
        float ratio = (float)player.hitpoint / (float)player.maxHitpoint;
        hitpointBar.localScale = new Vector3(1, ratio, 1);
    }

    public int GetCurrentLevel()
    {
        int r = 0;
        int add = 0;

        while(experience >= add)
        {
            add += xpTable[r];
            r++;

            if (r == xpTable.Count)
                return r;
        }

        return r;
    }

    public int GetXpToLevel(int level)
    {
        int r = 0;
        int xp = 0;

        while(r < level)
        {
            xp += xpTable[r];
            r++;
        }

        return xp;
    }

    public void GrantXp(int xp)
    {
        int currLevel = GetCurrentLevel();
        experience += xp;
        if (currLevel < GetCurrentLevel())
            OnLevelUp();
    }

    public void OnLevelUp()
    {
        player.OnLevelUp();
        OnHitpointChange();
    }

    public void OnSceneLoaded(Scene s, LoadSceneMode mode)
    {
        player.transform.position = GameObject.Find("SpawnPoint").transform.position;
    }

    public void Respawn()
    {
        misMenuAnim.SetTrigger("Hide");
        UnityEngine.SceneManagement.SceneManager.LoadScene("SampleScene");
        player.Respawn();
    }

    public void SaveState()
    {
       string s = "";

        s += "0" + "|";
        s += pesos.ToString() + '|';
        s += experience.ToString() + "|";
        s += weapon.weaponLevel.ToString();
    }

    public void LoadState(Scene s, LoadSceneMode mode)
    {
        SceneManager.sceneLoaded += LoadState;
        if (!PlayerPrefs.HasKey("SaveState"))
            return;

        string[] data = PlayerPrefs.GetString("SaveState").Split('|');

        pesos = int.Parse(data[1]);
        experience = int.Parse(data[2]);
        player.SetLevel(GetCurrentLevel());
        weapon.SetWeaponLevel(int.Parse(data[0]));
    }
}
```

I have tried many ways over the course of a month, but none of them could solve the problem...

Body:
I have one rather ambiguous problem in my C# (Unity) code. It lies in the fact that my player disappears because of the prescribed lines about the spawnpoint. Because of them, my player simply disappears when I run the game
The lines where the problem is possible are 22, 109-112. Please help me with this problem. Thank you very much in advance
But I need spawnpoint for further work. Thank you very much in advance!

Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{
    public static GameManager instance;
    private void Awake()
    {
        if(GameManager.instance != null)
        {
            Destroy(gameObject);
            Destroy(player.gameObject);
            Destroy(floatingTextManager.gameObject);
            Destroy(HUD);
            Destroy(menu);
            return;
        }
        instance = this;
        SceneManager.sceneLoaded += LoadState;
        SceneManager.sceneLoaded += OnSceneLoaded;
    }

    public List<Sprite> playerSprites;
    public List<Sprite> weaponSprites;
    public List<int> weaponPrices;
    public List<int> xpTable;

    public Player player;
    public Weapon weapon;
    public FloatingTextManager floatingTextManager;
    public Animator misMenuAnim;
    public RectTransform hitpointBar;
    public GameObject HUD;
    public GameObject menu;

    public int pesos;
    public int experience;

    public void ShowText(string msg, int fontSize, Color color, Vector3 position, Vector3 motion, float duration)
    {
        floatingTextManager.Show(msg, fontSize, color, position, motion, duration);
    }

    public bool TryUpgradeWeapon()
    {
        if (weaponPrices.Count <= weapon.weaponLevel)
            return false;

        if(pesos >= weaponPrices[weapon.weaponLevel])
        {
            pesos -= weaponPrices[weapon.weaponLevel];
            weapon.UpgradeWeapon();
            return true;
        }

        return false;
    }

    public void OnHitpointChange()
    {
        float ratio = (float)player.hitpoint / (float)player.maxHitpoint;
        hitpointBar.localScale = new Vector3(1, ratio, 1);
    }

    public int GetCurrentLevel()
    {
        int r = 0;
        int add = 0;

        while(experience >= add)
        {
            add += xpTable[r];
            r++;

            if (r == xpTable.Count)
                return r;
        }

        return r;
    }

    public int GetXpToLevel(int level)
    {
        int r = 0;
        int xp = 0;

        while(r < level)
        {
            xp += xpTable[r];
            r++;
        }

        return xp;
    }

    public void GrantXp(int xp)
    {
        int currLevel = GetCurrentLevel();
        experience += xp;
        if (currLevel < GetCurrentLevel())
            OnLevelUp();
    }

    public void OnLevelUp()
    {
        player.OnLevelUp();
        OnHitpointChange();
    }

    public void OnSceneLoaded(Scene s, LoadSceneMode mode)
    {
        player.transform.position = GameObject.Find("SpawnPoint").transform.position;
    }

    public void Respawn()
    {
        misMenuAnim.SetTrigger("Hide");
        UnityEngine.SceneManagement.SceneManager.LoadScene("SampleScene");
        player.Respawn();
    }

    public void SaveState()
    {
       string s = "";

        s += "0" + "|";
        s += pesos.ToString() + '|';
        s += experience.ToString() + "|";
        s += weapon.weaponLevel.ToString();
    }

    public void LoadState(Scene s, LoadSceneMode mode)
    {
        SceneManager.sceneLoaded += LoadState;
        if (!PlayerPrefs.HasKey("SaveState"))
            return;

        string[] data = PlayerPrefs.GetString("SaveState").Split('|');

        pesos = int.Parse(data[1]);
        experience = int.Parse(data[2]);
        player.SetLevel(GetCurrentLevel());
        weapon.SetWeaponLevel(int.Parse(data[0]));
    }
}

I have tried many ways over the course of a month, but none of them could solve the problem...


问:
('invalid_client: Unauthorized', {'error': 'invalid_client', 'error_description': 'Unauthorized'}) After 7 days
I started a project to autocreate and upload content. This was working previously but suddenly I get an error:

```<code>('invalid_client: Unauthorized', {'error': 'invalid_client', 'error_description': 'Unauthorized'})
</code>```

I've tried refreshing my secret and using a different project.
I've seen people suggest to change the project to release or something like that.

I'm using a premade google library and it always fails at:

```<code>cred.refresh(Request())
</code>```

it was working for about a week and now it doesn't work.

Body:
I started a project to autocreate and upload content. This was working previously but suddenly I get an error:

('invalid_client: Unauthorized', {'error': 'invalid_client', 'error_description': 'Unauthorized'})

I've tried refreshing my secret and using a different project.
I've seen people suggest to change the project to release or something like that.

I'm using a premade google library and it always fails at:

cred.refresh(Request())

it was working for about a week and now it doesn't work.