问:
How to use accordion custom widget
I used a custom widget for accordion but have no idea how it works I used classes to store the data but it comes out empty. I tried using both an index parsed through another listview and a hardcoded one but still doesn't display anything.

```<code>Accordion(
            title: receiptData.getVisitType(0),
            content: receiptData.getVisitDesc(),
          ),
</code>```

```<code>import 'package:flutter/material.dart';
import 'receiptClassData.dart';

ReceiptData receiptData = ReceiptData();

class Accordion extends StatefulWidget {
  final String title;
  final String content;

  const Accordion({Key? key, required this.title, required this.content})
      : super(key: key);
  @override
  _AccordionState createState() => _AccordionState();
}

class _AccordionState extends State<Accordion> {
  bool _showContent = false;
  @override
  Widget build(BuildContext context) {
    return Card(
      margin: const EdgeInsets.all(10),
      child: Column(children: [
        ListTile(
          title: Text(widget.title),
          onTap:(){
              setState(() {
                _showContent = !_showContent;
              });
            },
        ),
        _showContent
            ? Container(
          padding:
          const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
          child: Text(widget.content),
        )
            : Container()
      ]),
    );
  }
}
</code>```

main.dart

```<code>Accordion(
            title: receiptData.getVisitType(),
            content: receiptData.getVisitDesc(),
          ),
</code>```

receiptClassData

```<code>import 'receiptClass.dart';

int _receiptIndex = 0;

class ReceiptData {
  final List<Receipt> _receiptdata = [
    Receipt("Physical Therapy", "Walking\nKnee jumps\nFeeding fish", "Needs to do more memory training\nto take medication 3 times per day", 23.00, 10.50, 4.0),
    Receipt("Consultation","Jogging\nGardening\nRest", "Needs more sleep and not to skip medication", 23.00, 15.50, 3.5),
    Receipt("Physical Therapy","Swimming\nWalking\nGardening", "Needs more energy so more exercise is advised", 33.00, 25.00, 5.0),
    Receipt("Consultation","nil", "Medication to be taken daily as recommended on bottle", 55.00, 45.50, 1),
    Receipt("Consultation","Walking\nGardening\nWalking Dog", "Mental health has been affected, advised to do more hobbies instead of staying at home", 33.00, 100.50, 4.5),
  ];

  String getVisitType(){
    return _receiptdata[_receiptIndex].title;
  }

  String getVisitDesc(){
    return _receiptdata[_receiptIndex].titleDesc;
  }

  String getDoctorNotes(){
    return _receiptdata[_receiptIndex].doctorNotes;
  }

  double getCFees(){
    return _receiptdata[_receiptIndex].consultationFee;
  }

  double getMFees(){
    return _receiptdata[_receiptIndex].medicationFee;
  }

  double calcTotal(){
    return _receiptdata[_receiptIndex].consultationFee + _receiptdata[_receiptIndex].medicationFee;
  }

  double getRating(){
    return _receiptdata[_receiptIndex].rating;
  }

  int getIndex(){
    return _receiptIndex;
  }

}
</code>```

added the receipt class as per requested

```<code>import 'dart:ui';

class Receipt {
  String title = "";
  String titleDesc = "";
  String doctorNotes = "";
  double consultationFee = 0.0;
  double medicationFee = 0.0;
  double rating = 0.0;

  Receipt(String rs, String rtd, String rdn, double rcf, double rmf, double rr){
    String title = rs;
    String titleDesc = rtd;
    String doctorNotes = rdn;
    double consultationFee = rcf;
    double medicationFee = rmf;
    double rating = rr;
  }

}
</code>```

Title: How to use accordion custom widget

Body:
I used a custom widget for accordion but have no idea how it works I used classes to store the data but it comes out empty. I tried using both an index parsed through another listview and a hardcoded one but still doesn't display anything.

Accordion(
            title: receiptData.getVisitType(0),
            content: receiptData.getVisitDesc(),
          ),

import 'package:flutter/material.dart';
import 'receiptClassData.dart';

ReceiptData receiptData = ReceiptData();

class Accordion extends StatefulWidget {
  final String title;
  final String content;

  const Accordion({Key? key, required this.title, required this.content})
      : super(key: key);
  @override
  _AccordionState createState() => _AccordionState();
}

class _AccordionState extends State<Accordion> {
  bool _showContent = false;
  @override
  Widget build(BuildContext context) {
    return Card(
      margin: const EdgeInsets.all(10),
      child: Column(children: [
        ListTile(
          title: Text(widget.title),
          onTap:(){
              setState(() {
                _showContent = !_showContent;
              });
            },
        ),
        _showContent
            ? Container(
          padding:
          const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
          child: Text(widget.content),
        )
            : Container()
      ]),
    );
  }
}

main.dart

Accordion(
            title: receiptData.getVisitType(),
            content: receiptData.getVisitDesc(),
          ),

receiptClassData

import 'receiptClass.dart';

int _receiptIndex = 0;

class ReceiptData {
  final List<Receipt> _receiptdata = [
    Receipt("Physical Therapy", "Walking\nKnee jumps\nFeeding fish", "Needs to do more memory training\nto take medication 3 times per day", 23.00, 10.50, 4.0),
    Receipt("Consultation","Jogging\nGardening\nRest", "Needs more sleep and not to skip medication", 23.00, 15.50, 3.5),
    Receipt("Physical Therapy","Swimming\nWalking\nGardening", "Needs more energy so more exercise is advised", 33.00, 25.00, 5.0),
    Receipt("Consultation","nil", "Medication to be taken daily as recommended on bottle", 55.00, 45.50, 1),
    Receipt("Consultation","Walking\nGardening\nWalking Dog", "Mental health has been affected, advised to do more hobbies instead of staying at home", 33.00, 100.50, 4.5),
  ];

  String getVisitType(){
    return _receiptdata[_receiptIndex].title;
  }

  String getVisitDesc(){
    return _receiptdata[_receiptIndex].titleDesc;
  }

  String getDoctorNotes(){
    return _receiptdata[_receiptIndex].doctorNotes;
  }

  double getCFees(){
    return _receiptdata[_receiptIndex].consultationFee;
  }

  double getMFees(){
    return _receiptdata[_receiptIndex].medicationFee;
  }

  double calcTotal(){
    return _receiptdata[_receiptIndex].consultationFee + _receiptdata[_receiptIndex].medicationFee;
  }

  double getRating(){
    return _receiptdata[_receiptIndex].rating;
  }

  int getIndex(){
    return _receiptIndex;
  }

}

added the receipt class as per requested

import 'dart:ui';

class Receipt {
  String title = "";
  String titleDesc = "";
  String doctorNotes = "";
  double consultationFee = 0.0;
  double medicationFee = 0.0;
  double rating = 0.0;

  Receipt(String rs, String rtd, String rdn, double rcf, double rmf, double rr){
    String title = rs;
    String titleDesc = rtd;
    String doctorNotes = rdn;
    double consultationFee = rcf;
    double medicationFee = rmf;
    double rating = rr;
  }

}


来源: stackexchange

问:
add together two already calculated selects for new a column then get totals of all the selects
```<code> `This is what I have so far.`
</code>```

select nameFirst+' '+nameLast as 'NAME',G GP, AB,R,H,B2 as '2B',B3 as '3B',HR,RBI,

((S)+(b22)+(b33)+(hr*4)) as TB,
BB,SO,SB,

H*1.0/(Case when AB=0 then 1 else AB end) as 'AVG',

((H+BB+HBP*1.0)/(Case when (AB+BB +HBP+SF)=0 then 1 else (AB+BB +HBP+S) end )) as 'OBP',

((S)+(b22)+(b33)+(hr*4)*1.0)/(Case when AB=0 then 1 else AB end) as 'SLG'

from vwPlayersBatting
where teamID = 'hou' and yearID ='2005'

order by AB DESC;

```<code>
` I am trying to take what I have for "OPB" and PLUS it with "SLG
  and name it "OPS"
 then after  sum up all totals
like this
```sum(G)+''+sum(AB)+''+sum(R)+''+sum(H)+''+sum(S)+''+sum(B2)+''+sum(B3)+''+sum(HR)+''+sum(RBI)+''+(sum(S)+sum(b2)*2)+(sum(B3)*3)+(sum(HR)*4)+''+sum(BB)+''+sum(SO)+''+sum(SB)+''+
sum(H)*1.0/sum(G) +''+sum(h)+sum(BB)+sum(HBP)*1.0+''+ sum(S)+( sum(b2)*2)+(sum(b3)*3)+(sum(hr)*4)*1.0 as Total
```
<p><code>also I think I have to hardcode in  SELECT 162  GP since that's how many games were played  </code>
<code>I keep getting an error message Msg 8120, Level 16, State 1, Line 8 Column 'vwPlayersBatting.HBP' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Msg 8120, Level 16, State 1, Line 8 </code></p>
```

 I thought it would look something like this select nameFirst+' '+nameLast as 'NAME' ,G GP, AB,R,H,S,B2 as '2B',B3 as '3B',HR,RBI,

((S)+(b2*2)+(b3*3)+(hr*4)) as TB,
BB,SO,SB,

H*1.0/(Case when AB=0 then 1 else AB end) as 'AV',

((H+BB+HBP*1.0)/(Case when (AB+BB +HBP+SF)=0 then 1 else (AB+BB +HBP+S) end )) as 'OBP',

((S)+(b2*2)+(b3*3)+(hr*4)*1.0)/(Case when AB=0 then 1 else AB end) as 'SLG',

((H+BB+HBP*1.0)/(Case when (AB+BB +HBP+SF)=0 then 1 else (AB+BB +HBP+S) end ))+' '+ ((S)+(b2*2)+(b3*3)+(hr*4)*1.0)/(Case when AB=0 then 1 else AB end) as 'OPS'

 sum(G)+''+sum(AB)+''+sum(R)+''+sum(H)+''+sum(S)+''+sum(B2)+''+sum(B3)+''+sum(HR)+''+sum(RBI)+''+(sum(S)+sum(b2)*2)+(sum(B3)*3)+(sum(HR)*4)+''+sum(BB)+''+sum(SO)+''+sum(SB)+''+
sum(H)*1.0/sum(G) +''+sum(h)+sum(BB)+sum(HBP)*1.0+''+ sum(S)+( sum(b2)*2)+(sum(b3)*3)+(sum(hr)*4)*1.0 as Total
 from vwPlayersBatting
where teamID = 'hou' and yearID ='2005'
group by nameFirst,nameLast,G,AB,R,H,S,B2,B3,HR,RBI,BB,SO,SB
order by AB DESC;```
</code>```

ContentLicense: CC BY-SA 4.0

Body:
 `This is what I have so far.`

select nameFirst+' '+nameLast as 'NAME',G GP, AB,R,H,B2 as '2B',B3 as '3B',HR,RBI,

((S)+(b22)+(b33)+(hr*4)) as TB,
BB,SO,SB,

H*1.0/(Case when AB=0 then 1 else AB end) as 'AVG',

((H+BB+HBP*1.0)/(Case when (AB+BB +HBP+SF)=0 then 1 else (AB+BB +HBP+S) end )) as 'OBP',

((S)+(b22)+(b33)+(hr*4)*1.0)/(Case when AB=0 then 1 else AB end) as 'SLG'

from vwPlayersBatting
where teamID = 'hou' and yearID ='2005'

order by AB DESC;

` I am trying to take what I have for "OPB" and PLUS it with "SLG
  and name it "OPS"
 then after  sum up all totals
