问:
Why does when I remove the triangle it removes the back only not the front?
I am implementing triangle removal of a mesh by using ray cast. It removes the triangles from the moves that the ray cast is hitting it, but the problem is when I am trying to remove the triangles, it removes the back part of the mesh not the front, and only when I am hitting with ray cast from inside of the mesh. I am not sure what can be the problem, any help and guidance will be really appreciated. I have attached the picture.

In the imaged uploaded, the scene view is flipped down and the game view shows the object that cast ray is in middle:

Following is my implementation:

```<code>using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.Numerics;
using Vector2 = UnityEngine.Vector2;
using Vector3 = UnityEngine.Vector3;
using Vector4 = UnityEngine.Vector4;

public class RemoveTriangle : MonoBehaviour
{
    [Header("Game Object")][Tooltip("The game object that will be removed its triangles")]
    public GameObject spherePrefab;
    // Better to reference those already in the Inspector
    [Header("Mesh Files to Load")]
    [SerializeField][Tooltip("Drag and drop the mesh files you want to load")] private MeshFilter meshFilter;
    [SerializeField][Tooltip("Drag and drop the mesh files you want to load")] private MeshRenderer meshRenderer;
    [SerializeField][Tooltip("Drag and drop the mesh files you want to load")] private MeshCollider meshCollider;
    //[SerializeField] [Range(1.0f, 3.0f)] public float raycastSize = 1.0f;
    [Header("Origin and Target objects")]
    [Tooltip("Drag and drop the origin and target objects")]public Transform SelectOrigin;
    [Tooltip("Drag and drop the origin and target objects")]public MeshFilter SelectTarget;
    [Header("Raycast Distance")][Tooltip("The distance of the raycast")]
    [SerializeField][Range(0.1f,20.0f)]public float MaxDistance = 10f;
    private Mesh mesh;

    private void Awake()
    {
        MeshProperties();

    }

    private void Update()
    {

        DeleteTriangle();

    }

    void MeshProperties()
    {// Get the mesh from the mesh filter
        if (!meshFilter) meshFilter = GetComponent<MeshFilter>();

        if (!meshRenderer) meshRenderer = GetComponent<MeshRenderer>();
        if (!meshCollider) meshCollider = GetComponent<MeshCollider>();

        mesh = meshFilter.mesh;
    }// MeshProperties

    void DeleteTriangle()
    {//raycast from mouse position
        if (Input.GetKey(KeyCode.C))
        {//raycast from mouse position

            Ray ray = new Ray(SelectOrigin.position, SelectOrigin.forward);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, MaxDistance))
            {//if raycast hits a triangle
                Debug.DrawRay(SelectOrigin.position,
                            SelectTarget.transform.position - SelectOrigin.position,
                             Color.red);
                Debug.Log("Triangle Removed at: " + hit.point + "/" + hit.triangleIndex + "/" + hit.normal);

                //cube.transform.position = hit.point;

                // Get current vertices, triangles, uvs,tangents and normals of the mesh
                Vector3[] vertices = mesh.vertices;
                Vector2[] uv = mesh.uv;
                Vector4[] tangents = mesh.tangents;
                Vector3[] normals = mesh.normals;

                int[] triangles = mesh.triangles;

                // Get the vert indices for this triangle
                int vertIndex_1 = triangles[hit.triangleIndex * 3 + 0];
                int vertIndex_2 = triangles[hit.triangleIndex * 3 + 1];
                int vertIndex_3 = triangles[hit.triangleIndex * 3 + 2];

                // Get the vertices for this triangle
                var vert_1 = vertices[vertIndex_1];
                var vert_2 = vertices[vertIndex_2];
                var vert_3 = vertices[vertIndex_3];

                // Get the uv for this triangle
                var uv_1 = uv[vertIndex_1];
                var uv_2 = uv[vertIndex_2];
                var uv_3 = uv[vertIndex_3];

                //Get the Normals for this triangle
                var normal_1 = mesh.normals[vertIndex_1];
                var normal_2 = mesh.normals[vertIndex_2];
                var normal_3 = mesh.normals[vertIndex_3];

                //Get Tangents for this triangle
                Vector4 tangent_1 = mesh.tangents[vertIndex_1];
                Vector4 tangent_2 = mesh.tangents[vertIndex_2];
                Vector4 tangent_3 = mesh.tangents[vertIndex_3];

                // Get the positions for the vertices
                var vertPos_1 = vertices[vertIndex_1];
                var vertPos_2 = vertices[vertIndex_2];
                var vertPos_3 = vertices[vertIndex_3];

                // Get the center of the triangle
                var center = (vertPos_1 + vertPos_2 + vertPos_3) / 3;

                // Now for all three vertices we first check if any other triangle if using it
                // by simply count how often the indices are used in the triangles list
                var verticesOccur_1 = 0;
                var verticesOccur_2 = 0;
                var verticesOccur_3 = 0;

                for (var i = 0; i < triangles.Length; i++)
                {
                    if (triangles[i] == vertIndex_1)
                        verticesOccur_1++;
                    if (triangles[i] == vertIndex_2)
                        verticesOccur_2++;
                    if (triangles[i] == vertIndex_3)
                        verticesOccur_3++;
                }//end for

                // Remove the vertices
                if (verticesOccur_1 == 1)
                    vertices[vertIndex_1] = Vector3.zero;
                if (verticesOccur_2 == 1)
                    vertices[vertIndex_2] = Vector3.zero;
                if (verticesOccur_3 == 1)
                    vertices[vertIndex_3] = Vector3.zero;

                // Remove the uv
                if (verticesOccur_1 == 1)
                    uv[vertIndex_1] = Vector2.zero;
                if (verticesOccur_2 == 1)
                    uv[vertIndex_2] = Vector2.zero;
                if (verticesOccur_3 == 1)
                    uv[vertIndex_3] = Vector2.zero;

                // Remove the normals
                if (verticesOccur_1 == 1)
                    mesh.normals[vertIndex_1] = Vector3.zero;
                if (verticesOccur_2 == 1)
                    mesh.normals[vertIndex_2] = Vector3.zero;
                if (verticesOccur_3 == 1)
                    mesh.normals[vertIndex_3] = Vector3.zero;

                // Remove the tangents
                if (verticesOccur_1 == 1)
                    mesh.tangents[vertIndex_1] = Vector4.zero;
                if (verticesOccur_2 == 1)
                    mesh.tangents[vertIndex_2] = Vector4.zero;
                if (verticesOccur_3 == 1)
                    mesh.tangents[vertIndex_3] = Vector4.zero;

                //fix the triangles
                //for (var i = 0; i < triangles.Length; i++)
                //{
                //if (triangles[i] == vertIndex_1) triangles[i] = 0;
                // (triangles[i] == vertIndex_2) triangles[i] = 0;
                //if (triangles[i] == vertIndex_3) triangles[i] = 0;
                //}]

                // Find the intersecting triangles by checking if the ray intersects with their vertices
                //var intersectingTriangles = new List<int>();

                /* for (var i = 0; i < triangles.Length; i += 3)
                 {
                     var triangleVertIndex_1 = triangles[i + 0];
                     var triangleVertIndex_2 = triangles[i + 1];
                     var triangleVertIndex_3 = triangles[i + 2];

                     var triangleVertPos_1 = vertices[triangleVertIndex_1];
                     var triangleVertPos_2 = vertices[triangleVertIndex_2];
                     var triangleVertPos_3 = vertices[triangleVertIndex_3];

                 }*/

                // Remove the triangles and update the mesh
                triangles[hit.triangleIndex * 3] = 0;
                triangles[hit.triangleIndex * 3 + 1] = 0;
                triangles[hit.triangleIndex * 3 + 2] = 0;

                //update the mesh with the new vertices, uv, normals and tangents
                mesh.vertices = vertices;
                mesh.uv = uv;
                mesh.tangents = tangents;
                mesh.normals = normals;

                //update the tirangles
                mesh.triangles = triangles;

                // Recalculate the normals
                mesh.RecalculateNormals();

                // Recalculate the tangents
                mesh.RecalculateTangents();

                // Recalculate the bounds
                mesh.RecalculateBounds();
            }//end of if
            else
            {

                Debug.Log("No Triangle to remove" + hit.point);

            }//end of if hit.triangleIndex

        }//end of remove triangle

    }//end of class

}//end of class
</code>```

I tried to change the setting of mesh, but it did not give me a good result. I feel like there is a problem with the mesh, but I cannot understand what the problem is.

Body:
I am implementing triangle removal of a mesh by using ray cast. It removes the triangles from the moves that the ray cast is hitting it, but the problem is when I am trying to remove the triangles, it removes the back part of the mesh not the front, and only when I am hitting with ray cast from inside of the mesh. I am not sure what can be the problem, any help and guidance will be really appreciated. I have attached the picture.

In the imaged uploaded, the scene view is flipped down and the game view shows the object that cast ray is in middle:

Following is my implementation:

using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.Numerics;
using Vector2 = UnityEngine.Vector2;
using Vector3 = UnityEngine.Vector3;
using Vector4 = UnityEngine.Vector4;

public class RemoveTriangle : MonoBehaviour
{
    [Header("Game Object")][Tooltip("The game object that will be removed its triangles")]
    public GameObject spherePrefab;
    // Better to reference those already in the Inspector
    [Header("Mesh Files to Load")]
    [SerializeField][Tooltip("Drag and drop the mesh files you want to load")] private MeshFilter meshFilter;
    [SerializeField][Tooltip("Drag and drop the mesh files you want to load")] private MeshRenderer meshRenderer;
    [SerializeField][Tooltip("Drag and drop the mesh files you want to load")] private MeshCollider meshCollider;
    //[SerializeField] [Range(1.0f, 3.0f)] public float raycastSize = 1.0f;
    [Header("Origin and Target objects")]
    [Tooltip("Drag and drop the origin and target objects")]public Transform SelectOrigin;
    [Tooltip("Drag and drop the origin and target objects")]public MeshFilter SelectTarget;
    [Header("Raycast Distance")][Tooltip("The distance of the raycast")]
    [SerializeField][Range(0.1f,20.0f)]public float MaxDistance = 10f;
    private Mesh mesh;

    private void Awake()
    {
        MeshProperties();

    }

    private void Update()
    {

        DeleteTriangle();

    }

    void MeshProperties()
    {// Get the mesh from the mesh filter
        if (!meshFilter) meshFilter = GetComponent<MeshFilter>();

        if (!meshRenderer) meshRenderer = GetComponent<MeshRenderer>();
        if (!meshCollider) meshCollider = GetComponent<MeshCollider>();

        mesh = meshFilter.mesh;
    }// MeshProperties

