问:
How to allow user to select a date and get every record with the same date in each of their timestamps? (Firebase Realtime Database)
I'm trying to add a DatePicker for the user to choose a date from the calendar. Then, I'm using Firebase query equalTo(dateSelected.getTime()) to check whether the timestamps in every record match the selected date. If they match, they will be printed out in the recycler view.

Initially, when user enters this page, the app will display all the records on the recycler view. After user selects the date, by right the records must be shown according to what the user selects, but now it shows nothing. The pictures show how the page looks like and the data from Firebase. Thanks for reading this and helping out.

The error: As I select a date from the calendar, it went blank. There are no data printed out on the recycler view. In Logccat, there is an error W/System: A resource failed to call close. What does this mean?

```<code>public class DailyBreach extends AppCompatActivity implements DailyBreachRVAdapter.BreachClickInterface{
    private RecyclerView recyclerView;
    private FirebaseDatabase firebaseDatabase;
    private DatabaseReference databaseReference;
    private ArrayList<ppeBreachModel> ppeBreachModelArrayList;
    private DailyBreachRVAdapter dailyBreachRVAdapter;
    EditText dateInput;
    Button dateBtn, submitDate;
    Context context;
    Locale id = new Locale("en", "MY");
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMMM-yyyy", id);
    Calendar calendar = Calendar.getInstance();
    Date dateSelected;
    DatabaseReference database = FirebaseDatabase.getInstance().getReference();
    AlertDialog builderAlert;
    LayoutInflater layoutInflater;
    View showInput;
    Query query;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_daily_breach);

        dateInput = findViewById(R.id.dateInput);
        dateBtn = findViewById(R.id.dateBtn);
        submitDate = findViewById(R.id.submitDate);
        context = this;
        recyclerView = findViewById(R.id.recyclerView);
        firebaseDatabase = firebaseDatabase.getInstance();
        databaseReference = firebaseDatabase.getReference("PPEBreach");
        query = databaseReference.orderByChild("timestamp");
        ppeBreachModelArrayList = new ArrayList<>();
        dailyBreachRVAdapter = new DailyBreachRVAdapter(ppeBreachModelArrayList, this, this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(dailyBreachRVAdapter);

        getAllBreach();

        dateBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DatePickerDialog datePickerDialog = new DatePickerDialog(context, new DatePickerDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
                        calendar.set(year, month, dayOfMonth);
                        dateInput.setText(simpleDateFormat.format(calendar.getTime()));
                        dateSelected = calendar.getTime();

                        String input = dateInput.getText().toString();
                        if(input.isEmpty()) {
                            submitDate.setEnabled(false);
                        } else {
                            submitDate.setEnabled(true);
                        }
                    }
                }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
                datePickerDialog.show();
            }
        });

        submitDate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Query query = database.child("PPEBreach").orderByChild("timestamp").equalTo(dateSelected.getTime());
                query.addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override
                    public void onDataChange(@NonNull DataSnapshot snapshot) {
                        showLisener(snapshot);
                    }

                    @Override
                    public void onCancelled(@NonNull DatabaseError error) {

                    }
                });
            }
        });
    }

    private void showLisener(DataSnapshot snapshot) {
        ppeBreachModelArrayList.clear();
        for (DataSnapshot item : snapshot.getChildren()) {
            ppeBreachModel ppeBreachModel = item.getValue(ppeBreachModel.class);
            ppeBreachModelArrayList.add(ppeBreachModel);
        }
        dailyBreachRVAdapter = new DailyBreachRVAdapter(ppeBreachModelArrayList, this, this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(dailyBreachRVAdapter);
    }

    private void getAllBreach(){
        ppeBreachModelArrayList.clear();
        query.addChildEventListener(new ChildEventListener() {
            @Override
            public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
                ppeBreachModelArrayList.add(snapshot.getValue(ppeBreachModel.class));
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildRemoved(@NonNull DataSnapshot snapshot) {
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {

            }
        });
    }

    @Override
    public void onBreachClick(int position) {

    }
}
</code>```

Body:
I'm trying to add a DatePicker for the user to choose a date from the calendar. Then, I'm using Firebase query equalTo(dateSelected.getTime()) to check whether the timestamps in every record match the selected date. If they match, they will be printed out in the recycler view.

Initially, when user enters this page, the app will display all the records on the recycler view. After user selects the date, by right the records must be shown according to what the user selects, but now it shows nothing. The pictures show how the page looks like and the data from Firebase. Thanks for reading this and helping out.

The error: As I select a date from the calendar, it went blank. There are no data printed out on the recycler view. In Logccat, there is an error W/System: A resource failed to call close. What does this mean?

