问:
Re-render sibling on selection or a better?
I am kind of new to react & TypeScript.

I am trying to modify some functionality but having hard time doing that.

Currently we show all the subscriptions and all the transactions on the same page instead what I want to do is that based on the subscription selection i want show all the transactions (Currently both subscriptions and transactions are siblings).

I have created an on click event on subscription which is calling handleViewTransaction

The problem is that I am not able to re-render TransactionsTable from the handleViewTransaction.

Do I need to make it parent-child or there is a way to achieve it without much code refactoring?

```<code>import * as React from 'react'
import {RouteComponentProps} from 'react-router-dom'
import * as _ from 'lodash'
import * as cx from 'classnames'
import {Accordion, AccordionItem} from 'react-light-accordion'
import * as dcbApi from '../../../components/dcbApi'
import {Page} from '../../components/page'
import {Loader} from '../../components/loader'
import {Modal} from '../../components/modal'
import {SubscriptionStore, SubscriptionStoreState, useSubscriptionStore} from '../../../stores/subscription'
import {TransactionsTable} from '../../components/tables/transactions'
import {SubscriptionsTable} from '../../components/tables/subscriptions'
import {TransactionsPage} from './transactions'
import {BokuSubscription, BokuTransaction} from '../../../types'

export interface ResultPageProps extends RouteComponentProps<{}> {
    userId?: string
    subscriptions?: BokuSubscription[]
    transactions?: BokuTransaction[]
    isLoading?: boolean
    onRefetch?: () => any
}

export const ResultPage = ({ isLoading: isLoadingParent, history, userId, subscriptions, transactions, onRefetch }: ResultPageProps) => {
    const [isLoading, setIsLoading] = React.useState(false);
    const [subscriptionCancellationSent, setSubscriptionCancellationSent] = React.useState(false);
    const [transactionCancellationSent, setTransactionCancellationSent] = React.useState(false);
    const [selectedTransaction, setSelectedTransaction] = React.useState(null);
    const hasTransactions = false;
    const navigateHome = () =>
        history.push('/');

    const handleViewTransaction = async (daznUserId: string, subscriptionId: string, aggregator: string) => {
        // TODO: Show subscription specific transactions
    };

    const handleSubsctiptionCancel = async (userId: string, subscriptionId: string) => {
        try {
            setIsLoading(true);
            const response = await dcbApi.cancelSubscription(userId, 'boku', subscriptionId);
            setIsLoading(false);
            setSubscriptionCancellationSent(true);
            Modal.info({
                title: `Your cancellation request has been submited for ${userId}`,
                okText: 'OK',
                content: (
                    <div>
                        <span>Transaction Id:</span> {response.transactionId}<br/>
                        <span>Subscription Id:</span> {response.subscriptionId}<br/>
                        <span>Aggregator:</span> {response.aggregator}<br/>
                        <span>Status:</span> {response.status}<br/>
                    </div>
                ),
            })
            //this.setState({ cancellationSent: true })
        } catch (err) {
            setIsLoading(false);
            console.error(err);
            Modal.info({
                title: `Your cancellation request for ${userId} has failed`,
                okText: 'OK',
                content: (
                    <div>
                        {_.get(err, 'message') && <div>Error message: {err.message}</div>}
                        <Accordion atomic={true}>
                            <AccordionItem title='Toggle detailed error'>
                                ```{JSON.stringify(err, null, 2)}```
                            </AccordionItem>
                        </Accordion>
                    </div>
                ),
            })
        } finally {
            if (typeof onRefetch === 'function') {
                onRefetch()
            }
        }
    };

    const handleChargeRefund = async (userId: string, chargeId: string, reasonCode: number) => {
        try {
            setIsLoading(true);
            const response = await dcbApi.refund(userId, 'boku', chargeId, reasonCode)
            setIsLoading(false);
            setTransactionCancellationSent(true);
            Modal.info({
                title: `Your refund request has been submited`,
                okText: 'OK',
                content: (
                    <div>
                        <span>Charge Id:</span> {response.chargeId}<br/>
                        <span>Country:</span> {response.country}<br/>
                        <span>Refund status:</span> {response.refundStatus}<br/>
                        <span>Refund Id:</span> {response.refundId}<br/>
                    </div>
                ),
            })
            //this.setState({ cancellationSent: true })
        } catch (err) {
            setIsLoading(false);
            console.error(err);
            Modal.info({
                title: `Your refund request has failed`,
                okText: 'OK',
                content: (
                    <div>
                        {_.get(err, 'message') && <div>Error message: {err.message}</div>}
                        <Accordion atomic={true}>
                            <AccordionItem title='Toggle detailed error'>
                                ```{JSON.stringify(err, null, 2)}```
                            </AccordionItem>
                        </Accordion>
                    </div>
                ),
            })
        } finally {
            if (typeof onRefetch === 'function') {
                onRefetch()
            }
        }
    };

    return (
        <Page
            theme='dark' // light|dark
            title='Back to home'
            onLogoClick={navigateHome}
            onTitleClick={navigateHome}
            overlay={(!isLoading && !isLoadingParent) ? undefined :
                <div style={{
                    position: 'absolute',
                    top: 0,
                    left: 0,
                    width: '100%',
                    height: '100%',
                    background: 'rgba(130,131,134,.34)'
                }}>
                    <div style={{
                        textAlign: 'center',
                        position: 'relative',
                        top: '50%',
                        left: '50%',
                        transform: 'translate(-50%,-50%)'
                    }}>
                        <Loader/><br/><br/>
                        <span style={{
                            color: 'white',
                            fontSize: 22,
                            fontFamily: 'Trim',
                            textAlign: 'center'
                        }}>Loading</span>
                    </div>
                </div>}
        >
            <div style={{width: '100%'}}>
                <div
                    style={{
                        textAlign: 'center',
                        marginBottom: 24,
                        fontFamily: 'Trim',
                        fontWeight: 500,
                        fontSize: '26px'
                    }}
                >Subscription statuses for user: {userId}</div>
                <SubscriptionsTable
                    userId={userId}
                    data={subscriptions}
                    cancellationSent={subscriptionCancellationSent}
                    onCancelSubscription={handleSubsctiptionCancel}
                    onViewTransaction={handleViewTransaction}
                />
                <div id="transactions">
                    <div
                        style={{
                            textAlign: 'center',
                            marginTop: 24,
                            marginBottom: 24,
                            fontFamily: 'Trim',
                            fontWeight: 500,
                            fontSize: '26px',
                        }}
                    >
                        {hasTransactions ?
                            `Transactions for user: ${userId}` :
                            <i>This user does not have transactions linked to their subscription</i>}
                    </div>
                    {hasTransactions &&

                    <TransactionsTable
                        userId={userId}
                        data={transactions}
                        cancellationSent={transactionCancellationSent}
                        onRefundCharge={handleChargeRefund}
                    />}
                </div>
            </div>
        </Page>
    )
};

</code>```

答:
The only way to make a component rerender is to have its state or its props change, or an ancestor rerenders. With that in mind, if you want the sibling of a component to rerender when something happens, the best solution is to make the common parent update its state, and pass some value into the sibling.

For your type of scenario, you probably want to hold the selection state in the parent, and pass the value and setter functions down into the children as necessary

Body:
I am kind of new to react & TypeScript.

I am trying to modify some functionality but having hard time doing that.

Currently we show all the subscriptions and all the transactions on the same page instead what I want to do is that based on the subscription selection i want show all the transactions (Currently both subscriptions and transactions are siblings).

I have created an on click event on subscription which is calling handleViewTransaction

The problem is that I am not able to re-render TransactionsTable from the handleViewTransaction.

Do I need to make it parent-child or there is a way to achieve it without much code refactoring?