like this
```sum(G)+''+sum(AB)+''+sum(R)+''+sum(H)+''+sum(S)+''+sum(B2)+''+sum(B3)+''+sum(HR)+''+sum(RBI)+''+(sum(S)+sum(b2)*2)+(sum(B3)*3)+(sum(HR)*4)+''+sum(BB)+''+sum(SO)+''+sum(SB)+''+
sum(H)*1.0/sum(G) +''+sum(h)+sum(BB)+sum(HBP)*1.0+''+ sum(S)+( sum(b2)*2)+(sum(b3)*3)+(sum(hr)*4)*1.0 as Total
</code></pre>
<p><code>also I think I have to hardcode in  SELECT 162  GP since that's how many games were played  </code>
<code>I keep getting an error message Msg 8120, Level 16, State 1, Line 8 Column 'vwPlayersBatting.HBP' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Msg 8120, Level 16, State 1, Line 8 </code></p>
<pre><code>

 I thought it would look something like this select nameFirst+' '+nameLast as 'NAME' ,G GP, AB,R,H,S,B2 as '2B',B3 as '3B',HR,RBI,

((S)+(b2*2)+(b3*3)+(hr*4)) as TB,
BB,SO,SB,

H*1.0/(Case when AB=0 then 1 else AB end) as 'AV',

((H+BB+HBP*1.0)/(Case when (AB+BB +HBP+SF)=0 then 1 else (AB+BB +HBP+S) end )) as 'OBP',

((S)+(b2*2)+(b3*3)+(hr*4)*1.0)/(Case when AB=0 then 1 else AB end) as 'SLG',

((H+BB+HBP*1.0)/(Case when (AB+BB +HBP+SF)=0 then 1 else (AB+BB +HBP+S) end ))+' '+ ((S)+(b2*2)+(b3*3)+(hr*4)*1.0)/(Case when AB=0 then 1 else AB end) as 'OPS'

 sum(G)+''+sum(AB)+''+sum(R)+''+sum(H)+''+sum(S)+''+sum(B2)+''+sum(B3)+''+sum(HR)+''+sum(RBI)+''+(sum(S)+sum(b2)*2)+(sum(B3)*3)+(sum(HR)*4)+''+sum(BB)+''+sum(SO)+''+sum(SB)+''+
sum(H)*1.0/sum(G) +''+sum(h)+sum(BB)+sum(HBP)*1.0+''+ sum(S)+( sum(b2)*2)+(sum(b3)*3)+(sum(hr)*4)*1.0 as Total
 from vwPlayersBatting
where teamID = 'hou' and yearID ='2005'
group by nameFirst,nameLast,G,AB,R,H,S,B2,B3,HR,RBI,BB,SO,SB
order by AB DESC;```


问:
Problem In Unity 2019 With AdMob for RewardAd
I Using Unity 2019 for my Game and game in develepoment . there is a Button to Get a Free Life after visiting reward ad video From Ad . In Editor every things is well.But i use that in my android phone
.Banner is okay.but show reward ad rasier no ad config.

```<code>
    public void RequestAndLoadRewardedAd()
    {
        PrintStatus("Requesting Rewarded ad.");
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-3940256099942544/5224354917";
#elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-3940256099942544/1712485313";
#else
        string adUnitId = "unexpected_platform";
#endif

        // create new rewarded ad instance
        rewardedAd = new RewardedAd(adUnitId);

        // Add Event Handlers
        rewardedAd.OnAdLoaded += (sender, args) =>
        {
            PrintStatus("Reward ad loaded.");
            OnAdLoadedEvent.Invoke();
            ShowRewardedAd();
        };
        rewardedAd.OnAdFailedToLoad += (sender, args) =>
        {
            PrintStatus("Reward ad failed to load." + args.LoadAdError.GetMessage() + "-" + args.LoadAdError.GetCode().ToString());
            OnAdFailedToLoadEvent.Invoke();
        };
        rewardedAd.OnAdOpening += (sender, args) =>
        {
            PrintStatus("Reward ad opening.");
            OnAdOpeningEvent.Invoke();
        };
        rewardedAd.OnAdFailedToShow += (sender, args) =>
        {
            PrintStatus("Reward ad failed to show with error: "+args.AdError.GetMessage());
            OnAdFailedToShowEvent.Invoke();
        };
        rewardedAd.OnAdClosed += (sender, args) =>
        {
            PrintStatus("Reward ad closed.");
            OnAdClosedEvent.Invoke();
        };
        rewardedAd.OnUserEarnedReward += (sender, args) =>
        {
            PrintStatus("User earned Reward ad reward: "+args.Amount);
            OnUserEarnedRewardEvent.Invoke();

        };
        rewardedAd.OnAdDidRecordImpression += (sender, args) =>
        {
            PrintStatus("Reward ad recorded an impression.");
        };
        rewardedAd.OnPaidEvent += (sender, args) =>
        {
            string msg = string.Format("{0} (currency: {1}, value: {2}",
                                        "Rewarded ad received a paid event.",
                                        args.AdValue.CurrencyCode,
                                        args.AdValue.Value);
            PrintStatus(msg);
        };

        // Create empty ad request
        rewardedAd.LoadAd(CreateAdRequest());
    }
    public UnityEngine.UI.Button FreeButton;
    public void ShowRewardedAd()
    {
        if (rewardedAd != null)
        {
            rewardedAd.Show();
        }
        else
        {
            PrintStatus("Rewarded ad is not ready yet.");
        }
    }

    public void RequestAndLoadRewardedInterstitialAd()
    {
        PrintStatus("Requesting Rewarded Interstitial ad.");

        // These ad units are configured to always serve test ads.
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
            string adUnitId = "ca-app-pub-3940256099942544/5354046379";
#elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/6978759866";
#else
            string adUnitId = "unexpected_platform";
#endif

        // Create an interstitial.
        RewardedInterstitialAd.LoadAd(adUnitId, CreateAdRequest(), (rewardedInterstitialAd, error) =>
        {
            if (error != null)
            {
                PrintStatus("Rewarded Interstitial ad load failed with error: " + error);
                return;
            }

            this.rewardedInterstitialAd = rewardedInterstitialAd;
            PrintStatus("Rewarded Interstitial ad loaded.");

            // Register for ad events.
            this.rewardedInterstitialAd.OnAdDidPresentFullScreenContent += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad presented.");
            };
            this.rewardedInterstitialAd.OnAdDidDismissFullScreenContent += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad dismissed.");
                this.rewardedInterstitialAd = null;
            };
            this.rewardedInterstitialAd.OnAdFailedToPresentFullScreenContent += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad failed to present with error: "+
                                                                        args.AdError.GetMessage());
                this.rewardedInterstitialAd = null;
            };
            this.rewardedInterstitialAd.OnPaidEvent += (sender, args) =>
            {
                string msg = string.Format("{0} (currency: {1}, value: {2}",
                                            "Rewarded Interstitial ad received a paid event.",
                                            args.AdValue.CurrencyCode,
                                            args.AdValue.Value);
                PrintStatus(msg);
            };
            this.rewardedInterstitialAd.OnAdDidRecordImpression += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad recorded an impression.");
            };
        });
    }

    public void ShowRewardedInterstitialAd()
    {
        if (rewardedInterstitialAd != null)
        {
            rewardedInterstitialAd.Show((reward) =>
            {
                PrintStatus("Rewarded Interstitial ad Rewarded : " + reward.Amount);
            });
        }
        else
        {
            PrintStatus("Rewarded Interstitial ad is not ready yet.");
        }
    }
</code>```

i used google admob sample and button call "RequestAndLoadRewardedAd" function and now use test unit id.

thanks Guys

After click free button . no ad reward show and error no ad config rasied.

Body:
I Using Unity 2019 for my Game and game in develepoment . there is a Button to Get a Free Life after visiting reward ad video From Ad . In Editor every things is well.But i use that in my android phone
.Banner is okay.but show reward ad rasier no ad config.

    public void RequestAndLoadRewardedAd()
    {
        PrintStatus("Requesting Rewarded ad.");
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-3940256099942544/5224354917";
#elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-3940256099942544/1712485313";
#else
        string adUnitId = "unexpected_platform";
#endif

        // create new rewarded ad instance
        rewardedAd = new RewardedAd(adUnitId);

        // Add Event Handlers
        rewardedAd.OnAdLoaded += (sender, args) =>
        {
            PrintStatus("Reward ad loaded.");
            OnAdLoadedEvent.Invoke();
            ShowRewardedAd();
        };
        rewardedAd.OnAdFailedToLoad += (sender, args) =>
        {
            PrintStatus("Reward ad failed to load." + args.LoadAdError.GetMessage() + "-" + args.LoadAdError.GetCode().ToString());
            OnAdFailedToLoadEvent.Invoke();
        };
        rewardedAd.OnAdOpening += (sender, args) =>
        {
            PrintStatus("Reward ad opening.");
            OnAdOpeningEvent.Invoke();
        };
        rewardedAd.OnAdFailedToShow += (sender, args) =>
        {
            PrintStatus("Reward ad failed to show with error: "+args.AdError.GetMessage());
            OnAdFailedToShowEvent.Invoke();
        };
        rewardedAd.OnAdClosed += (sender, args) =>
        {
            PrintStatus("Reward ad closed.");
            OnAdClosedEvent.Invoke();
        };
        rewardedAd.OnUserEarnedReward += (sender, args) =>
        {
            PrintStatus("User earned Reward ad reward: "+args.Amount);
            OnUserEarnedRewardEvent.Invoke();

        };
        rewardedAd.OnAdDidRecordImpression += (sender, args) =>
        {
            PrintStatus("Reward ad recorded an impression.");
        };
        rewardedAd.OnPaidEvent += (sender, args) =>
        {
            string msg = string.Format("{0} (currency: {1}, value: {2}",
                                        "Rewarded ad received a paid event.",
                                        args.AdValue.CurrencyCode,
                                        args.AdValue.Value);
            PrintStatus(msg);
        };

        // Create empty ad request
        rewardedAd.LoadAd(CreateAdRequest());
    }
    public UnityEngine.UI.Button FreeButton;
    public void ShowRewardedAd()
    {
        if (rewardedAd != null)
        {
            rewardedAd.Show();
        }
        else
        {
            PrintStatus("Rewarded ad is not ready yet.");
        }
    }

    public void RequestAndLoadRewardedInterstitialAd()
    {
        PrintStatus("Requesting Rewarded Interstitial ad.");

        // These ad units are configured to always serve test ads.
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
            string adUnitId = "ca-app-pub-3940256099942544/5354046379";
#elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/6978759866";
#else
            string adUnitId = "unexpected_platform";
#endif

        // Create an interstitial.
        RewardedInterstitialAd.LoadAd(adUnitId, CreateAdRequest(), (rewardedInterstitialAd, error) =>
        {
            if (error != null)
            {
                PrintStatus("Rewarded Interstitial ad load failed with error: " + error);
                return;
            }

            this.rewardedInterstitialAd = rewardedInterstitialAd;
            PrintStatus("Rewarded Interstitial ad loaded.");

            // Register for ad events.
            this.rewardedInterstitialAd.OnAdDidPresentFullScreenContent += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad presented.");
            };
            this.rewardedInterstitialAd.OnAdDidDismissFullScreenContent += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad dismissed.");
                this.rewardedInterstitialAd = null;
            };
            this.rewardedInterstitialAd.OnAdFailedToPresentFullScreenContent += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad failed to present with error: "+
                                                                        args.AdError.GetMessage());
                this.rewardedInterstitialAd = null;
            };
            this.rewardedInterstitialAd.OnPaidEvent += (sender, args) =>
            {
                string msg = string.Format("{0} (currency: {1}, value: {2}",
                                            "Rewarded Interstitial ad received a paid event.",
                                            args.AdValue.CurrencyCode,
                                            args.AdValue.Value);
                PrintStatus(msg);
            };
            this.rewardedInterstitialAd.OnAdDidRecordImpression += (sender, args) =>
            {
                PrintStatus("Rewarded Interstitial ad recorded an impression.");
            };
        });
    }

    public void ShowRewardedInterstitialAd()
    {
        if (rewardedInterstitialAd != null)
        {
            rewardedInterstitialAd.Show((reward) =>
            {
                PrintStatus("Rewarded Interstitial ad Rewarded : " + reward.Amount);
            });
        }
        else
        {
            PrintStatus("Rewarded Interstitial ad is not ready yet.");
        }
    }