public class DailyBreach extends AppCompatActivity implements DailyBreachRVAdapter.BreachClickInterface{
    private RecyclerView recyclerView;
    private FirebaseDatabase firebaseDatabase;
    private DatabaseReference databaseReference;
    private ArrayList<ppeBreachModel> ppeBreachModelArrayList;
    private DailyBreachRVAdapter dailyBreachRVAdapter;
    EditText dateInput;
    Button dateBtn, submitDate;
    Context context;
    Locale id = new Locale("en", "MY");
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMMM-yyyy", id);
    Calendar calendar = Calendar.getInstance();
    Date dateSelected;
    DatabaseReference database = FirebaseDatabase.getInstance().getReference();
    AlertDialog builderAlert;
    LayoutInflater layoutInflater;
    View showInput;
    Query query;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_daily_breach);

        dateInput = findViewById(R.id.dateInput);
        dateBtn = findViewById(R.id.dateBtn);
        submitDate = findViewById(R.id.submitDate);
        context = this;
        recyclerView = findViewById(R.id.recyclerView);
        firebaseDatabase = firebaseDatabase.getInstance();
        databaseReference = firebaseDatabase.getReference("PPEBreach");
        query = databaseReference.orderByChild("timestamp");
        ppeBreachModelArrayList = new ArrayList<>();
        dailyBreachRVAdapter = new DailyBreachRVAdapter(ppeBreachModelArrayList, this, this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(dailyBreachRVAdapter);

        getAllBreach();

        dateBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DatePickerDialog datePickerDialog = new DatePickerDialog(context, new DatePickerDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
                        calendar.set(year, month, dayOfMonth);
                        dateInput.setText(simpleDateFormat.format(calendar.getTime()));
                        dateSelected = calendar.getTime();

                        String input = dateInput.getText().toString();
                        if(input.isEmpty()) {
                            submitDate.setEnabled(false);
                        } else {
                            submitDate.setEnabled(true);
                        }
                    }
                }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
                datePickerDialog.show();
            }
        });

        submitDate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Query query = database.child("PPEBreach").orderByChild("timestamp").equalTo(dateSelected.getTime());
                query.addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override
                    public void onDataChange(@NonNull DataSnapshot snapshot) {
                        showLisener(snapshot);
                    }

                    @Override
                    public void onCancelled(@NonNull DatabaseError error) {

                    }
                });
            }
        });
    }

    private void showLisener(DataSnapshot snapshot) {
        ppeBreachModelArrayList.clear();
        for (DataSnapshot item : snapshot.getChildren()) {
            ppeBreachModel ppeBreachModel = item.getValue(ppeBreachModel.class);
            ppeBreachModelArrayList.add(ppeBreachModel);
        }
        dailyBreachRVAdapter = new DailyBreachRVAdapter(ppeBreachModelArrayList, this, this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(dailyBreachRVAdapter);
    }

    private void getAllBreach(){
        ppeBreachModelArrayList.clear();
        query.addChildEventListener(new ChildEventListener() {
            @Override
            public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
                ppeBreachModelArrayList.add(snapshot.getValue(ppeBreachModel.class));
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildRemoved(@NonNull DataSnapshot snapshot) {
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
                dailyBreachRVAdapter.notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {

            }
        });
    }

    @Override
    public void onBreachClick(int position) {

    }
}


来源: stackexchange

问:
Is there a way to change the default AgGrid filter globally in angular project?
I want to know that is there a way to change the text filter of AgGrid globally?

I have recently moved to AgGrid Enterprise version and my default text filter was changed, i want to know that is there a way to change this text filter globally at once? because my angular application have 2000+ different grids.

Filter in community version:

Filter in Enterprise version (currently):

Note: I have asked same question on zendesk aggrid but if anyone has same issue and have resolved globally might want to pitch in then it will be helpful Thanks in advance!

ContentLicense: CC BY-SA 4.0


问:
The view web_vulnerability_scan.views.pdf didn't return an HttpResponse object. It returned None instead
Yesterday,when I try this function,it still working fine but today it suddenly shows this error,what is the problem?I could not post the complete coding,but I searched online,they said should be the if part problem,I have no idea how to fix it,someone please help,thank you!!!</p>
```<code>def pdf(request, target_id):

    # to check is the report scan_id already exist
    for i in req.json().get("reports"):
        id_list = i['source']['id_list']

        # if the report scan_id is in the report which mean already exist
        if str(id_list)[2:-2] == scan_id:

            # using fileresponse to let the user download the file
            file = open('report.pdf', 'rb')
            response = FileResponse(file)
            response['Content-Type'] = 'application/octet-stream'
            response['Content-Disposition'] = 'attachment;filename="Web_vulnerability_scan_report.pdf"'
            return response
        # if the scan_id not found in the report
        else:

            req = requests.get(url=api_url, headers=HEADERS, verify=False)
            pdf_download = req.json().get("reports")[0].get("download")[1]

            print("report", pdf_download)
            pdf_url = TAR_URL+pdf_download

            r = requests.get(url=pdf_url, headers=HEADERS, verify=False)
            with open("report.pdf", "wb") as code:
                code.write(r.content)
                code.close
            file = open('report.pdf', 'rb')
            response = FileResponse(file)
            response['Content-Type'] = 'application/octet-stream'
            response['Content-Disposition'] = 'attachment;filename="Web_vulnerability_scan_report.pdf"'
            return response
</code>```

Body:
Yesterday,when I try this function,it still working fine but today it suddenly shows this error,what is the problem?I could not post the complete coding,but I searched online,they said should be the if part problem,I have no idea how to fix it,someone please help,thank you!!!

def pdf(request, target_id):

    # to check is the report scan_id already exist
    for i in req.json().get("reports"):
        id_list = i['source']['id_list']

        # if the report scan_id is in the report which mean already exist
        if str(id_list)[2:-2] == scan_id:

            # using fileresponse to let the user download the file
            file = open('report.pdf', 'rb')
            response = FileResponse(file)
            response['Content-Type'] = 'application/octet-stream'
            response['Content-Disposition'] = 'attachment;filename="Web_vulnerability_scan_report.pdf"'
            return response
        # if the scan_id not found in the report
        else:

            req = requests.get(url=api_url, headers=HEADERS, verify=False)
            pdf_download = req.json().get("reports")[0].get("download")[1]

            print("report", pdf_download)
            pdf_url = TAR_URL+pdf_download

            r = requests.get(url=pdf_url, headers=HEADERS, verify=False)
            with open("report.pdf", "wb") as code:
                code.write(r.content)
                code.close
            file = open('report.pdf', 'rb')
            response = FileResponse(file)
            response['Content-Type'] = 'application/octet-stream'
            response['Content-Disposition'] = 'attachment;filename="Web_vulnerability_scan_report.pdf"'
            return response


问:
Read values from PBI report without embedding the report in Python
I am trying to read KPI values from a powerbi report using python.

I am using the powerbiclient package provided by Microsoft. Once I provide the groupid/reportid of my report, I create an instance of Power BI report and load it in Jupyter using the code below-

```<code>report = Report(group_id=group_id, report_id=report_id, auth=device_auth)
</code>```

Then I obtain the list of required visuals and export he KPI values using the code-

```<code>kpis=report.export_visual_data(report_page_id,visualization_id)
</code>```

This works well when I am embedding the report, but fails when I try to run it without embedding the code and just creating the PBI report instance.

```<code>    543 if not self._embedded:
--> 544     raise Exception(self.REPORT_NOT_EMBEDDED_MESSAGE)
    546 # Start getting pages on client side
    547 self._get_pages_request = True

Exception: Power BI report is not embedded
</code>```

Is there a way I can retrieve these values without embedding? I have looked at the PowerBI Rest APIs as well, but no luck yet.

Body:
I am trying to read KPI values from a powerbi report using python.

I am using the powerbiclient package provided by Microsoft. Once I provide the groupid/reportid of my report, I create an instance of Power BI report and load it in Jupyter using the code below-

report = Report(group_id=group_id, report_id=report_id, auth=device_auth)

Then I obtain the list of required visuals and export he KPI values using the code-

kpis=report.export_visual_data(report_page_id,visualization_id)

This works well when I am embedding the report, but fails when I try to run it without embedding the code and just creating the PBI report instance.

    543 if not self._embedded:
--> 544     raise Exception(self.REPORT_NOT_EMBEDDED_MESSAGE)
    546 # Start getting pages on client side
    547 self._get_pages_request = True

Exception: Power BI report is not embedded

Is there a way I can retrieve these values without embedding? I have looked at the PowerBI Rest APIs as well, but no luck yet.


问:
Run time Script for Apollo causes build to crash
I am running a script for building code at runtime for Apollo. I am encountering an error that causes the build to crash. It works fine if the For install builds only is checked. It throws an error that I am unable to see.

One thing to note is that my colleague is able to run this code on his machine fine. It is just not working for me

Any help will be appreciated

This is the script I am running

This is the error I am unable to see

It would help if at least I can see the error. The error is unclickable

Things I tried

Clean build and deleted derived data files

Re installed Xcode


问:
How to check and compare the first line in CSV file with the data in table in database using PHP
I have this one table named mapping. The mapping table is like this:

mapping table

what i want to do is, for the first line of uploaded csv, it will check compare the first line or the header and compare with the mapping table. If the name being used in the csv header is match with the name_csv column in the mapping table, then it will return the value of respective name_db_col.

```<code>if($_FILES['file']['name'] != '')
{
$file_array = explode(".", $_FILES['file']['name']);

$extension = end($file_array);

if($extension == 'csv') //Read the csv
{
$file_data = fopen($_FILES['file']['tmp_name'], 'r');

$file_header = fgetcsv($file_data);
}
}
</code>```

This is the snippet of the code to read the csv header. Really appreciate if you can help me, thanks!

Body:
I have this one table named mapping. The mapping table is like this:

mapping table

what i want to do is, for the first line of uploaded csv, it will check compare the first line or the header and compare with the mapping table. If the name being used in the csv header is match with the name_csv column in the mapping table, then it will return the value of respective name_db_col.

if($_FILES['file']['name'] != '')
{
$file_array = explode(".", $_FILES['file']['name']);

$extension = end($file_array);

if($extension == 'csv') //Read the csv
{
$file_data = fopen($_FILES['file']['tmp_name'], 'r');

$file_header = fgetcsv($file_data);
}
}

This is the snippet of the code to read the csv header. Really appreciate if you can help me, thanks!


问:
socket fail in watchos platform
I try to new a socket in watchos platform, and it always failure, the same code run in ios platform,and success,what's wrong? here are some code:

```<code>#import <sys/socket.h>
#import <netinet/in.h>
#import <arpa/inet.h>

int clientsocket = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in serverAddr;
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("192.168.124.52");
serverAddr.sin_port = htons(45678);
int connectResult = connect(clientsocket, (const struct sockaddr *)&serverAddr,sizeof(serverAddr));
NSLog(@"connect res : %d",connectResult);
</code>```

next I try $nc -lk 45678 in terminal,the connectResult always return -1, and the same code run in ios platform it's ok.

Title: socket fail in watchos platform

Body:
I try to new a socket in watchos platform, and it always failure, the same code run in ios platform,and success,what's wrong? here are some code:

#import <sys/socket.h>
#import <netinet/in.h>
#import <arpa/inet.h>

int clientsocket = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in serverAddr;
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("192.168.124.52");
serverAddr.sin_port = htons(45678);
int connectResult = connect(clientsocket, (const struct sockaddr *)&serverAddr,sizeof(serverAddr));
NSLog(@"connect res : %d",connectResult);

next I try $nc -lk 45678 in terminal,the connectResult always return -1, and the same code run in ios platform it's ok.


问:
websocket connection from polyfills is making an insecure connection and forcing a TLS upgrade
I found a bug in my Angular 14 upgrade that gets into an infinite redirect loop when logging in, Looks like a websocket connection from polyfills is making an insecure connection and forcing a TLS upgrade.

When I try to start the Angular 14 project directly, I'm always getting the infinite loop and showing "We couldn't sign you in. Please try again. When I run Angular 10 project UI is working fine, and when I try to run Angular 14 project it works correctly in the browser where the Angular 10 project's browser opened, but if I switch browser the same problem occurs again. Is there any fix for this!.I have shared the HAR file which I'm experiencing.


问:
Ionic Framework Vanilla JS Tabs and Content Issue
I have decided to include a tab menu into the application, but I’m having a problem with the content positioning, page pushing transitions and or the whole page content being scrollable with my attempt to fix it.

Current structure with my attempted fix:

index.html:

```<code>    <html lang="en">
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">

            <script type="module" src="node_modules/@ionic/core/dist/ionic/ionic.esm.js"></script>
            <script nomodule src="node_modules/@ionic/core/dist/ionic/ionic.js"></script>
            <link rel="stylesheet" href="node_modules/@ionic/core/css/ionic.bundle.css" />
        </head>

        <body>
            <ion-app>
                <ion-nav root="page-app"></ion-nav>
            </ion-app>

            <script type="module" src="index.js"></script>
        </body>
    </html>
</code>```

index.js:

```<code>    import AppComponent from './path/app.js';
    import HomeComponent from './path/home.js';
    import TestComponent from './path/test.js';

    customElements.define('page-app', AppComponent);
    customElements.define('page-home', HomeComponent);
    customElements.define('page-test', TestComponent);
</code>```

app.js:

```<code>    export default class AppComponent extends HTMLElement {
        async connectedCallback() {
            // Fetching the HTML and setting it here (app.html)
        }
    }
</code>```

app.html:

```<code>    <ion-header>
        <ion-toolbar color="primary">
            <ion-title slot="start">
                Test
            </ion-title>

            <ion-buttons slot="end">
                <ion-nav-link router-direction="forward" component="page-test">
                    <ion-button>
                        Test
                    </ion-button>
                </ion-nav-link>
            </ion-buttons>
        </ion-toolbar>
    </ion-header>

    <ion-content>
        <ion-tabs>
            <ion-tab tab="tab-home" component="page-home"></ion-tab>
            <ion-tab tab="tab-search"></ion-tab>

            <ion-tab-bar slot="bottom">
                <ion-tab-button tab="tab-home">
                    <ion-icon name="home"></ion-icon>
                </ion-tab-button>

                <ion-tab-button tab="tab-search">
                    <ion-icon name="search"></ion-icon>
                </ion-tab-button>
            </ion-tab-bar>
        </ion-tabs>
    </ion-content>
</code>```

home.js:

```<code>    export default class HomeComponent extends HTMLElement {
        async connectedCallback() {
            // Fetching the HTML and setting it here (home.html)
        }
    }
</code>```

home.html:

```<code>    <ion-content>
        <h1>Hello World</h1>
    </ion-content>
</code>```

test.js:

```<code>    export default class TestComponent extends HTMLElement {
        async connectedCallback() {
            // Fetching the HTML and setting it here
        }
    }
</code>```

This works as expected, but I get this annoying scroller for both the content and tabs menu visiting the app’s root and the home’s content isn’t being doing the pushing transition when a new page is pushed. Which is also over another scroller, which is for the home view content (but that is fine, because I want the home tab to be scrollable. In fact, I can scroll the page a pixel or two if I focus on the tabs menu.

I have tried removing the ion-content tag around the ion-tabs tag that is in home.html -
Result: The main header perfectly push transitions as the test page comes in, but the content of the home tab doesn’t do the transition pushing effect. Also, the home tab’s content goes behind the shared ion-toolbar header in the home.html.
Screenshot Example:

Moving the ion-header in the shared app root to home.html (Which I really don’t want to do as I want the search tab to also share the same toolbar in the future -
Result: Weird page pushing transition as the test page is coming in, where I can see the header background color also fading in, instead of the text only - doesn’t look that smooth.

Tried looking everywhere, but was not able to find a fix. From the documentation to any available page discussing it on the web, nothing.

Would really appreciate any assistance!

Body:
I have decided to include a tab menu into the application, but I’m having a problem with the content positioning, page pushing transitions and or the whole page content being scrollable with my attempt to fix it.

Current structure with my attempted fix:

index.html:

            <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">

            <link rel="stylesheet" href="node_modules/@ionic/core/css/ionic.bundle.css" />

            <ion-app>
                <ion-nav root="page-app"></ion-nav>
            </ion-app>

index.js:

    import AppComponent from './path/app.js';
    import HomeComponent from './path/home.js';
    import TestComponent from './path/test.js';

    customElements.define('page-app', AppComponent);
    customElements.define('page-home', HomeComponent);
    customElements.define('page-test', TestComponent);

app.js:

    export default class AppComponent extends HTMLElement {
        async connectedCallback() {
            // Fetching the HTML and setting it here (app.html)
        }
    }

app.html:

    <ion-header>
        <ion-toolbar color="primary">
            <ion-title slot="start">
                Test
            </ion-title>

            <ion-buttons slot="end">
                <ion-nav-link router-direction="forward" component="page-test">
                    <ion-button>
                        Test
                    </ion-button>
                </ion-nav-link>
            </ion-buttons>
        </ion-toolbar>
    </ion-header>

    <ion-content>
        <ion-tabs>
            <ion-tab tab="tab-home" component="page-home"></ion-tab>
            <ion-tab tab="tab-search"></ion-tab>

            <ion-tab-bar slot="bottom">
                <ion-tab-button tab="tab-home">
                    <ion-icon name="home"></ion-icon>
                </ion-tab-button>

                <ion-tab-button tab="tab-search">
                    <ion-icon name="search"></ion-icon>
                </ion-tab-button>
            </ion-tab-bar>
        </ion-tabs>
    </ion-content>

home.js:

    export default class HomeComponent extends HTMLElement {
        async connectedCallback() {
            // Fetching the HTML and setting it here (home.html)
        }
    }

home.html:

    <ion-content>

Hello World

    </ion-content>

test.js:

    export default class TestComponent extends HTMLElement {
        async connectedCallback() {
            // Fetching the HTML and setting it here
        }
    }

This works as expected, but I get this annoying scroller for both the content and tabs menu visiting the app’s root and the home’s content isn’t being doing the pushing transition when a new page is pushed. Which is also over another scroller, which is for the home view content (but that is fine, because I want the home tab to be scrollable. In fact, I can scroll the page a pixel or two if I focus on the tabs menu.

I have tried removing the ion-content tag around the ion-tabs tag that is in home.html -
Result: The main header perfectly push transitions as the test page comes in, but the content of the home tab doesn’t do the transition pushing effect. Also, the home tab’s content goes behind the shared ion-toolbar header in the home.html.
Screenshot Example:

Moving the ion-header in the shared app root to home.html (Which I really don’t want to do as I want the search tab to also share the same toolbar in the future -
Result: Weird page pushing transition as the test page is coming in, where I can see the header background color also fading in, instead of the text only - doesn’t look that smooth.

Tried looking everywhere, but was not able to find a fix. From the documentation to any available page discussing it on the web, nothing.

Would really appreciate any assistance!


问:
logstash output to apache druid db
I need to send data logstash to apache druid db. Can anyone please provide example pipeline.conf or output example for pipeline. I'm new for apache druid db.

I don't know about output section for druid db in logstash.

Title: logstash output to apache druid db


问:
Access and run QuickFixes for VSCode diagnostics through API
I'm working on a VS Code extension that needs to be able to access the diagnostics in the file its running on and execute the suggested QuickFixes. The response object for the diagnostic [![Diagnostic object structure][1]][1] however doesn't have the Quick Fixes available for access. I have tried all of the following to try to access the QuickFix suggestions

const codeActions = vscode.codeAction.getCodeActions(diagnostic);

vscode.languages.getCodeActions

```<code>
 vscode.workspace.applyEdit(quickFix.edit).then(success => {
     if (success) {
       console.log("Applied quick fix: ${quickFix.title}");
     } else {
       console.error("Failed to apply quick fix: ${quickFix.title}");
     }
     for (const quickFix of quickFixes) {
   vscode.workspace.applyEdit(quickFix.edit).then(success => {
     if (success) {
       console.log("Applied quick fix: ${quickFix.title}");
     } else {
       console.error("Failed to apply quick fix: ${quickFix.title}");
     }
   });
 }

</code>```

```<code>
However it looks like each of these functions might now be deprecated.  What is the suggested way to access the QuickFixes and run them through API calls from a VS Code Extension?

  [1]: https://i.stack.imgur.com/p0tQe.png
</code>```

Body:
I'm working on a VS Code extension that needs to be able to access the diagnostics in the file its running on and execute the suggested QuickFixes. The response object for the diagnostic [![Diagnostic object structure][1]][1] however doesn't have the Quick Fixes available for access. I have tried all of the following to try to access the QuickFix suggestions

const codeActions = vscode.codeAction.getCodeActions(diagnostic);

vscode.languages.getCodeActions

 vscode.workspace.applyEdit(quickFix.edit).then(success => {
     if (success) {
       console.log("Applied quick fix: ${quickFix.title}");
     } else {
       console.error("Failed to apply quick fix: ${quickFix.title}");
     }
     for (const quickFix of quickFixes) {
   vscode.workspace.applyEdit(quickFix.edit).then(success => {
     if (success) {
       console.log("Applied quick fix: ${quickFix.title}");
     } else {
       console.error("Failed to apply quick fix: ${quickFix.title}");
     }
   });
 }

However it looks like each of these functions might now be deprecated.  What is the suggested way to access the QuickFixes and run them through API calls from a VS Code Extension?

  [1]: https://i.stack.imgur.com/p0tQe.png


问:
String Index Out Of Bounds Exception When Initializing Spark Context
Java Version : 1.8.0_351Hadoop: 2.7Spark 2.4.0Code :

```<code>import org.apache.spark.sql.SparkSession

object TestFile {

  def main(args: Array[String]) {

    val spark = SparkSession
        .builder
        .master("local[*]")
        .appName("Testfile")
        .getOrCreate()

    println(spark.sparkContext.version)

    spark.stop()
  }
}

</code>```

Using Spark's default log4j profile:

org/apache/spark/log4j-defaults.properties23/01/04         12:34:19
INFO SparkContext: Running Spark version 2.4.023/01/04 12:34:19 WARN
NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicableException in
thread "main" java.lang.ExceptionInInitializerErrorat
org.apache.hadoop.util.StringUtils.(StringUtils.java:79)at
org.apache.hadoop.security.Groups.parseStaticMapping(Groups.java:116)at
org.apache.hadoop.security.Groups.(Groups.java:93)at
org.apache.hadoop.security.Groups.(Groups.java:73)at
org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:293)at
org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:283)at
org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:260)at
org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(UserGroupInformation.java:789)at
org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:774)at
org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:647)at
org.apache.spark.util.Utils$$anonfun$getCurrentUserName$1.apply(Utils.scala:2422)at
org.apache.spark.util.Utils$$anonfun$getCurrentUserName$1.apply(Utils.scala:2422)at
scala.Option.getOrElse(Option.scala:121)at
org.apache.spark.util.Utils$.getCurrentUserName(Utils.scala:2422)at
org.apache.spark.SparkContext.(SparkContext.scala:293)at
org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2520)at
org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:935)at
org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:926)at
scala.Option.getOrElse(Option.scala:121)at
org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:926)at
TestFile$.main(TestFile.scala:12)at
TestFile.main(TestFile.scala)Caused by:
java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds
for length 2at
java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)at
java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)at
java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)at
java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)at
java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)at
java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)at
java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)at
java.base/java.lang.String.checkBoundsBeginEnd(String.java:4589)at
java.base/java.lang.String.substring(String.java:2703)at
org.apache.hadoop.util.Shell.(Shell.java:50)... 22 more