    void DeleteTriangle()
    {//raycast from mouse position
        if (Input.GetKey(KeyCode.C))
        {//raycast from mouse position

            Ray ray = new Ray(SelectOrigin.position, SelectOrigin.forward);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, MaxDistance))
            {//if raycast hits a triangle
                Debug.DrawRay(SelectOrigin.position,
                            SelectTarget.transform.position - SelectOrigin.position,
                             Color.red);
                Debug.Log("Triangle Removed at: " + hit.point + "/" + hit.triangleIndex + "/" + hit.normal);

                //cube.transform.position = hit.point;

                // Get current vertices, triangles, uvs,tangents and normals of the mesh
                Vector3[] vertices = mesh.vertices;
                Vector2[] uv = mesh.uv;
                Vector4[] tangents = mesh.tangents;
                Vector3[] normals = mesh.normals;

                int[] triangles = mesh.triangles;

                // Get the vert indices for this triangle
                int vertIndex_1 = triangles[hit.triangleIndex * 3 + 0];
                int vertIndex_2 = triangles[hit.triangleIndex * 3 + 1];
                int vertIndex_3 = triangles[hit.triangleIndex * 3 + 2];

                // Get the vertices for this triangle
                var vert_1 = vertices[vertIndex_1];
                var vert_2 = vertices[vertIndex_2];
                var vert_3 = vertices[vertIndex_3];

                // Get the uv for this triangle
                var uv_1 = uv[vertIndex_1];
                var uv_2 = uv[vertIndex_2];
                var uv_3 = uv[vertIndex_3];

                //Get the Normals for this triangle
                var normal_1 = mesh.normals[vertIndex_1];
                var normal_2 = mesh.normals[vertIndex_2];
                var normal_3 = mesh.normals[vertIndex_3];

                //Get Tangents for this triangle
                Vector4 tangent_1 = mesh.tangents[vertIndex_1];
                Vector4 tangent_2 = mesh.tangents[vertIndex_2];
                Vector4 tangent_3 = mesh.tangents[vertIndex_3];

                // Get the positions for the vertices
                var vertPos_1 = vertices[vertIndex_1];
                var vertPos_2 = vertices[vertIndex_2];
                var vertPos_3 = vertices[vertIndex_3];

                // Get the center of the triangle
                var center = (vertPos_1 + vertPos_2 + vertPos_3) / 3;

                // Now for all three vertices we first check if any other triangle if using it
                // by simply count how often the indices are used in the triangles list
                var verticesOccur_1 = 0;
                var verticesOccur_2 = 0;
                var verticesOccur_3 = 0;

                for (var i = 0; i < triangles.Length; i++)
                {
                    if (triangles[i] == vertIndex_1)
                        verticesOccur_1++;
                    if (triangles[i] == vertIndex_2)
                        verticesOccur_2++;
                    if (triangles[i] == vertIndex_3)
                        verticesOccur_3++;
                }//end for

                // Remove the vertices
                if (verticesOccur_1 == 1)
                    vertices[vertIndex_1] = Vector3.zero;
                if (verticesOccur_2 == 1)
                    vertices[vertIndex_2] = Vector3.zero;
                if (verticesOccur_3 == 1)
                    vertices[vertIndex_3] = Vector3.zero;

                // Remove the uv
                if (verticesOccur_1 == 1)
                    uv[vertIndex_1] = Vector2.zero;
                if (verticesOccur_2 == 1)
                    uv[vertIndex_2] = Vector2.zero;
                if (verticesOccur_3 == 1)
                    uv[vertIndex_3] = Vector2.zero;

                // Remove the normals
                if (verticesOccur_1 == 1)
                    mesh.normals[vertIndex_1] = Vector3.zero;
                if (verticesOccur_2 == 1)
                    mesh.normals[vertIndex_2] = Vector3.zero;
                if (verticesOccur_3 == 1)
                    mesh.normals[vertIndex_3] = Vector3.zero;

                // Remove the tangents
                if (verticesOccur_1 == 1)
                    mesh.tangents[vertIndex_1] = Vector4.zero;
                if (verticesOccur_2 == 1)
                    mesh.tangents[vertIndex_2] = Vector4.zero;
                if (verticesOccur_3 == 1)
                    mesh.tangents[vertIndex_3] = Vector4.zero;

                //fix the triangles
                //for (var i = 0; i < triangles.Length; i++)
                //{
                //if (triangles[i] == vertIndex_1) triangles[i] = 0;
                // (triangles[i] == vertIndex_2) triangles[i] = 0;
                //if (triangles[i] == vertIndex_3) triangles[i] = 0;
                //}]

                // Find the intersecting triangles by checking if the ray intersects with their vertices
                //var intersectingTriangles = new List<int>();

                /* for (var i = 0; i < triangles.Length; i += 3)
                 {
                     var triangleVertIndex_1 = triangles[i + 0];
                     var triangleVertIndex_2 = triangles[i + 1];
                     var triangleVertIndex_3 = triangles[i + 2];

                     var triangleVertPos_1 = vertices[triangleVertIndex_1];
                     var triangleVertPos_2 = vertices[triangleVertIndex_2];
                     var triangleVertPos_3 = vertices[triangleVertIndex_3];

                 }*/

                // Remove the triangles and update the mesh
                triangles[hit.triangleIndex * 3] = 0;
                triangles[hit.triangleIndex * 3 + 1] = 0;
                triangles[hit.triangleIndex * 3 + 2] = 0;

                //update the mesh with the new vertices, uv, normals and tangents
                mesh.vertices = vertices;
                mesh.uv = uv;
                mesh.tangents = tangents;
                mesh.normals = normals;

                //update the tirangles
                mesh.triangles = triangles;

                // Recalculate the normals
                mesh.RecalculateNormals();

                // Recalculate the tangents
                mesh.RecalculateTangents();

                // Recalculate the bounds
                mesh.RecalculateBounds();
            }//end of if
            else
            {

                Debug.Log("No Triangle to remove" + hit.point);

            }//end of if hit.triangleIndex

        }//end of remove triangle

    }//end of class

}//end of class

I tried to change the setting of mesh, but it did not give me a good result. I feel like there is a problem with the mesh, but I cannot understand what the problem is.


来源: stackexchange

问:
python shap how to write feature_names from 3d array
In my program,

```<code>from keras.wrappers.scikit_learn import KerasClassifier,KerasRegressor
import shap

def CNN_pImportance():
    #1D convolutional neural network
    model = Sequential()
    model.add(Conv1D(filters=64,kernel_size=2,padding='same',activation='relu',input_shape=(5,1)))
    model.add(MaxPooling1D(pool_size=2))

    model.add(Conv1D(filters=128,kernel_size=2,padding='same',activation='relu'))
    model.add(MaxPooling1D(pool_size=2))

    model.add(Flatten())

    model.add(Dense(64))
    model.add(Activation('relu'))

    model.add(Dense(1))
    model.add(Activation('linear'))

    model.compile(loss='mean_squared_error',
               optimizer='adam',
               metrics = ['mse','mae'])

    return model

if __name__ == '__main__':
     my_model = CNN_pImportance()

     DE = shap.DeepExplainer(my_model,sc_cnn_tube_par_X_train_3D)
     shap_values = DE.shap_values(sc_cnn_tube_par_X_test_3D,check_additivity=False)
     shap.initjs()
     shap.summary_plot(
     shap_values[0],
     sc_cnn_tube_par_X_test_3D,
     feature_names = sc_cnn_tube_par_X_test_3D,
     max_display=50,
     plot_type = 'bar'
)
</code>```

sc_cnn_tube_par_X_train_3D and sc_cnn_tube_par_X_test_3D are 3d array, but it errors:

```<code>Traceback (most recent call last):
  File

C:/Users/win/PycharmProjects/allGlassStraightThroughTube/cnnTestNew.py", line 822, in <module>
plot_type = 'bar'
  File "C:\Anaconda3\lib\site-packages\shap\plots\_beeswarm.py", line 538, in summary_legacy
  max_display=max_display
  File "C:\Anaconda3\lib\site-packages\shap\plots\_beeswarm.py", line 641, in summary_legacy
  pl.scatter(shaps[nan_mask], pos + ys[nan_mask], color="#777777", vmin=vmin,
  IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
</code>```

the sentence

```<code>feature_names = sc_cnn_tube_par_X_test_3D,
</code>```

errors, could you please tell me how to write the "feature_names", how to choose feature_names from a 3d array

ContentLicense: CC BY-SA 4.0

Body:
In my program,

from keras.wrappers.scikit_learn import KerasClassifier,KerasRegressor
import shap

def CNN_pImportance():
    #1D convolutional neural network
    model = Sequential()
    model.add(Conv1D(filters=64,kernel_size=2,padding='same',activation='relu',input_shape=(5,1)))
    model.add(MaxPooling1D(pool_size=2))

    model.add(Conv1D(filters=128,kernel_size=2,padding='same',activation='relu'))
    model.add(MaxPooling1D(pool_size=2))

    model.add(Flatten())

    model.add(Dense(64))
    model.add(Activation('relu'))

    model.add(Dense(1))
    model.add(Activation('linear'))

    model.compile(loss='mean_squared_error',
               optimizer='adam',
               metrics = ['mse','mae'])

    return model

if __name__ == '__main__':
     my_model = CNN_pImportance()

     DE = shap.DeepExplainer(my_model,sc_cnn_tube_par_X_train_3D)
     shap_values = DE.shap_values(sc_cnn_tube_par_X_test_3D,check_additivity=False)
     shap.initjs()
     shap.summary_plot(
     shap_values[0],
     sc_cnn_tube_par_X_test_3D,
     feature_names = sc_cnn_tube_par_X_test_3D,
     max_display=50,
     plot_type = 'bar'
)

sc_cnn_tube_par_X_train_3D and sc_cnn_tube_par_X_test_3D are 3d array, but it errors:

Traceback (most recent call last):
  File

