问:
Bad state: cannot get a field on a DocumentSnapshotPlatform which does not exist
I'm new to Flutter and don't know about some things so please bare with me if any childish mistake is here, when I turn off the interne connection it throws this error :

```<code>Another exception was thrown: Bad state: cannot get a field on a DocumentSnapshotPlatform which does not exist

Another exception was thrown: SocketException: Failed host lookup: 'upload.wikimedia.org' (OS Error: No address associated with hostname, errno = 7)

Another exception was thrown: SocketException: Failed host lookup: 'upload.wikimedia.org' (OS Error: No address associated with hostname, errno = 7)
W/Firestore(29279): (24.4.1) [WatchStream]: (89a1d50) Stream closed with status: Status{code=UNAVAILABLE, description=Unable to resolve host firestore.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/Firestore(29279):     at java.lang.Thread.run(Thread.java:764)
W/Firestore(29279): Caused by: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:141)
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90)
W/Firestore(29279):     at java.net.InetAddress.getAllByName(InetAddress.java:787)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:631)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219)
W/Firestore(29279):     ... 5 more
W/Firestore(29279): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/Firestore(29279):     at libcore.io.Linux.android_getaddrinfo(Native Method)
W/Firestore(29279):     at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:59)
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:122)
W/Firestore(29279):     ... 9 more
W/Firestore(29279): }.
W/ManagedChannelImpl(29279): [{0}] Failed to resolve name. status={1}
W/Firestore(29279): (24.4.1) [WatchStream]: (89a1d50) Stream closed with status: Status{code=UNAVAILABLE, description=Unable to resolve host firestore.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/Firestore(29279):     at java.lang.Thread.run(Thread.java:764)
W/Firestore(29279): Caused by: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:111)
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90)
W/Firestore(29279):     at java.net.InetAddress.getAllByName(InetAddress.java:787)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:631)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219)
W/Firestore(29279):     ... 5 more
W/Firestore(29279): }.
</code>```

profile_page.dart

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:devscore/Services/Authentication.dart';
import 'package:devscore/screens/home_page/profile_page/profile_helpers.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';

class ProfilePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black87,
      appBar: AppBar(
        systemOverlayStyle: SystemUiOverlayStyle(
            statusBarColor: Colors.black,
            statusBarIconBrightness: Brightness.light),

        backgroundColor: Colors.black,
        centerTitle: true,

        // ignore: prefer_const_constructors
        title: Text(
          'DevsCore',
          style: TextStyle(
              color: Colors.white, fontFamily: 'kenia', fontSize: 35.0),
        ),
        actions: [
          IconButton(
            onPressed: () {
              Provider.of<ProfileHelpers>(context, listen: false)
                  .logOutDialog(context);
            },
            icon: Icon(
              EvaIcons.logOutOutline,
              color: Colors.white,
            ),
          ),
        ],
      ),
      body: SingleChildScrollView(
        child: Container(
            height: MediaQuery.of(context).size.height,
            width: MediaQuery.of(context).size.width,
            child: StreamBuilder<DocumentSnapshot>(
                stream: FirebaseFirestore.instance
                    .collection('users')
                    .doc(Provider.of<Authentication>(context, listen: false)
                        .getUserUid)
                    .snapshots(),
                builder: (BuildContext context, snapshot) {
                  if (snapshot.hasData) {
                    // ignore: unnecessary_new
                    return Column(
                      children: [
                        Provider.of<ProfileHelpers>(context, listen: false)
                            .headerProfile(context, snapshot),
                        Provider.of<ProfileHelpers>(context, listen: false)
                            .divider(context),
                        Provider.of<ProfileHelpers>(context, listen: false)
                            .FooterProfile(context, snapshot)
                      ],
                    );
                  } else {
                    return Center(child: CircularProgressIndicator());
                  }
                }),
            decoration: BoxDecoration(
                color: Colors.black,
                borderRadius: BorderRadius.circular(15.0))),
      ),
    );
  }
}

```
<p><code>profile_helpers.dart</code></p>
<pre class="lang-dart prettyprint-override"><code>import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:devscore/Services/Authentication.dart';
import 'package:devscore/components/dialog_button.dart';
import 'package:devscore/screens/landing_page.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import 'package:provider/provider.dart';

class ProfileHelpers with ChangeNotifier {
  Widget headerProfile(
      BuildContext context, AsyncSnapshot<DocumentSnapshot> snapshot) {
    return SizedBox(
      height: MediaQuery.of(context).size.height * .21,
      width: MediaQuery.of(context).size.width * 0.95,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          Padding(
            padding: const EdgeInsets.only(top: 10.0),
            child: Container(
              width: MediaQuery.of(context).size.width * 0.31,
              // color: Colors.red,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  GestureDetector(
                    onTap: () {},
                    child: CircleAvatar(
                      backgroundColor: Colors.white,
                      radius: 60.0,
                      backgroundImage: NetworkImage(
                          snapshot.data!.get(FieldPath(['userimage']))),
                    ),
                  ),
                  Text(
                    snapshot.data!.get(FieldPath(['username'])).toString(),

                    // 'UserName',
                    style: TextStyle(
                        color: Colors.white, fontWeight: FontWeight.bold),
                  )
                ],
              ),
            ),
          ),
          SizedBox(
            width: 15.0,
          ),
          Padding(
            padding: const EdgeInsets.only(top: 10.0),
            child: Container(
              width: MediaQuery.of(context).size.width * 0.55,
              // color: Colors.red,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          '11',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(
                          height: 2.0,
                        ),
                        Text(
                          'Posts',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                  ),
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          '69',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(
                          height: 2.0,
                        ),
                        Text(
                          'Followers',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                  ),
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          '69',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(
                          height: 2.0,
                        ),
                        Text(
                          'Following',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

  Widget divider(BuildContext context) {
    return Center(
      child: SizedBox(
        height: 40.0,
        width: MediaQuery.of(context).size.width * 0.8,
        child: Divider(
          color: Colors.grey,
        ),
      ),
    );
  }

  Widget FooterProfile(BuildContext context, AsyncSnapshot snapshot) {
    return Padding(
      padding: EdgeInsets.all(8.0),
      child: Container(
        child: Image.asset('assets/images/DevsCore-removebg-preview.png'),
        height: MediaQuery.of(context).size.height * .53,
        width: MediaQuery.of(context).size.width,
        decoration: BoxDecoration(
          color: Colors.black,
        ),
      ),
    );
  }

  Future logOutDialog(BuildContext context) {
    return showDialog(
        context: context,
        builder: (context) {
          return AlertDialog(
            title: Text(
              'Logout of the DevsCore ?',
              style: TextStyle(
                fontFamily: 'pacifico',
                color: Colors.black,
                fontSize: 16.0,
              ),
            ),
            actions: [
              DialogButton(
                text: 'No',
                onPressed: () {
                  Navigator.pop(context);
                },
              ),
              DialogButton(
                  onPressed: () {
                    Provider.of<Authentication>(context, listen: false)
                        .logoutViaEmail()
                        .whenComplete(() {
                      Navigator.pushReplacement(
                          context,
                          PageTransition(
                              child: LandingPage(),
                              type: PageTransitionType.fade));
                    });
                  },
                  text: 'Yes')
            ],
          );
        });
  }
}
</code>```

Body:
I'm new to Flutter and don't know about some things so please bare with me if any childish mistake is here, when I turn off the interne connection it throws this error :

Another exception was thrown: Bad state: cannot get a field on a DocumentSnapshotPlatform which does not exist

Another exception was thrown: SocketException: Failed host lookup: 'upload.wikimedia.org' (OS Error: No address associated with hostname, errno = 7)

Another exception was thrown: SocketException: Failed host lookup: 'upload.wikimedia.org' (OS Error: No address associated with hostname, errno = 7)
W/Firestore(29279): (24.4.1) [WatchStream]: (89a1d50) Stream closed with status: Status{code=UNAVAILABLE, description=Unable to resolve host firestore.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/Firestore(29279):     at java.lang.Thread.run(Thread.java:764)
W/Firestore(29279): Caused by: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:141)
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90)
W/Firestore(29279):     at java.net.InetAddress.getAllByName(InetAddress.java:787)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:631)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219)
W/Firestore(29279):     ... 5 more
W/Firestore(29279): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/Firestore(29279):     at libcore.io.Linux.android_getaddrinfo(Native Method)
W/Firestore(29279):     at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:59)
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:122)
W/Firestore(29279):     ... 9 more
W/Firestore(29279): }.
W/ManagedChannelImpl(29279): [{0}] Failed to resolve name. status={1}
W/Firestore(29279): (24.4.1) [WatchStream]: (89a1d50) Stream closed with status: Status{code=UNAVAILABLE, description=Unable to resolve host firestore.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/Firestore(29279):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/Firestore(29279):     at java.lang.Thread.run(Thread.java:764)
W/Firestore(29279): Caused by: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:111)
W/Firestore(29279):     at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:90)
W/Firestore(29279):     at java.net.InetAddress.getAllByName(InetAddress.java:787)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:631)
W/Firestore(29279):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219)
W/Firestore(29279):     ... 5 more
W/Firestore(29279): }.

profile_page.dart

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:devscore/Services/Authentication.dart';
import 'package:devscore/screens/home_page/profile_page/profile_helpers.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';

class ProfilePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black87,
      appBar: AppBar(
        systemOverlayStyle: SystemUiOverlayStyle(
            statusBarColor: Colors.black,
            statusBarIconBrightness: Brightness.light),

        backgroundColor: Colors.black,
        centerTitle: true,

        // ignore: prefer_const_constructors
        title: Text(
          'DevsCore',
          style: TextStyle(
              color: Colors.white, fontFamily: 'kenia', fontSize: 35.0),
        ),
        actions: [
          IconButton(
            onPressed: () {
              Provider.of<ProfileHelpers>(context, listen: false)
                  .logOutDialog(context);
            },
            icon: Icon(
              EvaIcons.logOutOutline,
              color: Colors.white,
            ),
          ),
        ],
      ),
      body: SingleChildScrollView(
        child: Container(
            height: MediaQuery.of(context).size.height,
            width: MediaQuery.of(context).size.width,
            child: StreamBuilder<DocumentSnapshot>(
                stream: FirebaseFirestore.instance
                    .collection('users')
                    .doc(Provider.of<Authentication>(context, listen: false)
                        .getUserUid)
                    .snapshots(),
                builder: (BuildContext context, snapshot) {
                  if (snapshot.hasData) {
                    // ignore: unnecessary_new
                    return Column(
                      children: [
                        Provider.of<ProfileHelpers>(context, listen: false)
                            .headerProfile(context, snapshot),
                        Provider.of<ProfileHelpers>(context, listen: false)
                            .divider(context),
                        Provider.of<ProfileHelpers>(context, listen: false)
                            .FooterProfile(context, snapshot)
                      ],
                    );
                  } else {
                    return Center(child: CircularProgressIndicator());
                  }
                }),
            decoration: BoxDecoration(
                color: Colors.black,
                borderRadius: BorderRadius.circular(15.0))),
      ),
    );
  }
}

profile_helpers.dart

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:devscore/Services/Authentication.dart';
import 'package:devscore/components/dialog_button.dart';
import 'package:devscore/screens/landing_page.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import 'package:provider/provider.dart';