import * as React from 'react'
import {RouteComponentProps} from 'react-router-dom'
import * as _ from 'lodash'
import * as cx from 'classnames'
import {Accordion, AccordionItem} from 'react-light-accordion'
import * as dcbApi from '../../../components/dcbApi'
import {Page} from '../../components/page'
import {Loader} from '../../components/loader'
import {Modal} from '../../components/modal'
import {SubscriptionStore, SubscriptionStoreState, useSubscriptionStore} from '../../../stores/subscription'
import {TransactionsTable} from '../../components/tables/transactions'
import {SubscriptionsTable} from '../../components/tables/subscriptions'
import {TransactionsPage} from './transactions'
import {BokuSubscription, BokuTransaction} from '../../../types'

export interface ResultPageProps extends RouteComponentProps<{}> {
    userId?: string
    subscriptions?: BokuSubscription[]
    transactions?: BokuTransaction[]
    isLoading?: boolean
    onRefetch?: () => any
}

export const ResultPage = ({ isLoading: isLoadingParent, history, userId, subscriptions, transactions, onRefetch }: ResultPageProps) => {
    const [isLoading, setIsLoading] = React.useState(false);
    const [subscriptionCancellationSent, setSubscriptionCancellationSent] = React.useState(false);
    const [transactionCancellationSent, setTransactionCancellationSent] = React.useState(false);
    const [selectedTransaction, setSelectedTransaction] = React.useState(null);
    const hasTransactions = false;
    const navigateHome = () =>
        history.push('/');

    const handleViewTransaction = async (daznUserId: string, subscriptionId: string, aggregator: string) => {
        // TODO: Show subscription specific transactions
    };

    const handleSubsctiptionCancel = async (userId: string, subscriptionId: string) => {
        try {
            setIsLoading(true);
            const response = await dcbApi.cancelSubscription(userId, 'boku', subscriptionId);
            setIsLoading(false);
            setSubscriptionCancellationSent(true);
            Modal.info({
                title: `Your cancellation request has been submited for ${userId}`,
                okText: 'OK',
                content: (

                        Transaction Id: {response.transactionId}

                        Subscription Id: {response.subscriptionId}

                        Aggregator: {response.aggregator}

                        Status: {response.status}

                ),
            })
            //this.setState({ cancellationSent: true })
        } catch (err) {
            setIsLoading(false);
            console.error(err);
            Modal.info({
                title: `Your cancellation request for ${userId} has failed`,
                okText: 'OK',
                content: (

                        {_.get(err, 'message') &&
Error message: {err.message}
}
                        <Accordion atomic={true}>
                            <AccordionItem title='Toggle detailed error'>

{JSON.stringify(err, null, 2)}

                            </AccordionItem>
                        </Accordion>

                ),
            })
        } finally {
            if (typeof onRefetch === 'function') {
                onRefetch()
            }
        }
    };

    const handleChargeRefund = async (userId: string, chargeId: string, reasonCode: number) => {
        try {
            setIsLoading(true);
            const response = await dcbApi.refund(userId, 'boku', chargeId, reasonCode)
            setIsLoading(false);
            setTransactionCancellationSent(true);
            Modal.info({
                title: `Your refund request has been submited`,
                okText: 'OK',
                content: (

                        Charge Id: {response.chargeId}

                        Country: {response.country}

                        Refund status: {response.refundStatus}

                        Refund Id: {response.refundId}

                ),
            })
            //this.setState({ cancellationSent: true })
        } catch (err) {
            setIsLoading(false);
            console.error(err);
            Modal.info({
                title: `Your refund request has failed`,
                okText: 'OK',
                content: (

                        {_.get(err, 'message') &&
Error message: {err.message}
}
                        <Accordion atomic={true}>
                            <AccordionItem title='Toggle detailed error'>

{JSON.stringify(err, null, 2)}

                            </AccordionItem>
                        </Accordion>

                ),
            })
        } finally {
            if (typeof onRefetch === 'function') {
                onRefetch()
            }
        }
    };

    return (
        <Page
            theme='dark' // light|dark
            title='Back to home'
            onLogoClick={navigateHome}
            onTitleClick={navigateHome}
            overlay={(!isLoading && !isLoadingParent) ? undefined :

                        <Loader/>

                        Loading

}
        >

Subscription statuses for user: {userId}

                <SubscriptionsTable
                    userId={userId}
                    data={subscriptions}
                    cancellationSent={subscriptionCancellationSent}
                    onCancelSubscription={handleSubsctiptionCancel}
                    onViewTransaction={handleViewTransaction}
                />

                        {hasTransactions ?
                            `Transactions for user: ${userId}` :
                            This user does not have transactions linked to their subscription}

                    {hasTransactions &&

                    <TransactionsTable
                        userId={userId}
                        data={transactions}
                        cancellationSent={transactionCancellationSent}
                        onRefundCharge={handleChargeRefund}
                    />}

        </Page>
    )
};


来源: stackexchange

问:
What does revert do in Azure Release pipeline?
On a release pipeline's history tab, you can select the ellipses on each record and choose to compare the difference or revert pipeline.

What does the revert option do? Does it revert the selected version (change) out of the latest pipeline? or does it revert the latest pipeline to the selected version (just after the change was made)?

答:
The revert tell Azure Pipelines to make the definition like the version you click "Revert Pipeline".

For example - I have 4 versions of my pipeline:

1) An empty pipeline.

2) One stage.

3) One Stage + Second Stage.

4) One Stage + Second Stage + This stage.

Now I have 3 stages in my release pipeline.

If I want to go back and delete my last 2 stages I need to go the History tab, to the second line that represents the creation of 2) One stage and click there on "Revert Pipeline". the pipeline will be with One stage only, like the version I clicked to revert.

ContentLicense: CC BY-SA 4.0


问:
airflow communicate between task without xcom
I figure out that xcom actually write data into database and pull it from other task. My dataset is large and pickle it and write to database cause some unnecessary delay. Is there a way to communicate data between tasks in the same airflow Dag without using xcom?

below is the code that I tried, the context is actually not passed. I know use task_instance.xcom_push() would work but it also pickle the data and write it to database which I don't need.

from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
from pandas import DataFrame
import pandas as pd
from custom.dataframe_to_postgres_operator import PostgresOperatorBulk
from airflow.operators.postgres_operator import PostgresOperator

def read_df(task_instance, **context):
    df = pd.read_parquet('/usr/local/airflow/data/df.parquet.gzip')
    print(df)
    # task_instance.xcom_push('data', df)
    context.update({'data': df})
    for k, v in context.items():
        print(k, v)
    return 1

def get_df(task_instance, **context):
    for k, v in context.items():
        print(k, v)
    df = context['data']

default_args = {
    'owner': 'Airflow',
    'depends_on_past': False,
    'start_date': datetime(2020, 2, 17),
    'retries': 0,
}

dag = DAG('abcdefg', default_args=default_args, schedule_interval=timedelta(days=1))

task_read_df = PythonOperator(
    task_id='read_df',
    python_callable=read_df,
    dag=dag,
    provide_context=True,
    do_xcom_push=False
)

task_get_df = PythonOperator(
    task_id='get_df',
    python_callable=get_df,
    dag=dag,
    provide_context=True,
    do_xcom_push=False
)

task_read_df >> task_get_df
```

答:
If you have a large dataset that you want to exchange I suggest storing the data in some form of a temporary location (e.g. a designated directory) and then passing the path to such a temp file or files using XCOM (which for small data pieces is cheap and gives good enough performance).

For that, a good library is tempfile which helps ease the pain to avoid duplicates among the temp files.

Why XCOM and not shared execution context between Tasks

Given that the Tasks can be executed in parallel this is the first issue that creates a lot of difficulty for Python (GIL, sharing data in parallel).

Secondly, to ensure some form of persistence (and therefore resilience to failure) you have to use a database to ensure ACID.

It all makes XCOM mechanism relatively heavy (particularly when you add pickling on top of it) but it is universal.

Having all that in mind you have to remember that usage of temporary files to which you pass a path via XCOM does ensure the same level of resilience as XCOM itself (particularly if the file is stored on RAM disk). It also does not support replay of Tasks unless you keep the temp files indefinitely.


问:
Setting entitlements on executables
I am developing a macOS program based on the C language. I created a macOS wrapper app called MyApp.app which is supposed to execute the program. I want to sandbox the program and to give it permission to access only certain resources.

This is how I codesign the program and the wrapper app:

```<code>codesign -s MyCert -f --keychain login.keychain --timestamp --options=runtime --deep --entitlements ents.plist myprogram