C:/Users/win/PycharmProjects/allGlassStraightThroughTube/cnnTestNew.py", line 822, in <module>
plot_type = 'bar'
  File "C:\Anaconda3\lib\site-packages\shap\plots\_beeswarm.py", line 538, in summary_legacy
  max_display=max_display
  File "C:\Anaconda3\lib\site-packages\shap\plots\_beeswarm.py", line 641, in summary_legacy
  pl.scatter(shaps[nan_mask], pos + ys[nan_mask], color="#777777", vmin=vmin,
  IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

the sentence

feature_names = sc_cnn_tube_par_X_test_3D,

errors, could you please tell me how to write the "feature_names", how to choose feature_names from a 3d array


问:
GraphQL file uploads and cURL: json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 188 (char 187)
I have a graphql-server that is running at localhost:3001 I want to send files to a python flask server together with some variables in a cURL request. Here is what i'm sending

curl http://localhost:3001/graphql/  -F operations='{ "query": "mutation ConvertDocToPDF($input: ConvertWordDocToPDFInputType!){ convertDocToPDF(input: $input){ success } } ", "variables": { "input" : { "file": null, "saveName": "hello" } ] } }' -F map='{ "0": ["variables.input.file"] }' -F 0=@README.md
```
<p>Surprisingly I'm getting an error which says:</p>
<pre class="lang-bash prettyprint-override"><code>json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 188 (char 187)
[11/Jan/2023 09:38:31] "POST /graphql/ HTTP/1.1" 500 107387
</code>```

What may be the problem in this request. Any help input will be appreciated

Body:
I have a graphql-server that is running at localhost:3001 I want to send files to a python flask server together with some variables in a cURL request. Here is what i'm sending

curl http://localhost:3001/graphql/  -F operations='{ "query": "mutation ConvertDocToPDF($input: ConvertWordDocToPDFInputType!){ convertDocToPDF(input: $input){ success } } ", "variables": { "input" : { "file": null, "saveName": "hello" } ] } }' -F map='{ "0": ["variables.input.file"] }' -F 0=@README.md

Surprisingly I'm getting an error which says:

json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 188 (char 187)
[11/Jan/2023 09:38:31] "POST /graphql/ HTTP/1.1" 500 107387

What may be the problem in this request. Any help input will be appreciated


问:
How to use the "ThrowTerminatingError" method in cmdlet development?
When handling errors in my cmdlet development, I encounter an unexpected behavior of the ThrowTerminatingError method.

Calling the method results in an unhandled exception of PipelineStoppedException. Thus, I do not get a formatted error in PowerShell, but a long unhandled exception error message.

My code corresponds to the following structure:

```<code>protected override async void ProcessRecord()
{
    try
    {
        var transferClient = new TransferClient(...);
        var result = await transferClient.GetAsync(); // Throws an AuthenticationException
    }
    catch (AuthenticationException exception)
    {
        var record = new ErrorRecord(exception, "TestException", ErrorCategory.AuthenticationError, null);
        ThrowTerminatingError(record); // Unhandled exception
    }
}
</code>```

System info:

Microsoft.PowerShell.SDK: 7.2.8

System.Management.Automation: 7.2.8

Target: PowerShell 7

Body:
When handling errors in my cmdlet development, I encounter an unexpected behavior of the ThrowTerminatingError method.

Calling the method results in an unhandled exception of PipelineStoppedException. Thus, I do not get a formatted error in PowerShell, but a long unhandled exception error message.

My code corresponds to the following structure:

protected override async void ProcessRecord()
{
    try
    {
        var transferClient = new TransferClient(...);
        var result = await transferClient.GetAsync(); // Throws an AuthenticationException
    }
    catch (AuthenticationException exception)
    {
        var record = new ErrorRecord(exception, "TestException", ErrorCategory.AuthenticationError, null);
        ThrowTerminatingError(record); // Unhandled exception
    }
}

System info:

Microsoft.PowerShell.SDK: 7.2.8

System.Management.Automation: 7.2.8

Target: PowerShell 7


问:
Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
I'm having a crash with high occurrence. I didn't find any trace of it. Somehow, I managed to know that after recreating an activity I fill recyclerView with my static list. Here's the crash coming from.

```<code>Choreographer.java line 911

Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
   at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
   at java.util.ArrayList.get(ArrayList.java:308)
   at android.animation.ObjectAnimator.start(ObjectAnimator.java:817)
   at android.animation.AnimatorSet$DependencyListener.startIfReady(AnimatorSet.java:799)
   at android.animation.AnimatorSet$DependencyListener.onAnimationEnd(AnimatorSet.java:753)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
   at android.animation.ValueAnimator.cancel(ValueAnimator.java:1140)
   at android.animation.ObjectAnimator.start(ObjectAnimator.java:820)
   at android.animation.AnimatorSet$DependencyListener.startIfReady(AnimatorSet.java:799)
   at android.animation.AnimatorSet$DependencyListener.onAnimationEnd(AnimatorSet.java:753)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
   at android.animation.ValueAnimator.cancel(ValueAnimator.java:1140)
   at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:974)
   at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1384)
   at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1427)
   at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:759)
   at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
   at android.view.Choreographer.doCallbacks(Choreographer.java:686)
   at android.view.Choreographer.doFrame(Choreographer.java:619)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:7409)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
</code>```

In my onViewCreated, I just call this method

```<code>private fun initRecyclerView() {
    val list = ArrayList<HomeFeature>()
    list.add(HomeFeature(id = 0, iconId = R.drawable.ic_home_collage, imageId = R.drawable.ic_home_bg_collage, title = globalActivity.resources.getString(R.string.home_title_1)))
    list.add(HomeFeature(id = 2, iconId = R.drawable.ic_home_edit, imageId = R.drawable.ic_home_bg_camera, title = globalActivity.resources.getString(R.string.home_title_3)))
    list.add(HomeFeature(id = 1, iconId = R.drawable.ic_home_camera, imageId = R.drawable.ic_home_bg_edit, title = globalActivity.resources.getString(R.string.home_title_2)))
    list.add(HomeFeature(id = 3, iconId = R.drawable.ic_home_filters, imageId = R.drawable.ic_home_bg_filters, title = globalActivity.resources.getString(R.string.home_title_4)))
    list.add(HomeFeature(id = 5, iconId = R.drawable.ic_home_settings, imageId = R.drawable.ic_home_bg_settings, title = globalActivity.resources.getString(R.string.home_title_6)))
    list.add(HomeFeature(id = 4, iconId = R.drawable.ic_home_saved, imageId = R.drawable.ic_home_bg_saved, title = globalActivity.resources.getString(R.string.home_title_5)))
    binding.incItemCollageHome.item = list[0]
    binding.incItemEditHome.item = list[1]
    binding.incItemCollageHome.itemClick = itemClick
    binding.incItemEditHome.itemClick = itemClick

    val adapter = AdapterHome(itemClick)
    binding.rvFeaturesHome.adapter = adapter
    val subList = list.subList(2, 6)
    adapter.submitList(subList)
}
</code>```

Adapter Class (DiffUtil), I'm using data binding along my list_item. So, overything is handled.

```<code>class AdapterHome(private val onItemClickListener: OnItemClickListener) : ListAdapter<HomeFeature, AdapterHome.ViewHolderHome>(diffUtilHome) {

    companion object {
        val diffUtilHome = object : DiffUtil.ItemCallback<HomeFeature>() {
            override fun areItemsTheSame(oldItem: HomeFeature, newItem: HomeFeature): Boolean {
                return oldItem.id == newItem.id
            }

            override fun areContentsTheSame(oldItem: HomeFeature, newItem: HomeFeature): Boolean {
                return oldItem == newItem
            }
        }
    }

    inner class ViewHolderHome(val binding: ListItemHomeBinding) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolderHome {
        val layoutInflater = LayoutInflater.from(parent.context)
        val binding = DataBindingUtil.inflate<ListItemHomeBinding>(layoutInflater, R.layout.list_item_home, parent, false)
        return ViewHolderHome(binding)
    }

    override fun onBindViewHolder(holder: ViewHolderHome, position: Int) {
        val homeFeature = getItem(position)
        holder.binding.apply {
            item = homeFeature
            itemClick = onItemClickListener
        }
    }
}
</code>```

Body:
I'm having a crash with high occurrence. I didn't find any trace of it. Somehow, I managed to know that after recreating an activity I fill recyclerView with my static list. Here's the crash coming from.

Choreographer.java line 911

Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
   at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
   at java.util.ArrayList.get(ArrayList.java:308)
   at android.animation.ObjectAnimator.start(ObjectAnimator.java:817)
   at android.animation.AnimatorSet$DependencyListener.startIfReady(AnimatorSet.java:799)
   at android.animation.AnimatorSet$DependencyListener.onAnimationEnd(AnimatorSet.java:753)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
   at android.animation.ValueAnimator.cancel(ValueAnimator.java:1140)
   at android.animation.ObjectAnimator.start(ObjectAnimator.java:820)
   at android.animation.AnimatorSet$DependencyListener.startIfReady(AnimatorSet.java:799)
   at android.animation.AnimatorSet$DependencyListener.onAnimationEnd(AnimatorSet.java:753)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
   at android.animation.ValueAnimator.cancel(ValueAnimator.java:1140)
   at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:974)
   at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1384)
   at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1427)
   at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:759)
   at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
   at android.view.Choreographer.doCallbacks(Choreographer.java:686)
   at android.view.Choreographer.doFrame(Choreographer.java:619)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:7409)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

In my onViewCreated, I just call this method

private fun initRecyclerView() {
    val list = ArrayList<HomeFeature>()
    list.add(HomeFeature(id = 0, iconId = R.drawable.ic_home_collage, imageId = R.drawable.ic_home_bg_collage, title = globalActivity.resources.getString(R.string.home_title_1)))
    list.add(HomeFeature(id = 2, iconId = R.drawable.ic_home_edit, imageId = R.drawable.ic_home_bg_camera, title = globalActivity.resources.getString(R.string.home_title_3)))
    list.add(HomeFeature(id = 1, iconId = R.drawable.ic_home_camera, imageId = R.drawable.ic_home_bg_edit, title = globalActivity.resources.getString(R.string.home_title_2)))
    list.add(HomeFeature(id = 3, iconId = R.drawable.ic_home_filters, imageId = R.drawable.ic_home_bg_filters, title = globalActivity.resources.getString(R.string.home_title_4)))
    list.add(HomeFeature(id = 5, iconId = R.drawable.ic_home_settings, imageId = R.drawable.ic_home_bg_settings, title = globalActivity.resources.getString(R.string.home_title_6)))
    list.add(HomeFeature(id = 4, iconId = R.drawable.ic_home_saved, imageId = R.drawable.ic_home_bg_saved, title = globalActivity.resources.getString(R.string.home_title_5)))
    binding.incItemCollageHome.item = list[0]
    binding.incItemEditHome.item = list[1]
    binding.incItemCollageHome.itemClick = itemClick
    binding.incItemEditHome.itemClick = itemClick

    val adapter = AdapterHome(itemClick)
    binding.rvFeaturesHome.adapter = adapter
    val subList = list.subList(2, 6)
    adapter.submitList(subList)
}