```<code>Process finished with exit code 1
</code>```

I unistall spark and again install tried . checked version as well of Java which is java 1.8
Spark Version 2.4.0
Hadoop: 2.7
Java 1.8 - java version "1.8.0_351"

Body:
Java Version : 1.8.0_351Hadoop: 2.7Spark 2.4.0Code :

import org.apache.spark.sql.SparkSession

object TestFile {

  def main(args: Array[String]) {

    val spark = SparkSession
        .builder
        .master("local[*]")
        .appName("Testfile")
        .getOrCreate()

    println(spark.sparkContext.version)

    spark.stop()
  }
}

Using Spark's default log4j profile:

org/apache/spark/log4j-defaults.properties23/01/04         12:34:19
INFO SparkContext: Running Spark version 2.4.023/01/04 12:34:19 WARN
NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicableException in
thread "main" java.lang.ExceptionInInitializerErrorat
org.apache.hadoop.util.StringUtils.(StringUtils.java:79)at
org.apache.hadoop.security.Groups.parseStaticMapping(Groups.java:116)at
org.apache.hadoop.security.Groups.(Groups.java:93)at
org.apache.hadoop.security.Groups.(Groups.java:73)at
org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:293)at
org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:283)at
org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:260)at
org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(UserGroupInformation.java:789)at
org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:774)at
org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:647)at
org.apache.spark.util.Utils$$anonfun$getCurrentUserName$1.apply(Utils.scala:2422)at
org.apache.spark.util.Utils$$anonfun$getCurrentUserName$1.apply(Utils.scala:2422)at
scala.Option.getOrElse(Option.scala:121)at
org.apache.spark.util.Utils$.getCurrentUserName(Utils.scala:2422)at
org.apache.spark.SparkContext.(SparkContext.scala:293)at
org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2520)at
org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:935)at
org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:926)at
scala.Option.getOrElse(Option.scala:121)at
org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:926)at
TestFile$.main(TestFile.scala:12)at
TestFile.main(TestFile.scala)Caused by:
java.lang.StringIndexOutOfBoundsException: Range [0, 3) out of bounds
for length 2at
java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)at
java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)at
java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)at
java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)at
java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)at
java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)at
java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)at
java.base/java.lang.String.checkBoundsBeginEnd(String.java:4589)at
java.base/java.lang.String.substring(String.java:2703)at
org.apache.hadoop.util.Shell.(Shell.java:50)... 22 more

Process finished with exit code 1

I unistall spark and again install tried . checked version as well of Java which is java 1.8
Spark Version 2.4.0
Hadoop: 2.7
Java 1.8 - java version "1.8.0_351"


问:
Differentiate java versions in Renovate
I would like to differentiate multiple Java versions in Renovate. The problem is, let's say the Tags which I'm getting are all under https://www.gitlab.com/binaries.
They look like this:

22.11.0-java17-1

23.2.0-java8-1

23.2.0-java11-1

Now when I want to upgrade Java 11 dependency in my file I have to differentiate that so that java11 doesn't get updated to java17 because it shouldn't and I don't know how to specify that.
I tried to use this PackageRule:

"packageRules": [
    {
      "descripton": "dependencys via gitlab Tags",
      "matchDatasources": [
        "gitlab-tags"
      ],
      "registryUrls": ["https://gitlab.com"],
      "matchPackagePrefixes": ["/binaries"],
      "extractVersion": "^(v)?(?<version>.*)$",
      "versioning": "regex:^(?<major>\\d+)\\.(?<minor>.*)-java\\d+?(-\\d)"
    }
  ],
