问:
How do i save the email I created using java mail API as a draft?
I have this code that intended to save the email as draft, but it keeps sending the message anyway.

```<code>        final String username = "xxx";
        final String password = "xxx";

        Properties props = new Properties();
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.host", "outlook.office365.com");
        props.put("mail.smtp.port", "587");

        Session session = Session.getInstance(props,
                new javax.mail.Authenticator() {
                    protected PasswordAuthentication getPasswordAuthentication() {
                        return new PasswordAuthentication(username, password);
                    }
                });

        try {

            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress("xxx"));
            message.setRecipients(Message.RecipientType.TO,
                    InternetAddress.parse("xxx"));
            message.setSubject("Test");
            message.setText("HI");

            message.setFlag(Flags.Flag.DRAFT, true);
            message.saveChanges();
            Transport.send(message);

        } catch (MessagingException e) {
            throw new RuntimeException(e);
        }
</code>```

i tried removing the Transport.send(message); but then it just do nothing. What i wanted is that the email just saved in the Drafts folder on my outlook.

Body:
I have this code that intended to save the email as draft, but it keeps sending the message anyway.

        final String username = "xxx";
        final String password = "xxx";

        Properties props = new Properties();
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.host", "outlook.office365.com");
        props.put("mail.smtp.port", "587");

        Session session = Session.getInstance(props,
                new javax.mail.Authenticator() {
                    protected PasswordAuthentication getPasswordAuthentication() {
                        return new PasswordAuthentication(username, password);
                    }
                });

        try {

            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress("xxx"));
            message.setRecipients(Message.RecipientType.TO,
                    InternetAddress.parse("xxx"));
            message.setSubject("Test");
            message.setText("HI");

            message.setFlag(Flags.Flag.DRAFT, true);
            message.saveChanges();
            Transport.send(message);

        } catch (MessagingException e) {
            throw new RuntimeException(e);
        }

i tried removing the Transport.send(message); but then it just do nothing. What i wanted is that the email just saved in the Drafts folder on my outlook.


来源: stackexchange

问:
How to set defaultValues in Mui Select component
I use React and Redux toolkit and Material Ui.

The data of select component is retrieved and configured using redux's createAsyncThunk.

I can confirm that I am able to create select boxes.

This is code of "create select component".

```<code>export const fetchHourList = createAsyncThunk(
 "HourList",
 async () => {
  const res = await axios.get(url)
  return res.data;
 }
)
</code>```

This is code of React Componet.

```<code>export default function aaa(props) {
  const [hour, setHour] = useState('');

  const dispatch: store.AppDispatch = useDispatch();
  // select component list
  const hourList = useHourlist();
  // data list
  const todoList = useTodoList();

  useEffect(() => {
   const promise = async () => {
    await dispatch(fetchHourList());
    await dispatch(fetchTodoList());
   }
   promise();
  }, [dispatch]);

  useEffect(() => {
   setHour("000" + todoList['Hour']);   // I am hoping to get a "00004".
  });

  return (
   // I am componentizing the select component
   <Inputselect
    list = {hourList}
    // Not set to default value. I was able to initialize it by typing "00004" directly.
    defaultValue = { hour }
    onChange = {handleHourChange}
    ...
   />
   { `Confirm Hour:${Hour}` }  // I can check the value here.
  )
}
</code>```

The contents of "todoList" are as follows.

data of todoList

{"seqNo": "0000000001", "operatorId":"0001", "Hour":"04", ...}

data of HourList

Array-Object
cd1: "00001", nm1:"01",

cd1: "00002", nm1:"02",

cd1: "00003", nm1:"03",

cd1: "00004", nm1:"04",

Why can I see "Confirm Hour:${Hour}" but not "defaultValue = { hour }"

Please let me know your solution.

Thank you.

ContentLicense: CC BY-SA 4.0

Body:
I use React and Redux toolkit and Material Ui.

The data of select component is retrieved and configured using redux's createAsyncThunk.

I can confirm that I am able to create select boxes.

This is code of "create select component".

export const fetchHourList = createAsyncThunk(
 "HourList",
 async () => {
  const res = await axios.get(url)
  return res.data;
 }
)

This is code of React Componet.

export default function aaa(props) {
  const [hour, setHour] = useState('');

  const dispatch: store.AppDispatch = useDispatch();
  // select component list
  const hourList = useHourlist();
  // data list
  const todoList = useTodoList();

  useEffect(() => {
   const promise = async () => {
    await dispatch(fetchHourList());
    await dispatch(fetchTodoList());
   }
   promise();
  }, [dispatch]);

  useEffect(() => {
   setHour("000" + todoList['Hour']);   // I am hoping to get a "00004".
  });

  return (
   // I am componentizing the select component
   <Inputselect
    list = {hourList}
    // Not set to default value. I was able to initialize it by typing "00004" directly.
    defaultValue = { hour }
    onChange = {handleHourChange}
    ...
   />
   { `Confirm Hour:${Hour}` }  // I can check the value here.
  )
}

The contents of "todoList" are as follows.

data of todoList

{"seqNo": "0000000001", "operatorId":"0001", "Hour":"04", ...}

data of HourList

Array-Object
cd1: "00001", nm1:"01",

cd1: "00002", nm1:"02",

cd1: "00003", nm1:"03",

cd1: "00004", nm1:"04",

Why can I see "Confirm Hour:${Hour}" but not "defaultValue = { hour }"

Please let me know your solution.

Thank you.


问:
Weird Sticky Element Bounce Snap on Firefox Android
I'm facing a very peculiar issue that exists on Firefox Android but works okay on Firefox Desktop and Chrome Android/Desktop.

The issue is when I scroll the page, the sticky Header title element should nicely snap to the bottom of the featured image element but on Firefox Android on actual device, it resulted in a small gap before it "sticky snaps".

I already tried recreating the bare minimum HTML template on Codepen but unfortunately (or fortunately?), it didn't exhibit the same issue...

Header

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

```
<pre class="lang-css prettyprint-override"><code>body {
  margin: 0px;
  min-height: 100vh;
}
.wrapper {
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  height: 100%;
  width: 100%;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}
.content {
  width: 100%;
  max-width: 1280px;
  -webkit-box-flex: 1;
  -webkit-flex-grow: 1;
  -ms-flex-positive: 1;
  flex-grow: 1;
  padding-top: 4rem;
}
#media-wrapper {
  position: relative;
  height: 100%;
}
#media {
  position: absolute;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
}
#media > img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
#header {
  position: -webkit-sticky;
  position: sticky;
  bottom: 16rem;
  box-sizing: border-box;
  max-width: 48rem;
  outline-style: solid;
  overflow-anchor: none;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  margin-inline: auto;
  background-color: white;
  padding: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
}
#description {
  padding: 2rem;
  position: relative;
}
</code>```

Refer to my Dropbox video links as this issue doesn't exhibit when using Responsive Design mode in Firefox Desktop. The recording was capture on Xiaomi Mi 9T.

https://www.dropbox.com/s/6wwm41p969671fw/Chrome.mp4?dl=0

https://www.dropbox.com/s/m5r1neprx0lgk7m/Firefox%20Nightly-1.mp4?dl=0

I'm running out of idea as it works fine on iOS 15.4 Safari on iPhone 13 Pro Max. Tested on both Xiaomi Mi 9T and Samsung Galaxy S21 FE where all Firefox variants exhibit the issue.

Body:
I'm facing a very peculiar issue that exists on Firefox Android but works okay on Firefox Desktop and Chrome Android/Desktop.

The issue is when I scroll the page, the sticky Header title element should nicely snap to the bottom of the featured image element but on Firefox Android on actual device, it resulted in a small gap before it "sticky snaps".

I already tried recreating the bare minimum HTML template on Codepen but unfortunately (or fortunately?), it didn't exhibit the same issue...

Header

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

          サクラはシベリア、日本、中国、米国・カナダ[2] など、主に北半球の温帯に広範囲に自生している[3][4]。歴史的に日本文化に馴染みの深い植物であり、その変異しやすい特質から特に日本で花見目的に多くの栽培品種が作出されてきた（#日本における栽培品種と品種改良、#日本人とサクラ）。このうち観賞用として最も多く植えられているのがソメイヨシノである。鑑賞用としてカンザンなど日本由来の多くの栽培品種が世界各国に寄贈されて各地に根付いており（日本花の会、キューガーデン、全米桜祭りなど参照）、英語では桜の花のことを「Cherry blossom」と呼ぶのが一般的であるが、日本文化の影響から「Sakura」と呼ばれることも多くなってきている。

body {
  margin: 0px;
  min-height: 100vh;
}
.wrapper {
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  height: 100%;
  width: 100%;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}
.content {
  width: 100%;
  max-width: 1280px;
  -webkit-box-flex: 1;
  -webkit-flex-grow: 1;
  -ms-flex-positive: 1;
  flex-grow: 1;
  padding-top: 4rem;
}
#media-wrapper {
  position: relative;
  height: 100%;
}
#media {
  position: absolute;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
}
#media > img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
#header {
  position: -webkit-sticky;
  position: sticky;
  bottom: 16rem;
  box-sizing: border-box;
  max-width: 48rem;
  outline-style: solid;
  overflow-anchor: none;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  margin-inline: auto;
  background-color: white;
  padding: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
}
#description {
  padding: 2rem;
  position: relative;
}

Refer to my Dropbox video links as this issue doesn't exhibit when using Responsive Design mode in Firefox Desktop. The recording was capture on Xiaomi Mi 9T.

https://www.dropbox.com/s/6wwm41p969671fw/Chrome.mp4?dl=0

https://www.dropbox.com/s/m5r1neprx0lgk7m/Firefox%20Nightly-1.mp4?dl=0

I'm running out of idea as it works fine on iOS 15.4 Safari on iPhone 13 Pro Max. Tested on both Xiaomi Mi 9T and Samsung Galaxy S21 FE where all Firefox variants exhibit the issue.


问:
FCM Notification
I am using firebase push notification in ionic 5 application, Here my problem is notification not receiving when inside the app but when in background the notification received immediately.