Adapter Class (DiffUtil), I'm using data binding along my list_item. So, overything is handled.

class AdapterHome(private val onItemClickListener: OnItemClickListener) : ListAdapter<HomeFeature, AdapterHome.ViewHolderHome>(diffUtilHome) {

    companion object {
        val diffUtilHome = object : DiffUtil.ItemCallback<HomeFeature>() {
            override fun areItemsTheSame(oldItem: HomeFeature, newItem: HomeFeature): Boolean {
                return oldItem.id == newItem.id
            }

            override fun areContentsTheSame(oldItem: HomeFeature, newItem: HomeFeature): Boolean {
                return oldItem == newItem
            }
        }
    }

    inner class ViewHolderHome(val binding: ListItemHomeBinding) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolderHome {
        val layoutInflater = LayoutInflater.from(parent.context)
        val binding = DataBindingUtil.inflate<ListItemHomeBinding>(layoutInflater, R.layout.list_item_home, parent, false)
        return ViewHolderHome(binding)
    }

    override fun onBindViewHolder(holder: ViewHolderHome, position: Int) {
        val homeFeature = getItem(position)
        holder.binding.apply {
            item = homeFeature
            itemClick = onItemClickListener
        }
    }
}


问:
How get token from headers to test my controller by mocking the service class
```<code>public class AdditionDto
{
    public int HttpCode {get; set:}
    public string UserName {get; set:}
    public int Total {get; set:}
}

public interface IAddtionService
{
    AdditionDto AddingTwoNumbers(int input1, int input2, string userName);
}

public class AdditionService : IAdditionService
{
    public AdditionDto AddingTwoNumbers(int input1, int input2, string userName)
    {
        AdditionDto addDto = new AdditionDto()
        {
             httpCode = 200,
             UserName = userName,
             Total = input1 + input2
        }
        return addDto;
    }
}
</code>```

With a controller like this:

```<code>public class AdditionController : ControllerBase
{
    private readonly IAddtionService _additionService;
    public AdditionController(IAddtionService additionService)
    {
         _additionService = additionService;
    }

    [HttpGet]
    [Authorize(Roles = "Admin")]
    [Route("AddtionOfTwoNumbers")]
    public IActionResult AddTwoNumbers(int input1, int input2)
    {
        if (ModelState.IsValid)
        {
            var token = HttpContext.Request.Headers["Authorization"].ToString();
            var tokenbearer = token.Split(' ');
            var handler = new JwtSecurityTokenHandler();
            var decodedtoken = handler.ReadJwtToken(tokenbearer[1]);
            string user = decodedtoken.Claims.Where(x => x.Type ==         "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name").FirstOrDefault().ToString();
            var usr = user.Split(":");
            string userName = usr[2].Trim();

            var result = _additionService.AddingTwoNumbers(input1, input2,userName);

            if (result.Httpcode == 200)
                return Ok(result);
            else
                 return StatusCode(500, result);
         }
         else
            return BadRequest();
      }
}
</code>```

When i am trying to conduct xunit test on this api I am getting null at header level.
also I need to mock service method that is also not happening. mostly it is showing null exception even I have passed token in the headers also then I am facing mocking issue at the service method level. could you please help me to mock my service method to test that api through xunit framework....

Body:
public class AdditionDto
{
    public int HttpCode {get; set:}
    public string UserName {get; set:}
    public int Total {get; set:}
}

public interface IAddtionService
{
    AdditionDto AddingTwoNumbers(int input1, int input2, string userName);
}

public class AdditionService : IAdditionService
{
    public AdditionDto AddingTwoNumbers(int input1, int input2, string userName)
    {
        AdditionDto addDto = new AdditionDto()
        {
             httpCode = 200,
             UserName = userName,
             Total = input1 + input2
        }
        return addDto;
    }
}

With a controller like this:

public class AdditionController : ControllerBase
{
    private readonly IAddtionService _additionService;
    public AdditionController(IAddtionService additionService)
    {
         _additionService = additionService;
    }

    [HttpGet]
    [Authorize(Roles = "Admin")]
    [Route("AddtionOfTwoNumbers")]
    public IActionResult AddTwoNumbers(int input1, int input2)
    {
        if (ModelState.IsValid)
        {
            var token = HttpContext.Request.Headers["Authorization"].ToString();
            var tokenbearer = token.Split(' ');
            var handler = new JwtSecurityTokenHandler();
            var decodedtoken = handler.ReadJwtToken(tokenbearer[1]);
            string user = decodedtoken.Claims.Where(x => x.Type ==         "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name").FirstOrDefault().ToString();
            var usr = user.Split(":");
            string userName = usr[2].Trim();

            var result = _additionService.AddingTwoNumbers(input1, input2,userName);

            if (result.Httpcode == 200)
                return Ok(result);
            else
                 return StatusCode(500, result);
         }
         else
            return BadRequest();
      }
}

When i am trying to conduct xunit test on this api I am getting null at header level.
also I need to mock service method that is also not happening. mostly it is showing null exception even I have passed token in the headers also then I am facing mocking issue at the service method level. could you please help me to mock my service method to test that api through xunit framework....


问:
Responsive img css with a twist
I'm trying to get an image (img) to fill all available space inside a div BUT also I want the img itself to be inside an equaly sized container with position:relative so that I can place markers on the image with absolute position.

I have tried using div background-image and that works perfect except that my markers positions are out of place (of course) since the parent div is not the same size.

And with  I get the markers to work perfect but then the image doesn't scale with parent container.

I need the image to behave like background-image but I also need the parent container to be same size.

Here I have 2 pens showing what I mean.
First one with background-image. pen:background-image

```<code>body {    height: 90vh;
    background: aliceblue;}
.page-inner {
    aspect-ratio: 16 / 9;
    position: relative;
    padding: 1em 1em 0 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
  height:100%;
  border: 1px solid black
}

.main-container {
      width: 100%;
    flex: 1;
    padding: 2em 1em 2em 1em;
  background:yellow;

}

.working-area {
  position:relative;
}

.work-item {
  position:absolute;
  top:10%;
  left:10%;
  background:white;
  outline: 2px solid black;
}
    <div class="page-inner">
        <h3 class="" >Some text</h3>
            <div class="main-container">
                <div class="working-area" style="height:100%;width:100%;background-position: center;background-image:url('');background-size: contain;background-repeat: no-repeat">
                   <div class="work-item">X</div>
                </div>
            </div>
        <div>
            <h3 class="" >Some text again</h3>
        </div>
    </div>
</code>```

Second one with img: pen:img

```<code>body {    height: 90vh;
    background: aliceblue;}
.page-inner {
    aspect-ratio: 16 / 9;
    position: relative;
    padding: 1em 1em 0 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
  height:100%;
  border: 1px solid black
}

.main-container {
      width: 100%;
    flex: 1;
    padding: 2em 1em 2em 1em;
  background:yellow;

}

.main-container img {
  width: 100%;
    height: auto;
}

.working-area {
  position:relative;
}

.work-item {
  position:absolute;
  top:10%;
  left:10%;
  background:white;
  outline: 2px solid black;
}

<div class="page-inner">
        <h3 class="" >Some text</h3>
        <div class="main-container">
            <div class="working-area">
                <img src="" style="" />
                <div class="work-item">X</div>
            </div>
        </div>
        <div>
            <h3 class="" >Some text again</h3>
        </div>
    </div>
</code>```

I want to combine these 2 into one :-) I need full scaling of image at the same time as I need to get image size and position relative so I can place my markers.

The image can be in any size and the screen can be resized at any time, so I need a solution that really is responsive.

thanks!

I have tried width:100%;height:auto; nad like 200 other different things. I have also started to calculate the image aspect-ratio and have a hidden img and then manually, with js, calculate each marker pos in %  based on parent div size.

The solution needs to work with all img sizes and aspect ratios. Users uploads image so I don't know what sizes will come.

I have also tried to position the image with full width and height and then used transform: scale to make it fit the parent div with lots of calculations in js.

But there has to be an easier way :-)

Title: Responsive img css with a twist

Body:
I'm trying to get an image (img) to fill all available space inside a div BUT also I want the img itself to be inside an equaly sized container with position:relative so that I can place markers on the image with absolute position.

I have tried using div background-image and that works perfect except that my markers positions are out of place (of course) since the parent div is not the same size.

And with  I get the markers to work perfect but then the image doesn't scale with parent container.

I need the image to behave like background-image but I also need the parent container to be same size.

Here I have 2 pens showing what I mean.
First one with background-image. pen:background-image

body {    height: 90vh;
    background: aliceblue;}
.page-inner {
    aspect-ratio: 16 / 9;
    position: relative;
    padding: 1em 1em 0 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
  height:100%;
  border: 1px solid black
}

.main-container {
      width: 100%;
    flex: 1;
    padding: 2em 1em 2em 1em;
  background:yellow;

}

.working-area {
  position:relative;
}

.work-item {
  position:absolute;
  top:10%;
  left:10%;
  background:white;
  outline: 2px solid black;
}

Some text

X

Some text again

Second one with img: pen:img

body {    height: 90vh;
    background: aliceblue;}
.page-inner {
    aspect-ratio: 16 / 9;
    position: relative;
    padding: 1em 1em 0 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
  height:100%;
  border: 1px solid black
}

.main-container {
      width: 100%;
    flex: 1;
    padding: 2em 1em 2em 1em;
  background:yellow;

}

.main-container img {
  width: 100%;
    height: auto;
}

.working-area {
  position:relative;
}

.work-item {
  position:absolute;
  top:10%;
  left:10%;
  background:white;
  outline: 2px solid black;
}

Some text

X

Some text again

I want to combine these 2 into one :-) I need full scaling of image at the same time as I need to get image size and position relative so I can place my markers.

The image can be in any size and the screen can be resized at any time, so I need a solution that really is responsive.

thanks!

I have tried width:100%;height:auto; nad like 200 other different things. I have also started to calculate the image aspect-ratio and have a hidden img and then manually, with js, calculate each marker pos in %  based on parent div size.

The solution needs to work with all img sizes and aspect ratios. Users uploads image so I don't know what sizes will come.

I have also tried to position the image with full width and height and then used transform: scale to make it fit the parent div with lots of calculations in js.

But there has to be an easier way :-)


问:
android okHttp no route to host exception why?
I am trying to call http url using okHttp library using the code below:

