问:
The DataFrame saved just the last query in scrapping tweets by emojis search, the for loop did not work well?
I wrote a python code using snscrape to collect Saudi tweets based on:

Location: GeneralListEmojis

Time Interval: TimeInterval

Emoji: EmojisList

I have a list for each of these searching criteria. For example, I want to collect tweets from Riyadh in the four time interval which include the emojis in the EmojiList.

I want to save all the results from all the cities into one dataframe called: EmojisTweets
I made another dataframe that showed the non-appear state when a specific emoji did not appear at the tweets of some cities, called: NoEmojiTweet.

I started the code by empty EmojisTweets dataframe, and it supposed to be filled iteratively in the inner-for-loop as I defined a dataframe EmojisTweets_i that hold the current searching tweet and concatenate it with the main dataframe EmojisTweets.

The problem is that, at the end of the scraping process, the EmojisTweets DataFrame saved only the last searching loop for the last emoji in the EmojisList!

the same problem appeared when using pd.append at NoEmojiTweet.

What is the problem in my code that caused this failure!

```<code>******************[ Start :     By Emojis      ]************************
now = datetime.now()
print("EMOJIS: Starting Time =", now.strftime("%H:%M:%S"))

GeneralListEmojis=[('Riyadh','250','2000'), ('Jeddah','300','2000'), ('Dammam','200','1000'), ('Abha','150','500'), ('Jizan','150','500'), ('24.470901, 39.612236','100','500'), ('Buraidah','100','500'), ('Tabuk','100','500'), ('Hail','100','500'), ('Najran','50','500'), ('29.5,39.52236','50','500'), ('20.0125, 41.465278','50','500'), ('Arar','50','500')]

TimeInterval=['since:2019-01-01 until:2019-12-31', 'since:2020-01-01 until:2020-12-31', 'since:2021-01-01 until:2021-12-31', 'since:2022-01-01 until:2022-12-14']

EmojisList= ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
EmojisTweets=pd.DataFrame()
NoEmojiTweet=pd.DataFrame(columns=['City', 'Emoji', 'TimeInterval'])

for c in GeneralListEmojis:
    City=c[0]
    km=c[1]
    tw=c[2]
    for Ti in TimeInterval:
        for E in EmojisList:
            EmojisTweets_i= pd.DataFrame(itertools.islice(sntwitter.TwitterSearchScraper('"{}" near:"{}" within:{}km {}'.format(E,City,km,Ti)).get_items(), int('{}'.format(tw))))
        if not EmojisTweets_i.empty:
            EmojisTweets_i['user_location'] = EmojisTweets_i['user'].apply(lambda x: x['location'])
            EmojisTweets_i['City'] = '{}'.format(City) #to chunck the df based on the city column
            EmojisTweets_i['Search'] = 'ByEmojis' #To know the type of searching for this tweet, when concatenate all the files
            EmojisTweets=pd.concat([EmojisTweets,EmojisTweets_i])
        else:
            NewNoEmoji_Row={'City':'{}'.format(City), 'Emoji':'{}'.format(E), 'TimeInterval':'{}'.format(Ti)}
            NoEmojiTweet=NoEmojiTweet.append(NewNoEmoji_Row, ignore_index=True)

#All the Saudi Reigonal Tweets | Searching by Emojis
EmojisTweets.to_csv('EmojisTweets.csv')
#File for each City with the missing Emoji during Time Interval:
NoEmojiTweet.to_csv('NoEmojiTweet.csv')

now = datetime.now()
print("EMOJIS: Ending Time =", now.strftime("%H:%M:%S"))
</code>```

I run the code and it worked, but when I investigate the collected tweets at EmojisTweets, I found that It had been saving only the last round of the inner-for loop. So, the dataframe contains all the tweets from all the cities in GeneralListEmojis list, with all the time interval in TimeInterval list for only the angry emoji '', which is the last emoji at the EmojiList

EmojisList= ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']

Body:
I wrote a python code using snscrape to collect Saudi tweets based on:

Location: GeneralListEmojis

Time Interval: TimeInterval

Emoji: EmojisList

I have a list for each of these searching criteria. For example, I want to collect tweets from Riyadh in the four time interval which include the emojis in the EmojiList.

I want to save all the results from all the cities into one dataframe called: EmojisTweets
I made another dataframe that showed the non-appear state when a specific emoji did not appear at the tweets of some cities, called: NoEmojiTweet.

I started the code by empty EmojisTweets dataframe, and it supposed to be filled iteratively in the inner-for-loop as I defined a dataframe EmojisTweets_i that hold the current searching tweet and concatenate it with the main dataframe EmojisTweets.

The problem is that, at the end of the scraping process, the EmojisTweets DataFrame saved only the last searching loop for the last emoji in the EmojisList!

the same problem appeared when using pd.append at NoEmojiTweet.

What is the problem in my code that caused this failure!

******************[ Start :     By Emojis      ]************************
now = datetime.now()
print("EMOJIS: Starting Time =", now.strftime("%H:%M:%S"))

GeneralListEmojis=[('Riyadh','250','2000'), ('Jeddah','300','2000'), ('Dammam','200','1000'), ('Abha','150','500'), ('Jizan','150','500'), ('24.470901, 39.612236','100','500'), ('Buraidah','100','500'), ('Tabuk','100','500'), ('Hail','100','500'), ('Najran','50','500'), ('29.5,39.52236','50','500'), ('20.0125, 41.465278','50','500'), ('Arar','50','500')]

TimeInterval=['since:2019-01-01 until:2019-12-31', 'since:2020-01-01 until:2020-12-31', 'since:2021-01-01 until:2021-12-31', 'since:2022-01-01 until:2022-12-14']

EmojisList= ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
EmojisTweets=pd.DataFrame()
NoEmojiTweet=pd.DataFrame(columns=['City', 'Emoji', 'TimeInterval'])

for c in GeneralListEmojis:
    City=c[0]
    km=c[1]
    tw=c[2]
    for Ti in TimeInterval:
        for E in EmojisList:
            EmojisTweets_i= pd.DataFrame(itertools.islice(sntwitter.TwitterSearchScraper('"{}" near:"{}" within:{}km {}'.format(E,City,km,Ti)).get_items(), int('{}'.format(tw))))
        if not EmojisTweets_i.empty:
            EmojisTweets_i['user_location'] = EmojisTweets_i['user'].apply(lambda x: x['location'])
            EmojisTweets_i['City'] = '{}'.format(City) #to chunck the df based on the city column
            EmojisTweets_i['Search'] = 'ByEmojis' #To know the type of searching for this tweet, when concatenate all the files
            EmojisTweets=pd.concat([EmojisTweets,EmojisTweets_i])
        else:
            NewNoEmoji_Row={'City':'{}'.format(City), 'Emoji':'{}'.format(E), 'TimeInterval':'{}'.format(Ti)}
            NoEmojiTweet=NoEmojiTweet.append(NewNoEmoji_Row, ignore_index=True)

#All the Saudi Reigonal Tweets | Searching by Emojis
EmojisTweets.to_csv('EmojisTweets.csv')
#File for each City with the missing Emoji during Time Interval:
NoEmojiTweet.to_csv('NoEmojiTweet.csv')

now = datetime.now()
print("EMOJIS: Ending Time =", now.strftime("%H:%M:%S"))

I run the code and it worked, but when I investigate the collected tweets at EmojisTweets, I found that It had been saving only the last round of the inner-for loop. So, the dataframe contains all the tweets from all the cities in GeneralListEmojis list, with all the time interval in TimeInterval list for only the angry emoji '', which is the last emoji at the EmojiList

EmojisList= ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']


来源: stackexchange

问:
How to change AM and PM to midnight and noon for 12:00 React Ant-design time picker
Hello every one I want to change AM to midnight and PM to noon once date is 12:00 selected in ant-design date time picker

I have look into ant design properties but did not find ant property

ContentLicense: CC BY-SA 4.0


问:
OneDrive Image to OneNote using Microsoft Graph
I am interested in adding images that are in my OneDrive to my OneNote via Microsoft Graph.