class ProfileHelpers with ChangeNotifier {
  Widget headerProfile(
      BuildContext context, AsyncSnapshot<DocumentSnapshot> snapshot) {
    return SizedBox(
      height: MediaQuery.of(context).size.height * .21,
      width: MediaQuery.of(context).size.width * 0.95,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          Padding(
            padding: const EdgeInsets.only(top: 10.0),
            child: Container(
              width: MediaQuery.of(context).size.width * 0.31,
              // color: Colors.red,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  GestureDetector(
                    onTap: () {},
                    child: CircleAvatar(
                      backgroundColor: Colors.white,
                      radius: 60.0,
                      backgroundImage: NetworkImage(
                          snapshot.data!.get(FieldPath(['userimage']))),
                    ),
                  ),
                  Text(
                    snapshot.data!.get(FieldPath(['username'])).toString(),

                    // 'UserName',
                    style: TextStyle(
                        color: Colors.white, fontWeight: FontWeight.bold),
                  )
                ],
              ),
            ),
          ),
          SizedBox(
            width: 15.0,
          ),
          Padding(
            padding: const EdgeInsets.only(top: 10.0),
            child: Container(
              width: MediaQuery.of(context).size.width * 0.55,
              // color: Colors.red,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          '11',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(
                          height: 2.0,
                        ),
                        Text(
                          'Posts',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                  ),
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          '69',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(
                          height: 2.0,
                        ),
                        Text(
                          'Followers',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                  ),
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          '69',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        ),
                        SizedBox(
                          height: 2.0,
                        ),
                        Text(
                          'Following',
                          style: TextStyle(
                              color: Colors.white, fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

  Widget divider(BuildContext context) {
    return Center(
      child: SizedBox(
        height: 40.0,
        width: MediaQuery.of(context).size.width * 0.8,
        child: Divider(
          color: Colors.grey,
        ),
      ),
    );
  }

  Widget FooterProfile(BuildContext context, AsyncSnapshot snapshot) {
    return Padding(
      padding: EdgeInsets.all(8.0),
      child: Container(
        child: Image.asset('assets/images/DevsCore-removebg-preview.png'),
        height: MediaQuery.of(context).size.height * .53,
        width: MediaQuery.of(context).size.width,
        decoration: BoxDecoration(
          color: Colors.black,
        ),
      ),
    );
  }

  Future logOutDialog(BuildContext context) {
    return showDialog(
        context: context,
        builder: (context) {
          return AlertDialog(
            title: Text(
              'Logout of the DevsCore ?',
              style: TextStyle(
                fontFamily: 'pacifico',
                color: Colors.black,
                fontSize: 16.0,
              ),
            ),
            actions: [
              DialogButton(
                text: 'No',
                onPressed: () {
                  Navigator.pop(context);
                },
              ),
              DialogButton(
                  onPressed: () {
                    Provider.of<Authentication>(context, listen: false)
                        .logoutViaEmail()
                        .whenComplete(() {
                      Navigator.pushReplacement(
                          context,
                          PageTransition(
                              child: LandingPage(),
                              type: PageTransitionType.fade));
                    });
                  },
                  text: 'Yes')
            ],
          );
        });
  }
}


来源: stackexchange

问:
How to avoid anti-spoofing measures in OpenStack?
I have created a virtual private network across two clusters in different regions. While the masters are able to communicate, I can't reach a worker across the virtual private network. I assume this is due to anti spoofing measures.

How I tried to fix it

I read (https://www.packetcoders.io/openstack-neutron-port-security-explained/ and https://www.redhat.com/en/blog/whats-coming-openstack-networking-kilo-release) that one needs to add allowed access pairs to all instances so that those allowed access pairs can access the worker. However I am unsure what IP needs to be allowed. I added the master's local ip in the subnet, its floating_ip and its ip in the virtual private network. None of these fixed my issue. I am still unable to reach the workers.

What I am looking for

A complete answer would be great, but ways to debug this further would be highly appreciated, too.

More info to avoid xy problem

I have started two clusters in different regions and have connected the masters using wireguard. They can already ping each other using subnet addresses. That's why I think that my problem is not wireguard related. If you think otherwise, I am happy to give additional info on this setup to avoid asking the wrong question.

ContentLicense: CC BY-SA 4.0


问:
"Add import ..." and "Add all unambiguous imports" quick fixes are missing in WebStorm
Today I found out that these two quick fixes are missing for me. It's very inconvenient. How can I revert back to normal?


问:
Android 12 Incoming call notification popup and full screen intent like whats app and true caller
In android 12 and 13 foreground and broad cast receivers restrictions  are that's why am unable find solution for this. android 11 achieved this solution using  foreground and broad cast receivers. facing problem with android 12 and 13 .

Please help me on this

thanks in advance


问:
How to disabled prettier import css
This is my order of css imports that should be

import '../styles/globals.css';
import '../public/assets/css/site.css';
import '../public/assets/css/responsive.css';
import '../public/assets/css/icons.css';
```
<p>But prettier makes it this way for me.</p>
<pre class="lang-js prettyprint-override"><code>import '../public/assets/css/icons.css';
import '../public/assets/css/responsive.css';
import '../public/assets/css/site.css';
import '../styles/globals.css';
</code>```

Responsive is not working because my responsive.css file is before site.css.

.prettierrc

```<code>{
    "trailingComma": "es5",
    "tabWidth": 4,
    "semi": true,
    "singleQuote": true,
    "printWidth": 120,
}

</code>```

How can i only disable prettier for these imports

Title: How to disabled prettier import css

Body:
This is my order of css imports that should be

import '../styles/globals.css';
import '../public/assets/css/site.css';
import '../public/assets/css/responsive.css';
import '../public/assets/css/icons.css';

But prettier makes it this way for me.

import '../public/assets/css/icons.css';
import '../public/assets/css/responsive.css';
import '../public/assets/css/site.css';
import '../styles/globals.css';

Responsive is not working because my responsive.css file is before site.css.

.prettierrc

{
    "trailingComma": "es5",
    "tabWidth": 4,
    "semi": true,
    "singleQuote": true,
    "printWidth": 120,
}

How can i only disable prettier for these imports


问:
Combining multiple databases using Processmaker triggers
I'm have difficulties combining/union 2 different databases in Processmaker using trigger. I have no issue getting value from the $oldDB but i have no idea how to combine both $oldDB and $newDB from the same table using union.

```<code>$oldDB = '18863150963a29172059b73074177825';
$newDB = '65738461163a2918f0d9097091237694';

$query1 = "SELECT app_uid, app_number, app_status FROM table WHERE drNumber = '$insertDrNo'";
$result1 = executeQuery($query1, $oldDB);
</code>```

above script worked but i need to combine/union both $oldDB and $newDB with similar table from both databases. Any help are much appreciated, thanks in advance.

Body:
I'm have difficulties combining/union 2 different databases in Processmaker using trigger. I have no issue getting value from the $oldDB but i have no idea how to combine both $oldDB and $newDB from the same table using union.

$oldDB = '18863150963a29172059b73074177825';
$newDB = '65738461163a2918f0d9097091237694';

$query1 = "SELECT app_uid, app_number, app_status FROM table WHERE drNumber = '$insertDrNo'";
$result1 = executeQuery($query1, $oldDB);

above script worked but i need to combine/union both $oldDB and $newDB with similar table from both databases. Any help are much appreciated, thanks in advance.


问:
Countdown Component Running Slow in Taiko + Gauge Automation Test
I have a problem in Taiko automation test as countdown components running so slow. Actually, not just countdown component, everything running slow. You can see the case in video below;

https://drive.google.com/file/d/1yxu_tt08Z0EBYTtWB8t0W0mFfEwApGgn/view?usp=sharing

Tried to switch browser

Tried to switch device


问:
AuthContext user is null on page refresh in Nextjs nested layout
I have following bit of code where <AuthContext> provide authentication objects and methods, <ProtectedRoute> component which guards the authentication required routes.

But the problem is when I login and refresh inside authenticated page, user object fetched from the useAuth hook returns null, but if I use next/link it works fine and user object is preserved.

AuthContext.tsx

```<code>const AuthContext = createContext<any>({})

export const useAuth = () => useContext(AuthContext)

type Props = {
  children: React.ReactNode
}

const LOGIN = gql`...`

export const AuthContextProvider = ({ children }: Props) => {
  const [user, setUser] = useState<object | null>(null)
  const [loginUser, { data, loading, error }] = useMutation(LOGIN)
  const router = useRouter()

  useEffect(() => {
    // in case of first login set user and token
    // push user to route he belongs
    if (data != null) {
      if (data.authenticate.jwt !== null) {
        console.log('Setting user with JWT decoding...')
        const decoded = jwt_decode(data.authenticate.jwt)
        setUser({
          role: decoded.role,
          id: decoded.id,
        })
        localStorage.setItem('token', data.authenticate.jwt)
      }
    }

    const token = localStorage.getItem('token')
    // if token is present set the user object
    if (token !== null) {
      console.log('Token present')
      const decoded = jwt_decode(token)
      // console.log(user)
      console.log(`Decoded token : ${JSON.stringify(decoded)}`)
      setUser({
        role: decoded.role,
        id: decoded.id,
      })
    } else {
      setUser(null)
    }
  }, [data])

  const login = async (username: string, password: string) => {
    loginUser({
      variables: {
        username,
        password,
      },
    })
  }

  const logOut = async () => {
    console.log('Logging out ...')
    setUser(null)
    data = null
    localStorage.removeItem('token')
  }

  // if (error) return <p>Submission error! ${error.message}</p>

  return (
    <AuthContext.Provider value={{ user, login, logOut }}>
      {error || loading ? null : children}
    </AuthContext.Provider>
  )
}

</code>```

ProtectedRoute.tsx

```<code>const PUBLIC_PATHS = ['/']
const ADMIN_ROUTES = [...]
const SUPERVISOR_ROUTES = [...]

export function ProtectedRoute({ children }: { children: React.ReactNode }) {
  const { user } = useAuth()
  const router = useRouter()
  const [authorized, setAuthorized] = useState(false)

  useEffect(() => {
    console.log(`Current User : ${JSON.stringify(user)}`)

    const isAdminRoute = ADMIN_ROUTES.includes(router.pathname)
    const isSupervisorRoute = SUPERVISOR_ROUTES.includes(router.pathname)

    // if an token is present send user to
    // authorized route
    if (user !== null) {
      // @ts-ignore
      if (user.role === 1 && isAdminRoute) {
        setAuthorized(true)
        console.log(`Pushing to ${router.pathname}`)
        router.push(router.pathname)
        // @ts-ignore
      } else if (user.role === 2 && isSupervisorRoute) {
        setAuthorized(true)
        console.log(`Pushing to ${router.pathname}`)
        router.push(router.pathname)
      } else {
        console.log(`Invalid role! user: ${JSON.stringify(user)}`)
      }
    } else {
      setAuthorized(false)
      console.log('Sending you to login page')
      // "/" have the login page
      router.push('/')
    }
  }, [user]) // router is avoided from deps to avoid infinite loop

  return <>{authorized && children}</>
}

</code>```

_app.tsx

```<code>export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
  getLayout?: (page: ReactElement) => ReactNode
}

type AppPropsWithLayout = AppProps & {
  Component: NextPageWithLayout
}

const noAuthRequired = ['/']

function App({ Component, pageProps }: AppPropsWithLayout) {
  const getLayout = Component.getLayout ?? ((page) => page)

  const router = useRouter()

  return (
    <ApolloProvider client={CLIENT}>
      <AuthContextProvider>
        {getLayout(
          noAuthRequired.includes(router.pathname) ? (
            <Component {...pageProps} />
          ) : (
            <ProtectedRoute>
              <Component {...pageProps} />
            </ProtectedRoute>
          ),
        )}
      </AuthContextProvider>
    </ApolloProvider>
  )
}

export default App

</code>```

Current possible workaround is to read JWT in the ProtectedRoute to get user information.

I there anyway to preserve user object on page refresh?

Body:
I have following bit of code where <AuthContext> provide authentication objects and methods, <ProtectedRoute> component which guards the authentication required routes.

But the problem is when I login and refresh inside authenticated page, user object fetched from the useAuth hook returns null, but if I use next/link it works fine and user object is preserved.

AuthContext.tsx

const AuthContext = createContext<any>({})

export const useAuth = () => useContext(AuthContext)

type Props = {
  children: React.ReactNode
}

const LOGIN = gql`...`

export const AuthContextProvider = ({ children }: Props) => {
  const [user, setUser] = useState<object | null>(null)
  const [loginUser, { data, loading, error }] = useMutation(LOGIN)
  const router = useRouter()

  useEffect(() => {
    // in case of first login set user and token
    // push user to route he belongs
    if (data != null) {
      if (data.authenticate.jwt !== null) {
        console.log('Setting user with JWT decoding...')
        const decoded = jwt_decode(data.authenticate.jwt)
        setUser({
          role: decoded.role,
          id: decoded.id,
        })
        localStorage.setItem('token', data.authenticate.jwt)
      }
    }

    const token = localStorage.getItem('token')
    // if token is present set the user object
    if (token !== null) {
      console.log('Token present')
      const decoded = jwt_decode(token)
      // console.log(user)
      console.log(`Decoded token : ${JSON.stringify(decoded)}`)
      setUser({
        role: decoded.role,
        id: decoded.id,
      })
    } else {
      setUser(null)
    }
  }, [data])

  const login = async (username: string, password: string) => {
    loginUser({
      variables: {
        username,
        password,
      },
    })
  }

  const logOut = async () => {
    console.log('Logging out ...')
    setUser(null)
    data = null
    localStorage.removeItem('token')
  }

  // if (error) return
Submission error! ${error.message}

  return (
    <AuthContext.Provider value={{ user, login, logOut }}>
      {error || loading ? null : children}
    </AuthContext.Provider>
  )
}

ProtectedRoute.tsx

const PUBLIC_PATHS = ['/']
const ADMIN_ROUTES = [...]
const SUPERVISOR_ROUTES = [...]

export function ProtectedRoute({ children }: { children: React.ReactNode }) {
  const { user } = useAuth()
  const router = useRouter()
  const [authorized, setAuthorized] = useState(false)

  useEffect(() => {
    console.log(`Current User : ${JSON.stringify(user)}`)

    const isAdminRoute = ADMIN_ROUTES.includes(router.pathname)
    const isSupervisorRoute = SUPERVISOR_ROUTES.includes(router.pathname)

    // if an token is present send user to
    // authorized route
    if (user !== null) {
      // @ts-ignore
      if (user.role === 1 && isAdminRoute) {
        setAuthorized(true)
        console.log(`Pushing to ${router.pathname}`)
        router.push(router.pathname)
        // @ts-ignore
      } else if (user.role === 2 && isSupervisorRoute) {
        setAuthorized(true)
        console.log(`Pushing to ${router.pathname}`)
        router.push(router.pathname)
      } else {
        console.log(`Invalid role! user: ${JSON.stringify(user)}`)
      }
    } else {
      setAuthorized(false)
      console.log('Sending you to login page')
      // "/" have the login page
      router.push('/')
    }
  }, [user]) // router is avoided from deps to avoid infinite loop

  return <>{authorized && children}</>
}

_app.tsx

export type NextPageWithLayout
 = NextPage
 & {
  getLayout?: (page: ReactElement) => ReactNode
}

type AppPropsWithLayout = AppProps & {
  Component: NextPageWithLayout
}

const noAuthRequired = ['/']

function App({ Component, pageProps }: AppPropsWithLayout) {
  const getLayout = Component.getLayout ?? ((page) => page)

  const router = useRouter()

  return (
    <ApolloProvider client={CLIENT}>
      <AuthContextProvider>
        {getLayout(
          noAuthRequired.includes(router.pathname) ? (
            <Component {...pageProps} />
          ) : (
            <ProtectedRoute>
              <Component {...pageProps} />
            </ProtectedRoute>
          ),
        )}
      </AuthContextProvider>
    </ApolloProvider>
  )
}

export default App

Current possible workaround is to read JWT in the ProtectedRoute to get user information.

I there anyway to preserve user object on page refresh?


问:
(Flutter-Firebase Auth) Ignoring header X-Firebase-Locale because its value was null
When tapping the sign in button instead of signing this error occurs:
Ignoring header X-Firebase-Locale because its value was null.
Also google-services.json, firebase Auth everything is connected.

error screenshot

Used controller.email.trim(),
Device is connected to internet,
google-service.json file is correctly placed,
Still getting same error


问:
How to display welcome message in dialogflow when a user opens the bot and display custom payload in chat web demo?
I am trying to design a chatbot for my company. In my company we mainly build applications for the bank sector. I was asked to design a bot for one of our clients. The plateform I am using to do it is dialogflow. I have finished the first step of my application but I have somes problems.
We want to integrate this bot in Whatssap messenger.

The first question is that how can I enable a welcome message whenever a user opens the chat in whatssap ? is it possible to do it ?

**The Second problem is : When I add a Custom payload json data, the payload dont gets displayed whenever I try to use the web demo functionality to interact with my bot. How can I solve this problem ?.
the custom payload I have added is :

```<code>  "richContent": [
    [
      {
        "options": [
          {
            "text": "Effectuer un virement."
          },
          {
            "text": "consulter solde."
          },
          {
            "text": "procéder à une ouverture de compte."
          }
        ],
        "type": "chips"
      }
    ]
  ]
}```**

All the informations get displayed in the bot except the payload I have added. Is there anyway to solve this problem ?
```

Body:
I am trying to design a chatbot for my company. In my company we mainly build applications for the bank sector. I was asked to design a bot for one of our clients. The plateform I am using to do it is dialogflow. I have finished the first step of my application but I have somes problems.
We want to integrate this bot in Whatssap messenger.

The first question is that how can I enable a welcome message whenever a user opens the chat in whatssap ? is it possible to do it ?

**The Second problem is : When I add a Custom payload json data, the payload dont gets displayed whenever I try to use the web demo functionality to interact with my bot. How can I solve this problem ?.
the custom payload I have added is :

  "richContent": [
    [
      {
        "options": [
          {
            "text": "Effectuer un virement."
          },
          {
            "text": "consulter solde."
          },
          {
            "text": "procéder à une ouverture de compte."
          }
        ],
        "type": "chips"
      }
    ]
  ]
}```**

All the informations get displayed in the bot except the payload I have added. Is there anyway to solve this problem ?


问:
My information is going through the API to the browser but not appearing
I am fetching my information from a API in node.js to a react app and the data is entering the browser but appearing not app

```<code>import './CSS_PSI.css'
import logout from './logout.ico';
import { Link } from 'react-router-dom';
import axios from 'axios';
import { useState, useEffect } from 'react';

function Projetos  ()  {

const [post, setpost] = useState([]);

useEffect(() => {
 fetch("/projeto/all")
    axios.get("/projeto/all").then((res) =>{
      setpost(res);
    });
}, []);

console.log(post);

return (
  <div className="App">
    {post?.length > 0 ? (
      post.map((value, key) => {
        return (

          <div className="post">
            <div className="title"> {value.titulo} </div>
            <div className="body">{value.regras}</div>
          </div>
        );
      })
    ) : (
      <div className="title">Data Loading.. </div>
    )}
  </div>
);
}

export default Projetos;
</code>```

The data is in the broser

various types of fetching but it still doesn't work

Body:
I am fetching my information from a API in node.js to a react app and the data is entering the browser but appearing not app

import './CSS_PSI.css'
import logout from './logout.ico';
import { Link } from 'react-router-dom';
import axios from 'axios';
import { useState, useEffect } from 'react';

function Projetos  ()  {

const [post, setpost] = useState([]);

useEffect(() => {
 fetch("/projeto/all")
    axios.get("/projeto/all").then((res) =>{
      setpost(res);
    });
}, []);

console.log(post);

return (

    {post?.length > 0 ? (
      post.map((value, key) => {
        return (

 {value.titulo}

{value.regras}

        );
      })
    ) : (

Data Loading..

    )}

);
}

export default Projetos;

The data is in the broser

various types of fetching but it still doesn't work


问:
How can an iOS app written in Swift be notified when USB flash drives connect or disconnect?
I'm working on an iOS app written in Swift and I want to be able to detect when USB flash drives are connected or disconnected from the device. How can I do this in my app?
I've looked into using the External Accessory framework, but I'm not sure how to get started. Can anyone provide some guidance or point me to some resources that can help me implement this feature in my app?
Any help would be greatly appreciated!

let keys: [URLResourceKey] = [
    .volumeNameKey, .volumeIsRemovableKey,
    .volumeIsEjectableKey, .volumeAvailableCapacityKey,
    .volumeTotalCapacityKey, .volumeUUIDStringKey,
    .volumeIsBrowsableKey, .volumeIsLocalKey, .isVolumeKey
]
let manager =
    FileManager.default.mountedVolumeURLs(includingResourceValuesForKeys: keys)

if let urls = manager {
    print(urls)
}
```

This code for example works on MacOS , I get a list of volumes.
However, in iOS it just returns nil.

Body:
I'm working on an iOS app written in Swift and I want to be able to detect when USB flash drives are connected or disconnected from the device. How can I do this in my app?
I've looked into using the External Accessory framework, but I'm not sure how to get started. Can anyone provide some guidance or point me to some resources that can help me implement this feature in my app?
Any help would be greatly appreciated!

let keys: [URLResourceKey] = [
    .volumeNameKey, .volumeIsRemovableKey,
    .volumeIsEjectableKey, .volumeAvailableCapacityKey,
    .volumeTotalCapacityKey, .volumeUUIDStringKey,
    .volumeIsBrowsableKey, .volumeIsLocalKey, .isVolumeKey
]
let manager =
    FileManager.default.mountedVolumeURLs(includingResourceValuesForKeys: keys)

if let urls = manager {
    print(urls)
}

This code for example works on MacOS , I get a list of volumes.
However, in iOS it just returns nil.


问:
Build a pyramid in java with a List of integers
I'm learning java and wanted to do this problem:

Build a pyramid from given input list of integer values. Numbers are to be sorted ascending from top to bottom, from left to right.

Empty spaces are to be filled with zeros. In order to make the pyramid symmetric input numbers should alternate with zeros.

For example, for input A={2, 4, 3, 5, 6, 1} the pyramid will look like:

[0,0,1,0,0]

[0,2,0,3,0]

[4,0,5,0,6]

I've written some code but the problem is that the solution comes out something like:

[0,1,2]

[0,1,2]

Instead it should be something like this:

[0,1,0]

[1,2,2]

Now I get an Array out of index error, what can I change?

```<code>public int[][] buildPyramid(List<Integer> inputNumbers)
    throws CannotBuildPyramidException {

    // Calculate the number of rows in the pyramid
    int rows = (int) (Math.sqrt(inputNumbers.size() * 2) - 1);

    // Initialize the 2D array that will hold the pyramid
    int[][] pyramid = new int[rows][rows];

    // Initialize the variables that will help us navigate through the pyramid
    int row = 0;
    int col = rows / 2;
    boolean isDown = true;

    // Iterate through the list of numbers and build the pyramid
    for (int num : inputNumbers) {
        pyramid[row][col] = num;

        if (isDown) {
            row++;
        } else {
            row--;
            col--;
        }

        if (row == rows) {
            row = rows - 2;
            col++;
            isDown = false;
        } else if (row < 0) {
            row = 1;
            isDown = true;
        }
    }

    // Print the pyramid
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < rows; j++) {
            if (pyramid[i][j] == 0) {
                System.out.print("0 ");
            } else {
                System.out.print(pyramid[i][j] + " ");
            }
        }
        System.out.println();
    }
    return pyramid;
}
</code>```

Body:
I'm learning java and wanted to do this problem:

Build a pyramid from given input list of integer values. Numbers are to be sorted ascending from top to bottom, from left to right.

Empty spaces are to be filled with zeros. In order to make the pyramid symmetric input numbers should alternate with zeros.

For example, for input A={2, 4, 3, 5, 6, 1} the pyramid will look like:

[0,0,1,0,0]

[0,2,0,3,0]

[4,0,5,0,6]

I've written some code but the problem is that the solution comes out something like:

[0,1,2]

[0,1,2]

Instead it should be something like this:

[0,1,0]

[1,2,2]

Now I get an Array out of index error, what can I change?

public int[][] buildPyramid(List<Integer> inputNumbers)
    throws CannotBuildPyramidException {

    // Calculate the number of rows in the pyramid
    int rows = (int) (Math.sqrt(inputNumbers.size() * 2) - 1);

    // Initialize the 2D array that will hold the pyramid
    int[][] pyramid = new int[rows][rows];

    // Initialize the variables that will help us navigate through the pyramid
    int row = 0;
    int col = rows / 2;
    boolean isDown = true;

    // Iterate through the list of numbers and build the pyramid
    for (int num : inputNumbers) {
        pyramid[row][col] = num;

        if (isDown) {
            row++;
        } else {
            row--;
            col--;
        }

        if (row == rows) {
            row = rows - 2;
            col++;
            isDown = false;
        } else if (row < 0) {
            row = 1;
            isDown = true;
        }
    }

    // Print the pyramid
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < rows; j++) {
            if (pyramid[i][j] == 0) {
                System.out.print("0 ");
            } else {
                System.out.print(pyramid[i][j] + " ");
            }
        }
        System.out.println();
    }
    return pyramid;
}


问:
Why in my component event handler, despite the re-render, one value is defined while the other one is not?
In my component handleClick function:

I'm using enqueueSnackbar (1) to create a notification

If errorSnackbar is defined (2) I'll close the error snackbar. This actually doesn't work!

asyncOpThatChangeTheState (3) performe some state changes

If something goes wrong, show the error snackbar (4)

Always close the loading snackbar (5) using the loadingSnackbar number ✅

What is not clear to me is: why, despite the re-render, the loadingSnackbar is still defined, while the errorSnackbar is not?

Code example:

const handleClick = async () => {
  // Show the loading snackbar
  const loadingSnackbar = enqueueSnackbar('Loading...'); // (1)

  // Close the previous error snackbar if any
  let errorSnackbar = null;
  if (errorSnackbar) { // (2) NOT WORKING: errorSnackbar always undefined!
    closeSnackbar(errorSnackbar);
  }

  try {
    await asyncOpThatChangeTheState(); // (3)
  }
  catch (error) {
    // Show the error snackbar
    errorSnackbar = enqueueSnackbar('Error.'); // (4)
  }
  finally {
    // Close the loading snackbar
    closeSnackbar(loadingSnackbar); // (5) WORKING: loadingSnackbar is defined
  }
};
```