i used google admob sample and button call "RequestAndLoadRewardedAd" function and now use test unit id.

thanks Guys

After click free button . no ad reward show and error no ad config rasied.


问:
Use Same Component as Multiple component with same nature , Using the title name of clicked component
Suppose I have created a single component In an angular Project , and I have few more components with exactly same nature, I just don't want to create another components for them , Can I route different component through single path using menu-bar name (title)?
Like I have worked for TestComponent1 -----

(e.g)
http://localhost:4200/TestComponent1 I have complete work for it.

when I click to another component from menu Like clicked on TestComponent2 , I want to use the functionality of TestComponent1 in TestComponent2 , picking through menu-title Name.

I have tried with same route but it select all component in a same time , and picked the last title name selected


问:
How to run an ElectronJS app in a docker container?
I am working on a desktop application build using ElectronJS framework on Windows.

May be I haven't understood Docker properly, but how do I use docker for this app?

My end goal is to not let people install node, npm and electron packages on their local system. They can use the docker image to develop this application.

I am struggling to run the app through the Docker Container.

This is my Dockerfile

```<code>FROM node:16-alpine3.16 as development

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . ./

RUN npm run build

FROM node:16-alpine3.16 as production

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY --from=development /app/dist ./dist

CMD ["npm", "run", "start"] // electron .

</code>```

I build this image this way: docker build -t oz/test-image .

I run it using the following command docker run -it -p 8080:8080 oz/test-image

And I get the following error:

```<code>node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn /app/node_modules/electron/dist/electron ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /app/node_modules/electron/dist/electron',
  path: '/app/node_modules/electron/dist/electron',
  spawnargs: [ '.' ]
}
</code>```

I need to know how to run a GUI(Electron Application) application using docker container?

what is wrong with what I have done above?

Thanks.

Body:
I am working on a desktop application build using ElectronJS framework on Windows.

May be I haven't understood Docker properly, but how do I use docker for this app?

My end goal is to not let people install node, npm and electron packages on their local system. They can use the docker image to develop this application.

I am struggling to run the app through the Docker Container.

This is my Dockerfile

FROM node:16-alpine3.16 as development

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . ./

RUN npm run build

FROM node:16-alpine3.16 as production

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY --from=development /app/dist ./dist

CMD ["npm", "run", "start"] // electron .

I build this image this way: docker build -t oz/test-image .

I run it using the following command docker run -it -p 8080:8080 oz/test-image

And I get the following error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn /app/node_modules/electron/dist/electron ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /app/node_modules/electron/dist/electron',
  path: '/app/node_modules/electron/dist/electron',
  spawnargs: [ '.' ]
}

I need to know how to run a GUI(Electron Application) application using docker container?

what is wrong with what I have done above?

Thanks.


问:
'IOSurface' memory keeps increasing in SceneKit project
This question is roughly related to this one.

I have a SceneKit project in which memory management has been a challenge (yes, even with ARC).

By loading images in a very specific way, by using weak variables in closures, and by setting SCNMaterials to nil prior to scene deallocation, I've been able to drastically improve the memory situation.

Here's how I'm loading the images:

```<code>DispatchQueue.global(qos: .background).async { [weak material] in
   let path = Bundle.main.path(forResource: "myString", ofType: "png")!
   let img = UIImage(contentsOfFile: path)

   material?.diffuse.contents = img
}
</code>```

However, Instruments shows memory for category VM: IOSurface more or less continuously increasing without ever being adequately reclaimed. According to the documentation, IOSurface is related to image memory.

Here's what Instruments Allocations shows for VM: IOSurface (the memory here goes from about 17MB to about 69MB):

For the above graph, I loaded and then unloaded a SceneKit scene several times.

Here's a graph that illustrates how this IOSurface memory relates to the overall memory footprint:

And here are the callers of IOSurface:

Now, you might think I should use UIImage(named:) instead of UIImage(contentsOfFile:), as the system caches the former in memory but not the latter. But using the former resulted in much worse memory statistics in my project.

I've seen this question on the matter, but it suggests that the problem is the device camera, which I'm not using.

Question: What can you tell me about how IOSurface relates to SceneKit, and how might I improve its memory usage?

Body:
This question is roughly related to this one.

I have a SceneKit project in which memory management has been a challenge (yes, even with ARC).

By loading images in a very specific way, by using weak variables in closures, and by setting SCNMaterials to nil prior to scene deallocation, I've been able to drastically improve the memory situation.

Here's how I'm loading the images:

DispatchQueue.global(qos: .background).async { [weak material] in
   let path = Bundle.main.path(forResource: "myString", ofType: "png")!
   let img = UIImage(contentsOfFile: path)

   material?.diffuse.contents = img
}

However, Instruments shows memory for category VM: IOSurface more or less continuously increasing without ever being adequately reclaimed. According to the documentation, IOSurface is related to image memory.

Here's what Instruments Allocations shows for VM: IOSurface (the memory here goes from about 17MB to about 69MB):

For the above graph, I loaded and then unloaded a SceneKit scene several times.

Here's a graph that illustrates how this IOSurface memory relates to the overall memory footprint:

And here are the callers of IOSurface:

Now, you might think I should use UIImage(named:) instead of UIImage(contentsOfFile:), as the system caches the former in memory but not the latter. But using the former resulted in much worse memory statistics in my project.

I've seen this question on the matter, but it suggests that the problem is the device camera, which I'm not using.

Question: What can you tell me about how IOSurface relates to SceneKit, and how might I improve its memory usage?


问:
(Where) is the Google Maps booking link available?
Is there a way to get the booking link displayed in a Google places result (the mediform.cloud link in the picture below) through an API call?

 What I have tried so far

I looked at the results (of Praxis Michael Gerhold and other places with a booking link) from the Google Places Text Search API as well as Nearby Search API. Both find Praxis Michael Gerhold, but the booking link is not included in the results.

Then I extended the result via the Google Places Details API using place_id, with the following Python code:

```<code>details_url = "https://maps.googleapis.com/maps/api/place/details/json?"
details_basic_contact = 'url,adr_address,formatted_address,formatted_phone_number,opening_hours,secondary_opening_hours,website'
details_atmosphere = 'curbside_pickup,delivery,dine_in,editorial_summary,price_level,reservable,serves_beer,serves_breakfast,serves_brunch,serves_dinner,serves_lunch,serves_vegetarian_food,serves_wine,takeout'
response = requests.get(details_url + 'place_id=' + practice['place_id'] + f'&fields={details_basic_contact},{details_atmosphere}' + '&key=' + API_KEY)
response_json = response.json()
practice.update(response_json['result'])
</code>```

The booking link is in none of those fields (removed some obvious not relevant fields to shorten result):

[{'business_status': 'OPERATIONAL', 'formatted_address':
'Käthe-Kollwitz-Straße 5, 72074 Tübingen, Germany',
'name': 'Praxis Michael Gerhold','place_id': 'ChIJ16HkGVvlmUcRAE_z_vEKXQM', 'plus_code':
{'compound_code': 'G3MV+JH Tübingen', 'global_code': '8FWFG3MV+JH'},
'rating': 5, 'reference': 'ChIJ16HkGVvlmUcRAE_z_vEKXQM', 'types':
['doctor', 'point_of_interest', 'health', 'establishment'],
'user_ratings_total': 2, 'adr_address': 'Käthe-Kollwitz-Straße 5, 72074 Tübingen, Germany', 'formatted_phone_number': '07071
87795', 'reviews': [{'author_name': 'Daniela Wiedmaier', 'author_url':
'https://www.google.com/maps/contrib/109740698522002079227/reviews',
'language': 'en-US', 'original_language': 'de', 'profile_photo_url':
'https://lh3.googleusercontent.com/a/AEdFTp57NyCURq_pB3vUzaXxocDxG7vsnkqxbTg_fp3S=s128-c0x00000000-cc-rp-mo-ba3',
'rating': 5, 'relative_time_description': '5 years ago', 'text':
'Friendly staff and a nice atmosphere in the office.\nGood
coordination of appointments. As long as you arrive on time, there is
almost no waiting time.\nGreat doctor with a golden touch for his
acupuncture needles.', 'time': 1511324152, 'translated': True},
{'author_name': 'Uli van Heeswijk', 'author_url':
'https://www.google.com/maps/contrib/108579831017915722813/reviews',
'profile_photo_url':
'https://lh3.googleusercontent.com/a/AEdFTp435e8eJkLsTRbvwATVWhyU8Z3S2LlbGgy8-uL9=s128-c0x00000000-cc-rp-mo-ba2',
'rating': 5, 'relative_time_description': '3 years ago', 'text': '',
'time': 1553157599, 'translated': False}], 'url':
'https://maps.google.com/?cid=242361989428629248', 'website':
'http://www.tcm-praxisnetz.de/?ID=17'}]

I do have access to the atmosphere fields with my API_KEY as the following result (for a restaurant) demonstrates:

[{'business_status': 'OPERATIONAL', 'formatted_address': 'Ettlinger
Allee 7, 76199 Karlsruhe, Germany', 'name': 'Chinarestaurant Yangda',
'place_id': 'ChIJX2ubJQ0Gl0cRqTxtTcxbOrk', 'price_level': 2, 'rating':
4.5, 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'], 'user_ratings_total': 764, 'adr_address': 'Ettlinger Allee 7, 76199 Karlsruhe, Germany', 'dine_in': True,
'editorial_summary': {'language': 'en', 'overview': 'Down-to-earth
eatery dishing up familiar Chinese entrees & traditional hot pot
options.'}, 'formatted_phone_number': '0721 881231', 'reservable':
True, 'serves_beer': True, 'serves_breakfast': False, 'serves_brunch':
False, 'serves_dinner': True, 'serves_lunch': True,
'serves_vegetarian_food': True, 'serves_wine': True, 'takeout': True,
'url': 'https://maps.google.com/?cid=13347081378696346793', 'website':
'https://www.yangda-karlsruhe.de/'}]

Body:
Is there a way to get the booking link displayed in a Google places result (the mediform.cloud link in the picture below) through an API call?

 What I have tried so far

I looked at the results (of Praxis Michael Gerhold and other places with a booking link) from the Google Places Text Search API as well as Nearby Search API. Both find Praxis Michael Gerhold, but the booking link is not included in the results.

Then I extended the result via the Google Places Details API using place_id, with the following Python code:

details_url = "https://maps.googleapis.com/maps/api/place/details/json?"
details_basic_contact = 'url,adr_address,formatted_address,formatted_phone_number,opening_hours,secondary_opening_hours,website'
details_atmosphere = 'curbside_pickup,delivery,dine_in,editorial_summary,price_level,reservable,serves_beer,serves_breakfast,serves_brunch,serves_dinner,serves_lunch,serves_vegetarian_food,serves_wine,takeout'
response = requests.get(details_url + 'place_id=' + practice['place_id'] + f'&fields={details_basic_contact},{details_atmosphere}' + '&key=' + API_KEY)
response_json = response.json()
practice.update(response_json['result'])

The booking link is in none of those fields (removed some obvious not relevant fields to shorten result):

[{'business_status': 'OPERATIONAL', 'formatted_address':
'Käthe-Kollwitz-Straße 5, 72074 Tübingen, Germany',
'name': 'Praxis Michael Gerhold','place_id': 'ChIJ16HkGVvlmUcRAE_z_vEKXQM', 'plus_code':
{'compound_code': 'G3MV+JH Tübingen', 'global_code': '8FWFG3MV+JH'},
'rating': 5, 'reference': 'ChIJ16HkGVvlmUcRAE_z_vEKXQM', 'types':
['doctor', 'point_of_interest', 'health', 'establishment'],
'user_ratings_total': 2, 'adr_address': 'Käthe-Kollwitz-Straße 5, 72074 Tübingen, Germany', 'formatted_phone_number': '07071
87795', 'reviews': [{'author_name': 'Daniela Wiedmaier', 'author_url':
'https://www.google.com/maps/contrib/109740698522002079227/reviews',
'language': 'en-US', 'original_language': 'de', 'profile_photo_url':
'https://lh3.googleusercontent.com/a/AEdFTp57NyCURq_pB3vUzaXxocDxG7vsnkqxbTg_fp3S=s128-c0x00000000-cc-rp-mo-ba3',
'rating': 5, 'relative_time_description': '5 years ago', 'text':
'Friendly staff and a nice atmosphere in the office.\nGood
coordination of appointments. As long as you arrive on time, there is
almost no waiting time.\nGreat doctor with a golden touch for his
acupuncture needles.', 'time': 1511324152, 'translated': True},
{'author_name': 'Uli van Heeswijk', 'author_url':
'https://www.google.com/maps/contrib/108579831017915722813/reviews',
'profile_photo_url':
'https://lh3.googleusercontent.com/a/AEdFTp435e8eJkLsTRbvwATVWhyU8Z3S2LlbGgy8-uL9=s128-c0x00000000-cc-rp-mo-ba2',
'rating': 5, 'relative_time_description': '3 years ago', 'text': '',
'time': 1553157599, 'translated': False}], 'url':
'https://maps.google.com/?cid=242361989428629248', 'website':
'http://www.tcm-praxisnetz.de/?ID=17'}]

I do have access to the atmosphere fields with my API_KEY as the following result (for a restaurant) demonstrates:

[{'business_status': 'OPERATIONAL', 'formatted_address': 'Ettlinger
Allee 7, 76199 Karlsruhe, Germany', 'name': 'Chinarestaurant Yangda',
'place_id': 'ChIJX2ubJQ0Gl0cRqTxtTcxbOrk', 'price_level': 2, 'rating':
4.5, 'types': ['restaurant', 'food', 'point_of_interest', 'establishment'], 'user_ratings_total': 764, 'adr_address': 'Ettlinger Allee 7, 76199 Karlsruhe, Germany', 'dine_in': True,
'editorial_summary': {'language': 'en', 'overview': 'Down-to-earth
eatery dishing up familiar Chinese entrees & traditional hot pot
options.'}, 'formatted_phone_number': '0721 881231', 'reservable':
True, 'serves_beer': True, 'serves_breakfast': False, 'serves_brunch':
False, 'serves_dinner': True, 'serves_lunch': True,
'serves_vegetarian_food': True, 'serves_wine': True, 'takeout': True,
'url': 'https://maps.google.com/?cid=13347081378696346793', 'website':
'https://www.yangda-karlsruhe.de/'}]


问:
How to set up realtime object detection with custom dataset using OpenCV?
I need to set up a project for realtime object detection with custom dataset using a webcam on OpenCV. What framework should i use for this and what is the proceduce for training and code?

I had used haarcascade but it was very inaccurate and also efficientdet but it was very slow.


问:
Not sure why rpsGame isn't being used? Is my syntax wrong?
I'm new to React and was wondering why this return an error

```<code>import React from 'react';
import rpsGame from './rpsGame'

function App() {
  return (
    <rpsGame />
  )
}

export default App;

</code>```

this return with the error

```<code>'rpsGame' is defined but never used  no-unused-vars
</code>```

Am I making some sort of syntax error that I'm not seeing?

Body:
I'm new to React and was wondering why this return an error

import React from 'react';
import rpsGame from './rpsGame'

function App() {
  return (
    <rpsGame />
  )
}

export default App;

this return with the error

'rpsGame' is defined but never used  no-unused-vars

Am I making some sort of syntax error that I'm not seeing?


问:
I want to display data last 7 days with date wise in wordpress for chartjs?
I am building a small plugin there I have add one chart using Chartjs. I want to display post views data based on date last 7 days. I have did small query but I got same date in chartjs label, Can anyone take a look on it, bellow what i have done:

```<code>$today = getdate();
$posts             = get_posts( [ 'post_type' => 'docs', 'date_query' => array( array( 'after' => '1 week ago', 'inclusive' => true)), 'GROUP BY' => 'post_date'] );
$docs_num          = count( $posts );

$labels = [];
$dataCount = [];
foreach ( $posts as $item ) {
    $labels[] =  date('d M, Y', strtotime($item->post_date));
    $dataCount[] =  get_post_meta( $item->ID, 'post_views_count', false );
}
</code>```

If i print the data like bellow, i get only same days data, but i want date wise:

```<code>var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
    // The type of chart we want to create
    type: 'line',

    // The data for our dataset
    data: {
        labels: <?php echo encode($label); ?>,
        datasets: [
            {
                label: 'My First dataset',
                backgroundColor: 'rgb(255, 99, 132)',
                borderColor: 'rgb(255, 99, 132)',
                data: <?php echo encode($dataCount); ?>
            },
            {
                label: 'My Second dataset',
                backgroundColor: 'rgb(255, 43, 122)',
                borderColor: 'rgb(255, 45, 122)',
                data: [0, 20, 3, 4, 30, 40, 41]
            }
        ]
    },

    // Configuration options go here
    options: {}
});
</code>```

Body:
I am building a small plugin there I have add one chart using Chartjs. I want to display post views data based on date last 7 days. I have did small query but I got same date in chartjs label, Can anyone take a look on it, bellow what i have done:

$today = getdate();
$posts             = get_posts( [ 'post_type' => 'docs', 'date_query' => array( array( 'after' => '1 week ago', 'inclusive' => true)), 'GROUP BY' => 'post_date'] );
$docs_num          = count( $posts );

$labels = [];
$dataCount = [];
foreach ( $posts as $item ) {
    $labels[] =  date('d M, Y', strtotime($item->post_date));
    $dataCount[] =  get_post_meta( $item->ID, 'post_views_count', false );
}

If i print the data like bellow, i get only same days data, but i want date wise:

var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
    // The type of chart we want to create
    type: 'line',

    // The data for our dataset
    data: {
        labels: <?php echo encode($label); ?>,
        datasets: [
            {
                label: 'My First dataset',
                backgroundColor: 'rgb(255, 99, 132)',
                borderColor: 'rgb(255, 99, 132)',
                data: <?php echo encode($dataCount); ?>
            },
            {
                label: 'My Second dataset',
                backgroundColor: 'rgb(255, 43, 122)',
                borderColor: 'rgb(255, 45, 122)',
                data: [0, 20, 3, 4, 30, 40, 41]
            }
        ]
    },

    // Configuration options go here
    options: {}
});


问:
How to compile native code in android studio?
I am having a local library which has C and Java code. I have added a function to the C and java code. but it is not reflecting in the app. Saying no implementation found</p>


问:
Snowflake - select query on one column giving 'SQL compilation error: Unsupported subquery type cannot be evaluated'
I have a Snowflake view as below:

```<code>create or replace view View1(
    ACCOUNTNUMBER,
    SELLER__C,
    PARENTID,
    PARENT_IS
) as (
 SELECT a.accountnumber,a.seller__c,p2.parentid,
        CASE
            WHEN p2.parentid IS NOT NULL AND ((( SELECT p.seller__c
               FROM Table1 p
              WHERE p.id::text = p2.parentid::text
             LIMIT 1))::text) = 'Yes'::varchar::text THEN true
            WHEN COALESCE(p2.seller__c, 'No'::varchar)::text = 'Yes'::varchar::text THEN true
            ELSE false
        END AS parent_is
   FROM Table1 a
   LEFT JOIN ( SELECT p1.id, p1.accountnumber, p1.name, p1.seller__c, p1.parentid AS parentid
           FROM Table1 p1
          WHERE (EXISTS ( SELECT 1
                   FROM Table1 b
                  WHERE b.parentid::text = p1.id::text))) p2 ON a.parentid::text = p2.id::text);
</code>```

There seems to be some problem with the parent_is column as when I do a simple

select parent_is from View1 ; then I get:

SQL compilation error: Unsupported subquery type cannot be evaluated.

My questions are:

Why am I getting this error on just parent_is column and not others?

How can I rewrite below query to avoid this error coming here as it is trying to select from parent_is? If I remove this column from the query in both select as well as the where clause, the query runs just fine.

```<code>SELECT DISTINCT accountnumber,parent_is
FROM View1
WHERE seller__c = 'Yes' OR parent_is = 'true' ;
</code>```

As I am new to Snowflake, any help would be appreciated.

Body:
I have a Snowflake view as below:

create or replace view View1(
    ACCOUNTNUMBER,
    SELLER__C,
    PARENTID,
    PARENT_IS
) as (
 SELECT a.accountnumber,a.seller__c,p2.parentid,
        CASE
            WHEN p2.parentid IS NOT NULL AND ((( SELECT p.seller__c
               FROM Table1 p
              WHERE p.id::text = p2.parentid::text
             LIMIT 1))::text) = 'Yes'::varchar::text THEN true
            WHEN COALESCE(p2.seller__c, 'No'::varchar)::text = 'Yes'::varchar::text THEN true
            ELSE false
        END AS parent_is
   FROM Table1 a
   LEFT JOIN ( SELECT p1.id, p1.accountnumber, p1.name, p1.seller__c, p1.parentid AS parentid
           FROM Table1 p1
          WHERE (EXISTS ( SELECT 1
                   FROM Table1 b
                  WHERE b.parentid::text = p1.id::text))) p2 ON a.parentid::text = p2.id::text);

There seems to be some problem with the parent_is column as when I do a simple

select parent_is from View1 ; then I get:

SQL compilation error: Unsupported subquery type cannot be evaluated.

My questions are:

Why am I getting this error on just parent_is column and not others?

How can I rewrite below query to avoid this error coming here as it is trying to select from parent_is? If I remove this column from the query in both select as well as the where clause, the query runs just fine.

SELECT DISTINCT accountnumber,parent_is
FROM View1
WHERE seller__c = 'Yes' OR parent_is = 'true' ;

As I am new to Snowflake, any help would be appreciated.


问:
How to build docker images for multiple Sagemaker training applications?
Given one ML repository contains 3 training applications, briefly,

```<code>root
  |__Dockerfile
  |__requirements.txt (contains **heavy dependencies**, e.g., numpy, sklearn, etc. needed for all 3 apps)
  |__app_0
  |    |__training_0.py
  |    |__Dockerfile0
  |__app_1
  |    |__training_1.py
  |    |__Dockerfile1
  |__app_2
  |    |__training_2.py
  |    |__Dockerfile2
  |__heavy_utils
       |__utils.py
</code>```

There are two approaches to build app_0, app_1 and app_2.

One container for multiple apps - Build one container using the Dockerfile at root location.  There will be some COPY commands at the end of the Dockerfile,

```<code>COPY app_0 .
COPY app_1 .
COPY app_2 .
</code>```

Multiple containers for multiple apps - Build multiple containers using individual Dockerfile$i inside app_$i.

I tried both approaches with pros and cons.

One container for multiple apps

Pros: When uploading the image to AWS ECR, The file size is optimized as all 3 apps share some dependencies.
Cons: When I plug in the container to Sagemaker training jobs, Sagemaker cannot recognize all 3 apps because docker building only allows one ENTRYPOINT in Dockerfile.

Multiple containers for multiple apps

Pros: I can give different ECR images to Sagemaker training jobs with individual ENTRYPOINT specified.
Cons: Duplicate dependencies across those ECR images.

I'd like to learn,

Which one is more conventional or if any other better practice?

Can I specify a custom ENTRYPOINT for Sagemaker training job (like the processing job) after the docker has been built?  Specifically, I'm using Sagemaker SDK (sagemaker.estimator.Estimator) to build a Sagemaker pipeline.  AFAIK, the entry_point option is only effective outside the container, i.e., run an external script from local or S3, which has a different behavior than entrypoint in sagemaker.processing.Processor.

Body:
Given one ML repository contains 3 training applications, briefly,

root
  |__Dockerfile
  |__requirements.txt (contains **heavy dependencies**, e.g., numpy, sklearn, etc. needed for all 3 apps)
  |__app_0
  |    |__training_0.py
  |    |__Dockerfile0
  |__app_1
  |    |__training_1.py
  |    |__Dockerfile1
  |__app_2
  |    |__training_2.py
  |    |__Dockerfile2
  |__heavy_utils
       |__utils.py

There are two approaches to build app_0, app_1 and app_2.

One container for multiple apps - Build one container using the Dockerfile at root location.  There will be some COPY commands at the end of the Dockerfile,

COPY app_0 .
COPY app_1 .
COPY app_2 .

Multiple containers for multiple apps - Build multiple containers using individual Dockerfile$i inside app_$i.

I tried both approaches with pros and cons.

One container for multiple apps

Pros: When uploading the image to AWS ECR, The file size is optimized as all 3 apps share some dependencies.
Cons: When I plug in the container to Sagemaker training jobs, Sagemaker cannot recognize all 3 apps because docker building only allows one ENTRYPOINT in Dockerfile.

Multiple containers for multiple apps

Pros: I can give different ECR images to Sagemaker training jobs with individual ENTRYPOINT specified.
Cons: Duplicate dependencies across those ECR images.

I'd like to learn,

Which one is more conventional or if any other better practice?

Can I specify a custom ENTRYPOINT for Sagemaker training job (like the processing job) after the docker has been built?  Specifically, I'm using Sagemaker SDK (sagemaker.estimator.Estimator) to build a Sagemaker pipeline.  AFAIK, the entry_point option is only effective outside the container, i.e., run an external script from local or S3, which has a different behavior than entrypoint in sagemaker.processing.Processor.


问:
Spring WebClient retryWhen does not take care of the TimeoutException
The issue is that 'TimeoutException' is not being handled through the 'retryWhen' function.

I have this below usage of webclient

```<code>   someWebClient
                .post()
                .uri(requestUri)
                .contentType(MediaType.APPLICATION_JSON)
                .headers(headers -> headers.addAll(httpHeaders))
                .accept(MediaType.APPLICATION_JSON)
                .body(Mono.just(userRequest), UserRequest.class)
                .retrieve()
                .bodyToMono(UserResponse.class)
                .retryWhen(
                        Retry.backoff(
                                        userConfiguration.getNumRetries(),
                                        userConfiguration.getBackOff())
                                .maxBackoff(userConfiguration.getMaxBackOff())
                                .jitter(0.5)
                                .maxAttempts(100)
                                .filter(this::shouldRetry))
                .timeout(userConfiguration.getTimeout());
</code>```

The shouldRetry method looks like this ,

```<code>private boolean shouldRetry(Throwable throwable) {
        String t = throwable.getMessage();
        return throwable instanceof io.netty.handler.timeout.TimeoutException;
    }
</code>```

Now when testing the scenario for retries if there is a timeout I set the userConfiguration.getTimeout() to a low value like 10ms.

What happens is the control never enters the 'shouldRetry' method. Instead it throws a general TimeoutException .
The message I get is this ,

Caused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 1000ms in 'retryWhen' (and no fallback has been configured)

Body:
The issue is that 'TimeoutException' is not being handled through the 'retryWhen' function.

I have this below usage of webclient

   someWebClient
                .post()
                .uri(requestUri)
                .contentType(MediaType.APPLICATION_JSON)
                .headers(headers -> headers.addAll(httpHeaders))
                .accept(MediaType.APPLICATION_JSON)
                .body(Mono.just(userRequest), UserRequest.class)
                .retrieve()
                .bodyToMono(UserResponse.class)
                .retryWhen(
                        Retry.backoff(
                                        userConfiguration.getNumRetries(),
                                        userConfiguration.getBackOff())
                                .maxBackoff(userConfiguration.getMaxBackOff())
                                .jitter(0.5)
                                .maxAttempts(100)
                                .filter(this::shouldRetry))
                .timeout(userConfiguration.getTimeout());

The shouldRetry method looks like this ,

private boolean shouldRetry(Throwable throwable) {
        String t = throwable.getMessage();
        return throwable instanceof io.netty.handler.timeout.TimeoutException;
    }

Now when testing the scenario for retries if there is a timeout I set the userConfiguration.getTimeout() to a low value like 10ms.

What happens is the control never enters the 'shouldRetry' method. Instead it throws a general TimeoutException .
The message I get is this ,

Caused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 1000ms in 'retryWhen' (and no fallback has been configured)


问:
FAIL - Application already exists at path [/] - how to delete the file manually?
The most proposed answer to toggle this flag to true at the line#18 of the context file: C:\Program Files\Apache Software Foundation\Tomcat 10.0\webapps\host-manager\META-INF\context.xml

```<code><Context antiResourceLocking="true" privileged="true" >
</code>```

I did just that, but I keep getting the same error.

I wonder whether I updated the right file?

I've been looking for the folder where Tomcat deploys the build. I can't find it so that I can't delete the existing deployment and see whether it will work.

Thanks for helping.

EDIT

FAIL - Application already exists at path [/]. What's this path?

FAIL - Unable to delete [C:\Program Files\Apache Software Foundation\Tomcat 10.0\webapps\ROOT]. ROOT is a folder. Is Tomcat complaining about the entire folder or just files that are inside?

This is what's in the ROOT folder. Seems like default files for a website. Should I delete them?

EDIT 2

I've deleted the ROOT folder. It's not complaining anymore about not being able to delete the ROOT folder. Yet, I'm still getting this error: FAIL - Failed to deploy application at context path [/

Body:
The most proposed answer to toggle this flag to true at the line#18 of the context file: C:\Program Files\Apache Software Foundation\Tomcat 10.0\webapps\host-manager\META-INF\context.xml

<Context antiResourceLocking="true" privileged="true" >

I did just that, but I keep getting the same error.

I wonder whether I updated the right file?

I've been looking for the folder where Tomcat deploys the build. I can't find it so that I can't delete the existing deployment and see whether it will work.

Thanks for helping.

EDIT

FAIL - Application already exists at path [/]. What's this path?

FAIL - Unable to delete [C:\Program Files\Apache Software Foundation\Tomcat 10.0\webapps\ROOT]. ROOT is a folder. Is Tomcat complaining about the entire folder or just files that are inside?

This is what's in the ROOT folder. Seems like default files for a website. Should I delete them?

EDIT 2

I've deleted the ROOT folder. It's not complaining anymore about not being able to delete the ROOT folder. Yet, I'm still getting this error: FAIL - Failed to deploy application at context path [/


问:
JCR Login - remote error: tls: unrecognized name
i am trying to login in JCR to push the image in Repo but while log in i am getting Blow  error.

```<code>docker login -u user -p pass123* 10.0.2.103:8082
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get "https://localhost:port/v2/": remote error: tls: unrecognized name
</code>```

I have tried reverse proxy and installed JCR on Docker but didn't work.

Body:
i am trying to login in JCR to push the image in Repo but while log in i am getting Blow  error.

docker login -u user -p pass123* 10.0.2.103:8082
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get "https://localhost:port/v2/": remote error: tls: unrecognized name

I have tried reverse proxy and installed JCR on Docker but didn't work.


问:
Flutter RiverPod - how best to set up providers to support the display of multiple lists?
I am puzzling about how best to use RiverPod to serve a UI that has a logical list of entries displayed across multiple list views.   For example, there might be 200 entries in the overall list,  90 of which are displayed in list view 'A', another 40 in list view 'B' and the remainder in list view 'C'.  The primary purpose of the UI is to move entries between list views,  e.g. moving an entry from list view 'A' to list view 'C'.

Any suggestions?


问:
Template to add in most Classes to create Migration Models with EF Core

Template to add in most Classes to create Migration Models with EF Core

With DataAnnotations there is one point at Base Class to declare using Attributes  for example ...TypeName...

