问:
How To Get total size of findItems Using EWS Managed API?
I want to get total size of all items using EWS findItems aqs or search-filter.Is there any way?

```<code>            <m:ResponseMessages>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder IndexedPagingOffset="10" TotalItemsInView="22438" IncludesLastItemInRange="false">
                        <t:Items>

                        </t:Items>
                    </m:RootFolder>
                </m:FindItemResponseMessage>
            </m:ResponseMessages>
</code>```

Is there any way to get "TotalSizeInView" like "TotalItemsInView"?

Body:
I want to get total size of all items using EWS findItems aqs or search-filter.Is there any way?

            <m:ResponseMessages>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder IndexedPagingOffset="10" TotalItemsInView="22438" IncludesLastItemInRange="false">
                        <t:Items>

                        </t:Items>
                    </m:RootFolder>
                </m:FindItemResponseMessage>
            </m:ResponseMessages>

Is there any way to get "TotalSizeInView" like "TotalItemsInView"?


来源: stackexchange

问:
Wikidata COUNT(*) query times out
I have a straightforward query that counts how many humans have an English Wikipedia page.

```<code>prefix schema: <http://schema.org/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>

SELECT ?item ?article
WHERE
{
  ?item wdt:P31 wd:Q5 . # Must be of a human
  ?article schema:about ?item ; # Must have a Wikipedia article
           schema:inLanguage "en" ; # Article must be in English
           schema:isPartOf <https://en.wikipedia.org/> . # Wikipedia article must be regular article
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } # Helps get the label in your language, if not, then en language
}
</code>```

I get expected output as follows:

```<code> wd:Q11124  <https://en.wikipedia.org/wiki/Stephen_Breyer>
 wd:Q10727  <https://en.wikipedia.org/wiki/Steve_Leo_Beleck>
 wd:Q10065  <https://en.wikipedia.org/wiki/Taichang_Emperor>
 wd:Q9605   <https://en.wikipedia.org/wiki/Sarah_Allen_(software_developer)>
</code>```

However, if I change the SELECT statement from

SELECT ?item ?article
```
<p>to</p>
<pre class="lang-sql prettyprint-override"><code>SELECT (count(?item) as ?count)
</code>```

I get timeout error. Please note that the count statement works if I only specify "human" condition and exclude English Wiki article condition. So, clearly, some kind of background join is causing the query to timeout.

However, this is a fairly trivial join, so the query timeout is surprising.

Please let me know what may I be missing here.

Thanks!

ContentLicense: CC BY-SA 4.0

Title: Wikidata COUNT(*) query times out

Body:
I have a straightforward query that counts how many humans have an English Wikipedia page.

prefix schema: <http://schema.org/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>

SELECT ?item ?article
WHERE
{
  ?item wdt:P31 wd:Q5 . # Must be of a human
  ?article schema:about ?item ; # Must have a Wikipedia article
           schema:inLanguage "en" ; # Article must be in English
           schema:isPartOf <https://en.wikipedia.org/> . # Wikipedia article must be regular article
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } # Helps get the label in your language, if not, then en language
}

I get expected output as follows:

 wd:Q11124  <https://en.wikipedia.org/wiki/Stephen_Breyer>
 wd:Q10727  <https://en.wikipedia.org/wiki/Steve_Leo_Beleck>
 wd:Q10065  <https://en.wikipedia.org/wiki/Taichang_Emperor>
 wd:Q9605   <https://en.wikipedia.org/wiki/Sarah_Allen_(software_developer)>

However, if I change the SELECT statement from

SELECT ?item ?article

to

SELECT (count(?item) as ?count)

I get timeout error. Please note that the count statement works if I only specify "human" condition and exclude English Wiki article condition. So, clearly, some kind of background join is causing the query to timeout.

However, this is a fairly trivial join, so the query timeout is surprising.

Please let me know what may I be missing here.

Thanks!


问:
How to change dynamic resource based on date on fullcalendar timeline view?
I use driver name as resource dynamically from database.
This is the output.

Driver name will be displayed based on how many event they have even if it is on different date. How to make driver name only be displayed when they have event on that particular date only and change accordingly? Is it possible to do? I tried to use GROUP BY driver name on SQL but it will only show one event that they have.


问:
Imagenet ILSVRC2013 submission failed
Recently, i have submitted classification challenge on imagenet ILSVRC2013

Unfortunately, i received an email like this:

Dear participant,

We received your submission at 2022-12-14 01:39:08 for the classification challenge.
However, it was found that your submission did not conform to the specifications we mentioned. We were therefore unable to evaluate your submission. Please read the ILSVRC 2013 page for more details.

ILSVRC 2013 team

The contents of my submission file are as follows, including 100,000 rows of data

`771 778 794 387 650

363 691 764 923 427

737 369 430 531 124`

Want to know where my submission went wrong.
Any help is greatly appreciated！

Title: Imagenet ILSVRC2013 submission failed


问:
(React-Native) Set Cookie doesn't work in IOS, but perfectly on Android
Problems

I'm using react-native for our current services, and we are sending cookies to our webpage to send information which is needed to seen in our webview. These process is working PERFECTLY in android devices, but not in IOS. (The most annoying thing is set-cookie works sometimes in IOS in same condition. It just randomly succeeded, and I cannot find the reason why.)

How To Reprouce
First of all, these are the stacks we are currently using.

Application: React-Native