codesign -s MyCert -f --keychain login.keychain --timestamp --options=runtime --deep --entitlements ents.plist MyApp.app
</code>```

Where ents.plist enables the com.apple.security.app-sandbox entitlement among others. The above commands don't report any errors. Then I check if sandboxing is really enabled on the app and it is on:

```<code>asctl sandbox check MyApp.app
/Users/Me/MyApp.app:
        signed with App Sandbox entitlements
</code>```

As for the binary program, I get an error:

```<code>asctl sandbox check myprogram
asctl: unable to resolve path for application "myprogram"
</code>```

If I run the program and check on the process, it gives me the following:

```<code>asctl sandbox check -p 16890
/Users/Me/myprogram:
        not signed with App Sandbox entitlements
        running without App Sandbox enabled
        running unsandboxed
</code>```

How is sandboxing supposed to be enabled on binary executable programs?

答:
In order to enable the App Sandbox for command line utilities – I assume that this is what you try to achieve – you do not need a wrapper application / application bundle. What you need is the information property list (Info.plist), which is usually located inside such an application bundle. However, the Info.plist can be embedded into the binary, which allows you to enable sandboxing for the binary directly.

First, you need to create the missing Info.plist file.

The second step depends on whether you are using Xcode or another build system:

If you are using Xcode, select the Info.plist at the Identity section of the General tab of your target configuration. In the Build Settings tab, under section Packaging, you need to enable Create Info.plist Section in Binary. Now you can add the App Sandbox capability in the Signing & Capabilities tab.

If you are using another build system, make sure that you pass
-sectcreate __TEXT __info_plist /path/to/Info.plist to the linker and embed the entitlements as described in the question – including the sandbox entitlement (com.apple.security.app-sandbox).

That's it – your command line utility should now be sandboxed.

In order to check whether the Info.plist is embedded correctly into the binary, you can display the embedded contents with the following sequence of commands:

objdump -m -section=__info_plist -s /path/to/binary | sed '1,/Contents of (/d'
```

Title: Setting entitlements on executables

Body:
I am developing a macOS program based on the C language. I created a macOS wrapper app called MyApp.app which is supposed to execute the program. I want to sandbox the program and to give it permission to access only certain resources.

This is how I codesign the program and the wrapper app:

codesign -s MyCert -f --keychain login.keychain --timestamp --options=runtime --deep --entitlements ents.plist myprogram

codesign -s MyCert -f --keychain login.keychain --timestamp --options=runtime --deep --entitlements ents.plist MyApp.app

Where ents.plist enables the com.apple.security.app-sandbox entitlement among others. The above commands don't report any errors. Then I check if sandboxing is really enabled on the app and it is on:

asctl sandbox check MyApp.app
/Users/Me/MyApp.app:
        signed with App Sandbox entitlements

As for the binary program, I get an error:

asctl sandbox check myprogram
asctl: unable to resolve path for application "myprogram"

If I run the program and check on the process, it gives me the following:

asctl sandbox check -p 16890
/Users/Me/myprogram:
        not signed with App Sandbox entitlements
        running without App Sandbox enabled
        running unsandboxed

How is sandboxing supposed to be enabled on binary executable programs?


问:
What will the code below output to the console and what is the reason?
This is an interview question and I'm very curious about the answer.</p>

```<code>var myObject = {
    foo: "bar",
    func: function() {
        var self = this;
        console.log("outer func:  this.foo = " + this.foo);
        console.log("outer func:  self.foo = " + self.foo);
        (function() {
            console.log("inner func:  this.foo = " + this.foo);
            console.log("inner func:  self.foo = " + self.foo);
        }());
    }
};
myObject.func();
</code>```

答:
Output will be:

```<code>outer func:  this.foo = bar
outer func:  self.foo = bar
inner func:  this.foo = undefined
inner func:  self.foo = bar
</code>```

Because IIFE(Immediately Invoked Function Expression) will be called in context of global object (window in browsers) so "this" will be global object inside IIFE and when you try to access "this.foo" inside IIFE it will return undefined because there is no property named foo in global object.

```<code>var xyz = "Hi There"
var myObject = {
    foo: "bar",
    func: function() {
        var self = this;
        console.log("outer func:  this.foo = " + this.foo);
        console.log("outer func:  self.foo = " + self.foo);
        (function() {
            console.log("inner func:  this.foo = " + this.foo);
            console.log("inner func:  this.xyz = " + this.xyz);
            console.log("inner func:  self.foo = " + self.foo);
            console.log("inner func:  this = " + this);
        }());
    }
};
myObject.func();
</code>```

The output for above code will be :

```<code>outer func:  this.foo = bar
outer func:  self.foo = bar
inner func:  this.foo = undefined
inner func:  this.xyz = Hi There
inner func:  self.foo = bar
inner func:  this = [object Window]
</code>```

You can learn more about IIFE from https://www.kirupa.com/html5/immediately_invoked_function_expressions_iife.htm

Body:
This is an interview question and I'm very curious about the answer.

var myObject = {
    foo: "bar",
    func: function() {
        var self = this;
        console.log("outer func:  this.foo = " + this.foo);
        console.log("outer func:  self.foo = " + self.foo);
        (function() {
            console.log("inner func:  this.foo = " + this.foo);
            console.log("inner func:  self.foo = " + self.foo);
        }());
    }
};
myObject.func();

Body:
Output will be:

outer func:  this.foo = bar
outer func:  self.foo = bar
inner func:  this.foo = undefined
inner func:  self.foo = bar

Because IIFE(Immediately Invoked Function Expression) will be called in context of global object (window in browsers) so "this" will be global object inside IIFE and when you try to access "this.foo" inside IIFE it will return undefined because there is no property named foo in global object.

var xyz = "Hi There"
var myObject = {
    foo: "bar",
    func: function() {
        var self = this;
        console.log("outer func:  this.foo = " + this.foo);
        console.log("outer func:  self.foo = " + self.foo);
        (function() {
            console.log("inner func:  this.foo = " + this.foo);
            console.log("inner func:  this.xyz = " + this.xyz);
            console.log("inner func:  self.foo = " + self.foo);
            console.log("inner func:  this = " + this);
        }());
    }
};
myObject.func();

The output for above code will be :

outer func:  this.foo = bar
outer func:  self.foo = bar
inner func:  this.foo = undefined
inner func:  this.xyz = Hi There
inner func:  self.foo = bar
inner func:  this = [object Window]

You can learn more about IIFE from https://www.kirupa.com/html5/immediately_invoked_function_expressions_iife.htm