```<code>Every Model which inherits from that BaseClass is scaffolded correct and all Attributes are taken
</code>```

With FluentAPI you have to declare Property attributes  for example ...HasColumnTypes... on each Model you want to create.
Or loop through after ModelBuilder is finished or create a Convention for ModelFinalizer

```<code>Every Model inherited from BaseClass has to be modified manually/looped for each property, regardless of defining a Grouped SetupClass for that BaseClass
</code>```

How to use FluentAPI to get same results as DataAnnotation with a single Point of Definition ?

expected result

CREATE DATABASE [BlogsMS];

CREATE TABLE [LogEntries] (
    [Id] int NOT NULL IDENTITY,
    [CreatedAt]  smalldatetime NOT NULL,    -- from DataAnnotations
    [UpdatedAt]  smalldatetime NOT NULL,    -- from FluentAPI with SingleConfigPoint ?
);
```
<h2>Source</h2>
<h3>template class</h3>
<pre class="lang-cs prettyprint-override"><code>public abstract class DefaultAuditColumns
{
    [Column(TypeName = ("smalldatetime"))]
    public DateTime CreatedAt { get; set; }  // DB Type defined with DataAnnotations

    public DateTime UpdatedAt { get; set; }  // DB Type defined FluentAPI Grouped OnModelCreating
}
</code>```

first example class/entity

```<code>public class TableLogged : DefaultAuditColumns
{
    public int Id { get; set; }
    public string? Description { get; set; }
}
</code>```

second example class/entity

```<code>public class AnotherTableLogged : DefaultAuditColumns
{
    public int Id { get; set; }
    public string? Description { get; set; }
}
</code>```

Sql table results

  CREATE DATABASE [BlogsMS];

      CREATE TABLE [AnotherLogEntries] (
          [Id] int NOT NULL IDENTITY,
          [Description] nvarchar(200) NULL,
          [CreatedAt] smalldatetime NOT NULL,
          [UpdatedAt] datetime2 NOT NULL,
          CONSTRAINT [PK_AnotherLogEntries] PRIMARY KEY ([Id])
      );

      CREATE TABLE [LogEntries] (
          [Id] int NOT NULL IDENTITY,
          [Description] nvarchar(200) NULL,
          [CreatedAt] smalldatetime NOT NULL,
          [UpdatedAt] datetime2 NOT NULL,
          CONSTRAINT [PK_LogEntries] PRIMARY KEY ([Id])
      );
```
<h2>How to use FluentAPI to get same results as DataAnnotation with a single Point of Definition ?</h2>
<p>The Suggestion Entity Framework Core 2.0: How to configure abstract base class once Ivan Stoev – grek40 does the job but</p>
<p><strong>Some of the Property Attributes then still are missing in scaffolded Model/Classes.</strong></p>
<p><strong>The Modified Class look now like, all works as expected :-)</strong></p>
```public  class TableLoggedConfiguration :  DefaultAuditColumnsConfiguration<TableLogged>, IEntityTypeConfiguration<TableLogged>
 {
     public void Configure(EntityTypeBuilder<TableLogged> entity)
     {
         base.Configure(entity); // <--
         // entity.Property(e => e.ReviewedAt).HasColumnType("smalldatetime");
         // entity.Property(e => e.CreatedBy).HasMaxLength(30);
         // entity.Property(e => e.UpdatedBy).HasMaxLength(30);
         entity.Property(e => e.DecimalType).HasColumnType("decimal(18,5)").HasPrecision(18, 5);
     }
 }
```

Body:
Template to add in most Classes to create Migration Models with EF Core

With DataAnnotations there is one point at Base Class to declare using Attributes  for example ...TypeName...

Every Model which inherits from that BaseClass is scaffolded correct and all Attributes are taken

With FluentAPI you have to declare Property attributes  for example ...HasColumnTypes... on each Model you want to create.
Or loop through after ModelBuilder is finished or create a Convention for ModelFinalizer

Every Model inherited from BaseClass has to be modified manually/looped for each property, regardless of defining a Grouped SetupClass for that BaseClass

How to use FluentAPI to get same results as DataAnnotation with a single Point of Definition ?

expected result

CREATE DATABASE [BlogsMS];

CREATE TABLE [LogEntries] (
    [Id] int NOT NULL IDENTITY,
    [CreatedAt]  smalldatetime NOT NULL,    -- from DataAnnotations
    [UpdatedAt]  smalldatetime NOT NULL,    -- from FluentAPI with SingleConfigPoint ?
);

Source

template class

public abstract class DefaultAuditColumns
{
    [Column(TypeName = ("smalldatetime"))]
    public DateTime CreatedAt { get; set; }  // DB Type defined with DataAnnotations

    public DateTime UpdatedAt { get; set; }  // DB Type defined FluentAPI Grouped OnModelCreating
}

first example class/entity

public class TableLogged : DefaultAuditColumns
{
    public int Id { get; set; }
    public string? Description { get; set; }
}

second example class/entity

public class AnotherTableLogged : DefaultAuditColumns
{
    public int Id { get; set; }
    public string? Description { get; set; }
}

Sql table results

  CREATE DATABASE [BlogsMS];

      CREATE TABLE [AnotherLogEntries] (
          [Id] int NOT NULL IDENTITY,
          [Description] nvarchar(200) NULL,
          [CreatedAt] smalldatetime NOT NULL,
          [UpdatedAt] datetime2 NOT NULL,
          CONSTRAINT [PK_AnotherLogEntries] PRIMARY KEY ([Id])
      );

      CREATE TABLE [LogEntries] (
          [Id] int NOT NULL IDENTITY,
          [Description] nvarchar(200) NULL,
          [CreatedAt] smalldatetime NOT NULL,
          [UpdatedAt] datetime2 NOT NULL,
          CONSTRAINT [PK_LogEntries] PRIMARY KEY ([Id])
      );

How to use FluentAPI to get same results as DataAnnotation with a single Point of Definition ?

The Suggestion Entity Framework Core 2.0: How to configure abstract base class once Ivan Stoev – grek40 does the job but

Some of the Property Attributes then still are missing in scaffolded Model/Classes.

The Modified Class look now like, all works as expected :-)

public  class TableLoggedConfiguration :  DefaultAuditColumnsConfiguration<TableLogged>, IEntityTypeConfiguration<TableLogged>
 {
     public void Configure(EntityTypeBuilder<TableLogged> entity)
     {
         base.Configure(entity); // <--
         // entity.Property(e => e.ReviewedAt).HasColumnType("smalldatetime");
         // entity.Property(e => e.CreatedBy).HasMaxLength(30);
         // entity.Property(e => e.UpdatedBy).HasMaxLength(30);
         entity.Property(e => e.DecimalType).HasColumnType("decimal(18,5)").HasPrecision(18, 5);
     }
 }


问:
Auto close of Super tool tip and navigate to new screen with a single tap flutter web
I used super_tooltip: ^1.0.1 for the tooltip. My requirement is to close the tooltip when clicking on the outside.

```<code>SuperTooltip(

  dismissOnTapOutside: true)
</code>```

It works perfectly. But I have another button to navigate to new screen. When I click on the button popup was automatically closes and with the second tap it navigate to new screen.
My requirement is to close the tooltip and navigate to new screen on single tap.

Is it possible to do it on single tap?

Body:
I used super_tooltip: ^1.0.1 for the tooltip. My requirement is to close the tooltip when clicking on the outside.

SuperTooltip(

  dismissOnTapOutside: true)

It works perfectly. But I have another button to navigate to new screen. When I click on the button popup was automatically closes and with the second tap it navigate to new screen.
My requirement is to close the tooltip and navigate to new screen on single tap.

Is it possible to do it on single tap?


问:
heimdall node exited while/after syncing
I have been trying to run a polygon full node according to the official documentation. I ran the node on a Ubuntu 20.04.4 LTS with the requiered specs according to the docs.
followed everything step by step and ran the commands for syncing the heimdall service:

sudo service heimdalld start

sudo service heimdalld-rest-server start

This took quite some time (9 days aproximately) and I checked on it every few hours. Last time I checked it everything was ok and blocks were being downloaded. Next morning I come and see the heimdall service is down, I check the logs and these is what it shows:

journalctl -u heimdalld.service -f

```<code>-- Logs begin at Sat 2022-12-10 17:38:34 UTC. --
Dec 13 02:20:47 full-node heimdalld[9285]: I[2022-12-13|02:20:47.726] Executed block
   module=state height=10630670 validTxs=1 invalidTxs=1
Dec 13 02:20:47 full-node heimdalld[9285]: I[2022-12-13|02:20:47.747] Committed state
   module=state height=10630670 txs=2 appHash=60C58E8E383EE496FC5430E1344878945D595A5266750C9B2F3FC25598CA5665