```
<p>and using this regex Manager to diffrentiate</p>
<pre class="lang-json prettyprint-override"><code>  "regexManagers": [
    {
      "fileMatch": [
        ".*cfg-"
      ],
      "matchStrings": [
        "PF_APLAT_JAVA8:?[\\s\\S](?<currentValue>\\d+\\.\\d.\\d+-java8(-\\d+)?)"
      ],
      "datasourceTemplate": "gitlab-tags",
      "depNameTemplate": "/binaries"
    },
    {
      "fileMatch": [
        ".*cfg-"
      ],
      "matchStrings": [
        "PF_APLAT_JAVA11:?[\\s\\S](?<currentValue>\\d+\\.\\d.\\d+-java11(-\\d+)?)"
      ],
      "datasourceTemplate": "gitlab-tags",
      "depNameTemplate": "/binaries"
    }
  ]
</code>```

Title: Differentiate java versions in Renovate

Body:
I would like to differentiate multiple Java versions in Renovate. The problem is, let's say the Tags which I'm getting are all under https://www.gitlab.com/binaries.
They look like this:

22.11.0-java17-1

23.2.0-java8-1

23.2.0-java11-1

Now when I want to upgrade Java 11 dependency in my file I have to differentiate that so that java11 doesn't get updated to java17 because it shouldn't and I don't know how to specify that.
I tried to use this PackageRule:

"packageRules": [
    {
      "descripton": "dependencys via gitlab Tags",
      "matchDatasources": [
        "gitlab-tags"
      ],
      "registryUrls": ["https://gitlab.com"],
      "matchPackagePrefixes": ["/binaries"],
      "extractVersion": "^(v)?(?<version>.*)$",
      "versioning": "regex:^(?<major>\\d+)\\.(?<minor>.*)-java\\d+?(-\\d)"
    }
  ],

and using this regex Manager to diffrentiate

  "regexManagers": [
    {
      "fileMatch": [
        ".*cfg-"
      ],
      "matchStrings": [
        "PF_APLAT_JAVA8:?[\\s\\S](?<currentValue>\\d+\\.\\d.\\d+-java8(-\\d+)?)"
      ],
      "datasourceTemplate": "gitlab-tags",
      "depNameTemplate": "/binaries"
    },
    {
      "fileMatch": [
        ".*cfg-"
      ],
      "matchStrings": [
        "PF_APLAT_JAVA11:?[\\s\\S](?<currentValue>\\d+\\.\\d.\\d+-java11(-\\d+)?)"
      ],
      "datasourceTemplate": "gitlab-tags",
      "depNameTemplate": "/binaries"
    }
  ]


问:
Zoom in/out and navigation buttons PowerBI
I am developing my own custom visual in PowerBI with R and Typescript and I would like to add zoom in/out and navigation buttons like in the following visual. Where I can find resources on how to add these buttons to my custom visual?


问:
Bootstrap CSS issue while migration from Angular 12 to 13
We have done the migration of our project from Angular 12 to 13. Post-migration, the application works fine on our local environment but after deploying on the dev server, bootstrap CSS is breaking.

From Angular13 onwards, the key "extractCss" is removed from angular.json file, perhaps this is the reason application is not able to detect the bootstrap library on the dev server.

Solutions tried:

We moved the bootstrap path from main.scss file to app.component.scss file
We tried to give the bootstrap CDN path in our index.html file.
Both approaches are not working for us.


问:
C initialization of variable in Linux kernel using jiffies
This is a C question with a Linux kernel module program behind. I want to calculate the elapsed time but also to understand macros, variables and compilation in C.

I have a kernel loadable module that creates a proc file called /proc/seconds and every time it is read, prints the elapsed time since the loading of the kernel module.

This is the full code

```<code>#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <asm/param.h>
#include <linux/jiffies.h>

#define BUFFER_SIZE 128
#define PROC_TIME_NAME "seconds"
#define START_JIFFIES jiffies

ssize_t proc_read_seconds(struct file *file, char __user *usr_buf, size_t count, loff_t *pos);

static struct proc_ops proc_ops_seconds= {
    .proc_read = proc_read_seconds,
};

/* This function is called when the module is loaded */
int simple_init(void){
    printk(KERN_INFO "Loading My Proc Module.\n");
    proc_create(PROC_TIME_NAME, 0666, NULL, &proc_ops_seconds);
    return 0;
}

/* This function is called when the module is removed */

void simple_exit(void){
    printk(KERN_INFO "Removing My Proc Module. \n");
    remove_proc_entry(PROC_TIME_NAME, NULL);
}

/* This function is called each time /proc/seconds is read */

ssize_t proc_read_seconds(struct file *file, char __user *usr_buf, size_t count, loff_t *pos){
    int rv = 0;
    char buffer[BUFFER_SIZE];
    static int completed = 0;
    unsigned long elapsed = ((jiffies-START_JIFFIES)/HZ);

    if (completed){
        completed = 0;
        return 0;
    }

    completed = 1;
    rv = sprintf(buffer, "Hello World. Seconds since this kernel was loaded:  %lu \n", elapsed);

    /* copies kernel space buffer to user space usr_buf */

    if (copy_to_user(usr_buf, buffer, rv)) {
        printk(KERN_ERR "Error copying data to user space\n");
        return -EFAULT;
    }
    else return rv;
}

module_init(simple_init);
module_exit(simple_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple Module");
MODULE_AUTHOR("SGG");
</code>```

It works, but not as intended. Elapsed time is 0 every time.

I do

```<code>#define START_TIME jiffies
</code>```