问:
ViewPager doesn't scroll vertically when is inside a CoordinatorLayout
I'm making and android app where the main activity consists in a TabLayout and a ViewPager, a Floating action button is needed to start another activity, the problem is that when I add a CoordinatorLayout the ViewPager doesn't scroll (The viewPager contains 3 fragments one with a RecyclerView and the other two contains just textview with a lot of text, so all of them must scroll vertically.

The ViewPager works perfectly, but when I put it inside a CoordinatorLayout is not possible to do vertical scroll in any of the fragments loaded in the ViewPager.

I tried to add android:nestedScrollingEnabled="true" in every fragment root layout but it doesn't work.

EDIT:
All of the fragments loaded in the ViewPager have ScrollView as Root view.
This is my Main activity layout:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <androidx.coordinatorlayout.widget.CoordinatorLayout

        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:elevation="0dp"
            >

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

                />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/TabLayoutPrincipal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabIndicatorColor="@color/colorAccent"
                app:tabGravity="fill"
                app:tabMode="fixed"/>

            <androidx.viewpager.widget.ViewPager
                android:id="@+id/ViewPagerPrincipal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/white"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:nestedScrollingEnabled="true"
                />

        </com.google.android.material.appbar.AppBarLayout>

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/addShotFAB"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add_white_24dp"
            android:layout_gravity="bottom|end"
            android:layout_margin="16dp"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:menu="@menu/menu_drawer"/>

</androidx.drawerlayout.widget.DrawerLayout>
</code>```

This is what inside of the fragment with the RecyclerView:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:nestedScrollingEnabled="true">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/RecViewTomas"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

The another fragment:

```<code><?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:textSize="50sp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
            Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of  (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum,  comes from a line in section 1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham."/>

    </FrameLayout>

</ScrollView>
</code>```

答:
Solved doing these changes to the layout:

```<code>    <androidx.coordinatorlayout.widget.CoordinatorLayout

        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:elevation="0dp"
            >

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

                />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/TabLayoutPrincipal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabIndicatorColor="@color/colorAccent"
                app:tabGravity="fill"
                app:tabMode="fixed"/>

        </com.google.android.material.appbar.AppBarLayout>

        <androidx.viewpager.widget.ViewPager
            android:id="@+id/ViewPagerPrincipal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:nestedScrollingEnabled="true"
            />

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/addShotFAB"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add_white_24dp"
            android:layout_gravity="bottom|end"
            android:layout_margin="16dp"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:menu="@menu/menu_drawer"/>

</androidx.drawerlayout.widget.DrawerLayout>
</code>```

Body:
I'm making and android app where the main activity consists in a TabLayout and a ViewPager, a Floating action button is needed to start another activity, the problem is that when I add a CoordinatorLayout the ViewPager doesn't scroll (The viewPager contains 3 fragments one with a RecyclerView and the other two contains just textview with a lot of text, so all of them must scroll vertically.

The ViewPager works perfectly, but when I put it inside a CoordinatorLayout is not possible to do vertical scroll in any of the fragments loaded in the ViewPager.

I tried to add android:nestedScrollingEnabled="true" in every fragment root layout but it doesn't work.

EDIT:
All of the fragments loaded in the ViewPager have ScrollView as Root view.
This is my Main activity layout:

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <androidx.coordinatorlayout.widget.CoordinatorLayout

        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:elevation="0dp"
            >

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

                />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/TabLayoutPrincipal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabIndicatorColor="@color/colorAccent"
                app:tabGravity="fill"
                app:tabMode="fixed"/>

            <androidx.viewpager.widget.ViewPager
                android:id="@+id/ViewPagerPrincipal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/white"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:nestedScrollingEnabled="true"
                />

        </com.google.android.material.appbar.AppBarLayout>

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/addShotFAB"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add_white_24dp"
            android:layout_gravity="bottom|end"
            android:layout_margin="16dp"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:menu="@menu/menu_drawer"/>

</androidx.drawerlayout.widget.DrawerLayout>

This is what inside of the fragment with the RecyclerView:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:nestedScrollingEnabled="true">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/RecViewTomas"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

The another fragment:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:textSize="50sp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
            Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of  (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum,  comes from a line in section 1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham."/>

    </FrameLayout>

</ScrollView>

Body:
Solved doing these changes to the layout:

    <androidx.coordinatorlayout.widget.CoordinatorLayout

        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:elevation="0dp"
            >

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

                />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/TabLayoutPrincipal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabIndicatorColor="@color/colorAccent"
                app:tabGravity="fill"
                app:tabMode="fixed"/>

        </com.google.android.material.appbar.AppBarLayout>

        <androidx.viewpager.widget.ViewPager
            android:id="@+id/ViewPagerPrincipal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:nestedScrollingEnabled="true"
            />

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/addShotFAB"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add_white_24dp"
            android:layout_gravity="bottom|end"
            android:layout_margin="16dp"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:menu="@menu/menu_drawer"/>

</androidx.drawerlayout.widget.DrawerLayout>


问:
AngularJs : How to declare an app & multiple controllers, serves, etc, using an IFFE?
John Papa's famous Angular 1 Style Guide says to use IIFEs, to avoid the likes of  var myApp = angular.module('myApp',[]);
 and polluting the global namespace.

The example given is:

logger.js

```<code>(function() {
    'use strict';

    angular
        .module('app')
        .factory('logger', logger);

    function logger() { }
})();
</code>```

storage.js

```<code>(function() {
    'use strict';

    angular
        .module('app')
        .factory('storage', storage);

    function storage() { }
})();
</code>```

How does this work? Do I not need to declare the module at least once? E.g with angular.module('app',[]); (wrapped in an IIFE? (instead of var app = angular.module('app',[]); to avoid a global variable))?

However, the two usages of angular.module('app') in the example , do not declare, but will then evaluate angular.module('app') twice, which surely cannot be A Good Thing (in fact, I read a highly upvoted S.O. question earlier which said that this is A Bad Thing, and that there should be a single reference - but that would be a global, which is also A Bad Thing).

Which is it to be? Or can I declare my angular.module('app'), plus a few controllers, serves, factories, directives, in separate files, in separate IIFEs? If so, how?

答:
angular.module('app') without array as 2nd param is a getter, it is ok to use it multiple times.

To improve this you need some build tool, e.g. we use webpack (it will wrap everything into IIFE for u btw) and now it looks like this:

logger.js :

```<code>export default ['$log', function($log) {}]
</code>```

storage.js :

```<code>export default ['$http', function($http) {}]
</code>```

module.js :

```<code>import logger from './logger.js';
import storage from './storage.js';
angular
        .module('app')
        .factory('logger', logger)
        .factory('storage', storage);
</code>```

Body:
John Papa's famous Angular 1 Style Guide says to use IIFEs, to avoid the likes of  var myApp = angular.module('myApp',[]);
 and polluting the global namespace.

The example given is:

logger.js

(function() {
    'use strict';

    angular
        .module('app')
        .factory('logger', logger);

    function logger() { }
})();

storage.js

(function() {
    'use strict';

    angular
        .module('app')
        .factory('storage', storage);

    function storage() { }
})();

How does this work? Do I not need to declare the module at least once? E.g with angular.module('app',[]); (wrapped in an IIFE? (instead of var app = angular.module('app',[]); to avoid a global variable))?

However, the two usages of angular.module('app') in the example , do not declare, but will then evaluate angular.module('app') twice, which surely cannot be A Good Thing (in fact, I read a highly upvoted S.O. question earlier which said that this is A Bad Thing, and that there should be a single reference - but that would be a global, which is also A Bad Thing).

Which is it to be? Or can I declare my angular.module('app'), plus a few controllers, serves, factories, directives, in separate files, in separate IIFEs? If so, how?

Body:
angular.module('app') without array as 2nd param is a getter, it is ok to use it multiple times.

To improve this you need some build tool, e.g. we use webpack (it will wrap everything into IIFE for u btw) and now it looks like this:

logger.js :

export default ['$log', function($log) {}]

storage.js :

export default ['$http', function($http) {}]

module.js :

import logger from './logger.js';
import storage from './storage.js';
angular
        .module('app')
        .factory('logger', logger)
        .factory('storage', storage);


问:
C# how to check exact time difference in if condition
I have this if condition where I need to do some stuff if the difference is 15 min or so

```<code>if (DateTime.UtcNow - x.Timestamp == TimeSpan.FromMinutes(15))
{
    //Do something
}
</code>```

The above condition never satisfies when I check with == but when I do >= it gets into the condition but that's not what I need, I want 15 min or so difference.

Can someone explain this behavior?

Sample Data:

x = 2/17/2020 8:45:17 PM

答:
Can someone explain this behavior?

Yes: It is very unlikely that the elapsed time calculated from DateTime.Now is exactly equal to your specified TimeSpan.

From your comments, it seems that you want to periodically check if it's time to do something. One easy way to do this is to use a Stopwatch to keep track of the amount of time that has elapsed since the last time you did the thing:

```<code>using System;
using System.Diagnostics;
using System.Threading;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            throttleTimer.Start();

            // This loop simulates your periodic check to see if the action
            // needs to be performed:

            while (true)
            {
                doActionIfTimeElapsed(TimeSpan.FromSeconds(5));
                Thread.Sleep(1000);  // Simulate checking every 1 second or so.
            }
        }

        static Stopwatch throttleTimer = new Stopwatch();

        static void doActionIfTimeElapsed(TimeSpan period)
        {
            if (throttleTimer.Elapsed <= period)
                return;

            doAction();
            throttleTimer.Restart();
        }

        static void doAction()
        {
            Console.WriteLine("Doing the action.");
        }
    }
}
</code>```

This sample program will perform doAction() whenever you call doActionIfTimeElapsed() and more than 5 seconds has elapsed since the last time it called doAction().

Alternatively, if you want to perform an action after every N seconds without having to call a method to periodically check if the action should be performed, then you can use a System.Threading.Timer instead.

Body:
I have this if condition where I need to do some stuff if the difference is 15 min or so

if (DateTime.UtcNow - x.Timestamp == TimeSpan.FromMinutes(15))
{
    //Do something
}

The above condition never satisfies when I check with == but when I do >= it gets into the condition but that's not what I need, I want 15 min or so difference.

Can someone explain this behavior?

Sample Data:

x = 2/17/2020 8:45:17 PM

Body:
Can someone explain this behavior?

Yes: It is very unlikely that the elapsed time calculated from DateTime.Now is exactly equal to your specified TimeSpan.

From your comments, it seems that you want to periodically check if it's time to do something. One easy way to do this is to use a Stopwatch to keep track of the amount of time that has elapsed since the last time you did the thing:

using System;
using System.Diagnostics;
using System.Threading;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            throttleTimer.Start();

            // This loop simulates your periodic check to see if the action
            // needs to be performed:

            while (true)
            {
                doActionIfTimeElapsed(TimeSpan.FromSeconds(5));
                Thread.Sleep(1000);  // Simulate checking every 1 second or so.
            }
        }

        static Stopwatch throttleTimer = new Stopwatch();

        static void doActionIfTimeElapsed(TimeSpan period)
        {
            if (throttleTimer.Elapsed <= period)
                return;

            doAction();
            throttleTimer.Restart();
        }

        static void doAction()
        {
            Console.WriteLine("Doing the action.");
        }
    }
}

This sample program will perform doAction() whenever you call doActionIfTimeElapsed() and more than 5 seconds has elapsed since the last time it called doAction().

Alternatively, if you want to perform an action after every N seconds without having to call a method to periodically check if the action should be performed, then you can use a System.Threading.Timer instead.


问:
Datatables Multi Filter Same Column
I need to be able to apply multiple filters to a single column using datatables.

I've been looking at an example they have provided here but my requirements are slightly different.

The first column in my table will contain location information, each cell will contain a building name and floor. I want to have two dropdowns that allow users to filter on both of these.

So e.g. 'Show me Building 1 and Second Floor'.

I can get the first dropdown to filter on building, but the second doesn't filter on floor.  My current code is below, here's a codepen.

Note I have simplified this table and limited it to 6 records, my live table will contain hundreds of records.

$(document).ready(function() {
  var table = $("#example").DataTable();

  $("#dropdown1").on("change", function() {
    table
      .columns(0)
      .search(this.value)
      .draw();
  });
  $("#dropdown2").on("change", function() {
    table
      .columns(0)
      .search(this.value)
      .draw();
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet"/>
<select id="dropdown1">
  <option value="">Building</option>
  <option value="Building 1">Building 1</option>
  <option value="Building 2">Building 2</option>
</select>
<select id="dropdown2">
  <option value="">Floor</option>
  <option value="First Floor">First Floor</option>
  <option value="Second Floor">Second Floor</option>
  <option value="Third Floor">Third Floor</option>
</select>

<table id="example" class="display" cellspacing="0" width="100%">
  <thead>
    <tr>
      <th>Location</th>
      <th>Status</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Building 1<br><span class="floor">First Floor</span></td>
      <td>Available</td>
    </tr>
    <tr>
      <td>Building 1<br><span class="floor">Second Floor</span></td>
      <td>Available</td>
    </tr>
    <tr>
      <td>Building 1<br><span class="floor">Third Floor</span></td>
      <td>Available</td>
    </tr>
    <tr>
      <td>Building 2<br><span class="floor">First Floor</span></td>
      <td>Unavailable</td>
    </tr>
    <tr>
      <td>Building 2<br><span class="floor">Second Floor</span></td>
      <td>Available</td>
    </tr>
    <tr>
      <td>Building 2<br><span class="floor">Third Floor</span></td>
      <td>Unavailable</td>
    </tr>

  </tbody>
</table></code>```

