问:
How does an object that contains two start and end dates
```<code> useEffect(() => {
    client
      .fetch(
        `*[_type == "indicadore-chave_autonomia_da_tomada_decissao"]{
          indicadores_chave,
          genero,
          icf,
          data{
            inicio,
            fim
          },
          fonte,
          total
      }| order(indicadores_chave asc)`
      )
      .then(data => {
        setDecisionData(data)
      })
      .catch(console.error)
  }, [])

  const [dicisionData, setDecisionData] = useState([])

  const rowData = dicisionData.map(item => ({
    IndicadoresChave: item.indicadores_chave,
    Total: item.total,
    Femenino: item.genero.femenino,
    Masculino: item.genero.masculino,
    ICF: item.icf,
    Data: format(new Date([item.data?.inicio, item.date?.fim]), 'yyyy'),
    Fonte: item.fonte
  }))
</code>```

I'm using sanity with back end and date-fn to format dates, I'm trying to format two dates start and end, but this just formatting one date and the other is not showing up

Translation

data{             inicio,             fim           }.Portuguese

data{             start,             end           }English

Body:
 useEffect(() => {
    client
      .fetch(
        `*[_type == "indicadore-chave_autonomia_da_tomada_decissao"]{
          indicadores_chave,
          genero,
          icf,
          data{
            inicio,
            fim
          },
          fonte,
          total
      }| order(indicadores_chave asc)`
      )
      .then(data => {
        setDecisionData(data)
      })
      .catch(console.error)
  }, [])

  const [dicisionData, setDecisionData] = useState([])

  const rowData = dicisionData.map(item => ({
    IndicadoresChave: item.indicadores_chave,
    Total: item.total,
    Femenino: item.genero.femenino,
    Masculino: item.genero.masculino,
    ICF: item.icf,
    Data: format(new Date([item.data?.inicio, item.date?.fim]), 'yyyy'),
    Fonte: item.fonte
  }))

I'm using sanity with back end and date-fn to format dates, I'm trying to format two dates start and end, but this just formatting one date and the other is not showing up

Translation

data{             inicio,             fim           }.Portuguese

data{             start,             end           }English


来源: stackexchange

问:
How to display CZML polygons in real time
My code changes the value (time, polygon height) of sql to express czml at regular intervals. When czml with interval time between 1:00 and 2:00 moves to a czml file with interval time between 2:00 and 3:00, the error "DeveloperError: Normalized result is not a number" is generated.

How do I connect the 1:00-2:00 czml file to the 2:00-3:00 czml file without errors?

This is my czml file.

        const exresult = [
          {
            id: "document",
            name: "CZML Custom Properties",
            version: "1.0",
            clock: {
              interval: TotalDate2,
              currentTime: date_re1,
              multiplier: 300,
            },
          },
          {
            id: "water_extrudedheight",
            name: "An object with custom properties",
            properties: {
              constant_property: true,
              population_sampled: {
                number: [date_re1, result6[0], date_re2, result6[1]],
              },
            },
          },
          {
            id: "colorado",
            name: "Colorado",
            polygon: {
              positions: {
                cartographicDegrees: [
                  128.818153,
                  37.699167,
                  0,
                  128.189289,
                  37.698488,
                  0,
                  128.818186,
                  37.696908,
                  0,
                  128.814783,
                  37.697982,
                  0,
                ],
              },
              material: {
                solidColor: {
                  color: {
                    rgba: [0, 255, 0, 150],
                  },
                },
              },
              height: 208.652,
              extrudedHeight: 208.652,
            },
          },
        ];
```

The first czml is expressed without errors even if it is repeated.

However, if the interval time and the number time at the bottom of population_sampled change, the error "DeveloperError: Normalized result is not a number" will occur.

I thought the interval time was a problem, so I set the interval time to 24 hours and set only the value of number to be different, but if the interval time and the time size of number are not the same, I confirmed that the same error appears.

ContentLicense: CC BY-SA 4.0

Body:
My code changes the value (time, polygon height) of sql to express czml at regular intervals. When czml with interval time between 1:00 and 2:00 moves to a czml file with interval time between 2:00 and 3:00, the error "DeveloperError: Normalized result is not a number" is generated.

How do I connect the 1:00-2:00 czml file to the 2:00-3:00 czml file without errors?

This is my czml file.

        const exresult = [
          {
            id: "document",
            name: "CZML Custom Properties",
            version: "1.0",
            clock: {
              interval: TotalDate2,
              currentTime: date_re1,
              multiplier: 300,
            },
          },
          {
            id: "water_extrudedheight",
            name: "An object with custom properties",
            properties: {
              constant_property: true,
              population_sampled: {
                number: [date_re1, result6[0], date_re2, result6[1]],
              },
            },
          },
          {
            id: "colorado",
            name: "Colorado",
            polygon: {
              positions: {
                cartographicDegrees: [
                  128.818153,
                  37.699167,
                  0,
                  128.189289,
                  37.698488,
                  0,
                  128.818186,
                  37.696908,
                  0,
                  128.814783,
                  37.697982,
                  0,
                ],
              },
              material: {
                solidColor: {
                  color: {
                    rgba: [0, 255, 0, 150],
                  },
                },
              },
              height: 208.652,
              extrudedHeight: 208.652,
            },
          },
        ];

The first czml is expressed without errors even if it is repeated.

However, if the interval time and the number time at the bottom of population_sampled change, the error "DeveloperError: Normalized result is not a number" will occur.

I thought the interval time was a problem, so I set the interval time to 24 hours and set only the value of number to be different, but if the interval time and the time size of number are not the same, I confirmed that the same error appears.


问:
Redux toolkit how to call action from other slice on one action fullfilled

I have a async action name  editLoginIdData() in loginsIdSlice.js,
which i am dispatching from certain component, which edits the data in mongoDB database, then when the action is fullfilled, i mutate the state in extraReducers
editLoginIdData.fulfilled.

But now what i want to do that whenever the editLoginIdData action is fullfilled
i want to also add the updated(which i will get from server responese -> updatedData at editLoginIdData()) data to activitiesData state, which i am handling in  activitiesSlice.js

So basically is there a way that when editLoginIdData action is fullfilled we can
dispatch somehow mutate the state in other slice.

One approach i have taken is to import the editLoginIdData() action in activitiesSlice.js and then creating a extraReducer with editLoginIdData.fullfilled
and mutating  activitiesData state.

I have done the above approach  and seems its working correctly.

But there is a catch, like how show i get the response data at editLoginIdData()
to passed to activitiesSlice.js because i will required that updated data.

if the above appraoch is not correct, then how should i do it

loginsIdSlice.js

```<code>import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import * as api from "../../api"

const initialState = {
    loginsIdData: [],
}

export const fecthLoginIdsData = createAsyncThunk("loginIds/fetch", async ({ user_id }, { getState }) => {
    const res = await api.fetchUserLoginIds(user_id);
    console.log(res);
    const { data } = res;
    data.reverse();
    return data;
});

export const addNewLoginIdData = createAsyncThunk("loginIds/add", async ({ data, user_id }, { getState }) => {
    const res = await api.addNewLoginIdA(data, user_id)
    const { loginIdsArray } = res.data;
    return loginIdsArray[loginIdsArray.length - 1];
});

export const editLoginIdData = createAsyncThunk("loginIds/edit", async ({ updatedData, login_id }, { getState }) => {
    const res = await api.editLoginId(login_id, updatedData);
    // console.log(updatedData);
    return updatedData;
});

export const deleteLoginData = createAsyncThunk("loginIds/delete", async ({ login_id, user_id }, { getState }) => {
    const res = await api.deleteLoginId(login_id, user_id);
    // console.log(res);
    const { data } = res;
    // console.log(data);
    return data.reverse();
});

//* Slice
const loginsIdSlice = createSlice({

    name: 'loginsId',
    initialState: initialState,

    extraReducers: (builder) => {
        builder.
            addCase(fecthLoginIdsData.fulfilled, (state, action) => {
                return {
                    ...state,
                    loginsIdData: action.payload
                };
            }).
            addCase(addNewLoginIdData.fulfilled, (state, action) => {
                return {
                    ...state,
                    loginsIdData: [action.payload, ...state.loginsIdData]
                };
            }).
            addCase(editLoginIdData.fulfilled, (state, action) => {
                const newArray = state.loginsIdData.map((loginId) => {
                    if (loginId._id === action.payload._id) {
                        return action.payload;
                    } else {
                        return loginId;
                    }
                });
                return {
                    ...state,
                    loginsIdData: newArray,
                };
            }).
            addCase(deleteLoginData.fulfilled, (state, action) => {
                return {
                    ...state,
                    loginsIdData: action.payload
                };
            })

    }

})

export const { deleteLoginId, editLoginId } = loginsIdSlice.actions;

export default loginsIdSlice.reducer;

</code>```

activitiesSlice

```<code>import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import * as api from "../../api"

import { editLoginIdData } from "../loginsId/loginsIdSlice"

const initialState = {
    activitiesData: [],
}

const activitiesSlice = createSlice({

    name: 'activities',
    initialState: initialState,

    extraReducers: (builder) => {
        builder.
            addCase(editLoginIdData.fullfilled, (state, action) => {
                console.log("ss")
                return {
                    ...state,
                    activitiesData: []
                };
            })

    }

})

export default activitiesSlice.reducer;