```<code>    OkHttpClient client = new OkHttpClient();

    Request.Builder builder = new Request.Builder();
    builder.url(url);
    Request request = builder.build();

    try {
        Response response = client.newCall(request).execute();
        return response.body().string();
    } catch (Exception e) {
        e.printStackTrace();

        return e+"";
    }
</code>```

The problem is the url is opened well and return data from browser of device, but when i try to call this function and passing the same url it return

```<code>java.net.NoRouteToHostException: No route to host
</code>```

Body:
I am trying to call http url using okHttp library using the code below:

    OkHttpClient client = new OkHttpClient();

    Request.Builder builder = new Request.Builder();
    builder.url(url);
    Request request = builder.build();

    try {
        Response response = client.newCall(request).execute();
        return response.body().string();
    } catch (Exception e) {
        e.printStackTrace();

        return e+"";
    }

The problem is the url is opened well and return data from browser of device, but when i try to call this function and passing the same url it return

java.net.NoRouteToHostException: No route to host


问:
Why is it valid to have a reference of the result of string adding if c++17?
In c++17, it is valid like

```<code>string s = "asd";
string &ss = "asd" + s;  --> here
</code>```

Now I have two doubts:
1.Why reference of ss is valid? What is it reference to? An anonymous variable of the result of
"asd" + s?But is it valid to reference to an anonymous variable?
2.Why "asd" could directly add s?Wouldn't write it as string("asd") + s like before?Why?

Body:
In c++17, it is valid like

string s = "asd";
string &ss = "asd" + s;  --> here

Now I have two doubts:
1.Why reference of ss is valid? What is it reference to? An anonymous variable of the result of
"asd" + s?But is it valid to reference to an anonymous variable?
2.Why "asd" could directly add s?Wouldn't write it as string("asd") + s like before?Why?


问:
When using esbuild with external react I get Dynamic require of “react” is not supported
cross post from github

I have two UI components library. One of them (@ikas/components) library does not have any issue but the other (same config) throw this error. Can anyone have any idea?

When i comment inhouse-components it is work. but when i open it it crash... any idea?

I try to external,
Also try add import React from "react" to tsx files. but there error is still there.
I am expecting the @ikas/inhouse-components is should also work as well as @ikas/components

I also control the dist (output folder) .d.ts and show React import different but I don't know if it's relevant


问:
CKeditor not working while we changing the font size in some cases
Ckeditor stopped working when we changed the font size of different fonts, when we have text document of more than 20 pages. it is working fine with 1-2 pages of text document.

Need help to resolve this query.


问:
I have an issue with converting numbers to words
so i'm having an issue with the decimal part where the number that you input in the console is for example 0,02 and it gives in words only 2 out of the 3 characters (skips the second 0) i tried many solutions including just doing an if() where i have a double mn = 0.9 but i found out that the if works only to 0 it accepts the variable that i made but its seems like it doesnt understands it. If you have any idea how i can fix this glad to hear

P.S I've attached the whole code on the other paragraph. Thank you!

what i want to happen Input 0,02 ---> output zero point zero two
what is happening Input - 0,02 ----> output zero point 2

```<code>    static void Main(string[] args)
    {

        Console.OutputEncoding = System.Text.Encoding.Unicode;
        // OT VIKTOR BOTKOV 304sr
        try
        {
            Console.WriteLine("Въведете число.....:");
            string number = Console.ReadLine();
            number = ConvertAmount(double.Parse(number));
            Console.WriteLine("Числото изписано в думи е : \n{0}", number);
            Console.ReadKey();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
    private static String[] units = { "нула", "едно", "две", "три",
    "четири", "пет", "шест", "седем", "осем", "девет", "десет", "единайсет",
    "дванайсет", "тринайсет", "четиринайсет", "петнайсет", "шеснайсет",
    "седемнайсет", "осемнайсет", "деветнайсет" };
    private static String[] tens = { "", "", "двайсет", "трийсет", "четиресет",
    "педесет", "шейсет", "седемдесет", "осемдесет", "деведесет" };
    private static String[] hundreds = {"","сто", "двеста", "триста","четиристотин",
    "петстотин", "шестстотин", "седемстотин", "осемстотин", "деветстотин" };
    private static String[] thousands = {"","хиляда","две хиялди", "три хиляди","четири хиляди",
    "пет хиляди", "шест хиляди", "седем хиляди", "осем хиляди", "девет хиляди" };
    private static String[] unitsс = { "нула ", "един", "два", };

    public static String ConvertAmount(double amount)
    {
        try
        {
            double mn = 0.09;
            Int64 amount_int = (Int64)amount;
            Int64 amount_dec = (Int64)Math.Round((Decimal)(amount - (double)(amount_int)) * 100);
            if (amount_dec == 0)
            {
                return Convert(amount_int) + " лв.";
            }
            else if (amount_int <= mn)
            {
                return Convert(amount_int) + " Цяло и " + " Нула " + Convert(amount_dec) + " ст.";
            }
            else
            {
                return Convert(amount_int) + " лв. и " + Convert(amount_dec) + " ст.";
            }
        }
        catch (Exception e)
        {

        }
        return "";

    }

    public static String Convert(Int64 i)
    {
    Console.OutputEncoding = System.Text.Encoding.Unicode;

        if (i<=2)
        {
            return unitsс[i];

        }
        if (i < 20)
        {
            return units[i];
        }
        if (i < 100)
        {
            return tens[i / 10] + ((i % 10 > 0) ? " и " + Convert(i % 10) : "");
        }
        if (i < 1000)
        {
            return hundreds[i / 100] + ((i % 100 > 0) ? " и " + Convert(i % 100) : "");
        }
        if (i < 100000)
        {
            return Convert(i / 1000) + " Хиляди "
                        + ((i % 1000 > 0) ? "  " + Convert(i % 1000) : "");
        }
        else if (i < 1000000)
        {
            return Convert(i / 10000) + " Хиляди "
                    + ((i % 10000 > 0) ? " и " + Convert(i % 10000) : "");
        }
        if (i < 10000000)
        {
            return Convert(i / 1000000) + " Милиона "
                    + ((i % 1000000 > 0) ? " " + Convert(i % 1000000) : "");
        }
        if (i < 100000000)
        {
            return Convert(i / 1000000) + " Милиона "
                    + ((i % 1000000 > 0) ? " и " + Convert(i % 1000000) : "");
        }
        if (i < 1000000000)
        {
            return Convert(i / 1000000) + " Милиона "
                    + ((i % 1000000 > 0) ? "  " + Convert(i % 1000000) : "");
        }
        if (i < 10000000000)
        {
            return Convert(i / 1000000000) + " Милиaрда "
                    + ((i % 1000000000 > 0) ? "  " + Convert(i % 1000000000) : "");
        }
        return Convert(i / 1000000000000) + "  "
                    + ((i % 1000000000000 > 0) ? " " + Convert(i % 10000000000000) : "");

    }
}

</code>```

Body:
so i'm having an issue with the decimal part where the number that you input in the console is for example 0,02 and it gives in words only 2 out of the 3 characters (skips the second 0) i tried many solutions including just doing an if() where i have a double mn = 0.9 but i found out that the if works only to 0 it accepts the variable that i made but its seems like it doesnt understands it. If you have any idea how i can fix this glad to hear

P.S I've attached the whole code on the other paragraph. Thank you!