I am using firebase api to send push notification using a json.

Here is my code Using FCM notification

```<code>FCM.getToken().then(token => {
        console.log(token);
        // alert('new:' + token);
        this.updatePushToken(token);
    });
    FCM.onNotification().subscribe(data => {
        console.log(data);
        if (data.wasTapped) {
            console.log('Received in background');
        } else {
            console.log('Received in foreground');
        }
    });
    FCM.onTokenRefresh().subscribe(token => {
        console.log(token);
        // alert("refresh : " + token);
        // Register your new token in your back-end if you want
        // backend.registerToken(token);
    });
</code>```

Title: FCM Notification

Body:
I am using firebase push notification in ionic 5 application, Here my problem is notification not receiving when inside the app but when in background the notification received immediately.

I am using firebase api to send push notification using a json.

Here is my code Using FCM notification

FCM.getToken().then(token => {
        console.log(token);
        // alert('new:' + token);
        this.updatePushToken(token);
    });
    FCM.onNotification().subscribe(data => {
        console.log(data);
        if (data.wasTapped) {
            console.log('Received in background');
        } else {
            console.log('Received in foreground');
        }
    });
    FCM.onTokenRefresh().subscribe(token => {
        console.log(token);
        // alert("refresh : " + token);
        // Register your new token in your back-end if you want
        // backend.registerToken(token);
    });


问:
This function takes a lot of time to run on Google Colab
Input : x_train, y_train.
Output : Hessian matrix of loss function with respect to weights.

```<code>def compute_hessian(x_train_array,y_train_array):##functio which calculates and returns the hessian matrix
    hessian_row_mat = np.empty(shape = (init_dim,init_dim), dtype = float)
    for i in range(len(model.weights)):

      hessian_col_mat = np.empty(shape = (init_dim,init_dim),dtype = float)
      for j in range(len(model.weights)):

        with tf.GradientTape(persistent = True) as tape1:

          with tf.GradientTape(persistent = True) as tape2:
            feature_vector = x_train_array.reshape(1,6)
            for k in range(len(model.layers)):
                layer = model.layers[k]
                y = layer(feature_vector)
                feature_vector = y
            loss = tf.keras.metrics.mean_squared_error(y,y_train_array)
          g = tape2.gradient(loss,model.weights[i])
          g = tf.reshape(g,[-1])
        h = tape1.jacobian(g,model.weights[j])
        h_array = tf.make_ndarray(tf.make_tensor_proto(tf.convert_to_tensor(h)))
        h_shape = h_array.shape
        if j%2 == 0:
            h_array = h_array.reshape(h_shape[0],h_shape[1]*h_shape[2])

        if j == 0:
          hessian_col_mat = h_array
        else:
          hessian_col_mat = np.concatenate((hessian_col_mat,h_array), axis = 1)

      if i==0:
        hessian_row_mat = hessian_col_mat
      else:
        hessian_row_mat = np.concatenate((hessian_row_mat,hessian_col_mat), axis = 0)
    return hessian_row_mat
</code>```

In the above code we are trying to compute the hessian of loss function for each layer of the neural network with respect of all the weights with one training example. We need to compute the same for all the training examples. But the thing is, it takes about a minute for one training example, and we have about 300 such training examples. Thus, it would take about 5 hours !!! for entire training set.

Is there a better way to form a Hessian matrix, so that the computation time can be reduced ?

Body:
Input : x_train, y_train.
Output : Hessian matrix of loss function with respect to weights.

def compute_hessian(x_train_array,y_train_array):##functio which calculates and returns the hessian matrix
    hessian_row_mat = np.empty(shape = (init_dim,init_dim), dtype = float)
    for i in range(len(model.weights)):

      hessian_col_mat = np.empty(shape = (init_dim,init_dim),dtype = float)
      for j in range(len(model.weights)):

        with tf.GradientTape(persistent = True) as tape1:

          with tf.GradientTape(persistent = True) as tape2:
            feature_vector = x_train_array.reshape(1,6)
            for k in range(len(model.layers)):
                layer = model.layers[k]
                y = layer(feature_vector)
                feature_vector = y
            loss = tf.keras.metrics.mean_squared_error(y,y_train_array)
          g = tape2.gradient(loss,model.weights[i])
          g = tf.reshape(g,[-1])
        h = tape1.jacobian(g,model.weights[j])
        h_array = tf.make_ndarray(tf.make_tensor_proto(tf.convert_to_tensor(h)))
        h_shape = h_array.shape
        if j%2 == 0:
            h_array = h_array.reshape(h_shape[0],h_shape[1]*h_shape[2])

        if j == 0:
          hessian_col_mat = h_array
        else:
          hessian_col_mat = np.concatenate((hessian_col_mat,h_array), axis = 1)

      if i==0:
        hessian_row_mat = hessian_col_mat
      else:
        hessian_row_mat = np.concatenate((hessian_row_mat,hessian_col_mat), axis = 0)
    return hessian_row_mat

In the above code we are trying to compute the hessian of loss function for each layer of the neural network with respect of all the weights with one training example. We need to compute the same for all the training examples. But the thing is, it takes about a minute for one training example, and we have about 300 such training examples. Thus, it would take about 5 hours !!! for entire training set.

Is there a better way to form a Hessian matrix, so that the computation time can be reduced ?


问:
Rascal Charts Broken
Rascal has a Charts library, and VSCode just got a recent update with working charts. However, when just applying the code from the charts library, importing of namespaces do not work within either REPL or modules with the Eclipse plugin.

```<code>rascal>import vis::Charts;
|prompt:///|(0,19,<1,0>,<1,19>): Could not import module vis::Charts: can not find in search path
</code>```

A comparable set of code within a module results into the following error:

```<code>public void drawPieChart(map[str, int] code, str label){
    pieChart(toRel(code));
}
</code>```

Which is nothing more than an analysed program with classes and their respective LOC.

The results of calling that function:

```<code>rascal>readTest();
Reloading module Test
The total lines in this project: 17507
|project://*********/src/Visualize.rsc|(968,8,<35,1>,<35,9>): Undeclared variable: pieChart
Advice: |http://tutor.rascal-mpl.org/Errors/Static/UndeclaredVariable/UndeclaredVariable.html|
</code>```

I tried importing charts from vis::Charts via the console (in the right project), tried it within a module and updated to version 0.26.7. Still no dice and broken Charts namespace.

There are problems with the figure library (judging by the amount of figure-library tags) in the issue tracker on GitHub, but I wasn't aware that it was removed completely, nor was it in any way clear that it was not functional on the documentation page. What am I doing wrong? If I am not doing anything wrong, when is it expected to be fixed?

Title: Rascal Charts Broken

Body:
Rascal has a Charts library, and VSCode just got a recent update with working charts. However, when just applying the code from the charts library, importing of namespaces do not work within either REPL or modules with the Eclipse plugin.

rascal>import vis::Charts;
|prompt:///|(0,19,<1,0>,<1,19>): Could not import module vis::Charts: can not find in search path

A comparable set of code within a module results into the following error:

public void drawPieChart(map[str, int] code, str label){
    pieChart(toRel(code));
}

Which is nothing more than an analysed program with classes and their respective LOC.

The results of calling that function:

rascal>readTest();
Reloading module Test
The total lines in this project: 17507
|project://*********/src/Visualize.rsc|(968,8,<35,1>,<35,9>): Undeclared variable: pieChart
Advice: |http://tutor.rascal-mpl.org/Errors/Static/UndeclaredVariable/UndeclaredVariable.html|

I tried importing charts from vis::Charts via the console (in the right project), tried it within a module and updated to version 0.26.7. Still no dice and broken Charts namespace.

There are problems with the figure library (judging by the amount of figure-library tags) in the issue tracker on GitHub, but I wasn't aware that it was removed completely, nor was it in any way clear that it was not functional on the documentation page. What am I doing wrong? If I am not doing anything wrong, when is it expected to be fixed?


问:
Jackson how to deserialize json using custom resolver with @JsonTypeInfo
There are two Java beans Child and Parent, enum TypeEnum

@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        property = "type",
        visible = true,
        defaultImpl = Parent.class)
@JsonSubTypes({
        @JsonSubTypes.Type(value = Child.class, name = "CHILD")
})
public class Parent {
   protected String type;

   public getType() {...}
   public setType(){...}
}
```
<pre class="lang-java prettyprint-override"><code>public class Child extends Parent {
}
</code>```

public TypeEnum {

  PARENT(1),

  CHILD(2);

  private int code;

  TypeEnum(int code) {
        code = code;
  }
}
```
<p>When deserializing, if type is <code>"PARENT"</code> then convert it to bean <code>Parent</code>, if type is <code>"CHILD"</code> convert it to bean <code>CHILD</code></p>
<pre class="lang-json prettyprint-override"><code>{
  "type": "PARENT";
}
</code>```

while, the type value is 1 and 2 in previously data as below, current type value is TypeEnum#code.

{
  "type": 1;
}
```
<pre class="lang-json prettyprint-override"><code>{
  "type": 2;
}
</code>```

I want to deserialize these two scenarios using custom resolver as below, so whether "type": 1 or "type": "PARENT" will be deserialized PARENT, but how to implement custom resolver, any idea?

```<code>@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        property = "type",
        visible = true,
        defaultImpl = Parent.class)
@JsonSubTypes({
        @JsonSubTypes.Type(value = Child.class, name = "CHILD")
})
@JsonTypeIdResolver(CustomResolver.class)
@JsonDeserialize(using = CustomSerializer.class)
public class Parent {...}
</code>```

Body:
There are two Java beans Child and Parent, enum TypeEnum

@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        property = "type",
        visible = true,
        defaultImpl = Parent.class)
@JsonSubTypes({
        @JsonSubTypes.Type(value = Child.class, name = "CHILD")
})
public class Parent {
   protected String type;

   public getType() {...}
   public setType(){...}
}

public class Child extends Parent {
}

public TypeEnum {

  PARENT(1),

  CHILD(2);

  private int code;

  TypeEnum(int code) {
        code = code;
  }
}