答:
This works.

Create an array of the select elements, join them with a space and send them as one search term. Think DT has more on regex on their docs.

```<code><select class="filter_location" id="filter_building">
    <option value="">Building</option>
    <option value="Building 1">Building 1</option>
    <option value="Building 2">Building 2</option>
</select>

<select class="filter_location" id="filter_floor">
    <option value="First Floor">First Floor</option>
    <option value="Second Floor">Second Floor</option>
    <option value="Third Floor">Third Floor</option>
</select>

$('select.filter_location').on( 'change', function () {
    var val = [];
    val.push($('#filter_building').val());
    val.push($('#filter_floor').val());
    table.column(0).search(val.join(' ')).draw();
} );
</code>```

Title: Datatables Multi Filter Same Column

Body:
I need to be able to apply multiple filters to a single column using datatables.

I've been looking at an example they have provided here but my requirements are slightly different.

The first column in my table will contain location information, each cell will contain a building name and floor. I want to have two dropdowns that allow users to filter on both of these.

So e.g. 'Show me Building 1 and Second Floor'.

I can get the first dropdown to filter on building, but the second doesn't filter on floor.  My current code is below, here's a codepen.

Note I have simplified this table and limited it to 6 records, my live table will contain hundreds of records.

$(document).ready(function() {
  var table = $("#example").DataTable();

  $("#dropdown1").on("change", function() {
    table
      .columns(0)
      .search(this.value)
      .draw();
  });
  $("#dropdown2").on("change", function() {
    table
      .columns(0)
      .search(this.value)
      .draw();
  });
});

<link href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet"/>
<select id="dropdown1">
  <option value="">Building</option>
  <option value="Building 1">Building 1</option>
  <option value="Building 2">Building 2</option>
</select>
<select id="dropdown2">
  <option value="">Floor</option>
  <option value="First Floor">First Floor</option>
  <option value="Second Floor">Second Floor</option>
  <option value="Third Floor">Third Floor</option>
</select>

      Location
      Status

      Building 1
First Floor
      Available

      Building 1
Second Floor
      Available

      Building 1
Third Floor
      Available

      Building 2
First Floor
      Unavailable

      Building 2
Second Floor
      Available

      Building 2
Third Floor
      Unavailable

Body:
This works.

Create an array of the select elements, join them with a space and send them as one search term. Think DT has more on regex on their docs.

<select class="filter_location" id="filter_building">
    <option value="">Building</option>
    <option value="Building 1">Building 1</option>
    <option value="Building 2">Building 2</option>
</select>

<select class="filter_location" id="filter_floor">
    <option value="First Floor">First Floor</option>
    <option value="Second Floor">Second Floor</option>
    <option value="Third Floor">Third Floor</option>
</select>

$('select.filter_location').on( 'change', function () {
    var val = [];
    val.push($('#filter_building').val());
    val.push($('#filter_floor').val());
    table.column(0).search(val.join(' ')).draw();
} );