</code>```

Is there a way that when editLoginIdData action is fullfilled we can
dispatch somehow mutate the state in other slice.

Body:
I have a async action name  editLoginIdData() in loginsIdSlice.js,
which i am dispatching from certain component, which edits the data in mongoDB database, then when the action is fullfilled, i mutate the state in extraReducers
editLoginIdData.fulfilled.

But now what i want to do that whenever the editLoginIdData action is fullfilled
i want to also add the updated(which i will get from server responese -> updatedData at editLoginIdData()) data to activitiesData state, which i am handling in  activitiesSlice.js

So basically is there a way that when editLoginIdData action is fullfilled we can
dispatch somehow mutate the state in other slice.

One approach i have taken is to import the editLoginIdData() action in activitiesSlice.js and then creating a extraReducer with editLoginIdData.fullfilled
and mutating  activitiesData state.

I have done the above approach  and seems its working correctly.

But there is a catch, like how show i get the response data at editLoginIdData()
to passed to activitiesSlice.js because i will required that updated data.

if the above appraoch is not correct, then how should i do it

loginsIdSlice.js

import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import * as api from "../../api"

const initialState = {
    loginsIdData: [],
}

export const fecthLoginIdsData = createAsyncThunk("loginIds/fetch", async ({ user_id }, { getState }) => {
    const res = await api.fetchUserLoginIds(user_id);
    console.log(res);
    const { data } = res;
    data.reverse();
    return data;
});

export const addNewLoginIdData = createAsyncThunk("loginIds/add", async ({ data, user_id }, { getState }) => {
    const res = await api.addNewLoginIdA(data, user_id)
    const { loginIdsArray } = res.data;
    return loginIdsArray[loginIdsArray.length - 1];
});

export const editLoginIdData = createAsyncThunk("loginIds/edit", async ({ updatedData, login_id }, { getState }) => {
    const res = await api.editLoginId(login_id, updatedData);
    // console.log(updatedData);
    return updatedData;
});

export const deleteLoginData = createAsyncThunk("loginIds/delete", async ({ login_id, user_id }, { getState }) => {
    const res = await api.deleteLoginId(login_id, user_id);
    // console.log(res);
    const { data } = res;
    // console.log(data);
    return data.reverse();
});

//* Slice
const loginsIdSlice = createSlice({

    name: 'loginsId',
    initialState: initialState,

    extraReducers: (builder) => {
        builder.
            addCase(fecthLoginIdsData.fulfilled, (state, action) => {
                return {
                    ...state,
                    loginsIdData: action.payload
                };
            }).
            addCase(addNewLoginIdData.fulfilled, (state, action) => {
                return {
                    ...state,
                    loginsIdData: [action.payload, ...state.loginsIdData]
                };
            }).
            addCase(editLoginIdData.fulfilled, (state, action) => {
                const newArray = state.loginsIdData.map((loginId) => {
                    if (loginId._id === action.payload._id) {
                        return action.payload;
                    } else {
                        return loginId;
                    }
                });
                return {
                    ...state,
                    loginsIdData: newArray,
                };
            }).
            addCase(deleteLoginData.fulfilled, (state, action) => {
                return {
                    ...state,
                    loginsIdData: action.payload
                };
            })

    }

})

export const { deleteLoginId, editLoginId } = loginsIdSlice.actions;

export default loginsIdSlice.reducer;

activitiesSlice

import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import * as api from "../../api"

import { editLoginIdData } from "../loginsId/loginsIdSlice"

const initialState = {
    activitiesData: [],
}

const activitiesSlice = createSlice({

    name: 'activities',
    initialState: initialState,

    extraReducers: (builder) => {
        builder.
            addCase(editLoginIdData.fullfilled, (state, action) => {
                console.log("ss")
                return {
                    ...state,
                    activitiesData: []
                };
            })

    }

})

export default activitiesSlice.reducer;

Is there a way that when editLoginIdData action is fullfilled we can
dispatch somehow mutate the state in other slice.


问:
How to get r-squared using the covariance matrix output of scipy.optimize.curve_fit?
The scipy.optimize.curve_fit outputs covariance matrix, see scipy.optimize.curve_fit. I wish to get a single float description of the fitting result and I was use to compare r-squared, the coefficient of determination.

How to get r-squared using the covariance matrix output of scipy.optimize.curve_fit?

I would calculate the r-squared from the dataset https://medium.com/swlh/covariance-correlation-r-sqaured-5cbefc5cbe1c#1ae3 otherwise.


问:
Why is my UNION twice as fast as my UNION ALL? (SQL Server ~140k records)
I am asking this question purely out of interest since I can't for the life of me explain why this is happening, especially to this degree. As far as I knew, combining result sets without checking for duplicates would always be as fast as / (usually) faster than with checking!

Basically, there are two views returning ~78.000 and ~63.000 records in ~7 seconds respectively. They have the same super long query, just reading from different tables (same indexes).

Combining the views

```<code>SELECT * FROM v1
UNION ALL
SELECT * FROM v2
</code>```

This results in 141.167 rows after ~14 seconds. Twice the data, twice the time. Makes sense.

Now, purely out of interest I ran the same query but instead of a UNION ALL I just used a UNION on the result sets.

To my surprise, I got the same 141.167 rows in a whopping ~7 seconds!

The records returned by the views are already unique, so I would generally use UNION ALL, but this is twice as fast when I eliminate duplicates that don't exist, so what gives?

Execution plans

The execution plans are the same except for the last few steps since, obviously, they are different. I'm not that well versed in understanding them (especially being so long), but I don't want to leak any sensitive data here:

I was going to upload the execution plans to pastetheplan but they're both >2MB so it wouldn't let me. Instead, here are google drive links for the cleaned version (I only replaced table names):

UNION.sqlplan

UNION_ALL.sqlplan

Body:
I am asking this question purely out of interest since I can't for the life of me explain why this is happening, especially to this degree. As far as I knew, combining result sets without checking for duplicates would always be as fast as / (usually) faster than with checking!

Basically, there are two views returning ~78.000 and ~63.000 records in ~7 seconds respectively. They have the same super long query, just reading from different tables (same indexes).

Combining the views

SELECT * FROM v1
UNION ALL
SELECT * FROM v2

This results in 141.167 rows after ~14 seconds. Twice the data, twice the time. Makes sense.

Now, purely out of interest I ran the same query but instead of a UNION ALL I just used a UNION on the result sets.

To my surprise, I got the same 141.167 rows in a whopping ~7 seconds!

The records returned by the views are already unique, so I would generally use UNION ALL, but this is twice as fast when I eliminate duplicates that don't exist, so what gives?

Execution plans

The execution plans are the same except for the last few steps since, obviously, they are different. I'm not that well versed in understanding them (especially being so long), but I don't want to leak any sensitive data here:

I was going to upload the execution plans to pastetheplan but they're both >2MB so it wouldn't let me. Instead, here are google drive links for the cleaned version (I only replaced table names):

UNION.sqlplan

UNION_ALL.sqlplan


问:
UseState is not updating value in first attempt?
I am running the following snippet. On first time I Click on the  onClick button it should show "Hi, I am ammad jahangir" it shows ammad.  I want to know the reason.

```<code>import logo from './logo.svg';
import './App.css';

import { useState } from 'react';
function App() {

  let [data,setdata]=useState("ammad")

  function apple()
  {
    setdata("Hi, I am ammad jahangir")
    alert(data)
  }
  console.warn(data)
  return (
    <div className="App">
      <h1>{data}</h1>

      <button onClick={apple}>Click me</button>
    </div>
  );
}

export default App;
</code>```

I was trying the outcome should come like "Hi, I am ammad jahangir" in first onClick but it appears ammad on first click.

Body:
I am running the following snippet. On first time I Click on the  onClick button it should show "Hi, I am ammad jahangir" it shows ammad.  I want to know the reason.

import logo from './logo.svg';
import './App.css';

import { useState } from 'react';
function App() {

  let [data,setdata]=useState("ammad")

  function apple()
  {
    setdata("Hi, I am ammad jahangir")
    alert(data)
  }
  console.warn(data)
  return (

{data}

      <button onClick={apple}>Click me</button>

  );
}

export default App;

I was trying the outcome should come like "Hi, I am ammad jahangir" in first onClick but it appears ammad on first click.


问:
How to use two Leaflet plugins together in same Polyline (polycolor and spline)
I want to use this two Leaflet plugins together in same Polyline.

https://github.com/Oliv/leaflet-polycolor

https://github.com/slutske22/leaflet-spline

I have been reviewing the source code of both plugins, but their integration with Leaflet is totally different, so I don't know very well how to use them together in the same Polyline.

Any help with integration? Thanks!


问:
Torch: Using a target size (torch.Size([4])) that is different to the input size
I have the following code to train a neural network:

```<code>model = torch.nn.Sequential(
    torch.nn.Linear(14261, 10),
    torch.nn.ReLU(),
    torch.nn.Linear(10, 1)
)

X_train_t = torch.from_numpy(X_train.to_numpy(np.float32))
X_test_t = torch.from_numpy(X_test.to_numpy(np.float32))
Y_train_t = torch.from_numpy(Y_train.to_numpy(np.float32))
Y_test_t = torch.from_numpy(Y_test.to_numpy(np.float32))

train_set = torch.utils.data.TensorDataset(X_train_t, Y_train_t)
train_loader = torch.utils.data.DataLoader(train_set, batch_size=4, shuffle=True)

optimiser = torch.optim.SGD(model.parameters(), lr=0.001)
loss = torch.nn.functional.mse_loss
for epoch in range(10):
    current_loss = 0
    for (Xt, yt) in train_loader:
        yb_pred = model(Xt)
        c_loss = loss(yb_pred, yt)
        current_loss += c_loss.item()*yb_pred.shape[0]
        optimiser.zero_grad()
        c_loss.backward()
        optimiser.step()
    print(epoch, current_loss)
