问:
Wordpress - importing CPTs and optimising the time they are loaded in
I have an XML from our old WP website that I'd like to import into new WP (management makes me do this, help). Now, the XML is quite thick, and I'm using WP all import to import it. The catch is, the management for some reason wants to import it to jet-engines Custom Content Types (CCT) instead of custom Post Types (CPT), and WP all import doesnt support that. Why? No idea. I doubt they have one either.

Their original argument is that when the xml will grow larger, the pages will load slower. It's quite obvious as WP isnt the fastest thing out there when it loads 100+ rows from CPT.

I've asked in all the places really, WP all import people, jet-engine people. Now I ask here.
Is it possible to somehow link these two? I am aware I can create a relation inside jet engine, and I've done that, but is it possible to automate connecting the parent-child relation?

All that "I" need is 1:1 relation. Once again, don't ask.

OR, what are some other ways to make WP bit faster when loading these from the CPTs?

Please help, I'm going insane.

Tried creating custom CPTs, CCTs, relations, manually adding tables, all the shenanigans. Consulted the right people who should knew (to no surprise, they said it's impossible the way "I" want to do it)


来源: stackexchange

问:
Vaadin ComboBox debounce change
I want to do ComboBox more faster when answer by filtering string. How to change debounce parameter for ComboBox of Vaadin Flow 14 ?

My worries about debounce is started from there:

https://github.com/vaadin/web-components/issues/518

https://github.com/vaadin/flow-components/blob/master/vaadin-combo-box-flow-parent/vaadin-combo-box-flow/src/main/resources/META-INF/resources/frontend/comboBoxConnector.js#L97-L99

Please look at this example:
https://github.com/lanmaster/ping-component-demo

And video:
https://www.youtube.com/watch?v=m3l2iXAhQzQ

Maybe there is no problem with debounce at all, but all i need is to faster UI responsibility with ComboBox (faster reload filtered data) with minimal delays on each char entered.

ContentLicense: CC BY-SA 4.0

Title: Vaadin ComboBox debounce change


问:
How to check if all corresponding elements of three 2D arrays are zero?
I am calculating Green leaf index of an image. Image has been read by opencv and has three bands (RGB). Background has already been removed and now image has only green pixels. I want to calculate the index but when all corresponding elements in all the bands are zero, the formula results in nan values gli = (2 * g - r - b) / (2 * g + r + b).

I want to perform a if block to skip the calculation if all corresponding values are zero.But I want to exclude the scenario where nan values would result.
I am thinking it can be done by checking if r,g,b have corresponding
zero values, if yes then don't perform the calculation. I can't
figure out how to do it.

Following is my code:

# Import libraries
import numpy as np
from plantcv import plantcv as pcv
import cv2
import matplotlib.pyplot as plt
import os
import glob
from skimage import io, img_as_float, img_as_float32, img_as_ubyte, img_as_float64

folder = r"D:\Data\Koochia_Summer_trial\Output\Segmented green 7 days images\Barns 2021_treated"
gli_list = []

for file in glob.glob(folder + "\*.*"):
    img = cv2.imread(file)
    a = pcv.rgb2gray_lab(rgb_img=img, channel='a')
    ret, thresh1 = cv2.threshold(a, 0, 255, cv2.THRESH_BINARY_INV +
                                            cv2.THRESH_OTSU)

    img_arr = img_as_float32(img)
    r = img_arr[:,:,2]
    b = img_arr[:, :, 0]
    g = img_arr[:,:,1]

    np.seterr(invalid='ignore')
    gr = g/(r+g+b)
    bl = b/(r+g+b)
    re = r/(r+g+b)

    gli = (2 * g - r - b) / (2 * g + r + b)
    gxi = (2*gr) - re-b

    gli_no_nan = np.nan_to_num(gli,0,posinf = 1, neginf = 0)
    gxi_no_nan = np.nan_to_num(gxi,0,posinf = 1, neginf = 0)

    average_gli = gli_no_nan[np.nonzero(gli_no_nan)].mean()
    average_gxi = gxi_no_nan[np.nonzero(gxi_no_nan)].mean()

    gli_list.append(average_gli) `
```


问:
Python - I can't return the dataframe as a response from the function
I created a forecast model function, but I can't return the dataframe as a response. What is missing from the function?

`

```<code>def prophet_model(data_frame, cluster=int()):

    df_to_model = data_frame.copy()
    df_to_model = df_to_model[df_to_model['CLUSTER'] == cluster]
    df_to_model = df_to_model[['DATA', 'ZIP_CODE_CITY', 'VOLUME']]

    # Modelo
    results = []
    gran = ['ZIP_CODE_CITY']

    for n, gr in df_to_model.groupby(['ZIP_CODE_CITY']):

        ds = gr[['DATA','VOLUME']].rename(columns={'DATA':'ds','VOLUME':'y'})
        ds['ds'] = pd.to_datetime(ds.ds)

        # changepoint_prior_scale = 0.1 | seasonality_prior_scale = 10

        m = Prophet(
            changepoint_prior_scale = 1,
            seasonality_prior_scale = 15,
            yearly_seasonality = 20, # add 12/12
            weekly_seasonality = 20, # add 12/12
            seasonality_mode = 'multiplicative'
        )

        m.add_country_holidays(country_name='BR')
        m.fit(ds)

        future = m.make_future_dataframe(periods=30)
        forecast = m.predict(future)

        x = m.history[['ds','y']].merge(forecast[['ds','yhat','yhat_lower', 'yhat_upper','trend']],'right')

        for i in range(len(gran)):
            x[gran[i]] = n[i] if isinstance(n,tuple) else n

        results.append(x)

    results_final = pd.concat(results)
    return results_final
</code>```

`

let me show you an example in the print...

I tried to generate a dataframe as a response. I only have the prints of the model with me

Body:
I created a forecast model function, but I can't return the dataframe as a response. What is missing from the function?

`

def prophet_model(data_frame, cluster=int()):

    df_to_model = data_frame.copy()
    df_to_model = df_to_model[df_to_model['CLUSTER'] == cluster]
    df_to_model = df_to_model[['DATA', 'ZIP_CODE_CITY', 'VOLUME']]

    # Modelo
    results = []
    gran = ['ZIP_CODE_CITY']

    for n, gr in df_to_model.groupby(['ZIP_CODE_CITY']):

        ds = gr[['DATA','VOLUME']].rename(columns={'DATA':'ds','VOLUME':'y'})
        ds['ds'] = pd.to_datetime(ds.ds)

        # changepoint_prior_scale = 0.1 | seasonality_prior_scale = 10

        m = Prophet(
            changepoint_prior_scale = 1,
            seasonality_prior_scale = 15,
            yearly_seasonality = 20, # add 12/12
            weekly_seasonality = 20, # add 12/12
            seasonality_mode = 'multiplicative'
        )

        m.add_country_holidays(country_name='BR')
        m.fit(ds)

        future = m.make_future_dataframe(periods=30)
        forecast = m.predict(future)

        x = m.history[['ds','y']].merge(forecast[['ds','yhat','yhat_lower', 'yhat_upper','trend']],'right')

        for i in range(len(gran)):
            x[gran[i]] = n[i] if isinstance(n,tuple) else n

        results.append(x)

    results_final = pd.concat(results)
    return results_final

`

let me show you an example in the print...

I tried to generate a dataframe as a response. I only have the prints of the model with me


问:
Polygon selection based on marker position in leaflet
On the map, I have an added layer with polygons and one marker on another layer. When I click anywhere, the marker moves to that location and the polygon is selected. The marker has the ability to drag across the map, but just when I drag it, the polygon selection does not appear. How to do this?

```<code>
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});

var map = new L.Map('map', {
    'center': [51, 17],
    'zoom': 6,
    'layers': [osm],
});

var selected;

var marker
marker = L.marker([51, 17], {
    draggable: true
}).addTo(map);

var geoJsonLayer2
geoJsonLayer2 = L.geoJson( polygons ,{
style: {
fillColor: "#1ED100",
color: "orange",
fillOpacity: 0.0,
opacity: 0.0,
},

})
.on('click', function (e) {
// Check for selected
if (selected) {
// Reset selected to default style
e.target.resetStyle(selected)
}
// Assign new selected
selected = e.layer
// Bring selected to front
selected.bringToFront()
// Style selected
selected.setStyle({
'color': 'red',
'opacity': 1,
})
})
.addTo(map);

marker.on('dragend', function (e, feature) {
    updateLatLng(marker.getLatLng().lat, marker.getLatLng().lng);
});

map.on('click', function (e) {
    marker.setLatLng(e.latlng);
    updateLatLng(marker.getLatLng().lat, marker.getLatLng().lng);
});

function updateLatLng(lat, lng, reverse) {
    if (reverse) {
        marker.setLatLng([lat, lng]);
        map.panTo([lat, lng]);
    } else {
        document.getElementById('lat').value = marker.getLatLng().lat.toFixed(10);
        document.getElementById('long').value = marker.getLatLng().lng.toFixed(10);
        map.panTo([lat, lng]);

        document.getElementById("lat").value = lat.toFixed(10);
        document.getElementById("long").value = lng.toFixed(10);
    }
}

</code>```

view after clicking on the polygon

view after shifting the marker

Body:
On the map, I have an added layer with polygons and one marker on another layer. When I click anywhere, the marker moves to that location and the polygon is selected. The marker has the ability to drag across the map, but just when I drag it, the polygon selection does not appear. How to do this?

var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '© OpenStreetMap contributors'
});

var map = new L.Map('map', {
    'center': [51, 17],
    'zoom': 6,
    'layers': [osm],
});

var selected;

var marker
marker = L.marker([51, 17], {
    draggable: true
}).addTo(map);

var geoJsonLayer2
geoJsonLayer2 = L.geoJson( polygons ,{
style: {
fillColor: "#1ED100",
color: "orange",
fillOpacity: 0.0,
opacity: 0.0,
},

})
.on('click', function (e) {
// Check for selected
if (selected) {
// Reset selected to default style
e.target.resetStyle(selected)
}
// Assign new selected
selected = e.layer
// Bring selected to front
selected.bringToFront()
// Style selected
selected.setStyle({
'color': 'red',
'opacity': 1,
})
})
.addTo(map);

marker.on('dragend', function (e, feature) {
    updateLatLng(marker.getLatLng().lat, marker.getLatLng().lng);
});

map.on('click', function (e) {
    marker.setLatLng(e.latlng);
    updateLatLng(marker.getLatLng().lat, marker.getLatLng().lng);
});