问:
Why is this simple multithreaded program freezing in eclipse - mingw32/gdb?
The program below keeps hanging/freezing in GDB 7.4 (MinGW32, Eclipse, Windows) absolutely randomly, estimating about every 5 or 6 runs. It is most easily found by mashing the debug button in eclipse and then checking the debug instances that haven't terminated. You can of course do the same thing by running it like a normal person and likely will get the same result quite soon.

The sample never freezes when not attached to GDB. Ever. I also could not expose the same issue under VC++ Express (it was a different sample but really just the same idea).

It hangs mostly around thread creation, thread deletion, and program termination. Also worth of note is that even though main returns -1 as exit code, when attached to GDB whenever the program doesn't freeze it exits with code 0.

Another interesting fact - when I uncomment the "Sleep(1)" call it stops hanging 80% of the time. When it does freeze however, it freezes after it prints "Return -1\n".
All other terminations continue to return 0 (except when ran w/o gdb).

Without further ado, the code:

```<code>#include <stdio.h>
#include <windows.h>
#include <process.h>

void __cdecl callback(void *arg)
{
    int count = 0;

    while(count < 10)
    {
        printf("Thread 2(%i): looping %i\n", (int)arg, count);
        count++;
    }

    printf("Ending thread...\n");
    _endthread();
}

int main(int argc, char *argv[])
{
    // Mingw32 on windows w/ eclipse - fix console output not showing up until the app terminates
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);

    bool runMain = true;

    int runCount = 0;

    while(runMain == true)
    {
        if(runCount == 5)
        {
            printf("Thread starting... ");
            int result = _beginthread(callback, 0, (void*)5);
//          Sleep(1);

            if(result == 0)
                printf("[FAILURE]\n");
            else
                printf("[SUCCESS]\n");
        }

        printf("Thread 1: %i\n", runCount);
        runCount++;

        if(runCount == 20)
            runMain = false;
    }

    printf("Return -1\n");
    return -1;
}
</code>```

What do you think is causing this, and more importantly - how do I fix it?

答:
There is no solution. There was a bug in GDB #17247 related.

Sending a SIGCONT signal to gdb or to your application makes it work again.

Try run this command next time:

```<code>killall -s SIGCONT <gdb | your application process name>
</code>```

or

```<code>kill -18 <gdb pid|application pid>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
The program below keeps hanging/freezing in GDB 7.4 (MinGW32, Eclipse, Windows) absolutely randomly, estimating about every 5 or 6 runs. It is most easily found by mashing the debug button in eclipse and then checking the debug instances that haven't terminated. You can of course do the same thing by running it like a normal person and likely will get the same result quite soon.

The sample never freezes when not attached to GDB. Ever. I also could not expose the same issue under VC++ Express (it was a different sample but really just the same idea).

It hangs mostly around thread creation, thread deletion, and program termination. Also worth of note is that even though main returns -1 as exit code, when attached to GDB whenever the program doesn't freeze it exits with code 0.

Another interesting fact - when I uncomment the "Sleep(1)" call it stops hanging 80% of the time. When it does freeze however, it freezes after it prints "Return -1\n".
All other terminations continue to return 0 (except when ran w/o gdb).

Without further ado, the code:

#include <stdio.h>
#include <windows.h>
#include <process.h>

void __cdecl callback(void *arg)
{
    int count = 0;

    while(count < 10)
    {
        printf("Thread 2(%i): looping %i\n", (int)arg, count);
        count++;
    }

    printf("Ending thread...\n");
    _endthread();
}

int main(int argc, char *argv[])
{
    // Mingw32 on windows w/ eclipse - fix console output not showing up until the app terminates
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);

    bool runMain = true;

    int runCount = 0;

    while(runMain == true)
    {
        if(runCount == 5)
        {
            printf("Thread starting... ");
            int result = _beginthread(callback, 0, (void*)5);
//          Sleep(1);

            if(result == 0)
                printf("[FAILURE]\n");
            else
                printf("[SUCCESS]\n");
        }

        printf("Thread 1: %i\n", runCount);
        runCount++;

        if(runCount == 20)
            runMain = false;
    }

    printf("Return -1\n");
    return -1;
}

What do you think is causing this, and more importantly - how do I fix it?

Body:
There is no solution. There was a bug in GDB #17247 related.

Sending a SIGCONT signal to gdb or to your application makes it work again.

Try run this command next time:

killall -s SIGCONT <gdb | your application process name>

or

kill -18 <gdb pid|application pid>


问:
http status code for an expired link?
guys which is the correct status code for a link that expires in a certain amount of time?

I have thought to send a 404 after the expiration but maybe there is a better http status to send.

Example of link:

mysite/dir/062011/file.exe (<- working only within 06-2011)

Thanks

答:
How about 410 "Gone"?

See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Title: http status code for an expired link?


问:
wso2, Configure the header to carry the Bearer token, not working
I am using wso2am-2.6.0 versrion and I would like to pass an existing bearer token which is different than the wso2 oauth token which wso2 is providing.

I followed the instructions given in this link:

Configure the header per API

Configuring the header for the entire organization

None of them solved my problem.

Providing the existing bearer token, after following the steps mentioned in the above link, the below is the response I am getting:

```<code>{
  "fault": {
    "code": 900901,
    "message": "Invalid Credentials",
    "description": "Access failure for API: /embargoQA/v1, version: v1 status: (900901) - Invalid Credentials. Make sure you have given the correct access token"
  }
}
</code>```

Any help would be appreciated.

答:
This issue is solved by doing couple of changes,

One on the api-manager.xml, un-commenting the RemoveOAuthHeadersFromOutMessage tag and making it "false" under   OAuthConfigurations as shown below,

```<code><OAuthConfigurations>
        <!-- Remove OAuth headers from outgoing message. -->
        <RemoveOAuthHeadersFromOutMessage>false</RemoveOAuthHeadersFromOutMessage>
        ..........
</OAuthConfigurations>
</code>```

Second is on the manage tab while publishing the API, Under the Resource section for the respective endpoint you have select "None" option instead of selecting "Application/Application User"

With this solution we need not add Authorization Header, as Token on the manage tab while publishing the API. After doing these changes while trying it out on the API Store you can provide your Bearer token on the field meant for it and provide the required inputs click execute it should work.

Body:
I am using wso2am-2.6.0 versrion and I would like to pass an existing bearer token which is different than the wso2 oauth token which wso2 is providing.

I followed the instructions given in this link:

Configure the header per API

Configuring the header for the entire organization

None of them solved my problem.

Providing the existing bearer token, after following the steps mentioned in the above link, the below is the response I am getting:

{
  "fault": {
    "code": 900901,
    "message": "Invalid Credentials",
    "description": "Access failure for API: /embargoQA/v1, version: v1 status: (900901) - Invalid Credentials. Make sure you have given the correct access token"
  }
}

Any help would be appreciated.

Body:
This issue is solved by doing couple of changes,

One on the api-manager.xml, un-commenting the RemoveOAuthHeadersFromOutMessage tag and making it "false" under   OAuthConfigurations as shown below,

<OAuthConfigurations>
        <!-- Remove OAuth headers from outgoing message. -->
        <RemoveOAuthHeadersFromOutMessage>false</RemoveOAuthHeadersFromOutMessage>
        ..........
</OAuthConfigurations>

Second is on the manage tab while publishing the API, Under the Resource section for the respective endpoint you have select "None" option instead of selecting "Application/Application User"

With this solution we need not add Authorization Header, as Token on the manage tab while publishing the API. After doing these changes while trying it out on the API Store you can provide your Bearer token on the field meant for it and provide the required inputs click execute it should work.


问:
Python Flask chunk data upload not working
I am trying to upload a large file (say ~1GB) from client (using Python request.post) to the flask server.

When client sends the request to server in chunks of 1024, server do not read the whole file and save to server 0kb.

Can you please help me in debugging what exactly I am mistaking here.

Server - Flask Code:

```<code>from flask import Flask, request, jsonify
from werkzeug.utils import secure_filename
import os