When deserializing, if type is "PARENT" then convert it to bean Parent, if type is "CHILD" convert it to bean CHILD

{
  "type": "PARENT";
}

while, the type value is 1 and 2 in previously data as below, current type value is TypeEnum#code.

{
  "type": 1;
}

{
  "type": 2;
}

I want to deserialize these two scenarios using custom resolver as below, so whether "type": 1 or "type": "PARENT" will be deserialized PARENT, but how to implement custom resolver, any idea?

@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        property = "type",
        visible = true,
        defaultImpl = Parent.class)
@JsonSubTypes({
        @JsonSubTypes.Type(value = Child.class, name = "CHILD")
})
@JsonTypeIdResolver(CustomResolver.class)
@JsonDeserialize(using = CustomSerializer.class)
public class Parent {...}


问:
Why doesnt my Custom Splash screen display when I access my Android application from an App Shortcut
I have added an animated Splash Screen to my current Android application using

```<code>  implementation "androidx.core:core-splashscreen:1.0.0"
</code>```

This works fine and my custom splash screen is shown as expected.

However my application also has multiple App Shortcuts that deeplinks into my application and when the user clicks on any app shortcut my custom splash screen is not displayed, the default system supplied splash screen is triggered, e.g. the app icon is shown.

How do i get my custom animated app splash screen to display irrespective of how my app is accessed?

Body:
I have added an animated Splash Screen to my current Android application using

  implementation "androidx.core:core-splashscreen:1.0.0"

This works fine and my custom splash screen is shown as expected.

However my application also has multiple App Shortcuts that deeplinks into my application and when the user clicks on any app shortcut my custom splash screen is not displayed, the default system supplied splash screen is triggered, e.g. the app icon is shown.

How do i get my custom animated app splash screen to display irrespective of how my app is accessed?