function updateLatLng(lat, lng, reverse) {
    if (reverse) {
        marker.setLatLng([lat, lng]);
        map.panTo([lat, lng]);
    } else {
        document.getElementById('lat').value = marker.getLatLng().lat.toFixed(10);
        document.getElementById('long').value = marker.getLatLng().lng.toFixed(10);
        map.panTo([lat, lng]);

        document.getElementById("lat").value = lat.toFixed(10);
        document.getElementById("long").value = lng.toFixed(10);
    }
}

view after clicking on the polygon

view after shifting the marker


问:
how to create an application of AudioRecorder test in which audio is recorded by the system as well as from the environment
How to create an application of AudioRecorder test in which audio is recorded by the system as well as from the environment I mean system automatically record his voice as well as the user voice please help me to write code?

I tried but I don't get any clue how to write code?


问:
PHP output newline in a single character using bitwise NOT operator
I have found in different web sites (for example here) this statement:

This PHP code prints a newline using 10 bytes:

```<code>echo "\n";
</code>```

This PHP code prints a newline using 9 bytes:

```<code>echo "
";
</code>```

This PHP code prints a newline using 8 bytes (using the bitwise NOT operator ~):

```<code>echo ~õ;
</code>```

My problem is that I can't make that last solution work in any possible way, test and environment that I used. I have tested on online PHP sandboxes, on local machine, etc, when I execute

```<code>echo ~õ;
</code>```

I get always this output:

```<code><J
</code>```

Why? Can someone explain why I get this output and why it should print a newline?

Body:
I have found in different web sites (for example here) this statement:

This PHP code prints a newline using 10 bytes:

echo "\n";

This PHP code prints a newline using 9 bytes:

echo "
";

This PHP code prints a newline using 8 bytes (using the bitwise NOT operator ~):

echo ~õ;

My problem is that I can't make that last solution work in any possible way, test and environment that I used. I have tested on online PHP sandboxes, on local machine, etc, when I execute

echo ~õ;

I get always this output:

<J

Why? Can someone explain why I get this output and why it should print a newline?


问:
Not able to call solidity contract function (public payable function) from React
I am using truffle framework to deploy my solidity smart contract on local Ganache GUI.

Everything is on my local. I have configured the truffle config to use local ganache blockchain.

On the front-end app I am using ReactJS with ethers.js. I am also using Metamask (chrome extension) in which I have setup the local ganache RPC correctly (I believe).

THIS IS WORKING CORRECTLY -

I have public testfxn on my solidity contract deployed on local ganache. This testfxn function just returns a uint value 123.