Dec 13 02:20:47 full-node heimdalld[9285]: panic: Failed to process committed block (10630671:06B40BF366D3A029B3A5B2567C2714D46E183427AE35A03E070839B21E225A08): Wrong Block.Header.AppHash.  Expected 60C58E8E383EE496FC5430E1344878945D595A5266750C9B2F3FC25598CA5665, got CCB7437AFC0588D4A9514F52CB2F45FFA08313E489ED380E703FD5C38051F0F9
Dec 13 02:20:47 full-node heimdalld[9285]: goroutine 735 [running]:
Dec 13 02:20:47 full-node heimdalld[9285]: github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).poolRoutine(0xc003e12000)
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:344 +0x10c5
Dec 13 02:20:47 full-node heimdalld[9285]: created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:118 +0x7a
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Failed with result 'exit-code'.
</code>```

logs here

I then try to start once again the services again, with the mentioned commands and after checking the logs again, seems it exited instantaneously:

 journalctl -u heimdalld.service -f

```<code>-- Logs begin at Sat 2022-12-10 17:38:34 UTC. --
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:344 +0x10c5
Dec 13 02:20:47 full-node heimdalld[9285]: created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:118 +0x7a
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Failed with result 'exit-code'.
Dec 13 06:54:21 full-node systemd[1]: Started heimdalld.
Dec 13 06:54:21 full-node heimdalld[401489]: I[2022-12-13|06:54:21.946] starting ABCI with Tendermint                module=main
Dec 13 06:54:23 full-node heimdalld[401489]: ERROR: error during handshake: error on replay: Wrong Block.Header.AppHash.  Expected 60C58E8E383EE496FC5430E1344878945D595A5266750C9B2F3FC25598CA5665, got CCB7437AFC0588D4A9514F52CB2F45FFA08313E489ED380E703FD5C38051F0F9
Dec 13 06:54:24 full-node systemd[1]: heimdalld.service: Main process exited, code=exited, status=1/FAILURE
Dec 13 06:54:24 full-node systemd[1]: heimdalld.service: Failed with result 'exit-code'.
</code>```

logs here

checked the error and this github thread is all I found.
Can someone please help, I dont want to go over syncing a heimdall node for another 9-10 days. Is redoing everything the only way?

Body:
I have been trying to run a polygon full node according to the official documentation. I ran the node on a Ubuntu 20.04.4 LTS with the requiered specs according to the docs.
followed everything step by step and ran the commands for syncing the heimdall service:

sudo service heimdalld start

sudo service heimdalld-rest-server start

This took quite some time (9 days aproximately) and I checked on it every few hours. Last time I checked it everything was ok and blocks were being downloaded. Next morning I come and see the heimdall service is down, I check the logs and these is what it shows:

journalctl -u heimdalld.service -f

-- Logs begin at Sat 2022-12-10 17:38:34 UTC. --
Dec 13 02:20:47 full-node heimdalld[9285]: I[2022-12-13|02:20:47.726] Executed block
   module=state height=10630670 validTxs=1 invalidTxs=1
Dec 13 02:20:47 full-node heimdalld[9285]: I[2022-12-13|02:20:47.747] Committed state
   module=state height=10630670 txs=2 appHash=60C58E8E383EE496FC5430E1344878945D595A5266750C9B2F3FC25598CA5665
Dec 13 02:20:47 full-node heimdalld[9285]: panic: Failed to process committed block (10630671:06B40BF366D3A029B3A5B2567C2714D46E183427AE35A03E070839B21E225A08): Wrong Block.Header.AppHash.  Expected 60C58E8E383EE496FC5430E1344878945D595A5266750C9B2F3FC25598CA5665, got CCB7437AFC0588D4A9514F52CB2F45FFA08313E489ED380E703FD5C38051F0F9
Dec 13 02:20:47 full-node heimdalld[9285]: goroutine 735 [running]:
Dec 13 02:20:47 full-node heimdalld[9285]: github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).poolRoutine(0xc003e12000)
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:344 +0x10c5
Dec 13 02:20:47 full-node heimdalld[9285]: created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:118 +0x7a
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Failed with result 'exit-code'.

logs here

I then try to start once again the services again, with the mentioned commands and after checking the logs again, seems it exited instantaneously:

 journalctl -u heimdalld.service -f

-- Logs begin at Sat 2022-12-10 17:38:34 UTC. --
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:344 +0x10c5
Dec 13 02:20:47 full-node heimdalld[9285]: created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart
Dec 13 02:20:47 full-node heimdalld[9285]:         /home/infra/go/pkg/mod/github.com/maticnetwork/tendermint@v0.26.0-dev0.0.20220803122020-9c20f6000900/blockchain/v0/reactor.go:118 +0x7a
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 13 02:20:47 full-node systemd[1]: heimdalld.service: Failed with result 'exit-code'.
Dec 13 06:54:21 full-node systemd[1]: Started heimdalld.
Dec 13 06:54:21 full-node heimdalld[401489]: I[2022-12-13|06:54:21.946] starting ABCI with Tendermint                module=main
Dec 13 06:54:23 full-node heimdalld[401489]: ERROR: error during handshake: error on replay: Wrong Block.Header.AppHash.  Expected 60C58E8E383EE496FC5430E1344878945D595A5266750C9B2F3FC25598CA5665, got CCB7437AFC0588D4A9514F52CB2F45FFA08313E489ED380E703FD5C38051F0F9
Dec 13 06:54:24 full-node systemd[1]: heimdalld.service: Main process exited, code=exited, status=1/FAILURE
Dec 13 06:54:24 full-node systemd[1]: heimdalld.service: Failed with result 'exit-code'.

logs here

checked the error and this github thread is all I found.
Can someone please help, I dont want to go over syncing a heimdall node for another 9-10 days. Is redoing everything the only way?


问:
Text strings must be rendered within a <Text> component
I am new in React native and now I am stuck.

The error which I am getting is when I am passing a log to check if there are any internal errors in my applications but I don't know why I am getting this error as Text components has nothing to do with the log.

Here is the code:

```<code>import React from "react";
import { Text, View, Image, TouchableOpacity } from "react-native";
import Container from "../common/Container";
import Input from "../common/input";
import CustomButton from "../common/CustomButton";
import styles from "./styles";
import { LOGIN } from "../../constants/rountNames";
import { useNavigation } from "@react-navigation/native";

const RegisterComponents = ({ onChange, onSubmit, form, errors, loading, error }) => {

    const { navigate } = useNavigation();
    return (<Container>

        <Image height={70} width={70} style={styles.logoImage} source={require('../../assests/images/logo.png')} />

        <View>

            <Text style={styles.title}> Welcome to RNContact</Text>
            <Text style={styles.subTitle}> Create a free account</Text>

            <View style={styles.form}>
                {error?.error && <Text>{error.error}</Text>}
                <Input label="Username"
                    iconPosition="right"
                    placeholder="Enter Username"
                    onChangeText={(value) => {
                        onChange({ name: "userName", value })
                    }}
                    error={errors.userName}
                />

                <Input label="First name"
                    iconPosition="right"
                    placeholder="Enter First name"
                    onChangeText={(value) => {
                        onChange({ name: "firstName", value })
                    }}
                    error={errors.firstName}
                />

                <Input label="Last name"
                    iconPosition="right"
                    placeholder="Enter Last name"
                    onChangeText={(value) => {
                        onChange({ name: "lastName", value })
                    }}
                    error={errors.lastName}
                />

                <Input label="Email"
                    iconPosition="right"
                    placeholder="Enter Email"
                    onChangeText={(value) => {
                        onChange({ name: "email", value })
                    }}
                    error={errors.email}
                />

                <Input label="Password"
                    icon={<Text>SHOW</Text>}
                    secureTextEntry={true}
                    iconPosition="right"
                    placeholder="Enter Password"
                    onChangeText={(value) => {
                        onChange({ name: "password", value })
                    }}
                    error={errors.password}
                />

                **{console.log('error', error)};**
                <CustomButton
                    loading={loading}
                    onPress={onSubmit}
                    disabled={loading}
                    primary title="Submit" />

                <View style={styles.createSection}>
                    <Text style={styles.infoText}>Already have an account?</Text>
                    <TouchableOpacity
                        onPress={() => {
                            navigate(LOGIN);
                        }}>
                        <Text style={styles.linkBtn}>Login</Text>
                    </TouchableOpacity>
                </View>
            </View>
        </View>
    </Container>
    );
};

export default RegisterComponents;
</code>```

So the code should work like this:

When I click on the submit button then if there are an internal or server related error it should show me in the log.

I checked all the tags and semicolons but they look fine. but still not able to figure out the cause of the error.

Body:
I am new in React native and now I am stuck.

The error which I am getting is when I am passing a log to check if there are any internal errors in my applications but I don't know why I am getting this error as Text components has nothing to do with the log.

Here is the code:

import React from "react";
import { Text, View, Image, TouchableOpacity } from "react-native";
import Container from "../common/Container";
import Input from "../common/input";
import CustomButton from "../common/CustomButton";
import styles from "./styles";
import { LOGIN } from "../../constants/rountNames";
import { useNavigation } from "@react-navigation/native";

const RegisterComponents = ({ onChange, onSubmit, form, errors, loading, error }) => {

    const { navigate } = useNavigation();
    return (<Container>

        <Image height={70} width={70} style={styles.logoImage} source={require('../../assests/images/logo.png')} />

        <View>

            <Text style={styles.title}> Welcome to RNContact</Text>
            <Text style={styles.subTitle}> Create a free account</Text>

            <View style={styles.form}>
                {error?.error && <Text>{error.error}</Text>}
                <Input label="Username"
                    iconPosition="right"
                    placeholder="Enter Username"
                    onChangeText={(value) => {
                        onChange({ name: "userName", value })
                    }}
                    error={errors.userName}
                />

                <Input label="First name"
                    iconPosition="right"
                    placeholder="Enter First name"
                    onChangeText={(value) => {
                        onChange({ name: "firstName", value })
                    }}
                    error={errors.firstName}
                />

                <Input label="Last name"
                    iconPosition="right"
                    placeholder="Enter Last name"
                    onChangeText={(value) => {
                        onChange({ name: "lastName", value })
                    }}
                    error={errors.lastName}
                />

                <Input label="Email"
                    iconPosition="right"
                    placeholder="Enter Email"
                    onChangeText={(value) => {
                        onChange({ name: "email", value })
                    }}
                    error={errors.email}
                />

                <Input label="Password"
                    icon={<Text>SHOW</Text>}
                    secureTextEntry={true}
                    iconPosition="right"
                    placeholder="Enter Password"
                    onChangeText={(value) => {
                        onChange({ name: "password", value })
                    }}
                    error={errors.password}
                />

                **{console.log('error', error)};**
                <CustomButton
                    loading={loading}
                    onPress={onSubmit}
                    disabled={loading}
                    primary title="Submit" />

                <View style={styles.createSection}>
                    <Text style={styles.infoText}>Already have an account?</Text>
                    <TouchableOpacity
                        onPress={() => {
                            navigate(LOGIN);
                        }}>
                        <Text style={styles.linkBtn}>Login</Text>
                    </TouchableOpacity>
                </View>
            </View>
        </View>
    </Container>
    );
};

export default RegisterComponents;

So the code should work like this:

When I click on the submit button then if there are an internal or server related error it should show me in the log.

I checked all the tags and semicolons but they look fine. but still not able to figure out the cause of the error.


问:
How can i add a co-orgainizer or co-host while creating an event by using Microsoft Graph API?
We have almost 50 users (tutors) and daily we create some events with meeting for their classes with students
, so the Problem is that in case if any user(tutor) is not available at the time of meeting or event so we want that in place of that not available user(tutor) any other user(tutor) could take the class , so for that purpouse i want to add a co-host or co-organizer for every event or meeting How can i do that using graph api ?

endpoint i am calling to create event is (userId is email of the orgainizer in the endpoint)

```<code>axios.post(`https://graph.microsoft.com/v1.0/users/${userId}/calendar/events`,requestBody,options)
</code>```

request body is

```<code>requestBody = {
    subject:MeetSubject,
    start:{
        dateTime:isoStart,
        timezone:'UTC'
    },
    end:{
        dateTime:isoEnd,
        timezone:'UTC'
    },

    recurrence: recurrenceData,
    attendees: [
      {
        emailAddress: {
          address: attendeEmail,
          name: attendeName,
        },
        type: 'required',
      },
    ],
    isOnlineMeeting: true,
    onlineMeetingProvider: 'teamsForBusiness'
  };
</code>```

Body:
We have almost 50 users (tutors) and daily we create some events with meeting for their classes with students
, so the Problem is that in case if any user(tutor) is not available at the time of meeting or event so we want that in place of that not available user(tutor) any other user(tutor) could take the class , so for that purpouse i want to add a co-host or co-organizer for every event or meeting How can i do that using graph api ?

endpoint i am calling to create event is (userId is email of the orgainizer in the endpoint)

axios.post(`https://graph.microsoft.com/v1.0/users/${userId}/calendar/events`,requestBody,options)

request body is

requestBody = {
    subject:MeetSubject,
    start:{
        dateTime:isoStart,
        timezone:'UTC'
    },
    end:{
        dateTime:isoEnd,
        timezone:'UTC'
    },

    recurrence: recurrenceData,
    attendees: [
      {
        emailAddress: {
          address: attendeEmail,
          name: attendeName,
        },
        type: 'required',
      },
    ],
    isOnlineMeeting: true,
    onlineMeetingProvider: 'teamsForBusiness'
  };