what i want to happen Input 0,02 ---> output zero point zero two
what is happening Input - 0,02 ----> output zero point 2

    static void Main(string[] args)
    {

        Console.OutputEncoding = System.Text.Encoding.Unicode;
        // OT VIKTOR BOTKOV 304sr
        try
        {
            Console.WriteLine("Въведете число.....:");
            string number = Console.ReadLine();
            number = ConvertAmount(double.Parse(number));
            Console.WriteLine("Числото изписано в думи е : \n{0}", number);
            Console.ReadKey();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
    private static String[] units = { "нула", "едно", "две", "три",
    "четири", "пет", "шест", "седем", "осем", "девет", "десет", "единайсет",
    "дванайсет", "тринайсет", "четиринайсет", "петнайсет", "шеснайсет",
    "седемнайсет", "осемнайсет", "деветнайсет" };
    private static String[] tens = { "", "", "двайсет", "трийсет", "четиресет",
    "педесет", "шейсет", "седемдесет", "осемдесет", "деведесет" };
    private static String[] hundreds = {"","сто", "двеста", "триста","четиристотин",
    "петстотин", "шестстотин", "седемстотин", "осемстотин", "деветстотин" };
    private static String[] thousands = {"","хиляда","две хиялди", "три хиляди","четири хиляди",
    "пет хиляди", "шест хиляди", "седем хиляди", "осем хиляди", "девет хиляди" };
    private static String[] unitsс = { "нула ", "един", "два", };

    public static String ConvertAmount(double amount)
    {
        try
        {
            double mn = 0.09;
            Int64 amount_int = (Int64)amount;
            Int64 amount_dec = (Int64)Math.Round((Decimal)(amount - (double)(amount_int)) * 100);
            if (amount_dec == 0)
            {
                return Convert(amount_int) + " лв.";
            }
            else if (amount_int <= mn)
            {
                return Convert(amount_int) + " Цяло и " + " Нула " + Convert(amount_dec) + " ст.";
            }
            else
            {
                return Convert(amount_int) + " лв. и " + Convert(amount_dec) + " ст.";
            }
        }
        catch (Exception e)
        {

        }
        return "";

    }

    public static String Convert(Int64 i)
    {
    Console.OutputEncoding = System.Text.Encoding.Unicode;

        if (i<=2)
        {
            return unitsс[i];

        }
        if (i < 20)
        {
            return units[i];
        }
        if (i < 100)
        {
            return tens[i / 10] + ((i % 10 > 0) ? " и " + Convert(i % 10) : "");
        }
        if (i < 1000)
        {
            return hundreds[i / 100] + ((i % 100 > 0) ? " и " + Convert(i % 100) : "");
        }
        if (i < 100000)
        {
            return Convert(i / 1000) + " Хиляди "
                        + ((i % 1000 > 0) ? "  " + Convert(i % 1000) : "");
        }
        else if (i < 1000000)
        {
            return Convert(i / 10000) + " Хиляди "
                    + ((i % 10000 > 0) ? " и " + Convert(i % 10000) : "");
        }
        if (i < 10000000)
        {
            return Convert(i / 1000000) + " Милиона "
                    + ((i % 1000000 > 0) ? " " + Convert(i % 1000000) : "");
        }
        if (i < 100000000)
        {
            return Convert(i / 1000000) + " Милиона "
                    + ((i % 1000000 > 0) ? " и " + Convert(i % 1000000) : "");
        }
        if (i < 1000000000)
        {
            return Convert(i / 1000000) + " Милиона "
                    + ((i % 1000000 > 0) ? "  " + Convert(i % 1000000) : "");
        }
        if (i < 10000000000)
        {
            return Convert(i / 1000000000) + " Милиaрда "
                    + ((i % 1000000000 > 0) ? "  " + Convert(i % 1000000000) : "");
        }
        return Convert(i / 1000000000000) + "  "
                    + ((i % 1000000000000 > 0) ? " " + Convert(i % 10000000000000) : "");

    }
}


问:
Is it possible to set cursor position from within OpenCV mouse events?
Is it possible to set/update the cursor coordinates from within OpenCV mouse events? I have a virtual keyboard and I am trying to make it such that whenever the cursor hovers over a button, it is locked at the mid-point of the button.

My current mouse callback function:

```<code>def on_mouse(self, event, x, y, flags, param):
        global x1, y1
        if event == cv2.EVENT_MOUSEMOVE:
            x1, y1 = x, y
            for button in self.button_list:
                if button.is_hovered_over(x1, y1):
                    # set the cursor coordinates here
</code>```

The main function:

```<code>import cv2
cap = cv2.VideoCapture(0)

from pynput.mouse import Button, Controller
mouse = Controller()

from keyboards import QWERTYKeyboard
keyboard = QWERTYKeyboard.QWERTYKeyboard()

cv2.namedWindow("Image", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("Image", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
cv2.setMouseCallback("Image", keyboard.on_mouse)

while cap.isOpened():
    success, image = cap.read()
    .
    .
    .
    pred_x, pred_y = model.predict(ave_x, ave_y)

    cv2.circle(image, (ave_x, ave_y), 1, (255, 0, 0), 5)

    mouse.position = (pred_x, pred_y)

    cv2.imshow("Image", image)

    if cv2.waitKey(1) & 0xFF == 27:
      break

  cv2.destroyAllWindows()

cap.release()
</code>```

Body:
Is it possible to set/update the cursor coordinates from within OpenCV mouse events? I have a virtual keyboard and I am trying to make it such that whenever the cursor hovers over a button, it is locked at the mid-point of the button.

My current mouse callback function:

def on_mouse(self, event, x, y, flags, param):
        global x1, y1
        if event == cv2.EVENT_MOUSEMOVE:
            x1, y1 = x, y
            for button in self.button_list:
                if button.is_hovered_over(x1, y1):
                    # set the cursor coordinates here

The main function:

import cv2
cap = cv2.VideoCapture(0)

from pynput.mouse import Button, Controller
mouse = Controller()

from keyboards import QWERTYKeyboard
keyboard = QWERTYKeyboard.QWERTYKeyboard()

cv2.namedWindow("Image", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("Image", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
cv2.setMouseCallback("Image", keyboard.on_mouse)

while cap.isOpened():
    success, image = cap.read()
    .
    .
    .
    pred_x, pred_y = model.predict(ave_x, ave_y)

    cv2.circle(image, (ave_x, ave_y), 1, (255, 0, 0), 5)

    mouse.position = (pred_x, pred_y)

    cv2.imshow("Image", image)

    if cv2.waitKey(1) & 0xFF == 27:
      break

  cv2.destroyAllWindows()

cap.release()


问:
Octopus deploy error "The jq application must be installed"
I am trying to deploy an application in EKS using octopus deploy, octopus server is deployed in the same cluster. I’ve deployed octopus server using helm charts.

Now, after configuring the environment, deployment target, project & release. I'm trying to deploy the application in the cluster and that’s when I got the jq and kubectl error.

kubectl and jq are already installed in the cluster node on which octopus pod is running but it seems like octopus is not able to use them because it shows the same error “The jq application must be installed” even though jq is installed in the cluster node.

Now, when I install these tools in the octopus server pod itself, then I’m getting no error but this is a issue because let’s say, if the pod restarts or goes down then I’m gonna have to install those tools again in the pod every time the pod restarts or goes down and this becomes too much of a manual process.

Is there any way to resolve this issue?

Thanks


问:
PCL addpointcloud interface in debug mode normal operation release mode error
I am a newbie in point cloud library and currently I have a problem like the title.I've been debugging in debug mode before, but now I need to release so I'm debugging in release mode for the first time.When I get an error when I load the point cloud using the code below

```<code>viewer->removeAllPointClouds();
 viewer->removeAllShapes();
 viewer->addPointCloud<pcl::PointXYZRGB>(temcloud_ptr,"point cloud");
 viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
 viewer->resetCamera();
</code>```

In viewer->addpointcloud<pcl::PointXYZRGB>(temcloud_ptr,"point cloud");this code,will occur this error :An exception was raised: a read access permission conflict.this is 0xFFFFFFFFFFFFFFDF. and stop here code from xstring screen .

```<code>_CONSTEXPR20_CONTAINER bool _Large_string_engaged() const noexcept {
#ifdef __cpp_lib_constexpr_string
        if (_STD is_constant_evaluated()) {
            return true;
        }
#endif // __cpp_lib_constexpr_string
        return _BUF_SIZE <= _Myres;
</code>```

Here's my code

```<code>MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);

    auto renderer = vtkSmartPointer<vtkRenderer>::New();
    auto renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
    renderWindow->AddRenderer(renderer);
    viewer.reset(new pcl::visualization::PCLVisualizer(renderer,
        renderWindow,
        "viewer",
        false));
    ui.qvtkwidget->setRenderWindow(viewer->getRenderWindow());
    viewer->setupInteractor(ui.qvtkwidget->interactor(),
        ui.qvtkwidget->renderWindow());
    viewer->setBackgroundColor(0.8941176, 1, 0.9137254);
    cloud_ptr.reset(new pcl::PointCloud<PointXYZRGBI>);
    cloudrgb_ptr.reset(new pcl::PointCloud<pcl::PointXYZRGB>);
    cloudi_ptr.reset(new pcl::PointCloud<pcl::PointXYZI>);

}

void MainWindow::openFile()
{
    QString FileName = QFileDialog::getOpenFileName(this,
        tr("Open Resource"),
        ".",
        tr("File1(*.las);;File2(*.txt);;File3(*.pcd);;File4(*.ply);;File5(*.obj)"));
    if (FileName.isEmpty())
        return;

    const std::string sstr = FileName.toLocal8Bit();
    if (FileName != "")
    {
        Openfile of;
        if (FileName.endsWith("las"))
        {

            const char* cc_FileName = sstr.c_str();

            std::ifstream ifs;
            ifs.open(cc_FileName, std::ios::in | std::ios::binary);
            liblas::ReaderFactory f;

            liblas::Reader reader = f.CreateWithStream(ifs);

            liblas::Header const& header = reader.GetHeader();
            int pointsNum = header.GetPointRecordsCount();

            cloudrgb_ptr->width = pointsNum;
            cloudrgb_ptr->height = 1;
            cloudrgb_ptr->resize(pointsNum);

            for (int i = 0; i < pointsNum; ++i)
            {
                reader.ReadNextPoint();
                const liblas::Point& p = reader.GetPoint();

                float px = (float)p.GetX();
                float py = (float)p.GetY();
                float pz = (float)p.GetZ();
                float pi = (float)p.GetIntensity();

                uint16_t pr = p.GetColor().GetRed();
                uint16_t pg = p.GetColor().GetGreen();
                uint16_t pb = p.GetColor().GetBlue();
                int r2 = ceil(((float)pr / 65536) * (float)256);
                int g2 = ceil(((float)pg / 65536) * (float)256);
                int b2 = ceil(((float)pb / 65536) * (float)256);
                uint32_t prgb = ((int)r2) << 16 | ((int)g2) << 8 | ((int)b2);
                cloudrgb_ptr->points[i].rgb = *reinterpret_cast<float*>(&prgb);

                (*cloudrgb_ptr)[i].x = px;
                (*cloudrgb_ptr)[i].y = py;
                (*cloudrgb_ptr)[i].z = pz;

            }

            ifs.close();
        }

    viewer->removeAllPointClouds();
    viewer->removeAllShapes();
    viewer->addPointCloud<pcl::PointXYZRGB>(cloudrgb_ptr,"point cloud");
    viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
    viewer->resetCamera();

    ui.qvtkwidget->update();
}
</code>```

At first I thought the string was not properly initialized so I tried to change the second parameters of addpointcloud such as
const std::string ptcd{ "point cloud" }; const char* arr = "point cloud";
but there is no effect.

Body:
I am a newbie in point cloud library and currently I have a problem like the title.I've been debugging in debug mode before, but now I need to release so I'm debugging in release mode for the first time.When I get an error when I load the point cloud using the code below

viewer->removeAllPointClouds();
 viewer->removeAllShapes();
 viewer->addPointCloud<pcl::PointXYZRGB>(temcloud_ptr,"point cloud");
 viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
 viewer->resetCamera();

In viewer->addpointcloud<pcl::PointXYZRGB>(temcloud_ptr,"point cloud");this code,will occur this error :An exception was raised: a read access permission conflict.this is 0xFFFFFFFFFFFFFFDF. and stop here code from xstring screen .

_CONSTEXPR20_CONTAINER bool _Large_string_engaged() const noexcept {
#ifdef __cpp_lib_constexpr_string
        if (_STD is_constant_evaluated()) {
            return true;
        }
#endif // __cpp_lib_constexpr_string
        return _BUF_SIZE <= _Myres;

Here's my code

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);

    auto renderer = vtkSmartPointer<vtkRenderer>::New();
    auto renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
    renderWindow->AddRenderer(renderer);
    viewer.reset(new pcl::visualization::PCLVisualizer(renderer,
        renderWindow,
        "viewer",
        false));
    ui.qvtkwidget->setRenderWindow(viewer->getRenderWindow());
    viewer->setupInteractor(ui.qvtkwidget->interactor(),
        ui.qvtkwidget->renderWindow());
    viewer->setBackgroundColor(0.8941176, 1, 0.9137254);
    cloud_ptr.reset(new pcl::PointCloud<PointXYZRGBI>);
    cloudrgb_ptr.reset(new pcl::PointCloud<pcl::PointXYZRGB>);
    cloudi_ptr.reset(new pcl::PointCloud<pcl::PointXYZI>);

}

void MainWindow::openFile()
{
    QString FileName = QFileDialog::getOpenFileName(this,
        tr("Open Resource"),
        ".",
        tr("File1(*.las);;File2(*.txt);;File3(*.pcd);;File4(*.ply);;File5(*.obj)"));
    if (FileName.isEmpty())
        return;

    const std::string sstr = FileName.toLocal8Bit();
    if (FileName != "")
    {
        Openfile of;
        if (FileName.endsWith("las"))
        {

            const char* cc_FileName = sstr.c_str();

            std::ifstream ifs;
            ifs.open(cc_FileName, std::ios::in | std::ios::binary);
            liblas::ReaderFactory f;

            liblas::Reader reader = f.CreateWithStream(ifs);

            liblas::Header const& header = reader.GetHeader();
            int pointsNum = header.GetPointRecordsCount();

            cloudrgb_ptr->width = pointsNum;
            cloudrgb_ptr->height = 1;
            cloudrgb_ptr->resize(pointsNum);

            for (int i = 0; i < pointsNum; ++i)
            {
                reader.ReadNextPoint();
                const liblas::Point& p = reader.GetPoint();

                float px = (float)p.GetX();
                float py = (float)p.GetY();
                float pz = (float)p.GetZ();
                float pi = (float)p.GetIntensity();

                uint16_t pr = p.GetColor().GetRed();
                uint16_t pg = p.GetColor().GetGreen();
                uint16_t pb = p.GetColor().GetBlue();
                int r2 = ceil(((float)pr / 65536) * (float)256);
                int g2 = ceil(((float)pg / 65536) * (float)256);
                int b2 = ceil(((float)pb / 65536) * (float)256);
                uint32_t prgb = ((int)r2) << 16 | ((int)g2) << 8 | ((int)b2);
                cloudrgb_ptr->points[i].rgb = *reinterpret_cast<float*>(&prgb);

                (*cloudrgb_ptr)[i].x = px;
                (*cloudrgb_ptr)[i].y = py;
                (*cloudrgb_ptr)[i].z = pz;

            }

            ifs.close();
        }

    viewer->removeAllPointClouds();
    viewer->removeAllShapes();
    viewer->addPointCloud<pcl::PointXYZRGB>(cloudrgb_ptr,"point cloud");
    viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
    viewer->resetCamera();

    ui.qvtkwidget->update();
}

At first I thought the string was not properly initialized so I tried to change the second parameters of addpointcloud such as
const std::string ptcd{ "point cloud" }; const char* arr = "point cloud";
but there is no effect.


问:
How to insert multiple checkbox values into firebase using vue js
I've a form that contains a textarea and a table with a list of many members (from a collection named Members). Each table's  contain two checboxes: one to mark the presence of the member and the second one to mark his payment. After clicking on the submit button I'd like to have in my firebase database something like this:

Meeting collection:
associationId,
textareaValue,
createdAd

Presence collection:
memberId,
meetingId,
present: true or false,
createAt

Payment collection:
memberId,
meetingId,
payment: true or false,
createAt

```<code><form @submit.prevent="handleSubmitNewMeeting">
                                <!-- step one -->
                                <div class="card" v-if="showFormPart1">
                                    <div class="card-header">
                                        <h4>Entrer le sujet principal de la réunion</h4>
                                    </div>
                                    <div class="card-body">
                                        <div class="form-group">
                                            <textarea class="form-control" v-model="subjects" required rows="3"></textarea>
                                        </div>

                                        <p></p>

                                        <div class="row">
                                            <div class="col-sm-6">
                                                <button @click="showForm=false" class="btn btn-danger" style="width: 100%">
                                                    Annuler
                                                </button>
                                            </div>
                                            <div class="col-sm-6">
                                                <button
                                                    type="button" class="btn btn-outline-secondary" @click="showFormPart2=true;
                                                    showFormPart1=false;">
                                                    Suivant
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <p></p>

                                <!-- step two -->
                                <div class="card" v-if="showFormPart2">

                                    <div v-if="members">
                                        <div class="card-header">
                                            <h4>Cocher les présences et payements</h4>
                                        </div>
                                        <div class="card-block p-0">
                                            <table class="table table-bordered">
                                                <thead class="">
                                                    <tr align="center">
                                                        <th scope="col">Nom</th>
                                                        <th scope="col">Prénom</th>
                                                        <th scope="col">Téléphone</th>
                                                        <th scope="col">Présence</th>
                                                        <th scope="col">Payment</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr v-for="member in members" :key="member.id" align="center">
                                                        <td>{{ member.memberFirstname }}</td>
                                                        <td>{{ member.memberLastname }}</td>
                                                        <td>{{ member.memberPhoneNumber }}</td>
                                                        <td>
                                                            <label class="switch">
                                                                <input type="checkbox" class="default" v-model="present">
                                                                <span class="slider round"></span>
                                                            </label>
                                                        </td>
                                                        <td>
                                                            <label class="switch">
                                                                <input type="checkbox" class="default" v-model="payment">
                                                                <span class="slider round"></span>
                                                            </label>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>

                                            <p></p>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    <button
                                                        type="button" class="btn btn-outline-secondary" @click="showFormPart2=false;
                                                        showFormPart1=true;">
                                                        Précédent
                                                    </button>
                                                </div>
                                                <div class="col-sm-6">
                                                    <button class="btn btn-secondary"> Valider </button>
                                                </div>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                                <p></p>

                            </form>
</code>```

How to do these with firebase using Vue Js please ? thanks !

Body:
I've a form that contains a textarea and a table with a list of many members (from a collection named Members). Each table's  contain two checboxes: one to mark the presence of the member and the second one to mark his payment. After clicking on the submit button I'd like to have in my firebase database something like this:

Meeting collection:
associationId,
textareaValue,
createdAd

Presence collection:
memberId,
meetingId,
present: true or false,
createAt

Payment collection:
memberId,
meetingId,
payment: true or false,
createAt

<form @submit.prevent="handleSubmitNewMeeting">

Entrer le sujet principal de la réunion

                                            <textarea class="form-control" v-model="subjects" required rows="3"></textarea>

                                                <button @click="showForm=false" class="btn btn-danger" style="width: 100%">
                                                    Annuler
                                                </button>

                                                <button
                                                    type="button" class="btn btn-outline-secondary" @click="showFormPart2=true;
                                                    showFormPart1=false;">
                                                    Suivant
                                                </button>

Cocher les présences et payements

                                                        Nom
                                                        Prénom
                                                        Téléphone
                                                        Présence
                                                        Payment

                                                        {{ member.memberFirstname }}
                                                        {{ member.memberLastname }}
                                                        {{ member.memberPhoneNumber }}

                                                                <input type="checkbox" class="default" v-model="present">

                                                                <input type="checkbox" class="default" v-model="payment">

                                                    <button
                                                        type="button" class="btn btn-outline-secondary" @click="showFormPart2=false;
                                                        showFormPart1=true;">
                                                        Précédent
                                                    </button>

                                                    <button class="btn btn-secondary"> Valider </button>

                            </form>

How to do these with firebase using Vue Js please ? thanks !


问:
RabbitMQ router connect with node getting Error: connect ECONNREFUSED 127.0.0.1:5672
```<code>const amqp = require("amqplib");
const config = require("./config/config");

class Producer {
    channel;

    async createChannel() {
        const connection = await amqp.connect(config.rabbitMQ.url);
        this.channel = await connection.createChannel();
    }

    async publishMessage(routingKey, message) {
        if (!this.channel) {
            await this.createChannel();
        }

        const exchangeName = config.rabbitMQ.exchangeName;
        await this.channel.assertExchange(exchangeName, "direct");

        const logDetails = {
            logType: routingKey,
            message: message,
            dateTime: new Date(),
        };
        await this.channel.publish(
            exchangeName,
            routingKey,
            Buffer.from(JSON.stringify(logDetails))
        );

        console.log(
            `The new ${routingKey} log is sent to exchange ${exchangeName}`
        );
    }
}

module.exports = Producer;
</code>```

Error

```<code>node:internal/process/promises:279
        triggerUncaughtException(err, true /* fromPromise */);
        ^
</code>```

Error: connect ECONNREFUSED 127.0.0.1:5672
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5672
}

Body:
const amqp = require("amqplib");
const config = require("./config/config");

class Producer {
    channel;

    async createChannel() {
        const connection = await amqp.connect(config.rabbitMQ.url);
        this.channel = await connection.createChannel();
    }

    async publishMessage(routingKey, message) {
        if (!this.channel) {
            await this.createChannel();
        }

        const exchangeName = config.rabbitMQ.exchangeName;
        await this.channel.assertExchange(exchangeName, "direct");

        const logDetails = {
            logType: routingKey,
            message: message,
            dateTime: new Date(),
        };
        await this.channel.publish(
            exchangeName,
            routingKey,
            Buffer.from(JSON.stringify(logDetails))
        );

        console.log(
            `The new ${routingKey} log is sent to exchange ${exchangeName}`
        );
    }
}

module.exports = Producer;

Error

node:internal/process/promises:279
        triggerUncaughtException(err, true /* fromPromise */);
        ^

Error: connect ECONNREFUSED 127.0.0.1:5672
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5672
}


问:
Adding log in options in R Shiny
I want to add log in functionality with my existing shiny app. There will be some scenario or option added with the login. Lets say, a user can not login to the app more than 5 times a day.

How can I add the feature with the login method. Can anyone give any references or guidelines for doing such as I am very new in this sector?

Thanks in advance.

Title: Adding log in options in R Shiny


问:
Add a Custom Certificate to Application
I have created a WordPress website from marketplace on azure app service. Can someone help me on how to add SSL to it?

Custom SSL added to the Site.

Title: Add a Custom Certificate to Application


问:
Container 'docker' exceeded memory limit
Hi I have the following pipeline config

```<code>image: maven:3.3.9

definitions:
  steps:
    - step: &build-step
        name: SonarQube analysis
        script:
          - pipe: sonarsource/sonarcloud-scan:1.4.0
            variables:
              SONAR_HOST_URL: ${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
              SONAR_SCANNER_OPTS: -Xmx1024m
              SONAR_TOKEN: ${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
  caches:
    sonar: ~/.sonar

clone:
  depth: full

pipelines:
  branches:
    '{master}': # or the name of your main branch
      - step: *build-step

</code>```

I want to increase the size of the docker to 2x could you please help with the proper YML config for the same?

I tried changing it to

```<code>      - step:
          size: 2x
</code>```

but it won't work, I get erros that step is null or missing

Body:
Hi I have the following pipeline config

image: maven:3.3.9

definitions:
  steps:
    - step: &build-step
        name: SonarQube analysis
        script:
          - pipe: sonarsource/sonarcloud-scan:1.4.0
            variables:
              SONAR_HOST_URL: ${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
              SONAR_SCANNER_OPTS: -Xmx1024m
              SONAR_TOKEN: ${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
  caches:
    sonar: ~/.sonar

clone:
  depth: full

pipelines:
  branches:
    '{master}': # or the name of your main branch
      - step: *build-step

I want to increase the size of the docker to 2x could you please help with the proper YML config for the same?

I tried changing it to

      - step:
          size: 2x

but it won't work, I get erros that step is null or missing


问:
Debug in Visual Studio Code Angular 15
I am trying to debug in VS but it does not work with angular 15, however it does with angular 14

The problem is that files are not loaded.

This is my tsconfig.json

```<code>  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "ES2022",
    "typeRoots": [
      "node_modules/@types"
    ],
    "types": [
      "node"
    ],
    "lib": [
      "es2018",
      "es2015",
      "dom"
    ],
    "skipLibCheck": true,
    "useDefineForClassFields": false
  }
}
</code>```

and this is launch.json

```<code>  "version": "0.2.0",
  "configurations": [
    {
              "type": "chrome",
              "request": "launch",
              "name": "Launch Chrome against localhost",
              "url": "http://localhost:4200",
              "webRoot": "${workspaceFolder}",
              "runtimeArgs": ["--disable-web-security"]
    }
  ]
}
</code>```

I am using javascript debugger as the one for Chrome is deprecated.

Title: Debug in Visual Studio Code Angular 15

Body:
I am trying to debug in VS but it does not work with angular 15, however it does with angular 14

The problem is that files are not loaded.

This is my tsconfig.json

  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "ES2022",
    "typeRoots": [
      "node_modules/@types"
    ],
    "types": [
      "node"
    ],
    "lib": [
      "es2018",
      "es2015",
      "dom"
    ],
    "skipLibCheck": true,
    "useDefineForClassFields": false
  }
}

and this is launch.json

  "version": "0.2.0",
  "configurations": [
    {
              "type": "chrome",
              "request": "launch",
              "name": "Launch Chrome against localhost",
              "url": "http://localhost:4200",
              "webRoot": "${workspaceFolder}",
              "runtimeArgs": ["--disable-web-security"]
    }
  ]
}