Now from the front-end react app, I click a button - it opens metamask ---- this react  app then  correctly invokes the testfxn and I am correctly able to console log 123 (the smart contract's returned value)

Working code (React using ethers.js) -

```<code>      const accounts = await provider.send("eth_requestAccounts", []);
      console.log(accounts);  // logs correctly the account
      const signer = provider.getSigner(accounts[0]);

      const balance = await provider.getBalance(accounts[0]);

      const balanceInEther = ethers.utils.formatEther(balance);

      const contractInstance = new ethers.Contract(
                      "0x9bd3fdf893 ..... f36597E5e224f95",
                      contractABI,
                      signer)

      const testcall = await contractInstance.testfxn();
      console.log(testcall);    // CORRECTLY logs 123
</code>```

Definition of testfxn (on solidity contract deployed on ganache):-

```<code>    function testfxn() public pure returns( uint ){
        return 123;
    }
</code>```

BELOW CODE IS NOT WORKING-

Instead of calling textfxn if I call troublefxn ..... I get the error.

Non-working code (in react)  -

```<code>      const accounts = await provider.send("eth_requestAccounts", []);
      console.log(accounts);  // logs correctly the account
      const signer = provider.getSigner(accounts[0]);

      const balance = await provider.getBalance(accounts[0]);

      const balanceInEther = ethers.utils.formatEther(balance);

      const contractInstance = new ethers.Contract(
                      "0x9bd3fdf893 ..... f36597E5e224f95",
                      contractABI,
                      signer)

        await contractInstance.troublefxn(5,
                                            {value: ethers.utils.parseEther("8.0")}
                                            );

       // Get error exception -
</code>```

Error exception -

```<code>    "code": -32603,
    "message": "Internal JSON-RPC error.",
    "data": {
        "message": "VM Exception while processing transaction: revert",
        "code": -32000,
        ...
</code>```

troublefxn definition on solidity contract -

```<code>    function troublefxn(  uint f1,
        ) public payable {

        some_state_variable = f1;
    }
</code>```

What am I doing wrong in calling troublefxn from my react app ?

Body:
I am using truffle framework to deploy my solidity smart contract on local Ganache GUI.

Everything is on my local. I have configured the truffle config to use local ganache blockchain.

On the front-end app I am using ReactJS with ethers.js. I am also using Metamask (chrome extension) in which I have setup the local ganache RPC correctly (I believe).

THIS IS WORKING CORRECTLY -

I have public testfxn on my solidity contract deployed on local ganache. This testfxn function just returns a uint value 123.

Now from the front-end react app, I click a button - it opens metamask ---- this react  app then  correctly invokes the testfxn and I am correctly able to console log 123 (the smart contract's returned value)

Working code (React using ethers.js) -

      const accounts = await provider.send("eth_requestAccounts", []);
      console.log(accounts);  // logs correctly the account
      const signer = provider.getSigner(accounts[0]);

      const balance = await provider.getBalance(accounts[0]);

      const balanceInEther = ethers.utils.formatEther(balance);

      const contractInstance = new ethers.Contract(
                      "0x9bd3fdf893 ..... f36597E5e224f95",
                      contractABI,
                      signer)

      const testcall = await contractInstance.testfxn();
      console.log(testcall);    // CORRECTLY logs 123

Definition of testfxn (on solidity contract deployed on ganache):-

    function testfxn() public pure returns( uint ){
        return 123;
    }

BELOW CODE IS NOT WORKING-

Instead of calling textfxn if I call troublefxn ..... I get the error.

Non-working code (in react)  -

      const accounts = await provider.send("eth_requestAccounts", []);
      console.log(accounts);  // logs correctly the account
      const signer = provider.getSigner(accounts[0]);

      const balance = await provider.getBalance(accounts[0]);

      const balanceInEther = ethers.utils.formatEther(balance);

      const contractInstance = new ethers.Contract(
                      "0x9bd3fdf893 ..... f36597E5e224f95",
                      contractABI,
                      signer)

        await contractInstance.troublefxn(5,
                                            {value: ethers.utils.parseEther("8.0")}
                                            );

       // Get error exception -

Error exception -

    "code": -32603,
    "message": "Internal JSON-RPC error.",
    "data": {
        "message": "VM Exception while processing transaction: revert",
        "code": -32000,
        ...

troublefxn definition on solidity contract -

    function troublefxn(  uint f1,
        ) public payable {

        some_state_variable = f1;
    }

What am I doing wrong in calling troublefxn from my react app ?


问:
NetMQ/PyZMQ - Async poller sometimes doesn't recieve message until disposal
I have a DEALER/DEALER connection.

For some reason, there seems to be an importance to who runs first. If I run the C# one (NetMQ), followed by the python one, the message sent via C# will block until the python dealer is running (as expected - Send blocks until it can send). However...

sometimes, the response I send from the python dealer is not received by the C# poller (the method added to ReceiveReady isn't called). This seems to happen when I send a message from C#, then wait a few (tried ~10) seconds before I run the python client.

However the moment I either dispose of the poller on the C# end or the socket on the python end, I get the message (in the C# app, I seem to only get the first message. But if I dispose of the socket on the python end, I get all messages at once).

I'm not sure what's going on. I would have guessed some kind of timeout on the messages, if it weren't for the fact they end up being received.

C# code (about half the lines are just for disposing):

```<code>using UnityEngine;
using AsyncIO;
using NetMQ;
using NetMQ.Sockets;
using System;
using System.Threading.Tasks;
public class MsgClient_BASIC : MonoBehaviour
{
    DealerSocket socket;
    NetMQPoller poller;
    private bool requesterIsStarted;
    public static MsgClient_BASIC this_msgclient;

    private void OnReceive(object s, NetMQ.NetMQSocketEventArgs a)
    {
        bool more;
        string FS = a.Socket.ReceiveFrameString(out more);
        Debug.Log(FS);
    }
    void Start()
    {
        this_msgclient = this;
        ForceDotNet.Force();
        socket = new DealerSocket();
        socket.Bind("tcp://localhost:5558");
        poller = new NetMQPoller { socket };
        socket.ReceiveReady += OnReceive;
        poller.RunAsync();
    }
    private void Update()
    {
        if (Input.GetKeyDown("m"))
        {

            Debug.Log("Sending S");
            socket.SendFrame("S");
        }
    }
    void OnDestroy()
    {
        Debug.Log("Stopping async poller");
        try
        {
            poller.StopAsync();
        }
        catch

        {
        }

        Debug.Log("Disposing Poller");
        try
        {
            poller.Dispose();

        }
        catch

        {
        }
        Debug.Log("Closing socket");
        try
        {
            socket.Close();
        }
        catch

        {
        }
        Debug.Log("Disposing of socket");

        try
        {
            ((IDisposable)socket).Dispose();

        }
        catch
        {

        }
        Debug.Log("Cleaning up");
        NetMQConfig.Cleanup(true);

    }
}
</code>```

Python code:

```<code>import zmq
import json
from datetime import datetime as dt
from os import path
context = zmq.Context()
class Client:

    def __init__(self,port):
        self.socket = context.socket(zmq.DEALER)
        self.socket.setsockopt(zmq.LINGER,500)
        self.socket.connect("tcp://localhost:%d" % port)

    def check_msgs(self):
        try:
            response = self.socket.recv_string(flags=zmq.NOBLOCK)
        except zmq.Again as e:
            response = None
        print(response)
        return response

    def send_dict(self,d):
        jd = json.dumps(d)
        self.socket.send_string(jd,flags=zmq.NOBLOCK)

    def destroy(self):
        self.socket.close()
        context.destroy(5)
        print("Destroyed")
</code>```

Body:
I have a DEALER/DEALER connection.

For some reason, there seems to be an importance to who runs first. If I run the C# one (NetMQ), followed by the python one, the message sent via C# will block until the python dealer is running (as expected - Send blocks until it can send). However...

sometimes, the response I send from the python dealer is not received by the C# poller (the method added to ReceiveReady isn't called). This seems to happen when I send a message from C#, then wait a few (tried ~10) seconds before I run the python client.

However the moment I either dispose of the poller on the C# end or the socket on the python end, I get the message (in the C# app, I seem to only get the first message. But if I dispose of the socket on the python end, I get all messages at once).

I'm not sure what's going on. I would have guessed some kind of timeout on the messages, if it weren't for the fact they end up being received.

C# code (about half the lines are just for disposing):

using UnityEngine;
using AsyncIO;
using NetMQ;
using NetMQ.Sockets;
using System;
using System.Threading.Tasks;
public class MsgClient_BASIC : MonoBehaviour
{
    DealerSocket socket;
    NetMQPoller poller;
    private bool requesterIsStarted;
    public static MsgClient_BASIC this_msgclient;

    private void OnReceive(object s, NetMQ.NetMQSocketEventArgs a)
    {
        bool more;
        string FS = a.Socket.ReceiveFrameString(out more);
        Debug.Log(FS);
    }
    void Start()
    {
        this_msgclient = this;
        ForceDotNet.Force();
        socket = new DealerSocket();
        socket.Bind("tcp://localhost:5558");
        poller = new NetMQPoller { socket };
        socket.ReceiveReady += OnReceive;
        poller.RunAsync();
    }
    private void Update()
    {
        if (Input.GetKeyDown("m"))
        {

            Debug.Log("Sending S");
            socket.SendFrame("S");
        }
    }
    void OnDestroy()
    {
        Debug.Log("Stopping async poller");
        try
        {
            poller.StopAsync();
        }
        catch

        {
        }

        Debug.Log("Disposing Poller");
        try
        {
            poller.Dispose();

        }
        catch

        {
        }
        Debug.Log("Closing socket");
        try
        {
            socket.Close();
        }
        catch

        {
        }
        Debug.Log("Disposing of socket");

        try
        {
            ((IDisposable)socket).Dispose();

        }
        catch
        {

        }
        Debug.Log("Cleaning up");
        NetMQConfig.Cleanup(true);

    }
}

Python code:

import zmq
import json
from datetime import datetime as dt
from os import path
context = zmq.Context()
class Client:

    def __init__(self,port):
        self.socket = context.socket(zmq.DEALER)
        self.socket.setsockopt(zmq.LINGER,500)
        self.socket.connect("tcp://localhost:%d" % port)

    def check_msgs(self):
        try:
            response = self.socket.recv_string(flags=zmq.NOBLOCK)
        except zmq.Again as e:
            response = None
        print(response)
        return response

    def send_dict(self,d):
        jd = json.dumps(d)
        self.socket.send_string(jd,flags=zmq.NOBLOCK)

    def destroy(self):
        self.socket.close()
        context.destroy(5)
        print("Destroyed")


问:
An unhandled exception occurred: Cannot find module './internal/Observable' Require stack:
Require stack:

D:\Projects\pulse-fe-new\pulse\node_modules@angular-devkit\architect\node_modules\rxjs\index.js

D:\Projects\pulse-fe-new\pulse\node_modules@angular-devkit\architect\src\api.js

D:\Projects\pulse-fe-new\pulse\node_modules@angular-devkit\architect\src\index.js

D:\Projects\pulse-fe-new\pulse\node_modules@angular-devkit\build-angular\src\dev-server\index.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\architect\node\node-modules-architect-host.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\architect\node\index.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\src\command-builder\architect-base-command-module.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\src\command-builder\architect-command-module.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\src\commands\build\cli.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\src\command-builder\command-runner.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\lib\cli\index.js

C:\Users\mayan\AppData\Roaming\npm\node_modules@angular\cli\lib\init.js
See "C:\Users\mayan\AppData\Local\Temp\ng-lRGvDA\angular-errors.log" for further details.


问:
Telegraf to Prometheus is seemingly incorrectly identifying some labels as metrics
BACKGROUND

I have some time series data that looks like this:

```<code>1671407650806101433,GROUPSTATS,group_id=0,last_rx=1671407650694827472,last_rx_local=18:54:10.694827472,time_since_last_rx=111273960,desc=00AL.R24097.-,exch=mdx,pid=12345
</code>```

Where GROUPSTATS is the name of the type, group_id is either 0 or 1 and last_rx, last_rx_local and time_since_last_rx are the data sets that I care about and descriptor is the channel (many per pid).

Telegraf obtains this data which is then scraped by prometheus and results in the following metrics and labels:

metrics:

GROUPSTATS_group_id

GROUPSTATS_last_rx

GROUPSTATS_pid

GROUPSTATS_time

GROUPSTATS_time_since_last_rx

labels:

descriptor

exch

last_rx_local

type

instance (telegraf data)

I then visualise this data in grafana. Telegraf -> prometheus -> grafana.

QUESTION

Why are some of those fields arbitrarily taken as labels and some as metrics? I.e. why is pid a metric but exch a label?

Is there anyway to convert metrics to labels?

I want to be able to average time_since_last_rx on a host and show it by group_id, or average time_since_last_rx across a pid. At the moment I can't filter by group_id as its a separate metric.

telegraf config, is below. someBashScripts removes the keys from the csv:

```<code>commands = [
   "someBashScript.sh"

  ]
  data_format = "csv"
  csv_header_row_count = 0
  csv_column_names = ["time", "type", "group_id", "last_rx", "local_last_rx", "time_since_last_rx", "descriptor", "pid", "exch"]
  csv_measurement_column = "type"
  csv_timestamp_column = "time"
  csv_timestamp_format = "unix_ns"
</code>```

Body:
BACKGROUND

I have some time series data that looks like this:

1671407650806101433,GROUPSTATS,group_id=0,last_rx=1671407650694827472,last_rx_local=18:54:10.694827472,time_since_last_rx=111273960,desc=00AL.R24097.-,exch=mdx,pid=12345

Where GROUPSTATS is the name of the type, group_id is either 0 or 1 and last_rx, last_rx_local and time_since_last_rx are the data sets that I care about and descriptor is the channel (many per pid).

Telegraf obtains this data which is then scraped by prometheus and results in the following metrics and labels:

metrics:

GROUPSTATS_group_id

GROUPSTATS_last_rx

GROUPSTATS_pid

GROUPSTATS_time

GROUPSTATS_time_since_last_rx

labels:

descriptor

exch

last_rx_local

type

instance (telegraf data)

I then visualise this data in grafana. Telegraf -> prometheus -> grafana.

QUESTION

Why are some of those fields arbitrarily taken as labels and some as metrics? I.e. why is pid a metric but exch a label?

Is there anyway to convert metrics to labels?

I want to be able to average time_since_last_rx on a host and show it by group_id, or average time_since_last_rx across a pid. At the moment I can't filter by group_id as its a separate metric.

telegraf config, is below. someBashScripts removes the keys from the csv:

commands = [
   "someBashScript.sh"

  ]
  data_format = "csv"
  csv_header_row_count = 0
  csv_column_names = ["time", "type", "group_id", "last_rx", "local_last_rx", "time_since_last_rx", "descriptor", "pid", "exch"]
  csv_measurement_column = "type"
  csv_timestamp_column = "time"
  csv_timestamp_format = "unix_ns"


问:
Add object in array in document with Firestore/React
I have my firestore database with each user having their list of clients. Each item of that list is an object with properties and I have an 'appointment' property which is a list of objects. I want to allow the user to set an appointment for its client but I can't figure it out. I am able to create a new object but I don't know how to update an array in a document in firestore. Can you help?</p>


问:
Indexing in For Loop R
I am coming from Python and am trying to define a For Loop with print the first 168 observations of some Data in the first iteration, in the second I want it to print observation 2 until 169 instead. That is, dropping and adding one observation for each iteration.

```<code>for (i in 1:10) {
  print(df[i:167+i])
}
</code>```

This is the code I am trying to run. What this code does is:
First iteration: Print thje first 168 observation.
Second iteration: Drop two observations from the start, and adds one in the end, so it prints observation 3-169, instead of 2-169.

If I instead run:

```<code>for (i in 1:10) {
  print(df[i:168])
}
</code>```

It works as I want, only dropping one observations in the beginning of the sample for each iteration.

Why does this happen?

Title: Indexing in For Loop R

Body:
I am coming from Python and am trying to define a For Loop with print the first 168 observations of some Data in the first iteration, in the second I want it to print observation 2 until 169 instead. That is, dropping and adding one observation for each iteration.

for (i in 1:10) {
  print(df[i:167+i])
}

This is the code I am trying to run. What this code does is:
First iteration: Print thje first 168 observation.
Second iteration: Drop two observations from the start, and adds one in the end, so it prints observation 3-169, instead of 2-169.

If I instead run:

for (i in 1:10) {
  print(df[i:168])
}

It works as I want, only dropping one observations in the beginning of the sample for each iteration.

Why does this happen?


问:
Import specific package from maven dependency
I have a maven project where I am using pom.xml to declare maven dependency.
I want to import a jar named "externalCard" but don't want to import all the packages inside that jar because few entity defined in the externalCard jar is also present in my project causing an error.
error:  A bean with that name has already been defined in class path

Is their any way such that i can import only the specific package or classes from the externalCard jar.

for eg externalCard has this structure

```<code>-externalCard
--com.external.card
----package1
------files
----package2
------files
</code>```

I want to import files belong to only package1, as package2 files are already there in my projects

Body:
I have a maven project where I am using pom.xml to declare maven dependency.
I want to import a jar named "externalCard" but don't want to import all the packages inside that jar because few entity defined in the externalCard jar is also present in my project causing an error.
error:  A bean with that name has already been defined in class path

Is their any way such that i can import only the specific package or classes from the externalCard jar.

for eg externalCard has this structure

-externalCard
--com.external.card
----package1
------files
----package2
------files

I want to import files belong to only package1, as package2 files are already there in my projects


问:
Defining custom compiler/linker in Cmake custom language

Questions

Main question: Can we use/define a placeholder like <CMAKE_MYDUMMYLANGUAGE_LINKER> for CMAKE_MYDUMMYLANGUAGE_LINK_EXECUTABLE the same way we may define CMAKE_MYDUMMYLANGUAGE_COMPILE_OBJECT with <CMAKE_MYDUMMYLANGUAGE_COMPILER>?

If you can elaborate or share good links on placeholders and custom languages, it would be appreciated too. Particularly:

Is there a list of placeholders somewhere or do we need to read the code to get them?

Can we define our own ones? And if yes, is it a recommended practice?

What is the usual way of finding and defining a custom linker?

What should we place into CMakeInformation.cmake, CMakeDetermineCompiler.cmake, and is there a standardized way of setting them?

Speaking of placeholder and tokens, what is the purpose of apparent redundant set with "@MYVAR@"? Is there any non-trivial usage outside packaging? Example in /usr/share/cmake-3.16/Modules/FindCUDA/run_nvcc.cmake

```<code># Set these up as variables to make reading the generated file easier
set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
set(source_file "@source_file@") # path
</code>```

(This question is in the continuity of How do CMake placeholders work?)

Context

When doing cross-compilation or intermediate compilations, I know we can use custom commands (for example to pre-compile a ragel file .rl into .cpp). But when browsing CMake available languages in a standard Linux distribution, there are custom *Information.cmake, *DetermineCompiler.cmake etc. files, defining custom languages.

I tried to make a custom one too, but got stuck with the linker, and it made me realize I don't understand placeholder stuff and the standard way of define custom languages (if any). Why can't we use the same logic as for the compiler?

CMakeMyDummyLanguageInformation.txt

```<code>set( CMAKE_MYDUMMYLANGUAGE_COMPILE_OBJECT
    "<CMAKE_MYDUMMYLANGUAGE_COMPILER> ..."
)
# placeholder CMAKE_MYDUMMYLANGUAGE_LINKER unkown, resulting in `CMAKE_MYDUMMYLANGUAGE_LINKER ...` command to be attempted at link stage
set( CMAKE_MYDUMMYLANGUAGE_LINK_EXECUTABLE
    "<CMAKE_MYDUMMYLANGUAGE_LINKER> ..."
)
</code>```

CMakeMyDummyLanguageDetermineCompiler.txt

```<code>find_program(
    CMAKE_MYDUMMYLANGUAGE_COMPILER
        NAMES "dummycc"
        HINTS "${CMAKE_SOURCE_DIR}"
        DOC "dummy cc"
)
mark_as_advanced(CMAKE_MYDUMMYLANGUAGE_COMPILER)

find_program(
    CMAKE_MYDUMMYLANGUAGE_LINKER
        NAMES "dummyld"
        HINTS "${CMAKE_SOURCE_DIR}"
        DOC "dummy ld"
)
mark_as_advanced(CMAKE_MYDUMMYLANGUAGE_LINKER)
</code>```

Some links related (more or less)

How do CMake placeholders work?

https://gitlab.kitware.com/cmake/cmake/-/commit/677c091b8140a0655f512b8283c5b120fbd0f99c?view=parallel

https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html

Body:
Questions

Main question: Can we use/define a placeholder like <CMAKE_MYDUMMYLANGUAGE_LINKER> for CMAKE_MYDUMMYLANGUAGE_LINK_EXECUTABLE the same way we may define CMAKE_MYDUMMYLANGUAGE_COMPILE_OBJECT with <CMAKE_MYDUMMYLANGUAGE_COMPILER>?

If you can elaborate or share good links on placeholders and custom languages, it would be appreciated too. Particularly:

Is there a list of placeholders somewhere or do we need to read the code to get them?

Can we define our own ones? And if yes, is it a recommended practice?

What is the usual way of finding and defining a custom linker?

What should we place into CMakeInformation.cmake, CMakeDetermineCompiler.cmake, and is there a standardized way of setting them?

Speaking of placeholder and tokens, what is the purpose of apparent redundant set with "@MYVAR@"? Is there any non-trivial usage outside packaging? Example in /usr/share/cmake-3.16/Modules/FindCUDA/run_nvcc.cmake

# Set these up as variables to make reading the generated file easier
set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
set(source_file "@source_file@") # path

(This question is in the continuity of How do CMake placeholders work?)

Context

When doing cross-compilation or intermediate compilations, I know we can use custom commands (for example to pre-compile a ragel file .rl into .cpp). But when browsing CMake available languages in a standard Linux distribution, there are custom *Information.cmake, *DetermineCompiler.cmake etc. files, defining custom languages.

I tried to make a custom one too, but got stuck with the linker, and it made me realize I don't understand placeholder stuff and the standard way of define custom languages (if any). Why can't we use the same logic as for the compiler?

CMakeMyDummyLanguageInformation.txt

set( CMAKE_MYDUMMYLANGUAGE_COMPILE_OBJECT
    "<CMAKE_MYDUMMYLANGUAGE_COMPILER> ..."
)
# placeholder CMAKE_MYDUMMYLANGUAGE_LINKER unkown, resulting in `CMAKE_MYDUMMYLANGUAGE_LINKER ...` command to be attempted at link stage
set( CMAKE_MYDUMMYLANGUAGE_LINK_EXECUTABLE
    "<CMAKE_MYDUMMYLANGUAGE_LINKER> ..."
)

CMakeMyDummyLanguageDetermineCompiler.txt

find_program(
    CMAKE_MYDUMMYLANGUAGE_COMPILER
        NAMES "dummycc"
        HINTS "${CMAKE_SOURCE_DIR}"
        DOC "dummy cc"
)
mark_as_advanced(CMAKE_MYDUMMYLANGUAGE_COMPILER)

find_program(
    CMAKE_MYDUMMYLANGUAGE_LINKER
        NAMES "dummyld"
        HINTS "${CMAKE_SOURCE_DIR}"
        DOC "dummy ld"
)
mark_as_advanced(CMAKE_MYDUMMYLANGUAGE_LINKER)

Some links related (more or less)

How do CMake placeholders work?

https://gitlab.kitware.com/cmake/cmake/-/commit/677c091b8140a0655f512b8283c5b120fbd0f99c?view=parallel

https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html


问:
Use url-schema as href value in gmail
I am trying to insert a url-schema as the href attribute value in an email but when the email arrives, the href has been removed from gmail and hence the button is not clickable.

If I put a normal link with the http(s) protocol I don't have any problem. I found some similar questions as: question 1, question 2, but there isn't a solution.

There is a method to prevent that behavior?

Title: Use url-schema as href value in gmail


问:
IsAccessible function deprecated on Java 9 + not working on maven test after replacing with canAccess
i'm having problem with correcting bugs on this project on sonarcloud that has a IsAccessible, a deprecated function on Java 9+.
I get a compilation error when i do mvn test even after replacing the code with the latest function.

I replaced this code:

```<code>static <T> T getFieldValue(Object object, Field field) {
    boolean accessible = field.isAccessible();
    Object value = null;
    try {
        if (!accessible) {
            field.setAccessible(true);
        }
        value = field.get(object);
    } catch (IllegalAccessException ignored) {
    } finally {
        field.setAccessible(accessible);
    }
    return (T) value;
}
</code>```

With this code, according to the documentation:

```<code>static <T> T getFieldValue(Object object, Field field) {
    boolean accessible = field.canAccess(object);
    Object value = null;
    try {
        if (!accessible) {
            field.setAccessible(true);
        }
        value = field.get(object);
    } catch (IllegalAccessException ignored) {
    } finally {
        field.setAccessible(accessible);
    }
    return (T) value;
}
</code>```

But when i do the maven test i see this error:
mvn test

I don't know what else to do.
Thank you in advance

Body:
i'm having problem with correcting bugs on this project on sonarcloud that has a IsAccessible, a deprecated function on Java 9+.
I get a compilation error when i do mvn test even after replacing the code with the latest function.

I replaced this code:

static <T> T getFieldValue(Object object, Field field) {
    boolean accessible = field.isAccessible();
    Object value = null;
    try {
        if (!accessible) {
            field.setAccessible(true);
        }
        value = field.get(object);
    } catch (IllegalAccessException ignored) {
    } finally {
        field.setAccessible(accessible);
    }
    return (T) value;
}

With this code, according to the documentation:

static <T> T getFieldValue(Object object, Field field) {
    boolean accessible = field.canAccess(object);
    Object value = null;
    try {
        if (!accessible) {
            field.setAccessible(true);
        }
        value = field.get(object);
    } catch (IllegalAccessException ignored) {
    } finally {
        field.setAccessible(accessible);
    }
    return (T) value;
}

But when i do the maven test i see this error:
mvn test

I don't know what else to do.
Thank you in advance


问:
Error Resolving Thymeleaf Templates Files when run a jar file in Spring Boot App but runs fine locally
My app works fine on local. But when I deploy to kubernetes I get this error:

Error resolving template [login], template might not exist or might not be accessible by any of the configured Template Resolvers

Controller

```<code>    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public ModelAndView login(HttpServletRequest request) {
        String referrer = request.getHeader("Referer");
        ModelAndView modelAndView = new ModelAndView();
        request.getSession().setAttribute("Referer", referrer);
        modelAndView.setViewName("user/test");
        return modelAndView;
    }

</code>```

test.html

```<code><!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
    <h2>Test</h2>
</body>
</html>
</code>```

WebSecurityConfig

```<code>    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/api/**").permitAll()
                .antMatchers("/login").permitAll()
                .antMatchers("/reminder").permitAll()
                .antMatchers("/reset").permitAll()
                .antMatchers("/user/update-password").hasAnyAuthority("ADMIN", "MODERATOR", "USER")

                .anyRequest().authenticated()
                .and()
                .formLogin().successHandler(customizeAuthenticationSuccessHandler)
                .loginPage("/login").failureUrl("/login?error")
                .usernameParameter("username")
                .passwordParameter("password")
                .and()
                .logout()
                .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
                .logoutSuccessUrl("/login?logout")
                .and()
                .exceptionHandling()
                //                .accessDeniedHandler(accessDeniedHandler)
                .and()
                .csrf().ignoringAntMatchers(new String[]{"/api/**"}).and();
    }

    /**
     *
     * @param web
     * @throws Exception
     */
    @Override
    public void configure(WebSecurity web) {
        web.expressionHandler(new DefaultWebSecurityExpressionHandler() {
            @Override
            protected SecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, FilterInvocation fi) {
                WebSecurityExpressionRoot root = (WebSecurityExpressionRoot) super.createSecurityExpressionRoot(authentication, fi);
                root.setDefaultRolePrefix(""); //remove the prefix
                return root;
            }
        }).ignoring().antMatchers(
                "/resources/**",
                "/static/**",
                "/assets/**",
                "/global_assets/**",
                "/webjars/**",
                "/css/**",
                "/js/**",
                "/img/**"
        ).antMatchers("/webjars/**", "/css/**", "/js/**");
    }
</code>```

application.properties

```<code>spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
</code>```

How can I solve this problem? I am using spring boot and kubernetes. It does not bring up the login page.

Body:
My app works fine on local. But when I deploy to kubernetes I get this error:

Error resolving template [login], template might not exist or might not be accessible by any of the configured Template Resolvers

Controller

    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public ModelAndView login(HttpServletRequest request) {
        String referrer = request.getHeader("Referer");
        ModelAndView modelAndView = new ModelAndView();
        request.getSession().setAttribute("Referer", referrer);
        modelAndView.setViewName("user/test");
        return modelAndView;
    }

test.html

<!DOCTYPE html>

<meta charset="UTF-8">
<title>Test</title>

Test

WebSecurityConfig

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/api/**").permitAll()
                .antMatchers("/login").permitAll()
                .antMatchers("/reminder").permitAll()
                .antMatchers("/reset").permitAll()
                .antMatchers("/user/update-password").hasAnyAuthority("ADMIN", "MODERATOR", "USER")

                .anyRequest().authenticated()
                .and()
                .formLogin().successHandler(customizeAuthenticationSuccessHandler)
                .loginPage("/login").failureUrl("/login?error")
                .usernameParameter("username")
                .passwordParameter("password")
                .and()
                .logout()
                .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
                .logoutSuccessUrl("/login?logout")
                .and()
                .exceptionHandling()
                //                .accessDeniedHandler(accessDeniedHandler)
                .and()
                .csrf().ignoringAntMatchers(new String[]{"/api/**"}).and();
    }

    /**
     *
     * @param web
     * @throws Exception
     */
    @Override
    public void configure(WebSecurity web) {
        web.expressionHandler(new DefaultWebSecurityExpressionHandler() {
            @Override
            protected SecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, FilterInvocation fi) {
                WebSecurityExpressionRoot root = (WebSecurityExpressionRoot) super.createSecurityExpressionRoot(authentication, fi);
                root.setDefaultRolePrefix(""); //remove the prefix
                return root;
            }
        }).ignoring().antMatchers(
                "/resources/**",
                "/static/**",
                "/assets/**",
                "/global_assets/**",
                "/webjars/**",
                "/css/**",
                "/js/**",
                "/img/**"
        ).antMatchers("/webjars/**", "/css/**", "/js/**");
    }

application.properties

spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html

How can I solve this problem? I am using spring boot and kubernetes. It does not bring up the login page.


问:
Can't edit the .bashrc file in a container from the "docker exec" command?
I am trying to modify the .bashrc file in my container via the:

```<code>docker exec  -it --workdir /root --user root container_name bash -c "echo 'test' >> /root/.bashrc"
</code>```

Elsewhere in the /var/www path it works but not in /root.

I checked the rights of the file created in and modified in /var/www and it does belong to root:

```<code>-rw-r--r--   1 root root      0 Dec 21 10:58 test.txt
</code>```

my intention is simply to add the following lines:

```<code>export LS_OPTIONS='--color=auto'
eval "$(dircolors)"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
</code>```

in file ~/.bashrc.

Body:
I am trying to modify the .bashrc file in my container via the:

docker exec  -it --workdir /root --user root container_name bash -c "echo 'test' >> /root/.bashrc"

Elsewhere in the /var/www path it works but not in /root.

I checked the rights of the file created in and modified in /var/www and it does belong to root:

-rw-r--r--   1 root root      0 Dec 21 10:58 test.txt

my intention is simply to add the following lines:

export LS_OPTIONS='--color=auto'
eval "$(dircolors)"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'

in file ~/.bashrc.


问:
find the running queries in the last 24 hours or a particular date
How i can find or get how many queries running in my database, I need queries that start with (Insert, Select, update), I am using SQL Server

I try the below query but I am unable to customize it to get for INSERT statements which run yesterday only for example

```<code>SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE dest.dbid = DB_ID('msdb')
ORDER BY deqs.last_execution_time DESC
</code>```

Body:
How i can find or get how many queries running in my database, I need queries that start with (Insert, Select, update), I am using SQL Server

I try the below query but I am unable to customize it to get for INSERT statements which run yesterday only for example

SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE dest.dbid = DB_ID('msdb')
ORDER BY deqs.last_execution_time DESC


问:
Generating react native release aab
I want to build a release aab from my react native project and after following all the procedure from the reach native doc I’m still not able to do so.

I ejected my code ~expo eject~ and ran ~cd android
./gradlew bundleRelease~ but it keeps failing with this error

```<code>FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
* What went wrong:
Execution failed for task ' :expo-updates:     compileReleasekotlin'.
> Compilation error. See log for more   details

* Try:
5 Run with --stacktrace option to get the      stack trace.
5 Run with
• Run with
-info or - debug option to get more log  output.
-scan to get full insights.
2: Task failed with an exception.
* What went Wrong:
java. lang-StackOverflovError (no error  message)
Z
• Run with - stacktrace option to get the  stack trace.

• Run with
-info or - debug option to get more log   output.
> Run with - scan to get full insights.
© bash - android + Ow
# Get more help at https://help.gradle.org
Execution optimizations have been disabled  for     2 invalid units) of work during this bu  ild to ensure correctness.
Please consult deprecation warnings for  more details.
BUILD FAILED in 5m 21s
333 actionable tasks: 5 executed, 328 up- to-date
</code>```
```<code></code>```

Title: Generating react native release aab

Body:
I want to build a release aab from my react native project and after following all the procedure from the reach native doc I’m still not able to do so.

I ejected my code ~expo eject~ and ran ~cd android
./gradlew bundleRelease~ but it keeps failing with this error

FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
* What went wrong:
Execution failed for task ' :expo-updates:     compileReleasekotlin'.
> Compilation error. See log for more   details

* Try:
5 Run with --stacktrace option to get the      stack trace.
5 Run with
• Run with
-info or - debug option to get more log  output.
-scan to get full insights.
2: Task failed with an exception.
* What went Wrong:
java. lang-StackOverflovError (no error  message)
Z
• Run with - stacktrace option to get the  stack trace.

• Run with
-info or - debug option to get more log   output.
> Run with - scan to get full insights.
© bash - android + Ow
# Get more help at https://help.gradle.org
Execution optimizations have been disabled  for     2 invalid units) of work during this bu  ild to ensure correctness.
Please consult deprecation warnings for  more details.
BUILD FAILED in 5m 21s
333 actionable tasks: 5 executed, 328 up- to-date


问:
Is it possible to set the initial element to display in the List in SwiftUI?
I want to implement a list of events like in the Google Calendar mobile app. When you open the application, the upcoming events are shown, but despite this, you can scroll up and see past events. Is it possible to somehow set an element in the List (i.e. the current date), which will be considered as the beginning of the list to display, but at the same time, when scrolling up, the previous elements of the list were shown?</p>


问:
what is the 1 of N model implementation for GIC600
Working on GIC 600 for 1 of N model for SPI. I have 3 question below

Suppose we have 4 PE. Suppose first core is busy with higher priority task and others are in sleep. what is the decision of GIC?

At what condition the interrupt is divert from one core to another core

Can we route interrupt to specific PE in 1 of N model

Thank you in advance

Explore GIC600 spec but not clear about how GIC behave in different scenarios


问:
Dynamically point to full path using GetExecutingAssembly()
The project I am working on gets configuration by pointing at a folder, in the past the was done by a relative path (e.g. "../../api/data/"), however this was not suitable in all cirumstances as depending on assembly location the relative path to the above would be different, so another method was devised using
System.Reflection.Assembly.GetExecutingAssembly().Location

Ideally we would combine part of the path received from the above with the destination using path.combine() so if the full destination path was "Folder/Core/api/data" and the result  from GetExecutingAssembly() was "Folder/Core/Assembly/Assembly.dll", then the plan was to take everything before "/Assembly/" using something like

assemblyPath.Substring(0, assemblyPath.IndexOf($"/Assembly/"))

then combining the result with  "../../api/data/" to get the full path.

However I can see now that this will not work if the assembly path is different and does not contain /Assembly/. So I am now wondering what is the best way to dynamically get the full path. I thought about using a switch statement based on the deployment, however that is not very futureproof.


问:
Export Model from Unity With Material Colors to MeshLab
I would like to export to Meshlab a mesh created in Unity. Here I added also material colors to some of the model that compose the main one.
enter image description here
But when I import the mesh in Meshlab I don't see the color, but it is grey and in my Meshlab's version I can't apply the color doing: Render -> Color.
enter image description here
Anyone can help me please ? Thank you in advance.</p>


问:
MongoDB Sharded Cluster overloaded
I have a 3 way Sharded Mongo Atlas Cluster. During a high workload scenario, I noticed that 1 Shard 2 is overloaded with all Updates while the reads are distributed to all of them. After certain period, the next shard, maybe Shard 3 starts processing the Updates and at last Shard 1 takes over.

I would like to understand if this behaviour is incorrect, does it mean Shard Key is not the right choice?

And whenever a shard is overloaded with updates, we see Application threads taking part of dirty pages eviction and dirty cache ratio going over 20%

Do these behaviour mean we are constrained on resources or that ShardKey is not efficient??

We checked on Sharding metrics in cluster, there are equal number of chunks and data in each chunk is equal among shards.

Does anyone have clue on what could be reason or what can we further look for?

Title: MongoDB Sharded Cluster overloaded


问:
How to replace the published allure report on jenkins build with new one
```<code>while (run) {

  echo "Updating latest report"

  sh '''
  tar cvfz e2e - artifacts.tar.gz tmp /
  '''
  allure([
    includeProperties: false,
    jdk: '',
    properties: [],
    reportBuildPolicy: 'ALWAYS',
    results: [
      [path: 'allure-results']
    ]
  ])

  archiveArtifacts artifacts: 'e2e-artifacts.tar.gz'
  sleep 3
}
</code>```

I am using the above snippet in a stage in my jenkins pipeline to fetch the latest test allure report and publish is as an artifact on the job. The problem with this is, on every iteration of the loop, i have a separate artifact link and icon added on the build like this:

My question is: how do I remove the already published allure report from the build and replace it with the new one  during every iteration of the loop? So I will only have one icon on the build which will open the latest report

For anybody curious  - the reason why I am running this in a loop is because, I want to keep picking up the latest report every 1 minute or so and publish it

Body:
while (run) {

  echo "Updating latest report"

  sh '''
  tar cvfz e2e - artifacts.tar.gz tmp /
  '''
  allure([
    includeProperties: false,
    jdk: '',
    properties: [],
    reportBuildPolicy: 'ALWAYS',
    results: [
      [path: 'allure-results']
    ]
  ])

  archiveArtifacts artifacts: 'e2e-artifacts.tar.gz'
  sleep 3
}

I am using the above snippet in a stage in my jenkins pipeline to fetch the latest test allure report and publish is as an artifact on the job. The problem with this is, on every iteration of the loop, i have a separate artifact link and icon added on the build like this:

My question is: how do I remove the already published allure report from the build and replace it with the new one  during every iteration of the loop? So I will only have one icon on the build which will open the latest report

For anybody curious  - the reason why I am running this in a loop is because, I want to keep picking up the latest report every 1 minute or so and publish it


问:
Unity object returning on the same axis
I want it to come back when it reaches the max y value. Where is the error in my code? Thanks in advance for those who support.

```<code>void moveRope()
    {
        if (canRotate)
        {
            return;
        }
        if (!canRotate)
        {
            Vector3 temp = transform.position;
            if (moveDown)
            {
                temp -= transform.up * Time.deltaTime * moveSpeed;
            }
            else
            {
                temp += transform.up * Time.deltaTime * moveSpeed;
            }

            transform.position = temp;

            if (temp.y <= min_Y)
            {
                moveDown = false;
            }
            if (temp.y >= initialY)
            {
                canRotate = true;
                moveSpeed = initialMoveSpeed;
            }
        }
    }
</code>```

Diagram of expected behaviour

I want it to come back when it reaches the max y value.

Title: Unity object returning on the same axis

Body:
I want it to come back when it reaches the max y value. Where is the error in my code? Thanks in advance for those who support.

void moveRope()
    {
        if (canRotate)
        {
            return;
        }
        if (!canRotate)
        {
            Vector3 temp = transform.position;
            if (moveDown)
            {
                temp -= transform.up * Time.deltaTime * moveSpeed;
            }
            else
            {
                temp += transform.up * Time.deltaTime * moveSpeed;
            }

            transform.position = temp;

            if (temp.y <= min_Y)
            {
                moveDown = false;
            }
            if (temp.y >= initialY)
            {
                canRotate = true;
                moveSpeed = initialMoveSpeed;
            }
        }
    }

Diagram of expected behaviour

I want it to come back when it reaches the max y value.


问:
Can not access to map directive variables inside location in Nginx config, is there any way to access them?
I'm implementing rate limiting based on the request header value using Nginx and according to the different values of the header, I'd like to have different rate limits per request. In order to do that I've defined a map variable that can be used in other places, but it seems I do not have access to this variable in all places. I've also tried to set the value of this variable to another variable inside the location but it didn't work as well.

Here is my Nginx config file:

```<code>
http {

    map $http_api_key $limit {
    Value1 2;
    default 1;
    }

    limit_req_zone $limit zone=one:10m rate=1r/s;

    server {
        location / {
            limit_req zone=one burst=$limit nodelay;
        }
    }

}
</code>```

The error that I got is nginx: [emerg] invalid burst value "burst=$limit" in Nginx.config

Body:
I'm implementing rate limiting based on the request header value using Nginx and according to the different values of the header, I'd like to have different rate limits per request. In order to do that I've defined a map variable that can be used in other places, but it seems I do not have access to this variable in all places. I've also tried to set the value of this variable to another variable inside the location but it didn't work as well.

Here is my Nginx config file:

http {

    map $http_api_key $limit {
    Value1 2;
    default 1;
    }

    limit_req_zone $limit zone=one:10m rate=1r/s;

    server {
        location / {
            limit_req zone=one burst=$limit nodelay;
        }
    }

}

The error that I got is nginx: [emerg] invalid burst value "burst=$limit" in Nginx.config


问:
dropdown_search with FutureBuilder but I don't know how to extract items data to populate it

i need help to populate a dropdown_search in flutter from a local database

```<code>        Future getList() async {
          final db = await getDatabase();
          final res = await db.rawQuery("SELECT * FROM tb_point_of_Sale");

          List<PointOfSale> list =
          res.isNotEmpty ? res.map((c) => PointOfSale.fromJson(c)).toList() : [];
          return list;
        }
</code>```

I used FutureBuilder but I don't know how to extract items data... HELP PLEASE

```<code>      FutureBuilder(
          future: PointOfSaleDao.db.getAll(),
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            if (!snapshot.hasData) {
              return const Center(
                child: CircularProgressIndicator(),
              );
            } else {
              return DropdownSearch<String>(
                  mode: Mode.MENU,
                  showSearchBox: true,
                  showSelectedItem: true,
                  items: snapshot
                      .data[0].id, //PointOfSaleDao.db.getList(),
                  onChanged: print,
                  hint: "sélectionner",
                  validator: (value) {
                    if (value == null) {
                      return "ce champ est obligatoire !";
                    }
                    return null;
                  });
            }
          },
        )
</code>```

Body:
i need help to populate a dropdown_search in flutter from a local database

        Future getList() async {
          final db = await getDatabase();
          final res = await db.rawQuery("SELECT * FROM tb_point_of_Sale");

          List<PointOfSale> list =
          res.isNotEmpty ? res.map((c) => PointOfSale.fromJson(c)).toList() : [];
          return list;
        }

I used FutureBuilder but I don't know how to extract items data... HELP PLEASE

      FutureBuilder(
          future: PointOfSaleDao.db.getAll(),
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            if (!snapshot.hasData) {
              return const Center(
                child: CircularProgressIndicator(),
              );
            } else {
              return DropdownSearch<String>(
                  mode: Mode.MENU,
                  showSearchBox: true,
                  showSelectedItem: true,
                  items: snapshot
                      .data[0].id, //PointOfSaleDao.db.getList(),
                  onChanged: print,
                  hint: "sélectionner",
                  validator: (value) {
                    if (value == null) {
                      return "ce champ est obligatoire !";
                    }
                    return null;
                  });
            }
          },
        )