app = Flask(__name__)

app.config['UPLOAD_FOLDER'] = 'uploads/'

@app.route("/upload/<filename>", methods=["POST", "PUT"])
def upload_process(filename):
    filename = secure_filename(filename)
    fileFullPath = os.path.join(app.config['UPLOAD_FOLDER'], filename)

    with open(fileFullPath, "wb") as f:
        chunk_size = 1024
        chunk = request.stream.read(chunk_size)
        f.write(chunk)
    return jsonify({'filename': filename})

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=int("8080"),debug=True)
</code>```

Client - Request Code

```<code>import os
import requests

def read_in_chunks(file_object, chunk_size=1024):
    while True:
        data = file_object.read(chunk_size)
        if not data:
            break
        yield data

def main(fname, url):
    content_path = os.path.abspath(fname)
    with open(content_path, 'r') as f:
        try:
            r = requests.post(url, data=read_in_chunks(f))
            print "r: {0}".format(r)
        except Exception, e:
            print e

if __name__ == '__main__':
    filename = 'bigfile.zip'  # ~1GB
    url = 'http://localhost:8080/upload/{0}'.format(filename)
    main(filename, url)
</code>```

答:
This example below should work very well for you all. If you use Redis, you can also pub/sub the chunk being processed for progression bar in another API.</p>

```<code>from flask import Flask, request, jsonify
@app.route("/submit_vdo", methods=['POST'])
def submit_vdo():

@copy_current_request_context
def receive_chunk(stream, full_file_path):
    if full_file_path is None:
        tmpfile = tempfile.NamedTemporaryFile('wb+', prefix=str(uuid.uuid4())+"_")
        full_file_path = tmpfile.name

    print ('Write temp to ', full_file_path)
    with open(full_file_path, "wb") as f:
        max_chunk_size = settings.VIDEO_MAX_SIZE_CHUNK # config.MAX_UPLOAD_BYTE_LENGHT
        count_chunks = 0
        total_uploaded = 0
        try:
            while True:
                print ('Chunk ', count_chunks)
                chunk = stream.read(max_chunk_size)
                if chunk is not None and len(chunk)>0:
                    total_uploaded += len(chunk)
                    count_chunks += 1
                    f.write(chunk)
                    temp = {}
                    temp ['chunk_counts'] = count_chunks
                    temp ['total_bytes']  = total_uploaded
                    temp ['status'] = 'uploading...'
                    temp ['success'] = True
                    db_apn_logging.set(user_id+"@CHUNK_DOWNLOAD", json.dumps(temp), ex=5)
                    print (temp)
                else:
                    f.close()
                    temp = {}
                    temp ['chunk_counts'] = count_chunks
                    temp ['total_bytes']  = total_uploaded
                    temp ['status'] = 'DONE'
                    temp ['success'] = True
                    db_apn_logging.set(user_id+"@CHUNK_DOWNLOAD", json.dumps(temp), ex=5)
                    break
        except Exception as e:
            temp = {}
            temp ['chunk_counts'] = count_chunks
            temp ['total_bytes']  = total_uploaded
            temp ['status'] = e
            temp ['success'] = False
            db_apn_logging.set(user_id+"@CHUNK_DOWNLOAD", json.dumps(temp), ex=5)
            return  None

        return full_file_path

    stream = flask.request.files['file']
    stream.seek(0)
    full_file_path = receive_chunk(stream, full_file_path)

    return "DONE !"
</code>```

Body:
I am trying to upload a large file (say ~1GB) from client (using Python request.post) to the flask server.

When client sends the request to server in chunks of 1024, server do not read the whole file and save to server 0kb.

Can you please help me in debugging what exactly I am mistaking here.

Server - Flask Code:

from flask import Flask, request, jsonify
from werkzeug.utils import secure_filename
import os

app = Flask(__name__)

app.config['UPLOAD_FOLDER'] = 'uploads/'

@app.route("/upload/<filename>", methods=["POST", "PUT"])
def upload_process(filename):
    filename = secure_filename(filename)
    fileFullPath = os.path.join(app.config['UPLOAD_FOLDER'], filename)

    with open(fileFullPath, "wb") as f:
        chunk_size = 1024
        chunk = request.stream.read(chunk_size)
        f.write(chunk)
    return jsonify({'filename': filename})

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=int("8080"),debug=True)

Client - Request Code

import os
import requests

def read_in_chunks(file_object, chunk_size=1024):
    while True:
        data = file_object.read(chunk_size)
        if not data:
            break
        yield data

def main(fname, url):
    content_path = os.path.abspath(fname)
    with open(content_path, 'r') as f:
        try:
            r = requests.post(url, data=read_in_chunks(f))
            print "r: {0}".format(r)
        except Exception, e:
            print e

if __name__ == '__main__':
    filename = 'bigfile.zip'  # ~1GB
    url = 'http://localhost:8080/upload/{0}'.format(filename)
    main(filename, url)

Body:
This example below should work very well for you all. If you use Redis, you can also pub/sub the chunk being processed for progression bar in another API.

from flask import Flask, request, jsonify
@app.route("/submit_vdo", methods=['POST'])
def submit_vdo():

@copy_current_request_context
def receive_chunk(stream, full_file_path):
    if full_file_path is None:
        tmpfile = tempfile.NamedTemporaryFile('wb+', prefix=str(uuid.uuid4())+"_")
        full_file_path = tmpfile.name

    print ('Write temp to ', full_file_path)
    with open(full_file_path, "wb") as f:
        max_chunk_size = settings.VIDEO_MAX_SIZE_CHUNK # config.MAX_UPLOAD_BYTE_LENGHT
        count_chunks = 0
        total_uploaded = 0
        try:
            while True:
                print ('Chunk ', count_chunks)
                chunk = stream.read(max_chunk_size)
                if chunk is not None and len(chunk)>0:
                    total_uploaded += len(chunk)
                    count_chunks += 1
                    f.write(chunk)
                    temp = {}
                    temp ['chunk_counts'] = count_chunks
                    temp ['total_bytes']  = total_uploaded
                    temp ['status'] = 'uploading...'
                    temp ['success'] = True
                    db_apn_logging.set(user_id+"@CHUNK_DOWNLOAD", json.dumps(temp), ex=5)
                    print (temp)
                else:
                    f.close()
                    temp = {}
                    temp ['chunk_counts'] = count_chunks
                    temp ['total_bytes']  = total_uploaded
                    temp ['status'] = 'DONE'
                    temp ['success'] = True
                    db_apn_logging.set(user_id+"@CHUNK_DOWNLOAD", json.dumps(temp), ex=5)
                    break
        except Exception as e:
            temp = {}
            temp ['chunk_counts'] = count_chunks
            temp ['total_bytes']  = total_uploaded
            temp ['status'] = e
            temp ['success'] = False
            db_apn_logging.set(user_id+"@CHUNK_DOWNLOAD", json.dumps(temp), ex=5)
            return  None

        return full_file_path

    stream = flask.request.files['file']
    stream.seek(0)
    full_file_path = receive_chunk(stream, full_file_path)

    return "DONE !"


问:
Flutter slider should scroll only when dragged with thumb bar
In my custom widgets, there are multiple components along with the scrolling of page. Whenever I accidentally touch nearby to a slider by, it is recognizing touch & changing the position to respective position. I need custom behavior so that Slider changes only when it is dragged with a thumb bar.

I tried by adding a gesture recognizer on top of the slider but gives the flicker effect of changing & resetting value. Is it possible so that Slider shouldn't react on touch other than drag?

```<code> GestureDetector(
        onHorizontalDragUpdate: (updateDetails) {
          print("On onHorizontalDragUpdate called");
          setState(() {
            _diffLevel = updateDetails.globalPosition.distance;
          });
        },
        onTap: (() {
          setState(() {
            _diffLevel = _diffLevel;
          });
          print("On Tap called");
        }),
        child: Slider.adaptive(
              value: _diffLevel.toDouble(),
              activeColor: MyColors.appMediumBlueColor(),
              //inactiveColor: Colors.purple,
              onChanged: (double newValue) {
                setState(() {
                  _diffLevel = newValue;
                });
              },
              min: widget.minLevel,
              max: widget.maxLevel,
              divisions: widget.divisions,
              label: _diffLevel.toString(),
            ),
      )