问:
CSS and (or?) shortcode loading slow with LiteSpeed Cache
I have used this code:

```<code>form .this-class input[type="radio"]
{
position: fixed;
opacity: 0;
pointer-events: none;
}
</code>```

And the radio button is hidden when I load the page without caching. But when I turn on Litespeed Cache the radio button is shown for a split second before the CSS kicks in. I tried to turn off cache on that specific page where the CSS is supposed to be active, but it ain’t working.

The form which is affected is implemented through a shortcode (Contact Form 7).

Suggestions?

Body:
I have used this code:

form .this-class input[type="radio"]
{
position: fixed;
opacity: 0;
pointer-events: none;
}

And the radio button is hidden when I load the page without caching. But when I turn on Litespeed Cache the radio button is shown for a split second before the CSS kicks in. I tried to turn off cache on that specific page where the CSS is supposed to be active, but it ain’t working.

The form which is affected is implemented through a shortcode (Contact Form 7).

Suggestions?


问:
Unable to start jenkins in EC2-AWS linux server
I have installed java 1.8.* and set the JAVA_HOME path, and installed Jenkins from the official website as below in AWS EC2 Linux instance.

Java path: JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64 and
PATH=$PATH:$HOME/bin:$JAVA_HOME:$MAVEN_HOME:$M2