问:
App gets minimize on back press at any page in flutter
I have built an application which has around 5 or 6 screen so the problem I am facing right now is the application gets minimize whenever i am pressing back button in some devices (i.e pixel 6a) but the same code is working fine in emulator and in some other phones.

YouTube video of this issue

I tried in multiple devices some devices works fine including emulator but in some device it doesn't


问:
mongoose dosent return all Records
i have problem to mongoose query

when mongoo compass run this query

```<code>{ role: 'sales-agent', 'city.areaCodes': null }
</code>```

in mongoCompass  return
179
records

but when run this query in my codes
`

```<code>this.userDbService.findAll({ role: 'sales-agent', 'city.areaCodes': null }
</code>```

return 4 records

this is my dbService

async findAll(filter: FilterQuery<UserModel>, selectFields?): Promise<UserModel[]> {
        return this.userModel.find({ ...filter }, selectFields)   }```

what should i do  to return all documnet in my collection??

im search in mongodbquery and i study mongoose query paginition but doset work

Title: mongoose dosent return all Records

Body:
i have problem to mongoose query

when mongoo compass run this query

{ role: 'sales-agent', 'city.areaCodes': null }

in mongoCompass  return
179
records

but when run this query in my codes
`

this.userDbService.findAll({ role: 'sales-agent', 'city.areaCodes': null }

return 4 records

this is my dbService

async findAll(filter: FilterQuery<UserModel>, selectFields?): Promise<UserModel[]> {
        return this.userModel.find({ ...filter }, selectFields)   }

what should i do  to return all documnet in my collection??

im search in mongodbquery and i study mongoose query paginition but doset work


问:
TypeError: undefined is not an object (evaluating '_app.default.initializeApp')
i got this problem when i try to save all date in firebase realTime Database pressing submit.

ERROR  TypeError: undefined is not an object (evaluating '_app.default.initializeApp')

```<code>import firebase from 'firebase';
import React, { useState } from 'react';
import { View, Text, Modal, TouchableOpacity, FlatList, StyleSheet, DatePickerIOS, Image } from 'react-native';
import { Picker } from '@react-native-picker/picker';

const App = () => {
  const [chosenDate, setChosenDate] = useState(new Date());
  const [selectedValue, setSelectedValue] = useState('Alege Specializarea');
  const [selectedDoctor, setSelectedDoctor] = useState('');
  const [modalVisible, setModalVisible] = useState(false);
  const [showPicker, setShowPicker] = useState(false);
  const [showButtons, setShowButtons] = useState(false);

  const options = ['Alege Specializarea', 'Cardiologie', 'Dermatologie', 'Oftalmologie', 'Analize Medicale'];

  const optionMapping = {
    'Alege Specializarea': [],
    'Cardiologie': ['Dr. Alex', 'Dr. Balut'],
    'Dermatologie': ['Dr. Chloe', 'Dr. David'],
    'Oftalmologie': ['Dr. Emily', 'Dr. Frank'],
    'Analize Medicale': ['Dr. Grace', 'Dr. Henry'],
  };

  const firebaseConfig = {
    apiKey: "AIzaSyBhyYCXEaUlXqr83GtcbAfV2fiFooGzm2k",
    authDomain: "first-app-7901e.firebaseapp.com",
    databaseURL: "https://first-app-7901e-default-rtdb.europe-west1.firebasedatabase.app",
    projectId: "first-app-7901e",
    storageBucket: "first-app-7901e.appspot.com",
    messagingSenderId: "876718439254",
    appId: "1:876718439254:web:afe7784b89f066210334f7",
  };

  firebase.initializeApp(firebaseConfig);

  const writeAppointmentData = (appointment) => {
    firebase
      .database()
      .ref('appointments/' + appointment.id)
      .set(appointment);
  };

  // Read data from the database
  const readAppointmentData = (appointmentId) => {
    return firebase
      .database()
      .ref('appointments/' + appointmentId)
      .once('value')
      .then((snapshot) => {
        return snapshot.val();
      });
  };

  const handleSubmit = () => {
    const appointment = {
      date: chosenDate,
      specialization: selectedValue,
      doctor: selectedDoctor,
    };

    writeAppointmentData(appointment);
    setModalVisible(true);
  };

  const handleRead = () => {
    readAppointmentData(appointmentId).then((appointment) => {
      setAppointment(appointment);
    });
  };

  return (
    <>
      <View style={styles.container}>
        <Image source={require('./book.png')} style={styles.image} />
      </View>
      <View style={styles.container}>
        <DatePickerIOS
          date={chosenDate}
          onDateChange={setChosenDate}
          minuteInterval={30}
        />
        <TouchableOpacity
          style={styles.selectionButton}
          onPress={() => setShowPicker(!showPicker)}
        >
          <Text style={styles.selectionButtonText}>{selectedValue}</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={styles.submitButton}
          onPress={handleSubmit}
        >
          <Text style={styles.submitButtonText}>Submit</Text>
        </TouchableOpacity>
        {showPicker && (
          <Picker
            selectedValue={selectedValue}
            style={styles.picker}
            onValueChange={(itemValue) => {
              setSelectedValue(itemValue);
              setShowButtons(itemValue !== 'Alege Specializarea');
            }}
          >
            {options.map((option) => (
              <Picker.Item
                label={option}
                value={option}
                key={option}
              />
            ))}
          </Picker>
        )}
        {showButtons && optionMapping[selectedValue].length > 0 && (
          <View style={styles.buttonContainer}>
            {optionMapping[selectedValue].map((buttonName) => (
              <TouchableOpacity
                style={[
                  styles.button,
                  buttonName === selectedDoctor && {
                    backgroundColor: '#24b6d4',
                  },
                ]}
                key={buttonName}
                onPress={() => setSelectedDoctor(buttonName)}
              >
                <Text
                  style={[
                    styles.buttonText,
                    buttonName === selectedDoctor && { color: 'white' },
                  ]}
                >
                  {buttonName}
                </Text>
              </TouchableOpacity>
            ))}
          </View>
        )}
      </View>
      <Modal
        animationType="slide"
        transparent={true}
        visible={modalVisible}
      >
        <View style={styles.centeredView}>
          <View style={styles.modalView}>
            <Text style={styles.modalText}>
              Your appointment has been scheduled for{' '}
              {chosenDate.toString()} with {selectedDoctor}
            </Text>
            <TouchableOpacity
              style={styles.modalButton}
              onPress={() => setModalVisible(false)}
            >
              <Text style={styles.modalButtonText}>Close</Text>
            </TouchableOpacity>
          </View>
        </View>
      </Modal>
    </>
  );
};

const styles = StyleSheet.create({
  container: {
    top: -160,
    flex: 1,
    width: 350,
    justifyContent: 'center',
  },
  image: {
    alignSelf: 'center',
  },
  selectionButton: {
    backgroundColor: 'lightgray',
    padding: 10,
    borderRadius: 10,
    left: 20,
  },
  selectionButtonText: {
    fontSize: 18,
  },
  picker: {
    width: '100%',
  },
  buttonContainer: {
    flexDirection: 'row',
    justifyContent: 'center',
  },
  button: {
    backgroundColor: '#fff',
    borderWidth: 1,
    borderColor: '#24b6d4',
    borderRadius: 10,
    padding: 10,
    margin: 10,
    width: 120,
  },
  buttonText: {
    color: '#24b6d4',
    fontSize: 18,
    textAlign: 'center',
  },
  submitButton: {
    backgroundColor: '#24b6d4',
    borderRadius: 10,
    padding: 10,
    margin: 10,
  },
  submitButtonText: {
    color: 'white',
    fontSize: 18,
    textAlign: 'center',
  },
  centeredView: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 22,
  },
  modalView: {
    margin: 20,
    backgroundColor: 'white',
    borderRadius: 20,
    padding: 35,
    alignItems: 'center',
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2,
    },
    shadowOpacity: 0.25,
    shadowRadius: 3.84,
    elevation: 5,
  },
  modalText: {
    marginBottom: 15,
    textAlign: 'center',
  },
  modalButton: {
    backgroundColor: '#24b6d4',
    borderRadius: 10,
    padding: 10,
    margin: 10,
  },
  modalButtonText: {
    color: 'white',
    fontSize: 18,
    textAlign: 'center',
  },
});