</code>```

Yet it keeps sending NaNs as current losses with the following warning:

/var/folders/q2/b2k3t_tn7gd074m0b_jlfynh0000gn/T/ipykernel_10854/529743083.py:22: UserWarning: Using a target size (torch.Size([4])) that is different to the input size (torch.Size([4, 1, 1])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
c_loss = loss(yb_pred, yt)

I understand that something is wrong with my c_loss and I tried to figure out with this thread, yet it still does not work. Is there something I am missing ?

Body:
I have the following code to train a neural network:

model = torch.nn.Sequential(
    torch.nn.Linear(14261, 10),
    torch.nn.ReLU(),
    torch.nn.Linear(10, 1)
)

X_train_t = torch.from_numpy(X_train.to_numpy(np.float32))
X_test_t = torch.from_numpy(X_test.to_numpy(np.float32))
Y_train_t = torch.from_numpy(Y_train.to_numpy(np.float32))
Y_test_t = torch.from_numpy(Y_test.to_numpy(np.float32))

train_set = torch.utils.data.TensorDataset(X_train_t, Y_train_t)
train_loader = torch.utils.data.DataLoader(train_set, batch_size=4, shuffle=True)

optimiser = torch.optim.SGD(model.parameters(), lr=0.001)
loss = torch.nn.functional.mse_loss
for epoch in range(10):
    current_loss = 0
    for (Xt, yt) in train_loader:
        yb_pred = model(Xt)
        c_loss = loss(yb_pred, yt)
        current_loss += c_loss.item()*yb_pred.shape[0]
        optimiser.zero_grad()
        c_loss.backward()
        optimiser.step()
    print(epoch, current_loss)

Yet it keeps sending NaNs as current losses with the following warning:

/var/folders/q2/b2k3t_tn7gd074m0b_jlfynh0000gn/T/ipykernel_10854/529743083.py:22: UserWarning: Using a target size (torch.Size([4])) that is different to the input size (torch.Size([4, 1, 1])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
c_loss = loss(yb_pred, yt)

I understand that something is wrong with my c_loss and I tried to figure out with this thread, yet it still does not work. Is there something I am missing ?


问:
How to measure the length of pyramid's edge in electron microscope photo using OpenCV?
There is a electron microscope photo of some surface:

What I want to do is to use OpenCV to detect edges of pyramid in this image and measure their length. Currently I have to label them manually (the red lines in image).

I try to use Canny with Hough transform but the result turn out not very well.

import cv2
from matplotlib import pyplot as plt
import numpy as np

img = cv2.imread('../data/sample.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2BGRA)

kernel_size = 9
blur_gray = cv2.GaussianBlur(gray, (kernel_size, kernel_size), 0)

lo, hi = 15, 27
edges = cv2.Canny(blur_gray, lo, hi)
plt.figure()
plt.imshow(blur_gray)

plt.figure()
plt.imshow(edges)

lines
 = cv2.HoughLinesP(edges, 1, np.pi / 180, 50, None, 50, 10)
```

It looks to me like there is too much noise in the original image. What I want to detect is the lateral edges of pyramid, but the base edges are also included with my code. I don't know how to remove them before using Canny and Hough transform. And there are some glitches in the result of edge detection which I don't know how to eliminate them. I though Gaussian blur should be enough but it turns out not working very well.

I have to confess that I have little knowledge of computer vision so I am not sure what's the right tool for this. It would be really appreciated to have someone shed some light on it. There is no need to find a 100% accuracy method as there are some abnormal structures in the image that have to be adjust manually, what I want is try to reduce the human effort as much as possible by using some computer vision technique.

Body:
There is a electron microscope photo of some surface:

What I want to do is to use OpenCV to detect edges of pyramid in this image and measure their length. Currently I have to label them manually (the red lines in image).

I try to use Canny with Hough transform but the result turn out not very well.

import cv2
from matplotlib import pyplot as plt
import numpy as np