I am using javascript debugger as the one for Chrome is deprecated.


问:
Material UI Tabs indicator postion change while resizing
I used Material UI tabs on my page and have a sidebar on the right.
When I expand or collapse the sidebar, the active tab indicator position changes.
I have found this related issue on GitHub. They have added an action prop to the Tabs component since to solve the problem.

I have tried to fix the problem with this solution. But it didn't work for me.
How can I fix this problem?

```<code>function MyTabs() {
  const tabsActions = React.useRef();

  React.useEffect(() => {
    if (tabsActions.current) {
      tabsActions.current.updateIndicator();
    }
  }, []);

  return <Tabs action={tabsActions}>{items}</Popover>;
}
</code>```

This is my tabs component

```<code>export const BasicTab = (props: TabProps) => {
  const { data, disabled, type, actions } = props;
  const [value, setValue] = useState(0);

  const handleChange = (event: React.SyntheticEvent, newValue: number) => {
    setValue(newValue);
  };

  const tabsActions = React.useRef<any>();

  React.useEffect(() => {
    if (tabsActions.current) {
      tabsActions.current.updateIndicator();
    }
  }, []);

  return (
    <>
      <StyledTabs
        action={tabsActions}
        value={value}
        onChange={handleChange}
        aria-label="basic tabs example"
        className={type}
        variant="scrollable"
        scrollButtons={false}
      >
        {data?.map((item: TabItemType) => {
          return (
            <Tab
              key={item.id}
              label={item.name}
              disabled={item.disabled}
              disableRipple={item.disableTabRipple}
              {...props}
            />
          );
        })}
      </StyledTabs>

      {data?.map((item: TabPanelItemType) => {
        return (
          <TabPanel value={value} key={item.id} index={item.id}>
            {item.component}
          </TabPanel>
        );
      })}
    </>
  );
</code>```