Jenkins commands used for installation:

```<code>sudo wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install jenkins
sudo systemctl start jenkins
</code>```

But jenkins failed to start. I don't have tomcat installed so port 8080 should be available. I have also set Java path at /etc/init.d/jenkins file
under section candidates="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64/bin/java"
started Jenkins as per above command, but the service was failing.
Error Description as  below:

```<code> systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
</code>```

systemctl status jenkins.service

```<code>jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Wed 2022-12-21 10:15:02 UTC; 10s ago
  Process: 20467 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
 Main PID: 20467 (code=exited, status=1/FAILURE)
Unit jenkins.service entered failed state.
jenkins.service failed.
 jenkins.service holdoff time over, scheduling restart.
 Stopped Jenkins Continuous Integration Server.
start request repeated too quickly for jenkins.service
Failed to start Jenkins Continuous Integration Server.
Unit jenkins.service entered failed state.
jenkins.service failed.
</code>```

request if anybody has solution for this, please do help with the resolution. Expecting service should start and running and at browser console I should get the Unlock Jenkins screen window.

Thanks

Body:
I have installed java 1.8.* and set the JAVA_HOME path, and installed Jenkins from the official website as below in AWS EC2 Linux instance.

Java path: JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64 and
PATH=$PATH:$HOME/bin:$JAVA_HOME:$MAVEN_HOME:$M2

Jenkins commands used for installation:

sudo wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install jenkins
sudo systemctl start jenkins

But jenkins failed to start. I don't have tomcat installed so port 8080 should be available. I have also set Java path at /etc/init.d/jenkins file
under section candidates="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64/bin/java"
started Jenkins as per above command, but the service was failing.
Error Description as  below:

 systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

systemctl status jenkins.service

jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Wed 2022-12-21 10:15:02 UTC; 10s ago
  Process: 20467 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
 Main PID: 20467 (code=exited, status=1/FAILURE)
Unit jenkins.service entered failed state.
jenkins.service failed.
 jenkins.service holdoff time over, scheduling restart.
 Stopped Jenkins Continuous Integration Server.
start request repeated too quickly for jenkins.service
Failed to start Jenkins Continuous Integration Server.
Unit jenkins.service entered failed state.
jenkins.service failed.

request if anybody has solution for this, please do help with the resolution. Expecting service should start and running and at browser console I should get the Unlock Jenkins screen window.

Thanks


问:
Can I autoload products and price lists in magento2?

My magento site will be used in multiple countries like Thailand, Malaysia, Indonesia, Phillipinse, Singapore. If a person open the site from Thailand, based on geo location, the site should automatically load thailand specific information like home page and price etc. If its opened from Malaysia, it should show Malaysia specific homepage and price.

Each country will have multiple product vendors who will send the product to the customer. Each vendor will have a separate account (username/password) and they can maintain their inventory/upload their product with their price from their account. The customer can see all products from all vendors for that country from which customer open the site.  After the customer place order, product vendor will receive an email about order according to the email id they have configure in their profile. If customer choose two seperate products from two different customer, then two different email should be generated and sent to product vendor. Later, product vendor will pack the product and send to the customer. After that, order status is closed.
What should I complete these functions?

I don`t know what should I do.


问:
Does EF Core supports XOR relationship constraint?
I can't find any information about the support of EF Core 7 for XOR relationship constraint.

Is the following relationship supported?


问:
Keycloak Cordova-Native get token using native http request
Presently I am developing Cordova Native based Application.
Right now login part completed. but I am struck at getting token part. My Backend team is blocking all calls from localhost. I want to overcome this by using native http API Using Cordova Advanced HTTP plugin. i am looking for example so I can replicate it.

this is the code keycloak using.

```<code>function processCallback(oauth, promise) {
        var code = oauth.code;
        var error = oauth.error;
        var prompt = oauth.prompt;

        var timeLocal = new Date().getTime();

        if (oauth['kc_action_status']) {
            kc.onActionUpdate && kc.onActionUpdate(oauth['kc_action_status']);
        }

        if (error) {
            if (prompt != 'none') {
                var errorData = { error: error, error_description: oauth.error_description };
                kc.onAuthError && kc.onAuthError(errorData);
                promise && promise.setError(errorData);
            } else {
                promise && promise.setSuccess();
            }
            return;
        } else if ((kc.flow != 'standard') && (oauth.access_token || oauth.id_token)) {
            authSuccess(oauth.access_token, null, oauth.id_token, true);
        }

        if ((kc.flow != 'implicit') && code) {
            var params = 'code=' + code + '&grant_type=authorization_code';
            var url = kc.endpoints.token();

            var req = new XMLHttpRequest();
            req.open('POST', url, true);
            req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

            params += '&client_id=' + encodeURIComponent(kc.clientId);
            params += '&redirect_uri=' + oauth.redirectUri;

            if (oauth.pkceCodeVerifier) {
                params += '&code_verifier=' + oauth.pkceCodeVerifier;
            }

            req.withCredentials = true;

            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    if (req.status == 200) {

                        var tokenResponse = JSON.parse(req.responseText);
                        authSuccess(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], kc.flow === 'standard');
                        scheduleCheckIframe();
                    } else {
                        kc.onAuthError && kc.onAuthError();
                        promise && promise.setError();
                    }
                }
            };

            req.send(params);
        }

        function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
            timeLocal = (timeLocal + new Date().getTime()) / 2;

            setToken(accessToken, refreshToken, idToken, timeLocal);

            if (useNonce && ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||
                (kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||
                (kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce))) {

                logInfo('[KEYCLOAK] Invalid nonce, clearing token');
                kc.clearToken();
                promise && promise.setError();
            } else {
                if (fulfillPromise) {
                    kc.onAuthSuccess && kc.onAuthSuccess();
                    promise && promise.setSuccess();
                }
            }
        }

    }
</code>```

I would like to get help to convert above code using cordova-plugin-advanced-http plugin

Thanks in advance.

Body:
Presently I am developing Cordova Native based Application.
Right now login part completed. but I am struck at getting token part. My Backend team is blocking all calls from localhost. I want to overcome this by using native http API Using Cordova Advanced HTTP plugin. i am looking for example so I can replicate it.

this is the code keycloak using.

function processCallback(oauth, promise) {
        var code = oauth.code;
        var error = oauth.error;
        var prompt = oauth.prompt;

        var timeLocal = new Date().getTime();

        if (oauth['kc_action_status']) {
            kc.onActionUpdate && kc.onActionUpdate(oauth['kc_action_status']);
        }

        if (error) {
            if (prompt != 'none') {
                var errorData = { error: error, error_description: oauth.error_description };
                kc.onAuthError && kc.onAuthError(errorData);
                promise && promise.setError(errorData);
            } else {
                promise && promise.setSuccess();
            }
            return;
        } else if ((kc.flow != 'standard') && (oauth.access_token || oauth.id_token)) {
            authSuccess(oauth.access_token, null, oauth.id_token, true);
        }

        if ((kc.flow != 'implicit') && code) {
            var params = 'code=' + code + '&grant_type=authorization_code';
            var url = kc.endpoints.token();

            var req = new XMLHttpRequest();
            req.open('POST', url, true);
            req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

            params += '&client_id=' + encodeURIComponent(kc.clientId);
            params += '&redirect_uri=' + oauth.redirectUri;

            if (oauth.pkceCodeVerifier) {
                params += '&code_verifier=' + oauth.pkceCodeVerifier;
            }

            req.withCredentials = true;

            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    if (req.status == 200) {

                        var tokenResponse = JSON.parse(req.responseText);
                        authSuccess(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], kc.flow === 'standard');
                        scheduleCheckIframe();
                    } else {
                        kc.onAuthError && kc.onAuthError();
                        promise && promise.setError();
                    }
                }
            };

            req.send(params);
        }

        function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
            timeLocal = (timeLocal + new Date().getTime()) / 2;

            setToken(accessToken, refreshToken, idToken, timeLocal);

            if (useNonce && ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||
                (kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||
                (kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce))) {

                logInfo('[KEYCLOAK] Invalid nonce, clearing token');
                kc.clearToken();
                promise && promise.setError();
            } else {
                if (fulfillPromise) {
                    kc.onAuthSuccess && kc.onAuthSuccess();
                    promise && promise.setSuccess();
                }
            }
        }

    }

I would like to get help to convert above code using cordova-plugin-advanced-http plugin

Thanks in advance.


问:
Unable to perform browser authentication in 3DSecure Flow
We are using Global Payments Java SDK to implement 3DSecure. Our web application first calls check-version API on the backend. And our backend use checkEnrollment function of Secure3dService class in Java SDK to check the status of the card. If the card is enrolled, our backend sends the server transaction id (received from Global Payments) back to our web client.

Now, in the second step, our web client gathers all the customer/browser information and calls authentication API on the backend. The backend passes all the mandatory information to initiateAuthentication method of Secure3dService in Java SDK. But the SDK throws 400 error.
We are not able to figure out why we are getting 400 error back.

#update
If we call the checkEnrollment method of Java SDK just before calling initiateAuthentication method of Java SDK, everything works and we get back a successful response with the same request. But we do not want to do that. Because we want to use the old server transaction id for all the subsequent calls instead of generating a new one.

What is the fix of this issue?


问:
Sorting encrypted fields in MongoDB for a spring boot project
In the project I'm working on, I need to encrypt only specific data fields of the collection. But  I need to run search and sort queries on these fields as well, which is not possible currently given that they are encrypted. While running the sort query, sorting is happening on the encrypted values and not the plain text, hence giving the wrong result.

Also, part of the use case is that the encryption key is configurable for transaction. Since I am not storing the key in the application and fetching it from a custom KMS for every save/find operation.

Conclusion, I'm looking for a way to perform sort operations on encrypted fields in mongoDB using a configurable key. I found CSFLE  as a solution online, but I am not sure if it covers all the points above.

Can you suggest any technology/library which can fulfill the needs? Not looking for any code, just  documentation or library name is more than enough.

Thank you


问:
Java SDK SdkClientException: Unable to load AWS credentials from any provider in the chain
I want to fetch configuration properties from Parameter Store on boostrap application, for that I am using io.awspring.cloud:spring-cloud-starter-aws-parameter-store-config:2.3.3 and I run the same configuration on Windows where it works but on linux ec2 instance or WSL2 I am receiving below error message:

```<code>AwsParameterPropertySourceNotFoundException: com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY))
</code>```

but before run it I am doing

```<code>export AWS_ACCESS_KEY_ID="xxxx"
export AWS_SECRET_ACCESS_KEY="xxxxx"
</code>```

I also verify it using printenv and yes they are there. So the question is why I am receiving ...Unable to load AWS credentials from environment variables AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY...does anyone know?

EDIT:

Forgot to mention but I use
io.awspring.cloud:spring-cloud-starter-aws-parameter-store-config
with configuration:

```<code>cloud:
  aws:
    credentials:
      access-key: ${AWS_ACCESS_KEY_ID}
      secret-key: ${AWS_SECRET_ACCESS_KEY}
    region:
      static: eu-west-1
      auto: false
      use-default-aws-region-chain: true
    stack:
      auto: false