img = cv2.imread('../data/sample.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2BGRA)

kernel_size = 9
blur_gray = cv2.GaussianBlur(gray, (kernel_size, kernel_size), 0)

lo, hi = 15, 27
edges = cv2.Canny(blur_gray, lo, hi)
plt.figure()
plt.imshow(blur_gray)

plt.figure()
plt.imshow(edges)

lines
 = cv2.HoughLinesP(edges, 1, np.pi / 180, 50, None, 50, 10)

It looks to me like there is too much noise in the original image. What I want to detect is the lateral edges of pyramid, but the base edges are also included with my code. I don't know how to remove them before using Canny and Hough transform. And there are some glitches in the result of edge detection which I don't know how to eliminate them. I though Gaussian blur should be enough but it turns out not working very well.

I have to confess that I have little knowledge of computer vision so I am not sure what's the right tool for this. It would be really appreciated to have someone shed some light on it. There is no need to find a 100% accuracy method as there are some abnormal structures in the image that have to be adjust manually, what I want is try to reduce the human effort as much as possible by using some computer vision technique.


问:
IIS starts application twice after app pool restart
I'm facing an issue with my application.
It's being hosted on IIS, hosting model out of process, application framework .net 6.
Once in a while, after application restart, ISS starts two processes.

Those are the logs from Event Viewer

10:41:57 Application '/LM/W3SVC/2/ROOT' started process '14564' successfully and process '14564' is listening on port '40701'.

10:41:57 Sent shutdown HTTP message to process with Id '14564' and received http status '202'.

10:41:57 Application '/LM/W3SVC/2/ROOT' with physical root 'XXX' shut down process with Id '14564' listening on port '40701'

10:42:04 Application '/LM/W3SVC/2/ROOT' started process '12184' successfully and process '12184' is listening on port '47678'.

The problem is, the process id 14564 is still running afterwards, even though logs are claiming it has been shut down.

Do any of you have any clue what might be causing that?

Checked all application pool settings - all seems to be fine.
Tried to reproduce the bug with 100% repeatability - no luck.


问:
How to populate email clients for sharing mail in iPhone using JavaScript
I am facing one issue with my application. When I try to share some content from my webpage using email webshare it automatically opens the default mail client. Is it possible to ask for the mail clients like; gmail, outlook in iPhone</p>


问:
SSL Certificates location in Kafka trigger Azure Functions
I am developing kafka trigger based azure functions in JAVA where the function uses below configuration for connection:

```<code>@KafkaTrigger(name = "kafkatrigger", topic = "kafka.topic", brokerList = "%BrokerList%",
                    consumerGroup = "default-consumer", protocol = BrokerProtocol.SSL,
                    sslCertificateLocation = "%sslCertificateLocation%", sslCaLocation = "%sslCaLocation%",
                    sslKeyLocation = "%sslKeyLocation%", sslKeyPassword = "%keyStorePassword%",
                    cardinality = Cardinality.ONE, dataType = "string")
</code>```

So, In above configuration I do not want to upload the client private key, client public key and ca certificate through artifact on the container for security purpose. So, I want to keep the certificates at secure location like key vault, secret management and use their reference location in @KafkaTrigger annotation. How can I achieve that?

Body:
I am developing kafka trigger based azure functions in JAVA where the function uses below configuration for connection:

@KafkaTrigger(name = "kafkatrigger", topic = "kafka.topic", brokerList = "%BrokerList%",
                    consumerGroup = "default-consumer", protocol = BrokerProtocol.SSL,
                    sslCertificateLocation = "%sslCertificateLocation%", sslCaLocation = "%sslCaLocation%",
                    sslKeyLocation = "%sslKeyLocation%", sslKeyPassword = "%keyStorePassword%",
                    cardinality = Cardinality.ONE, dataType = "string")

So, In above configuration I do not want to upload the client private key, client public key and ca certificate through artifact on the container for security purpose. So, I want to keep the certificates at secure location like key vault, secret management and use their reference location in @KafkaTrigger annotation. How can I achieve that?


问:
how to merge dataset after applying dcast and melt for occurrence count purposes?
I have a panel dataset of firms with multiple variables. I create one dummy variable treat2 which equals 1 when a given firm takes one action in two consecutive months within a given year and 0 otherwise using dcast. I am looking for a way to combine my original data with the newly-created variable. I use melt and merge commands without success. Could anyone help me on this?

Here's an example with one additional variable (sector) and what I tried so far:

```<code>firmid <-c(1,1,1,1,1,1,
           2,2,2,2,
           3,4,4,5,5,5)
year <-c(2010,2010,2010,
         2011,2011,2011,
         2010,2010,2011,2011,
         2010,2011,2011,2010,
         2011,2011)
month <- c(1,2,3,1,2,3,
           1,2,1,2,1,1,
           2,1,2,3)
sector <- c(1,1,1,1,1,1,
            1,1,1,1,1,
            2,2,2,2,2)
dfdata <-as.data.frame(cbind(firmid,year,month, sector))
dfdata <-as.data.table(dfdata)
new_DT <- dcast(dfdata, firmid + year ~ month, value.var = "firmid",
                fun.aggregate = length, drop = FALSE)

#create the dummy variable treat2
new_DT1<- (new_DT[, treat2 := ifelse(rowSums(.SD) >= 2, 1, 0), .SDcols = patterns("^[0-9]+$")][])

#attempt to come back to original dataset
new_DT2 <- melt(new_DT1, measure.vars = patterns("^[0-9]+$"), variable.name = "month", value.name = "treat")
new_DT2 <-as.data.frame(new_DT2)
dfdata1 <-as.data.frame(cbind(firmid,year,month, sector))
dfdata2 <- as.data.table(dfdata1)
dfdata2 <- dcast(dfdata2, firmid + year ~ month, value.var = "firmid",
                 fun.aggregate = length, drop = FALSE)
dfdata2 <- melt(dfdata2, measure.vars = patterns("^[0-9]+$"), variable.name = "month", value.name = "treated")
dfdata2 <- as.data.frame(dfdata2)
final <- as.data.frame(merge(new_DT2, dfdata2, all = TRUE))
view(final)
</code>```

Body:
I have a panel dataset of firms with multiple variables. I create one dummy variable treat2 which equals 1 when a given firm takes one action in two consecutive months within a given year and 0 otherwise using dcast. I am looking for a way to combine my original data with the newly-created variable. I use melt and merge commands without success. Could anyone help me on this?

Here's an example with one additional variable (sector) and what I tried so far:

firmid <-c(1,1,1,1,1,1,
           2,2,2,2,
           3,4,4,5,5,5)
year <-c(2010,2010,2010,
         2011,2011,2011,
         2010,2010,2011,2011,
         2010,2011,2011,2010,
         2011,2011)
month <- c(1,2,3,1,2,3,
           1,2,1,2,1,1,
           2,1,2,3)
sector <- c(1,1,1,1,1,1,
            1,1,1,1,1,
            2,2,2,2,2)
dfdata <-as.data.frame(cbind(firmid,year,month, sector))
dfdata <-as.data.table(dfdata)
new_DT <- dcast(dfdata, firmid + year ~ month, value.var = "firmid",
                fun.aggregate = length, drop = FALSE)

#create the dummy variable treat2
new_DT1<- (new_DT[, treat2 := ifelse(rowSums(.SD) >= 2, 1, 0), .SDcols = patterns("^[0-9]+$")][])

#attempt to come back to original dataset
new_DT2 <- melt(new_DT1, measure.vars = patterns("^[0-9]+$"), variable.name = "month", value.name = "treat")
new_DT2 <-as.data.frame(new_DT2)
dfdata1 <-as.data.frame(cbind(firmid,year,month, sector))
dfdata2 <- as.data.table(dfdata1)
dfdata2 <- dcast(dfdata2, firmid + year ~ month, value.var = "firmid",
                 fun.aggregate = length, drop = FALSE)
dfdata2 <- melt(dfdata2, measure.vars = patterns("^[0-9]+$"), variable.name = "month", value.name = "treated")
dfdata2 <- as.data.frame(dfdata2)
final <- as.data.frame(merge(new_DT2, dfdata2, all = TRUE))
view(final)


问:
Normal-Distributions Transform PCL-NDT codes calculate c1, c2 may have problem? equation 6.7 and afterwards c1, c2 calculate
Paper: 2009 Phd Thesis <The Three-Dimensional Normal-Distributions Transform>

Equation here:
enter image description here

Question:

Why the pcl code write the constant c1, c2 as, pcl source code link:

   // Initializes the gaussian fitting parameters (eq. 6.8) [Magnusson 2009]
   const double gauss_c1 = 10.0 * (1 - outlier_ratio_);
   const double gauss_c2 = outlier_ratio_ / pow(resolution_, 3);
```

or why times 10 for sure on c1? It really confuses me.

Why the c1, c2 could be formulated as the codes said, and why 10 times on c1 also?

Body:
Paper: 2009 Phd Thesis <The Three-Dimensional Normal-Distributions Transform>

Equation here:
enter image description here

Question:

Why the pcl code write the constant c1, c2 as, pcl source code link:

   // Initializes the gaussian fitting parameters (eq. 6.8) [Magnusson 2009]
   const double gauss_c1 = 10.0 * (1 - outlier_ratio_);
   const double gauss_c2 = outlier_ratio_ / pow(resolution_, 3);

or why times 10 for sure on c1? It really confuses me.

Why the c1, c2 could be formulated as the codes said, and why 10 times on c1 also?


问:
How do define the first value of X-axis on ggplot
I have a dataset with 2 columns: Month (in a YYYY-MM-DD format, starting from 1 Jan 2016) and mortality for the month.

I am trying to plot the monthly mortality and have done this:

```<code>df %>%
    ggplot(aes(as.Date(month), mortality)) +
    geom_point() +
    scale_y_continuous(name = "Unadjusted Mortality (%)", limits=c(5, 9)) +
    scale_x_date(date_breaks = "3 month", date_labels = "%b %Y")
</code>```

That gives me a plot with the X axis starting at December 2015 - but I would like it to start at Jan 2016.

I have tried adding a limit=c("2016-01-01", "2022-01-01") to scale_x_date but that doesn't change it. Any suggestions?

Body:
I have a dataset with 2 columns: Month (in a YYYY-MM-DD format, starting from 1 Jan 2016) and mortality for the month.

I am trying to plot the monthly mortality and have done this:

df %>%
    ggplot(aes(as.Date(month), mortality)) +
    geom_point() +
    scale_y_continuous(name = "Unadjusted Mortality (%)", limits=c(5, 9)) +
    scale_x_date(date_breaks = "3 month", date_labels = "%b %Y")

That gives me a plot with the X axis starting at December 2015 - but I would like it to start at Jan 2016.

I have tried adding a limit=c("2016-01-01", "2022-01-01") to scale_x_date but that doesn't change it. Any suggestions?


问:
Looking up a deactivated widget's ancestor is unsafe.Flutter integaration test
```<code>type here
</code>```

iam new to flutter and trying to learn test integration test package and i have come around this error.
The following assertion was thrown while finalizing the widget
tree:
Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer
stable.
To safely refer to a widget's ancestor in its dispose() method,
save a reference to the ancestor by calling
dependOnInheritedWidgetOfExactType() in the widget's
didChangeDependencies() method.

```<code>and to the little understanding that i have this is the class throwing that error
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:modal_progress_hud/modal_progress_hud.dart';
import 'package:rflutter_alert/rflutter_alert.dart';
import 'package:wildai/helper/check_connectivity.dart';
import 'package:wildai/helper/common_methods.dart';
import 'package:wildai/helper/screen_config.dart';
import 'package:wildai/helper/toast_helper.dart';
import 'package:wildai/redux/actions.dart';
import 'package:wildai/redux/app_state.dart';
import 'package:wildai/redux/middleware/checkin_calls/checkin_update_get_data_call.dart';
import 'package:wildai/redux/middleware/homescreen_calls/update_single_view_calls.dart';
import 'package:wildai/src/models/dashboard/dashboard_model.dart';
import 'package:wildai/src/widgets/buttons/custom_radio_button.dart';
import 'package:wildai/src/widgets/custom_margins.dart';
import 'package:wildai/src/widgets/my_bottom_sheet.dart';
import 'package:wildai/utils/custom_alert.dart';
import 'package:wildai/utils/my_custom_text_theme.dart';
import 'package:wildai/helper/http_wrapper_custom.dart' as http;
import 'package:wildai/utils/my_redesign_icons.dart';
class EditCheckInOverlayPage extends StatefulWidget {
EditCheckInOverlayPage(this.title, this.avaiableCheckinItem,
this.updateCheckinsUrl, this.keyValue,
{Key key, this.showLoading = false, this.checkInRequestBody})
: super(key: key);
final String title;
final Map avaiableCheckinItem;
final String keyValue;
final String updateCheckinsUrl;
final Map checkInRequestBody;
bool showLoading;
\_EditCheckInOverlayPageState createState() =\> \_EditCheckInOverlayPageState();
}
class \_EditCheckInOverlayPageState extends State\<EditCheckInOverlayPage\> {
String micIconString = 'assets/icons/microphone.png';
Map responseBody = {'show_checkins': {}};
List\<AvaiableCheckinItemModel\> avaiableCheckinItems;
DateTime delayTime = DateTime.now();
final FlutterSecureStorage storage = new FlutterSecureStorage();
final store = StoreProvider.of\<AppState\>(SizeConfig.rootPagecOntext);
@override
void initState() {
super.initState();
avaiableCheckinItems = widget.avaiableCheckinItem\[widget.keyValue\];
List\<int\> requiredIntList = \[\];
for (var i = 0; i \< avaiableCheckinItems.length; i++) {
if (avaiableCheckinItems\[i\].require) {
requiredIntList.add(i);
}
}
for (int index in requiredIntList) {
var temp = avaiableCheckinItems\[index\];
avaiableCheckinItems.removeAt(index);
avaiableCheckinItems.insert(0, temp);
}
}
@override
void dispose() {
super.dispose();
if (mounted && !responseBody\['show_checkins'\].isEmpty) {
updateAvaiableCheckInsResponse();
print('///////////////////////////////');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: Align(
alignment: Alignment.bottomCenter,
child: MyBottomModelSheet.titleSheet(
title: 'Edit ${widget.title} Check-ins',
height: 530,
onClose: () {
Navigator.pop(context);
},
body: sortDetailsContainer()),
),
);
}
Widget titleWidget() {
return Container(
decoration: BoxDecoration(color: Colors.white, boxShadow: \[
BoxShadow(
blurRadius: 25,
color: SizeConfig.primaryTextColour.withOpacity(.3),
)
\]),
child: Row(
children: \[
Expanded(
child: Padding(
padding: cmargin(top: 31, left: 30, right: 30),
child: Text(
'Edit ${widget.title} Check-Ins'.toUpperCase(),
style: MyCustomTextStyles().buttonTextSmall.copyWith(
color: SizeConfig.primaryTextColour.withOpacity(.4),
),
),
),
)
\],
),
);
}
Widget searchbarWidget() {
final \_formKey = GlobalKey\<FormState\>();
return Container(
color: Colors.white,
child: Padding(
padding: cmargin(left: 25, right: 25, bottom: 20, top: 22),
child: Container(
height: HelperMethods().getMyDynamicHeight(36),
decoration: BoxDecoration(
color: Color(0xff767680).withOpacity(.12),
borderRadius: BorderRadius.circular(10)),
child: Row(
children: \[
Padding(
padding: cmargin(left: 8, right: 7.37),
child: Container(
height: HelperMethods().getMyDynamicHeight(15.78),
width: HelperMethods().getMyDynamicWidth(15.63),
child: Icon(
MyAwesomeIcons.loupe,
color: Color(0xff8E8E93),
size: HelperMethods().getMyDynamicWidth(15.63),
),
),
),
Expanded(
child: Form(
key: \_formKey,
child: TextFormField(
onSaved: (String \_value) {
if (!\_formKey.currentState.validate() ||
\_value.isEmpty) {
return;
}
print(\_value);
},
style: MyCustomTextStyles().body.copyWith(
color: SizeConfig.primaryTextColour, height: 1),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Search',
hintStyle: MyCustomTextStyles().body.copyWith(
color: Color(0xff3C3C43).withOpacity(.6),
height: 1.1,
),
),
),
),
),
Padding(
padding: cmargin(right: 9.63),
child: Container(
height: HelperMethods().getMyDynamicHeight(16.37),
width: HelperMethods().getMyDynamicWidth(11),
child: Image.asset(
micIconString,
color: Color(0xff8E8E93),
fit: BoxFit.contain,
),
),
),
\],
),
),
));
}
Widget closeButton() {
return Container(
color: Colors.transparent,
height: HelperMethods().getMyDynamicWidth(55),
width: SizeConfig.screenWidth,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: \[
Padding(
padding: cmargin(right: 30, bottom: 25),
child: InkWell(
borderRadius: BorderRadius.circular(50),
onTap: () {
Navigator.pop(context);
},
child: Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(.2),
shape: BoxShape.circle,
),
height: HelperMethods().getMyDynamicWidth(30),
width: HelperMethods().getMyDynamicWidth(30),
child: Icon(
MyAwesomeIcons.close,
key: Key("close_button"),
size: HelperMethods().getMyDynamicWidth(30),
)),
),
)
\],
),
);
}
Widget sortDetailsContainer() {
return Expanded(
child: ModalProgressHUD(
inAsyncCall: false,

        color: Colors.transparent,
        child:

            Container(
          width: SizeConfig.screenWidth,
          color: Colors.white,
          child: Padding(
            padding: cmargin(),
            child: ListView(
              padding: cmargin(),
              children: List.generate(
                  avaiableCheckinItems.length + 1,
                  (index) => index == avaiableCheckinItems.length
                      ? Container(
                          height: 50,
                        )
                      : InkWell(
                          key: Key(avaiableCheckinItems[index].displayName),
                          onTap: () {
                            //delayTime = DateTime.now();
                            if (avaiableCheckinItems[index].require &&
                                avaiableCheckinItems[index].selected) {
                              return;
                            }
                            avaiableCheckinItems[index].selected =
                                !avaiableCheckinItems[index].selected;

                            addToResponseBody(avaiableCheckinItems[index]);
                            setState(() {});
                          },
                          child: Container(
                            decoration: BoxDecoration(
                                border: Border(
                                    top: BorderSide(
                                        color: SizeConfig.primaryTextColour
                                            .withOpacity(.4),
                                        width: HelperMethods()
                                            .getMyDynamicFontSize(.35)))),
                            child: Padding(
                              padding: cmargin(
                                  left: 30, top: 20, bottom: 20, right: 30),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Container(
                                    width:
                                        HelperMethods().getMyDynamicWidth(244),
                                    child: Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.center,
                                      children: [
                                        Flexible(
                                          child: Text(
                                            avaiableCheckinItems[index]
                                                .displayName,
                                            style: MyCustomTextStyles()
                                                .formText
                                                .copyWith(
                                                    color: SizeConfig
                                                        .primaryTextColour,
                                                    height: 1),
                                          ),
                                        ),
                                        avaiableCheckinItems[index].require
                                            ? Text(
                                                ' (required)',
                                                style: MyCustomTextStyles()
                                                    .labelSmall
                                                    .copyWith(
                                                        color: SizeConfig
                                                            .primaryTextColour),
                                              )
                                            : Container()
                                      ],
                                    ),
                                  ),
                                  Opacity(
                                    opacity: avaiableCheckinItems[index]
                                                .require &&
                                            avaiableCheckinItems[index].selected
                                        ? .2
                                        : 1,
                                    child: CustomRadioButton(
                                      onTap: (value) {
                                        if (avaiableCheckinItems[index]
                                                .require &&
                                            avaiableCheckinItems[index]
                                                .selected) {
                                          return;
                                        }
                                        avaiableCheckinItems[index].selected =
                                            !avaiableCheckinItems[index]
                                                .selected;
                                        addToResponseBody(
                                            avaiableCheckinItems[index]);
                                        setState(() {});
                                      },
                                      selected:
                                          avaiableCheckinItems[index].selected,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ),
                        )),
            ),
          ),
        ),
      ),
    );

}
addToResponseBody(AvaiableCheckinItemModel checkInItem) {
if (responseBody\['show_checkins'\].containsKey(checkInItem.modelName)) {
responseBody\['show_checkins'\]\[checkInItem.modelName\]
\[checkInItem.dbVariable\] = checkInItem.selected;
} else {
responseBody\['show_checkins'\]\[checkInItem.modelName\] = {
checkInItem.dbVariable: checkInItem.selected
};
}
print(responseBody);
return;
}
updateAvaiableCheckInsResponse() {
Conn().connectivityResult().then((conn) async {
if (conn) {
final store = StoreProvider.of\<AppState\>(SizeConfig.rootPagecOntext);
String body = json.encode(responseBody);
responseBody = {'show_checkins': {}};
String token = await storage.read(key: "wildUserToken");
DashboardCheckInsModel oldCheckins =
store.state.dashboardDataModel.checkins;
store.state.dashboardDataModel.checkins = DashboardCheckInsModel();
store.dispatch(SetDashboardObject(store.state.dashboardDataModel));
if (widget.showLoading) {
await \_createCheckins(oldCheckins);
}
final response =
await http.post(Uri.encodeFull(widget.updateCheckinsUrl),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
"Authorization": "Token $token"
},
body: body);
if (response.statusCode == 200) {
store.state.dashboardDataModel.checkins = oldCheckins;
store.dispatch(updateDashboardCheckinCall(forceRefresh: true));
} else if (response.statusCode == 400 || response.statusCode == 500) {
var res = json.decode(response.body);
store.dispatch(SetDashboardObject(store.state.dashboardDataModel));
String msg = res\['details'\];
CustomAlert().showCustomAlert(
context, "Oops! Something went wrong. ", msg, AlertType.info);
} else {
store.dispatch(SetDashboardObject(store.state.dashboardDataModel));

          // throw Exception("failed to load calendar");
        }
      } else {
        ShowMyToastHelper().showCheckConnectionToast(context, 2);
      }
    });

}
Future \_createCheckins(DashboardCheckInsModel dashboardCheckInsModel) async {
await Conn().connectivityResult().then((bool conn) async {
if (conn) {
String body = json.encode(widget.checkInRequestBody);
String token = await storage.read(key: "wildUserToken");
final response = await http.post(
Uri.encodeFull(dashboardCheckInsModel.endpoints.submitCheckin.url),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
"Authorization": "Token $token"
},
body: body);
if (response.statusCode == 200) {
store.dispatch(checkInsUpdateGetDataCall(silenty: true));
}
} else {
ShowMyToastHelper().showCheckConnectionToast(context, 2);
}
});
}
</code>```

}
the problem is the script runs and performs its actions but the test fails.
any guidance would be appreciated.if there is anymore information needed for clarification i'll be happy to provide it.

Body:
type here

iam new to flutter and trying to learn test integration test package and i have come around this error.
The following assertion was thrown while finalizing the widget
tree:
Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer
stable.
To safely refer to a widget's ancestor in its dispose() method,
save a reference to the ancestor by calling
dependOnInheritedWidgetOfExactType() in the widget's
didChangeDependencies() method.

and to the little understanding that i have this is the class throwing that error
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:modal_progress_hud/modal_progress_hud.dart';
import 'package:rflutter_alert/rflutter_alert.dart';
import 'package:wildai/helper/check_connectivity.dart';
import 'package:wildai/helper/common_methods.dart';
import 'package:wildai/helper/screen_config.dart';
import 'package:wildai/helper/toast_helper.dart';
import 'package:wildai/redux/actions.dart';
import 'package:wildai/redux/app_state.dart';
import 'package:wildai/redux/middleware/checkin_calls/checkin_update_get_data_call.dart';
import 'package:wildai/redux/middleware/homescreen_calls/update_single_view_calls.dart';
import 'package:wildai/src/models/dashboard/dashboard_model.dart';
import 'package:wildai/src/widgets/buttons/custom_radio_button.dart';
import 'package:wildai/src/widgets/custom_margins.dart';
import 'package:wildai/src/widgets/my_bottom_sheet.dart';
import 'package:wildai/utils/custom_alert.dart';
import 'package:wildai/utils/my_custom_text_theme.dart';
import 'package:wildai/helper/http_wrapper_custom.dart' as http;
import 'package:wildai/utils/my_redesign_icons.dart';
class EditCheckInOverlayPage extends StatefulWidget {
EditCheckInOverlayPage(this.title, this.avaiableCheckinItem,
this.updateCheckinsUrl, this.keyValue,
{Key key, this.showLoading = false, this.checkInRequestBody})
: super(key: key);
final String title;
final Map avaiableCheckinItem;
final String keyValue;
final String updateCheckinsUrl;
final Map checkInRequestBody;
bool showLoading;
\_EditCheckInOverlayPageState createState() =\> \_EditCheckInOverlayPageState();
}
class \_EditCheckInOverlayPageState extends State\<EditCheckInOverlayPage\> {
String micIconString = 'assets/icons/microphone.png';
Map responseBody = {'show_checkins': {}};
List\<AvaiableCheckinItemModel\> avaiableCheckinItems;
DateTime delayTime = DateTime.now();
final FlutterSecureStorage storage = new FlutterSecureStorage();
final store = StoreProvider.of\<AppState\>(SizeConfig.rootPagecOntext);
@override
void initState() {
super.initState();
avaiableCheckinItems = widget.avaiableCheckinItem\[widget.keyValue\];
List\<int\> requiredIntList = \[\];
for (var i = 0; i \< avaiableCheckinItems.length; i++) {
if (avaiableCheckinItems\[i\].require) {
requiredIntList.add(i);
}
}
for (int index in requiredIntList) {
var temp = avaiableCheckinItems\[index\];
avaiableCheckinItems.removeAt(index);
avaiableCheckinItems.insert(0, temp);
}
}
@override
void dispose() {
super.dispose();
if (mounted && !responseBody\['show_checkins'\].isEmpty) {
updateAvaiableCheckInsResponse();
print('///////////////////////////////');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: Align(
alignment: Alignment.bottomCenter,
child: MyBottomModelSheet.titleSheet(
title: 'Edit ${widget.title} Check-ins',
height: 530,
onClose: () {
Navigator.pop(context);
},
body: sortDetailsContainer()),
),
);
}
Widget titleWidget() {
return Container(
decoration: BoxDecoration(color: Colors.white, boxShadow: \[
BoxShadow(
blurRadius: 25,
color: SizeConfig.primaryTextColour.withOpacity(.3),
)
\]),
child: Row(
children: \[
Expanded(
child: Padding(
padding: cmargin(top: 31, left: 30, right: 30),
child: Text(
'Edit ${widget.title} Check-Ins'.toUpperCase(),
style: MyCustomTextStyles().buttonTextSmall.copyWith(
color: SizeConfig.primaryTextColour.withOpacity(.4),
),
),
),
)
\],
),
);
}
Widget searchbarWidget() {
final \_formKey = GlobalKey\<FormState\>();
return Container(
color: Colors.white,
child: Padding(
padding: cmargin(left: 25, right: 25, bottom: 20, top: 22),
child: Container(
height: HelperMethods().getMyDynamicHeight(36),
decoration: BoxDecoration(
color: Color(0xff767680).withOpacity(.12),
borderRadius: BorderRadius.circular(10)),
child: Row(
children: \[
Padding(
padding: cmargin(left: 8, right: 7.37),
child: Container(
height: HelperMethods().getMyDynamicHeight(15.78),
width: HelperMethods().getMyDynamicWidth(15.63),
child: Icon(
MyAwesomeIcons.loupe,
color: Color(0xff8E8E93),
size: HelperMethods().getMyDynamicWidth(15.63),
),
),
),
Expanded(
child: Form(
key: \_formKey,
child: TextFormField(
onSaved: (String \_value) {
if (!\_formKey.currentState.validate() ||
\_value.isEmpty) {
return;
}
print(\_value);
},
style: MyCustomTextStyles().body.copyWith(
color: SizeConfig.primaryTextColour, height: 1),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Search',
hintStyle: MyCustomTextStyles().body.copyWith(
color: Color(0xff3C3C43).withOpacity(.6),
height: 1.1,
),
),
),
),
),
Padding(
padding: cmargin(right: 9.63),
child: Container(
height: HelperMethods().getMyDynamicHeight(16.37),
width: HelperMethods().getMyDynamicWidth(11),
child: Image.asset(
micIconString,
color: Color(0xff8E8E93),
fit: BoxFit.contain,
),
),
),
\],
),
),
));
}
Widget closeButton() {
return Container(
color: Colors.transparent,
height: HelperMethods().getMyDynamicWidth(55),
width: SizeConfig.screenWidth,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: \[
Padding(
padding: cmargin(right: 30, bottom: 25),
child: InkWell(
borderRadius: BorderRadius.circular(50),
onTap: () {
Navigator.pop(context);
},
child: Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(.2),
shape: BoxShape.circle,
),
height: HelperMethods().getMyDynamicWidth(30),
width: HelperMethods().getMyDynamicWidth(30),
child: Icon(
MyAwesomeIcons.close,
key: Key("close_button"),
size: HelperMethods().getMyDynamicWidth(30),
)),
),
)
\],
),
);
}
Widget sortDetailsContainer() {
return Expanded(
child: ModalProgressHUD(
inAsyncCall: false,

        color: Colors.transparent,
        child:

            Container(
          width: SizeConfig.screenWidth,
          color: Colors.white,
          child: Padding(
            padding: cmargin(),
            child: ListView(
              padding: cmargin(),
              children: List.generate(
                  avaiableCheckinItems.length + 1,
                  (index) => index == avaiableCheckinItems.length
                      ? Container(
                          height: 50,
                        )
                      : InkWell(
                          key: Key(avaiableCheckinItems[index].displayName),
                          onTap: () {
                            //delayTime = DateTime.now();
                            if (avaiableCheckinItems[index].require &&
                                avaiableCheckinItems[index].selected) {
                              return;
                            }
                            avaiableCheckinItems[index].selected =
                                !avaiableCheckinItems[index].selected;

                            addToResponseBody(avaiableCheckinItems[index]);
                            setState(() {});
                          },
                          child: Container(
                            decoration: BoxDecoration(
                                border: Border(
                                    top: BorderSide(
                                        color: SizeConfig.primaryTextColour
                                            .withOpacity(.4),
                                        width: HelperMethods()
                                            .getMyDynamicFontSize(.35)))),
                            child: Padding(
                              padding: cmargin(
                                  left: 30, top: 20, bottom: 20, right: 30),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Container(
                                    width:
                                        HelperMethods().getMyDynamicWidth(244),
                                    child: Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.center,
                                      children: [
                                        Flexible(
                                          child: Text(
                                            avaiableCheckinItems[index]
                                                .displayName,
                                            style: MyCustomTextStyles()
                                                .formText
                                                .copyWith(
                                                    color: SizeConfig
                                                        .primaryTextColour,
                                                    height: 1),
                                          ),
                                        ),
                                        avaiableCheckinItems[index].require
                                            ? Text(
                                                ' (required)',
                                                style: MyCustomTextStyles()
                                                    .labelSmall
                                                    .copyWith(
                                                        color: SizeConfig
                                                            .primaryTextColour),
                                              )
                                            : Container()
                                      ],
                                    ),
                                  ),
                                  Opacity(
                                    opacity: avaiableCheckinItems[index]
                                                .require &&
                                            avaiableCheckinItems[index].selected
                                        ? .2
                                        : 1,
                                    child: CustomRadioButton(
                                      onTap: (value) {
                                        if (avaiableCheckinItems[index]
                                                .require &&
                                            avaiableCheckinItems[index]
                                                .selected) {
                                          return;
                                        }
                                        avaiableCheckinItems[index].selected =
                                            !avaiableCheckinItems[index]
                                                .selected;
                                        addToResponseBody(
                                            avaiableCheckinItems[index]);
                                        setState(() {});
                                      },
                                      selected:
                                          avaiableCheckinItems[index].selected,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ),
                        )),
            ),
          ),
        ),
      ),
    );

}
addToResponseBody(AvaiableCheckinItemModel checkInItem) {
if (responseBody\['show_checkins'\].containsKey(checkInItem.modelName)) {
responseBody\['show_checkins'\]\[checkInItem.modelName\]
\[checkInItem.dbVariable\] = checkInItem.selected;
} else {
responseBody\['show_checkins'\]\[checkInItem.modelName\] = {
checkInItem.dbVariable: checkInItem.selected
};
}
print(responseBody);
return;
}
updateAvaiableCheckInsResponse() {
Conn().connectivityResult().then((conn) async {
if (conn) {
final store = StoreProvider.of\<AppState\>(SizeConfig.rootPagecOntext);
String body = json.encode(responseBody);
responseBody = {'show_checkins': {}};
String token = await storage.read(key: "wildUserToken");
DashboardCheckInsModel oldCheckins =
store.state.dashboardDataModel.checkins;
store.state.dashboardDataModel.checkins = DashboardCheckInsModel();
store.dispatch(SetDashboardObject(store.state.dashboardDataModel));
if (widget.showLoading) {
await \_createCheckins(oldCheckins);
}
final response =
await http.post(Uri.encodeFull(widget.updateCheckinsUrl),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
"Authorization": "Token $token"
},
body: body);
if (response.statusCode == 200) {
store.state.dashboardDataModel.checkins = oldCheckins;
store.dispatch(updateDashboardCheckinCall(forceRefresh: true));
} else if (response.statusCode == 400 || response.statusCode == 500) {
var res = json.decode(response.body);
store.dispatch(SetDashboardObject(store.state.dashboardDataModel));
String msg = res\['details'\];
CustomAlert().showCustomAlert(
context, "Oops! Something went wrong. ", msg, AlertType.info);
} else {
store.dispatch(SetDashboardObject(store.state.dashboardDataModel));

          // throw Exception("failed to load calendar");
        }
      } else {
        ShowMyToastHelper().showCheckConnectionToast(context, 2);
      }
    });

}
Future \_createCheckins(DashboardCheckInsModel dashboardCheckInsModel) async {
await Conn().connectivityResult().then((bool conn) async {
if (conn) {
String body = json.encode(widget.checkInRequestBody);
String token = await storage.read(key: "wildUserToken");
final response = await http.post(
Uri.encodeFull(dashboardCheckInsModel.endpoints.submitCheckin.url),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
"Authorization": "Token $token"
},
body: body);
if (response.statusCode == 200) {
store.dispatch(checkInsUpdateGetDataCall(silenty: true));
}
} else {
ShowMyToastHelper().showCheckConnectionToast(context, 2);
}
});
}

}
the problem is the script runs and performs its actions but the test fails.
any guidance would be appreciated.if there is anymore information needed for clarification i'll be happy to provide it.


问:
Identity propagation in wildfly elytron with HTTP bearer authentication
We use a elytron/token-realm with a elytron/http-authentication-factory and the BEARER_TOKEN mechanism to authenticate users. The system consists of two applications, running in separate wildfly instances. One application remotely invokes EJBs of the other application. We would like the identity of the current user to be propagated over the remote EJB call.

I am trying to set up Identity propagation according to the JBoss documentation.

BEARER_TOKEN is listed as a supported mechanism. The ejb system is configured to use the new HTTP transport (call target is http://server:port/wildfly-services), instead of the remote+http protocol.

I would expect the bearer token to be added as an HTTP “Authorization: Bearer” header by the forwarding server, when making the ejb call to the receiving server, however this does not happen and the HTTP response is 401.

This is the configuration of the forwarding server:

```<code>/subsystem=ejb3/application-security-domain=other:write-attribute(name=security-domain,value=ApplicationDomain)