export default App;
</code>```

I use ExpoGO to "export" the project.

I tried  many changes at firebase like: import firebase from 'firebase'; and all that changes for import firebase,none of that works but i tried with  Firebase JS SDK and still dosent work.

Body:
i got this problem when i try to save all date in firebase realTime Database pressing submit.

ERROR  TypeError: undefined is not an object (evaluating '_app.default.initializeApp')

import firebase from 'firebase';
import React, { useState } from 'react';
import { View, Text, Modal, TouchableOpacity, FlatList, StyleSheet, DatePickerIOS, Image } from 'react-native';
import { Picker } from '@react-native-picker/picker';

const App = () => {
  const [chosenDate, setChosenDate] = useState(new Date());
  const [selectedValue, setSelectedValue] = useState('Alege Specializarea');
  const [selectedDoctor, setSelectedDoctor] = useState('');
  const [modalVisible, setModalVisible] = useState(false);
  const [showPicker, setShowPicker] = useState(false);
  const [showButtons, setShowButtons] = useState(false);

  const options = ['Alege Specializarea', 'Cardiologie', 'Dermatologie', 'Oftalmologie', 'Analize Medicale'];

  const optionMapping = {
    'Alege Specializarea': [],
    'Cardiologie': ['Dr. Alex', 'Dr. Balut'],
    'Dermatologie': ['Dr. Chloe', 'Dr. David'],
    'Oftalmologie': ['Dr. Emily', 'Dr. Frank'],
    'Analize Medicale': ['Dr. Grace', 'Dr. Henry'],
  };

  const firebaseConfig = {
    apiKey: "AIzaSyBhyYCXEaUlXqr83GtcbAfV2fiFooGzm2k",
    authDomain: "first-app-7901e.firebaseapp.com",
    databaseURL: "https://first-app-7901e-default-rtdb.europe-west1.firebasedatabase.app",
    projectId: "first-app-7901e",
    storageBucket: "first-app-7901e.appspot.com",
    messagingSenderId: "876718439254",
    appId: "1:876718439254:web:afe7784b89f066210334f7",
  };

  firebase.initializeApp(firebaseConfig);

  const writeAppointmentData = (appointment) => {
    firebase
      .database()
      .ref('appointments/' + appointment.id)
      .set(appointment);
  };

  // Read data from the database
  const readAppointmentData = (appointmentId) => {
    return firebase
      .database()
      .ref('appointments/' + appointmentId)
      .once('value')
      .then((snapshot) => {
        return snapshot.val();
      });
  };

  const handleSubmit = () => {
    const appointment = {
      date: chosenDate,
      specialization: selectedValue,
      doctor: selectedDoctor,
    };

    writeAppointmentData(appointment);
    setModalVisible(true);
  };

  const handleRead = () => {
    readAppointmentData(appointmentId).then((appointment) => {
      setAppointment(appointment);
    });
  };

  return (
    <>
      <View style={styles.container}>
        <Image source={require('./book.png')} style={styles.image} />
      </View>
      <View style={styles.container}>
        <DatePickerIOS
          date={chosenDate}
          onDateChange={setChosenDate}
          minuteInterval={30}
        />
        <TouchableOpacity
          style={styles.selectionButton}
          onPress={() => setShowPicker(!showPicker)}
        >
          <Text style={styles.selectionButtonText}>{selectedValue}</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={styles.submitButton}
          onPress={handleSubmit}
        >
          <Text style={styles.submitButtonText}>Submit</Text>
        </TouchableOpacity>
        {showPicker && (
          <Picker
            selectedValue={selectedValue}
            style={styles.picker}
            onValueChange={(itemValue) => {
              setSelectedValue(itemValue);
              setShowButtons(itemValue !== 'Alege Specializarea');
            }}
          >
            {options.map((option) => (
              <Picker.Item
                label={option}
                value={option}
                key={option}
              />
            ))}
          </Picker>
        )}
        {showButtons && optionMapping[selectedValue].length > 0 && (
          <View style={styles.buttonContainer}>
            {optionMapping[selectedValue].map((buttonName) => (
              <TouchableOpacity
                style={[
                  styles.button,
                  buttonName === selectedDoctor && {
                    backgroundColor: '#24b6d4',
                  },
                ]}
                key={buttonName}
                onPress={() => setSelectedDoctor(buttonName)}
              >
                <Text
                  style={[
                    styles.buttonText,
                    buttonName === selectedDoctor && { color: 'white' },
                  ]}
                >
                  {buttonName}
                </Text>
              </TouchableOpacity>
            ))}
          </View>
        )}
      </View>
      <Modal
        animationType="slide"
        transparent={true}
        visible={modalVisible}
      >
        <View style={styles.centeredView}>
          <View style={styles.modalView}>
            <Text style={styles.modalText}>
              Your appointment has been scheduled for{' '}
              {chosenDate.toString()} with {selectedDoctor}
            </Text>
            <TouchableOpacity
              style={styles.modalButton}
              onPress={() => setModalVisible(false)}
            >
              <Text style={styles.modalButtonText}>Close</Text>
            </TouchableOpacity>
          </View>
        </View>
      </Modal>
    </>
  );
};

const styles = StyleSheet.create({
  container: {
    top: -160,
    flex: 1,
    width: 350,
    justifyContent: 'center',
  },
  image: {
    alignSelf: 'center',
  },
  selectionButton: {
    backgroundColor: 'lightgray',
    padding: 10,
    borderRadius: 10,
    left: 20,
  },
  selectionButtonText: {
    fontSize: 18,
  },
  picker: {
    width: '100%',
  },
  buttonContainer: {
    flexDirection: 'row',
    justifyContent: 'center',
  },
  button: {
    backgroundColor: '#fff',
    borderWidth: 1,
    borderColor: '#24b6d4',
    borderRadius: 10,
    padding: 10,
    margin: 10,
    width: 120,
  },
  buttonText: {
    color: '#24b6d4',
    fontSize: 18,
    textAlign: 'center',
  },
  submitButton: {
    backgroundColor: '#24b6d4',
    borderRadius: 10,
    padding: 10,
    margin: 10,
  },
  submitButtonText: {
    color: 'white',
    fontSize: 18,
    textAlign: 'center',
  },
  centeredView: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 22,
  },
  modalView: {
    margin: 20,
    backgroundColor: 'white',
    borderRadius: 20,
    padding: 35,
    alignItems: 'center',
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2,
    },
    shadowOpacity: 0.25,
    shadowRadius: 3.84,
    elevation: 5,
  },
  modalText: {
    marginBottom: 15,
    textAlign: 'center',
  },
  modalButton: {
    backgroundColor: '#24b6d4',
    borderRadius: 10,
    padding: 10,
    margin: 10,
  },
  modalButtonText: {
    color: 'white',
    fontSize: 18,
    textAlign: 'center',
  },
});

export default App;

I use ExpoGO to "export" the project.

I tried  many changes at firebase like: import firebase from 'firebase'; and all that changes for import firebase,none of that works but i tried with  Firebase JS SDK and still dosent work.


问:
Memory error in python while concate many excel file in one excel file
I want to combine many CSV files in one CSV file but it through me error this is my code

```<code>data_files=sorted(glob('C://Users//Home//Desktop//CSIC 2017//MachineLearningCVE//data*.csv'))
data_files
dfList = []
for data_file in data_files:
    df = pd.read_csv(data_file, header=None)
    dfList.append(df)