Body:
I used Material UI tabs on my page and have a sidebar on the right.
When I expand or collapse the sidebar, the active tab indicator position changes.
I have found this related issue on GitHub. They have added an action prop to the Tabs component since to solve the problem.

I have tried to fix the problem with this solution. But it didn't work for me.
How can I fix this problem?

function MyTabs() {
  const tabsActions = React.useRef();

  React.useEffect(() => {
    if (tabsActions.current) {
      tabsActions.current.updateIndicator();
    }
  }, []);

  return <Tabs action={tabsActions}>{items}</Popover>;
}

This is my tabs component

export const BasicTab = (props: TabProps) => {
  const { data, disabled, type, actions } = props;
  const [value, setValue] = useState(0);

  const handleChange = (event: React.SyntheticEvent, newValue: number) => {
    setValue(newValue);
  };

  const tabsActions = React.useRef<any>();

  React.useEffect(() => {
    if (tabsActions.current) {
      tabsActions.current.updateIndicator();
    }
  }, []);

  return (
    <>

      {data?.map((item: TabPanelItemType) => {
        return (
          <TabPanel value={value} key={item.id} index={item.id}>
            {item.component}
          </TabPanel>
        );
      })}
    </>
  );


问:
Download without internet
I want to download a file in a network without internet connection like local network or when device is connected with specific VPN connection.

I'm using android DownloadManger and have problem using it. My request is enqueued but download wouldn't starts until device can have internet connection.

Is there any way force DownloadManager to start download?

Title: Download without internet


问:
Reading data from PowerBi into a flow via a button in PowerApps
I am not sure if this is the type of question I can ask here but I figured I would try since I have had no luck on the Microsoft community forums.

Is it possible to read data from PowerBi to PowerApps and then into a PowerAutomate flow?

Here is my situation
Currently, I have a PowerBi dashboard containing a table with 9 calculated measures, an embedded powerApps commentary form and a button that triggers a flow to send an approval email.

My issue is that both the app and the flow sit on our default environment, but we need to move them to different environments. So since you cannot select an environment other than the default when embedding a power automate button in PBI  my solution is to rather embed the power automate button in powerapps.

For this to work I need to read data from powerBi to powerapps and then into power automate.
I am able to read the powerbi data into powerapps by simply dragging the relevant measures to the data field

But now I have no idea how to get all of this into power automate. Is this even possible?


问:
My code always get this error Exception in thread "main" java.sql.SQLNonTransientConnectionException: No operations allowed after connection closed
I have an ArrayList in Java and I want to insert it into my database but it's always showing me this error code

Exception in thread "main" java.sql.SQLNonTransientConnectionException: No operations allowed after connection closed.

And I don't know why it's happening, I have tried many fix in the internet but non of it is working

here's my code snipset

```<code>Connection con = db.getConnection();
try{
    for(Stock element: listStock){
        if(element.getKodeSaham().equals(getKode_saham())){
            int hargaSaham = element.getHarga();
            int harga = (lot*100) * hargaSaham;
            for(Transaction trans : listTransaksi){
                //System.out.println(trans.getKodeSaham());
                PreparedStatement p1 = con.prepareStatement("INSERT INTO history (id_transaction, kode_saham, lot, harga, username, status, lot_sell_check) VALUES(NULL,'"+getKode_saham()+"','"+getLot()+"','"+harga+"','"+getUsername()+"', 'Buy','"+getLot()+"')");
                p1.executeUpdate();
            }
        }
    }
}finally {
    con.close();
}
</code>```

And here's my database connection:

```<code>static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/tes";
static final String USER = "root";
static final String PASS = "";

private static Connection connection;
public static Connection getConnection() throws SQLException{
    if (connection == null){
        connection = createConnection();
    }
    return connection;
}

private static Connection createConnection() {
    try {
        Class.forName("com.mysql.cj.jdbc.Driver");
        connection = DriverManager.getConnection(DB_URL,USER,PASS);
    } catch (ClassNotFoundException | SQLException ex) {
         Logger.getLogger(db.class.getName()).log(Level.SEVERE, null, ex);
    }

    return connection;
}
</code>```

Body:
I have an ArrayList in Java and I want to insert it into my database but it's always showing me this error code

Exception in thread "main" java.sql.SQLNonTransientConnectionException: No operations allowed after connection closed.

And I don't know why it's happening, I have tried many fix in the internet but non of it is working

here's my code snipset

Connection con = db.getConnection();
try{
    for(Stock element: listStock){
        if(element.getKodeSaham().equals(getKode_saham())){
            int hargaSaham = element.getHarga();
            int harga = (lot*100) * hargaSaham;
            for(Transaction trans : listTransaksi){
                //System.out.println(trans.getKodeSaham());
                PreparedStatement p1 = con.prepareStatement("INSERT INTO history (id_transaction, kode_saham, lot, harga, username, status, lot_sell_check) VALUES(NULL,'"+getKode_saham()+"','"+getLot()+"','"+harga+"','"+getUsername()+"', 'Buy','"+getLot()+"')");
                p1.executeUpdate();
            }
        }
    }
}finally {
    con.close();
}

And here's my database connection:

static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/tes";
static final String USER = "root";
static final String PASS = "";

private static Connection connection;
public static Connection getConnection() throws SQLException{
    if (connection == null){
        connection = createConnection();
    }
    return connection;
}

private static Connection createConnection() {
    try {
        Class.forName("com.mysql.cj.jdbc.Driver");
        connection = DriverManager.getConnection(DB_URL,USER,PASS);
    } catch (ClassNotFoundException | SQLException ex) {
         Logger.getLogger(db.class.getName()).log(Level.SEVERE, null, ex);
    }

    return connection;
}


问:
Evaluate textbox while someone is typing
Is there a way in powershell to evaluate a textbox while someone is typing in the textbox?

I've tried looking online, but didn't find anything.


问:
Need to use SecuGen SDK in my Basic for Android App?
I have been developing applications with B4A for more than 2 years.

Whenever I have been stuck anywhere this forum always remained helpful for me.

I have developed a quite large scaled app in B4A and this project is near ending. The only hurdle is using SecuGen biometric device's SDK in this app. They have provided samples for android studio and java. I have no idea wrapping this library in AS to be used in B4A despite reading different threads.

Can anybody help me with this? I shall be thankful.

I am attaching the JAR Library files and Java activity file for your perusal.

I tried to search in all programming forums for this but no content found. I hope posting my problem here will result in resolving my problem.


问:
HTTP Request in powerAutomate
I created a Power Automate flow to export PBIX from powerBI. I created an HTTP Request in the body the PBIX file is generated well. I would like to recover the PBIX and put it in a Sharepoint folder, how to recover the export of the HTTP request connector?

Title: HTTP Request in powerAutomate