/subsystem=elytron/authentication-configuration=remote-ejb-configuration:add(security-domain=ApplicationDomain)
/subsystem=elytron/authentication-context=remote-ejb-context:add(match-rules=[{authentication-configuration=remote-ejb-configuration}])

/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-partner-ejb/:add(host="server",port="8080")
/subsystem=remoting/remote-outbound-connection=remote-ejb:add(outbound-socket-binding-ref=remote-partner-ejb, authentication-context=remote-ejb-context)

/subsystem=undertow/server=default-server/host=default-host/setting=http-invoker:undefine-attribute(name=security-realm)
/subsystem=undertow/server=default-server/host=default-host/setting=http-invoker:write-attribute(name=http-authentication-factory, value=jwt-http-authentication)
</code>```

And here is the error seen on the forwarding server side:

Caused by: javax.naming.AuthenticationException: WFHTTP000013: Authentication failed (full response ClientResponse{responseHeaders={Connection=[keep-alive], WWW-Authenticate=[Bearer realm="jwt-realm"], Set-Cookie=[JSESSIONID=0BAxZeBpW-RuStmtGFylfbYBpypUJYsqLMlsrw04.partner-as-76d77b7f5c-6bcb6; path=/wildfly-services], Server=[nginx/1.23.3], Content-Type=[text/html], Content-Length=[77], Date=[Mon, 09 Jan 2023 10:34:00 GMT]}, responseCode=401, status='Unauthorized', protocol=HTTP/1.1})

There is a quickstart showing identity propagation, but it uses SASL authentication, which does not support BEARER_TOKEN mechanism

Has anyone had luck with a setup like this?

Body:
We use a elytron/token-realm with a elytron/http-authentication-factory and the BEARER_TOKEN mechanism to authenticate users. The system consists of two applications, running in separate wildfly instances. One application remotely invokes EJBs of the other application. We would like the identity of the current user to be propagated over the remote EJB call.

I am trying to set up Identity propagation according to the JBoss documentation.

BEARER_TOKEN is listed as a supported mechanism. The ejb system is configured to use the new HTTP transport (call target is http://server:port/wildfly-services), instead of the remote+http protocol.

I would expect the bearer token to be added as an HTTP “Authorization: Bearer” header by the forwarding server, when making the ejb call to the receiving server, however this does not happen and the HTTP response is 401.

This is the configuration of the forwarding server:

/subsystem=ejb3/application-security-domain=other:write-attribute(name=security-domain,value=ApplicationDomain)

/subsystem=elytron/authentication-configuration=remote-ejb-configuration:add(security-domain=ApplicationDomain)
/subsystem=elytron/authentication-context=remote-ejb-context:add(match-rules=[{authentication-configuration=remote-ejb-configuration}])

/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=remote-partner-ejb/:add(host="server",port="8080")
/subsystem=remoting/remote-outbound-connection=remote-ejb:add(outbound-socket-binding-ref=remote-partner-ejb, authentication-context=remote-ejb-context)

/subsystem=undertow/server=default-server/host=default-host/setting=http-invoker:undefine-attribute(name=security-realm)
/subsystem=undertow/server=default-server/host=default-host/setting=http-invoker:write-attribute(name=http-authentication-factory, value=jwt-http-authentication)

And here is the error seen on the forwarding server side:

Caused by: javax.naming.AuthenticationException: WFHTTP000013: Authentication failed (full response ClientResponse{responseHeaders={Connection=[keep-alive], WWW-Authenticate=[Bearer realm="jwt-realm"], Set-Cookie=[JSESSIONID=0BAxZeBpW-RuStmtGFylfbYBpypUJYsqLMlsrw04.partner-as-76d77b7f5c-6bcb6; path=/wildfly-services], Server=[nginx/1.23.3], Content-Type=[text/html], Content-Length=[77], Date=[Mon, 09 Jan 2023 10:34:00 GMT]}, responseCode=401, status='Unauthorized', protocol=HTTP/1.1})

There is a quickstart showing identity propagation, but it uses SASL authentication, which does not support BEARER_TOKEN mechanism

Has anyone had luck with a setup like this?


问:
javax.xml.xpath.XPath.evalute method could not resolve simple xpath
I need to design a utility which searches node using input xpath in XML document and set its value as per given input.

```<code>import java.io.File;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