For what I understand (please correct me if I'm wrong), START_TIME is a macro that then 'expands' to the real jiffies value in compile time. So what that would mean is that in compile time, the real code that would be used instead of

```<code>unsigned long elapsedTime = (jiffies-START_TIME)/HZ;
</code>```

is actually

```<code>unsigned long elapsedTime = (jiffies-jiffies)/HZ;
</code>```

You can see that 'elapsedTime' is 0 every time.

I have also tried using a simple variable (first solution that came to mind)

```<code>unsigned long START_JIFFIES = jiffies;
</code>```

But there's an error with that, because apparently, you cannot initialize a variable with a non-constant element there.

```<code>/home/mauro/Documents/myprocmodule/myprocmodule.c:12:31: error: initializer element is not constant

12 | unsigned long START_JIFFIES = jiffies;

</code>```

Then I solved it by separating declaration from initialization and moving the initialization to the function int simple_init(void), like this

```<code>#include <linux/init.h>
...
#define PROC_TIME_NAME "seconds"
unsigned long START_JIFFIES;

ssize_t proc_read_seconds(struct file *file, char __user *usr_buf, size_t count, loff_t *pos);

static struct proc_ops proc_ops_seconds= {
    ...
};

/* This function is called when the module is loaded */
int simple_init(void){
    START_JIFFIES = jiffies;
    ...
}
</code>```

And now it works perfectly, but I don't know why.
So the question is: what mechanisms does C provide to move this kind of value across time? Should I use a macro or a variable?

And most importantly, why did it solve separating declaration from initialization in a function?

Thank you in advance.

Body:
This is a C question with a Linux kernel module program behind. I want to calculate the elapsed time but also to understand macros, variables and compilation in C.

I have a kernel loadable module that creates a proc file called /proc/seconds and every time it is read, prints the elapsed time since the loading of the kernel module.

This is the full code

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <asm/param.h>
#include <linux/jiffies.h>

#define BUFFER_SIZE 128
#define PROC_TIME_NAME "seconds"
#define START_JIFFIES jiffies

ssize_t proc_read_seconds(struct file *file, char __user *usr_buf, size_t count, loff_t *pos);

static struct proc_ops proc_ops_seconds= {
    .proc_read = proc_read_seconds,
};

/* This function is called when the module is loaded */
int simple_init(void){
    printk(KERN_INFO "Loading My Proc Module.\n");
    proc_create(PROC_TIME_NAME, 0666, NULL, &proc_ops_seconds);
    return 0;
}

/* This function is called when the module is removed */

void simple_exit(void){
    printk(KERN_INFO "Removing My Proc Module. \n");
    remove_proc_entry(PROC_TIME_NAME, NULL);
}

/* This function is called each time /proc/seconds is read */

ssize_t proc_read_seconds(struct file *file, char __user *usr_buf, size_t count, loff_t *pos){
    int rv = 0;
    char buffer[BUFFER_SIZE];
    static int completed = 0;
    unsigned long elapsed = ((jiffies-START_JIFFIES)/HZ);

    if (completed){
        completed = 0;
        return 0;
    }

    completed = 1;
    rv = sprintf(buffer, "Hello World. Seconds since this kernel was loaded:  %lu \n", elapsed);

    /* copies kernel space buffer to user space usr_buf */

    if (copy_to_user(usr_buf, buffer, rv)) {
        printk(KERN_ERR "Error copying data to user space\n");
        return -EFAULT;
    }
    else return rv;
}

module_init(simple_init);
module_exit(simple_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple Module");
MODULE_AUTHOR("SGG");

It works, but not as intended. Elapsed time is 0 every time.

I do

#define START_TIME jiffies

For what I understand (please correct me if I'm wrong), START_TIME is a macro that then 'expands' to the real jiffies value in compile time. So what that would mean is that in compile time, the real code that would be used instead of

unsigned long elapsedTime = (jiffies-START_TIME)/HZ;

is actually

unsigned long elapsedTime = (jiffies-jiffies)/HZ;

You can see that 'elapsedTime' is 0 every time.

I have also tried using a simple variable (first solution that came to mind)

unsigned long START_JIFFIES = jiffies;

But there's an error with that, because apparently, you cannot initialize a variable with a non-constant element there.

/home/mauro/Documents/myprocmodule/myprocmodule.c:12:31: error: initializer element is not constant

12 | unsigned long START_JIFFIES = jiffies;

Then I solved it by separating declaration from initialization and moving the initialization to the function int simple_init(void), like this

#include <linux/init.h>
...
#define PROC_TIME_NAME "seconds"
unsigned long START_JIFFIES;

ssize_t proc_read_seconds(struct file *file, char __user *usr_buf, size_t count, loff_t *pos);

static struct proc_ops proc_ops_seconds= {
    ...
};

/* This function is called when the module is loaded */
int simple_init(void){
    START_JIFFIES = jiffies;
    ...
}

And now it works perfectly, but I don't know why.
So the question is: what mechanisms does C provide to move this kind of value across time? Should I use a macro or a variable?

And most importantly, why did it solve separating declaration from initialization in a function?

Thank you in advance.


问:
Could not update WPF app version without restart window
My program is a WPF app which is installed into  Program Files (x86) folder, in this app I have a method called every 30 minutes to compared version of current app and version of .msi file in local folder. If version of .msi file is the lastest, app will run this .msi file to update version using the below code:

```<code> Process installerProcess = new Process();
 ProcessStartInfo processInfo = new ProcessStartInfo();
 processInfo.FileName = "msiexec";
 processInfo.Arguments = $@"/i  {msiFilePath}  /q";
 processInfo.Verb = "runas";
 installerProcess.StartInfo = processInfo;
 installerProcess.Start();
 installerProcess.WaitForExit();
</code>```

After updating I want to restart this app by using this code:

```<code> Process.Start(Process.GetCurrentProcess().MainModule.FileName);
 Environment.Exit(0);
</code>```

It is my problem from now: After updating version, my windows also restart and app doesn't auto launch when restarting finished

What I tried: I add log after called installerProcess.WaitForExit(); to notify app is updated successfully but in the log file I don't see any message. It's seem to windows restart before log is wrote.

What I want: my app can update the lastest version if exists and auto launch after update

Could anyone help me this problem?

Body:
My program is a WPF app which is installed into  Program Files (x86) folder, in this app I have a method called every 30 minutes to compared version of current app and version of .msi file in local folder. If version of .msi file is the lastest, app will run this .msi file to update version using the below code:

 Process installerProcess = new Process();
 ProcessStartInfo processInfo = new ProcessStartInfo();
 processInfo.FileName = "msiexec";
 processInfo.Arguments = $@"/i  {msiFilePath}  /q";
 processInfo.Verb = "runas";
 installerProcess.StartInfo = processInfo;
 installerProcess.Start();
 installerProcess.WaitForExit();

After updating I want to restart this app by using this code:

 Process.Start(Process.GetCurrentProcess().MainModule.FileName);
 Environment.Exit(0);

It is my problem from now: After updating version, my windows also restart and app doesn't auto launch when restarting finished

What I tried: I add log after called installerProcess.WaitForExit(); to notify app is updated successfully but in the log file I don't see any message. It's seem to windows restart before log is wrote.

What I want: my app can update the lastest version if exists and auto launch after update

Could anyone help me this problem?


问:
Pi Unable to locate libncurses or libncurses
I attempted to include ncurses in my code and got this error:
fatal error: ncurses.h: No such file or directory
1 | #include <ncurses.h>
I wanted to install the ncurses library to my raspbian OS and the following messages were returned:
Unable to locate package libcurses-dev
Unable to locate package libcurses5-dev

The instructions I used were from:
How to apt-get install libncurses5-dev

and following debian instruction:

https://ostechnix.com/how-to-install-ncurses-library-in-linux/


问:
Is feature importance in DT the same as SHAP values in Black-box ML?
The question is in the header.

As i understand it, SHAP values can not be used for casual inference since a SHAP value tells us how much a given model feature has contributed to a prediction - not the target variable.

Shap is not a measure of “how important a given feature is in the real world”, it is simply “how important a feature is to the model”. — Gianlucca Zuin

My question:
Is the “feature importance” in decision trees the equivalent to the SHAP values in black-box models?
I.e. do feature importance in DT suffer from the same issues as SHAP values? Or are they more reliable?

And if not, What are the issues really with black-box models, if white box models (like DT) suffer from the same issues?


问:
ERROR NG0900: Error trying to diff '[object Object]'. Only arrays and iterables are allowed , *ngFor
I've been trying to follow some similar questions and their solutions on the forum but can't figure out how to iterate my Object or assign it to the type properly for the view and fill the instance of the object type.

I'm able to see the correct object I want in the console log, but I can't iterate over it to populate the view. I tried keyvalue, however, I got stuck with the view just iterating over the whole object using {{item.key}}:{{item.value}}, I needed the data to match the model. I don't need the whole API response JSON object, just 'specific' property:values.

What I am not understanding? or What am I not doing? I've read the rxjs map information and angular.io keyvalue docs. Is it a typescript misunderstanding? Thanks in advance for your insight!

Component

```<code>export class ArtifactCardComponent implements OnInit {
  allArtifacts: Artifact[] = []; // Is this a class object type to array?
  isFetching: boolean = false;

  constructor(private artifactService: ArtifactService) {}

  ngOnInit() {
    this.artifactService.getArtifacts().pipe(
      map((data) => {
        return data['data'] ;
      }
    ))
    .subscribe(
      (data) => {
        this.isFetching = true;
        this.allArtifacts = data
        console.log(artifacts);
        this.isFetching = false;
      },
      (error) => {
        this.errorMessage = error.message;
      }
    );
  }
}
</code>```

Model:

```<code>export class Artifact {
  id?: string;
  title: string;
  date_start: number;
  date_end: number;
  artist_display: string;
  main_reference_number: number;
  place_of_origin: string;
  medium_display: string;
  inscriptions: string;
  dimensions: number;
  credit_line: string;
  department_title: string;
}
</code>```

Service:

```<code>public getArtifacts() {
 // return this.http.get<Artifact[]>(this.baseURL) : Observable<Artifact[]
 return this.http.get(this.baseURL,  { responseType: 'json' })
}
</code>```

View:

```<code><div>
 <ul class="list-group list-group-flush d-flex align-items-start"
*ngFor="let artifact of allArtifacts"  >
<li class="list-group-item  border-bottom-0">{{artifact.title}}<span></span></li>
...

</ul>
</div>
</code>```

response

```<code>   {
    "id": 120081,
    "api_model": "artworks",
    "api_link": "https://api.artic.edu/api/v1/artworks/120081",
    "is_boosted": false,
    "title": "Landscape with Dog",
    "alt_titles": null,
    "thumbnail": {
        "lqip": ...,
        "width": 2721,
        "height": 2250,
        "alt_text": "A work made of oil on composition board."
    },
    "main_reference_number": "1990.485",
    "has_not_been_viewed_much": false,
    "boost_rank": null,
    "date_start": 1832,
    "date_end": 1832,
    "date_display": "1832",
    "date_qualifier_title": "",
    "date_qualifier_id": null,
    "artist_display": "Thomas Doughty\nAmerican, 1793–1856",
    "place_of_origin": "United States",
    "dimensions": "24.8 × 29.2 cm (9 3/4 × 11 1/2 in.)",
    "medium_display": "Oil on composition board",
    "inscriptions": "signed l.r.: \"TD/1832\"",
    "credit_line": "Through prior acquisition of the Charles H. and Mary F. S. Worcester Collection",
    "catalogue_display": null,
    "publication_history": "Alexander Gallery (advertisement) in Magazine Antiques, 88, 5 (November 1990) p. 860 (ill.).",
    "exhibition_history": null,
    "provenance_text": null,
    "publishing_verification_level": "Web Cataloged",
    "internal_department_id": 21,
    "fiscal_year": 1991,
    "fiscal_year_deaccession": null,
    "is_public_domain": true,
    "is_zoomable": true,
    "max_zoom_window_size": -1,
    "copyright_notice": null,
    "has_multimedia_resources": false,
    "has_educational_resources": false,
    "has_advanced_imaging": false,
    "colorfulness": 29.5929,
    "color": {
   ...
    },
    "latitude": null,
    "longitude": null,
    "latlon": null,
    "is_on_view": false,
    "on_loan_display": null,
    "gallery_title": null,
    "gallery_id": null,
    "artwork_type_title": "Painting",
    "artwork_type_id": 1,
    "department_title": "Arts of the Americas",
    "department_id": "PC-3",
    "artist_id": 43088,
    "artist_title": "Thomas Doughty",
    "alt_artist_ids": [],
    "artist_ids": [
        43088
    ],
    "artist_titles": [
        "Thomas Doughty"
    ],
    "category_ids": [
        "PC-3"
    ],
    "category_titles": [
        "Arts of the Americas"
    ],
    "term_titles": [
...
    ]....
}
</code>```

Body:
I've been trying to follow some similar questions and their solutions on the forum but can't figure out how to iterate my Object or assign it to the type properly for the view and fill the instance of the object type.

I'm able to see the correct object I want in the console log, but I can't iterate over it to populate the view. I tried keyvalue, however, I got stuck with the view just iterating over the whole object using {{item.key}}:{{item.value}}, I needed the data to match the model. I don't need the whole API response JSON object, just 'specific' property:values.

What I am not understanding? or What am I not doing? I've read the rxjs map information and angular.io keyvalue docs. Is it a typescript misunderstanding? Thanks in advance for your insight!

Component

export class ArtifactCardComponent implements OnInit {
  allArtifacts: Artifact[] = []; // Is this a class object type to array?
  isFetching: boolean = false;

  constructor(private artifactService: ArtifactService) {}

  ngOnInit() {
    this.artifactService.getArtifacts().pipe(
      map((data) => {
        return data['data'] ;
      }
    ))
    .subscribe(
      (data) => {
        this.isFetching = true;
        this.allArtifacts = data
        console.log(artifacts);
        this.isFetching = false;
      },
      (error) => {
        this.errorMessage = error.message;
      }
    );
  }
}

Model:

export class Artifact {
  id?: string;
  title: string;
  date_start: number;
  date_end: number;
  artist_display: string;
  main_reference_number: number;
  place_of_origin: string;
  medium_display: string;
  inscriptions: string;
  dimensions: number;
  credit_line: string;
  department_title: string;
}

Service:

public getArtifacts() {
 // return this.http.get<Artifact[]>(this.baseURL) : Observable<Artifact[]
 return this.http.get(this.baseURL,  { responseType: 'json' })
}

View:

{{artifact.title}}

...

response

   {
    "id": 120081,
    "api_model": "artworks",
    "api_link": "https://api.artic.edu/api/v1/artworks/120081",
    "is_boosted": false,
    "title": "Landscape with Dog",
    "alt_titles": null,
    "thumbnail": {
        "lqip": ...,
        "width": 2721,
        "height": 2250,
        "alt_text": "A work made of oil on composition board."
    },
    "main_reference_number": "1990.485",
    "has_not_been_viewed_much": false,
    "boost_rank": null,
    "date_start": 1832,
    "date_end": 1832,
    "date_display": "1832",
    "date_qualifier_title": "",
    "date_qualifier_id": null,
    "artist_display": "Thomas Doughty\nAmerican, 1793–1856",
    "place_of_origin": "United States",
    "dimensions": "24.8 × 29.2 cm (9 3/4 × 11 1/2 in.)",
    "medium_display": "Oil on composition board",
    "inscriptions": "signed l.r.: \"TD/1832\"",
    "credit_line": "Through prior acquisition of the Charles H. and Mary F. S. Worcester Collection",
    "catalogue_display": null,
    "publication_history": "Alexander Gallery (advertisement) in Magazine Antiques, 88, 5 (November 1990) p. 860 (ill.).",
    "exhibition_history": null,
    "provenance_text": null,
    "publishing_verification_level": "Web Cataloged",
    "internal_department_id": 21,
    "fiscal_year": 1991,
    "fiscal_year_deaccession": null,
    "is_public_domain": true,
    "is_zoomable": true,
    "max_zoom_window_size": -1,
    "copyright_notice": null,
    "has_multimedia_resources": false,
    "has_educational_resources": false,
    "has_advanced_imaging": false,
    "colorfulness": 29.5929,
    "color": {
   ...
    },
    "latitude": null,
    "longitude": null,
    "latlon": null,
    "is_on_view": false,
    "on_loan_display": null,
    "gallery_title": null,
    "gallery_id": null,
    "artwork_type_title": "Painting",
    "artwork_type_id": 1,
    "department_title": "Arts of the Americas",
    "department_id": "PC-3",
    "artist_id": 43088,
    "artist_title": "Thomas Doughty",
    "alt_artist_ids": [],
    "artist_ids": [
        43088
    ],
    "artist_titles": [
        "Thomas Doughty"
    ],
    "category_ids": [
        "PC-3"
    ],
    "category_titles": [
        "Arts of the Americas"
    ],
    "term_titles": [
...
    ]....
}


问:
Image download but can't open show photos can't open this file because the format is currently unsupported or the file is corrupted
This my code

When i run this code it's download the image success but doesn't open


问:
file upload while edit row in database
I am working on simple CRUD and I am facing difficulty with the "Edit section"
Long story short:
I have MySQL base with records, I am printing them on the front page, I have added two buttons for "Add new record" via <form and "Edit record" where I can edit any record.
The problem: in the "Add" section I can upload files during adding a new record.
here is the code for uploading a file in insert.php

```<code>// Include the database configuration file
include 'db.php';
$statusMsg = '';

// File upload path
$targetDir = "uploads/";
$fileName = basename($_FILES["file"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);

if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){
}
    // Allow certain file formats
    $allowTypes = array('jpg','png','jpeg','gif','pdf','doc','xlsx');
    if(in_array($fileType, $allowTypes)){
    }
        // Upload file to server
        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
        }
</code>```

Via this one, I am uploading the file on the server and making the record into the database as the filename.
I would like to use the same way while editing records in order if the user wants to upload a file later, but when I use the same code I am getting

```<code>Warning: Undefined array key "file" in C:\xampp\htdocs\crud\edit.php on line 12

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\crud\edit.php on line 12
</code>```

Here is my edit.php code:

```<code><?php

// include database connection file
include_once("config.php");

// Check if form is submitted for user update, then redirect to homepage after update
if(isset($_POST['update']))
{
    $id = $_POST['id'];
    $toolnr=$_POST['toolnr'];
    $status=$_POST['status'];
    $toolname=$_POST['toolname'];
    $serial=$_POST['serial'];
    $usedat=$_POST['usedat'];
    $owner=$_POST['owner'];
    $calibrated=$_POST['calibrated'];
    $nextcalibration=$_POST['nextcalibration'];
    $vendors=$_POST['vendors'];

    // update tools data
    $result = mysqli_query($mysqli, "UPDATE tools SET toolnr='$toolnr',status='$status',toolname='$toolname',serial='$serial',usedat='$usedat',owner='$owner',calibrated='$calibrated',nextcalibration='$nextcalibration', vendors='$vendors', file_name = '$fileName' WHERE id=$id");

    // Redirect to homepage to display updated tools in list
    header("Location: index.php");
}
?>
<?php
// Display selected tool data based on id
// Getting id from url
$id = $_GET['id'];

// Fetech tool data based on id
$result = mysqli_query($mysqli, "SELECT * FROM tools WHERE id=$id");

while($user_data = mysqli_fetch_array($result))
{
    $toolnr = $user_data['toolnr'];
    $status = $user_data['status'];
    $toolname = $user_data['toolname'];
    $serial = $user_data['serial'];
    $usedat = $user_data['usedat'];
    $owner = $user_data['owner'];
    $calibrated = $user_data['calibrated'];
    $nextcalibration = $user_data['nextcalibration'];
    $vendors = $user_data['vendors'];

}
?>
</code>```

and here is the HTML pcs:

```<code><tr>
                <td>File upload:</td>
                <td><input type="file" name="file" ></td>
            </tr>
</code>```

---- update ------
Here is the full edit.php code:

```<code><?php

// include database connection file
include_once("config.php");

// Include the database configuration file
include 'db.php';
$statusMsg = '';

// File upload path
$targetDir = "uploads/";
$fileName = basename($_FILES["file"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);

if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){
}
    // Allow certain file formats
    $allowTypes = array('jpg','png','jpeg','gif','pdf','doc','xlsx');
    if(in_array($fileType, $allowTypes)){
    }
        // Upload file to server
        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
        }

// Check if form is submitted for tool update, then redirect to homepage after update
if(isset($_POST['update']))
{
    $id = $_POST['id'];
    $toolnr=$_POST['toolnr'];
    $status=$_POST['status'];
    $toolname=$_POST['toolname'];
    $serial=$_POST['serial'];
    $usedat=$_POST['usedat'];
    $owner=$_POST['owner'];
    $calibrated=$_POST['calibrated'];
    $nextcalibration=$_POST['nextcalibration'];
    $vendors=$_POST['vendors'];

    // update tool data
    $result = mysqli_query($mysqli, "UPDATE tools SET toolnr='$toolnr',status='$status',toolname='$toolname',serial='$serial',usedat='$usedat',owner='$owner',calibrated='$calibrated',nextcalibration='$nextcalibration', vendors='$vendors',file_name = '$fileName'   WHERE id=$id");

    // Redirect to homepage to display updated tool in list
    header("Location: index.php");
}
?>
<?php
// Display selected tool data based on id
// Getting id from url
$id = $_GET['id'];

// Fetech tool data based on id
$result = mysqli_query($mysqli, "SELECT * FROM tools WHERE id=$id");

while($user_data = mysqli_fetch_array($result))
{
    $toolnr = $user_data['toolnr'];
    $status = $user_data['status'];
    $toolname = $user_data['toolname'];
    $serial = $user_data['serial'];
    $usedat = $user_data['usedat'];
    $owner = $user_data['owner'];
    $calibrated = $user_data['calibrated'];
    $nextcalibration = $user_data['nextcalibration'];
    $vendors = $user_data['vendors'];

}
?>
</code>```

Maybe I am working in the wrong way somehow...

Title: file upload while edit row in database

Body:
I am working on simple CRUD and I am facing difficulty with the "Edit section"
Long story short:
I have MySQL base with records, I am printing them on the front page, I have added two buttons for "Add new record" via <form and "Edit record" where I can edit any record.
The problem: in the "Add" section I can upload files during adding a new record.
here is the code for uploading a file in insert.php

// Include the database configuration file
include 'db.php';
$statusMsg = '';

// File upload path
$targetDir = "uploads/";
$fileName = basename($_FILES["file"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);

if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){
}
    // Allow certain file formats
    $allowTypes = array('jpg','png','jpeg','gif','pdf','doc','xlsx');
    if(in_array($fileType, $allowTypes)){
    }
        // Upload file to server
        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
        }

Via this one, I am uploading the file on the server and making the record into the database as the filename.
I would like to use the same way while editing records in order if the user wants to upload a file later, but when I use the same code I am getting

Warning: Undefined array key "file" in C:\xampp\htdocs\crud\edit.php on line 12

Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\crud\edit.php on line 12

Here is my edit.php code:

<?php

// include database connection file
include_once("config.php");

// Check if form is submitted for user update, then redirect to homepage after update
if(isset($_POST['update']))
{
    $id = $_POST['id'];
    $toolnr=$_POST['toolnr'];
    $status=$_POST['status'];
    $toolname=$_POST['toolname'];
    $serial=$_POST['serial'];
    $usedat=$_POST['usedat'];
    $owner=$_POST['owner'];
    $calibrated=$_POST['calibrated'];
    $nextcalibration=$_POST['nextcalibration'];
    $vendors=$_POST['vendors'];

    // update tools data
    $result = mysqli_query($mysqli, "UPDATE tools SET toolnr='$toolnr',status='$status',toolname='$toolname',serial='$serial',usedat='$usedat',owner='$owner',calibrated='$calibrated',nextcalibration='$nextcalibration', vendors='$vendors', file_name = '$fileName' WHERE id=$id");

    // Redirect to homepage to display updated tools in list
    header("Location: index.php");
}
?>
<?php
// Display selected tool data based on id
// Getting id from url
$id = $_GET['id'];

// Fetech tool data based on id
$result = mysqli_query($mysqli, "SELECT * FROM tools WHERE id=$id");

while($user_data = mysqli_fetch_array($result))
{
    $toolnr = $user_data['toolnr'];
    $status = $user_data['status'];
    $toolname = $user_data['toolname'];
    $serial = $user_data['serial'];
    $usedat = $user_data['usedat'];
    $owner = $user_data['owner'];
    $calibrated = $user_data['calibrated'];
    $nextcalibration = $user_data['nextcalibration'];
    $vendors = $user_data['vendors'];

}
?>

and here is the HTML pcs:

                File upload:
                <input type="file" name="file" >

---- update ------
Here is the full edit.php code:

<?php

// include database connection file
include_once("config.php");

// Include the database configuration file
include 'db.php';
$statusMsg = '';

// File upload path
$targetDir = "uploads/";
$fileName = basename($_FILES["file"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);

if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){
}
    // Allow certain file formats
    $allowTypes = array('jpg','png','jpeg','gif','pdf','doc','xlsx');
    if(in_array($fileType, $allowTypes)){
    }
        // Upload file to server
        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
        }

// Check if form is submitted for tool update, then redirect to homepage after update
if(isset($_POST['update']))
{
    $id = $_POST['id'];
    $toolnr=$_POST['toolnr'];
    $status=$_POST['status'];
    $toolname=$_POST['toolname'];
    $serial=$_POST['serial'];
    $usedat=$_POST['usedat'];
    $owner=$_POST['owner'];
    $calibrated=$_POST['calibrated'];
    $nextcalibration=$_POST['nextcalibration'];
    $vendors=$_POST['vendors'];

    // update tool data
    $result = mysqli_query($mysqli, "UPDATE tools SET toolnr='$toolnr',status='$status',toolname='$toolname',serial='$serial',usedat='$usedat',owner='$owner',calibrated='$calibrated',nextcalibration='$nextcalibration', vendors='$vendors',file_name = '$fileName'   WHERE id=$id");

    // Redirect to homepage to display updated tool in list
    header("Location: index.php");
}
?>
<?php
// Display selected tool data based on id
// Getting id from url
$id = $_GET['id'];

// Fetech tool data based on id
$result = mysqli_query($mysqli, "SELECT * FROM tools WHERE id=$id");

while($user_data = mysqli_fetch_array($result))
{
    $toolnr = $user_data['toolnr'];
    $status = $user_data['status'];
    $toolname = $user_data['toolname'];
    $serial = $user_data['serial'];
    $usedat = $user_data['usedat'];
    $owner = $user_data['owner'];
    $calibrated = $user_data['calibrated'];
    $nextcalibration = $user_data['nextcalibration'];
    $vendors = $user_data['vendors'];

}
?>

Maybe I am working in the wrong way somehow...


问:
I wonder why tabnet applies np.expm1 to prediction values
I am currently working through the tabnet tutorial with house price data.

```<code>kf = KFold(n_splits=5, random_state=42, shuffle=True)
predictions_array = []
predictions_array2 = []
CV_score_array    = []
for train_index, test_index in kf.split(X): # train_index는 kfold1회에서 train조합, test_index는 테스트조합
    X_train, X_valid = X[train_index], X[test_index]
    y_train, y_valid = y[train_index], y[test_index]
    regressor = TabNetRegressor(verbose=0,seed=42)
    regressor.fit(X_train=X_train, y_train=y_train,
              eval_set=[(X_valid, y_valid)],
              patience=300, max_epochs=2000,
              eval_metric=['rmse'])
    CV_score_array.append(regressor.best_cost)
    predictions_array.append(np.expm1(regressor.predict(X_test)))
predictions = np.mean(predictions_array,axis=0)
</code>```

No matter how much I think about it, I don't understand why np.expm1(regressor.predict(X_test)) is applied rather than regressor.predict(X_test) value.

I referred to "https://www.kaggle.com/code/carlmcbrideellis/tabnet-a-very-simple-regression-example/notebook"

Body:
I am currently working through the tabnet tutorial with house price data.

kf = KFold(n_splits=5, random_state=42, shuffle=True)
predictions_array = []
predictions_array2 = []
CV_score_array    = []
for train_index, test_index in kf.split(X): # train_index는 kfold1회에서 train조합, test_index는 테스트조합
    X_train, X_valid = X[train_index], X[test_index]
    y_train, y_valid = y[train_index], y[test_index]
    regressor = TabNetRegressor(verbose=0,seed=42)
    regressor.fit(X_train=X_train, y_train=y_train,
              eval_set=[(X_valid, y_valid)],
              patience=300, max_epochs=2000,
              eval_metric=['rmse'])
    CV_score_array.append(regressor.best_cost)
    predictions_array.append(np.expm1(regressor.predict(X_test)))
predictions = np.mean(predictions_array,axis=0)

No matter how much I think about it, I don't understand why np.expm1(regressor.predict(X_test)) is applied rather than regressor.predict(X_test) value.

I referred to "https://www.kaggle.com/code/carlmcbrideellis/tabnet-a-very-simple-regression-example/notebook"


问:
Round icon of MediaItem on AndroidAuto App

MediaItem Builder maynot support round icon

Is there a way to make a list of media item which has a round icon (because currently i just have the square one). I do think about using Glide to load it as asynchronize but it looks not good.


问:
cannot pickle 'generator' object created using yield key-word
As shown in the below posted code, I call __yieldIterables() to generate iterables according to what the list self.__itersList contains. At run time I receive the following error:

```<code>TypeError: cannot pickle 'generator' object
</code>```

Please let me know how to correct the below code in such a way that I can still convert the contents of self.__itersList to iterables that can be passed to the self.run()

code:

```<code>def postTask(self):
    arg0 = self.getDistancesModel().getFieldCoordinatesAsTextInWKTEPSG25832()
    self.__itersList.append(self.getDistancesModel().getNZCCCenterPointsAsString())
    self.__itersList.append(self.getDistancesModel().getZCCCenterPointsAsString())
    self.__itersList.append(self.getDistancesModel().getNoDataCCenterPointsAsString())

    with Pool(processes=self.__processesCount,initializer=self.initPool,initargs=(arg0,)) as DistancesRecordsPool.pool:
        self.__iterables = self.__yieldIterables()
        self.__chunkSize = PoolUtils.getChunkSizeForLenOfIterables(lenOfIterablesList=len(self.__itersList),cpuCount=self.__cpuCount)
        for res in DistancesRecordsPool.pool.map(func=self.run,iterable=self.__iterables,chunksize=self.__chunkSize):
            self.__res.append(res)

    DistancesRecordsPool.pool.join()
    gPostgreSQLHelperObject.closeConnection()
    return self.__res

def __yieldIterables(self):
    for i in self.__itersList:
        yield i
</code>```

Body:
As shown in the below posted code, I call __yieldIterables() to generate iterables according to what the list self.__itersList contains. At run time I receive the following error:

TypeError: cannot pickle 'generator' object

Please let me know how to correct the below code in such a way that I can still convert the contents of self.__itersList to iterables that can be passed to the self.run()

code:

def postTask(self):
    arg0 = self.getDistancesModel().getFieldCoordinatesAsTextInWKTEPSG25832()
    self.__itersList.append(self.getDistancesModel().getNZCCCenterPointsAsString())
    self.__itersList.append(self.getDistancesModel().getZCCCenterPointsAsString())
    self.__itersList.append(self.getDistancesModel().getNoDataCCenterPointsAsString())

    with Pool(processes=self.__processesCount,initializer=self.initPool,initargs=(arg0,)) as DistancesRecordsPool.pool:
        self.__iterables = self.__yieldIterables()
        self.__chunkSize = PoolUtils.getChunkSizeForLenOfIterables(lenOfIterablesList=len(self.__itersList),cpuCount=self.__cpuCount)
        for res in DistancesRecordsPool.pool.map(func=self.run,iterable=self.__iterables,chunksize=self.__chunkSize):
            self.__res.append(res)

    DistancesRecordsPool.pool.join()
    gPostgreSQLHelperObject.closeConnection()
    return self.__res

def __yieldIterables(self):
    for i in self.__itersList:
        yield i


问:
how to automate the angular 10 _ grid using filters and check the grid is displayed based on filter in selenium c#
how to automate the angular 10 _ grid using filters and check the grid is displayed based on filter in selenium c#

try
{
Exceloperations.PopulateInCollection(@"D:\Grid.xlsx");
for (int i = 1; i <= Exceloperations.GetTotalRowCount(); i++)
{

```<code>                    ReadExcel(Driver.driver, i);

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

            }
</code>```

// Getting elements from the excel

```<code>public void ReadExcel(IWebDriver driver, int rowNum)
        {
            Menus menu = new Menus();
            Invoices_obj invoices_Obj = new Invoices_obj();

            try
            {
                if(invoices_Obj.Grid_Filter.Enabled)
                {
                                        invoices_Obj.Grid_Filter.Click();

                                   }
                else
                {
                    Console.WriteLine("Already filter is enable");
                }

                invoices_Obj.hourscolumn_Gridfilter.Click();

                Console.WriteLine("-------------- Hours column Equals ------------------");

                invoices_Obj.hourscolumn_dd_Field_dd.Click();

                invoices_Obj.hourscolumn_dd_Field_dd_value_equals.Click();

                string Totalhourseq = Exceloperations.ReadData(rowNum, "Hours_Customequals");
               // Console.WriteLine(rowNum);

                Thread.Sleep(1000);

                if (rowNum != null)

                {

                    Actions actions = new Actions(Driver.driver);

                    invoices_Obj.hourscolumn_dd_input.SendKeys(Totalhourseq);
                    Thread.Sleep(2000);
                    Console.WriteLine("input value as "+ Totalhourseq);

                    invoices_Obj.Gridcolumn_Apply.Click();

}
}
</code>```

Body:
how to automate the angular 10 _ grid using filters and check the grid is displayed based on filter in selenium c#

try
{
Exceloperations.PopulateInCollection(@"D:\Grid.xlsx");
for (int i = 1; i <= Exceloperations.GetTotalRowCount(); i++)
{

                    ReadExcel(Driver.driver, i);

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

            }

// Getting elements from the excel

public void ReadExcel(IWebDriver driver, int rowNum)
        {
            Menus menu = new Menus();
            Invoices_obj invoices_Obj = new Invoices_obj();

            try
            {
                if(invoices_Obj.Grid_Filter.Enabled)
                {
                                        invoices_Obj.Grid_Filter.Click();

                                   }
                else
                {
                    Console.WriteLine("Already filter is enable");
                }

                invoices_Obj.hourscolumn_Gridfilter.Click();

                Console.WriteLine("-------------- Hours column Equals ------------------");

                invoices_Obj.hourscolumn_dd_Field_dd.Click();

                invoices_Obj.hourscolumn_dd_Field_dd_value_equals.Click();

                string Totalhourseq = Exceloperations.ReadData(rowNum, "Hours_Customequals");
               // Console.WriteLine(rowNum);

                Thread.Sleep(1000);

                if (rowNum != null)

                {

                    Actions actions = new Actions(Driver.driver);

                    invoices_Obj.hourscolumn_dd_input.SendKeys(Totalhourseq);
                    Thread.Sleep(2000);
                    Console.WriteLine("input value as "+ Totalhourseq);

                    invoices_Obj.Gridcolumn_Apply.Click();

}
}


问:
How I can access FaceId or face Recognition in react native for android?
I have already tried react-native-touch-id package for biometric login. but i couldnot find solution to get access for faceId in android. or face recognition. I have gone through firebase ml kit face recognition but it is has paid plans.


问:
Celery worker not restarting after completing max task per child
I've set max-task-per-child for celery worker with default concurrency and pool=prefork it still won't restart and release memory like it does on manually stopping and starting

celery report

```<code>PERMANENT_SESSION_LIFETIME: datetime.timedelta(days=31)
USE_X_SENDFILE: False
SERVER_NAME: None
APPLICATION_ROOT: '/'
SESSION_COOKIE_NAME: 'session'
SESSION_COOKIE_DOMAIN: None
SESSION_COOKIE_PATH: None
SESSION_COOKIE_HTTPONLY: True
SESSION_COOKIE_SECURE: False
SESSION_COOKIE_SAMESITE: None
SESSION_REFRESH_EACH_REQUEST: True
MAX_CONTENT_LENGTH: None
SEND_FILE_MAX_AGE_DEFAULT: datetime.timedelta(seconds=43200)
TRAP_BAD_REQUEST_ERRORS: None
TRAP_HTTP_EXCEPTIONS: False
EXPLAIN_TEMPLATE_LOADING: False
PREFERRED_URL_SCHEME: 'http'
JSON_AS_ASCII: True
JSON_SORT_KEYS: '********'
JSONIFY_PRETTYPRINT_REGULAR: False
JSONIFY_MIMETYPE: 'application/json'
TEMPLATES_AUTO_RELOAD: None
MAX_COOKIE_SIZE: 4093
worker_max_tasks_per_child: 2
timezone: 'UTC'
result_extended: True
broker_heartbeat: 0
worker_cancel_long_running_tasks_on_connection_loss: True
worker_deduplicate_successful_tasks: True
</code>```

How can I make max-task-per-child restart workers after completing the specified number of tasks?

Body:
I've set max-task-per-child for celery worker with default concurrency and pool=prefork it still won't restart and release memory like it does on manually stopping and starting

celery report

PERMANENT_SESSION_LIFETIME: datetime.timedelta(days=31)
USE_X_SENDFILE: False
SERVER_NAME: None
APPLICATION_ROOT: '/'
SESSION_COOKIE_NAME: 'session'
SESSION_COOKIE_DOMAIN: None
SESSION_COOKIE_PATH: None
SESSION_COOKIE_HTTPONLY: True
SESSION_COOKIE_SECURE: False
SESSION_COOKIE_SAMESITE: None
SESSION_REFRESH_EACH_REQUEST: True
MAX_CONTENT_LENGTH: None
SEND_FILE_MAX_AGE_DEFAULT: datetime.timedelta(seconds=43200)
TRAP_BAD_REQUEST_ERRORS: None
TRAP_HTTP_EXCEPTIONS: False
EXPLAIN_TEMPLATE_LOADING: False
PREFERRED_URL_SCHEME: 'http'
JSON_AS_ASCII: True
JSON_SORT_KEYS: '********'
JSONIFY_PRETTYPRINT_REGULAR: False
JSONIFY_MIMETYPE: 'application/json'
TEMPLATES_AUTO_RELOAD: None
MAX_COOKIE_SIZE: 4093
worker_max_tasks_per_child: 2
timezone: 'UTC'
result_extended: True
broker_heartbeat: 0
worker_cancel_long_running_tasks_on_connection_loss: True
worker_deduplicate_successful_tasks: True

How can I make max-task-per-child restart workers after completing the specified number of tasks?


问:
Map tilt down and rotation in GMap.Net WPF
I am looking forward to implementing Driving Navigation in GMap.NET.WindowsPresentation. Would it be possible to tilt down and rotate the map.

I think the bearing does the rotation, but I am not sure how to tilt up or tilt down.

mapControl.Bearing = 10;
mapControl.Bearing -= 10;

Any help would be appreciated.
Thanks


问:
Video AVAsset — only saves one object to arrays
I am trying to use implement photo and video functionality to my iOS app with Swift.

Images work fine. The images and uiimages arrays are correctly populated.
With video — it only seems to save one video to the array (i.e. it overwrites the existing video, even though the imageIndex has changed. This happens in both the videos and media arrays).

What could be causing this? It seems I have the exact same logic for videos as for images, and saving images in the media ([AnyObject]) array works fine, but not for videos.

@State var images = [Image?](repeating: nil, count: 6)
@State var uiimages = [UIImage?](repeating: nil, count: 6)
@State var videos = [AVAsset?](repeating: nil, count: 6)
@State var media = [AnyObject?](repeating: nil, count: 6)

...

CaptureImageView(isShown: $showCaptureImageView, uiimage: $uiimages[imageIndex], image: $images[imageIndex], video: $videos[imageIndex], amedia: $media[imageIndex], camera: camera)
    .onAppear {
        self.disableButtons = true
    }
    .onDisappear {
        var nonNil:Int = 0
        for media in media {
            if media != nil {
                nonNil += 1
            }
        }
        self.nonNilImages = nonNil
        self.imageIndex = nonNil
        self.disableButtons = false
        print("-------")
        print("imageIndex: \(imageIndex)")
        print(videos)
        print(media)
    }
```
<pre class="lang-swift prettyprint-override"><code>import SwiftUI
import AVFoundation

struct CaptureImageView {

    @Binding var isShown: Bool
    @Binding var uiimage: UIImage?
    @Binding var image: Image?
    @Binding var video: AVAsset?
    @Binding var amedia: AnyObject?

    var camera: Bool

    func makeCoordinator() -> Coordinator {
        return Coordinator(isShown: $isShown, image: $image, uiimage: $uiimage, video: $video, amedia: $amedia)
    }
}
extension CaptureImageView: UIViewControllerRepresentable {
    func makeUIViewController(context: UIViewControllerRepresentableContext<CaptureImageView>) -> UIImagePickerController {
        let picker = UIImagePickerController()
        picker.delegate = context.coordinator
        if camera {

            if let mediaTypes = UIImagePickerController.availableMediaTypes(for: .camera) {
                picker.mediaTypes = mediaTypes
            }

            picker.sourceType = .camera
        }
        return picker
    }

    func updateUIViewController(_ uiViewController: UIImagePickerController,
                                context: UIViewControllerRepresentableContext<CaptureImageView>) {

    }
}
</code>```

import SwiftUI
import AVFoundation
class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
  @Binding var isCoordinatorShown: Bool
  @Binding var uiimageInCoordinator: UIImage?
  @Binding var imageInCoordinator: Image?
  @Binding var videoInCoordinator: AVAsset?
  @Binding var mediaInCoordinator: AnyObject?

  init(isShown: Binding<Bool>, image: Binding<Image?>, uiimage: Binding<UIImage?>, video: Binding<AVAsset?>, amedia: Binding<AnyObject?>) {
    _isCoordinatorShown = isShown
    _uiimageInCoordinator = uiimage
    _imageInCoordinator = image
    _videoInCoordinator = video
    _mediaInCoordinator = amedia
  }
    func imagePickerController(_ picker: UIImagePickerController,
                didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
        if let videoURL = info[UIImagePickerController.InfoKey.mediaURL] as? URL {
            let asset = AVAsset(url: videoURL)
            print(asset)
            videoInCoordinator = AVAsset(url: videoURL)
            mediaInCoordinator = AVAsset(url: videoURL)
        } else if let unwrapImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
            // handle image pick
            uiimageInCoordinator = unwrapImage
            imageInCoordinator = Image(uiImage: unwrapImage)
            mediaInCoordinator = unwrapImage
        }
        isCoordinatorShown = false
    }
  func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
     isCoordinatorShown = false
  }
}
```

Body:
I am trying to use implement photo and video functionality to my iOS app with Swift.

Images work fine. The images and uiimages arrays are correctly populated.
With video — it only seems to save one video to the array (i.e. it overwrites the existing video, even though the imageIndex has changed. This happens in both the videos and media arrays).

What could be causing this? It seems I have the exact same logic for videos as for images, and saving images in the media ([AnyObject]) array works fine, but not for videos.

@State var images = [Image?](repeating: nil, count: 6)
@State var uiimages = [UIImage?](repeating: nil, count: 6)
@State var videos = [AVAsset?](repeating: nil, count: 6)
@State var media = [AnyObject?](repeating: nil, count: 6)

...

CaptureImageView(isShown: $showCaptureImageView, uiimage: $uiimages[imageIndex], image: $images[imageIndex], video: $videos[imageIndex], amedia: $media[imageIndex], camera: camera)
    .onAppear {
        self.disableButtons = true
    }
    .onDisappear {
        var nonNil:Int = 0
        for media in media {
            if media != nil {
                nonNil += 1
            }
        }
        self.nonNilImages = nonNil
        self.imageIndex = nonNil
        self.disableButtons = false
        print("-------")
        print("imageIndex: \(imageIndex)")
        print(videos)
        print(media)
    }

import SwiftUI
import AVFoundation

struct CaptureImageView {

    @Binding var isShown: Bool
    @Binding var uiimage: UIImage?
    @Binding var image: Image?
    @Binding var video: AVAsset?
    @Binding var amedia: AnyObject?

    var camera: Bool

    func makeCoordinator() -> Coordinator {
        return Coordinator(isShown: $isShown, image: $image, uiimage: $uiimage, video: $video, amedia: $amedia)
    }
}
extension CaptureImageView: UIViewControllerRepresentable {
    func makeUIViewController(context: UIViewControllerRepresentableContext<CaptureImageView>) -> UIImagePickerController {
        let picker = UIImagePickerController()
        picker.delegate = context.coordinator
        if camera {

            if let mediaTypes = UIImagePickerController.availableMediaTypes(for: .camera) {
                picker.mediaTypes = mediaTypes
            }

            picker.sourceType = .camera
        }
        return picker
    }

    func updateUIViewController(_ uiViewController: UIImagePickerController,
                                context: UIViewControllerRepresentableContext<CaptureImageView>) {

    }
}

import SwiftUI
import AVFoundation
class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
  @Binding var isCoordinatorShown: Bool
  @Binding var uiimageInCoordinator: UIImage?
  @Binding var imageInCoordinator: Image?
  @Binding var videoInCoordinator: AVAsset?
  @Binding var mediaInCoordinator: AnyObject?

  init(isShown: Binding<Bool>, image: Binding<Image?>, uiimage: Binding<UIImage?>, video: Binding<AVAsset?>, amedia: Binding<AnyObject?>) {
    _isCoordinatorShown = isShown
    _uiimageInCoordinator = uiimage
    _imageInCoordinator = image
    _videoInCoordinator = video
    _mediaInCoordinator = amedia
  }
    func imagePickerController(_ picker: UIImagePickerController,
                didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
        if let videoURL = info[UIImagePickerController.InfoKey.mediaURL] as? URL {
            let asset = AVAsset(url: videoURL)
            print(asset)
            videoInCoordinator = AVAsset(url: videoURL)
            mediaInCoordinator = AVAsset(url: videoURL)
        } else if let unwrapImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
            // handle image pick
            uiimageInCoordinator = unwrapImage
            imageInCoordinator = Image(uiImage: unwrapImage)
            mediaInCoordinator = unwrapImage
        }
        isCoordinatorShown = false
    }
  func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
     isCoordinatorShown = false
  }
}