For this, I wanted to use thubnail from the OneDrive Microsoft Graph (https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_thumbnails?view=odsp-graph-online) to get the address of my image via URL and then add the image using add image from web from the OneNote Microsoft Graph (https://learn.microsoft.com/en-us/graph/onenote-images-files). However, I get the following error when I run the command:

```<code>{'error': {'code': '19999',
  'message': 'Something failed, the API cannot share any more information at the time of the request.',
  'innerError': {'date': '2022-12-20T07:57:01',
   'request-id': '0a6fbfc1-f198-4126-ac3f-3db11f8b2bc6',
   'client-request-id': 'fd60a5e5-e6e6-4244-9aa6-1384275db5c8'}}}
</code>```
```<code>
I don't understand why this method doesn't work and what other solution do I have?
</code>```

Body:
I am interested in adding images that are in my OneDrive to my OneNote via Microsoft Graph.

For this, I wanted to use thubnail from the OneDrive Microsoft Graph (https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_thumbnails?view=odsp-graph-online) to get the address of my image via URL and then add the image using add image from web from the OneNote Microsoft Graph (https://learn.microsoft.com/en-us/graph/onenote-images-files). However, I get the following error when I run the command:

{'error': {'code': '19999',
  'message': 'Something failed, the API cannot share any more information at the time of the request.',
  'innerError': {'date': '2022-12-20T07:57:01',
   'request-id': '0a6fbfc1-f198-4126-ac3f-3db11f8b2bc6',
   'client-request-id': 'fd60a5e5-e6e6-4244-9aa6-1384275db5c8'}}}

I don't understand why this method doesn't work and what other solution do I have?


问:
More than 1 inertia data in Laravel Vue
I am loading page with inertia in Laravel, but when I apply any filter it keeps GET/POST parameters from first render and also create new set of parameters.

So if I apply filter again Inertia.post will run twice. same will happen if I filter 3rd time. Inertia.post will run 3 time. The code files are too large, so I am sharing the inertia part only. Hope that will be enough? Let me know if need more details please.

Thank you guys.

web.php

```<code>Route::get('sales', [SalesController::class, 'showSalesGraph'])->name('showSalesGraph');
</code>```

SalesController.php

```<code>return Inertia::render('Sales', [
            "sales" => $salesData,
            "startDate" => $startDate,
            "EndData" => $endDate
        ]);
</code>```

sales.vue

```<code>import { Inertia } from "@inertiajs/inertia";
import { computed, ref, reactive, inject, Vue } from "vue";

setup(props) {
   const postData = reactive({
        startDate: startDate,
        endDate:endDate,
        _token: usePage().props.value.csrf_token,
        change: "custom",
      });

   Inertia.get("sales", postData, {});
}
</code>```

Title: More than 1 inertia data in Laravel Vue

Body:
I am loading page with inertia in Laravel, but when I apply any filter it keeps GET/POST parameters from first render and also create new set of parameters.

So if I apply filter again Inertia.post will run twice. same will happen if I filter 3rd time. Inertia.post will run 3 time. The code files are too large, so I am sharing the inertia part only. Hope that will be enough? Let me know if need more details please.

Thank you guys.

web.php

Route::get('sales', [SalesController::class, 'showSalesGraph'])->name('showSalesGraph');

SalesController.php

return Inertia::render('Sales', [
            "sales" => $salesData,
            "startDate" => $startDate,
            "EndData" => $endDate
        ]);

sales.vue

import { Inertia } from "@inertiajs/inertia";
import { computed, ref, reactive, inject, Vue } from "vue";

setup(props) {
   const postData = reactive({
        startDate: startDate,
        endDate:endDate,
        _token: usePage().props.value.csrf_token,
        change: "custom",
      });

   Inertia.get("sales", postData, {});
}


问:
DataGridView weird behavior in Visual Studio
My datagridview[Resident's Information DatagridView] has a weird behavior. When I try to run my application using Debug in Visual Studio It takes so much time before Datagridview loads fully  but when I try to run the program through the external .exe under the Debug folder the datagridview loads fast and no delay. I tried cleaning the project or the solution but to no avail. I also tried building it again.

for reference or much detail see video below:

running the application through visual studio
https://drive.google.com/file/d/1LbM--rigXy-m17e7v1DAdmxGnMQ7gE4g/view?usp=share_link

running the application through the .exe file in the Debug folder
https://drive.google.com/file/d/1b19jGooDXMjTkaz5aGMYnimyRlikCxhL/view?usp=share_link

Here's how I populate my DataGridView

```<code>mySQLCommand.CommandText = "Select * From residents" & (IIf(txtSearchResident.Text.Trim = "" Or txtSearchResident.Text = "Type in your search", " ", " WHERE first_name LIKE @resident_name OR middle_name LIKE @resident_name OR last_name LIKE @resident_name")) & " order by first_name asc limit 30 OFFSET " & (((CInt(Me.txtPageNoResident.Text)) - 1) * 30)
                mySQLCommand.Parameters.AddWithValue("@resident_name", "%" & txtSearchResident.Text & "%")
                mySQLReader = mySQLCommand.ExecuteReader

While mySQLReader.Read
                        Dim middle, ext As String
                        If mySQLReader!middle_name <> DBNull.Value Then
                            middle = mySQLReader!middle_name + " "
                        Else
                            middle = ""
                        End If

                        If mySQLReader!ext_name <> DBNull.Value Then
                            ext = mySQLReader!ext_name
                        Else
                            ext = ""
                        End If

                        datagrid.Rows.Add(New String() {(mySQLReader!first_name + " " + middle + mySQLReader!last_name + " " + ext), mySQLReader!sex, mySQLReader!is_voter, mySQLReader!contact_no})

                    End While
</code>```

Language used: Visual Basic .Net
Visual Studio version: 2022
Database: MySQL using Xampp

Body:
My datagridview[Resident's Information DatagridView] has a weird behavior. When I try to run my application using Debug in Visual Studio It takes so much time before Datagridview loads fully  but when I try to run the program through the external .exe under the Debug folder the datagridview loads fast and no delay. I tried cleaning the project or the solution but to no avail. I also tried building it again.

for reference or much detail see video below:

running the application through visual studio
https://drive.google.com/file/d/1LbM--rigXy-m17e7v1DAdmxGnMQ7gE4g/view?usp=share_link

running the application through the .exe file in the Debug folder
https://drive.google.com/file/d/1b19jGooDXMjTkaz5aGMYnimyRlikCxhL/view?usp=share_link

Here's how I populate my DataGridView

mySQLCommand.CommandText = "Select * From residents" & (IIf(txtSearchResident.Text.Trim = "" Or txtSearchResident.Text = "Type in your search", " ", " WHERE first_name LIKE @resident_name OR middle_name LIKE @resident_name OR last_name LIKE @resident_name")) & " order by first_name asc limit 30 OFFSET " & (((CInt(Me.txtPageNoResident.Text)) - 1) * 30)
                mySQLCommand.Parameters.AddWithValue("@resident_name", "%" & txtSearchResident.Text & "%")
                mySQLReader = mySQLCommand.ExecuteReader

While mySQLReader.Read
                        Dim middle, ext As String
                        If mySQLReader!middle_name <> DBNull.Value Then
                            middle = mySQLReader!middle_name + " "
                        Else
                            middle = ""
                        End If

                        If mySQLReader!ext_name <> DBNull.Value Then
                            ext = mySQLReader!ext_name
                        Else
                            ext = ""
                        End If

                        datagrid.Rows.Add(New String() {(mySQLReader!first_name + " " + middle + mySQLReader!last_name + " " + ext), mySQLReader!sex, mySQLReader!is_voter, mySQLReader!contact_no})

                    End While

Language used: Visual Basic .Net
Visual Studio version: 2022
Database: MySQL using Xampp


问:
Php push notifications to firebase in android studio error "Failed to create image decoder with message 'unimplemented'"
I am calling a php script to send notification, all the tokens are in the db and I retrieve them.
If the image is null the

```<code>showSmallNotification
</code>```

will be executed which does not include an image but all I get is this error.
D/skia: --- Failed to create image decoder with message 'unimplemented'
I tried and searched for it but the other examples were not and so helpful

This is the php code

```<code><?php
//importing required files
require_once 'DbOperation.php';
require_once 'Firebase.php';
require_once 'Push.php';

$db = new DbOperation();

$response = array();
$_SERVER['REQUEST_METHOD']='POST';
$_POST['title']="hi";
$_POST['message']="wegweg";
$_POST['email']="test@test.com";
if($_SERVER['REQUEST_METHOD']=='POST'){
    //hecking the required params
    if(isset($_POST['title']) and isset($_POST['message']) and isset($_POST['email'])){

        //creating a new push
        $push = null;
        //first check if the push has an image with it
        if(isset($_POST['image'])){
            $push = new Push(
                    $_POST['title'],
                    $_POST['message'],
                    $_POST['image']
                );
        }else{
            //if the push don't have an image give null in place of image
            $push = new Push(
                    $_POST['title'],
                    $_POST['message'],
                    null
                );
        }

        //getting the push from push object
        $mPushNotification = $push->getPush();

        //getting the token from database object
        $devicetoken = $db->getTokenByEmail($_POST['email']);

        //creating firebase class object
        $firebase = new Firebase();

        //sending push notification and displaying result
        echo $firebase->send($devicetoken, $mPushNotification);
    }else{
        $response['error']=true;
        $response['message']='Parameters missing';
    }
}else{
    $response['error']=true;
    $response['message']='Invalid request';
}

echo json_encode($response);
</code>```

This is the java code but I get the below error

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

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import android.text.Html;

import androidx.core.app.NotificationCompat;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class MyNotificationManager {

    public static final int ID_BIG_NOTIFICATION = 234;
    public static final int ID_SMALL_NOTIFICATION = 235;

    private Context mCtx;

    public MyNotificationManager(Context mCtx) {
        this.mCtx = mCtx;
    }

    //the method will show a big notification with an image
    //parameters are title for message title, message for message text, url of the big image and an intent that will open
    //when you will tap on the notification
    public void showBigNotification(String title, String message, String url, Intent intent) {
        PendingIntent resultPendingIntent =
                PendingIntent.getActivity(
                        mCtx,
                        ID_BIG_NOTIFICATION,
                        intent,
                        PendingIntent.FLAG_UPDATE_CURRENT
                );
        NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle();
        bigPictureStyle.setBigContentTitle(title);
        bigPictureStyle.setSummaryText(Html.fromHtml(message).toString());
        bigPictureStyle.bigPicture(getBitmapFromURL(url));
        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mCtx);
        Notification notification;
        notification = mBuilder.setSmallIcon(R.mipmap.ic_launcher).setTicker(title).setWhen(0)
                .setAutoCancel(true)
                .setContentIntent(resultPendingIntent)
                .setContentTitle(title)
                .setStyle(bigPictureStyle)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(BitmapFactory.decodeResource(mCtx.getResources(), R.mipmap.ic_launcher))
                .setContentText(message)
                .build();

        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        NotificationManager notificationManager = (NotificationManager) mCtx.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(ID_BIG_NOTIFICATION, notification);
    }

    //the method will show a small notification
    //parameters are title for message title, message for message text and an intent that will open
    //when you will tap on the notification
    public void showSmallNotification(String title, String message, Intent intent) {
        PendingIntent resultPendingIntent =
                PendingIntent.getActivity(
                        mCtx,
                        ID_SMALL_NOTIFICATION,
                        intent,
                        PendingIntent.FLAG_UPDATE_CURRENT
                );

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mCtx);
        Notification notification;
        notification = mBuilder.setSmallIcon(R.mipmap.ic_launcher).setTicker(title).setWhen(0)
                .setAutoCancel(true)
                .setContentIntent(resultPendingIntent)
                .setContentTitle(title)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(BitmapFactory.decodeResource(mCtx.getResources(), R.mipmap.ic_launcher))
                .setContentText(message)
                .build();

        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        NotificationManager notificationManager = (NotificationManager) mCtx.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(ID_SMALL_NOTIFICATION, notification);
    }

    //The method will return Bitmap from an image URL
    private Bitmap getBitmapFromURL(String strURL) {
        try {
            URL url = new URL(strURL);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setDoInput(true);
            connection.connect();
            InputStream input = connection.getInputStream();
            Bitmap myBitmap = BitmapFactory.decodeStream(input);
            return myBitmap;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}

</code>```

D/skia: --- Failed to create image decoder with message 'unimplemented'

These are the data that come to the java
E/MyFirebaseMsgService: Data Payload: {data={"image":null,"title":"hi","message":"wegweg"}}
E/MyFirebaseMsgService: Notification JSON {"data":{"image":null,"title":"hi","message":"wegweg"}}

If the image is null then the function

```<code>showSmallNotification
</code>```

will be executed which does not include image
Any ideas?

Body:
I am calling a php script to send notification, all the tokens are in the db and I retrieve them.
If the image is null the

showSmallNotification

will be executed which does not include an image but all I get is this error.
D/skia: --- Failed to create image decoder with message 'unimplemented'
I tried and searched for it but the other examples were not and so helpful

This is the php code

<?php
//importing required files
require_once 'DbOperation.php';
require_once 'Firebase.php';
require_once 'Push.php';

$db = new DbOperation();

$response = array();
$_SERVER['REQUEST_METHOD']='POST';
$_POST['title']="hi";
$_POST['message']="wegweg";
$_POST['email']="test@test.com";
if($_SERVER['REQUEST_METHOD']=='POST'){
    //hecking the required params
    if(isset($_POST['title']) and isset($_POST['message']) and isset($_POST['email'])){

        //creating a new push
        $push = null;
        //first check if the push has an image with it
        if(isset($_POST['image'])){
            $push = new Push(
                    $_POST['title'],
                    $_POST['message'],
                    $_POST['image']
                );
        }else{
            //if the push don't have an image give null in place of image
            $push = new Push(
                    $_POST['title'],
                    $_POST['message'],
                    null
                );
        }

        //getting the push from push object
        $mPushNotification = $push->getPush();

        //getting the token from database object
        $devicetoken = $db->getTokenByEmail($_POST['email']);

        //creating firebase class object
        $firebase = new Firebase();

        //sending push notification and displaying result
        echo $firebase->send($devicetoken, $mPushNotification);
    }else{
        $response['error']=true;
        $response['message']='Parameters missing';
    }
}else{
    $response['error']=true;
    $response['message']='Invalid request';
}

echo json_encode($response);

This is the java code but I get the below error

package com.example.notif3;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import android.text.Html;

import androidx.core.app.NotificationCompat;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class MyNotificationManager {

    public static final int ID_BIG_NOTIFICATION = 234;
    public static final int ID_SMALL_NOTIFICATION = 235;

    private Context mCtx;

    public MyNotificationManager(Context mCtx) {
        this.mCtx = mCtx;
    }

    //the method will show a big notification with an image
    //parameters are title for message title, message for message text, url of the big image and an intent that will open
    //when you will tap on the notification
    public void showBigNotification(String title, String message, String url, Intent intent) {
        PendingIntent resultPendingIntent =
                PendingIntent.getActivity(
                        mCtx,
                        ID_BIG_NOTIFICATION,
                        intent,
                        PendingIntent.FLAG_UPDATE_CURRENT
                );
        NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle();
        bigPictureStyle.setBigContentTitle(title);
        bigPictureStyle.setSummaryText(Html.fromHtml(message).toString());
        bigPictureStyle.bigPicture(getBitmapFromURL(url));
        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mCtx);
        Notification notification;
        notification = mBuilder.setSmallIcon(R.mipmap.ic_launcher).setTicker(title).setWhen(0)
                .setAutoCancel(true)
                .setContentIntent(resultPendingIntent)
                .setContentTitle(title)
                .setStyle(bigPictureStyle)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(BitmapFactory.decodeResource(mCtx.getResources(), R.mipmap.ic_launcher))
                .setContentText(message)
                .build();

        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        NotificationManager notificationManager = (NotificationManager) mCtx.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(ID_BIG_NOTIFICATION, notification);
    }

    //the method will show a small notification
    //parameters are title for message title, message for message text and an intent that will open
    //when you will tap on the notification
    public void showSmallNotification(String title, String message, Intent intent) {
        PendingIntent resultPendingIntent =
                PendingIntent.getActivity(
                        mCtx,
                        ID_SMALL_NOTIFICATION,
                        intent,
                        PendingIntent.FLAG_UPDATE_CURRENT
                );

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mCtx);
        Notification notification;
        notification = mBuilder.setSmallIcon(R.mipmap.ic_launcher).setTicker(title).setWhen(0)
                .setAutoCancel(true)
                .setContentIntent(resultPendingIntent)
                .setContentTitle(title)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(BitmapFactory.decodeResource(mCtx.getResources(), R.mipmap.ic_launcher))
                .setContentText(message)
                .build();

        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        NotificationManager notificationManager = (NotificationManager) mCtx.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(ID_SMALL_NOTIFICATION, notification);
    }

    //The method will return Bitmap from an image URL
    private Bitmap getBitmapFromURL(String strURL) {
        try {
            URL url = new URL(strURL);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setDoInput(true);
            connection.connect();
            InputStream input = connection.getInputStream();
            Bitmap myBitmap = BitmapFactory.decodeStream(input);
            return myBitmap;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}

D/skia: --- Failed to create image decoder with message 'unimplemented'

These are the data that come to the java
E/MyFirebaseMsgService: Data Payload: {data={"image":null,"title":"hi","message":"wegweg"}}
E/MyFirebaseMsgService: Notification JSON {"data":{"image":null,"title":"hi","message":"wegweg"}}

If the image is null then the function

showSmallNotification

will be executed which does not include image
Any ideas?


问:
How can we achieve the Kendo chart combination of Area, Line, and Scatter/Bubble?
How can we achieve the Kendo chart combination of Area, Line, and Scatter/Bubble? I had tried a couple of options but I couldn't achieve that in Kendo.

How can we plot the below series in one chart? Is there any option to handle this scenario? or any other plugin/library suggestion?

Line

Area

Scatter/Bubble

Here is the stackblitz - https://stackblitz.com/edit/angular-kendo-chart-line-color-issue-xrwwrk


问:
npm warning after upgrading angular version
I am facing the below warnings while upgrading from angular 8 to 14. I can build and run application properly despite the warning. However, I would like to remove the warning. Below is the warning. How do I remove it?
Angular version: 14.2.0
nodejs version : 14.17.6

npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@6.0.2 requires a peer of @angular/compiler@>=2.3.1 <13.0.0 || ^12.0.0-next || ^12.1.0-next || ^12.2.0-next but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@6.0.2 requires a peer of @angular/core@>=2.3.1 <13.0.0 || ^12.0.0-next || ^12.1.0-next || ^12.2.0-next but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-darwin-64@0.15.5 (node_modules\esbuild-darwin-64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-darwin-64@0.15.5: wanted {"os":"darwin","arch":"x64"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-android-arm64@0.15.5 (node_modules\esbuild-android-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-android-arm64@0.15.5: wanted {"os":"android","arch":"arm64"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/linux-loong64@0.15.5 (node_modules@esbuild\linux-loong64):


问:
Webpack build results Terser Error: Unexpected token: punc ())
I've been cleaning up my npm audit errors and after I was done I could not execute npm tun build anymore.

Error

```<code>ERROR in web/themes/custom/js/funds-chunk.js from Terser
Unexpected token: punc ()) [webpack://./node_modules/source-map-loader/dist/cjs.js!./frontend/js/shared/select2.countSelectionAdapter.js:18,0][web/themes/custom/js/funds-chunk.js:26214,4]
    at ne (/node_modules/terser/dist/bundle.min.js:1:19592)
    at c (/node_modules/terser/dist/bundle.min.js:1:28298)
    at l (/node_modules/terser/dist/bundle.min.js:1:28389)
    at f (/node_modules/terser/dist/bundle.min.js:1:28442)
    at /node_modules/terser/dist/bundle.min.js:1:38167
    at x (/node_modules/terser/dist/bundle.min.js:1:38198)
    at O (/node_modules/terser/dist/bundle.min.js:1:34874)
    at U (/node_modules/terser/dist/bundle.min.js:1:42405)
    at me (/node_modules/terser/dist/bundle.min.js:1:48326)
    at /terser/dist/bundle.min.js:1:49206
</code>```

package.json

```<code>{
...
 "scripts": {
    "build": "webpack --config webpack.config.js --env production",
  },

  "devDependencies": {
    "@babel/core": "^7.10.4",
    "@types/jquery": "^3.5.1",
    "babel-loader": "^8.1.0",
    "css-loader": "^3.6.0",
    "file-loader": "^6.0.0",
    "image-webpack-loader": "^6.0.0",
    "mini-css-extract-plugin": "^1.6.2",
    "prettier": "2.8.1",
    "sass": "1.32",
    "sass-loader": "^9.0.2",
    "scss-loader": "0.0.1",
    "terser-webpack-plugin": "^3.0.6",
    "ts-loader": "^8.0.18",
    "typescript": "^4.2.3",
    "webpack-cli": "^4.7.2",
    "webpack-merge": "^5.0.8"
  },
  "dependencies": {
    "@popperjs/core": "^2.9.2",
    "@types/bootstrap": "^5.0.12",
    "@types/googlemaps": "^3.43.3",
    "@types/iframe-resizer": "^3.5.9",
    "@types/js-cookie": "^3.0.0",
    "@types/requirejs": "^2.1.32",
    "autoprefixer": "^9.8.5",
    "bootstrap": "^4.0.0",
    "filemanager-webpack-plugin": "^8.0.0",
    "fork-ts-checker-webpack-plugin": "^6.2.0",
    "highcharts": "^9.3.3",
    "highlight.js": "^10.1.1",
    "iframe-resizer": "^3.5.5",
    "jquery": "^3.5.1",
    "jquery-quicksand": "^1.6.0",
    "js-cookie": "^3.0.1",
    "loader-utils": "^2.0.3",
    "parsleyjs": "^2.9.2",
    "popper.js": "^1.0.8",
    "postcss-loader": "^3.0.0",
    "query-string": "^7.0.1",
    "select2": "^4.0.13",
    "slick-carousel": "^1.8.1",
    "source-map-loader": "^2.0.1",
    "swiper": "^6.5.3 <6.8",
    "tippy.js": "^6.2.6",
    "webpack": "^5.30.0"
  },
  "overrides": {
    "got": "12.1.0",
    "semver-regex@<3.1.4": "3.1.4",
    "semver-regex@>=4.0.0 <4.0.3": "4.0.3",
    "trim-newlines": "4.0.1",
    "minimist": "1.2.6",
    "terser@<4.8.1": "4.8.1",
    "terser@>=5.0.0 <5.14.2": "5.14.2",
    "nth-check": "2.0.1",
    "minimatch": "3.0.5"
  }
}
</code>```

webpack.config.prod.js

```<code>const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');

module.exports = {
  mode: 'production',
  devtool: 'source-map',
  optimization: {
    minimize: true,
    minimizer: [
      new TerserPlugin({
        parallel: false,
        terserOptions: {
          ecma: 5, // IE11
          compress: true,
          output: {
            comments: false,
            beautify: false
          }
        }
      })
    ]
  },

  module: {
    rules: [{

      test: /images.*\.(jpg|jpeg|gif|png|svg|webp)$/i,
      use: info => {
        const theme = path.basename(info.issuer, path.extname(info.issuer));
        return [{
            loader: "file-loader",
            options: {
              outputPath: url => path.join('/web/themes/custom', theme, 'dist/images', url),
              name: "[name].[ext]",
              publicPath: '../images'
            },
          },
        ]
      }
    }]
  }
};
</code>```

I've looked into these:

https://github.com/webpack-contrib/terser-webpack-plugin/issues/114,

https://github.com/jantimon/html-webpack-plugin/issues/1262 but I do not use uglify or html-minifier.

https://github.com/webpack/webpack/issues/14662 updated webpack from 5.30.0 to version 5.75 did not help

Webpack 5 - "Unexpected token: punc (.)" after import axios adding mode: web didn't do a thing

Body:
I've been cleaning up my npm audit errors and after I was done I could not execute npm tun build anymore.

Error

ERROR in web/themes/custom/js/funds-chunk.js from Terser
Unexpected token: punc ()) [webpack://./node_modules/source-map-loader/dist/cjs.js!./frontend/js/shared/select2.countSelectionAdapter.js:18,0][web/themes/custom/js/funds-chunk.js:26214,4]
    at ne (/node_modules/terser/dist/bundle.min.js:1:19592)
    at c (/node_modules/terser/dist/bundle.min.js:1:28298)
    at l (/node_modules/terser/dist/bundle.min.js:1:28389)
    at f (/node_modules/terser/dist/bundle.min.js:1:28442)
    at /node_modules/terser/dist/bundle.min.js:1:38167
    at x (/node_modules/terser/dist/bundle.min.js:1:38198)
    at O (/node_modules/terser/dist/bundle.min.js:1:34874)
    at U (/node_modules/terser/dist/bundle.min.js:1:42405)
    at me (/node_modules/terser/dist/bundle.min.js:1:48326)
    at /terser/dist/bundle.min.js:1:49206

package.json

{
...
 "scripts": {
    "build": "webpack --config webpack.config.js --env production",
  },

  "devDependencies": {
    "@babel/core": "^7.10.4",
    "@types/jquery": "^3.5.1",
    "babel-loader": "^8.1.0",
    "css-loader": "^3.6.0",
    "file-loader": "^6.0.0",
    "image-webpack-loader": "^6.0.0",
    "mini-css-extract-plugin": "^1.6.2",
    "prettier": "2.8.1",
    "sass": "1.32",
    "sass-loader": "^9.0.2",
    "scss-loader": "0.0.1",
    "terser-webpack-plugin": "^3.0.6",
    "ts-loader": "^8.0.18",
    "typescript": "^4.2.3",
    "webpack-cli": "^4.7.2",
    "webpack-merge": "^5.0.8"
  },
  "dependencies": {
    "@popperjs/core": "^2.9.2",
    "@types/bootstrap": "^5.0.12",
    "@types/googlemaps": "^3.43.3",
    "@types/iframe-resizer": "^3.5.9",
    "@types/js-cookie": "^3.0.0",
    "@types/requirejs": "^2.1.32",
    "autoprefixer": "^9.8.5",
    "bootstrap": "^4.0.0",
    "filemanager-webpack-plugin": "^8.0.0",
    "fork-ts-checker-webpack-plugin": "^6.2.0",
    "highcharts": "^9.3.3",
    "highlight.js": "^10.1.1",
    "iframe-resizer": "^3.5.5",
    "jquery": "^3.5.1",
    "jquery-quicksand": "^1.6.0",
    "js-cookie": "^3.0.1",
    "loader-utils": "^2.0.3",
    "parsleyjs": "^2.9.2",
    "popper.js": "^1.0.8",
    "postcss-loader": "^3.0.0",
    "query-string": "^7.0.1",
    "select2": "^4.0.13",
    "slick-carousel": "^1.8.1",
    "source-map-loader": "^2.0.1",
    "swiper": "^6.5.3 <6.8",
    "tippy.js": "^6.2.6",
    "webpack": "^5.30.0"
  },
  "overrides": {
    "got": "12.1.0",
    "semver-regex@<3.1.4": "3.1.4",
    "semver-regex@>=4.0.0 <4.0.3": "4.0.3",
    "trim-newlines": "4.0.1",
    "minimist": "1.2.6",
    "terser@<4.8.1": "4.8.1",
    "terser@>=5.0.0 <5.14.2": "5.14.2",
    "nth-check": "2.0.1",
    "minimatch": "3.0.5"
  }
}

webpack.config.prod.js

const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');

module.exports = {
  mode: 'production',
  devtool: 'source-map',
  optimization: {
    minimize: true,
    minimizer: [
      new TerserPlugin({
        parallel: false,
        terserOptions: {
          ecma: 5, // IE11
          compress: true,
          output: {
            comments: false,
            beautify: false
          }
        }
      })
    ]
  },

  module: {
    rules: [{

      test: /images.*\.(jpg|jpeg|gif|png|svg|webp)$/i,
      use: info => {
        const theme = path.basename(info.issuer, path.extname(info.issuer));
        return [{
            loader: "file-loader",
            options: {
              outputPath: url => path.join('/web/themes/custom', theme, 'dist/images', url),
              name: "[name].[ext]",
              publicPath: '../images'
            },
          },
        ]
      }
    }]
  }
};

I've looked into these:

https://github.com/webpack-contrib/terser-webpack-plugin/issues/114,

https://github.com/jantimon/html-webpack-plugin/issues/1262 but I do not use uglify or html-minifier.

https://github.com/webpack/webpack/issues/14662 updated webpack from 5.30.0 to version 5.75 did not help

Webpack 5 - "Unexpected token: punc (.)" after import axios adding mode: web didn't do a thing


问:
Decode string with quotation marks Jenkins
Recently I've encountered error with assertions comparing strings having quotation marks. The marks are not being recongnized and replaced with question marks.
This happens only when running tests on Jenkins.
Project encoding is UTF-8, the same is in maven-plugin-compiler.
Currently my workaround is to replace these marks, but doing it wherever they appear is not something I would be proud of.
Has anyone have any idea how to deal with it?


问:
How to create new branch B starting at point A and tracking non existent origin/B in one command
What I currently do is a common work scenario for me. When I create a new feature branch, I want to start at point 'develop' and set upstream branch with the same name as my feautre branch so it goes like

```<code>git checkout -b feature/MyFeature origin/develop --no-track
</code>```

and with the first push I do

```<code>git push -u origin feature/MyFeature
</code>```

I am wondering if it is possible to create new branch with given starting point and setting upstream with matching name in single git command ?

something like

git checkout -b fastBranch --start-at origin/develop --set-upstream origin/fastBranch

and favoreably with the ability to ommit repeating myself regarding origin/fastBranch part

Body:
What I currently do is a common work scenario for me. When I create a new feature branch, I want to start at point 'develop' and set upstream branch with the same name as my feautre branch so it goes like

git checkout -b feature/MyFeature origin/develop --no-track

and with the first push I do

git push -u origin feature/MyFeature

I am wondering if it is possible to create new branch with given starting point and setting upstream with matching name in single git command ?

something like

git checkout -b fastBranch --start-at origin/develop --set-upstream origin/fastBranch

and favoreably with the ability to ommit repeating myself regarding origin/fastBranch part


问:
Rails casts timestamptz to UTC in Postgres
I'm on Rails 7.0.4 and Postgres 15. I have a trigger that checks if a timestamp(6) with time zone is within a certain date range:

```<code>CREATE TABLE public.contracts (
    id bigint NOT NULL,
    starts_on date NOT NULL,
    ends_on date
);

CREATE TABLE public.time_entries (
    id bigint NOT NULL,
    contract_id bigint,
    "from" timestamp(6) with time zone,
    "to" timestamp(6) with time zone
);
</code>```

And this is the trigger:

```<code>CREATE FUNCTION time_entries_contract_trigger() RETURNS trigger AS $time_entries_contract_trigger$
BEGIN
  IF EXISTS (SELECT 1 FROM contracts WHERE contracts.id = NEW."contract_id" AND NEW."from"::date < starts_on) THEN
    RAISE EXCEPTION 'from % is before contracts.starts_on', NEW."from";
  END IF;
  IF EXISTS (SELECT 1 FROM contracts WHERE contracts.id = NEW."contract_id" AND NEW."to"::date > ends_on) THEN
    RAISE EXCEPTION 'to % is after contracts.ends_on', NEW."to";
  END IF;
  RETURN NEW;
END;
$time_entries_contract_trigger$ LANGUAGE plpgsql;

CREATE TRIGGER time_entries_contract_trigger BEFORE INSERT OR UPDATE ON time_entries
  FOR EACH ROW EXECUTE PROCEDURE time_entries_contract_trigger();
</code>```

And I set the default timezone like this:

```<code>module App
  class Application < Rails::Application
    # ...
    config.time_zone = "Europe/Berlin"
    # ...
end
</code>```

The problem now is, that whenever I try to store a TimeEntry, Rails converts it to UTC and I get an error like this:

```<code>> contract = Contract.create(:contract, starts_on: Date.parse("2021-12-19"))
> contract.time_entries << build(:time_entry, from: Time.zone.parse("2021-12-19T00:00"))
ActiveRecord::StatementInvalid:
  PG::RaiseException: ERROR:  from 2021-12-18 23:00:00+00 is before contracts.starts_on
    CONTEXT:  PL/pgSQL function time_entries_contract_trigger() line 4 at RAISE
</code>```

It makes sense insofar, that Rails converts Time.zone.parse("2021-12-19T00:00") to UTC and my trigger just casts it to a date with NEW."from"::date, just returning the date part (which now is 2021-12-18 and not 2021-12-19).

My questions now are:

How could I force Rails to store the columns with the timezone information in it? My Postgres columns are already timezone aware, so I guess converting it to UTC doesn't make sense any more? Or are there any drawbacks that I'm missing?

Body:
I'm on Rails 7.0.4 and Postgres 15. I have a trigger that checks if a timestamp(6) with time zone is within a certain date range:

CREATE TABLE public.contracts (
    id bigint NOT NULL,
    starts_on date NOT NULL,
    ends_on date
);

CREATE TABLE public.time_entries (
    id bigint NOT NULL,
    contract_id bigint,
    "from" timestamp(6) with time zone,
    "to" timestamp(6) with time zone
);

And this is the trigger:

CREATE FUNCTION time_entries_contract_trigger() RETURNS trigger AS $time_entries_contract_trigger$
BEGIN
  IF EXISTS (SELECT 1 FROM contracts WHERE contracts.id = NEW."contract_id" AND NEW."from"::date < starts_on) THEN
    RAISE EXCEPTION 'from % is before contracts.starts_on', NEW."from";
  END IF;
  IF EXISTS (SELECT 1 FROM contracts WHERE contracts.id = NEW."contract_id" AND NEW."to"::date > ends_on) THEN
    RAISE EXCEPTION 'to % is after contracts.ends_on', NEW."to";
  END IF;
  RETURN NEW;
END;
$time_entries_contract_trigger$ LANGUAGE plpgsql;

CREATE TRIGGER time_entries_contract_trigger BEFORE INSERT OR UPDATE ON time_entries
  FOR EACH ROW EXECUTE PROCEDURE time_entries_contract_trigger();

And I set the default timezone like this:

module App
  class Application < Rails::Application
    # ...
    config.time_zone = "Europe/Berlin"
    # ...
end

The problem now is, that whenever I try to store a TimeEntry, Rails converts it to UTC and I get an error like this:

> contract = Contract.create(:contract, starts_on: Date.parse("2021-12-19"))
> contract.time_entries << build(:time_entry, from: Time.zone.parse("2021-12-19T00:00"))
ActiveRecord::StatementInvalid:
  PG::RaiseException: ERROR:  from 2021-12-18 23:00:00+00 is before contracts.starts_on
    CONTEXT:  PL/pgSQL function time_entries_contract_trigger() line 4 at RAISE

It makes sense insofar, that Rails converts Time.zone.parse("2021-12-19T00:00") to UTC and my trigger just casts it to a date with NEW."from"::date, just returning the date part (which now is 2021-12-18 and not 2021-12-19).

My questions now are:

How could I force Rails to store the columns with the timezone information in it? My Postgres columns are already timezone aware, so I guess converting it to UTC doesn't make sense any more? Or are there any drawbacks that I'm missing?


问:
how to install numpy correctly?
I'm trying to install numpy but i get an error:

I already tried to install it from github but i get the same result, i also tried to install pandas but the tsame thing happens
In all videos i've seen they simply just pip install it, but for me it dosent seem to work

how can i install this correctly?

Title: how to install numpy correctly?


问:
How to do to cypher dsl with set +=
I'am trying to use cypher dsl to create a Statement which results in

merge(n:entity {name:'value'}
set n += {k1:'v1',k2:'v2'}
return n

I parsed it with the CypherParser and it is oke. I see that the set clause has a mutate operator which , i quess, handles the '+='. But when i try to create it with the cypher dsl api  i can't find how to express the '+='

Without '+=' the cypher dsl is something like:

```<code>var node = Cypher.node("entity").withProperties("name", Cypher.literalOf("value"))
var expression = Cypher.mapOf("k1", Cypher.literalOf("v1"), "k2", Cypher.literalOf("v2")
var statement = Cypher.merge(node).set(expression).returning(node).build()
</code>```

This will result in : merge(n:entity {name:'name'} set n = {k1:'v1',k2:'v2'} return n.

The name property is gone when executing this query.

How can i express the '+=' in cypher dsl?

thanks

Title: How to do to cypher dsl with set +=

Body:
I'am trying to use cypher dsl to create a Statement which results in

merge(n:entity {name:'value'}
set n += {k1:'v1',k2:'v2'}
return n

I parsed it with the CypherParser and it is oke. I see that the set clause has a mutate operator which , i quess, handles the '+='. But when i try to create it with the cypher dsl api  i can't find how to express the '+='

Without '+=' the cypher dsl is something like:

var node = Cypher.node("entity").withProperties("name", Cypher.literalOf("value"))
var expression = Cypher.mapOf("k1", Cypher.literalOf("v1"), "k2", Cypher.literalOf("v2")
var statement = Cypher.merge(node).set(expression).returning(node).build()

This will result in : merge(n:entity {name:'name'} set n = {k1:'v1',k2:'v2'} return n.

The name property is gone when executing this query.

How can i express the '+=' in cypher dsl?

thanks


问:
Xamarin iOS HybridWebView app : use javascript function to auto click button after load Webview page
I am developing a Xamarin Android and iOS app, the app is using Webview to display the webpage content, I followed the article's tutorial:
Customizing a WebView

And there is a button in my Webview webpage, I want this app can automatically click the button when app finish load the Webview.

In Android project, I found how to do this , tested in Android simulator and it worked:

JavascriptWebViewClient.cs

```<code>public override void OnPageFinished(WebView view, string url)
        {
            base.OnPageFinished(view, url);
            view.EvaluateJavascript(_javascript, null);
            view.LoadUrl("javascript:document.getElementById('btn_sign').click()");
        }
</code>```

but I don't know how to achieve this function in iOS project?
My iOS project has HybridWebViewRenderer.cs, I think maybe I need to do something similar,
but I can't solve this after did a lot of research.
Can anyone help me solve this?

Thanks!!!

Body:
I am developing a Xamarin Android and iOS app, the app is using Webview to display the webpage content, I followed the article's tutorial:
Customizing a WebView

And there is a button in my Webview webpage, I want this app can automatically click the button when app finish load the Webview.

In Android project, I found how to do this , tested in Android simulator and it worked:

JavascriptWebViewClient.cs

public override void OnPageFinished(WebView view, string url)
        {
            base.OnPageFinished(view, url);
            view.EvaluateJavascript(_javascript, null);
            view.LoadUrl("javascript:document.getElementById('btn_sign').click()");
        }

but I don't know how to achieve this function in iOS project?
My iOS project has HybridWebViewRenderer.cs, I think maybe I need to do something similar,
but I can't solve this after did a lot of research.
Can anyone help me solve this?

Thanks!!!


问:
Getting response 200 instead of 302 in django test
I'm using django-pytest there's a signup/ route in urls which when accessed in browser, a signup form is rendered which expects the fields below

```<code>['first_name', 'last_name', 'username', 'email', 'password1', 'password2']
</code>```

Here's the SignUpView and SignupForm

```<code>import uuid

from django import forms
from django.contrib import messages
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic import FormView

class SignUpForm(UserCreationForm):
    first_name = forms.CharField(
        widget=forms.TextInput(
            attrs={'class': 'form-control', 'placeholder': 'First name'}
        ),
        label='',
    )
    last_name = forms.CharField(
        widget=forms.TextInput(
            attrs={'class': 'form-control', 'placeholder': 'Last name'}
        ),
        label='',
    )
    username = forms.CharField(
        widget=forms.TextInput(
            attrs={'class': 'form-control', 'placeholder': 'Username'}
        ),
        label='',
    )
    email = forms.EmailField(
        widget=forms.EmailInput(
            attrs={'class': 'form-control', 'placeholder': 'Email'}
        ),
        label='',
    )
    password1 = forms.CharField(
        widget=forms.PasswordInput(
            attrs={'class': 'form-control', 'placeholder': 'Password'}
        ),
        label='',
    )
    password2 = forms.CharField(
        widget=forms.PasswordInput(
            attrs={'class': 'form-control', 'placeholder': 'Confirm password'}
        ),
        label='',
    )

class SignUpView(FormView):
    template_name = 'center-form.html'
    form_class = SignUpForm

    def form_valid(self, form):
        if form.is_valid():
            user = User.objects.create_user(
                first_name=form.cleaned_data['first_name'],
                last_name=form.cleaned_data['last_name'],
                username=form.cleaned_data['username'],
                email=form.cleaned_data['email'],
                password=form.cleaned_data['password1'],
                is_active=False,
            )
            activation_code = uuid.uuid4().hex
            Activation.objects.create(code=activation_code, user=user)
            activation_url = self.request.build_absolute_uri(
                reverse('activate', kwargs={'code': activation_code})
            )
            send_mail(
                'Activate translation account',
                f'To activate your account, please follow the link below\n{activation_url}',
                'Translation services',
                [form.cleaned_data['email']],
                fail_silently=False,
            )
            messages.success(
                self.request,
                'Please check your email for a message with the activation code.',
            )
        return redirect('index')
</code>```

Both work as expected when accessed in browser and a user is eventually created. Here's the test that I'm expecting to pass.

```<code>import pytest
from django.urls import reverse

@pytest.mark.django_db
class TestSignup:
    def test_valid(self, client, valid_user_data, django_user_model):
        url = reverse('signup')
        client.get(url)
        response = client.post(url, valid_user_data)
        assert django_user_model.objects.count() and response.status_code == 302
</code>```

It doesn't. The response's status code is 200 and django_user_model.objects.count() is still 0 after the response.

Here's valid_user_data

```<code>{
        'first_name': 'First',
        'last_name': 'Last',
        'username': 'username',
        'email': 'email@domain.com',
        'password1': 'HJGcutcu23TYCUhtxfy5ex',
        'password2': 'HJGcutcu23TYCUhtxfy5ex',
}
</code>```

```<code><TemplateResponse status_code=200, "text/html; charset=utf-8">
</code>```

Body:
I'm using django-pytest there's a signup/ route in urls which when accessed in browser, a signup form is rendered which expects the fields below

['first_name', 'last_name', 'username', 'email', 'password1', 'password2']

Here's the SignUpView and SignupForm

import uuid

from django import forms
from django.contrib import messages
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic import FormView

class SignUpForm(UserCreationForm):
    first_name = forms.CharField(
        widget=forms.TextInput(
            attrs={'class': 'form-control', 'placeholder': 'First name'}
        ),
        label='',
    )
    last_name = forms.CharField(
        widget=forms.TextInput(
            attrs={'class': 'form-control', 'placeholder': 'Last name'}
        ),
        label='',
    )
    username = forms.CharField(
        widget=forms.TextInput(
            attrs={'class': 'form-control', 'placeholder': 'Username'}
        ),
        label='',
    )
    email = forms.EmailField(
        widget=forms.EmailInput(
            attrs={'class': 'form-control', 'placeholder': 'Email'}
        ),
        label='',
    )
    password1 = forms.CharField(
        widget=forms.PasswordInput(
            attrs={'class': 'form-control', 'placeholder': 'Password'}
        ),
        label='',
    )
    password2 = forms.CharField(
        widget=forms.PasswordInput(
            attrs={'class': 'form-control', 'placeholder': 'Confirm password'}
        ),
        label='',
    )

class SignUpView(FormView):
    template_name = 'center-form.html'
    form_class = SignUpForm

    def form_valid(self, form):
        if form.is_valid():
            user = User.objects.create_user(
                first_name=form.cleaned_data['first_name'],
                last_name=form.cleaned_data['last_name'],
                username=form.cleaned_data['username'],
                email=form.cleaned_data['email'],
                password=form.cleaned_data['password1'],
                is_active=False,
            )
            activation_code = uuid.uuid4().hex
            Activation.objects.create(code=activation_code, user=user)
            activation_url = self.request.build_absolute_uri(
                reverse('activate', kwargs={'code': activation_code})
            )
            send_mail(
                'Activate translation account',
                f'To activate your account, please follow the link below\n{activation_url}',
                'Translation services',
                [form.cleaned_data['email']],
                fail_silently=False,
            )
            messages.success(
                self.request,
                'Please check your email for a message with the activation code.',
            )
        return redirect('index')

Both work as expected when accessed in browser and a user is eventually created. Here's the test that I'm expecting to pass.

import pytest
from django.urls import reverse

@pytest.mark.django_db
class TestSignup:
    def test_valid(self, client, valid_user_data, django_user_model):
        url = reverse('signup')
        client.get(url)
        response = client.post(url, valid_user_data)
        assert django_user_model.objects.count() and response.status_code == 302

It doesn't. The response's status code is 200 and django_user_model.objects.count() is still 0 after the response.

Here's valid_user_data

{
        'first_name': 'First',
        'last_name': 'Last',
        'username': 'username',
        'email': 'email@domain.com',
        'password1': 'HJGcutcu23TYCUhtxfy5ex',
        'password2': 'HJGcutcu23TYCUhtxfy5ex',
}

<TemplateResponse status_code=200, "text/html; charset=utf-8">


问:
Mat-select selected value is undefined
I have multiselect list and when I select the option I can't get the value, not from the event, not from the property, everything that I tried -ngModel/value/ formControl is undefined. Why?

```<code>  <div class="flex" style="width:35%;float:right;margin-top:10px;flex-direction:column">

            <form [formGroup]="filterSearchForm">

            <mat-form-field style="width:70%">
                <mat-select [formControlName]="'customField'" [(ngModel)]="selectedUserType"  [multiple]="true" placeholder="בחר" (selectionChange)="filterByCustomFields($event)">

                    <mat-option *ngFor="let custom of filteredRows" #matSelect  (onSelectionChange)="filterByCustomFields($event,matSelect)" [value]="custom.value">
                        {{custom.fieldHebKey}}
                    </mat-option>
                </mat-select>
            </mat-form-field>
            </form>

        </div>
</code>```

Title: Mat-select selected value is undefined

Body:
I have multiselect list and when I select the option I can't get the value, not from the event, not from the property, everything that I tried -ngModel/value/ formControl is undefined. Why?

            <form [formGroup]="filterSearchForm">

            <mat-form-field style="width:70%">
                <mat-select [formControlName]="'customField'" [(ngModel)]="selectedUserType"  [multiple]="true" placeholder="בחר" (selectionChange)="filterByCustomFields($event)">

                    <mat-option *ngFor="let custom of filteredRows" #matSelect  (onSelectionChange)="filterByCustomFields($event,matSelect)" [value]="custom.value">
                        {{custom.fieldHebKey}}
                    </mat-option>
                </mat-select>
            </mat-form-field>
            </form>


问:
Detox No elements found for MATCHER text
I am trying to tap the element by text, but it is failing. on home screen tap by test work, but after on second screen it failed

I needed to be working as other by text element.


问:
How to pass the result of one field to another in graphql
I have a query which gives me the list of projects for which I am using project schema. I want to get the count of repeated users across the projects for which I am calling a function getRepeatedUsersCounter. But I am not sure how do I pass this projectList result to this getRepeatedUsersCounter() and get it fit in the below query structure</p>
```<code>query projectList() {
  getProjectList() {
    project{
      id
      name
      users
    }
    usersCounter{
    //This is for across the project
     user1Counter
     user2Counter
    }
  }
}
</code>```

Body:
I have a query which gives me the list of projects for which I am using project schema. I want to get the count of repeated users across the projects for which I am calling a function getRepeatedUsersCounter. But I am not sure how do I pass this projectList result to this getRepeatedUsersCounter() and get it fit in the below query structure

query projectList() {
  getProjectList() {
    project{
      id
      name
      users
    }
    usersCounter{
    //This is for across the project
     user1Counter
     user2Counter
    }
  }
}


问:
Control amount of UDP ports used by webRTC
I have simple webRTC app written with nodejs socket.io and peerJS. This app works great when there are no restrictions on the network, but yesterday I was informed by network admin that webRTC uses port range from 49152 to 65536 udp and thats to much.

How can I limit amount of ports that webRTC uses, the app allows only two streams so I don't need massive port ranges for connection.

This is my basic setup if needed I can post some server side code

```<code>const socket = io('/')
const videoGrid = document.getElementById('video-grid')
const myPeer = new Peer(undefined, {
  path: '/peerjs',
  host: '/',
  port: '3000'
})
const peers = {}
let myVideoStream;
const myVideo = document.createElement('video')
myVideo.muted = true;

Promise.resolve(navigator.mediaDevices.getUserMedia({
    video: {
      width: 1920,
      height: 1080,
      aspectRatio: { ideal: 1.7777777778 },
      frameRate: { max: 24, }
    },
    audio: true
  })).then(stream => {
    console.log("server | camera | mic")
    myVideoStream = stream;

    myPeer.on('call', call => {
      call.answer(stream)
      const video = document.createElement('video')
      call.on('stream', userVideoStream => {
        addVideoStream(video, userVideoStream)
      })
    })

    socket.on('user-connected', userId => {
      connectToNewUser(userId, stream)
    })

  }).catch(() => {
    Promise.resolve(navigator.mediaDevices.getUserMedia({
      video: {
        width: 1920,
        height: 1080,
        aspectRatio: { ideal: 1.7777777778 },
        frameRate: { max: 24, }
      },
      audio: false
    })).then(stream => {
      console.log("server | camera | no mic")
      myVideoStream = stream;

      myPeer.on('call', call => {
        call.answer(stream)
        const video = document.createElement('video')
        call.on('stream', userVideoStream => {
          addVideoStream(video, userVideoStream)
        })
      })

      socket.on('user-connected', userId => {
        connectToNewUser(userId, stream)
      })

    }).catch(() => {
      console.log("Server does not have camera or microphone available.")
    })
  })

socket.on('user-disconnected', userId => {
  if (peers[userId]) peers[userId].close()
})

myPeer.on('open', id => {
  socket.emit('join-room', ROOM_ID, id)
})

function connectToNewUser(userId, stream) {
  const call = myPeer.call(userId, stream)
  const video = document.createElement('video')
  call.on('stream', userVideoStream => {
    addVideoStream(video, userVideoStream)
  })
  call.on('close', () => {
    video.remove()
  })

  peers[userId] = call
}

</code>```

Body:
I have simple webRTC app written with nodejs socket.io and peerJS. This app works great when there are no restrictions on the network, but yesterday I was informed by network admin that webRTC uses port range from 49152 to 65536 udp and thats to much.

How can I limit amount of ports that webRTC uses, the app allows only two streams so I don't need massive port ranges for connection.

This is my basic setup if needed I can post some server side code

const socket = io('/')
const videoGrid = document.getElementById('video-grid')
const myPeer = new Peer(undefined, {
  path: '/peerjs',
  host: '/',
  port: '3000'
})
const peers = {}
let myVideoStream;
const myVideo = document.createElement('video')
myVideo.muted = true;

Promise.resolve(navigator.mediaDevices.getUserMedia({
    video: {
      width: 1920,
      height: 1080,
      aspectRatio: { ideal: 1.7777777778 },
      frameRate: { max: 24, }
    },
    audio: true
  })).then(stream => {
    console.log("server | camera | mic")
    myVideoStream = stream;

    myPeer.on('call', call => {
      call.answer(stream)
      const video = document.createElement('video')
      call.on('stream', userVideoStream => {
        addVideoStream(video, userVideoStream)
      })
    })

    socket.on('user-connected', userId => {
      connectToNewUser(userId, stream)
    })

  }).catch(() => {
    Promise.resolve(navigator.mediaDevices.getUserMedia({
      video: {
        width: 1920,
        height: 1080,
        aspectRatio: { ideal: 1.7777777778 },
        frameRate: { max: 24, }
      },
      audio: false
    })).then(stream => {
      console.log("server | camera | no mic")
      myVideoStream = stream;

      myPeer.on('call', call => {
        call.answer(stream)
        const video = document.createElement('video')
        call.on('stream', userVideoStream => {
          addVideoStream(video, userVideoStream)
        })
      })

      socket.on('user-connected', userId => {
        connectToNewUser(userId, stream)
      })

    }).catch(() => {
      console.log("Server does not have camera or microphone available.")
    })
  })

socket.on('user-disconnected', userId => {
  if (peers[userId]) peers[userId].close()
})

myPeer.on('open', id => {
  socket.emit('join-room', ROOM_ID, id)
})

function connectToNewUser(userId, stream) {
  const call = myPeer.call(userId, stream)
  const video = document.createElement('video')
  call.on('stream', userVideoStream => {
    addVideoStream(video, userVideoStream)
  })
  call.on('close', () => {
    video.remove()
  })

  peers[userId] = call
}


问:
Return custom response in websocket in Django
I wanted to return a response if the token is invalid.

consumer.py

```<code>some code...

async def connect(self):
        try:
            self.userId = self.scope['url_route']['kwargs']['token']

            try:
                UntypedToken(self.userId)
            except (InvalidToken, TokenError) as e:
                print(e)
                return {"response": False, "return_code": "invalid_token", "result": {}, "message": errors["token_not_valid"]}

some code...
</code>```

in a browser, I'm not getting error details. I'm using WebSocket Test Client.
and in postman, I'm getting this

```<code>Error: connect ECONNREFUSED 127.0.0.1:8000
Handshake Details
Request URL: http://127.0.0.1:8000/ws/users/eyJ0e.eyJ0b2In0.cbyYygG/chat/
Request Method: GET
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: RpWsJRu+ziCUjwLtRjgNHg==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: 127.0.0.1:8000
</code>```

a result I'm expecting is.

```<code>{
    "response": false,
    "return_code": "invalid_token",
    "result": {},
    "message": "token error"
}
</code>```

Body:
I wanted to return a response if the token is invalid.

consumer.py

some code...

async def connect(self):
        try:
            self.userId = self.scope['url_route']['kwargs']['token']

            try:
                UntypedToken(self.userId)
            except (InvalidToken, TokenError) as e:
                print(e)
                return {"response": False, "return_code": "invalid_token", "result": {}, "message": errors["token_not_valid"]}

some code...

in a browser, I'm not getting error details. I'm using WebSocket Test Client.
and in postman, I'm getting this

Error: connect ECONNREFUSED 127.0.0.1:8000
Handshake Details
Request URL: http://127.0.0.1:8000/ws/users/eyJ0e.eyJ0b2In0.cbyYygG/chat/
Request Method: GET
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: RpWsJRu+ziCUjwLtRjgNHg==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: 127.0.0.1:8000

a result I'm expecting is.

{
    "response": false,
    "return_code": "invalid_token",
    "result": {},
    "message": "token error"
}


问:
Can I know if the click event in JS was produced while the cursor was pointer?
I'll explain: I want to detect a click on a pseudo-element, which I already know is not possible. So I've thought that I could made the cursor pointer with CSS while the cursor is over the pseudo-element and then, when the click event starts, watch if the cursor was pointer at that moment.</p>


问:
efficient partitioning column-wise when converting from dask dataframe to xarray (dask array)
A common task in my daily data wrangling is converting tab-delimited text files to xarray datasets and continuing analysis on the dataset and saving to zarr or netCDF format.

I have developed a data pipeline to read the data into dask dataframe, convert it to a dask array and assigning to a xarray dataset.

The data is two-dimensional along dimensions "time" and "subid".

ddf = dd.read_table(some_text_file, ...)
data = ddf.to_dask_array(lengths=True)
attrs = {"about": "some attribute"}

ds = xr.Dataset({"parameter": (["time", "subid"], data, attrs)}

```
<p>Now, this is working fine as intended. However, recently we have been doing many computational heavy operations along the <code>time</code> dimension such that we often want to rechunk the data along that dimension, so we usually follow this up by:</p>
<pre class="lang-py prettyprint-override"><code>ds_chunked = ds.chunk({"time": -1, "subid": "auto"})
</code>```

and then save to disk or do some analysis and then save to disk.

This is however causing quite a bottleneck as the rechunking adds significant time to the pipeline generating the datasets. I am aware that there is no work-around to speeding up rechunking and that one should avoid it if looking for performance improvement. So my questions is really: can anyone think of any smart idea to avoid it or possibly improving its speed? I've looked into reading the data into partitions by column but I haven't found any info on dask dataframe reading data in partitions along columns. If I could "read the data column-wise" (i.e. along time dimension), I wouldn't have to rechunk.

To generate some data for this example you can replace the read_table with something like ddf = dask.datasets.timeseries().

Tried reading data into a dask dataframe but I have to rechunk everytime so I am looking for a way to read the data initially column-wise (along one dimension).

Body:
A common task in my daily data wrangling is converting tab-delimited text files to xarray datasets and continuing analysis on the dataset and saving to zarr or netCDF format.

I have developed a data pipeline to read the data into dask dataframe, convert it to a dask array and assigning to a xarray dataset.

The data is two-dimensional along dimensions "time" and "subid".

ddf = dd.read_table(some_text_file, ...)
data = ddf.to_dask_array(lengths=True)
attrs = {"about": "some attribute"}

ds = xr.Dataset({"parameter": (["time", "subid"], data, attrs)}

Now, this is working fine as intended. However, recently we have been doing many computational heavy operations along the time dimension such that we often want to rechunk the data along that dimension, so we usually follow this up by:

ds_chunked = ds.chunk({"time": -1, "subid": "auto"})

and then save to disk or do some analysis and then save to disk.

This is however causing quite a bottleneck as the rechunking adds significant time to the pipeline generating the datasets. I am aware that there is no work-around to speeding up rechunking and that one should avoid it if looking for performance improvement. So my questions is really: can anyone think of any smart idea to avoid it or possibly improving its speed? I've looked into reading the data into partitions by column but I haven't found any info on dask dataframe reading data in partitions along columns. If I could "read the data column-wise" (i.e. along time dimension), I wouldn't have to rechunk.

To generate some data for this example you can replace the read_table with something like ddf = dask.datasets.timeseries().

Tried reading data into a dask dataframe but I have to rechunk everytime so I am looking for a way to read the data initially column-wise (along one dimension).


问:
Can't use API in a cordova app, the fetch does not work
When I build a debug version of my app and tested it on my android phone, the API's I am using didn't connected to it but when I tested the HTML code itself (with the API's) on my pc (not in cordova, in my browser) it worked just fine.
I am using cordova-android 10.1.1 and 30.0.3 as my android build tools sdk version.
The API I am using is a simple weather API from WeatherApi.Com.
I am using it by the fetch function in js and gets the output to a div.
An example code :

Loading...

```

With this code, the div stays on "Loading..." forever.

I am not using any plugin, and I just removed the css and the js from the default index.html file I got in the www folder.

Is there a solution for this issue?

I tried to build a debug version of my app and check if everything is ok with the API before building the release and everything was fine in my chrome browser, but when I tested it on my android mobile phone it didn't worked.

Body:
When I build a debug version of my app and tested it on my android phone, the API's I am using didn't connected to it but when I tested the HTML code itself (with the API's) on my pc (not in cordova, in my browser) it worked just fine.
I am using cordova-android 10.1.1 and 30.0.3 as my android build tools sdk version.
The API I am using is a simple weather API from WeatherApi.Com.
I am using it by the fetch function in js and gets the output to a div.
An example code :

Loading...

With this code, the div stays on "Loading..." forever.

I am not using any plugin, and I just removed the css and the js from the default index.html file I got in the www folder.

Is there a solution for this issue?

I tried to build a debug version of my app and check if everything is ok with the API before building the release and everything was fine in my chrome browser, but when I tested it on my android mobile phone it didn't worked.


问:
Update data from SQL sever directly in excel
Is there anyway I can update data from my SQL server table directly in Excel?

It is easy enough to connect to my table and get updated data into Excel, but i am looking for the solution to go the other way around.

My table is being used in a Web app and updates rely heavily on me, so i would like to make it easy for others to update the data directly from excel.

excel 2016


问:
filebeat cannot connect to logstash because of selinux
filebeat cannot connect to logstash because this happen when i upgrade kubernetes to 1.24 the log path is changed, on this version is no longer using docker as a runtime

i only change this path and cannot connect to logstash

```<code>  paths:
    - "/var/log/containers/*.log"
</code>```

but when i run this on kubernetes with docker runtime is work

```<code>  paths:
    - /var/lib/docker/containers/*/*.log
</code>```

here my filebeat.yml

```<code>apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  filebeat.yml: |-
    filebeat.config:
      prospectors:
        # Mounted `filebeat-prospectors` configmap:
        path: ${path.config}/prospectors.d/*.yml
        # Reload prospectors configs as they change:
        reload.enabled: false
      modules:
        path: ${path.config}/modules.d/*.yml
        # Reload module configs as they change:
        reload.enabled: false

    processors:
      - add_cloud_metadata:
    output.logstash:
      hosts: ["log.xxx.com:5044"]
      ssl.certificate_authorities: ["/usr/share/filebeat/certs/elk-ca.pem"]
      ssl.certificate: "/usr/share/filebeat/certs/beats-client.pem"
      ssl.key: "/usr/share/filebeat/certs/beats-client.key"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-prospectors
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  kubernetes.yml: |-
    - type: log
      enabled: true
      symlinks: true
      paths:
        - "/var/log/containers/*.log"
      processors:
        - add_kubernetes_metadata:
            in_cluster: true
            default_matchers.enabled: false
            matchers:
            - logs_path:
                logs_path: /var/log/containers/
</code>```

logs

```<code>2022-12-19T13:06:35.189Z INFO instance/beat.go:611 Home path: [/usr/share/filebeat] Config path: [/usr/share/filebeat] Data path: [/usr/share/filebeat/data] Logs path: [/usr/share/filebeat/logs]
2022-12-19T13:06:35.190Z INFO instance/beat.go:618 Beat UUID: 68776622-4469-4ff4-bf1a-442d13456c75
2022-12-19T13:06:35.190Z INFO [seccomp] seccomp/seccomp.go:116 Syscall filter successfully installed
2022-12-19T13:06:35.190Z INFO [beat] instance/beat.go:931 Beat info {"system_info": {"beat": {"path": {"config": "/usr/share/filebeat", "data": "/usr/share/filebeat/data", "home": "/usr/share/filebeat", "logs": "/usr/share/filebeat/logs"}, "type": "filebeat", "uuid": "68776622-4469-4ff4-bf1a-442d13456c75"}}}
2022-12-19T13:06:35.191Z INFO [beat] instance/beat.go:940 Build info {"system_info": {"build": {"commit": "1d55b4bd9dbf106a4ad4bc34fe9ee425d922363b", "libbeat": "6.7.1", "time": "2019-04-02T15:01:15.000Z", "version": "6.7.1"}}}
2022-12-19T13:06:35.191Z INFO [beat] instance/beat.go:943 Go runtime info {"system_info": {"go": {"os":"linux","arch":"amd64","max_procs":4,"version":"go1.10.8"}}}
2022-12-19T13:06:35.193Z INFO [beat] instance/beat.go:947 Host info {"system_info": {"host": {"architecture":"x86_64","boot_time":"2022-12-15T13:22:10Z","containerized":true,"name":"filebeat-2gh9x","ip":["127.0.0.1/8","::1/128","10.220.48.144/32","fe80::74:65ff:fe3e:27f0/64"],"kernel_version":"3.10.0-1160.80.1.el7.x86_64","mac":["02:74:65:3e:27:f0"],"os":{"family":"redhat","platform":"centos","name":"CentOS Linux","version":"7 (Core)","major":7,"minor":6,"patch":1810,"codename":"Core"},"timezone":"UTC","timezone_offset_sec":0}}}
2022-12-19T13:06:35.195Z INFO [beat] instance/beat.go:976 Process info {"system_info": {"process": {"capabilities": {"inheritable":null,"permitted":["chown","dac_override","fowner","fsetid","kill","setgid","setuid","setpcap","net_bind_service","net_raw","sys_chroot","mknod","audit_write","setfcap"],"effective":["chown","dac_override","fowner","fsetid","kill","setgid","setuid","setpcap","net_bind_service","net_raw","sys_chroot","mknod","audit_write","setfcap"],"bounding":["chown","dac_override","fowner","fsetid","kill","setgid","setuid","setpcap","net_bind_service","net_raw","sys_chroot","mknod","audit_write","setfcap"],"ambient":null}, "cwd": "/usr/share/filebeat", "exe": "/usr/share/filebeat/filebeat", "name": "filebeat", "pid": 1, "ppid": 0, "seccomp": {"mode":"filter","no_new_privs":true}, "start_time": "2022-12-19T13:06:34.150Z"}}}
2022-12-19T13:06:35.195Z INFO instance/beat.go:280 Setup Beat: filebeat; Version: 6.7.1
2022-12-19T13:06:35.197Z INFO [publisher] pipeline/module.go:110 Beat name: filebeat-2gh9x
2022-12-19T13:06:35.197Z WARN [cfgwarn] beater/filebeat.go:89 DEPRECATED: config.prospectors are deprecated, Use `config.inputs` instead. Will be removed in version: 7.0.0
2022-12-19T13:06:35.198Z INFO instance/beat.go:402 filebeat start running.
2022-12-19T13:06:35.198Z INFO registrar/registrar.go:97 No registry file found under: /usr/share/filebeat/data/registry. Creating a new registry file.
2022-12-19T13:06:35.200Z INFO registrar/registrar.go:134 Loading registrar data from /usr/share/filebeat/data/registry
2022-12-19T13:06:35.200Z INFO registrar/registrar.go:141 States Loaded from registrar: 0
2022-12-19T13:06:35.200Z WARN beater/filebeat.go:367 Filebeat is unable to load the Ingest Node pipelines for the configured modules because the Elasticsearch output is not configured/enabled. If you have already loaded the Ingest Node pipelines or are using Logstash pipelines, you can ignore this warning.
2022-12-19T13:06:35.200Z INFO crawler/crawler.go:72 Loading Inputs: 0
2022-12-19T13:06:35.245Z INFO [monitoring] log/log.go:117 Starting metrics logging every 30s
2022-12-19T13:06:35.484Z INFO kubernetes/util.go:86 kubernetes: Using pod name filebeat-2gh9x and namespace kube-system to discover kubernetes node
2022-12-19T13:06:35.576Z INFO add_cloud_metadata/add_cloud_metadata.go:345 add_cloud_metadata: hosting provider type detected as ec2, metadata={"availability_zone":"ap-southeast-1a","instance_id":"i-01eae62cd2b63a734","machine_type":"t3.xlarge","provider":"ec2","region":"ap-southeast-1"}
2022-12-19T13:06:35.730Z INFO kubernetes/util.go:93 kubernetes: Using node ip-10-12-xxx.ap-southeast-1.compute.internal discovered by in cluster pod node query
2022-12-19T13:06:35.731Z INFO kubernetes/watcher.go:182 kubernetes: Performing a resource sync for *v1.PodList
2022-12-19T13:06:35.766Z INFO kubernetes/watcher.go:198 kubernetes: Resource sync done
2022-12-19T13:06:35.767Z INFO kubernetes/watcher.go:242 kubernetes: Watching API for resource events
2022-12-19T13:06:35.767Z INFO log/input.go:138 Configured paths: [/var/log/containers/*.log]
2022-12-19T13:06:35.767Z INFO cfgfile/reload.go:150 Config reloader started
2022-12-19T13:06:35.767Z INFO crawler/crawler.go:106 Loading and starting Inputs completed. Enabled inputs: 0
2022-12-19T13:06:35.768Z INFO cfgfile/reload.go:150 Config reloader started
2022-12-19T13:06:35.768Z INFO cfgfile/reload.go:205 Loading of config files completed.
2022-12-19T13:06:35.770Z INFO kubernetes/util.go:86 kubernetes: Using pod name filebeat-2gh9x and namespace kube-system to discover kubernetes node
2022-12-19T13:06:35.928Z INFO kubernetes/util.go:93 kubernetes: Using node ip-10-12-xxx.ap-southeast-1.compute.interna discovered by in cluster pod node query
2022-12-19T13:06:35.928Z INFO kubernetes/watcher.go:182 kubernetes: Performing a resource sync for *v1.PodList
2022-12-19T13:06:35.934Z INFO kubernetes/watcher.go:198 kubernetes: Resource sync done
2022-12-19T13:06:35.934Z INFO kubernetes/watcher.go:242 kubernetes: Watching API for resource events
2022-12-19T13:06:35.935Z INFO log/input.go:138 Configured paths: [/var/log/containers/*.log]
2022-12-19T13:06:35.935Z INFO input/input.go:114 Starting input of type: log; ID: 12715084902863065571
2022-12-19T13:06:35.935Z INFO cfgfile/reload.go:205 Loading of config files completed.
</code>```

UPDATE
its selinux problem
any idea fix this instead of change the selinux to permissive ?

```<code>type=AVC msg=audit(1671531416.824:408337): avc:  denied  { read } for  pid=10185 comm="filebeat" name="containers" dev="dm-3" ino=524357 scontext=system_u:system_r:container_t:s0:c579,c853 tcontext=system_u:object_r:container_log_t:s0 tclass=dir permissive=0
type=SYSCALL msg=audit(1671531416.824:408337): arch=c000003e syscall=257 success=no exit=-13 a0=ffffffffffffff9c a1=c4202b3b20 a2=80000 a3=0 items=0 ppid=10123 pid=10185 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="filebeat" exe="/usr/share/filebeat/filebeat" subj=system_u:system_r:container_t:s0:c579,c853 key=(null)
type=PROCTITLE msg=audit(1671531416.824:408337): proctitle=66696C6562656174002D63002F6574632F66696C65626561742E796D6C002D65
</code>```

Body:
filebeat cannot connect to logstash because this happen when i upgrade kubernetes to 1.24 the log path is changed, on this version is no longer using docker as a runtime

i only change this path and cannot connect to logstash

  paths:
    - "/var/log/containers/*.log"

but when i run this on kubernetes with docker runtime is work

  paths:
    - /var/lib/docker/containers/*/*.log

here my filebeat.yml

apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  filebeat.yml: |-
    filebeat.config:
      prospectors:
        # Mounted `filebeat-prospectors` configmap:
        path: ${path.config}/prospectors.d/*.yml
        # Reload prospectors configs as they change:
        reload.enabled: false
      modules:
        path: ${path.config}/modules.d/*.yml
        # Reload module configs as they change:
        reload.enabled: false

    processors:
      - add_cloud_metadata:
    output.logstash:
      hosts: ["log.xxx.com:5044"]
      ssl.certificate_authorities: ["/usr/share/filebeat/certs/elk-ca.pem"]
      ssl.certificate: "/usr/share/filebeat/certs/beats-client.pem"
      ssl.key: "/usr/share/filebeat/certs/beats-client.key"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-prospectors
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  kubernetes.yml: |-
    - type: log
      enabled: true
      symlinks: true
      paths:
        - "/var/log/containers/*.log"
      processors:
        - add_kubernetes_metadata:
            in_cluster: true
            default_matchers.enabled: false
            matchers:
            - logs_path:
                logs_path: /var/log/containers/

logs

2022-12-19T13:06:35.189Z INFO instance/beat.go:611 Home path: [/usr/share/filebeat] Config path: [/usr/share/filebeat] Data path: [/usr/share/filebeat/data] Logs path: [/usr/share/filebeat/logs]
2022-12-19T13:06:35.190Z INFO instance/beat.go:618 Beat UUID: 68776622-4469-4ff4-bf1a-442d13456c75
2022-12-19T13:06:35.190Z INFO [seccomp] seccomp/seccomp.go:116 Syscall filter successfully installed
2022-12-19T13:06:35.190Z INFO [beat] instance/beat.go:931 Beat info {"system_info": {"beat": {"path": {"config": "/usr/share/filebeat", "data": "/usr/share/filebeat/data", "home": "/usr/share/filebeat", "logs": "/usr/share/filebeat/logs"}, "type": "filebeat", "uuid": "68776622-4469-4ff4-bf1a-442d13456c75"}}}
2022-12-19T13:06:35.191Z INFO [beat] instance/beat.go:940 Build info {"system_info": {"build": {"commit": "1d55b4bd9dbf106a4ad4bc34fe9ee425d922363b", "libbeat": "6.7.1", "time": "2019-04-02T15:01:15.000Z", "version": "6.7.1"}}}
2022-12-19T13:06:35.191Z INFO [beat] instance/beat.go:943 Go runtime info {"system_info": {"go": {"os":"linux","arch":"amd64","max_procs":4,"version":"go1.10.8"}}}
2022-12-19T13:06:35.193Z INFO [beat] instance/beat.go:947 Host info {"system_info": {"host": {"architecture":"x86_64","boot_time":"2022-12-15T13:22:10Z","containerized":true,"name":"filebeat-2gh9x","ip":["127.0.0.1/8","::1/128","10.220.48.144/32","fe80::74:65ff:fe3e:27f0/64"],"kernel_version":"3.10.0-1160.80.1.el7.x86_64","mac":["02:74:65:3e:27:f0"],"os":{"family":"redhat","platform":"centos","name":"CentOS Linux","version":"7 (Core)","major":7,"minor":6,"patch":1810,"codename":"Core"},"timezone":"UTC","timezone_offset_sec":0}}}
2022-12-19T13:06:35.195Z INFO [beat] instance/beat.go:976 Process info {"system_info": {"process": {"capabilities": {"inheritable":null,"permitted":["chown","dac_override","fowner","fsetid","kill","setgid","setuid","setpcap","net_bind_service","net_raw","sys_chroot","mknod","audit_write","setfcap"],"effective":["chown","dac_override","fowner","fsetid","kill","setgid","setuid","setpcap","net_bind_service","net_raw","sys_chroot","mknod","audit_write","setfcap"],"bounding":["chown","dac_override","fowner","fsetid","kill","setgid","setuid","setpcap","net_bind_service","net_raw","sys_chroot","mknod","audit_write","setfcap"],"ambient":null}, "cwd": "/usr/share/filebeat", "exe": "/usr/share/filebeat/filebeat", "name": "filebeat", "pid": 1, "ppid": 0, "seccomp": {"mode":"filter","no_new_privs":true}, "start_time": "2022-12-19T13:06:34.150Z"}}}
2022-12-19T13:06:35.195Z INFO instance/beat.go:280 Setup Beat: filebeat; Version: 6.7.1
2022-12-19T13:06:35.197Z INFO [publisher] pipeline/module.go:110 Beat name: filebeat-2gh9x
2022-12-19T13:06:35.197Z WARN [cfgwarn] beater/filebeat.go:89 DEPRECATED: config.prospectors are deprecated, Use `config.inputs` instead. Will be removed in version: 7.0.0
2022-12-19T13:06:35.198Z INFO instance/beat.go:402 filebeat start running.
2022-12-19T13:06:35.198Z INFO registrar/registrar.go:97 No registry file found under: /usr/share/filebeat/data/registry. Creating a new registry file.
2022-12-19T13:06:35.200Z INFO registrar/registrar.go:134 Loading registrar data from /usr/share/filebeat/data/registry
2022-12-19T13:06:35.200Z INFO registrar/registrar.go:141 States Loaded from registrar: 0
2022-12-19T13:06:35.200Z WARN beater/filebeat.go:367 Filebeat is unable to load the Ingest Node pipelines for the configured modules because the Elasticsearch output is not configured/enabled. If you have already loaded the Ingest Node pipelines or are using Logstash pipelines, you can ignore this warning.
2022-12-19T13:06:35.200Z INFO crawler/crawler.go:72 Loading Inputs: 0
2022-12-19T13:06:35.245Z INFO [monitoring] log/log.go:117 Starting metrics logging every 30s
2022-12-19T13:06:35.484Z INFO kubernetes/util.go:86 kubernetes: Using pod name filebeat-2gh9x and namespace kube-system to discover kubernetes node
2022-12-19T13:06:35.576Z INFO add_cloud_metadata/add_cloud_metadata.go:345 add_cloud_metadata: hosting provider type detected as ec2, metadata={"availability_zone":"ap-southeast-1a","instance_id":"i-01eae62cd2b63a734","machine_type":"t3.xlarge","provider":"ec2","region":"ap-southeast-1"}
2022-12-19T13:06:35.730Z INFO kubernetes/util.go:93 kubernetes: Using node ip-10-12-xxx.ap-southeast-1.compute.internal discovered by in cluster pod node query
2022-12-19T13:06:35.731Z INFO kubernetes/watcher.go:182 kubernetes: Performing a resource sync for *v1.PodList
2022-12-19T13:06:35.766Z INFO kubernetes/watcher.go:198 kubernetes: Resource sync done
2022-12-19T13:06:35.767Z INFO kubernetes/watcher.go:242 kubernetes: Watching API for resource events
2022-12-19T13:06:35.767Z INFO log/input.go:138 Configured paths: [/var/log/containers/*.log]
2022-12-19T13:06:35.767Z INFO cfgfile/reload.go:150 Config reloader started
2022-12-19T13:06:35.767Z INFO crawler/crawler.go:106 Loading and starting Inputs completed. Enabled inputs: 0
2022-12-19T13:06:35.768Z INFO cfgfile/reload.go:150 Config reloader started
2022-12-19T13:06:35.768Z INFO cfgfile/reload.go:205 Loading of config files completed.
2022-12-19T13:06:35.770Z INFO kubernetes/util.go:86 kubernetes: Using pod name filebeat-2gh9x and namespace kube-system to discover kubernetes node
2022-12-19T13:06:35.928Z INFO kubernetes/util.go:93 kubernetes: Using node ip-10-12-xxx.ap-southeast-1.compute.interna discovered by in cluster pod node query
2022-12-19T13:06:35.928Z INFO kubernetes/watcher.go:182 kubernetes: Performing a resource sync for *v1.PodList
2022-12-19T13:06:35.934Z INFO kubernetes/watcher.go:198 kubernetes: Resource sync done
2022-12-19T13:06:35.934Z INFO kubernetes/watcher.go:242 kubernetes: Watching API for resource events
2022-12-19T13:06:35.935Z INFO log/input.go:138 Configured paths: [/var/log/containers/*.log]
2022-12-19T13:06:35.935Z INFO input/input.go:114 Starting input of type: log; ID: 12715084902863065571
2022-12-19T13:06:35.935Z INFO cfgfile/reload.go:205 Loading of config files completed.

UPDATE
its selinux problem
any idea fix this instead of change the selinux to permissive ?

type=AVC msg=audit(1671531416.824:408337): avc:  denied  { read } for  pid=10185 comm="filebeat" name="containers" dev="dm-3" ino=524357 scontext=system_u:system_r:container_t:s0:c579,c853 tcontext=system_u:object_r:container_log_t:s0 tclass=dir permissive=0
type=SYSCALL msg=audit(1671531416.824:408337): arch=c000003e syscall=257 success=no exit=-13 a0=ffffffffffffff9c a1=c4202b3b20 a2=80000 a3=0 items=0 ppid=10123 pid=10185 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="filebeat" exe="/usr/share/filebeat/filebeat" subj=system_u:system_r:container_t:s0:c579,c853 key=(null)
type=PROCTITLE msg=audit(1671531416.824:408337): proctitle=66696C6562656174002D63002F6574632F66696C65626561742E796D6C002D65


问:
testing app not running -showing error in device manager
illegal char*> at index0:*.lock
above phrase is appearing  on my screen.

I tried running again and again but the above error is appearing again and again.


问:
How to mock react hooks while writing Unit testing (jest )?
I am writing some unit test cases which will test some functionality . So, basically it is giving me some error, while executing, saying "CANT ACCEPT NULL OR UNDEFINED IN USESTATE, USEEFFECT".
My question is, if i want to test just its functionality, and want to skip all the hooks, how can i do that? or any other suggetions , on how to deal with React hooks , with unit testing in jest will be helpful.</p>


问:
React-idle-timer session does expire if i leave screen
I am using react idle timer. My session only expires if screen is opened if I close that screen it does not expire after the given time. here is my Code</p>
```<code>const {getLastActiveTime } = useIdleTimer({
        timeout: 1000 * 60 * SESSION_IDEL_MINUTES,
        onIdle: handleOnIdle,
        debounce: 500,
    })
const handleOnIdle = (event ) => {
        console.log('user is idle', event)
        console.log('last active', getLastActiveTime())
        localStorage.removeItem("HotelCode");
        setIsLogin(false);
    }
</code>```

Body:
I am using react idle timer. My session only expires if screen is opened if I close that screen it does not expire after the given time. here is my Code

const {getLastActiveTime } = useIdleTimer({
        timeout: 1000 * 60 * SESSION_IDEL_MINUTES,
        onIdle: handleOnIdle,
        debounce: 500,
    })
const handleOnIdle = (event ) => {
        console.log('user is idle', event)
        console.log('last active', getLastActiveTime())
        localStorage.removeItem("HotelCode");
        setIsLogin(false);
    }