问:
Program exceeds time limit
this is my first time coming here with a question, please don't beat me up too much.
I'm trying to solve a problem and can't figure out how to optimize it
The program doesn't pass the time limit

I tried to reduce the time to check the row for a number in the range by using the ArraySegment method, but I could not implement it correctly

Time limit: 1 second
Memory limitation: 256 MiB
A virologist experimented on K strains of the virus and recorded the temperatures at which that strain died. The number of experiments on each strain could be different. Let's call the size of the temperature range, which is fatal for all strains of the virus, the difference between the boundaries of the temperature range, which contains at least one temperature to kill each of the strains of the virus. Help the virologist determine the minimum possible size of such a range.

The format of the input data is.

The first line contains a single positive integer K the number of virus strains, 1 <= K <= 10^5 Then k lines containing spaces separated integers. The first number in the i-th row is the number of experiments on the i-th strain which ended in the destruction of the strain, 1 < Mi < 10^5, then Mi, the temperature values in the experiments in which the strain died, all values in the range from -10^7 to 10^7. The total number of experiments performed on all strains does not exceed 10^5.

Output data format

One integer is the minimum possible size of the temperature range that is lethal for all strains of the virus.

Example
Test

3

5 3 9 15 24 20

4 1 9 13 14

4 5 15 12 11

Answer

1

```<code>using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;

namespace SkuratovAvtomat
{
    internal class Program
    {
        public static void Main()
        {
            int gr1, gr2;
            int min = Int32.MaxValue;
            int kount = Convert.ToInt32(Console.ReadLine());
            int j;
            int[][] virus = new int [kount][];
            List<int> temp = new List<int>();

            for (int i = 0; i < kount; i++)
            {
                List<int> tempp = new List<int>();
                int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                virus[i] = input;
                tempp.AddRange(virus[i]);
                tempp.RemoveRange(0,1);
                temp.AddRange(tempp);
            }

            SortedSet<int> sorttemp = new SortedSet<int>(temp);
            temp.Clear();
            temp = sorttemp.ToList();
            int y = temp.Count;
            for (int i = 0; i < y; i++)
             {

                 gr1 = temp[i];
                 for (int k = i; k < y; k++)
                 {
                     j = 0;
                     gr2 = temp[k];

                     for (int o = 0; o < kount; o++)
                     {
                         bool prov = false;
                         for (int l = 1; l < virus[o].Length; l++)
                         {
                             if (gr1 <= virus[o][l] & virus[o][l] <= gr2)
                             {
                                 j++;
                                 prov = true;
                                 break;
                             }
                         }
                         if (prov == false)
                             break;
                     }
                     if(j == kount)
                         min = Math.Min(Math.Abs(gr1 - gr2), min);
                 }
             }
             Console.WriteLine(min);
        }
    }
}
</code>```

Here you can find input file that i have problem https://drive.google.com/file/d/1VvC_osh5NM6ww35p9qjarLd3PYHiJB7c/view?usp=sharing

Title: Program exceeds time limit

Body:
this is my first time coming here with a question, please don't beat me up too much.
I'm trying to solve a problem and can't figure out how to optimize it
The program doesn't pass the time limit

I tried to reduce the time to check the row for a number in the range by using the ArraySegment method, but I could not implement it correctly

Time limit: 1 second
Memory limitation: 256 MiB
A virologist experimented on K strains of the virus and recorded the temperatures at which that strain died. The number of experiments on each strain could be different. Let's call the size of the temperature range, which is fatal for all strains of the virus, the difference between the boundaries of the temperature range, which contains at least one temperature to kill each of the strains of the virus. Help the virologist determine the minimum possible size of such a range.

The format of the input data is.

The first line contains a single positive integer K the number of virus strains, 1 <= K <= 10^5 Then k lines containing spaces separated integers. The first number in the i-th row is the number of experiments on the i-th strain which ended in the destruction of the strain, 1 < Mi < 10^5, then Mi, the temperature values in the experiments in which the strain died, all values in the range from -10^7 to 10^7. The total number of experiments performed on all strains does not exceed 10^5.

Output data format

One integer is the minimum possible size of the temperature range that is lethal for all strains of the virus.

Example
Test

3

5 3 9 15 24 20

4 1 9 13 14

4 5 15 12 11

Answer

1

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;

namespace SkuratovAvtomat
{
    internal class Program
    {
        public static void Main()
        {
            int gr1, gr2;
            int min = Int32.MaxValue;
            int kount = Convert.ToInt32(Console.ReadLine());
            int j;
            int[][] virus = new int [kount][];
            List<int> temp = new List<int>();

            for (int i = 0; i < kount; i++)
            {
                List<int> tempp = new List<int>();
                int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                virus[i] = input;
                tempp.AddRange(virus[i]);
                tempp.RemoveRange(0,1);
                temp.AddRange(tempp);
            }

            SortedSet<int> sorttemp = new SortedSet<int>(temp);
            temp.Clear();
            temp = sorttemp.ToList();
            int y = temp.Count;
            for (int i = 0; i < y; i++)
             {

                 gr1 = temp[i];
                 for (int k = i; k < y; k++)
                 {
                     j = 0;
                     gr2 = temp[k];

                     for (int o = 0; o < kount; o++)
                     {
                         bool prov = false;
                         for (int l = 1; l < virus[o].Length; l++)
                         {
                             if (gr1 <= virus[o][l] & virus[o][l] <= gr2)
                             {
                                 j++;
                                 prov = true;
                                 break;
                             }
                         }
                         if (prov == false)
                             break;
                     }
                     if(j == kount)
                         min = Math.Min(Math.Abs(gr1 - gr2), min);
                 }
             }
             Console.WriteLine(min);
        }
    }
}

Here you can find input file that i have problem https://drive.google.com/file/d/1VvC_osh5NM6ww35p9qjarLd3PYHiJB7c/view?usp=sharing


问:
How to send user's full name and email to database with django
When I try to send the full name and email, it returns a value like this

<bound method AbstractUser.get_full_name of <User: keremedeler>>

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

To send the e-mail, I added a function like this to the models.py file of the user class, and it sent a response like this:

```<code><bound method AbstractUser.get_email of <User: keremedeler>>

def get_email(self):
        email = self.email
</code>```

Body:
When I try to send the full name and email, it returns a value like this

<bound method AbstractUser.get_full_name of <User: keremedeler>>

To send the e-mail, I added a function like this to the models.py file of the user class, and it sent a response like this:

<bound method AbstractUser.get_email of <User: keremedeler>>

def get_email(self):
        email = self.email


问:
Spark job fails with org.apache.spark.SparkException: Job 207 cancelled because SparkContext was shut down
I am running a AWS Glue job, with pyspark, where I read a json file from S3, do some transformations on it, and then save it back to the same location. The following is the behavior

```<code>df = spark.read.json(path)
checkpoint the df and read again
df = df.transformation1()
df = df.transformation2()
print(df.count())
df.write(s3_path)
</code>```

The count gets printed, but the write to S3 fails with the exception Spark job fails with org.apache.spark.SparkException: Job 207 cancelled because SparkContext was shut down

After searching online, it seems like this is an OOM issue. The data in question is in MBs, so its pretty small. Considering that the count operation succeeds, and write fails, would it make sense to persist the dataframe before the count, so that the write would probably succeed as the data to write is already computed and persisted.

Other error logs that I found:

```<code>Lost executor 2 on 172.36.186.165: Remote RPC client disassociated. Likely due to containers exceeding thresholds, or network issues. Check driver logs for WARN
</code>```

Body:
I am running a AWS Glue job, with pyspark, where I read a json file from S3, do some transformations on it, and then save it back to the same location. The following is the behavior

df = spark.read.json(path)
checkpoint the df and read again
df = df.transformation1()
df = df.transformation2()
print(df.count())
df.write(s3_path)

The count gets printed, but the write to S3 fails with the exception Spark job fails with org.apache.spark.SparkException: Job 207 cancelled because SparkContext was shut down

After searching online, it seems like this is an OOM issue. The data in question is in MBs, so its pretty small. Considering that the count operation succeeds, and write fails, would it make sense to persist the dataframe before the count, so that the write would probably succeed as the data to write is already computed and persisted.

Other error logs that I found:

Lost executor 2 on 172.36.186.165: Remote RPC client disassociated. Likely due to containers exceeding thresholds, or network issues. Check driver logs for WARN


问:
LoopbackCapture (`ActivateAudioInterfaceAsync` with `VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK` ), m_AudioClient->GetMixFormat failed with E_NOTIMPL
I use the applicationloopbackaudio-sample to record system audio, it works fine. However, the capture format is hard coded:

```<code> // The app can also call m_AudioClient->GetMixFormat instead to get the capture format.
 // 16 - bit PCM format.
 m_CaptureFormat.wFormatTag = WAVE_FORMAT_PCM;
 m_CaptureFormat.nChannels = 2;
 m_CaptureFormat.nSamplesPerSec = 44100;
 m_CaptureFormat.wBitsPerSample = 16;
 m_CaptureFormat.nBlockAlign = m_CaptureFormat.nChannels * m_CaptureFormat.wBitsPerSample / 8;
 m_CaptureFormat.nAvgBytesPerSec = m_CaptureFormat.nSamplesPerSec * m_CaptureFormat.nBlockAlign;
</code>```

according to the comment, I can use m_AudioClient->GetMixFormat to get the capture format, but it failed with error code: E_NOTIMPL

```<code> WAVEFORMATEX* pWfxOut = NULL;
 HRESULT hr = m_AudioClient->GetMixFormat(&pWfxOut);
 // hr is E_NOTIMPL, failed to GetMixFormat
</code>```

I'd like to know:

why does this happen?

how should I get the valid capture format supported by System?
Many thanks.

Environment:
Visual Studio 2019, Windows SDK20348

Body:
I use the applicationloopbackaudio-sample to record system audio, it works fine. However, the capture format is hard coded:

 // The app can also call m_AudioClient->GetMixFormat instead to get the capture format.
 // 16 - bit PCM format.
 m_CaptureFormat.wFormatTag = WAVE_FORMAT_PCM;
 m_CaptureFormat.nChannels = 2;
 m_CaptureFormat.nSamplesPerSec = 44100;
 m_CaptureFormat.wBitsPerSample = 16;
 m_CaptureFormat.nBlockAlign = m_CaptureFormat.nChannels * m_CaptureFormat.wBitsPerSample / 8;
 m_CaptureFormat.nAvgBytesPerSec = m_CaptureFormat.nSamplesPerSec * m_CaptureFormat.nBlockAlign;

according to the comment, I can use m_AudioClient->GetMixFormat to get the capture format, but it failed with error code: E_NOTIMPL

 WAVEFORMATEX* pWfxOut = NULL;
 HRESULT hr = m_AudioClient->GetMixFormat(&pWfxOut);
 // hr is E_NOTIMPL, failed to GetMixFormat

I'd like to know:

why does this happen?

how should I get the valid capture format supported by System?
Many thanks.

Environment:
Visual Studio 2019, Windows SDK20348