</code>```

this is the error

```<code>C:\Users\Home\AppData\Local\Temp\ipykernel_7624\4284368016.py:3: DtypeWarning: Columns (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76) have mixed types. Specify dtype option on import or set low_memory=False.
  df = pd.read_csv(data_file, header=None)
</code>```

Body:
I want to combine many CSV files in one CSV file but it through me error this is my code

data_files=sorted(glob('C://Users//Home//Desktop//CSIC 2017//MachineLearningCVE//data*.csv'))
data_files
dfList = []
for data_file in data_files:
    df = pd.read_csv(data_file, header=None)
    dfList.append(df)

this is the error

C:\Users\Home\AppData\Local\Temp\ipykernel_7624\4284368016.py:3: DtypeWarning: Columns (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76) have mixed types. Specify dtype option on import or set low_memory=False.
  df = pd.read_csv(data_file, header=None)


问:
How To Capture image & sent it to backend (Express) in react js
` In react.js i want to capture image & send image to backend using formik & mutation for reference In the Below code, I saved information with image capturing but a problem to send it to backend. So how can I send image to backend?

`

```<code>function PwaWebcam() {

    const classes = useStyles();

    const [source, setSource] = useState("");

    const handleCapture = (target) => {

        if (target.files) {

            if (target.files.length !== 0) {

                const file = target.files[0];
                const newUrl = URL.createObjectURL(file);
                setSource(newUrl);
            }
        }
    };

    const handleSave = () => {
        const screenCaptureSource = source;
        const downloadLink = document.createElement('a');
        const fileName = 'react-screen-capture.png';

        downloadLink.href = screenCaptureSource;
        downloadLink.download = fileName;
        downloadLink.click();
    };
</code>```
```<code><input
                        accept="image/*"
                        className={classes.input}
                        id="icon-button-file"
                        type="file"
                        capture="environment"
                        onChange={(e) => handleCapture(e.target)}
                    />

                    <label htmlFor="icon-button-file">
                        <IconButton
                            color="primary"
                            aria-label="upload picture"
                            component="span"
                        >
                            <PhotoCameraRoundedIcon fontSize="large" color="primary" />
                        </IconButton>
                    </label>

</code>```

Body:
` In react.js i want to capture image & send image to backend using formik & mutation for reference In the Below code, I saved information with image capturing but a problem to send it to backend. So how can I send image to backend?

`

function PwaWebcam() {

    const classes = useStyles();

    const [source, setSource] = useState("");

    const handleCapture = (target) => {

        if (target.files) {

            if (target.files.length !== 0) {

                const file = target.files[0];
                const newUrl = URL.createObjectURL(file);
                setSource(newUrl);
            }
        }
    };

    const handleSave = () => {
        const screenCaptureSource = source;
        const downloadLink = document.createElement('a');
        const fileName = 'react-screen-capture.png';

        downloadLink.href = screenCaptureSource;
        downloadLink.download = fileName;
        downloadLink.click();
    };

<input
                        accept="image/*"
                        className={classes.input}
                        id="icon-button-file"
                        type="file"
                        capture="environment"
                        onChange={(e) => handleCapture(e.target)}
                    />

                        <IconButton
                            color="primary"
                            aria-label="upload picture"
                            component="span"
                        >
                            <PhotoCameraRoundedIcon fontSize="large" color="primary" />
                        </IconButton>


问:
Is LazyLoading broken in Angular ? ChunkLoadError: Loading chunk xxx failed
Having the following in the app-routing.module.ts of my Angular 15 application:

```<code>import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { AuthorizationGuard } from './core/authorization/authorization.guard';
import { LoginComponent } from './core/authorization/login/login.component';
import { RolesGuard } from './core/authorization/roles.guard';
import { ErrorComponent } from './error/error.component';
import { HomeComponent } from './home/home.component';
import { ProjectModule } from './project/project.module';

const routes: Routes = [
  {
    path: 'home',
    component: HomeComponent,
    canActivate: [AuthorizationGuard]
  },
  {
    path: 'projects',
    loadChildren: () => ProjectModule, //  import('./project/project.module').then(m => m.ProjectModule)
    canActivate: [AuthorizationGuard]
  },
  {
    path: 'admin',
    loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule),
    canActivate: [AuthorizationGuard, RolesGuard],
    data: { roles: ['admin', 'admin-dsn'] }
  },
  { path: 'login', component: LoginComponent },
  { path: 'error/:status', component: ErrorComponent },
  { path: '', redirectTo: 'projects', pathMatch: 'full' },
  { path: '**', redirectTo: 'error/404' }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
</code>```

If I understand well, the commented code activated the lazy loading. When using the commented code I had the follwing error:

app-routing.module.ts:18 ERROR Error: Uncaught (in promise): ChunkLoadError: Loading chunk Client_app_project_project_module_ts failed. (missing: http://localhost:4200/Client_app_project_project_module_ts.js) ChunkLoadError: Loading chunk Client_app_project_project_module_ts failed. (missing: http://localhost:4200/Client_app_project_project_module_ts.js) at webpack_require.f.j (jsonp chunk loading:27:1) at ensure chunk:6:1

searching similar issues on SO, like this I see that the proposed solution is to reload the page when such errors arrives...

I am not sure if hardly reloading the page when arbitrary errors like this are caught is a really good idea. Could someone explain what for is that "lazy loading", is it broken in Angular and if yes should it be fixed or it's a normal behavior?

PS.

If I restore the

```<code>loadChildren: () => import('./project/project.module').then(m => m.ProjectModule),
</code>```

and comment out all the project.competent code leaving only the declaration in .ts

```<code>@Component({
  selector: 'project',
  templateUrl: './project.component.html',
  styleUrls: ['./project.component.scss']
})
export class ProjectComponent {}
</code>```

and reduce the project.component.html to
project component
 still get the same Chunk error.

Body:
Having the following in the app-routing.module.ts of my Angular 15 application:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { AuthorizationGuard } from './core/authorization/authorization.guard';
import { LoginComponent } from './core/authorization/login/login.component';
import { RolesGuard } from './core/authorization/roles.guard';
import { ErrorComponent } from './error/error.component';
import { HomeComponent } from './home/home.component';
import { ProjectModule } from './project/project.module';

const routes: Routes = [
  {
    path: 'home',
    component: HomeComponent,
    canActivate: [AuthorizationGuard]
  },
  {
    path: 'projects',
    loadChildren: () => ProjectModule, //  import('./project/project.module').then(m => m.ProjectModule)
    canActivate: [AuthorizationGuard]
  },
  {
    path: 'admin',
    loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule),
    canActivate: [AuthorizationGuard, RolesGuard],
    data: { roles: ['admin', 'admin-dsn'] }
  },
  { path: 'login', component: LoginComponent },
  { path: 'error/:status', component: ErrorComponent },
  { path: '', redirectTo: 'projects', pathMatch: 'full' },
  { path: '**', redirectTo: 'error/404' }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

If I understand well, the commented code activated the lazy loading. When using the commented code I had the follwing error:

app-routing.module.ts:18 ERROR Error: Uncaught (in promise): ChunkLoadError: Loading chunk Client_app_project_project_module_ts failed. (missing: http://localhost:4200/Client_app_project_project_module_ts.js) ChunkLoadError: Loading chunk Client_app_project_project_module_ts failed. (missing: http://localhost:4200/Client_app_project_project_module_ts.js) at webpack_require.f.j (jsonp chunk loading:27:1) at ensure chunk:6:1

searching similar issues on SO, like this I see that the proposed solution is to reload the page when such errors arrives...

I am not sure if hardly reloading the page when arbitrary errors like this are caught is a really good idea. Could someone explain what for is that "lazy loading", is it broken in Angular and if yes should it be fixed or it's a normal behavior?

PS.

If I restore the

loadChildren: () => import('./project/project.module').then(m => m.ProjectModule),

and comment out all the project.competent code leaving only the declaration in .ts

@Component({
  selector: 'project',
  templateUrl: './project.component.html',
  styleUrls: ['./project.component.scss']
})
export class ProjectComponent {}

and reduce the project.component.html to
project component
 still get the same Chunk error.


问:
Dotnet core 6, Custom Config Provider doesn't work when hosted in Windows Service
I have written custom ConfigurationProvider so that the application ( .net Core 6 ) is able to read configuration from the database. This works as expected when running from Visual Studio or running the output .exe file from command line, however when I try to run it as a Windows Service the config from database is not added. See code below with the appropriate comments

private static IHost CreateHost(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                            .ConfigureHostConfiguration(configBuilder =>
                            {
                                var builder = new ConfigurationBuilder()
                                    .SetBasePath(Directory.GetCurrentDirectory())
                                    .AddJsonFile("appSettings.json", optional: true, reloadOnChange: true);
                                IConfigurationRoot configuration = builder.Build();
                                var dbConfig = configuration.GetSection("DatabaseConfig");

                                // Get connection string from appSettings.json and add SqlConfigurationProvider
                                configBuilder.AddSqlDatabase(config =>
                                {
                                    config.ConnectionString = dbConfig["ConnectionString"];
                                    config.RefreshInterval = TimeSpan.FromMinutes(1);
                                });
                            })
                            .ConfigureServices((host, services) =>
                            {
                                var myConfigSection = host.Configuration.GetSection("MyConfigSection");
                                var myConfigValue = myConfigSection["MyConfig"];

                                // When running from VS or CMD myConfigValue is properly taken from the database
                                // When running from Windows Service myConfigValue will be null suggesting SqlConfigurationProvider has not been added
                                if (string.IsNullOrEmpty(myConfigValue))
                                    throw new ArgumentException("Config is missing");

                                services.AddHostedService<WorkerProcess>();
                            })
                            .UseWindowsService(options =>
                            {
                                options.ServiceName = "MyService";
                            })
                            .Build();
        }
```

I suppose that when we call UseWindowsService the host configuration is ignored and that's the reason but that's just the assumption.
What is the proper way of registering Custom Configuration Provider when running the app as Windows Service ?

Edit

I have tried using ConfigureAppConfiguration instead of ConfigureHostConfiguration but the result is unfortunately the same

Body:
I have written custom ConfigurationProvider so that the application ( .net Core 6 ) is able to read configuration from the database. This works as expected when running from Visual Studio or running the output .exe file from command line, however when I try to run it as a Windows Service the config from database is not added. See code below with the appropriate comments

private static IHost CreateHost(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                            .ConfigureHostConfiguration(configBuilder =>
                            {
                                var builder = new ConfigurationBuilder()
                                    .SetBasePath(Directory.GetCurrentDirectory())
                                    .AddJsonFile("appSettings.json", optional: true, reloadOnChange: true);
                                IConfigurationRoot configuration = builder.Build();
                                var dbConfig = configuration.GetSection("DatabaseConfig");

                                // Get connection string from appSettings.json and add SqlConfigurationProvider
                                configBuilder.AddSqlDatabase(config =>
                                {
                                    config.ConnectionString = dbConfig["ConnectionString"];
                                    config.RefreshInterval = TimeSpan.FromMinutes(1);
                                });
                            })
                            .ConfigureServices((host, services) =>
                            {
                                var myConfigSection = host.Configuration.GetSection("MyConfigSection");
                                var myConfigValue = myConfigSection["MyConfig"];

                                // When running from VS or CMD myConfigValue is properly taken from the database
                                // When running from Windows Service myConfigValue will be null suggesting SqlConfigurationProvider has not been added
                                if (string.IsNullOrEmpty(myConfigValue))
                                    throw new ArgumentException("Config is missing");

                                services.AddHostedService<WorkerProcess>();
                            })
                            .UseWindowsService(options =>
                            {
                                options.ServiceName = "MyService";
                            })
                            .Build();
        }

I suppose that when we call UseWindowsService the host configuration is ignored and that's the reason but that's just the assumption.
What is the proper way of registering Custom Configuration Provider when running the app as Windows Service ?

Edit

I have tried using ConfigureAppConfiguration instead of ConfigureHostConfiguration but the result is unfortunately the same