</code>```

But underhood it use DefaultAWSCredentialsProviderChain so it should works like AWS SDK for Java

Body:
I want to fetch configuration properties from Parameter Store on boostrap application, for that I am using io.awspring.cloud:spring-cloud-starter-aws-parameter-store-config:2.3.3 and I run the same configuration on Windows where it works but on linux ec2 instance or WSL2 I am receiving below error message:

AwsParameterPropertySourceNotFoundException: com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY))

but before run it I am doing

export AWS_ACCESS_KEY_ID="xxxx"
export AWS_SECRET_ACCESS_KEY="xxxxx"

I also verify it using printenv and yes they are there. So the question is why I am receiving ...Unable to load AWS credentials from environment variables AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY...does anyone know?

EDIT:

Forgot to mention but I use
io.awspring.cloud:spring-cloud-starter-aws-parameter-store-config
with configuration:

cloud:
  aws:
    credentials:
      access-key: ${AWS_ACCESS_KEY_ID}
      secret-key: ${AWS_SECRET_ACCESS_KEY}
    region:
      static: eu-west-1
      auto: false
      use-default-aws-region-chain: true
    stack:
      auto: false

But underhood it use DefaultAWSCredentialsProviderChain so it should works like AWS SDK for Java


问:
Woocommerce Google Analytics event tracking for loop add to cart returns "Uncaught ReferenceError: jQuery is not defined"
I have a WordPress page with WooCommerce and W3 Total Cache plugin. When I check on W3TC options, that code from head should be loaded with defer or async, it causes the Woocommerce function "Google Analytics event tracking for loop add to cart" to fail with "Uncaught ReferenceError: jQuery is not defined".

What will be the best practice here, to fix that error? Should I just grab the generated by this function code into separate, defer loaded file, and disable the function?


问:
A form in my Spring MVC app that submits a POST request is not returning the value entered
This is a basic Spring MVC application that stores the Group Stage Records for the World Cup just past. I have created the entity named GroupStageRecord that has variables homeTeam, awayTeam, homeResult, etc. I want users to be able to add a record and am using thymeleaf as the templating tool.

When the form is submitted, I can see the homeTeam and homeResult values picked on the site in the returned entity instance. But awayTeam is always null. Any help as to why that is would be great! Below are the snapshots of the entity, controller, and html page. The groupStageRecord repository is an implementation of an interface extending CrudRepository.

```<code>@Entity
public class GroupStageRecord {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    @Column(name = "homeTeam", nullable = false)
    private String homeTeam;

    @Column(name = "awayTeam", nullable = false)
    private String awayTeam;

    @Column(name = "homeResult", nullable = false)
    private String homeResult;

    @Column(name = "matchGroup", nullable = false)
    private String matchGroup;

    public GroupStageRecord() {}

    public GroupStageRecord(String homeTeam, String awayTeam, String homeResult, String matchGroup) {
        this.homeTeam = homeTeam;
        this.awayTeam = awayTeam;
        this.homeResult = homeResult;
        this.matchGroup = matchGroup;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getHomeTeam() {
        return homeTeam;
    }

    public void setHomeTeam(String homeTeam) {
        this.homeTeam = homeTeam;
    }

    public String getAwayTeam() {
        return awayTeam;
    }

    public void setAwayteam(String awayTeam) {
        this.awayTeam = awayTeam;
    }

    public String getHomeResult() {
        return homeResult;
    }

    public void setHomeResult(String result) {
        this.homeResult = result;
    }

    public String getMatchGroup() {
        return matchGroup;
    }

    public void setMatchGroup(String matchGroup) {
        this.matchGroup = matchGroup;
    }
}
</code>```
```<code>@Controller
public class WorldCup2022Controller {

    private TeamServiceImpl teamServiceImpl;
    private GroupStageRecordServiceImpl groupStageRecordServiceImpl;

    private List<String> teamGroups = Arrays.asList("A", "B", "C", "D", "E", "F", "G", "H");

    @Autowired
    public void setTeamsService(TeamServiceImpl teamsServiceImpl) {
        this.teamServiceImpl = teamsServiceImpl;
    }

    @Autowired
    public void setGroupStageRecordsService(GroupStageRecordServiceImpl groupStageRecordServiceImpl) {
        this.groupStageRecordServiceImpl = groupStageRecordServiceImpl;
    }

    @GetMapping("/groupStageRecords")
    public String retrieveGroupStageRecords(Model model) {
        model.addAttribute("groupStageRecords", groupStageRecordServiceImpl.findAll());
        model.addAttribute("fullTeamList", this.teamServiceImpl.findAll());
        model.addAttribute("newGroupStageRecord", new GroupStageRecord());
        return "groupStageRecords";
    }