问:
Issue with creating new instance of can for STM32F429 Discovery board in rust when using stm32f4xx_hal
Problem while executing the example file can-send.rs from the stm32f4xx_hal crate [https://github.com/stm32-rs/stm32f4xx-hal/blob/master/examples/can-send.rs]
for stm32f429 Discovery board, cannot find any way to instantiate can using new(), the compiler shows error saying there is no such function like new().
I have been facing this issue since a while. It would be great if you could help.

The error log is like this:

          let can = dp.CAN1.can((tx, rx));
|                           ^^^ method not found in `CAN1`
```
<p>I wanted to initialize the can bus however there seems to be a problem doing that. This is from the stm32f4xx_hal examples</p>
```    use panic_halt as _;

    use bxcan::filter::Mask32;
    use bxcan::{Fifo, Frame, StandardId};
    use cortex_m_rt::entry;
    use nb::block;
    use stm32f4xx_hal::{pac, prelude::*};

    #[entry]
    fn main() -> ! {
    let dp = pac::Peripherals::take().unwrap();

    let rcc = dp.RCC.constrain();

    // To meet CAN clock accuracy requirements an external crystal or ceramic
    // resonator must be used. The blue pill has a 8MHz external crystal.
    // Other boards might have a crystal with another frequency or none at all.
    rcc.cfgr.use_hse(8.MHz()).freeze();

    let gpiob = dp.GPIOB.split();
    let mut can1 = {
        let rx = gpiob.pb8.into_alternate::<9>();
        let tx = gpiob.pb9.into_alternate::<9>();

        // let can = Can::new(dp.CAN1, (tx, rx));
        // or
        let can = dp.CAN1.can((tx, rx));

        bxcan::Can::builder(can)
            // APB1 (PCLK1): 8MHz, Bit rate: 500kBit/s, Sample Point 87.5%
            // Value was calculated with http://www.bittiming.can-wiki.info/
            .set_bit_timing(0x001c_0000)
            .enable()
    };

```

Body:
Problem while executing the example file can-send.rs from the stm32f4xx_hal crate [https://github.com/stm32-rs/stm32f4xx-hal/blob/master/examples/can-send.rs]
for stm32f429 Discovery board, cannot find any way to instantiate can using new(), the compiler shows error saying there is no such function like new().
I have been facing this issue since a while. It would be great if you could help.

The error log is like this:

          let can = dp.CAN1.can((tx, rx));
|                           ^^^ method not found in `CAN1`

I wanted to initialize the can bus however there seems to be a problem doing that. This is from the stm32f4xx_hal examples

    use panic_halt as _;

    use bxcan::filter::Mask32;
    use bxcan::{Fifo, Frame, StandardId};
    use cortex_m_rt::entry;
    use nb::block;
    use stm32f4xx_hal::{pac, prelude::*};

    #[entry]
    fn main() -> ! {
    let dp = pac::Peripherals::take().unwrap();

    let rcc = dp.RCC.constrain();

    // To meet CAN clock accuracy requirements an external crystal or ceramic
    // resonator must be used. The blue pill has a 8MHz external crystal.
    // Other boards might have a crystal with another frequency or none at all.
    rcc.cfgr.use_hse(8.MHz()).freeze();

    let gpiob = dp.GPIOB.split();
    let mut can1 = {
        let rx = gpiob.pb8.into_alternate::<9>();
        let tx = gpiob.pb9.into_alternate::<9>();

        // let can = Can::new(dp.CAN1, (tx, rx));
        // or
        let can = dp.CAN1.can((tx, rx));

        bxcan::Can::builder(can)
            // APB1 (PCLK1): 8MHz, Bit rate: 500kBit/s, Sample Point 87.5%
            // Value was calculated with http://www.bittiming.can-wiki.info/
            .set_bit_timing(0x001c_0000)
            .enable()
    };


问:
I try to create AR app by using react native and deepAr
I'm trying AR for mobile apps by using deepAr in React Native, my app is working perfectly, ask all permissions but the camera is not open black screen shows, If anyone has an idea how to solve this issue so kindly help me</p>


问:
NSUserDefaults setValue is invoking recursive operation
I have NSUserDefaults setValue inside my viewDidLoad event. When I set the value of a key using the following code then viewDidLoad is fired again.

```<code> [ud setValue:@"YES" forKey:@"isFoo"];
</code>```

Should the viewDidLoad fire after setting the user default value?

ContentLicense: CC BY-SA 3.0

Body:
I have NSUserDefaults setValue inside my viewDidLoad event. When I set the value of a key using the following code then viewDidLoad is fired again.

 [ud setValue:@"YES" forKey:@"isFoo"];

Should the viewDidLoad fire after setting the user default value?


问:
Egit Eclipse IDE 2022-12: How to log in GitHub accout with 2 steps (OTP)?
I am using Eclipse IDE 2022-12, Windows 10 x64.

Egit Eclipse IDE 2022-12: How to log in GitHub accout with 2 steps (OTP)?


问:
Cannot make server-side selectizeInput work
I have read all possible posts and threads about server-side selectizeInput, here and elsewhere... but no matter what I try, I cannot make it work.

I tried a few months back and eventually just gave up, but now I really need to make it work, so really hoping someone can shed some light.

I have my Shiny app that I built with "Package for Shiny app using Golem" in RStudio, and I pass my data around using reactive values.

The problem I face is very simple, I have a long list of IDs I want to show in a selectizeInputdrop-down menu, but I get the following warning:

Warning: The select input "bulk_side_ui_1-selected_ids" contains a
large number of options; consider using server-side selectize for
massively improved performance. See the Details section of the
?selectizeInput help topic.

This is my working code on the client side:

UI:

```<code>test_side_ui <- function(id, r){
  ns <- NS(id)
  tagList(
    uiOutput(outputId = ns("selected_ids"))
  )
}
</code>```

SERVER:

```<code>  test_side_server <- function(id, r){
  moduleServer( id, function(input, output, session){
    ns <- session$ns

    output$selected_ids <- renderUI({
      selectizeInput(inputId = ns("selected_ids"), label = "My IDs:",
                     choices = paste0('id',1:60000),
                     selected = NULL,
                     multiple = TRUE,
                     options = list(maxOptions = 100000L))
    })

    # add selection to reactive values
    observeEvent(input$selected_ids, {
      r$selected_ids <- input$selected_ids
    }, ignoreNULL = FALSE)
  })
}
</code>```

This works, but shows the warning, and it is indeed a bit slow.

My best attempt at server-side selectizeInput, after going through many posts, is the following, which still does not fully work...

UI:

```<code>test_side_ui <- function(id, r){
  ns <- NS(id)
  tagList(
    selectizeInput(inputId = ns("selected_ids"), label = "My IDs:", choices = NULL, multiple = TRUE, options = list(maxOptions = 10000L))
  )
}
</code>```

SERVER:

```<code>  test_side_server <- function(id, r){
  moduleServer( id, function(input, output, session){
    ns <- session$ns

    observeEvent(input$selected_ids, {
      r$selected_ids <- input$selected_ids
      updateSelectizeInput(session, inputId = "selected_ids", choices = paste0('id',1:60000), selected = r$selected_ids, server = TRUE)
    }, ignoreNULL = FALSE)
  })
}
</code>```

This seems to enter an infinite loop where selectizeInput is constantly updated from NULL to the selected values...

Anybody can help please? I don't know what I'm doing wrong and I'm really at a loss here... Thanks!

Body:
I have read all possible posts and threads about server-side selectizeInput, here and elsewhere... but no matter what I try, I cannot make it work.

I tried a few months back and eventually just gave up, but now I really need to make it work, so really hoping someone can shed some light.

I have my Shiny app that I built with "Package for Shiny app using Golem" in RStudio, and I pass my data around using reactive values.

The problem I face is very simple, I have a long list of IDs I want to show in a selectizeInputdrop-down menu, but I get the following warning:

Warning: The select input "bulk_side_ui_1-selected_ids" contains a
large number of options; consider using server-side selectize for
massively improved performance. See the Details section of the
?selectizeInput help topic.

This is my working code on the client side:

UI:

test_side_ui <- function(id, r){
  ns <- NS(id)
  tagList(
    uiOutput(outputId = ns("selected_ids"))
  )
}

SERVER:

  test_side_server <- function(id, r){
  moduleServer( id, function(input, output, session){
    ns <- session$ns

    output$selected_ids <- renderUI({
      selectizeInput(inputId = ns("selected_ids"), label = "My IDs:",
                     choices = paste0('id',1:60000),
                     selected = NULL,
                     multiple = TRUE,
                     options = list(maxOptions = 100000L))
    })

    # add selection to reactive values
    observeEvent(input$selected_ids, {
      r$selected_ids <- input$selected_ids
    }, ignoreNULL = FALSE)
  })
}

This works, but shows the warning, and it is indeed a bit slow.

My best attempt at server-side selectizeInput, after going through many posts, is the following, which still does not fully work...

UI:

test_side_ui <- function(id, r){
  ns <- NS(id)
  tagList(
    selectizeInput(inputId = ns("selected_ids"), label = "My IDs:", choices = NULL, multiple = TRUE, options = list(maxOptions = 10000L))
  )
}

SERVER:

  test_side_server <- function(id, r){
  moduleServer( id, function(input, output, session){
    ns <- session$ns

    observeEvent(input$selected_ids, {
      r$selected_ids <- input$selected_ids
      updateSelectizeInput(session, inputId = "selected_ids", choices = paste0('id',1:60000), selected = r$selected_ids, server = TRUE)
    }, ignoreNULL = FALSE)
  })
}

This seems to enter an infinite loop where selectizeInput is constantly updated from NULL to the selected values...

Anybody can help please? I don't know what I'm doing wrong and I'm really at a loss here... Thanks!


问:
Service worker load the application that was bookmarked
Hello all I have an application where I am loading the page when offline, every thing works perfect but on hard refresh it is not working. Also if user bookmarked the site and opening it later it is not getting loaded. Is it possible to load the site in the mentioned scenarios. Here is the code I am using</p>
```<code>// Changing the version causes the browser to replace the current service worker file with the new one.
const version = 4.0;
const cacheName = 'bmaCache' + version;

self.addEventListener("install", function (e) {
    showSpinner();
    self.skipWaiting();

    e.waitUntil(async function () {
        const cache = await caches.open(cacheName);

        await cache.addAll([
            "/Assets/siren.svg",
            "/Assets/logo-bma.svg",
            "/Assets/bma-favicon.png",
            "/Content/css/styles.css",
            "/Content/images/custom.svg",
            "/Content/font-icons/bootstrap-icons.css",
            "/Content/font-icons/fonts/bootstrap-icons.woff",
            "/Content/font-icons/fonts/bootstrap-icons.woff2",
            "/Content/bootstrap.min.css",
            "/Content/font-awesome.min.css",
            "/Content/Site.css",
            "/Content/css/bootstrap-toaster.css",
            "/Content/sweetalert.css",
            "/Content/themes/base/jquery-ui.min.css",
            "/Content/filePond/filepond-plugin-image-preview.min.css",
            "/Content/filePond/filepond.min.css",
            "/Scripts/jquery-3.6.0.min.js",
            "/Scripts/app/jquery.multi-select.js",
            "/Scripts/bootstrap.min.js",
            "/Scripts/bootstrap-filestyle.min.js",
            "/Scripts/scripts.js",
            "/Scripts/jquery.validate.min.js",
            "/Scripts/app/global/globalVariable.js",
            "/Scripts/app/indexDb/indexDb.js",
            "/Scripts/app/checkConnection.js",
            "/Scripts/app/loadingOverlay.js",
            "/Scripts/app/global/PersonCnt.js",
            "/Scripts/app/global/globalFunction.js",
            "/Scripts/app/global/personalvalidation.js",
            "/Scripts/app/global/editFromValidation.js",
            "/Scripts/app/app.js",
            "/Scripts/app/fromJson/masterJson.js",
            "/Scripts/app/ReportableEvent/ReportableEvent.js",
            "/Scripts/app/ReportableEvent/SaveForm/saveFormData.js",
            "/Scripts/app/ReportableEvent/InternalReview/updateFormData.js",
            "/Scripts/app/ReportableEvent/InternalReview/UpdateFormToIndexDb.js",
            "/Scripts/app/ReportableEvent/SaveForm/SaveFormToIndexDb.js",
            "/Scripts/app/ReportableEvent/ReportableAttachment/ReportableAttachment.js",
            "/Scripts/app/ReportableEvent/NearMissReport.js",
            "/Scripts/app/toaster/bootstrap-toaster.js",
            "/Scripts/app/syncToDb/syncDb.js",
            "/Scripts/app/syncToDb/UpdateSyncToDb.js",
            "/Scripts/app/ReportableEvent/InternalReview/internalReview.js",
            "/Scripts/app/ReportableEvent/SaveMoreInfo.js",
            "/Scripts/sweetalert.min.js",
            "/Scripts/app/syncToDb/nearMissSync.js",
            "/Scripts/app/filePond/filepond-plugin-file-encode.js",
            "/Scripts/app/filePond/filepond-plugin-file-validate-size.min.js",
            "/Scripts/app/filePond/filepond-plugin-image-exif-orientation.min.js",
            "/Scripts/app/filePond/filepond-plugin-image-preview.min.js",
            "/Scripts/app/filePond/filepond.js",
            "/Scripts/moment.min.js",
            //"/ReportableEvent/Index",
            //"/NearMissReport/Index",
            "/reportingportal",
            "/nearmissreport",
            "/ReportableEvent/InternalReview?ReportableEventId=0",
            "/ReportableEvent/NeedMoreInfo?ReportableEventId=0",
            "/bundles/reportableEvent?v=x",
            "/bundles/nearmiss?v=x",
            "/bundles/internalreview?v=x",
            "/bundles/needmoreinfo?v=x"
        ]);
        hideSpinner();
    }());
});

var uncachedPaths = new Set(["/", "/Login/Login", "/Dashboard/LoadGraph", "/Dashboard/Index", "/Login/Login", "/UserManagement/Index", "/Reportable/ReportableGrid", "/Reportable/NearMissGrid",
    "/Reportable/NearMissDetailById", "/Reportable/ReportableEventDetail", "/Home/ContactNearMiss",
    "/Reportable/Reports"]);

// https://www.charistheo.io/blog/2021/03/cache-handling-with-service-workers-and-the-cache-api/
// Check if the resource for the request exists in the cache. If it does, return the cached response, else try to make
// a network request for the resource.
self.addEventListener("fetch", async function (e) {
    // Check if the request is a network connectivity/server test, or a non-GET request.
    if (e.request.method !== "GET") {
        return;
    }

    e.respondWith(
        caches.match(e.request, { ignoreSearch: true }).then(async cachedResponse => {
            if (cachedResponse && !navigator.onLine) {
                return cachedResponse;
            }
            else {
                if (e.request.url.includes("service-worker.js") && !navigator.onLine) {
                    return;
                }

                // Fetch the requested resource from the network if it does not exist in the cache.
                if (navigator.onLine) {
                    const networkResponse = await fetch(e.request);

                    // Response needs to be cloned if going to be used more than once.
                    const clonedResponse = networkResponse.clone();

                    if (!uncachedPaths.has(new URL(e.request.url).pathname)) {
                        // Save response to runtime cache for later use.
                        const runtimeCache = await caches.open(cacheName);
                        runtimeCache.put(e.request, networkResponse);
                    }
                    // Respond with the cloned network response.
                    return Promise.resolve(clonedResponse);
                }
            }
        })
    );
});
</code>```

Body:
Hello all I have an application where I am loading the page when offline, every thing works perfect but on hard refresh it is not working. Also if user bookmarked the site and opening it later it is not getting loaded. Is it possible to load the site in the mentioned scenarios. Here is the code I am using

// Changing the version causes the browser to replace the current service worker file with the new one.
const version = 4.0;
const cacheName = 'bmaCache' + version;

self.addEventListener("install", function (e) {
    showSpinner();
    self.skipWaiting();

    e.waitUntil(async function () {
        const cache = await caches.open(cacheName);

        await cache.addAll([
            "/Assets/siren.svg",
            "/Assets/logo-bma.svg",
            "/Assets/bma-favicon.png",
            "/Content/css/styles.css",
            "/Content/images/custom.svg",
            "/Content/font-icons/bootstrap-icons.css",
            "/Content/font-icons/fonts/bootstrap-icons.woff",
            "/Content/font-icons/fonts/bootstrap-icons.woff2",
            "/Content/bootstrap.min.css",
            "/Content/font-awesome.min.css",
            "/Content/Site.css",
            "/Content/css/bootstrap-toaster.css",
            "/Content/sweetalert.css",
            "/Content/themes/base/jquery-ui.min.css",
            "/Content/filePond/filepond-plugin-image-preview.min.css",
            "/Content/filePond/filepond.min.css",
            "/Scripts/jquery-3.6.0.min.js",
            "/Scripts/app/jquery.multi-select.js",
            "/Scripts/bootstrap.min.js",
            "/Scripts/bootstrap-filestyle.min.js",
            "/Scripts/scripts.js",
            "/Scripts/jquery.validate.min.js",
            "/Scripts/app/global/globalVariable.js",
            "/Scripts/app/indexDb/indexDb.js",
            "/Scripts/app/checkConnection.js",
            "/Scripts/app/loadingOverlay.js",
            "/Scripts/app/global/PersonCnt.js",
            "/Scripts/app/global/globalFunction.js",
            "/Scripts/app/global/personalvalidation.js",
            "/Scripts/app/global/editFromValidation.js",
            "/Scripts/app/app.js",
            "/Scripts/app/fromJson/masterJson.js",
            "/Scripts/app/ReportableEvent/ReportableEvent.js",
            "/Scripts/app/ReportableEvent/SaveForm/saveFormData.js",
            "/Scripts/app/ReportableEvent/InternalReview/updateFormData.js",
            "/Scripts/app/ReportableEvent/InternalReview/UpdateFormToIndexDb.js",
            "/Scripts/app/ReportableEvent/SaveForm/SaveFormToIndexDb.js",
            "/Scripts/app/ReportableEvent/ReportableAttachment/ReportableAttachment.js",
            "/Scripts/app/ReportableEvent/NearMissReport.js",
            "/Scripts/app/toaster/bootstrap-toaster.js",
            "/Scripts/app/syncToDb/syncDb.js",
            "/Scripts/app/syncToDb/UpdateSyncToDb.js",
            "/Scripts/app/ReportableEvent/InternalReview/internalReview.js",
            "/Scripts/app/ReportableEvent/SaveMoreInfo.js",
            "/Scripts/sweetalert.min.js",
            "/Scripts/app/syncToDb/nearMissSync.js",
            "/Scripts/app/filePond/filepond-plugin-file-encode.js",
            "/Scripts/app/filePond/filepond-plugin-file-validate-size.min.js",
            "/Scripts/app/filePond/filepond-plugin-image-exif-orientation.min.js",
            "/Scripts/app/filePond/filepond-plugin-image-preview.min.js",
            "/Scripts/app/filePond/filepond.js",
            "/Scripts/moment.min.js",
            //"/ReportableEvent/Index",
            //"/NearMissReport/Index",
            "/reportingportal",
            "/nearmissreport",
            "/ReportableEvent/InternalReview?ReportableEventId=0",
            "/ReportableEvent/NeedMoreInfo?ReportableEventId=0",
            "/bundles/reportableEvent?v=x",
            "/bundles/nearmiss?v=x",
            "/bundles/internalreview?v=x",
            "/bundles/needmoreinfo?v=x"
        ]);
        hideSpinner();
    }());
});

var uncachedPaths = new Set(["/", "/Login/Login", "/Dashboard/LoadGraph", "/Dashboard/Index", "/Login/Login", "/UserManagement/Index", "/Reportable/ReportableGrid", "/Reportable/NearMissGrid",
    "/Reportable/NearMissDetailById", "/Reportable/ReportableEventDetail", "/Home/ContactNearMiss",
    "/Reportable/Reports"]);

// https://www.charistheo.io/blog/2021/03/cache-handling-with-service-workers-and-the-cache-api/
// Check if the resource for the request exists in the cache. If it does, return the cached response, else try to make
// a network request for the resource.
self.addEventListener("fetch", async function (e) {
    // Check if the request is a network connectivity/server test, or a non-GET request.
    if (e.request.method !== "GET") {
        return;
    }

    e.respondWith(
        caches.match(e.request, { ignoreSearch: true }).then(async cachedResponse => {
            if (cachedResponse && !navigator.onLine) {
                return cachedResponse;
            }
            else {
                if (e.request.url.includes("service-worker.js") && !navigator.onLine) {
                    return;
                }

                // Fetch the requested resource from the network if it does not exist in the cache.
                if (navigator.onLine) {
                    const networkResponse = await fetch(e.request);

                    // Response needs to be cloned if going to be used more than once.
                    const clonedResponse = networkResponse.clone();

                    if (!uncachedPaths.has(new URL(e.request.url).pathname)) {
                        // Save response to runtime cache for later use.
                        const runtimeCache = await caches.open(cacheName);
                        runtimeCache.put(e.request, networkResponse);
                    }
                    // Respond with the cloned network response.
                    return Promise.resolve(clonedResponse);
                }
            }
        })
    );
});


问:
Way to get logon events from remote Windows server without using WMI
Nowdays my application uses WMIC to poll logon events from remote machine. With WMI i use query like

-U user%password //myHost '--delimiter="|"' "SELECT eventCode,eventType,timeGenerated,User,InsertionStrings,Message FROM win32_NTLogEvent WHERE Logfile='Security' AND NOT Message LIKE '%$%' AND (eventCode='4624') AND timeGenerated > '20221124190047.000000-000'"

So server receives query, read win32_NTLogEvent object, opens file 'Security', read from it events with code 4624 (which is logon) filter according timeGenerated and return me events.

Is there any way to get such information without using WMI?


问:
Can I perform upsert operation on mongodb with pyspark
Hi I have started learning mongodb with pyspark. I want to know if we can perform upsert operation with pyspark in mongodb for exmaple

df1 :

A
B

x
1

y
1

df1 is already written in mongodb.

Now I want to update  values of x,y and add new column c
and write into mongodb collection as mentioned below df2

df2 :

A
B
C

x
1
2

y
2
2

z
3
2

So is this operation is possible with pyspark in mongodb .Please help me with this.
Is pyspak good to work with mongodb?


问:
Error in Turtle: AttributeError: 'RawTurtle' object has no attribute 'delay'
Here is my code:

```<code>import turtle
from customtkinter import *
from tkinter import Canvas, ttk, messagebox

root = CTk()
root.geometry('1080x680')
root.title('Tecnologia')
root.set_appearance_mode('dark')
canvas = Canvas(root, width=1080, height=480)
canvas.grid(row=0, column=0)

t = turtle.RawTurtle(canvas)

def tricmd():
    t.home()
    t.speed(1)
    t.forward(150)
    t.left(120)
    steps.configure(text='Explanation')
    t.delay(5)
    t.forward(150)
    t.left(120)
    steps.configure(text='Other explanation')
    t.delay(5)
    t.forward(150)
    t.left(120)

def squarecmd():
    t.home()
    t.speed(1)
    t.forward(150)
    t.left(90)

def pentacmd():
    t.home()
    t.speed(1)
    t.forward(150)
    t.left(45)

triangolo = CTkButton(root, width=50, height=35, text='Triangolo', command=tricmd)
triangolo.grid(row=1, column=0, pady=20)
quadrato = CTkButton(root, width=50, height=35, text='Quadrato', command=squarecmd)
quadrato.grid(row=2, column=0, pady=20)
quadrato = CTkButton(root, width=50, height=35, text='Pentagono', command=pentacmd)
quadrato.grid(row=3, column=0, pady=20)

steps = CTkLabel(root, text='Here is  explained the shape', width=10, height=30)
steps.grid(row=1, column=0)

def quit():
    root.destroy()
quitb = CTkButton(root, width=50, height=35, text='Esci', command=quit)
quitb.grid(row=1, column=1,pady=30)

root.mainloop()
</code>```

I'm trying to make a tkinter interface that draws different shapes when you click the corresponding button and explains how to draw that shape. Only the triangle code is completed and it is returning the error mentioned in the title.
Is there a way to use .delay() with RawTurtle?

Body:
Here is my code:

import turtle
from customtkinter import *
from tkinter import Canvas, ttk, messagebox

root = CTk()
root.geometry('1080x680')
root.title('Tecnologia')
root.set_appearance_mode('dark')
canvas = Canvas(root, width=1080, height=480)
canvas.grid(row=0, column=0)

t = turtle.RawTurtle(canvas)

def tricmd():
    t.home()
    t.speed(1)
    t.forward(150)
    t.left(120)
    steps.configure(text='Explanation')
    t.delay(5)
    t.forward(150)
    t.left(120)
    steps.configure(text='Other explanation')
    t.delay(5)
    t.forward(150)
    t.left(120)

def squarecmd():
    t.home()
    t.speed(1)
    t.forward(150)
    t.left(90)

def pentacmd():
    t.home()
    t.speed(1)
    t.forward(150)
    t.left(45)

triangolo = CTkButton(root, width=50, height=35, text='Triangolo', command=tricmd)
triangolo.grid(row=1, column=0, pady=20)
quadrato = CTkButton(root, width=50, height=35, text='Quadrato', command=squarecmd)
quadrato.grid(row=2, column=0, pady=20)
quadrato = CTkButton(root, width=50, height=35, text='Pentagono', command=pentacmd)
quadrato.grid(row=3, column=0, pady=20)

steps = CTkLabel(root, text='Here is  explained the shape', width=10, height=30)
steps.grid(row=1, column=0)

def quit():
    root.destroy()
quitb = CTkButton(root, width=50, height=35, text='Esci', command=quit)
quitb.grid(row=1, column=1,pady=30)

root.mainloop()

I'm trying to make a tkinter interface that draws different shapes when you click the corresponding button and explains how to draw that shape. Only the triangle code is completed and it is returning the error mentioned in the title.
Is there a way to use .delay() with RawTurtle?


问:
Why does SSO (single Sign-On) not working when using full URL
SSO (single Sign-On) with jetty and AD does not work when typing in full URL http://dellserver3.qtime.local:8880/sso to the Browser

We use SSO (single sign-on) with the following components.
- Domaincontroller: Microsoft Windows Server 2016 Essentials
- WebServer: jetty Version 9.4.33
- Browser: Microsoft Edge Version 108.0.1462.46

Case A (only the host)
SSO works fine, when I type in the following URL to the browser:
http://dellserver3:8880/sso

Case B (full URL)
On the other hand, if I
http://dellserver3.qtime.local:8880/sso
type in, the browser requires authorization in the form of a username and password. So SSO doesn't work.

When debugging I noticed the following behavior.
In both cases, the browser's first request to the web server is rejected with http 401 Unauthorized. So far so good.
In case A, a second request is made with a TGT (SSO token), which is accepted by the web server.
In case B, the 2nd request does not occur at all.

Properties
Setting SPN:
setspn -s HTTP/dellserver3.qtime.local QTimeDienst

Building keytab-File:
ktpass /out C:\sso_dellserver3_QTimeDienst.keytab /princ HTTP/dellserver3.qtime.local@QTIME.LOCAL /mapUser QTimeDienst@QTIME.LOCAL /mapOp set /pass Bochum96 /crypto RC4-HMAC-NT /pType KRB5_NT_PRINCIPAL

Content of krb5.ini:
[libdefaults]
default_realm = QTIME.LOCAL
default_keytab_name = FILE:C:\Program Files\QTime\Q1\writeable\sys\sso\sso_dellserver3_QTimeDienst.keytab
permitted_enctypes = aes128-cts aes256-cts arcfour-hmac-md5
default_tgs_enctypes = aes128-cts aes256-cts arcfour-hmac-md5
default_tkt_enctypes = aes128-cts aes256-cts arcfour-hmac-md5

```<code>[realms]
QTIME.LOCAL = {
    kdc = dellserver3.qtime.local
    admin_server = dellserver3.qtime.local
    default_domain = QTIME.LOCAL
}

[domain_realm]
qtime.local = QTIME.LOCAL
.qtime.local = QTIME.LOCAL

[appdefaults]
autologin = true
forwardable = true
</code>```

WebServer-Port:
8880

Body:
SSO (single Sign-On) with jetty and AD does not work when typing in full URL http://dellserver3.qtime.local:8880/sso to the Browser

We use SSO (single sign-on) with the following components.
- Domaincontroller: Microsoft Windows Server 2016 Essentials
- WebServer: jetty Version 9.4.33
- Browser: Microsoft Edge Version 108.0.1462.46

Case A (only the host)
SSO works fine, when I type in the following URL to the browser:
http://dellserver3:8880/sso

Case B (full URL)
On the other hand, if I
http://dellserver3.qtime.local:8880/sso
type in, the browser requires authorization in the form of a username and password. So SSO doesn't work.

When debugging I noticed the following behavior.
In both cases, the browser's first request to the web server is rejected with http 401 Unauthorized. So far so good.
In case A, a second request is made with a TGT (SSO token), which is accepted by the web server.
In case B, the 2nd request does not occur at all.

Properties
Setting SPN:
setspn -s HTTP/dellserver3.qtime.local QTimeDienst

Building keytab-File:
ktpass /out C:\sso_dellserver3_QTimeDienst.keytab /princ HTTP/dellserver3.qtime.local@QTIME.LOCAL /mapUser QTimeDienst@QTIME.LOCAL /mapOp set /pass Bochum96 /crypto RC4-HMAC-NT /pType KRB5_NT_PRINCIPAL

Content of krb5.ini:
[libdefaults]
default_realm = QTIME.LOCAL
default_keytab_name = FILE:C:\Program Files\QTime\Q1\writeable\sys\sso\sso_dellserver3_QTimeDienst.keytab
permitted_enctypes = aes128-cts aes256-cts arcfour-hmac-md5
default_tgs_enctypes = aes128-cts aes256-cts arcfour-hmac-md5
default_tkt_enctypes = aes128-cts aes256-cts arcfour-hmac-md5

[realms]
QTIME.LOCAL = {
    kdc = dellserver3.qtime.local
    admin_server = dellserver3.qtime.local
    default_domain = QTIME.LOCAL
}

[domain_realm]
qtime.local = QTIME.LOCAL
.qtime.local = QTIME.LOCAL

[appdefaults]
autologin = true
forwardable = true

WebServer-Port:
8880


问:
When JWT token expiration should be checked with a state management library in React?
I've just started using a React routing libray and a state management library.

After a successfully login, JWT token is stored in the state

After some time, depending on the server, the token exipires. I need to remove the stored JWT token and force the user to navigate to the /login page again.

Where to check for the token expiration and redirect the user?

Lot of people suggest to do it with a router listener

Other people suggest to check every server response and look for 401 Unauthorized

Problem: approach 1 doesn't work if the user stay on the same page and hit a button that doesn't change the current route. The approach 2 depends on the request library one is using.

So what's the correct way to check for the expiration?


问:
Amazon Sagemaker - Create USA map by States using Jupyter notebook
I been trying creating USA map in Amazon Sagemaker Jupyter notebook instance, I have used the code

```<code>import plotly.express as px
import numpy as np
import pandas as pd

dff = pd.read_excel("fold/map_data.xlsx",engine='openpyxl')

# Strip out white spaces

dff.columns = dff.columns.to_series().apply(lambda x: x.strip())

# Keep only Required cloumns,

dff=dff[['week_end','state','state_code','item','sales']]

# Filter the data and rename

dff=dff[(dff['week_end']=='12-12-2022') & (dff['item']=='Resd')]
dff.rename({'sales':'Sales Price ($)'},axis=1, inplace=True)

fig = px.choropleth(dff,
                    locations='state_code',
                    locationmode="USA-states",
                    scope="usa",
                    color='Sales Price ($)',
                    color_continuous_scale="Viridis_r",

                    )
fig.show()
</code>```

Data used

No Map is showing up,not even outline or any error. When I searched in Browser console I am getting warning "Default Kernel not found"

What am I missing here? Please help me understand. Is there any additional steps to be done since I am running inside Sagemaker?

Body:
I been trying creating USA map in Amazon Sagemaker Jupyter notebook instance, I have used the code

import plotly.express as px
import numpy as np
import pandas as pd

dff = pd.read_excel("fold/map_data.xlsx",engine='openpyxl')

# Strip out white spaces

dff.columns = dff.columns.to_series().apply(lambda x: x.strip())

# Keep only Required cloumns,

dff=dff[['week_end','state','state_code','item','sales']]

# Filter the data and rename

dff=dff[(dff['week_end']=='12-12-2022') & (dff['item']=='Resd')]
dff.rename({'sales':'Sales Price ($)'},axis=1, inplace=True)

fig = px.choropleth(dff,
                    locations='state_code',
                    locationmode="USA-states",
                    scope="usa",
                    color='Sales Price ($)',
                    color_continuous_scale="Viridis_r",

                    )
fig.show()

Data used

No Map is showing up,not even outline or any error. When I searched in Browser console I am getting warning "Default Kernel not found"

What am I missing here? Please help me understand. Is there any additional steps to be done since I am running inside Sagemaker?


问:
Running aarch64 Yocto on QEMU
I know QEMU can emulate aarch64 (Raspberry Pi 4, 64-bit) on 64-bit x86. However, as far as I know, the runqemu of Yocto requires you to have built your Yocto image for qemuxxx. Can I somehow run the output of Yocto for aarch64 using QEMU?</p>

Title: Running aarch64 Yocto on QEMU


问:
Wrong environment in Django

I'm a beginner at Django Web Framework. At the beginning when I start Django project I didn't see venv folder like on the picture on the left. I didn't have bin, lab , .gitignore and pyvenv.cfg files on the right picture.

When I made new env I see venv folder but also there are duplicate bin and lib folders. All I want for now is when I start new Django project is to have one VENV folder and that it's gonna be my only enviornment and also bin and lab folders be in venv folder.

What I try is this:
That was the commands I enter on my MAC.

```<code>pip install virtualenv
virtualenv venv
source venv/bin/activate
</code>```

That made a new env and folder venv. But I don't want to have another basic environment with name of the project like on the picture on the right. I don't want to have in project folder bin and lib folder also.

Title: Wrong environment in Django

Body:
I'm a beginner at Django Web Framework. At the beginning when I start Django project I didn't see venv folder like on the picture on the left. I didn't have bin, lab , .gitignore and pyvenv.cfg files on the right picture.

When I made new env I see venv folder but also there are duplicate bin and lib folders. All I want for now is when I start new Django project is to have one VENV folder and that it's gonna be my only enviornment and also bin and lab folders be in venv folder.

What I try is this:
That was the commands I enter on my MAC.

pip install virtualenv
virtualenv venv
source venv/bin/activate

That made a new env and folder venv. But I don't want to have another basic environment with name of the project like on the picture on the right. I don't want to have in project folder bin and lib folder also.


问:
Micronaut HTTP Client handeling empty parameters in GET requests
Micronaut declarative HTTP Client question

I need to construct a GET request that looks like this:

```<code>URL/index?xxx=42&singledatapoint&Unadjusted
</code>```

If I use MN’s declarative HTTP Client, like this:

```<code>@Get('/index?no={number}&singledatapoint&Unadjusted')
HttpResponse<String> getData(int number)
</code>```

The final URL looks like this:

```<code>URL/index?no=42&singledatapoint=&Unadjusted=
</code>```

MN has added = (equal signs) to the end of the empty parameters.

This fails with a invalid request on the server.

I tried the following permutations with the same sad results:

```<code>URL/index?no=42&singledatapoint=””&Unadjusted=””
URL/index?no=42&singledatapoint=null&Unadjusted=null
</code>```

My question: How do I force MN to stop putting = (equal sign) after the empty parameters?

Please note: this is not a debate on whether or not = or =”” should be allowed - they’re not, simple as that!

Body:
Micronaut declarative HTTP Client question

I need to construct a GET request that looks like this:

URL/index?xxx=42&singledatapoint&Unadjusted

If I use MN’s declarative HTTP Client, like this:

@Get('/index?no={number}&singledatapoint&Unadjusted')
HttpResponse<String> getData(int number)

The final URL looks like this:

URL/index?no=42&singledatapoint=&Unadjusted=

MN has added = (equal signs) to the end of the empty parameters.

This fails with a invalid request on the server.

I tried the following permutations with the same sad results:

URL/index?no=42&singledatapoint=””&Unadjusted=””
URL/index?no=42&singledatapoint=null&Unadjusted=null

My question: How do I force MN to stop putting = (equal sign) after the empty parameters?

Please note: this is not a debate on whether or not = or =”” should be allowed - they’re not, simple as that!


问:
GUI tool to present both textual and tabular data
I am trying to present both tabular data and text in hierarch way using Tkinter GUI. Is it possible to do it in Treeview ?  I know that I can display table using Treeview, but I want to present also text in the same tree.
If not, are you familiar with other GUI that can do it?

I created a text Treeview and now trying to apply a command which present table when clicking on the text (with the bind function). I don't like this approach cause I have lots of tables to present, depend on the text value.


问:
gnuradio packet size overflow
I am working with gnuradio, and I have overflow exception - 'O' that
gets prints each second.
I wanted to know the size of the samples that get drops with each 'O'.
When I monitored the USB connection on Wireshark I saw that the each packet getting from the device is in size of
8256 Bytes, so according to the logic that each O represent one packet missing
this is the size. But I not sure, so I would like your help.
Thanks!

I also looked online but I didn't found some concrete size, maybe I
am missing something.

Title: gnuradio packet size overflow


问:
Because of pyglet mesh.show() command is not functioning
```<code>mesh = trimesh.load(model_normalized_scaled.off)
mesh.show()
</code>```

When I use mesh.show(). It throws the following error:

```<code>  File "/work/ws-tmp/g051382-PCL_task/ndf/dataprocessing/boundary_sampling.py", line 39, in boundary_sampling
    mesh.show()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/base.py", line 2433, in show
    return scene.show(**kwargs)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/scene/scene.py", line 1089, in show
    return SceneViewer(self, **kwargs)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/exceptions.py", line 48, in failed
    raise exc
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/viewer/__init__.py", line 18, in <module>
    from .windowed import (SceneViewer,
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/viewer/windowed.py", line 15, in <module>
    import pyglet.gl as gl
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 237, in <module>
    import pyglet.window
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1890, in <module>
    gl._create_shadow_window()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 209, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 171, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/window/__init__.py", line 575, in __init__
    display = pyglet.canvas.get_display()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/canvas/__init__.py", line 95, in get_display
    return Display()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/canvas/xlib.py", line 123, in __init__
    raise NoSuchDisplayException('Cannot connect to "%s"' % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"
</code>```

I tried with mesh.show() command and got this issue. How to resolve this error, so that I can visualize the mesh using mesh.show(). I have downloaded pyglet 1.4.5 for python 3.6.10 and I got this error.

Body:
mesh = trimesh.load(model_normalized_scaled.off)
mesh.show()

When I use mesh.show(). It throws the following error:

  File "/work/ws-tmp/g051382-PCL_task/ndf/dataprocessing/boundary_sampling.py", line 39, in boundary_sampling
    mesh.show()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/base.py", line 2433, in show
    return scene.show(**kwargs)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/scene/scene.py", line 1089, in show
    return SceneViewer(self, **kwargs)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/exceptions.py", line 48, in failed
    raise exc
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/viewer/__init__.py", line 18, in <module>
    from .windowed import (SceneViewer,
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/trimesh/viewer/windowed.py", line 15, in <module>
    import pyglet.gl as gl
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 237, in <module>
    import pyglet.window
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1890, in <module>
    gl._create_shadow_window()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 209, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 171, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/window/__init__.py", line 575, in __init__
    display = pyglet.canvas.get_display()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/canvas/__init__.py", line 95, in get_display
    return Display()
  File "/home/g051382/.conda/envs/NDF/lib/python3.6/site-packages/pyglet/canvas/xlib.py", line 123, in __init__
    raise NoSuchDisplayException('Cannot connect to "%s"' % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

I tried with mesh.show() command and got this issue. How to resolve this error, so that I can visualize the mesh using mesh.show(). I have downloaded pyglet 1.4.5 for python 3.6.10 and I got this error.


问:
vscode intellisense not working for my published NPM Package
Intellisense works correctly for any package like @angular but when i publish my own package and then install it in another project. Intellisense is not able to identify the type definitions in my npm Package. Am i missing some tsconfig settings when publishing the NPM package?

created a new NPM package
Publish the package.
install the package in another project.
expected vscode intellisense to import my package ts definitions automatically as it does for other packages.


问:
Fresh flutter demo app: Access denied finding property "persist.vendor.sf.fbc" on moto e20
I created a new Flutter project (Flutter Demo) and used my moto e20 for debugging. I did not make any modifications to the example code.

In debug console i get the following errors.

```<code>Launching lib\main.dart on moto e20 in debug mode...
Running Gradle task 'assembleDebug'...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Debug service listening on ws://127.0.0.1:56915/W6uTaIvADtc=/ws
Syncing files to device moto e20...
I/gralloc4( 9954): register: id=1b1000000ab
E/libc    ( 9954): Access denied finding property "persist.vendor.sf.fbc"
E/libc    ( 9954): Access denied finding property "persist.vendor.gpu.fbc"
E/libc    ( 9954): Access denied finding property "persist.vendor.vsp.fbc"
I/gralloc4( 9954): register: id=1b1000000ac
I/gralloc4( 9954): register: id=1b1000000ad
</code>```

My toolchain is:

Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19044.2251])

Android toolchain - develop for Android devices (Android SDK version 33.0.1)

Android Studio (version 2021.3)

I could not find anything helpful by searching for "access denied property" and the "persist.vendor.x" properties.

What would be the starting point to track this error down?

Any links or keywords, where to look, would already help.

Body:
I created a new Flutter project (Flutter Demo) and used my moto e20 for debugging. I did not make any modifications to the example code.

In debug console i get the following errors.

Launching lib\main.dart on moto e20 in debug mode...
Running Gradle task 'assembleDebug'...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Debug service listening on ws://127.0.0.1:56915/W6uTaIvADtc=/ws
Syncing files to device moto e20...
I/gralloc4( 9954): register: id=1b1000000ab
E/libc    ( 9954): Access denied finding property "persist.vendor.sf.fbc"
E/libc    ( 9954): Access denied finding property "persist.vendor.gpu.fbc"
E/libc    ( 9954): Access denied finding property "persist.vendor.vsp.fbc"
I/gralloc4( 9954): register: id=1b1000000ac
I/gralloc4( 9954): register: id=1b1000000ad

My toolchain is:

Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19044.2251])

Android toolchain - develop for Android devices (Android SDK version 33.0.1)

Android Studio (version 2021.3)

I could not find anything helpful by searching for "access denied property" and the "persist.vendor.x" properties.

What would be the starting point to track this error down?

Any links or keywords, where to look, would already help.


问:
Transfer cookies to the website or automatically log in to your google account
Is there a way to automatically login google account to wordpress or save cookies automatically on the website?

How to automatically transmit and save cookies on the website


问:
MotionBuilder: How to change takes order with python?
Is it possible to change the order of the take list using python?

GIF of what I want to accomplish

The only answer I have found so far is by duplicating takes and removing old ones:
https://forums.autodesk.com/t5/motionbuilder-forum/how-to-change-takes-order/td-p/4291784


问:
System tray application would detect hotkey with PySimpleGUI and psgtray
I want to create an application with a system tray icon.
This app should detect the hotkey and react to it, even if the app is not focused (icon tray).
Example: I want to show the window, then I press Alt + X. The window is showing.

I tried using the "keyboard" library, but it seems to not be usable with PySimpleGUI.

Also, I want to know what is the difference between multiple if and elif codeblock.

I'm new to programming, thanks!

Here is my code:

import PySimpleGUI as psg
from psgtray import SystemTray

menu = ['', ['Show', 'Quit']]
tooltip = 'GFNTyperPSG'

layout = [[psg.Input(size = (20, 1), key = 'text_input', focus = True)],
      [psg.Button(button_text = 'Cancel', key = 'hide_window'), psg.Button(button_text = 'Type', key = 'cut_all')]]

window = psg.Window(size = (192, 64), title = 'GFNTyperPSG', layout = layout, element_justification = 'center', disable_minimize = True, enable_close_attempted_event = True, background_color = 'lightgray', button_color = 'black on lightgray', icon = 'GFNTyper.ico', finalize = True)

tray = SystemTray(menu = menu, single_click_events = False, window = window, tooltip = tooltip, icon = 'GFNTyper.ico')
tray.show_message('GFNTyperPSG has started!', 'Thank you for using! :D')

window['text_input'].bind('<Return>', 'hide_alt')

while True:
    event, values = window.read()

    if event == tray.key:
        event = values[event]

    if event in ('Quit', psg.WIN_CLOSED):
        break

    if event in ('Show', psg.EVENT_SYSTEM_TRAY_ICON_DOUBLE_CLICKED):
        window.un_hide()
        window.bring_to_front()
        window['text_input'].set_focus()

    if event in ('hide_window', 'cut_all', psg.WIN_CLOSE_ATTEMPTED_EVENT):
        window.hide()
        tray.show_icon()

    if event in ('cut_all'):
        psg.clipboard_set(values['text_input'])
        window['text_input'].update('')

    if event == 'text_input' + 'hide_alt':
        psg.clipboard_set(values['text_input'])
        window['text_input'].update('')
        window.hide()
        tray.show_icon()

tray.close()
window.close()

```


问:
Google Calendar set attending to an event using API
I'm about to start a project which will sync with Google Calendar (written in Ruby on Rails). It's a training app where I want users to be able to set attending to the training events and sync it with Google Calendar.

I've been looking at some gems and the official documentation and can't seem to find the correct method or call to trigger this action.

Is it possible to set/remove attending state on specific events through the API?


问:
Upload image binary to GCP success but can't see image
i have an issue with upload file image (binary) to GCP.
I tested it in postman and it gave me status 200 with an link can open my image. It's succesed.
When i try it in my app, which is coding by react-native, it's also successed but when i opened link which have my uploaded my image, it shows an error like this..
Can anyone help me with this please !!!
Thank you very much.
enter image description here

i try to search, using with form-data but...


问:
Django: Use the different field for password in the Custom User Model
When you use the Custom User Model, you can change the "username" field using the

```<code>USERNAME_FIELD = 'identifier'
</code>```

Is there a way to do similar thing for the "password" field? Something like

```<code>PASSWORD_FIELD = 'my_password_field'
</code>```

If not, is there any was to store the password not in the default "password" field of the user model?

No code tried because I don't know what to write in this case.
Django docs contains the instruction about changing the changing the used identifier, but nothing about password.

Body:
When you use the Custom User Model, you can change the "username" field using the

USERNAME_FIELD = 'identifier'

Is there a way to do similar thing for the "password" field? Something like

PASSWORD_FIELD = 'my_password_field'

If not, is there any was to store the password not in the default "password" field of the user model?

No code tried because I don't know what to write in this case.
Django docs contains the instruction about changing the changing the used identifier, but nothing about password.


问:
Using web worker with setTimeout or setInterval cause the memory leak
I made a timer by setTimeout and web worker.
But I found that the browser's memory usage is getting higher as time go.

The digit here circled is getting bigger every 1 second just because my timer is looping every 1 second.

And the heap graph also indicate that the memory usage is increasing...

Here's my code: https://codesandbox.io/s/infallible-shannon-se0ysh

I don't know why the memory usage is increasing, can anyone help me with this problem? tks

I don't want the memory usage increases which may cause memory leak.


问:
TypeError: Cannot read properties of undefined (reading 'toString') on Inertia
I am trying to implement a searchable input. But getting TypeError: Cannot read properties of undefined (reading 'toString') on vue.

Here is my controller function :

ArticleController.php

```<code>public function create(Request $request)
    {
        return Inertia::render(
            'Article/New',
            [
                'categories' => Category::when($request->cateQuery, function ($query, $cateQuery) {
                    echo $query->get();
                    $query->where('name', 'ILIKE', '%' . $cateQuery . '%');
                }),
            ]
        );
    }
</code>```

without the echo statement above, it doesn't return anything.

web.php

```<code>Route::resource('articles', ArticleController::class)
    ->only(['index', 'create', 'store'])
    ->middleware(['auth', 'verified']);
</code>```

Search Input in New.vue

```<code><input
                    type="text"
                    v-model="cateQuery"
                    @keyup="searchCategory"
                    placeholder="search.."
                    class="search-bar"
/>
</code>```

and script in 'New.vue'

```<code><script>
import _ from "lodash";
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout.vue";
export default {
    components: {
        AuthenticatedLayout,
    },
    props: {
        categories: Object,
    },
    data() {
        return {
            cateQuery: "",
        };
    },
    methods: {
        searchCategory:function () {
            this.$inertia.get(
                route("articles.create", { cateQuery: this.cateQuery })
            );
        }
    },
};
</script>
</code>```

and on input i am getting

```<code>TypeError: Cannot read properties of undefined (reading 'toString')
    at u (url.ts:6:23)
    at router.ts:318:27
</code>```

const responseUrl = hrefToUrl(pageResponse.url) in Router.ts throws the error.

Where am I going wrong here?

Body:
I am trying to implement a searchable input. But getting TypeError: Cannot read properties of undefined (reading 'toString') on vue.

Here is my controller function :

ArticleController.php

public function create(Request $request)
    {
        return Inertia::render(
            'Article/New',
            [
                'categories' => Category::when($request->cateQuery, function ($query, $cateQuery) {
                    echo $query->get();
                    $query->where('name', 'ILIKE', '%' . $cateQuery . '%');
                }),
            ]
        );
    }

without the echo statement above, it doesn't return anything.

web.php

Route::resource('articles', ArticleController::class)
    ->only(['index', 'create', 'store'])
    ->middleware(['auth', 'verified']);

Search Input in New.vue

<input
                    type="text"
                    v-model="cateQuery"
                    @keyup="searchCategory"
                    placeholder="search.."
                    class="search-bar"
/>

and script in 'New.vue'

and on input i am getting

TypeError: Cannot read properties of undefined (reading 'toString')
    at u (url.ts:6:23)
    at router.ts:318:27

const responseUrl = hrefToUrl(pageResponse.url) in Router.ts throws the error.

Where am I going wrong here?


问:
How to create stripe token using @stripe/stripe-react-native library
I was using tipsi-stripe library but now i migrated it to @stripe/stripe-react-native library  but i am unable to create token and get country name from card , please let me know how to implement it ,Thanks in advance.

------------------ Tipsi-stripe Code ----------------

```<code>import stripe, { PaymentCardTextField, } from 'tipsi-stripe'
stripe
                        .paymentRequestWithCardForm()
                        .then(stripeTokenInfo => {
                            this.state.loading = true
                            console.log('Token created', { stripeTokenInfo });
</code>```

-------------- New Code without Create token ---------------------

```<code>import { CardField, useStripe ,confirmPayment, loading} from '@stripe/stripe-react-native';

export default class CheckoutSignin extends Component {
  state = {
    TotalAmount:null,
    clientSecret:null
  }
componentDidMount(){
  console.log("Total Amount : " + this.props.route.params.TotalAmount);
  this.state.TotalAmount = this.props.route.params.TotalAmount;
  this.setState(this.state)
}
 fetchPaymentIntentClientSecret = async () => {

  makePayment(100,"AUD").then(r => {
      if(r.Status === "Success"){

        this.state.clientSecret = r.ClientSecret;
        this.setState(this.state)
          // alert("Payment Indent Success");
          // console.log("1===> "+ clientSecret);
          this.handlePayPress();
          // console.log("3===> "+ clientSecret);
      }
      else {

          alert("Payment Indent Failed.");
      }

  }).catch(e => {
      alert(e)
  })

};

 handlePayPress = async () => {

  const {paymentIntent, error} = await confirmPayment(this.state.clientSecret, {
  paymentMethodType: 'Card',
  paymentMethodData: {
    // email: _userInfo.email,
  },
});
if (error) {
  console.log('Payment confirmation error', error);
  Alert.alert("Error","Payment confirmation error", error);
} else if (paymentIntent) {
  console.log('Success from promise', paymentIntent);
  // Alert.alert("Success","Succeed Payment with 3ds");
  this.props.navigation.navigate("Thankyou")
}

 }
}
</code>```

Body:
I was using tipsi-stripe library but now i migrated it to @stripe/stripe-react-native library  but i am unable to create token and get country name from card , please let me know how to implement it ,Thanks in advance.

------------------ Tipsi-stripe Code ----------------

import stripe, { PaymentCardTextField, } from 'tipsi-stripe'
stripe
                        .paymentRequestWithCardForm()
                        .then(stripeTokenInfo => {
                            this.state.loading = true
                            console.log('Token created', { stripeTokenInfo });

-------------- New Code without Create token ---------------------

import { CardField, useStripe ,confirmPayment, loading} from '@stripe/stripe-react-native';

export default class CheckoutSignin extends Component {
  state = {
    TotalAmount:null,
    clientSecret:null
  }
componentDidMount(){
  console.log("Total Amount : " + this.props.route.params.TotalAmount);
  this.state.TotalAmount = this.props.route.params.TotalAmount;
  this.setState(this.state)
}
 fetchPaymentIntentClientSecret = async () => {

  makePayment(100,"AUD").then(r => {
      if(r.Status === "Success"){

        this.state.clientSecret = r.ClientSecret;
        this.setState(this.state)
          // alert("Payment Indent Success");
          // console.log("1===> "+ clientSecret);
          this.handlePayPress();
          // console.log("3===> "+ clientSecret);
      }
      else {

          alert("Payment Indent Failed.");
      }

  }).catch(e => {
      alert(e)
  })

};

 handlePayPress = async () => {

  const {paymentIntent, error} = await confirmPayment(this.state.clientSecret, {
  paymentMethodType: 'Card',
  paymentMethodData: {
    // email: _userInfo.email,
  },
});
if (error) {
  console.log('Payment confirmation error', error);
  Alert.alert("Error","Payment confirmation error", error);
} else if (paymentIntent) {
  console.log('Success from promise', paymentIntent);
  // Alert.alert("Success","Succeed Payment with 3ds");
  this.props.navigation.navigate("Thankyou")
}

 }
}


问:
Sipios' Spring Boot JPA Search - Querying Enum
I am using Spring Boot (2.7.3) and Sipios' library for Spring Search for JPA Entities (https://github.com/sipios/spring-search).

I am trying make a search based on one of my class's enum fields, but receive the following error:

InvalidDataAccessApiUsageException: Parameter value [FIRST] did not match expected type [*.MY_ENUM (n/a)];

To make it clear through an example, let's say I have an entity-class "MyClass" which has a field "MY_ENUM enumField", and MY_ENUM has the values ('FIRST', 'SECOND', 'THIRD').

I am trying to query for all MyClass entries that have the value 'FIRST' in their enumField.

The enumField is annotated with @Enumerated(EnumType.STRING).

For those familiar with the specific library, my HTTP request is: localhost:8080/controller/search?search=enumField:FIRST.

I have also tried putting the FIRST query param in single & double quotes but the result was the same.

I have traced the problem to Hibernate's org.hibernate.query.spi.QueryParameterBindingValidator, method isValidBindValue().

Method isValidBindValue() checks whether value "FIRST" is of MY_ENUM type.

More specifically, the line that effectively causes the exception is expectedType.isInstance(value), where expectedType is "class MY_ENUM" and value is "FIRST", which evaluates to false and thus the error message - values checked via Intellij's debugger.

I have tried it with versions 0.2.3 & 0.2.4 of sipios/spring-search.

I saw that version 0.2.3 should support querying enums but I couldn't find any relative examples on how to do it, so it may be possible I have misunderstood how to use spring-search, but I would expect Spring Boot to recognise the "FIRST" string as an instance of MY_ENUM type.


问:
start server socket in a woker and consumer PYTHON ASYNCIO
With a worker I want to run an asyncio server which will be ready to listen.

```<code> asyncio.create_task(self.consumer())
            await asyncio.gather(
                self.obj_Coinbase.manage_connection(), self.obj_server.run()
            )
</code>```

In the coinbase connection i am receiving data i real time and i would like to send this data with my server.

```<code> async def run(self):

        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server.bind((self.host, self.port))
        server.listen(8)
        socket_client, adr = await self.loop.sock_accept(server)
        while True:
            self.clients_sessions.append(sock)

            await self.loop.sock_sendall(self.current_client ,
                                             (json.dumps(self.current_data).encode()))  # return Task obj
                    self.last_data_rcv = self.current_data
</code>```

it doesnt work when i want to lunch server to distrubte the data
The server blocks the reception of the data from the provider coinbase
thanks

Body:
With a worker I want to run an asyncio server which will be ready to listen.

 asyncio.create_task(self.consumer())
            await asyncio.gather(
                self.obj_Coinbase.manage_connection(), self.obj_server.run()
            )

In the coinbase connection i am receiving data i real time and i would like to send this data with my server.

 async def run(self):

        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server.bind((self.host, self.port))
        server.listen(8)
        socket_client, adr = await self.loop.sock_accept(server)
        while True:
            self.clients_sessions.append(sock)

            await self.loop.sock_sendall(self.current_client ,
                                             (json.dumps(self.current_data).encode()))  # return Task obj
                    self.last_data_rcv = self.current_data

it doesnt work when i want to lunch server to distrubte the data
The server blocks the reception of the data from the provider coinbase
thanks