Webview: react-native-webview (https://github.com/react-native-webview/react-native-webview)

Cookie: @react-native-cookies/cookies (https://github.com/react-native-cookies/cookies)

Webpage: React (Already deployed in AWS)

Cookie: react-cookie (useCookie)

And the following is our process we are currently doing.

If the user clicks a button (I will call this button as 'Apply' button), it navigates to screen that includes <WebView />

This is a abstract of our webview screen code (For our security issue, I just abstracted and changed some code for it, so if you think more information for our code, please let me know.)

Rendering Page
enter image description here

WebView Component
enter image description here

Send Cookie
enter image description here

Send Cookie Function
enter image description here
(This function is kinda messy bc this is a collective code from 3 files, and I tried my best to set cookie differently with android. (The same logic with android doesn't work in IOS))

Webpage (Launched in AWS)
enter image description here

I Want My Code To Do This
I want my code to send cookie in loading state, and after loading, when the webview rendered, the webpage get some cookie and based on that cookie, it shows some data.

It PERFECTLY works on Android, but not in IOS. It works randomly in IOS so I have no idea what the heck is wrong with this code and hard to define a problem.

I tried...

Someone said to me to add '.' infront of domain. It worked for the very first time, but after the second trial, it starts to not working again

I also tried clear all cookie data before set cookie using

```<code> await CookieManager.clearAll();
</code>```

, but it works same as the first measure I tried.

I also tried to use webkit. I send all true arguments to use webkit while using cookiemanager, but it has no effect.

I expected to do...

As I write in the above, I hope the cookie is rightly set in both android and ios environment, perfectly works in both platform.

Body:
Problems

I'm using react-native for our current services, and we are sending cookies to our webpage to send information which is needed to seen in our webview. These process is working PERFECTLY in android devices, but not in IOS. (The most annoying thing is set-cookie works sometimes in IOS in same condition. It just randomly succeeded, and I cannot find the reason why.)

How To Reprouce
First of all, these are the stacks we are currently using.

Application: React-Native

Webview: react-native-webview (https://github.com/react-native-webview/react-native-webview)

Cookie: @react-native-cookies/cookies (https://github.com/react-native-cookies/cookies)

Webpage: React (Already deployed in AWS)

Cookie: react-cookie (useCookie)

And the following is our process we are currently doing.

If the user clicks a button (I will call this button as 'Apply' button), it navigates to screen that includes <WebView />

This is a abstract of our webview screen code (For our security issue, I just abstracted and changed some code for it, so if you think more information for our code, please let me know.)

Rendering Page
enter image description here

WebView Component
enter image description here

Send Cookie
enter image description here

Send Cookie Function
enter image description here
(This function is kinda messy bc this is a collective code from 3 files, and I tried my best to set cookie differently with android. (The same logic with android doesn't work in IOS))

Webpage (Launched in AWS)
enter image description here

I Want My Code To Do This
I want my code to send cookie in loading state, and after loading, when the webview rendered, the webpage get some cookie and based on that cookie, it shows some data.

It PERFECTLY works on Android, but not in IOS. It works randomly in IOS so I have no idea what the heck is wrong with this code and hard to define a problem.

I tried...

Someone said to me to add '.' infront of domain. It worked for the very first time, but after the second trial, it starts to not working again

I also tried clear all cookie data before set cookie using

 await CookieManager.clearAll();

, but it works same as the first measure I tried.

I also tried to use webkit. I send all true arguments to use webkit while using cookiemanager, but it has no effect.

I expected to do...

As I write in the above, I hope the cookie is rightly set in both android and ios environment, perfectly works in both platform.


问:
In the following image, what can you conclude about Cache associativy?

In this image, I know that block size is 2^4 words and there are 2^8 blocks. But how can I know that cache is direct-mapped or not and total cache capacity?


问:
UIScrollView with custom paging size don't allow clickable buttons
I'm trying to create a scrollview with paging that is smaller than the screen size to snap between the buttons in my scrollview. After much headache and searching I found a solution to create the custom paging size explained below. The problem is the buttons inside my scrollview aren't clickable because the hitTest is overriding it?

This answer solves half the problem https://stackoverflow.com/a/6948934/12264367 ... the code works to create the snapping effect but my buttons aren't clickable I'm guessing because the hitTest but I'm not sure how to fix that?

```<code>-(UIView *) hitTest:(CGPoint) point withEvent:(UIEvent *)event
{
    UIView* child = [super hitTest:point withEvent:event];
    if (child == self && self.subviews.count > 0)
    {
        return self.subviews[0];
    }
    return child;
}
</code>```

Body:
I'm trying to create a scrollview with paging that is smaller than the screen size to snap between the buttons in my scrollview. After much headache and searching I found a solution to create the custom paging size explained below. The problem is the buttons inside my scrollview aren't clickable because the hitTest is overriding it?

This answer solves half the problem https://stackoverflow.com/a/6948934/12264367 ... the code works to create the snapping effect but my buttons aren't clickable I'm guessing because the hitTest but I'm not sure how to fix that?

-(UIView *) hitTest:(CGPoint) point withEvent:(UIEvent *)event
{
    UIView* child = [super hitTest:point withEvent:event];
    if (child == self && self.subviews.count > 0)
    {
        return self.subviews[0];
    }
    return child;
}


问:
Redis REPLICA sync: What causes "Partial Resynchronization accepted" vs. "Finished with success"?
When I run systemctl status on redis service, why do I at times see status as "Finished with success" and at times "Partial Resynchronization accepted". Why/when do we get partial resynchronization?

```<code>Status: "MASTER <-> REPLICA sync: Finished with success. Ready to accept connections in read-write mode."
</code>```

vs

```<code>Status: "MASTER <-> REPLICA sync: Partial Resynchronization accepted. Ready to accept connections in read-write mode."
</code>```

Tried bouncing redis process and it started showing "Finished with success" once but not other times.

Body:
When I run systemctl status on redis service, why do I at times see status as "Finished with success" and at times "Partial Resynchronization accepted". Why/when do we get partial resynchronization?

Status: "MASTER <-> REPLICA sync: Finished with success. Ready to accept connections in read-write mode."

vs

Status: "MASTER <-> REPLICA sync: Partial Resynchronization accepted. Ready to accept connections in read-write mode."

Tried bouncing redis process and it started showing "Finished with success" once but not other times.


问:
I'm trying to calculate the appetizers price from PreferenceData with the main meal but when I press add to cart only meal price calculate
here is my code using context hook to add the meal to cart and calculate its price

```<code>const CartStateContext = createContext();
const CartDispatchContext = createContext();

const initialState = {
    products: restaurantMenu.flatMap(({ menu }) => menu),
    cart: [],
};

const reducer = (state = initialState, action)=>{
    switch(action.type){
        case 'ADD':
            const item = state.products.find(
                (product) => product.id === action.payload.id
            );
            // Check if Item is in cart already
            const inCart = state.cart.find((item) =>
                item.id === action.payload.id ? true : false
            );

            return {
            ...state,
            cart: inCart
                ? state.cart.map((item) =>
                    item.id === action.payload.id
                    ? { ...item, qty: item.qty + 1 }
                    : item
                )
                : [...state.cart, { ...item, qty: 1 }],
            };

        case 'DELETE':
            return {
                ...state,
                cart: state.cart.filter((item) => item.id !== action.payload.id),
            };

        case 'INCREASE':
            const tempCart = state.cart.map((cartItem) => {
                if (cartItem.id === action.payLoad.id) {
                    return { ...cartItem, qty: cartItem.qty + 1 };
                }
                return cartItem;
            });
            return { ...state, cart: tempCart };

        case 'DECREASE':
            const temp = state.cart.map((cartItem) => {
                if (cartItem.id === action.payLoad.id) {
                    return { ...cartItem, qty: cartItem.qty - 1 };
                }
                return cartItem;
            })
            .filter((cartItem) => cartItem.qty !== 0);
            return { ...state, cart: temp };

        case 'CLEAR':
            return {cart :[]}

        default:
            throw new Error(`unknow action.${action.type}`)
    }

}

export const CartProvider =({children})=>{
    const [state, dispatch] = useReducer(reducer,initialState)
    return(
        <CartDispatchContext.Provider value={dispatch}>
        <CartStateContext.Provider value={state}>
            {children}
        </CartStateContext.Provider>

        </CartDispatchContext.Provider>
    )
}

export const useCart = ()=>useContext(CartStateContext);
export const useDispatch =()=> useContext(CartDispatchContext);
</code>```

Here is the code where I display the meal details with appetizer from dummydata

```<code>const OrderScreen= ({navigation, route})=>{

const {index,item} = route.params;
const [state,setState] = React.useState([])

const opacity = React.useRef(new Animated.Value(0)).current
const {dark} = useContext(ThemeContext)

{/*Change Basket Value*/}
const {cart} = useCart();
const [cartCount, setCartCount]=React.useState(0);

{/*Culcalate Total*/}
const [totalPrice, setTotalPrice] = React.useState(0);
const [totalItems, setTotalItems] = React.useState(0);

useEffect(() => {
    let items = 0;
    let price = 0;

    cart.forEach((item) => {
        items += item.qty;
        price += item.qty * item.price;
    });

    setTotalItems(items);
    setTotalPrice(price);
},);

useEffect(()=>{
    let count = 0;
    cart.forEach((item)=>{
        count +=item.qty;
    });
    setCartCount(count)
})

{/*Add Item to Cart*/}
const dispatch = useDispatch();
const addToCart = (item)=>{
    dispatch({type:'ADD', payload:item});
}

return(
    <Modal animationType='slide'>
        <View style={{flex:1,  backgroundColor: dark ? COLORS.darkColor : COLORS.gray3, }}>

        {/*Mini Meal Additional*/}
        {index.preferenceData.map(items=>(
            <View  style={{marginTop:SIZES.padding}}>
                <View style={styles.view7} key={items.id}>
                    <Text style={styles.text8}>{dummyData?.restaurantMenu[item].preferenceTitle[index.preferenceData.indexOf(items)]}</Text>

                    {
                        index.required[index.preferenceData.indexOf(items)] &&
                            <View style={styles.view9}>
                                <Text style={styles.text7}>{index.minimum[index.preferenceData.indexOf(items)]} REQUIRED</Text>
                            </View>
                    }

                </View>

                <View style={styles.view10}>
                    {items.map(item =>
                        <TouchableOpacity key={item.id}
                            onPress={()=>{
                                const id = index.preferenceData.indexOf(items)
                                if(index.minimum[id] !==null)
                                {
                                    const check = items.filter(item =>item.checked?item:null)
                                    index.preferenceData[id].forEach(i=>{
                                    if(i.id === item.id){
                                        if(check.length < index.minimum[id])
                                        {
                                        i.checked = !i.checked
                                        }
                                        else{
                                        i.checked = false
                                        }
                                    }
                                    })
                                    index.counter[id] = index.counter[id]+1
                                    setState({
                                        prefernce:[...index.preferenceData],
                                        counter:[...index.counter]
                                    })
                                } else{
                                    index.preferenceData[id].forEach(i=>{
                                        if(i.id===item.id){
                                            i.checked = !i.checked
                                        }
                                    })
                                    setState({preferenceData:[...state.preferenceData]})
                                }
                            }}
                            >
                            <View style={styles.view4}>
                                <View style={styles.view5}>
                                    <View style={styles.view6}>
                                        <CheckBox
                                        center
                                        checkedIcon='check-square-o'
                                        uncheckedIcon='square-o'
                                        checked={item.checked}
                                        checkedColor={COLORS.primary}
                                        />
                                        <Text style={styles.text5}>{item.name}</Text>
                                    </View>
                                    <Text style={styles.text6}>RM.{item.price.toFixed(2)}</Text>

                                </View>
                            </View>
                        </TouchableOpacity>

                    )}
                </View>
            </View>
        ))}
    </ScrollView>
</code>```

dummyData code

```<code>menu:[
    {
        id: 1,
        name: "Chicken Fajita",
        photo: images.Chicken_Fajita,
        description: "Grilled Chicken Breast, Onion, Bell Pepper, Fajita Sauce",
        price: 20.00,
        rating:3,
        reviews:89,
        preferenceData: [

            [{name:"Garlic Sauce",price:8.91,checked:false,id:0},{name:"Cocktail Sauce",price:8.75,checked:false ,id:1},{name:'Chili Sauce',price:11.99 ,checked:false,id:2},
            {name:'ketchip Sauce',price:11.99 ,checked:false,id:3},
            ],

            [{name:"7up",price:8.90 ,checked:false,id:0 },{name:"Fanta Orange",price:8.90 ,checked:false,id:1},{name:'Sprite',price:11.90,checked:false ,id:2},
            {name:'Dew',price:3.95 ,checked:false,id:3},{name:'100Plus',price:3.95 ,checked:false,id:4},{name:'Apple Juice',price:10.95 ,checked:false,id:5},
            {name:'Strawberry Shake',price:16.95 ,checked:false,id:6},{name:'Chocolate Shake',price:16.95 ,checked:false,id:7},
            ],

            [{name:"ٌRice",price:5.90,checked:false ,id:0},{name:"Shawarma",price:8.90,checked:false ,id:1},{name:'Mini Hummus',price:11.90,checked:false ,id:2},
            {name:'Lamb Arays',price:13.95 ,checked:false,id:3},{name:'Fine Cheese Kunafa',price:15.95 ,checked:false,id:4},{name:'Almond Basbousa',price:10.95,checked:false ,id:5},
            {name:'Mix Baklava Nuts',price:16.95,checked:false ,id:6},{name:'Mini Muhallibyah',price:11.95 ,checked:false,id:7},{name:'Beef Tekkah',price:16.95 ,checked:false,id:8},
            ],

        ],
        minimum:[2,1,2,null,null],
        counter:[0,0,0,0,0],
        required: [true,true,true,false,false],
    },
</code>```

from the dummyData I can only able to add the main meal like Chicken Fajita and calculate its price but when I tick any appetizer like Garlic Sauce I can't add it to cart and also I can't calculate its price too. so please do help me out.

Body:
here is my code using context hook to add the meal to cart and calculate its price

const CartStateContext = createContext();
const CartDispatchContext = createContext();

const initialState = {
    products: restaurantMenu.flatMap(({ menu }) => menu),
    cart: [],
};

const reducer = (state = initialState, action)=>{
    switch(action.type){
        case 'ADD':
            const item = state.products.find(
                (product) => product.id === action.payload.id
            );
            // Check if Item is in cart already
            const inCart = state.cart.find((item) =>
                item.id === action.payload.id ? true : false
            );

            return {
            ...state,
            cart: inCart
                ? state.cart.map((item) =>
                    item.id === action.payload.id
                    ? { ...item, qty: item.qty + 1 }
                    : item
                )
                : [...state.cart, { ...item, qty: 1 }],
            };

        case 'DELETE':
            return {
                ...state,
                cart: state.cart.filter((item) => item.id !== action.payload.id),
            };

        case 'INCREASE':
            const tempCart = state.cart.map((cartItem) => {
                if (cartItem.id === action.payLoad.id) {
                    return { ...cartItem, qty: cartItem.qty + 1 };
                }
                return cartItem;
            });
            return { ...state, cart: tempCart };

        case 'DECREASE':
            const temp = state.cart.map((cartItem) => {
                if (cartItem.id === action.payLoad.id) {
                    return { ...cartItem, qty: cartItem.qty - 1 };
                }
                return cartItem;
            })
            .filter((cartItem) => cartItem.qty !== 0);
            return { ...state, cart: temp };

        case 'CLEAR':
            return {cart :[]}

        default:
            throw new Error(`unknow action.${action.type}`)
    }

}

export const CartProvider =({children})=>{
    const [state, dispatch] = useReducer(reducer,initialState)
    return(
        <CartDispatchContext.Provider value={dispatch}>
        <CartStateContext.Provider value={state}>
            {children}
        </CartStateContext.Provider>

        </CartDispatchContext.Provider>
    )
}

export const useCart = ()=>useContext(CartStateContext);
export const useDispatch =()=> useContext(CartDispatchContext);

Here is the code where I display the meal details with appetizer from dummydata

const OrderScreen= ({navigation, route})=>{

const {index,item} = route.params;
const [state,setState] = React.useState([])

const opacity = React.useRef(new Animated.Value(0)).current
const {dark} = useContext(ThemeContext)

{/*Change Basket Value*/}
const {cart} = useCart();
const [cartCount, setCartCount]=React.useState(0);

{/*Culcalate Total*/}
const [totalPrice, setTotalPrice] = React.useState(0);
const [totalItems, setTotalItems] = React.useState(0);

useEffect(() => {
    let items = 0;
    let price = 0;

    cart.forEach((item) => {
        items += item.qty;
        price += item.qty * item.price;
    });

    setTotalItems(items);
    setTotalPrice(price);
},);

useEffect(()=>{
    let count = 0;
    cart.forEach((item)=>{
        count +=item.qty;
    });
    setCartCount(count)
})

{/*Add Item to Cart*/}
const dispatch = useDispatch();
const addToCart = (item)=>{
    dispatch({type:'ADD', payload:item});
}

return(
    <Modal animationType='slide'>
        <View style={{flex:1,  backgroundColor: dark ? COLORS.darkColor : COLORS.gray3, }}>

        {/*Mini Meal Additional*/}
        {index.preferenceData.map(items=>(
            <View  style={{marginTop:SIZES.padding}}>
                <View style={styles.view7} key={items.id}>
                    <Text style={styles.text8}>{dummyData?.restaurantMenu[item].preferenceTitle[index.preferenceData.indexOf(items)]}</Text>

                    {
                        index.required[index.preferenceData.indexOf(items)] &&
                            <View style={styles.view9}>
                                <Text style={styles.text7}>{index.minimum[index.preferenceData.indexOf(items)]} REQUIRED</Text>
                            </View>
                    }

                </View>

                <View style={styles.view10}>
                    {items.map(item =>
                        <TouchableOpacity key={item.id}
                            onPress={()=>{
                                const id = index.preferenceData.indexOf(items)
                                if(index.minimum[id] !==null)
                                {
                                    const check = items.filter(item =>item.checked?item:null)
                                    index.preferenceData[id].forEach(i=>{
                                    if(i.id === item.id){
                                        if(check.length < index.minimum[id])
                                        {
                                        i.checked = !i.checked
                                        }
                                        else{
                                        i.checked = false
                                        }
                                    }
                                    })
                                    index.counter[id] = index.counter[id]+1
                                    setState({
                                        prefernce:[...index.preferenceData],
                                        counter:[...index.counter]
                                    })
                                } else{
                                    index.preferenceData[id].forEach(i=>{
                                        if(i.id===item.id){
                                            i.checked = !i.checked
                                        }
                                    })
                                    setState({preferenceData:[...state.preferenceData]})
                                }
                            }}
                            >
                            <View style={styles.view4}>
                                <View style={styles.view5}>
                                    <View style={styles.view6}>
                                        <CheckBox
                                        center
                                        checkedIcon='check-square-o'
                                        uncheckedIcon='square-o'
                                        checked={item.checked}
                                        checkedColor={COLORS.primary}
                                        />
                                        <Text style={styles.text5}>{item.name}</Text>
                                    </View>
                                    <Text style={styles.text6}>RM.{item.price.toFixed(2)}</Text>

                                </View>
                            </View>
                        </TouchableOpacity>

                    )}
                </View>
            </View>
        ))}
    </ScrollView>

dummyData code

menu:[
    {
        id: 1,
        name: "Chicken Fajita",
        photo: images.Chicken_Fajita,
        description: "Grilled Chicken Breast, Onion, Bell Pepper, Fajita Sauce",
        price: 20.00,
        rating:3,
        reviews:89,
        preferenceData: [

            [{name:"Garlic Sauce",price:8.91,checked:false,id:0},{name:"Cocktail Sauce",price:8.75,checked:false ,id:1},{name:'Chili Sauce',price:11.99 ,checked:false,id:2},
            {name:'ketchip Sauce',price:11.99 ,checked:false,id:3},
            ],

            [{name:"7up",price:8.90 ,checked:false,id:0 },{name:"Fanta Orange",price:8.90 ,checked:false,id:1},{name:'Sprite',price:11.90,checked:false ,id:2},
            {name:'Dew',price:3.95 ,checked:false,id:3},{name:'100Plus',price:3.95 ,checked:false,id:4},{name:'Apple Juice',price:10.95 ,checked:false,id:5},
            {name:'Strawberry Shake',price:16.95 ,checked:false,id:6},{name:'Chocolate Shake',price:16.95 ,checked:false,id:7},
            ],

            [{name:"ٌRice",price:5.90,checked:false ,id:0},{name:"Shawarma",price:8.90,checked:false ,id:1},{name:'Mini Hummus',price:11.90,checked:false ,id:2},
            {name:'Lamb Arays',price:13.95 ,checked:false,id:3},{name:'Fine Cheese Kunafa',price:15.95 ,checked:false,id:4},{name:'Almond Basbousa',price:10.95,checked:false ,id:5},
            {name:'Mix Baklava Nuts',price:16.95,checked:false ,id:6},{name:'Mini Muhallibyah',price:11.95 ,checked:false,id:7},{name:'Beef Tekkah',price:16.95 ,checked:false,id:8},
            ],

        ],
        minimum:[2,1,2,null,null],
        counter:[0,0,0,0,0],
        required: [true,true,true,false,false],
    },

from the dummyData I can only able to add the main meal like Chicken Fajita and calculate its price but when I tick any appetizer like Garlic Sauce I can't add it to cart and also I can't calculate its price too. so please do help me out.


问:
Power BI Paginated Reports (SSRS) - How to Group Column Totals
I can't seem to figure out how to group this. I need to have these years (highlighted in yellow) grouped as a total by default so Forecast will only appear as one column containing each forecasted amount per project. I still need the Year and yyyyMM groups as child groups. Note: Sorry, I cant share the file as it's a live report containing financial values.

Below is the design

Below is my dataset

Thank you in advance!


问:
Cannot connect to individual Redis nodes? (To get the full list of keys pattern)
I have a Elasticache Redis cluster with three nodes in three Shards.

I got the "Configuration endpoint" of clustercfg.xyzxyz.r7x6.use1.cache.amazonaws.com (as the Host) from ElastiCache > Redis clusters > xyzxyz in AWS console, and created a newe database to the host using RedisInsight-v2 (v1.14.0).

However, the Host changed to xyzxyz-0002-001.xyzabc.r7x9.use1.cache.amazonaws.com after the database connection is saved? (it changed from ...-0001-001... back to ...-0002-001...)

I tried to set the host to xyzxyz-0001-001..... But it was changed to xyzxyz-0002-001.... once the database connection is saved?

I found that using the keys pattern* in the CLI, it only returns the keys of one node. I want to check all the hosts to get the full list of pattern*.

It seems the command line tool redis-cli can use --cluster call to run the command on individual nodes. How to do it using redisinsight-v2?

```<code>redis-cli --cluster call hostname:90001 KEYS "pattern*"
</code>```

Body:
I have a Elasticache Redis cluster with three nodes in three Shards.

I got the "Configuration endpoint" of clustercfg.xyzxyz.r7x6.use1.cache.amazonaws.com (as the Host) from ElastiCache > Redis clusters > xyzxyz in AWS console, and created a newe database to the host using RedisInsight-v2 (v1.14.0).

However, the Host changed to xyzxyz-0002-001.xyzabc.r7x9.use1.cache.amazonaws.com after the database connection is saved? (it changed from ...-0001-001... back to ...-0002-001...)

I tried to set the host to xyzxyz-0001-001..... But it was changed to xyzxyz-0002-001.... once the database connection is saved?

I found that using the keys pattern* in the CLI, it only returns the keys of one node. I want to check all the hosts to get the full list of pattern*.

It seems the command line tool redis-cli can use --cluster call to run the command on individual nodes. How to do it using redisinsight-v2?

redis-cli --cluster call hostname:90001 KEYS "pattern*"


问:
SendGrid API v3 using NodeJS @sendgrid/client - Call is Unauthorized / API Key is valid with full permissions
I'm really struggling with a problem where every call I make to the @sendgrid/client comes back unauthorized.  The exact same key can be used with @sendgrid/mail in the same code and it works fine.

I've tried everything but cannot get the NodeJS @sendgrid/client to work.  I've even tried a brand new API Key and still get unauthorized.

I'm trying to use the /suppressions API.  I can make the exact same call, with the same API key, in Postman and it works fine.

What am I doing wrong here?

Here is my code:

```<code>    sgApiKey = config.get('sendGrid_APIKey');
    sgClient.setApiKey(sgApiKey);

    const email = "test@abc.com";
    const headers = {
    "on-behalf-of": "The subuser's username. This header generates the API call as if the subuser account was making the call."
    };

    const request = {
        url: `/v3/asm/suppressions/global/${email}`,
        method: 'GET',
        headers: headers
    }

    sgClient.request(request)
    .then(([response, body]) => {
        console.log(response.statusCode);
        console.log(response.body);
    })
    .catch(error => {
        console.error(error);
    });

</code>```

I have tried creating a new API key with full permissions and it still does not work.

I'm expecting that my existing API key I already use for emailing should work to all the /suppression API.

Body:
I'm really struggling with a problem where every call I make to the @sendgrid/client comes back unauthorized.  The exact same key can be used with @sendgrid/mail in the same code and it works fine.

I've tried everything but cannot get the NodeJS @sendgrid/client to work.  I've even tried a brand new API Key and still get unauthorized.

I'm trying to use the /suppressions API.  I can make the exact same call, with the same API key, in Postman and it works fine.

What am I doing wrong here?

Here is my code:

    sgApiKey = config.get('sendGrid_APIKey');
    sgClient.setApiKey(sgApiKey);

    const email = "test@abc.com";
    const headers = {
    "on-behalf-of": "The subuser's username. This header generates the API call as if the subuser account was making the call."
    };

    const request = {
        url: `/v3/asm/suppressions/global/${email}`,
        method: 'GET',
        headers: headers
    }

    sgClient.request(request)
    .then(([response, body]) => {
        console.log(response.statusCode);
        console.log(response.body);
    })
    .catch(error => {
        console.error(error);
    });

I have tried creating a new API key with full permissions and it still does not work.

I'm expecting that my existing API key I already use for emailing should work to all the /suppression API.


问:
Can a space in jboss-deployment-structure.xml make the spring framework jdbc update failed?
here is my jboss-deployment-structure.xml
the original xml

My question is Does the space or the order of the tags in jboss-deployment-structure.xml can cause spring framework jdbc update failed?

With this xml, I exeucted the update and it didn't work. However, after I changed the xml with this one
the edited xml, the data I wanted  update into the Data Base were successfully updated.


问:
How to render a custom schema defined as a plugin into Universal Scene Description format?
I've been searching for how to add a new schema into USD.

I found that there is a framework for generating and definining a new schema given by Pixar, but I can't find a way to render the custom schema on usdview or Hydra renderer.

For example, if I define an image schema which is to display an image on a 3D scene thorough USD schema definition and locate built plugin into right location, then how should I tell either usdview or Hydra renderer render properly? Are there any other plugin frameworks, provided by Pixar, to read and process user defined schemas? I can't find any documentation about them. Maybe I misundertand USD system.

Thanks in advance.

I found that there is a way to define a new schema through tools provided by Pixar. (Generating New Schema Classes — Universal Scene Description 22.11 documentation)

However, I can't find any resources for developing plugins for rendering new schema types of USD.


问:
Check user Exist in AD group using python
I am new to python development, trying to convert PowerShell code to python.

I am looking for a python code to check user exists in AD domain . Equivalent to PowerShell command (dsquery user -name $username) . if account exists then get the user CanonicalName Properties.  Equivalent to PowerShell command (Get-ADUser $username -Properties * | Select CanonicalName). Thanks for your help.


问:
what this solution of job schedule
I scheduled a package to run daily at night 9.30 pm (the package is suppose to load the data on daily basis and the data will put in to backup
once the package is executed and It wont allow the previous day data) and It worked fine until Friday,
due to some server problem the package get failed on Saturday, and it worked fine on Sunday. My question is whether the data of Saturday
will be loaded in to database if yes how, if no means I want to load the Saturday data if it is
possible means, how will you load the Saturday data and where will you get the Saturday files.

Need return value

Title: what this solution of job schedule


问:
Get GitHub merged PR titles only using the GitHub API
I am using the GitHub API to get the merged PR's but the problem is that it is returning not only the title but also the comments, authors and other information. I don't want this extra information as it is making my program very slow. I am using The API in the following way:

```<code>return json.loads(
            get(
                f"https://github.com/api/v3/search/issues?q=repo:{org_repo}+merged:<{end_date}&page={page}&per_page={page_limit}",
                <username>,
                <token>,
            )
        )
</code>```

What do I need to do to request only the titles of the PR that were merged after a particular date? I looked for a filter but could not find one. I am manually filtering the title from the data I get back from the server. Please help. Thanks!

Body:
I am using the GitHub API to get the merged PR's but the problem is that it is returning not only the title but also the comments, authors and other information. I don't want this extra information as it is making my program very slow. I am using The API in the following way:

return json.loads(
            get(
                f"https://github.com/api/v3/search/issues?q=repo:{org_repo}+merged:<{end_date}&page={page}&per_page={page_limit}",
                <username>,
                <token>,
            )
        )

What do I need to do to request only the titles of the PR that were merged after a particular date? I looked for a filter but could not find one. I am manually filtering the title from the data I get back from the server. Please help. Thanks!


问:
Forge app for Jira can’t run because ‘experiment is not enabled’
I am a very beginner in Forge and JS, trying to run my app but can’t do because of that error:

```<code>File was processed with these loaders:
 * ../tunnel/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)
    at /tunnel/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js:54:11
    at Hook.eval [as call] (eval at create (/tunnel/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Hook.CALL_DELEGATE [as _call] (/tunnel/node_modules/tapable/lib/Hook.js:14:14)
    at JavascriptParser.walkAwaitExpression (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:2314:29)
    at JavascriptParser.walkExpression (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:2244:10)
    at JavascriptParser.walkVariableDeclaration (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:2098:33)
    at JavascriptParser.walkStatement (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:1592:10)
    at JavascriptParser.walkStatements (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:1453:9)
    at JavascriptParser.parse (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:3338:9)
    at /tunnel/node_modules/webpack/lib/NormalModule.js:1080:26
    at processResult (/tunnel/node_modules/webpack/lib/NormalModule.js:793:11)
    at /tunnel/node_modules/webpack/lib/NormalModule.js:853:5
    at /tunnel/node_modules/loader-runner/lib/LoaderRunner.js:406:3
    at iterateNormalLoaders (/tunnel/node_modules/loader-runner/lib/LoaderRunner.js:232:10)
    at iterateNormalLoaders (/tunnel/node_modules/loader-runner/lib/LoaderRunner.js:239:10)
    at /tunnel/node_modules/loader-runner/lib/LoaderRunner.js:254:3`
</code>```

I already found it’s needed to put this excerpt to webpack.config.js file

```<code>experiments: {
  topLevelAwait: true
}
</code>```

However, I can’t find this file.

What to do to make the app running?

Body:
I am a very beginner in Forge and JS, trying to run my app but can’t do because of that error:

File was processed with these loaders:
 * ../tunnel/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)
    at /tunnel/node_modules/webpack/lib/dependencies/HarmonyDetectionParserPlugin.js:54:11
    at Hook.eval [as call] (eval at create (/tunnel/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Hook.CALL_DELEGATE [as _call] (/tunnel/node_modules/tapable/lib/Hook.js:14:14)
    at JavascriptParser.walkAwaitExpression (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:2314:29)
    at JavascriptParser.walkExpression (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:2244:10)
    at JavascriptParser.walkVariableDeclaration (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:2098:33)
    at JavascriptParser.walkStatement (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:1592:10)
    at JavascriptParser.walkStatements (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:1453:9)
    at JavascriptParser.parse (/tunnel/node_modules/webpack/lib/javascript/JavascriptParser.js:3338:9)
    at /tunnel/node_modules/webpack/lib/NormalModule.js:1080:26
    at processResult (/tunnel/node_modules/webpack/lib/NormalModule.js:793:11)
    at /tunnel/node_modules/webpack/lib/NormalModule.js:853:5
    at /tunnel/node_modules/loader-runner/lib/LoaderRunner.js:406:3
    at iterateNormalLoaders (/tunnel/node_modules/loader-runner/lib/LoaderRunner.js:232:10)
    at iterateNormalLoaders (/tunnel/node_modules/loader-runner/lib/LoaderRunner.js:239:10)
    at /tunnel/node_modules/loader-runner/lib/LoaderRunner.js:254:3`

I already found it’s needed to put this excerpt to webpack.config.js file

experiments: {
  topLevelAwait: true
}

However, I can’t find this file.

What to do to make the app running?


问:
User Assigned Device Name entitlement still not working with NSExtension
Good day,

Previously, I have requested entitlement at User-Assigned Device Name Entitlement for my app ID.

After Apple approve, I do the follow steps: Tick the User-Assigned Device Name checkbox under Additional Capabilities tab in apple developer website for the identifier. Regenerate the Profile. Add the following value in Entitlements-Release.plist file: com.apple.developer.device-information.user-assigned-device-name

I able to generate the IOS app to testflight with the username device name enable, without NSExtension. Now the app can show the device name that define by user, instead of "Iphone".

However, my app needs to generate together with NSExtension, I am hitting error like follow in my Xcode:

"profile doesn't include the com.apple.developer.device-information.user-assigned-device-name entitlement."

Hence, I request entitlement for the NSExtension as well, after get approved from apple, I repeat the step 1 and step 2 for NSExtension. (No step 3 for NSExtension because no plist for this)

I expected the error will gone because my NSExtension profile already contains the entitlement. However, it's still the same.

May I know which steps I missing and how to fix this?

And I can see the following value under app profile download: com.apple.developer.device-information.user-assigned-device-name

But not NSExtension profile.

Please help on this, thanks.


问:
How to reliably trigger __del__ method of object?
I would like to reliably call the __del__ method of an object immediately when it gets deleted. I am aware that this has been asked for python 2, but the documentation of python 3 claims that the __del__ method is called when the reference count reaches 0. However, this does not seem to be the case with my program

```<code>import time

class MyClass:
    object_list = []
    def __init__(self):
        MyClass.object_list.append(self)
        print("object initialized")
    def __del__(self):
        print("executing cleanup steps")
        MyClass.object_list.remove(self)

a = MyClass()
b = MyClass()
c = MyClass()
print(len(MyClass.object_list))
del b
time.sleep(1)
print("sleep finished")
print(len(MyClass.object_list))
</code>```

Try it online

What I want to achieve is to remove b from the object_list immediately when it is destroyed and also make the variable b inaccessible. So simply calling b.__del__() is not enough, I would need to also render b inaccessible.

Note: running first b.__del__() and then del b will lead to complaints when exiting the python interpreter.

Interestingly enough, a very similar program seems to call b.__del__() immediately when del b is executed.

```<code>import time

class MyClass:
    counter = 0
    def __init__(self, value):
        self.value = value
        print("object initialized")
        MyClass.counter+=1
    def __del__(self):
        print("executing cleanup steps")
        MyClass.counter-=1

a = MyClass(5)
b = MyClass(6)
c = MyClass(7)
print(MyClass.counter)
del b
time.sleep(1)
print("sleep finished")
print(MyClass.counter)
</code>```

Try it online

EDIT

@Pranav Hosangadi pointed out that there is still a reference to the object in the object_list. What a shameful oversight of mine. Now I came up with a workaround by calling first b.__del__() and then del b, but it is a two step process. I would like to have it in one step, if possible.

```<code>import time

class MyClass:
    object_list = []
    def __init__(self, value):
        self.value = value
        MyClass.object_list.append(self)
        print("object initialized")
    def __del__(self):
        print("executing cleanup steps")
        try:
            MyClass.object_list.remove(self)
        except:
            pass

a = MyClass(1)
b = MyClass(2)
c = MyClass(3)
print(len(MyClass.object_list))
b.__del__()
del b
time.sleep(1)
print("sleep finished")
print(len(MyClass.object_list))
</code>```

Body:
I would like to reliably call the __del__ method of an object immediately when it gets deleted. I am aware that this has been asked for python 2, but the documentation of python 3 claims that the __del__ method is called when the reference count reaches 0. However, this does not seem to be the case with my program

import time

class MyClass:
    object_list = []
    def __init__(self):
        MyClass.object_list.append(self)
        print("object initialized")
    def __del__(self):
        print("executing cleanup steps")
        MyClass.object_list.remove(self)

a = MyClass()
b = MyClass()
c = MyClass()
print(len(MyClass.object_list))
del b
time.sleep(1)
print("sleep finished")
print(len(MyClass.object_list))

Try it online

What I want to achieve is to remove b from the object_list immediately when it is destroyed and also make the variable b inaccessible. So simply calling b.__del__() is not enough, I would need to also render b inaccessible.

Note: running first b.__del__() and then del b will lead to complaints when exiting the python interpreter.

Interestingly enough, a very similar program seems to call b.__del__() immediately when del b is executed.

import time

class MyClass:
    counter = 0
    def __init__(self, value):
        self.value = value
        print("object initialized")
        MyClass.counter+=1
    def __del__(self):
        print("executing cleanup steps")
        MyClass.counter-=1

a = MyClass(5)
b = MyClass(6)
c = MyClass(7)
print(MyClass.counter)
del b
time.sleep(1)
print("sleep finished")
print(MyClass.counter)

Try it online

EDIT

@Pranav Hosangadi pointed out that there is still a reference to the object in the object_list. What a shameful oversight of mine. Now I came up with a workaround by calling first b.__del__() and then del b, but it is a two step process. I would like to have it in one step, if possible.

import time

class MyClass:
    object_list = []
    def __init__(self, value):
        self.value = value
        MyClass.object_list.append(self)
        print("object initialized")
    def __del__(self):
        print("executing cleanup steps")
        try:
            MyClass.object_list.remove(self)
        except:
            pass

a = MyClass(1)
b = MyClass(2)
c = MyClass(3)
print(len(MyClass.object_list))
b.__del__()
del b
time.sleep(1)
print("sleep finished")
print(len(MyClass.object_list))


问:
How to redirect the std output of a C++ program into a file in VSCode on Mac OS by "launch.json"?
I'm trying to let the output of a C++ program to go into a file, say, "image.ppm". Actually, using the following launch.json file works pretty well on my Ubuntu 20.04.

{
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/raytracing",
        "args": [">image.ppm"],
        "postDebugTask": "open_image_linux",
        "stopAtEntry": false,
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "cwd": "${workspaceFolder}",
        // "preLaunchTask": "C/C++: g++ build active file",
        "preLaunchTask": "Build",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "Set Disassembly Flavor to Intel",
                "text": "-gdb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
    },
```
<p>When I try to implement a similar procedure on Mac OS, something wried happened, here is my new <code>launch.json</code> file:</p>
<pre class="lang-json prettyprint-override"><code>    {
        "name": "(lldb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/raytracing",
        "args": [">image.ppm"],
        "postDebugTask": "open_image_mac",
        "stopAtEntry": false,
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb",
        "cwd": "${workspaceFolder}",
        // "preLaunchTask": "C/C++: g++ build active file",
        "preLaunchTask": "Build",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for lldb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "Set Disassembly Flavor to Intel",
                "text": "-lldb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
    }
</code>```

As can be seen, I just changed the debugger from gdb to lldb since gdb doesn't natively support Apple Silicon right now. However, the image.ppm will not be created after the execution of the program, while the output of the program goes into the debug console, like this:

I think, intrinsically, "args": [">image.ppm"], should work, since it works smoothly on Linux. I guess the reason may be related to the different features of gdb and lldb. Since when I run the program in VSCode on Ubuntu, nothing will be shown in the debug console. But I don't know how could I solve this problem.

Body:
I'm trying to let the output of a C++ program to go into a file, say, "image.ppm". Actually, using the following launch.json file works pretty well on my Ubuntu 20.04.

{
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/raytracing",
        "args": [">image.ppm"],
        "postDebugTask": "open_image_linux",
        "stopAtEntry": false,
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "cwd": "${workspaceFolder}",
        // "preLaunchTask": "C/C++: g++ build active file",
        "preLaunchTask": "Build",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "Set Disassembly Flavor to Intel",
                "text": "-gdb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
    },

When I try to implement a similar procedure on Mac OS, something wried happened, here is my new launch.json file:

    {
        "name": "(lldb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/raytracing",
        "args": [">image.ppm"],
        "postDebugTask": "open_image_mac",
        "stopAtEntry": false,
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb",
        "cwd": "${workspaceFolder}",
        // "preLaunchTask": "C/C++: g++ build active file",
        "preLaunchTask": "Build",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for lldb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            },
            {
                "description": "Set Disassembly Flavor to Intel",
                "text": "-lldb-set disassembly-flavor intel",
                "ignoreFailures": true
            }
        ]
    }

As can be seen, I just changed the debugger from gdb to lldb since gdb doesn't natively support Apple Silicon right now. However, the image.ppm will not be created after the execution of the program, while the output of the program goes into the debug console, like this:

I think, intrinsically, "args": [">image.ppm"], should work, since it works smoothly on Linux. I guess the reason may be related to the different features of gdb and lldb. Since when I run the program in VSCode on Ubuntu, nothing will be shown in the debug console. But I don't know how could I solve this problem.


问:
node.js ERR_IMPORT_ASSERTION_TYPE_MISSING TypeError: Module tsconfig.json needs an import assertion of type "json"
```<code>{
    "extends": "../../tsconfig.json",
    "include": [
        "**/*.ts"
    ],
    "exclude": [
        "node_modules",
        "build"
    ],
    "compilerOptions": {
        "baseUrl": ".",
        "rootDir": ".",
        "outDir": "build/",
        "plugins": [
            {
                "name": "@rollup/plugin-typescript"
            },
            {
                "name": "@rollup/plugin-json"
            }
        ]
    }
}
</code>```

bumps into the following build error:

```<code>[!] TypeError: Module "file:///usr/src/Node.JSRestAPI/src/core/tsconfig.json" needs an import assertion of type "json"
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///usr/src/Node.JSRestAPI/src/core/tsconfig.json" needs an import assertion of type "json"
    at new NodeError (node:internal/errors:393:5)
    at validateAssertions (node:internal/modules/esm/assert:82:15)
    at defaultLoad (node:internal/modules/esm/load:84:3)
    at nextLoad (node:internal/modules/esm/loader:164:28)
    at ESMLoader.load (node:internal/modules/esm/loader:603:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:459:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at #createModuleJob (node:internal/modules/esm/loader:478:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:436:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:78:21)
</code>```

I have set "resolveJsonModule": true, in top-level tsconfig.json

Body:
{
    "extends": "../../tsconfig.json",
    "include": [
        "**/*.ts"
    ],
    "exclude": [
        "node_modules",
        "build"
    ],
    "compilerOptions": {
        "baseUrl": ".",
        "rootDir": ".",
        "outDir": "build/",
        "plugins": [
            {
                "name": "@rollup/plugin-typescript"
            },
            {
                "name": "@rollup/plugin-json"
            }
        ]
    }
}

bumps into the following build error:

[!] TypeError: Module "file:///usr/src/Node.JSRestAPI/src/core/tsconfig.json" needs an import assertion of type "json"
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///usr/src/Node.JSRestAPI/src/core/tsconfig.json" needs an import assertion of type "json"
    at new NodeError (node:internal/errors:393:5)
    at validateAssertions (node:internal/modules/esm/assert:82:15)
    at defaultLoad (node:internal/modules/esm/load:84:3)
    at nextLoad (node:internal/modules/esm/loader:164:28)
    at ESMLoader.load (node:internal/modules/esm/loader:603:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:459:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at #createModuleJob (node:internal/modules/esm/loader:478:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:436:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:78:21)

I have set "resolveJsonModule": true, in top-level tsconfig.json


问:
How to get around this long overflow error in a loop method with conditionals?
I am still learning my way around JS and have run into this issue that I cannot figure out. I have two sets of array of json objects that I have simplified as an example here. I wrote a method to basically compare the two and make sure the values match with each other. It looks like the following:

var actual = {
  "nameTag": "abc123",
  "number": "567553218",
  "hitDate": "2022-12-09"
};

var expected = {
  "nameTag": "abc123",
  "number": "567553218",
  "hitDate": "2022-12-09"
};

function matchVar(actual, expected) {
  var array = [];
  var now = new Date();
  var dateNow = new Date(now.getTime() + now.getTimezoneOffset() * 60000);

  for (key in actual) {
    var checkForMatch = false;
    var actualDate = Date.parse(actual[key]);
    if (isNaN(actualDate) || !(isNaN(actual[key]))) {
      if (expected.hasOwnProperty(key)) {
        var tempMatch = console.log("There is a match!");
      } else {
        continue;
      }
    } else {
      if (actualDate <= dateNow) {
        checkForMatch = true;
      } else {
        checkForMatch = false;
      }
    }
    array.push(checkForMatch);
  }
  return (array);
}

console.log(matchVar(actual, expected));```
</div>
</div>
</p>
<p>When I run the code here, it gives the correct result back. However, when I run on my local machine and/or on docker, I get the following error:</p>
```org.graalvm.polyglot.PolyglotException: java.lang.ArithmeticException: long overflow
- java.base/java.lang.Math.multiplyExact(Math.java:1004)
- java.base/java.lang.Math.multiplyExact(Math.java:980)
- java.base/java.time.Instant.toEpochMilli(Instant.java:1236)
- com.oracle.truffle.js.runtime.builtins.JSDate.makeDay(JSDate.java:502)
- com.oracle.truffle.js.runtime.builtins.JSDate.makeDate(JSDate.java:522)
- com.oracle.truffle.js.builtins.DateFunctionBuiltins$DateParseNode.parse(DateFunctionBuiltins.java:113)
- com.oracle.truffle.js.builtins.DateFunctionBuiltinsFactory$DateParseNodeGen.execute(DateFunctionBuiltinsFactory.java:51)
```

The error seems to be happening on the "number" key in the loop. Please advise.

Thank you in advance!

Body:
I am still learning my way around JS and have run into this issue that I cannot figure out. I have two sets of array of json objects that I have simplified as an example here. I wrote a method to basically compare the two and make sure the values match with each other. It looks like the following:

var actual = {
  "nameTag": "abc123",
  "number": "567553218",
  "hitDate": "2022-12-09"
};

var expected = {
  "nameTag": "abc123",
  "number": "567553218",
  "hitDate": "2022-12-09"
};

function matchVar(actual, expected) {
  var array = [];
  var now = new Date();
  var dateNow = new Date(now.getTime() + now.getTimezoneOffset() * 60000);

  for (key in actual) {
    var checkForMatch = false;
    var actualDate = Date.parse(actual[key]);
    if (isNaN(actualDate) || !(isNaN(actual[key]))) {
      if (expected.hasOwnProperty(key)) {
        var tempMatch = console.log("There is a match!");
      } else {
        continue;
      }
    } else {
      if (actualDate <= dateNow) {
        checkForMatch = true;
      } else {
        checkForMatch = false;
      }
    }
    array.push(checkForMatch);
  }
  return (array);
}

console.log(matchVar(actual, expected));

When I run the code here, it gives the correct result back. However, when I run on my local machine and/or on docker, I get the following error:

org.graalvm.polyglot.PolyglotException: java.lang.ArithmeticException: long overflow
- java.base/java.lang.Math.multiplyExact(Math.java:1004)
- java.base/java.lang.Math.multiplyExact(Math.java:980)
- java.base/java.time.Instant.toEpochMilli(Instant.java:1236)
- com.oracle.truffle.js.runtime.builtins.JSDate.makeDay(JSDate.java:502)
- com.oracle.truffle.js.runtime.builtins.JSDate.makeDate(JSDate.java:522)
- com.oracle.truffle.js.builtins.DateFunctionBuiltins$DateParseNode.parse(DateFunctionBuiltins.java:113)
- com.oracle.truffle.js.builtins.DateFunctionBuiltinsFactory$DateParseNodeGen.execute(DateFunctionBuiltinsFactory.java:51)

The error seems to be happening on the "number" key in the loop. Please advise.

Thank you in advance!


问:
How should I solve the function's problem?
I'm working on a project for my uni and I got stuck. First of all, these are the structures and #define that I use, and then below that are the two functions that I use:

```<code>#define NAME_SIZE           51
#define NATIONALITY_SIZE    20
#define SEX_SIZE            8
#define EVENT_SIZE          8
#define CHIEF_SIZE          5

typedef struct competitor
{
    int id;
    char name[NAME_SIZE];
    char nationality[NATIONALITY_SIZE];
    char sex[SEX_SIZE];
    double weight;
    char event[EVENT_SIZE];
}competitor;

typedef struct comp_ldata
{
    competitor data;
    struct comp_ldata* next;
}comp_ldata;

typedef struct referee
{
    int ref_id;
    char rname[NAME_SIZE];
    char nationality[NATIONALITY_SIZE];
    char chief[CHIEF_SIZE];
}ref;

typedef struct ref_ldata
{
    ref data;
    struct ref_ldata* next;
}ref_ldata;

bool ref_nationality(ref_ldata* sorted, char* ref_nat)
{
    bool status = false;

    ref_ldata* temp_s;
    temp_s = sorted->next;

    for(int i = 0 ; temp_s != NULL ; temp_s=temp_s->next)
    {
        if (strcmp(ref_nat , (temp_s->data).nationality) == 0)
            i++;

        if (i  >= 2)
        {
            status = true;
            return status;
        }
    }

    return status;
}
</code>```

I am stuck, although my program runs well, I don't know how to change the function. The ref_nationality function got 2 parameters, first is the sorted list and the referee's nationality. As you can see it will return a true value if it has been used more than two times and a false if not.
This function is a part of a bigger program and the concept is to draw the athletes and assign 7 judges to them. This function aim would be to have a maximum of 2 judges of the same nationality for each fight. So if in the first match there were two germans and two italians, in the second fight there could again be two Germans, two Italians etc...
However, as I have written, only two judges of the same nationality are allowed in total. What should I change to achieve the desired result?

Also sorry, I the sites didn't allow me to post more code because then I had to write more description but I didn't know what else to write. If the rest of the code is needed I will post it in the comments.

Body:
I'm working on a project for my uni and I got stuck. First of all, these are the structures and #define that I use, and then below that are the two functions that I use:

#define NAME_SIZE           51
#define NATIONALITY_SIZE    20
#define SEX_SIZE            8
#define EVENT_SIZE          8
#define CHIEF_SIZE          5

typedef struct competitor
{
    int id;
    char name[NAME_SIZE];
    char nationality[NATIONALITY_SIZE];
    char sex[SEX_SIZE];
    double weight;
    char event[EVENT_SIZE];
}competitor;

typedef struct comp_ldata
{
    competitor data;
    struct comp_ldata* next;
}comp_ldata;

typedef struct referee
{
    int ref_id;
    char rname[NAME_SIZE];
    char nationality[NATIONALITY_SIZE];
    char chief[CHIEF_SIZE];
}ref;

typedef struct ref_ldata
{
    ref data;
    struct ref_ldata* next;
}ref_ldata;

bool ref_nationality(ref_ldata* sorted, char* ref_nat)
{
    bool status = false;

    ref_ldata* temp_s;
    temp_s = sorted->next;

    for(int i = 0 ; temp_s != NULL ; temp_s=temp_s->next)
    {
        if (strcmp(ref_nat , (temp_s->data).nationality) == 0)
            i++;

        if (i  >= 2)
        {
            status = true;
            return status;
        }
    }

    return status;
}

I am stuck, although my program runs well, I don't know how to change the function. The ref_nationality function got 2 parameters, first is the sorted list and the referee's nationality. As you can see it will return a true value if it has been used more than two times and a false if not.
This function is a part of a bigger program and the concept is to draw the athletes and assign 7 judges to them. This function aim would be to have a maximum of 2 judges of the same nationality for each fight. So if in the first match there were two germans and two italians, in the second fight there could again be two Germans, two Italians etc...
However, as I have written, only two judges of the same nationality are allowed in total. What should I change to achieve the desired result?

Also sorry, I the sites didn't allow me to post more code because then I had to write more description but I didn't know what else to write. If the rest of the code is needed I will post it in the comments.


问:
Test class has dependency failure because of conditional Beans
I have few beans which i declared with some condition using @ConditionalOnProperty annotation. I have a test class, which is failing because of autowiring unsatisfied dependency as the conditional bean didnt load. Can you help me to figure out how to execute that whole test class only when the condition is satisfied?

I tried using @BeforeClass and tried to skip the test class execution, with skipException, but that didnt work


问:
Is there a way to replicate np.random.rand() python function from C?
I want to get random numbers in C sampled in the same way that np.random.rand() does ... the problem is that with rand()/srand() C functions I am not getting good results (random numbers from rand() C function seem to have some pattern).
Which is the best solution? call np.random.rand() from C ?

thanks


问:
How do I debug "Getting your selection..." in Android Auto
I forked Timber (https://github.com/naman14/Timber), and I am trying to add Android Auto support. I got the app showing up on the virtual head unit, and I can select a song, and it plays. However, instead of showing progress and playback controls, it shows "Getting your selection..."

Now the question is: how do I debug it. As far as I can see from the point when I click on the song, to a few minutes later there are no relevant errors in Logcat. So how can I get some idea of what's going wrong? What does Android Auto is expected to do in that scenario that my app might not be fulfilling?

P.S. this is similar to another question on the same issue, however replacement of Context from this to getBaseContext() does not help, and I am actually curious what is the right way to debug this.


问:
Android Google MLKit face detection check if detected face bounding box is inside another view
I'm developing an Android application which capable of detection face

I need to check whether the detected face is inside a specific view (An instruction Circle for user to place their face on). I'm able to get the face bounding box but it seem to reference the imageAnalysis coordinate system. How to check if the detected face are inside a circle view? (from a root view coordinate system)

I'm using below analyzer for imageAnalysis:

```<code>override fun analyze(image: ImageProxy) {
   val mediaImage = imageProxy.image
   val inputImage = InputImage.fromMediaImage(mediaImage, imageProxy.imageInfo.rotationDegrees)
   val listFaces = detector.process(image)

}
</code>```

I'm able extract the boundingBox from detected Face from listFaces

Body:
I'm developing an Android application which capable of detection face

I need to check whether the detected face is inside a specific view (An instruction Circle for user to place their face on). I'm able to get the face bounding box but it seem to reference the imageAnalysis coordinate system. How to check if the detected face are inside a circle view? (from a root view coordinate system)

I'm using below analyzer for imageAnalysis:

override fun analyze(image: ImageProxy) {
   val mediaImage = imageProxy.image
   val inputImage = InputImage.fromMediaImage(mediaImage, imageProxy.imageInfo.rotationDegrees)
   val listFaces = detector.process(image)

}

I'm able extract the boundingBox from detected Face from listFaces


问:
How to output php file in plugin instead of get_template_part
In theme i use following function with get_template_part to otput content of php file cc-archive.php
But when i use same function in my plugin it dosent work. what i can use instead of get_template_part ? i copied  cc-archive.php in same folder too still dont work.</p>
```<code>function my_couse_cards($atts) {
    ob_start();
    $cat = $atts['id'] ;
    get_template_part(
    'cc-archive',
    null,
    array(
        'catid' => $cat
    )
);
    return ob_get_clean();
}
</code>```

Body:
In theme i use following function with get_template_part to otput content of php file cc-archive.php
But when i use same function in my plugin it dosent work. what i can use instead of get_template_part ? i copied  cc-archive.php in same folder too still dont work.

function my_couse_cards($atts) {
    ob_start();
    $cat = $atts['id'] ;
    get_template_part(
    'cc-archive',
    null,
    array(
        'catid' => $cat
    )
);
    return ob_get_clean();
}


问:
Command error: Vlocode is not initialized; VlocityDatapackService is null
Recently i am not able to use the Vlocity VScode extension. I tried to uninstall the extension and salesforce one and then VS code also. Reinstalled everything from scratch and able to work with Salesforce extension but not able to connect the org for vlocity. Even cleaned the alias and logged out from all the orgs in terminal and started with just one org but no luck. I am attaching the screenshot. Please let me know if there is something that is missing from my end or if this is a known issue.

OS : MAC (12.6.1) Monterey
SF cli : sfdx-cli/7.180.0 darwin-x64 node-v18.12.1
Vs Code Version : 1.74.0 (Universal)
Commit: 5235c6bb189b60b01b1f49062f4ffa42384f8c91
Date: 2022-12-05T16:43:37.594Z (1 wk ago)
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 21.6.0enter image description here


问:
Object(...) is not a function - Material UI
Please help me with this error.

I am trying to apply some styling for the MUI dropdown but I am getting this Object(...) is not a function error

```<code>import { makeStyles } from "@material-ui/core/styles";

const dropDownStyle = makeStyles({
  formControl: {
    "& .MuiInputBase-root": {
      color: "#6EC177",
      borderColor: "#6EC177",
      borderWidth: "1px",
      borderStyle: "solid",
      borderRadius: "100px",
      minWidth: "120px",
      justifyContent: "center",
    },
    "& .MuiSelect-select.MuiSelect-select": {
      paddingRight: "0px",
    },
  },
  select: {
    width: "auto",
    fontSize: "12px",
    "&:focus": {
      backgroundColor: "transparent",
    },
  },
  selectIcon: {
    position: "relative",
    color: "#6EC177",
    fontSize: "14px",
  },
  paper: {
    borderRadius: 12,
    marginTop: 8,
  },
  list: {
    paddingTop: 0,
    paddingBottom: 0,
    "& li": {
      fontWeight: 200,
      paddingTop: 8,
      paddingBottom: 8,
      fontSize: "12px",
    },
    "& li.Mui-selected": {
      color: "white",
      background: "#6EC177",
    },
    "& li.Mui-selected:hover": {
      background: "#6EC177",
    },
  },
});

export default dropDownStyle;`
</code>```

Object(...) is not a functionObject(...) is not a functionObject(...) is not a function

Error:

MUI and React version

Body:
Please help me with this error.

I am trying to apply some styling for the MUI dropdown but I am getting this Object(...) is not a function error

import { makeStyles } from "@material-ui/core/styles";

const dropDownStyle = makeStyles({
  formControl: {
    "& .MuiInputBase-root": {
      color: "#6EC177",
      borderColor: "#6EC177",
      borderWidth: "1px",
      borderStyle: "solid",
      borderRadius: "100px",
      minWidth: "120px",
      justifyContent: "center",
    },
    "& .MuiSelect-select.MuiSelect-select": {
      paddingRight: "0px",
    },
  },
  select: {
    width: "auto",
    fontSize: "12px",
    "&:focus": {
      backgroundColor: "transparent",
    },
  },
  selectIcon: {
    position: "relative",
    color: "#6EC177",
    fontSize: "14px",
  },
  paper: {
    borderRadius: 12,
    marginTop: 8,
  },
  list: {
    paddingTop: 0,
    paddingBottom: 0,
    "& li": {
      fontWeight: 200,
      paddingTop: 8,
      paddingBottom: 8,
      fontSize: "12px",
    },
    "& li.Mui-selected": {
      color: "white",
      background: "#6EC177",
    },
    "& li.Mui-selected:hover": {
      background: "#6EC177",
    },
  },
});

export default dropDownStyle;`

Object(...) is not a functionObject(...) is not a functionObject(...) is not a function

Error:

MUI and React version


问:
Mongoose populate not getting any value after populating
Hi im building mern project which have a social media feature, this social media have profile, post, and comment. I want to populate profile model to post model, so that i know which post belongs to which user. But im having a problem using populate, its not working the field that have ref is removed after populating.

idk why this happend can someone tell me whats wrong with the code. Thanks.

Models :
https://cdn.discordapp.com/attachments/755260290450587661/1052037045607997472/image.png

SosmedPost.js model

```<code>const mongoose = require("mongoose");

const SosmedPostSchema = new mongoose.Schema({
   Username : {
        type : String
   },
   Content : {
        type : String
   },
   Documents : {
        type : String
   },
   Author : { type : mongoose.Schema.Types.ObjectId, ref : 'sosmedprofiles'}
}, {timestamps : true});

const SosmedPostModel = mongoose.model('sosmedposts', SosmedPostSchema);
module.exports = SosmedPostModel;
</code>```

SosmedProfile models

```<code>const mongoose = require("mongoose");

const SosmedProfileSchema = new mongoose.Schema({

       _id : {
         type : mongoose.Schema.Types.ObjectId
       },
       Username : {
            type : String
       },
       FullName : {
            type : String
       },
       ProfilePicture : {
            type : String
       },
       Bio : {
            type : String
       },
       Post : { type : mongoose.Schema.Types.ObjectId, ref : 'sosmedposts'}
    }, {timestamps : true});

    const SosmedProfileModel = mongoose.model('sosmedprofiles', SosmedProfileSchema);
    module.exports = SosmedProfileModel
</code>```

route / controllers for Sosmed Post

```<code>const getPostById = async (req, res) => {
   const Id = req.params.id;

   SosmedPostModel.findOne({_id : Id})
   .populate("Author")
   .exec(function (err, posts) {
      if (err) return handleError(err);
      console.log(posts);
      res.send(posts)
   })
}
</code>```

Result :
https://cdn.discordapp.com/attachments/755260290450587661/1052037628016476170/image.png

Update :

```<code>const createPost = async (req, res) => {

  if (req.file) {
    const Post = new SosmedPostModel({
      Username : req.body.Username,
      Title : req.body.Title,
      Content : req.body.Content,
      Documents : `https://bsi-portal-service-production.up.railway.app/images/${req.file.filename}`
    })
    await Post.save();
    res.send(Post);
  } else {
    const Post = new SosmedPostModel({
      Username : req.body.Username,
      Title : req.body.Title,
      Content : req.body.Content
    })
    await Post.save();
    res.send(Post);
  }
}
</code>```

Body:
Hi im building mern project which have a social media feature, this social media have profile, post, and comment. I want to populate profile model to post model, so that i know which post belongs to which user. But im having a problem using populate, its not working the field that have ref is removed after populating.

idk why this happend can someone tell me whats wrong with the code. Thanks.

Models :
https://cdn.discordapp.com/attachments/755260290450587661/1052037045607997472/image.png

SosmedPost.js model

const mongoose = require("mongoose");

const SosmedPostSchema = new mongoose.Schema({
   Username : {
        type : String
   },
   Content : {
        type : String
   },
   Documents : {
        type : String
   },
   Author : { type : mongoose.Schema.Types.ObjectId, ref : 'sosmedprofiles'}
}, {timestamps : true});

const SosmedPostModel = mongoose.model('sosmedposts', SosmedPostSchema);
module.exports = SosmedPostModel;

SosmedProfile models

const mongoose = require("mongoose");

const SosmedProfileSchema = new mongoose.Schema({

       _id : {
         type : mongoose.Schema.Types.ObjectId
       },
       Username : {
            type : String
       },
       FullName : {
            type : String
       },
       ProfilePicture : {
            type : String
       },
       Bio : {
            type : String
       },
       Post : { type : mongoose.Schema.Types.ObjectId, ref : 'sosmedposts'}
    }, {timestamps : true});

    const SosmedProfileModel = mongoose.model('sosmedprofiles', SosmedProfileSchema);
    module.exports = SosmedProfileModel

route / controllers for Sosmed Post

const getPostById = async (req, res) => {
   const Id = req.params.id;

   SosmedPostModel.findOne({_id : Id})
   .populate("Author")
   .exec(function (err, posts) {
      if (err) return handleError(err);
      console.log(posts);
      res.send(posts)
   })
}

Result :
https://cdn.discordapp.com/attachments/755260290450587661/1052037628016476170/image.png

Update :

const createPost = async (req, res) => {

  if (req.file) {
    const Post = new SosmedPostModel({
      Username : req.body.Username,
      Title : req.body.Title,
      Content : req.body.Content,
      Documents : `https://bsi-portal-service-production.up.railway.app/images/${req.file.filename}`
    })
    await Post.save();
    res.send(Post);
  } else {
    const Post = new SosmedPostModel({
      Username : req.body.Username,
      Title : req.body.Title,
      Content : req.body.Content
    })
    await Post.save();
    res.send(Post);
  }
}


问:
How to make a complex analysis/calculation in pandas/python without a for loop
I have a database DF1 of sales data: DATE_SOLD, PRICE, NAME of product, indexed on ID.  Products of the same NAME sell sometimes fast, sometimes slowly.

I'd like to add a column which flags the entry if, for a given entry in the database, having looked at all other entries which have the same product NAME as the given entry, and counted how many were sold by looking at the DATE_SOLD of all entries with the same NAME.  If there is only one other entry within 365 days and one entry within 90 days (i.e. only one product with that NAME sold within 1 year prior to the entry row being analyzed, and that one sale was within 90 days), then I want to look at the price of that previous sale and see if it is more than 25% more expensive than the row being analyzed.  If it is, I want to flag the row being analyzed.

I have no idea how to do with in Pandas.  I can do it with a for loop, but it will take forever given the million entries or so that I have.

Help?


问:
How to add custom code snippets using nodejs or other language in VSCode like webstorm?
In the webstorm I can do this using live-template using groovy to create custom template.

eg:

```<code>capitalize(camelCase(groovyScript(   "def splitList = _1.split('/');def size = splitList.size();if (size >= 2) {for (int i = 0; i < size-2; i++) {splitList = Arrays.copyOfRange(splitList, 1, splitList.length);}};return splitList.join('_');",   fileRelativePath() )));
</code>```

This custom variable will create a string which is based on current directory and current filename and extentions.

If a directory like this

```<code>root
   |-app
       |-components
                  |MyComponent.tsx
   |-server

</code>```

MyComponent.tsx use this template will create a string which value is ComponentsMyComponentTsx

The reason create this string is i can command+o quick open by name which is found in the react-dev-tool.

I just copy the name and open de editor, command+o open the file. soconvenient

I want to know how can i do this in vscode

Body:
In the webstorm I can do this using live-template using groovy to create custom template.

eg:

capitalize(camelCase(groovyScript(   "def splitList = _1.split('/');def size = splitList.size();if (size >= 2) {for (int i = 0; i < size-2; i++) {splitList = Arrays.copyOfRange(splitList, 1, splitList.length);}};return splitList.join('_');",   fileRelativePath() )));

This custom variable will create a string which is based on current directory and current filename and extentions.

If a directory like this

root
   |-app
       |-components
                  |MyComponent.tsx
   |-server

MyComponent.tsx use this template will create a string which value is ComponentsMyComponentTsx

The reason create this string is i can command+o quick open by name which is found in the react-dev-tool.

I just copy the name and open de editor, command+o open the file. soconvenient

I want to know how can i do this in vscode


问:
Data not Found as POST request returns `JSON.stringify(value); TypeError: Converting circular structure to JSON`
I have two functions in functions.js - postData and startProcess. I am calling both functions in a function in server.js called sendData. sendData is then called in the app.post route.

In sendData, getData is called first and returns an id. This id is passed to startProcess and after it is run, a message that says 'success` should be printed. If it fails, a message that says 'failed to complete process should be returned'.

It seems like postData runs successfully, but startProcess is unable to pick or use its response as id.

When I run just the postData function in SendData, I get this error message:

```<code>JSON.stringify(value);
TypeError: Converting circular structure to JSON
</code>```

What am I missing and how can I properly implement this?

functions.js

```<code>const axios = require("axios");
const BASE_URL = "http://localhost:1770";

const startProcess = async (id) => {
  const headers = {
    "Content-type": "application/json",
  };
  try {
    return axios.post(`${BASE_URL}/start/${id}`, { headers });
  } catch (error) {
    console.error(error);
  }
};

const postData = async (body) => {
  const headers = {
    "Content-type": "application/json",
  };
  try {
    return axios.post(`${BASE_URL}/data`, body, { headers });
  } catch (error) {
    console.error(error);
  }
};
</code>```

server.js

```<code>const express = require("express");
const process = require("./functions.js");
const payload = require("./payload.json");
const res = require("express/lib/response");

// Create Express Server
const app = express();
app.use(cors());

// Configuration-api
const PORT = 5203;

app.use(express.json());

const sendData = async (req, res, next) => {
  const body = payload;
  try {
    const response = await process.postData(body);
    if ((response.status = 200)) {
      let id = response.data;
      const processResult = await process.startProcess(id);

      if ((processResult.status = 200)) {
        res.send("successfully started process");
      }
    }
  } catch (error) {
    console.error(error);
  }
};

app.post("/data", sendData);
app.listen(PORT, () => {
  console.log(`Running this application on the PORT ${PORT}`);
});
</code>```

Body:
I have two functions in functions.js - postData and startProcess. I am calling both functions in a function in server.js called sendData. sendData is then called in the app.post route.

In sendData, getData is called first and returns an id. This id is passed to startProcess and after it is run, a message that says 'success` should be printed. If it fails, a message that says 'failed to complete process should be returned'.

It seems like postData runs successfully, but startProcess is unable to pick or use its response as id.

When I run just the postData function in SendData, I get this error message:

JSON.stringify(value);
TypeError: Converting circular structure to JSON

What am I missing and how can I properly implement this?

functions.js

const axios = require("axios");
const BASE_URL = "http://localhost:1770";

const startProcess = async (id) => {
  const headers = {
    "Content-type": "application/json",
  };
  try {
    return axios.post(`${BASE_URL}/start/${id}`, { headers });
  } catch (error) {
    console.error(error);
  }
};

const postData = async (body) => {
  const headers = {
    "Content-type": "application/json",
  };
  try {
    return axios.post(`${BASE_URL}/data`, body, { headers });
  } catch (error) {
    console.error(error);
  }
};

server.js

const express = require("express");
const process = require("./functions.js");
const payload = require("./payload.json");
const res = require("express/lib/response");

// Create Express Server
const app = express();
app.use(cors());

// Configuration-api
const PORT = 5203;

app.use(express.json());

const sendData = async (req, res, next) => {
  const body = payload;
  try {
    const response = await process.postData(body);
    if ((response.status = 200)) {
      let id = response.data;
      const processResult = await process.startProcess(id);

      if ((processResult.status = 200)) {
        res.send("successfully started process");
      }
    }
  } catch (error) {
    console.error(error);
  }
};

app.post("/data", sendData);
app.listen(PORT, () => {
  console.log(`Running this application on the PORT ${PORT}`);
});


问:
groupby two columns with max value of third
I am trying to group by dataset with two columns, based on max value of third:

```<code>#this is data

df.head()

          card           date     BWHA_annotation
0   MSD-1555    20210710    0
1   MSD-1555    20210710    0
2   MSD-1555    20210710    0
3   MSD-1555    20210710    0
4   MSD-1555    20210710    0

# with this method  and result.
df1 = df.groupby(['card','date'])['BWHA_annotation'].max().reset_index()

         card             date   BWHA_annotation
0   LSD-0091    20210528    0
1   LSD-0091    20210529    0
2   LSD-0091    20210530    0
3   LSD-0091    20210531    0
4   LSD-0091    20210601    0

</code>```

So, my code is working, however, problem is BWHA_annotation should sum up to 132, because I have 0s and 1s in column, however after grouping I have only 127 1s, so I am potentially losing 5 rows.

is there any better and cleaner way for grouping?

Thanks in advance!

Body:
I am trying to group by dataset with two columns, based on max value of third:

#this is data

df.head()

          card           date     BWHA_annotation
0   MSD-1555    20210710    0
1   MSD-1555    20210710    0
2   MSD-1555    20210710    0
3   MSD-1555    20210710    0
4   MSD-1555    20210710    0

# with this method  and result.
df1 = df.groupby(['card','date'])['BWHA_annotation'].max().reset_index()

         card             date   BWHA_annotation
0   LSD-0091    20210528    0
1   LSD-0091    20210529    0
2   LSD-0091    20210530    0
3   LSD-0091    20210531    0
4   LSD-0091    20210601    0

So, my code is working, however, problem is BWHA_annotation should sum up to 132, because I have 0s and 1s in column, however after grouping I have only 127 1s, so I am potentially losing 5 rows.

is there any better and cleaner way for grouping?

Thanks in advance!


问:
header nav not showing in webpage
/****In my css already had the background-color as green. ****/
Here's my code.

```<code><header>
        <nav id="header-nav" class="navbar navbar-default">
            <div class="container">

            </div>
    </nav>
    </header>
</code>```

In my css already had the background-color as green, but the header nav it's not showing in my webpage.
any solution for this?

Title: header nav not showing in webpage

Body:
/****In my css already had the background-color as green. ****/
Here's my code.

In my css already had the background-color as green, but the header nav it's not showing in my webpage.
any solution for this?