    @PostMapping("/groupStageRecords")
    public String updateGroupStageResult(@ModelAttribute("newGroupStageRecord") GroupStageRecord newGroupStageRecord, Model model) {
        groupStageRecordServiceImpl.setHomeResult(newGroupStageRecord);
        model.addAttribute("groupStageRecords", groupStageRecordServiceImpl.findAll());
        model.addAttribute("newGroupStageRecord", new GroupStageRecord());
        return "redirect:groupStageRecords";
    }
}
</code>```
```<code><form method="post" th:action="@{/groupStageRecords}" th:object="${newGroupStageRecord}">
    <div class="form-group">
      <select class="form-control" th:field="*{homeTeam}">
        <option th:each="team: ${fullTeamList}" th:value="${team.teamName}" th:text="${team.teamName}"></option>
      </select>
    </div>
    <div class="form-group">
      <select class="form-control" th:field="*{awayTeam}">
        <option th:each="team: ${fullTeamList}" th:value="${team.teamName}" th:text="${team.teamName}"></option>
      </select>
    </div>
    <div class = "form-group">
      <select class = "form-group" placeholder="Choose result" th:field="*{homeResult}">
        <option value="WIN">HOME WIN</option>
        <option value="LOSS">HOME LOSS</option>
        <option value="DRAW">DRAW</option>
      </select>
    </div>
    <button type="submit" class="btn btn-primary">Submit</button>
  </form>
</code>```

Body:
This is a basic Spring MVC application that stores the Group Stage Records for the World Cup just past. I have created the entity named GroupStageRecord that has variables homeTeam, awayTeam, homeResult, etc. I want users to be able to add a record and am using thymeleaf as the templating tool.

When the form is submitted, I can see the homeTeam and homeResult values picked on the site in the returned entity instance. But awayTeam is always null. Any help as to why that is would be great! Below are the snapshots of the entity, controller, and html page. The groupStageRecord repository is an implementation of an interface extending CrudRepository.

@Entity
public class GroupStageRecord {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    @Column(name = "homeTeam", nullable = false)
    private String homeTeam;

    @Column(name = "awayTeam", nullable = false)
    private String awayTeam;

    @Column(name = "homeResult", nullable = false)
    private String homeResult;

    @Column(name = "matchGroup", nullable = false)
    private String matchGroup;

    public GroupStageRecord() {}

    public GroupStageRecord(String homeTeam, String awayTeam, String homeResult, String matchGroup) {
        this.homeTeam = homeTeam;
        this.awayTeam = awayTeam;
        this.homeResult = homeResult;
        this.matchGroup = matchGroup;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getHomeTeam() {
        return homeTeam;
    }

    public void setHomeTeam(String homeTeam) {
        this.homeTeam = homeTeam;
    }

    public String getAwayTeam() {
        return awayTeam;
    }

    public void setAwayteam(String awayTeam) {
        this.awayTeam = awayTeam;
    }

    public String getHomeResult() {
        return homeResult;
    }

    public void setHomeResult(String result) {
        this.homeResult = result;
    }

    public String getMatchGroup() {
        return matchGroup;
    }

    public void setMatchGroup(String matchGroup) {
        this.matchGroup = matchGroup;
    }
}

@Controller
public class WorldCup2022Controller {

    private TeamServiceImpl teamServiceImpl;
    private GroupStageRecordServiceImpl groupStageRecordServiceImpl;

    private List<String> teamGroups = Arrays.asList("A", "B", "C", "D", "E", "F", "G", "H");

    @Autowired
    public void setTeamsService(TeamServiceImpl teamsServiceImpl) {
        this.teamServiceImpl = teamsServiceImpl;
    }

    @Autowired
    public void setGroupStageRecordsService(GroupStageRecordServiceImpl groupStageRecordServiceImpl) {
        this.groupStageRecordServiceImpl = groupStageRecordServiceImpl;
    }

    @GetMapping("/groupStageRecords")
    public String retrieveGroupStageRecords(Model model) {
        model.addAttribute("groupStageRecords", groupStageRecordServiceImpl.findAll());
        model.addAttribute("fullTeamList", this.teamServiceImpl.findAll());
        model.addAttribute("newGroupStageRecord", new GroupStageRecord());
        return "groupStageRecords";
    }

    @PostMapping("/groupStageRecords")
    public String updateGroupStageResult(@ModelAttribute("newGroupStageRecord") GroupStageRecord newGroupStageRecord, Model model) {
        groupStageRecordServiceImpl.setHomeResult(newGroupStageRecord);
        model.addAttribute("groupStageRecords", groupStageRecordServiceImpl.findAll());
        model.addAttribute("newGroupStageRecord", new GroupStageRecord());
        return "redirect:groupStageRecords";
    }
}

<form method="post" th:action="@{/groupStageRecords}" th:object="${newGroupStageRecord}">

      <select class="form-control" th:field="*{homeTeam}">
        <option th:each="team: ${fullTeamList}" th:value="${team.teamName}" th:text="${team.teamName}"></option>
      </select>

      <select class="form-control" th:field="*{awayTeam}">
        <option th:each="team: ${fullTeamList}" th:value="${team.teamName}" th:text="${team.teamName}"></option>
      </select>

      <select class = "form-group" placeholder="Choose result" th:field="*{homeResult}">
        <option value="WIN">HOME WIN</option>
        <option value="LOSS">HOME LOSS</option>
        <option value="DRAW">DRAW</option>
      </select>

    <button type="submit" class="btn btn-primary">Submit</button>
  </form>


问:
How to make analytical table display more rows SAP FIORI
I made a SAP Fiori app from template with an analytical table in it.
The table however only displays 4 rows. It looks really small.
Im looking for a way to make the table show maybe 10 rows or something.
Here is a picture of the table:

As you can see the table only displays 4 rows

Since the app was created from template there is no view or controller in the UI5 webide.
I have been looking for cds annotations, xml annotations or anything but wasnt able to find anything usefull.
Any help is much appreciated.
If someone can explain how to make a table show more rows with a non-template project in the webide this would also be appreciated.


问:
tag"NgRX-Forms" addArrayControl (HOW CAN I ADD A STRING TO MY TABLE THAT IS INSIDE AN OBJECT TABLE WITH AN INDEX)
I need your help on NgRx forms, I need to add to the pregk table a value on an alias [index], without it touching me other alias [other_index]

my entities

```<code>export interface CreationPersonnePhysiqueLieeForm {
  type: TypePersonne;
  nomMarital?: string;
  noms?: string[];
  alias?: IAlias[];
}

export interface IAlias {
  nom: string;
  prenoms: string[];
  dateNaissance?: string;
  paysNaissance?: Boxed<CodificationSrj>;
  villeNaissance?: string;
}
</code>```

//-->Definition of the initial state of the form

```<code>export const initialPersonnePhysique = <CreationPersonnePhysiqueLieeForm>{
  type: TypePersonne.PHYSIQUE,
  noms: [''],
  nomMarital: null,
  alias: [],
};

export const initialState: FormGroupState<CreationPersonnePhysiqueLieeForm> = createFormGroupState<CreationPersonnePhysiqueLieeForm>(
  FORMULAIRE_CREATION_PERSONNE_PHYSIQUE_LIEE_ID,
  initialPersonnePhysique,
);
</code>```

//-->Définition du reducer de feature

```<code>export function creationPersonnePhysiqueFormReducer(
  state: FormGroupState<CreationPersonnePhysiqueLieeForm> = initialState,
  action: CreationPersonnePhysiqueFormActions,
): FormGroupState<CreationPersonnePhysiqueLieeForm> {
  // Règles de validation du formulaire
  const validateForm = updateGroup<CreationPersonnePhysiqueLieeForm>({
    type: validate(required),
    noms: compose(validate<Array<string>>(maxLength(environment.FORM_MAX_NOMBRE_NOMS))),
    nationalites: compose(validate<Array<string>>(maxLength(environment.FORM_MAX_NOMBRE_NATIONALITES))),
    alias: updateArray(
      updateGroup<IAlias>({
        nom: validate(required),
        prenoms: compose(validate<Array<string>>(maxLength(environment.FORM_MAX_NOMBRE_PRENOMS))),
      }),
    ),
  });
</code>```

//Gestions des actions

```<code> switch (action.type) {
    case CreationPersonnePhysiqueFormActionTypes.INIT_FORM:
      const personne = action.initialValue || initialPersonnePhysique;
      return createFormGroupState<CreationPersonnePhysiqueLieeForm>(FORMULAIRE_CREATION_PERSONNE_PHYSIQUE_LIEE_ID, personne);

    case CreationPersonnePhysiqueFormActionTypes.ENREGISTRER_FORM:
      return createFormGroupState(FORMULAIRE_CREATION_PERSONNE_PHYSIQUE_LIEE_ID, action.creationPersonnePhysiqueLieeFormValue);

    case CreationPersonnePhysiqueFormActionTypes.AJOUTER_NOM:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        noms: addArrayControl<string>(''),
      });

    case CreationPersonnePhysiqueFormActionTypes.SUPPRIMER_NOM:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        noms: removeArrayControl(action.nomIndex),
      });

    case CreationPersonnePhysiqueFormActionTypes.AJOUTER_ALIAS:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: addArrayControl<IAlias>({
          nom: '',
          prenoms: [''],
          dateNaissance: null,
          villeNaissance: null,
          paysNaissance: null,
        }),
      });

    case CreationPersonnePhysiqueFormActionTypes.SUPPRIMER_ALIAS:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: removeArrayControl(action.aliasIndex),
      });