import org.apache.commons.io.FileUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
public class XMLUtil
{

        private XPath xPath;
        private Document xmlDoc;
        private String xmlName;

        public XMLUtil(String xmlName) {
            this.xmlName = xmlName;
            System.out.println(System.getProperty("user.dir"));
            File srcXMLFile = new File(System.getProperty("user.dir") + xmlName);
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            try {
                xmlDoc = factory.newDocumentBuilder().parse(srcXMLFile);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            xPath = XPathFactory.newInstance().newXPath();
        }

        public void changeXMLNodeValue(String xpath, String query) {
            try {

            Node node = (Node) xPath.compile(xpath).evaluate(xmlDoc, XPathConstants.NODE);
            node.setTextContent(query);

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    public static void main(String[] args) {
        XMLUtil xmlUtil = new XMLUtil("tc01.xml");
    xmlUtil.changeXMLNodeValue("//Customer/State/City","Hyderabad");
    }
    }

</code>```

XML File:tc01.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<Customer>
<State>
<value>Andhra</value>
<City>
<value>amravati</value>
</City>
</State>
</Customer>

</code>```

Running the code is throwing NullPointerException at changeXMLNodeValue method on trying to compile and evalute the xpath to fetch the node.
Node node = (Node) xPath.compile(xpath).evaluate(xmlDoc, XPathConstants.NODE);

This is a simple xml without any namespace requirement.
I am using the API first please let me know if I missed something.

Body:
I need to design a utility which searches node using input xpath in XML document and set its value as per given input.

import java.io.File;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

import org.apache.commons.io.FileUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
public class XMLUtil
{

        private XPath xPath;
        private Document xmlDoc;
        private String xmlName;

        public XMLUtil(String xmlName) {
            this.xmlName = xmlName;
            System.out.println(System.getProperty("user.dir"));
            File srcXMLFile = new File(System.getProperty("user.dir") + xmlName);
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            try {
                xmlDoc = factory.newDocumentBuilder().parse(srcXMLFile);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            xPath = XPathFactory.newInstance().newXPath();
        }

        public void changeXMLNodeValue(String xpath, String query) {
            try {

            Node node = (Node) xPath.compile(xpath).evaluate(xmlDoc, XPathConstants.NODE);
            node.setTextContent(query);

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    public static void main(String[] args) {
        XMLUtil xmlUtil = new XMLUtil("tc01.xml");
    xmlUtil.changeXMLNodeValue("//Customer/State/City","Hyderabad");
    }
    }

XML File:tc01.xml

<?xml version="1.0" encoding="UTF-8"?>
<Customer>
<State>
<value>Andhra</value>
<City>
<value>amravati</value>
</City>
</State>
</Customer>

Running the code is throwing NullPointerException at changeXMLNodeValue method on trying to compile and evalute the xpath to fetch the node.
Node node = (Node) xPath.compile(xpath).evaluate(xmlDoc, XPathConstants.NODE);

This is a simple xml without any namespace requirement.
I am using the API first please let me know if I missed something.


问:
Google Pay for UK - administrativeArea is empty
Integrated the GooglePay and able to launch GPay Sheet successfully. Prefilled with test card and test UK address. On clicking "continue", in response the administrativeArea is blank  - always for other UK address also.

{ ... "shippingAddress": { "address3": "", "sortingCode": "", "address2": "", "countryCode": "GB", "address1": "6 Pancras Square", "postalCode": "N1C 4AG", "name": "UK User", "locality": "London", "administrativeArea": "" } }

I could find other similarity also while adding address the state/county option is not present for UK (as in below screenshot).


问:
How to fill RecyclerView equally with LinearLayoutManager in XML?
I have a huge thing that I cannot understand! Hoping on your help!

Example:
6 children are
Equally filled in RecyclerView by height with GridLayoutManager. But I need LinearLayoutManager(Don't ask me why, it doesn't matter).

Example using GridLayoutManager - all 6 children are equally filled:

Example using LinearLayoutManager - 6 children filled and a huge white spot is left at the bottom:

So, how to fill RecyclerView so it would fill the screen with 6 children with LinearLayoutManager as it is filling with GridLayoutManager?
I'm asking how to make it in XML!!!
Thank you!


问:
ansible failing to find binaries rsync and pwgen
I am running ansible 2.14.1 running against Debian 11.  In the first instance, I install rsync on the target host, then try the synchronize module. I get the error "No such file or directory" when referencing the rsync binary, which is installed on the target in /usr/bin.

In the second instance, I install pwgen, but then when trying to use it, I again get the error "No such file or directory."  pwgen is installed on the target in /usr/bin.

In ansible.log, the ansible_env.PATH includes /usr/bin.

Why is ansible unable to find these binaries?


问:
Anaconda Mac Terminal Base Environment
This is for a brand new Macbook setup for MacOs Ventura 13.1.

After installing Anaconda, when I launch terminal, I see base environment activated.

I am able to deactivate by running

conda deactivate

But if I can recall correctly, earlier this behaviour never happened i.e. base environment on launch.

Also, when I deactivate it, I can't launch ipython.

Furthermore, it seems the default on Mac Terminal is now zsh.

I am planning to install iTerm2, will I see same behavior?

Or have I messed up something?

Title: Anaconda Mac Terminal Base Environment


问:
why dbeaver puts ""(quotes) to my column name?
I created a table in my SQLite database in DBeaver. When I generate SELECT query:
SELECT "col1", col2, col3, col4 FROM mytable;

there is double quotes on my first column name. I directly created it as col1 and in table view it shows as col1. But in SQL query it "col1". There is something that i don't know related to SQLite? col1,3,4 are TEXT by the way.

I rewrite its name in table view but its still same.


问:
Can't fetch data after joining tables. data saved on database was shoing before joining table but after joining tables i cant input data
I cant fetch data on list from data base.

https://github.com/roshanjoshi2/Hostel-Management-System

There's no error showing to solve it.

I tried joining tables. but there's no output


问:
Flutter iOS: The bundle xxxxxxx contains disallowed nested bundles
We recently upgraded to Flutter 3.3.7 in our iOS project, and started to get the following error when uploading to TestFlight: Asset validation failed Invalid Bundle. The bundle at 'XXXXXXXXX' contains disallowed nested bundles.

After several intents of understanding the root cause, we managed to create a minimum reproducible example, isolated from the rest of our project: https://github.com/alansteiman/FlutterExample

In this example, Flutter is integrated via Cocoapods using this doc, as a dependency of a framework that is dynamically linked to the main app:


问:
How to type an aswer with the exec from child_process
I use exec commands in Ubuntu very offten, I use it with promisify:

import { exec } from 'child_process'

const execFunction = promisify(exec)

Then when I run a command like:

await execFunction('sudo ufw status')

That command will ask me a password, the thing is I can't answer any question (like the question for the password) when using that command, so my question is: is there any way to pass an answer or something like that for the exec command?


问:
Wordpress shortcode function - Get current status of Twitch Live
I've searched a lot and I couldn't find anything, I'm looking for a way to create a function to get the result if a channel is streaming or not and store the result in a shortcode. I have tried a thousand ways to make a request but I am unable, now I just want to get the shortcode so I can use it for my website.</p>


问:
High CPU usage in my C# ASP.NET Core 6 MVC app on Linux server
So, I have been struggling with C# asp.net core 6 MVC and high CPU usage recently. Here is my problem:

I've been using perfview to know which thread or process is causing this problem but I'm not able to do it. Based in this image that I left below I understand that my app is consuming 360% of cpu or more than 3.6 cores. Which is right, because when I use a htop to monitor the process in my Linux server (I left other photo below) I get that my app is consuming 4 cores. Sometimes my app just increse and increse until it gets the 8 cores (which is obviously a problem).

Other thing that is strange is that the image that I left below of perfview my app it is not doing hard work. So, it shouldn't get that high cpu usage. because when I took this particulary sample nobody was using the app.

And other thing is that when I use dotnet-counters monitor to know how much is consuming my app I get the next results and I get confused because it says that my app is consuming 50% of CPU which as we saw before it's not right.

I've been reading that I should not use task.result and task.wait (thing that i don't do because I understand that it slow down my app).

PD: I don't have this problem in testing. But when I use my app in production I get the high CPU usage.

Someone know how could I resolve this or tell me where to look please? Thank you very much!


问:
Firebase Messaging > https://fcmregistrations.googleapis.com/v1/projects/dr-plano/registrations responds with invalid argument
we use Firebase to implement web push-notification. I tested our implementation on multiple devices and it works fine. Only on a single device (Firefox, Windows 11) we are getting an error, and I am clueless. Hopefully, somebody has an idea.

We use Firebase JavaScript SDK. The service-worker is pretty standard:

```<code>// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/9.15.0/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/9.15.0/firebase-messaging-compat.js');

// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
  apiKey: '...',
  authDomain: '...',
  databaseURL: '...',
  projectId: '...',
  storageBucket: '...',
  messagingSenderId: '...',
  appId: '...',
});

// Retrieve an instance of Firebase Messaging so that it can handle background
// messages.
const messaging = firebase.messaging();
</code>```

We register the service-worker manually and then get the token with the following code:

```<code>getToken(this.messaging, {
    vapidKey: this.VAPID_KEY,
    serviceWorkerRegistration: this.serviceWorker
}).then((token) => {
    // store the token
})
</code>```

As I said, this setup works fine for multiple tested devices. On the Firefox (Windows 11) device with problems the call to POST https://fcmregistrations.googleapis.com/v1/projects/dr-plano/registrations gives the following response:

```<code>{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}
</code>```

The payload to the API call is:

```<code>{
  "web": {
    "endpoint": "https://updates.push.services.mozilla.com/wpush/v2/gAAAAABju_PDv-sqOv-BT13zqOdPb53vQzspTgrTex_vBnKUFfkLsU_sdikXdcMiTbjGazHO5Hr3U_OpvLMXZoX9FP1o5gz3PSInxS6KAORmDfUxzuVtaW5Mnyy8wHOvkF5MpmsfH_KKFgPOol8Z3A-IlRoCLXoYuWIeuvSMRtz-N3ZnfnQmoZ8",
    "auth": "...",
    "p256dh": "...",
    "applicationPubKey": "..."
  }
}
</code>```

I have anonymized project specific data with .... Let me know if anything is relevant.

I have tried removing the service-worker and letting it be recreated. And also resetting the permission for getting notifications in the Firefox browser. Nothing helped. I would appreciate any idea.

Regards,
Milad

Body:
we use Firebase to implement web push-notification. I tested our implementation on multiple devices and it works fine. Only on a single device (Firefox, Windows 11) we are getting an error, and I am clueless. Hopefully, somebody has an idea.

We use Firebase JavaScript SDK. The service-worker is pretty standard:

// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/9.15.0/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/9.15.0/firebase-messaging-compat.js');

// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
  apiKey: '...',
  authDomain: '...',
  databaseURL: '...',
  projectId: '...',
  storageBucket: '...',
  messagingSenderId: '...',
  appId: '...',
});

// Retrieve an instance of Firebase Messaging so that it can handle background
// messages.
const messaging = firebase.messaging();

We register the service-worker manually and then get the token with the following code:

getToken(this.messaging, {
    vapidKey: this.VAPID_KEY,
    serviceWorkerRegistration: this.serviceWorker
}).then((token) => {
    // store the token
})

As I said, this setup works fine for multiple tested devices. On the Firefox (Windows 11) device with problems the call to POST https://fcmregistrations.googleapis.com/v1/projects/dr-plano/registrations gives the following response:

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

The payload to the API call is:

{
  "web": {
    "endpoint": "https://updates.push.services.mozilla.com/wpush/v2/gAAAAABju_PDv-sqOv-BT13zqOdPb53vQzspTgrTex_vBnKUFfkLsU_sdikXdcMiTbjGazHO5Hr3U_OpvLMXZoX9FP1o5gz3PSInxS6KAORmDfUxzuVtaW5Mnyy8wHOvkF5MpmsfH_KKFgPOol8Z3A-IlRoCLXoYuWIeuvSMRtz-N3ZnfnQmoZ8",
    "auth": "...",
    "p256dh": "...",
    "applicationPubKey": "..."
  }
}

I have anonymized project specific data with .... Let me know if anything is relevant.

I have tried removing the service-worker and letting it be recreated. And also resetting the permission for getting notifications in the Firefox browser. Nothing helped. I would appreciate any idea.

Regards,
Milad


问:
Cook's Distance in fixest::feols
I have a dataset with 1-N observations per firm per year (e.g., dividends, some pay quarterly, other yearly, some pay only in a single year, others in multiple years). I want to estimate a regression model with firm and year fixed effects. I do this using the feols function from fixest.

Now I want to analyze cooks.distance to see if I have outliers in my model and get the following error message:

```<code>cooks.distance(model)
</code>```

Error in UseMethod("cooks.distance") :
no applicable method for 'cooks.distance' applied to an object of class "fixest"

Is there a cooks.distance formula that works with feols?

If not, how would I calculate this myself. I know the formula would be something like:

```<code>leverage = (1 / number of observations) + (predictors' * (X'X)^(-1) * predictors)
influence = leverage * residual^2
Cook's distance = influence / (leverage * (1 - leverage))
</code>```

Here, I don't know how to get the predictors from feols and what exactly X would be (and how to get that)?

Initially, I tried the plm package but because the combination of firm & year is not unique (e.g., multiple events per year), I could not add the two as fixed effects. I therefore selected the feols package.

I also tried

```<code>check_outliers()
</code>```

from the performance package and received

Converting missing values (NA) into regular values currently not possible for variables of class NULL.

as error message.

Title: Cook's Distance in fixest::feols

Body:
I have a dataset with 1-N observations per firm per year (e.g., dividends, some pay quarterly, other yearly, some pay only in a single year, others in multiple years). I want to estimate a regression model with firm and year fixed effects. I do this using the feols function from fixest.

Now I want to analyze cooks.distance to see if I have outliers in my model and get the following error message:

cooks.distance(model)

Error in UseMethod("cooks.distance") :
no applicable method for 'cooks.distance' applied to an object of class "fixest"

Is there a cooks.distance formula that works with feols?

If not, how would I calculate this myself. I know the formula would be something like:

leverage = (1 / number of observations) + (predictors' * (X'X)^(-1) * predictors)
influence = leverage * residual^2
Cook's distance = influence / (leverage * (1 - leverage))

Here, I don't know how to get the predictors from feols and what exactly X would be (and how to get that)?

Initially, I tried the plm package but because the combination of firm & year is not unique (e.g., multiple events per year), I could not add the two as fixed effects. I therefore selected the feols package.

I also tried

check_outliers()

from the performance package and received

Converting missing values (NA) into regular values currently not possible for variables of class NULL.

as error message.


问:
Ag-Grid refreshServerSideStore({ purge: true }) not calling the server
this.gridApi.refreshServerSideStore({ purge: true });
When I using this method to refresh my Grid too quicly it is not calling the Server every time.
I am using server side enterprise ag-grid</p>
```<code>    this.gridApi.refreshServerSideStore({ purge: true });
</code>```

Body:
this.gridApi.refreshServerSideStore({ purge: true });
When I using this method to refresh my Grid too quicly it is not calling the Server every time.
I am using server side enterprise ag-grid

    this.gridApi.refreshServerSideStore({ purge: true });