</code>```

Expected Result :

Actual result:

答: I haven't analysed your code yet, but is there any reason no to use https://pub.dev/packages/flutter_range_slider ?

Body:
In my custom widgets, there are multiple components along with the scrolling of page. Whenever I accidentally touch nearby to a slider by, it is recognizing touch & changing the position to respective position. I need custom behavior so that Slider changes only when it is dragged with a thumb bar.

I tried by adding a gesture recognizer on top of the slider but gives the flicker effect of changing & resetting value. Is it possible so that Slider shouldn't react on touch other than drag?

 GestureDetector(
        onHorizontalDragUpdate: (updateDetails) {
          print("On onHorizontalDragUpdate called");
          setState(() {
            _diffLevel = updateDetails.globalPosition.distance;
          });
        },
        onTap: (() {
          setState(() {
            _diffLevel = _diffLevel;
          });
          print("On Tap called");
        }),
        child: Slider.adaptive(
              value: _diffLevel.toDouble(),
              activeColor: MyColors.appMediumBlueColor(),
              //inactiveColor: Colors.purple,
              onChanged: (double newValue) {
                setState(() {
                  _diffLevel = newValue;
                });
              },
              min: widget.minLevel,
              max: widget.maxLevel,
              divisions: widget.divisions,
              label: _diffLevel.toString(),
            ),
      )

Expected Result :

Actual result:


问:
Scene7 publish based on time in AEM
So I have assets publishing based on date and flowing to Scene7, how can i do it using time as an input along with date. So basically if the date is 2020-02-17T16:30:00.000+05:30, I have a job which will publish the asset at particular date. But I want it to publish at that time itself and not wait for the job which runs midnight.</p>

答: What AEM version are you using? AEM already offers when to publish an asset. And, by default, publishing in AEM will publish to Dynamic Media.</p>

Title: Scene7 publish based on time in AEM


问:
Query separate collection in RavenDB Index (WHERE IN)
Using RavenDB v4.2 or higher, I want to setup an index that queries another collection. Basically, reproduce a WHERE IN clause in the mapping part of the index.

The models below represent two collections. Here each User has a collection of Device ID's:

class Device {
    public string Id { get; set; }
    public string Name { get; set; }
}

class User {
    public string Id { get; set; }
    public string BlogPostId { get; set; }
    public List<string> DeviceIds { get; set; }
}
```

<p>Now consider the following index as an example on what I'm trying to achieve:</p>

<pre class="lang-cs prettyprint-override"><code>public class DeviceIndex : AbstractIndexCreationTask<Device, DeviceIndex.Result>
{
    public class Result
    {
        public string Id { get; set; }
        public string DeviceName { get; set; }
        public bool HasUser { get; set; }
        public int UserCount { get; set; }
    }
    public DeviceIndex()
    {
        Map = devices => from d in devices
                         select new Result
                         {
                             Id = d.Id,
                             DeviceName = d.Name,

                             HasUser = ... ?, // How to get this from Users collection?
                             UserCount = ... ? // same...

                         };

    }
</code>```

How do I fill the HasUser true/false and UserCount properties in this index? E.g. how can I query the 'User' collection here?

Please note that this example is seriously simplified for brevity. I'm not so much interested in workarounds, or changing the logic behind it.

答:
As @Danielle mentioned you need to use a mutli-map-index and reduce the result.
Here is a working example

```<code>public class DeviceIndex : AbstractMultiMapIndexCreationTask<DeviceIndex.Result>
    {
        public class Result
        {
            public string Id { get; set; }
            public string DeviceName { get; set; }
            public bool HasUser { get; set; }
            public int UserCount { get; set; }
        }
        public DeviceIndex()
        {
            AddMap<User>(users => from u in users
                                  from deviceId in u.DeviceIds
                                  let d = LoadDocument<Device>(deviceId)
                                select new Result
                                {
                                    Id = d.Id,
                                    HasUser = true,
                                    UserCount = 1,
                                    DeviceName = d.Name,
                                });
            AddMap<Device>(devices => from d in devices
                                      select new Result
                                      {
                                          Id = d.Id,
                                          HasUser = false,
                                          UserCount = 0,
                                          DeviceName = d.Name,
                                      });

            Reduce = results => from result in results
                                group result by new { result.Id } into g
                                select new Result
                                {
                                    Id = g.First().Id,
                                    DeviceName = g.First().DeviceName,
                                    HasUser = g.Any(e => e.HasUser),
                                    UserCount = g.Sum(e => e.UserCount),
                                };

        }
    }
</code>```

and you can call it like this

```<code>var result = await _session.Query<DeviceIndex.Result, DeviceIndex>().ToListAsync();
</code>```

Body:
Using RavenDB v4.2 or higher, I want to setup an index that queries another collection. Basically, reproduce a WHERE IN clause in the mapping part of the index.

The models below represent two collections. Here each User has a collection of Device ID's:

class Device {
    public string Id { get; set; }
    public string Name { get; set; }
}

class User {
    public string Id { get; set; }
    public string BlogPostId { get; set; }
    public List<string> DeviceIds { get; set; }
}

Now consider the following index as an example on what I'm trying to achieve:

public class DeviceIndex : AbstractIndexCreationTask<Device, DeviceIndex.Result>
{
    public class Result
    {
        public string Id { get; set; }
        public string DeviceName { get; set; }
        public bool HasUser { get; set; }
        public int UserCount { get; set; }
    }
    public DeviceIndex()
    {
        Map = devices => from d in devices
                         select new Result
                         {
                             Id = d.Id,
                             DeviceName = d.Name,

                             HasUser = ... ?, // How to get this from Users collection?
                             UserCount = ... ? // same...

                         };

    }

How do I fill the HasUser true/false and UserCount properties in this index? E.g. how can I query the 'User' collection here?

Please note that this example is seriously simplified for brevity. I'm not so much interested in workarounds, or changing the logic behind it.

Body:
As @Danielle mentioned you need to use a mutli-map-index and reduce the result.
Here is a working example

public class DeviceIndex : AbstractMultiMapIndexCreationTask<DeviceIndex.Result>
    {
        public class Result
        {
            public string Id { get; set; }
            public string DeviceName { get; set; }
            public bool HasUser { get; set; }
            public int UserCount { get; set; }
        }
        public DeviceIndex()
        {
            AddMap<User>(users => from u in users
                                  from deviceId in u.DeviceIds
                                  let d = LoadDocument<Device>(deviceId)
                                select new Result
                                {
                                    Id = d.Id,
                                    HasUser = true,
                                    UserCount = 1,
                                    DeviceName = d.Name,
                                });
            AddMap<Device>(devices => from d in devices
                                      select new Result
                                      {
                                          Id = d.Id,
                                          HasUser = false,
                                          UserCount = 0,
                                          DeviceName = d.Name,
                                      });

            Reduce = results => from result in results
                                group result by new { result.Id } into g
                                select new Result
                                {
                                    Id = g.First().Id,
                                    DeviceName = g.First().DeviceName,
                                    HasUser = g.Any(e => e.HasUser),
                                    UserCount = g.Sum(e => e.UserCount),
                                };

        }
    }

and you can call it like this

var result = await _session.Query<DeviceIndex.Result, DeviceIndex>().ToListAsync();