</code>```

** I tried that but when I create a second alias (Alias2) and I add a second name ==> it updates the first alias (Alias1) with the new value I gave to Alias2.
while I don't want it to touch Alias1**

```<code> case CreationPersonnePhysiqueFormActionTypes.AJOUTER_PRENOM_ALIAS:
      console.log('aliaaaaaaaass===============>', action.aliasIndex);

      console.log('state=======9++========>', state.controls.alias.controls[action.aliasIndex].controls);

      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: updateArray((lineItem, lineItemsState) =>
          updateGroup<IAlias>({
            prenoms: addArrayControl<string>(''),
          })(lineItemsState.controls[action.aliasIndex]),
        ),
      });

    case CreationPersonnePhysiqueFormActionTypes.SUPPRIMER_PRENOM_ALIAS:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: updateArray(
          updateGroup<IAlias>({
            prenoms: removeArrayControl(action.prenomAliasIndex),
          }),
        ),
      });

    default:
      return validateForm(formGroupReducer(state, action));
  }
}
</code>```

I have a lead with

```<code>const updatedArrayUncurried = updateArrayWithFilter(array, (s, idx) => s.value === '0' && idx === 0, setValue('1'));
</code>```

but I can't write it correctly with my case

Body:
I need your help on NgRx forms, I need to add to the pregk table a value on an alias [index], without it touching me other alias [other_index]

my entities

export interface CreationPersonnePhysiqueLieeForm {
  type: TypePersonne;
  nomMarital?: string;
  noms?: string[];
  alias?: IAlias[];
}

export interface IAlias {
  nom: string;
  prenoms: string[];
  dateNaissance?: string;
  paysNaissance?: Boxed<CodificationSrj>;
  villeNaissance?: string;
}

//-->Definition of the initial state of the form

export const initialPersonnePhysique = <CreationPersonnePhysiqueLieeForm>{
  type: TypePersonne.PHYSIQUE,
  noms: [''],
  nomMarital: null,
  alias: [],
};

export const initialState: FormGroupState<CreationPersonnePhysiqueLieeForm> = createFormGroupState<CreationPersonnePhysiqueLieeForm>(
  FORMULAIRE_CREATION_PERSONNE_PHYSIQUE_LIEE_ID,
  initialPersonnePhysique,
);

//-->Définition du reducer de feature

export function creationPersonnePhysiqueFormReducer(
  state: FormGroupState<CreationPersonnePhysiqueLieeForm> = initialState,
  action: CreationPersonnePhysiqueFormActions,
): FormGroupState<CreationPersonnePhysiqueLieeForm> {
  // Règles de validation du formulaire
  const validateForm = updateGroup<CreationPersonnePhysiqueLieeForm>({
    type: validate(required),
    noms: compose(validate<Array<string>>(maxLength(environment.FORM_MAX_NOMBRE_NOMS))),
    nationalites: compose(validate<Array<string>>(maxLength(environment.FORM_MAX_NOMBRE_NATIONALITES))),
    alias: updateArray(
      updateGroup<IAlias>({
        nom: validate(required),
        prenoms: compose(validate<Array<string>>(maxLength(environment.FORM_MAX_NOMBRE_PRENOMS))),
      }),
    ),
  });

//Gestions des actions

 switch (action.type) {
    case CreationPersonnePhysiqueFormActionTypes.INIT_FORM:
      const personne = action.initialValue || initialPersonnePhysique;
      return createFormGroupState<CreationPersonnePhysiqueLieeForm>(FORMULAIRE_CREATION_PERSONNE_PHYSIQUE_LIEE_ID, personne);

    case CreationPersonnePhysiqueFormActionTypes.ENREGISTRER_FORM:
      return createFormGroupState(FORMULAIRE_CREATION_PERSONNE_PHYSIQUE_LIEE_ID, action.creationPersonnePhysiqueLieeFormValue);

    case CreationPersonnePhysiqueFormActionTypes.AJOUTER_NOM:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        noms: addArrayControl<string>(''),
      });

    case CreationPersonnePhysiqueFormActionTypes.SUPPRIMER_NOM:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        noms: removeArrayControl(action.nomIndex),
      });

    case CreationPersonnePhysiqueFormActionTypes.AJOUTER_ALIAS:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: addArrayControl<IAlias>({
          nom: '',
          prenoms: [''],
          dateNaissance: null,
          villeNaissance: null,
          paysNaissance: null,
        }),
      });

    case CreationPersonnePhysiqueFormActionTypes.SUPPRIMER_ALIAS:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: removeArrayControl(action.aliasIndex),
      });

** I tried that but when I create a second alias (Alias2) and I add a second name ==> it updates the first alias (Alias1) with the new value I gave to Alias2.
while I don't want it to touch Alias1**

 case CreationPersonnePhysiqueFormActionTypes.AJOUTER_PRENOM_ALIAS:
      console.log('aliaaaaaaaass===============>', action.aliasIndex);

      console.log('state=======9++========>', state.controls.alias.controls[action.aliasIndex].controls);

      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: updateArray((lineItem, lineItemsState) =>
          updateGroup<IAlias>({
            prenoms: addArrayControl<string>(''),
          })(lineItemsState.controls[action.aliasIndex]),
        ),
      });

    case CreationPersonnePhysiqueFormActionTypes.SUPPRIMER_PRENOM_ALIAS:
      return updateGroup<CreationPersonnePhysiqueLieeForm>(state, {
        alias: updateArray(
          updateGroup<IAlias>({
            prenoms: removeArrayControl(action.prenomAliasIndex),
          }),
        ),
      });

    default:
      return validateForm(formGroupReducer(state, action));
  }
}

I have a lead with

const updatedArrayUncurried = updateArrayWithFilter(array, (s, idx) => s.value === '0' && idx === 0, setValue('1'));

but I can't write it correctly with my case


问:
How to resolve the unbound local error in the following code while trying to create a function for a SARIMAX model?
y = df['Date']
import itertools

def sarima_grid_search(y, seasonal_period):
p= d=q= range(0,2)
pdq= list(itertools.products(p,d,q))
seasonal_pdg= [(x[0], x[1], x[2], seasonal_period) for x in list(itertools.product(p,d,q))]
mini= float('+inf')
for param in pdq:
for param_seasonal in seasonal_pdq:
try:
mod= sm.tsa.statespace.SARIMAX(y, order= param, seasonal_order= param_seasonal,
enforce_stationarity= False,
enforce_invertibility=False)
results= mod.fit()
if results.aic<mini:
mini= results.aic
param_mini=param
param_seasonal_mini= param_seasonal
except:
continue


问:
Error loading stopwords: <urlopen error [Errno 110] Connection
While downloading NLTK stopwords , I am getting the following error
[nltk_data] Error loading stopwords: <urlopen error [Errno 110]
[nltk_data]     Connection timed out>
The code used is

```<code>import nltk
nltk.download('stopwords')
</code>```

I also tried the following command and got the same error

```<code>python -m nltk.downloader stopwords
</code>```

Thanks

Body:
While downloading NLTK stopwords , I am getting the following error
[nltk_data] Error loading stopwords: <urlopen error [Errno 110]
[nltk_data]     Connection timed out>
The code used is

import nltk
nltk.download('stopwords')

I also tried the following command and got the same error

python -m nltk.downloader stopwords

Thanks


问:
Is it possible to connect to android logcat via WebSocket?
I'm working on implementing a WS client that can connect to an Android device via the Appium server as part of my effort to contribute to the .NET client.

So far, my main issue is that I'm unable to connect to the device with the WS Uri. in this format: ws://127.0.0.1:4723/ws/session/327c84e4-0ca9-4f11-867c-74a492388ff4/appium/device/logcat

I'm trying to use the following call, but I get a 404 error each time. System.Net.WebSockets.WebSocketException: 'Unable to connect to the remote server

I also tried connecting via 'websocat' but without success either.
I read somewhere that android is using wss://, but this approach also return an error:
websocat: WebSocketError: WebSocket SSL error: The token supplied to the function is invalid (os error -2146893048) websocat: error running

My question is if it's even possible to connect to an android logcat via WS to an android device on a windows machine.


问:
setDownloadBehavior analog for Firefox at Puppeteer
For chromium, in Puppeteer it is possible to block file downloads using the cdp command Page.setDownloadBehavior. Is there something similar for Firefox? Otherwise, it downloads all files automatically :(

Of course, I tried using Page.setDownloadBehavior for Firefox as well, but it throws an error:

Protocol error (Page.setDownloadBehavior): Page.setDownloadBehavior RemoteAgentError@chrome://remote/content/cdp/Error.jsm:29:5\nUnknownMethodError@chrome://remote/content/cdp/Error.jsm:112:7\nexecute@chrome://remote/content/cdp/domains/DomainCache.jsm:98:13\nreceiveMessage@chrome://remote/content/cdp/sessions/ContentProcessSession.jsm:84:45\n

I found a list of CDP support in Firefox and there is nothing there that could be somehow similar to what I need. Page.setDownloadBehavior, apparently, is only in the plans.


问:
Android: @layout/layout3 does not contain a declaration with id textView
I am writing an app where I need to use the value displayed in a TextView on another layout. I have tried to reference the TextView, but it is not looking in the right place for the id. Here is my code, which is the touch listener for my buttons:

```<code>    override fun onTouch(v: View, e: MotionEvent): Boolean {
        if (v.id != R.id.button13) {
            //The textView is referenced in the code that was in this if statement
            return false
        }
        else if (v.id == R.id.button13) {
            val tV = findViewById<TextView>(R.id.textView)
            /*Here, R.id.textView is searched for in R.layout.layout3, even though this layout
            is not set until 3 lines after, and when R.id.button13 is pressed, the layout is
            always R.layout.layout2*/
            var tVText = tV.text
            setTheme(R.style.Theme_Theme2)
            setContentView(R.layout.layout3)
            findViewById<TextView>(R.id.textViewP).text = tVText
        }
        return false
    }
</code>```

The error is that "val tV = findViewById(R.id.textView)" returns a null reference, because it cannot find it.

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.*., PID: 15453
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence  android.widget.TextView.getText()' on a null object reference

I don't understand why this error is ocurring, especially because this code should never be run when R.layout.layout3 is the active layout, and the if statement that precedes this else if statement contains a reference to the text view (which works as intended).

Thanks!

Body:
I am writing an app where I need to use the value displayed in a TextView on another layout. I have tried to reference the TextView, but it is not looking in the right place for the id. Here is my code, which is the touch listener for my buttons:

    override fun onTouch(v: View, e: MotionEvent): Boolean {
        if (v.id != R.id.button13) {
            //The textView is referenced in the code that was in this if statement
            return false
        }
        else if (v.id == R.id.button13) {
            val tV = findViewById<TextView>(R.id.textView)
            /*Here, R.id.textView is searched for in R.layout.layout3, even though this layout
            is not set until 3 lines after, and when R.id.button13 is pressed, the layout is
            always R.layout.layout2*/
            var tVText = tV.text
            setTheme(R.style.Theme_Theme2)
            setContentView(R.layout.layout3)
            findViewById<TextView>(R.id.textViewP).text = tVText
        }
        return false
    }

The error is that "val tV = findViewById(R.id.textView)" returns a null reference, because it cannot find it.

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.*., PID: 15453
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence  android.widget.TextView.getText()' on a null object reference

I don't understand why this error is ocurring, especially because this code should never be run when R.layout.layout3 is the active layout, and the if statement that precedes this else if statement contains a reference to the text view (which works as intended).

Thanks!


问:
Unable to transfer the file permissions through Lsyncd to the Destination server?
While doing Lsyncd i am unable to transfer the file permissions and ownership of files in source server to the destination server.</p>
```<code>settings {
        logfile = "/var/log/lsyncd/lsyncd.log",
        statusFile = "/var/log/lsyncd/lsyncd.status",
   statusInterval = 20,
   nodaemon   = false
}

sync {
        default.rsyncssh,
        source = "/hdfs/hdd004",
        host = "10.100.1.23",
        targetdir = "/hdfs/hdd011/testdab",
        rsync = { rsh = "/usr/bin/ssh -l tne -i /home/tne/id_rsa*" }
     }
        rsync = {
        update = true,
        archive = true,
        times = true,
        perms = true,
        group = true,
        owner = true,
        compress = true,
        acls = true,
        xattrs = true,
        _extra = {"-a"},
}

</code>```

Body:
While doing Lsyncd i am unable to transfer the file permissions and ownership of files in source server to the destination server.

settings {
        logfile = "/var/log/lsyncd/lsyncd.log",
        statusFile = "/var/log/lsyncd/lsyncd.status",
   statusInterval = 20,
   nodaemon   = false
}

sync {
        default.rsyncssh,
        source = "/hdfs/hdd004",
        host = "10.100.1.23",
        targetdir = "/hdfs/hdd011/testdab",
        rsync = { rsh = "/usr/bin/ssh -l tne -i /home/tne/id_rsa*" }
     }
        rsync = {
        update = true,
        archive = true,
        times = true,
        perms = true,
        group = true,
        owner = true,
        compress = true,
        acls = true,
        xattrs = true,
        _extra = {"-a"},
}