问:
Infinity scroll problem wit loading items flutter
Problem with displaying images in ListView, have error app crash when load all images at once and pagination code i have now is not work for some reason

Basicly want to fetch images from this firebase colection and display them in 'ListView' with pagination to my app not crash.
Hopfuly somebody can help me fix this issue, thank you!

```<code>initSliderImages() async {
    var result = await FirebaseFirestore.instance.collection('galerytab1');
    result.snapshots().listen((data) {
      List imgs = [];
      data.docChanges.forEach((change) {
        var imageData = change.doc.data();
        String image = imageData?['url'];
        imgs.add(CachedNetworkImage(imageUrl: image));
      });

      setState(() {
        images = imgs;
      });
    });
  }
</code>```
```<code>
class _CategoryTab1State extends State<CategoryTab1> {
  List images = [];

  late ScrollController controller;

  final scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  void initState() {
    super.initState();
    // addUrls();
    controller = ScrollController()..addListener(_scrollListener);
    initSliderImages();
    if (this.mounted) {
      context.read<CategoryTab1Bloc>().data.isNotEmpty
          ? print('data already loaded')
          : context.read<CategoryTab1Bloc>().getData(mounted, widget.category);
    }
  }

  @override
  void dispose() {
    controller.removeListener(_scrollListener);
    super.dispose();
  }

  void _scrollListener() {
    print(controller.position.extentAfter);

    if (controller.position.extentAfter < 2) {
      setState(() {
        print('add 2 more');
        print('add 2 more');
        print('add 2 more');
        print('add 2 more');
        // images.addAll(['item1','item2','item3']
            // List.generate(2, (index) => 'Inserted $index'
        // )

        // );
      });
    }
  }

  // //
  // void addUrls() {
  //   final List<String> imgs = List.generate(
  //     16,
  //         (_) {
  //       int random = Random().nextInt(16) + 16; // 250-500
  //       return
  //         // initSliderImages();
  //         // 'https://picsum.photos/$random/$random';
  //           'https://firebasestorage.googleapis.com/v0/b/klosterkatz-c914e.appspot.com/o/galerytab1%2F1.png?alt=media&token=5b0e9c74-ec5a-42ca-aa59-309f41938a28';
  //
  //
  //
  //
  //     },
  //   );

  //   setState(() {
  //     images.addAll(imgs);
  //   });
  // }
  //

  // Fetch images from databse for list

  initSliderImages() async {
    final int _limit = 3;

    var result = await FirebaseFirestore.instance.collection('galerytab1');
    result.snapshots().listen((data) {
      List imgs = [];
      data.docChanges.forEach((change) {
        var imageData = change.doc.data();
        String image = imageData?['url'];
        imgs.add(image);
      });

      setState(() {
        images = imgs;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    print('imagesimageimagesimagesimageismageimage');
    print('$images');
    print(images.length);

    return NotificationListener<ScrollNotification>(
      onNotification: (ScrollNotification notification) {

        if (notification.metrics.pixels ==
            notification.metrics.maxScrollExtent) {
          initSliderImages();
          _scrollListener();
          // addUrls();
        }

        return true;
      },
      child:
      ListView.builder(
        controller: controller,
        key: widget.key,
        itemCount: images.length,
        itemExtent: 250,
          itemBuilder: (context, index) {
            return CachedNetworkImage(
              imageUrl: images[index],
              fit: BoxFit.cover,
              key: ValueKey(images[index]),
            );
          }
      ),
    );
  }

}

</code>```

Body:
Problem with displaying images in ListView, have error app crash when load all images at once and pagination code i have now is not work for some reason

Basicly want to fetch images from this firebase colection and display them in 'ListView' with pagination to my app not crash.
Hopfuly somebody can help me fix this issue, thank you!

initSliderImages() async {
    var result = await FirebaseFirestore.instance.collection('galerytab1');
    result.snapshots().listen((data) {
      List imgs = [];
      data.docChanges.forEach((change) {
        var imageData = change.doc.data();
        String image = imageData?['url'];
        imgs.add(CachedNetworkImage(imageUrl: image));
      });

      setState(() {
        images = imgs;
      });
    });
  }

class _CategoryTab1State extends State<CategoryTab1> {
  List images = [];

  late ScrollController controller;

  final scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  void initState() {
    super.initState();
    // addUrls();
    controller = ScrollController()..addListener(_scrollListener);
    initSliderImages();
    if (this.mounted) {
      context.read<CategoryTab1Bloc>().data.isNotEmpty
          ? print('data already loaded')
          : context.read<CategoryTab1Bloc>().getData(mounted, widget.category);
    }
  }

  @override
  void dispose() {
    controller.removeListener(_scrollListener);
    super.dispose();
  }

  void _scrollListener() {
    print(controller.position.extentAfter);

    if (controller.position.extentAfter < 2) {
      setState(() {
        print('add 2 more');
        print('add 2 more');
        print('add 2 more');
        print('add 2 more');
        // images.addAll(['item1','item2','item3']
            // List.generate(2, (index) => 'Inserted $index'
        // )

        // );
      });
    }
  }

  // //
  // void addUrls() {
  //   final List<String> imgs = List.generate(
  //     16,
  //         (_) {
  //       int random = Random().nextInt(16) + 16; // 250-500
  //       return
  //         // initSliderImages();
  //         // 'https://picsum.photos/$random/$random';
  //           'https://firebasestorage.googleapis.com/v0/b/klosterkatz-c914e.appspot.com/o/galerytab1%2F1.png?alt=media&token=5b0e9c74-ec5a-42ca-aa59-309f41938a28';
  //
  //
  //
  //
  //     },
  //   );

  //   setState(() {
  //     images.addAll(imgs);
  //   });
  // }
  //

  // Fetch images from databse for list

  initSliderImages() async {
    final int _limit = 3;

    var result = await FirebaseFirestore.instance.collection('galerytab1');
    result.snapshots().listen((data) {
      List imgs = [];
      data.docChanges.forEach((change) {
        var imageData = change.doc.data();
        String image = imageData?['url'];
        imgs.add(image);
      });

      setState(() {
        images = imgs;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    print('imagesimageimagesimagesimageismageimage');
    print('$images');
    print(images.length);

    return NotificationListener<ScrollNotification>(
      onNotification: (ScrollNotification notification) {

        if (notification.metrics.pixels ==
            notification.metrics.maxScrollExtent) {
          initSliderImages();
          _scrollListener();
          // addUrls();
        }

        return true;
      },
      child:
      ListView.builder(
        controller: controller,
        key: widget.key,
        itemCount: images.length,
        itemExtent: 250,
          itemBuilder: (context, index) {
            return CachedNetworkImage(
              imageUrl: images[index],
              fit: BoxFit.cover,
              key: ValueKey(images[index]),
            );
          }
      ),
    );
  }

}


来源: stackexchange

问:
How to check if I have a closed circle-like object in the image?
I am analyzing some images, where I am zooming on image and to detect a such objects ( animals on the field with a thermal camera ):

And after the OTSU method, I end up with such an image:

I would like to know how I can check if the black-and-white image is a circle-like image; as you can see, if not, I can say an animal does not exist on that part of the image.

ContentLicense: CC BY-SA 4.0


问:
EJB Schedule issue on WebLogic
I have an EJB with a method that has an @schedule attribute configured to run at 5 PM every evening. The EJB is deployed on WebLogic server that gets restarted every morning at 4 AM.

Problem: The EJB method sendSummaryEmailForReqs() gets triggered during the server restart at 4 AM even though the method is scheduled to trigger ONLY at 5 PM.

Any pointers on resolving this issue would be highly appreciated.

```<code>@Stateless
@LocalBean
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
public class SendEmail implements Serializable {

    private static final Logger LOGGER = Logger.getLogger(SendEmail.class.getName());
    private static final long serialVersionUID = -3511061216660424373L;

    @EJB(beanName = "requestImpl")
    RequestImplRemote requestImpl;

    @EJB(beanName = "UtilityImpl")
    UtilityImplRemote utilityImpl;

    @Context
    private ServletContext context;

    @Schedule(dayOfWeek = "Mon-Sun", month = "*", hour = "17", dayOfMonth = "*", year = "*", minute = "0", second = "0")
    public void sendSummaryEmailForReqs() {
        LOGGER.log(Level.INFO, "sendSummaryEmailForReqs:: {0}", new Date());
        try {
            //... ... ... ...
            //... ... ... ...
        } catch (Exception ex) {
            LOGGER.log(Level.SEVERE, ex.getMessage());
        }
    }
}
</code>```

Title: EJB Schedule issue on WebLogic

Body:
I have an EJB with a method that has an @schedule attribute configured to run at 5 PM every evening. The EJB is deployed on WebLogic server that gets restarted every morning at 4 AM.

Problem: The EJB method sendSummaryEmailForReqs() gets triggered during the server restart at 4 AM even though the method is scheduled to trigger ONLY at 5 PM.

Any pointers on resolving this issue would be highly appreciated.

@Stateless
@LocalBean
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
public class SendEmail implements Serializable {

    private static final Logger LOGGER = Logger.getLogger(SendEmail.class.getName());
    private static final long serialVersionUID = -3511061216660424373L;

    @EJB(beanName = "requestImpl")
    RequestImplRemote requestImpl;

    @EJB(beanName = "UtilityImpl")
    UtilityImplRemote utilityImpl;

    @Context
    private ServletContext context;

    @Schedule(dayOfWeek = "Mon-Sun", month = "*", hour = "17", dayOfMonth = "*", year = "*", minute = "0", second = "0")
    public void sendSummaryEmailForReqs() {
        LOGGER.log(Level.INFO, "sendSummaryEmailForReqs:: {0}", new Date());
        try {
            //... ... ... ...
            //... ... ... ...
        } catch (Exception ex) {
            LOGGER.log(Level.SEVERE, ex.getMessage());
        }
    }
}


问:
Reactjs Hooks Context Provider with no token present
Hello I have a reactjs context which checks the localstorage token and then passes data down from it to the other componenets. However if a user tries to load a page without having access I want it to navigate back to the login component. However I keep getting this error "{message: 'Invalid token specified'}" Because the token doesn't exist in this scenario. How can I correctly make this redirect and work if the token doesn't exist at all?</p>
```<code>import { createContext, useState, useEffect } from "react";
import jwt_decode from "jwt-decode";

const UserContext = createContext({});

export const UserProvider = ({ children }) => {

    const [firstName, setFirstName] = useState();
    const [lastName, setLastName] = useState();
    const [email, setEmail] = useState();

    function checkAuth() {
        const token = localStorage.getItem("access_token");
            if (localStorage.getItem("access_token") === '') {
            navigate('/auth');
            return false;
            }
            const authData = jwt_decode(token);
            setFirstName(authData.firstname);
            setLastName(authData.lastName);
            setEmail(authData.email);
    }

    useEffect(()=>{
        checkAuth
        },[checkAuth])

    return (
        <UserContext.Provider value={{
            firstName, setFirstName,
            lastName, setLastName,
            email,setEmail
            }}>
            {children}
        </UserContext.Provider>
    )
}

export default UserContext;
</code>```

Body:
Hello I have a reactjs context which checks the localstorage token and then passes data down from it to the other componenets. However if a user tries to load a page without having access I want it to navigate back to the login component. However I keep getting this error "{message: 'Invalid token specified'}" Because the token doesn't exist in this scenario. How can I correctly make this redirect and work if the token doesn't exist at all?

import { createContext, useState, useEffect } from "react";
import jwt_decode from "jwt-decode";

const UserContext = createContext({});

export const UserProvider = ({ children }) => {

    const [firstName, setFirstName] = useState();
    const [lastName, setLastName] = useState();
    const [email, setEmail] = useState();

    function checkAuth() {
        const token = localStorage.getItem("access_token");
            if (localStorage.getItem("access_token") === '') {
            navigate('/auth');
            return false;
            }
            const authData = jwt_decode(token);
            setFirstName(authData.firstname);
            setLastName(authData.lastName);
            setEmail(authData.email);
    }

    useEffect(()=>{
        checkAuth
        },[checkAuth])

    return (
        <UserContext.Provider value={{
            firstName, setFirstName,
            lastName, setLastName,
            email,setEmail
            }}>
            {children}
        </UserContext.Provider>
    )
}

export default UserContext;


Title: Matplotlib plot/scatter wrong non-linear y axis

Body:
list(reversed(best_cs.precisions))

['0.0269',
 '0.0318',
 '0.0600',
 '0.0949',
 '0.1227',
 '0.1324',
 '0.1822',
 '0.2426',
 '0.3624',
 '0.4258',
 '0.4876']

recalls
[1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0]

And then when I try to plot it with line or scatter plot I get a strange y-axis:


问:
Redis (BeetleX.Redis) DB input and output data
I need to create a console app that connects to Redis DB, inputs values of string, int, List, HashSet, Hashtable, custom class types and then reads and outputs them on console.
I wrote a program using BeetleX.Redis (I need this exact client) basing on the official documentation, it compiles in MVS successfully, but it does not output on the console the values that I put in my Redis DB.
Also, as far as I understand, BeetleX.Redis runs a local server on it's own, however I'm still running a Memurai Redis server just in case. If BeetleX.Redis does indeed run a server, what port does it have or do I even need to specify it in the connection string?

My code is the following:

`

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeetleX.Redis;

namespace LR3_Redis
{
    public class UserRegistration
    {
        private string Name;
        private int Age;
        private DateTime Registered;
        public UserRegistration(string Nm, int Ag, DateTime Reg)
        {
            this.Name = Nm;
            this.Age = Ag;
            this.Registered = Reg;
        }
        public override string ToString()
        {
            return "[User Name: Name = " + Name + "," + "Age = " + Age +
            "Registered = " + Registered + "]";
        }
    }

    class Program
    {
        static void Main(string[] args)
        {

            RedisDB DB = new RedisDB(1);

            // Doljen bit zapushen server Redis, ya ispolzoval "Memurai"
            DefaultRedis.Instance.Host.AddWriteHost("localhost", 6378, true);

            // Dobavlyaem v BD

            DB.Set("keyAV1", "Yankin M.I., LR4 Redis");
            DB.Set("keyAV2", 123456);

            byte[] myByteArray = { 1, 2, 3, 4, 5, 6 };
            DB.Set("keyBA", myByteArray);

            var myList = DefaultRedis.CreateList<string>("keyL");
            myList.Push("Yankin M.I.");
            myList.Push("LR4");
            myList.Push("Redis");

            ISet<Object> myHashSet = new HashSet<Object>();
            myHashSet.Add(123456);
            myHashSet.Add(123.456);
            myHashSet.Add("Yankin M.I., LR4 Redis");
            DB.Set("keyHS", myHashSet);

            var myHashtable = DB.CreateHashTable("keyHT");
            myHashtable.Set("keyHT1", "Yankin M.I., LR4 Redis");
            myHashtable.Set("keyHT2", 123.456);
            myHashtable.Set("keyHT3", 123456);

            UserRegistration UserInfo = new UserRegistration("Michael", 20, DateTime.Today);
            DB.Set("keyObj", UserInfo);

            // Izvlekaem is BD

            var gString = DefaultRedis.Get<string>("keyAV1");
            Console.WriteLine("Stroka: " + gString);

            var gNumber = DefaultRedis.Get<int>("keyAV2");
            Console.WriteLine("Chislo: " + gNumber);

            var gByteArray = DefaultRedis.Get<byte[]>("keyBA");
            Console.WriteLine("Byte Array: " + gByteArray.ToString());

            var gList = DefaultRedis.Get<List<string>>("keyL");
            Console.WriteLine("List: " + gList.ToString());

            var gHashSet = DefaultRedis.Get<ISet<Object>>("keyHS");
            Console.WriteLine("HashSet: " + gHashSet.ToString());

            var gHashTable = DefaultRedis.Get<System.Collections.Hashtable>("keyHT");
            Console.WriteLine("Hashtable: " + gHashTable.ToString());

            var gUserRegistration = DefaultRedis.Get<UserRegistration>("keyObj");
            Console.WriteLine("Object: " + gUserRegistration.ToString());

            DB.Dispose();
            Console.ReadKey();

        }
    }
}
</code>```

`
In MVS it compiles the app, but it only outputs strings:redis result
I cannot understand whether it's the problem of inputting data in DB or extracting it or both.
In the end, my question is - what do I do to make my DB to input and extract data from it?

Body:
I need to create a console app that connects to Redis DB, inputs values of string, int, List, HashSet, Hashtable, custom class types and then reads and outputs them on console.
I wrote a program using BeetleX.Redis (I need this exact client) basing on the official documentation, it compiles in MVS successfully, but it does not output on the console the values that I put in my Redis DB.
Also, as far as I understand, BeetleX.Redis runs a local server on it's own, however I'm still running a Memurai Redis server just in case. If BeetleX.Redis does indeed run a server, what port does it have or do I even need to specify it in the connection string?

My code is the following:

`

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeetleX.Redis;

namespace LR3_Redis
{
    public class UserRegistration
    {
        private string Name;
        private int Age;
        private DateTime Registered;
        public UserRegistration(string Nm, int Ag, DateTime Reg)
        {
            this.Name = Nm;
            this.Age = Ag;
            this.Registered = Reg;
        }
        public override string ToString()
        {
            return "[User Name: Name = " + Name + "," + "Age = " + Age +
            "Registered = " + Registered + "]";
        }
    }

    class Program
    {
        static void Main(string[] args)
        {

            RedisDB DB = new RedisDB(1);

            // Doljen bit zapushen server Redis, ya ispolzoval "Memurai"
            DefaultRedis.Instance.Host.AddWriteHost("localhost", 6378, true);

            // Dobavlyaem v BD

            DB.Set("keyAV1", "Yankin M.I., LR4 Redis");
            DB.Set("keyAV2", 123456);

            byte[] myByteArray = { 1, 2, 3, 4, 5, 6 };
            DB.Set("keyBA", myByteArray);

            var myList = DefaultRedis.CreateList<string>("keyL");
            myList.Push("Yankin M.I.");
            myList.Push("LR4");
            myList.Push("Redis");

            ISet<Object> myHashSet = new HashSet<Object>();
            myHashSet.Add(123456);
            myHashSet.Add(123.456);
            myHashSet.Add("Yankin M.I., LR4 Redis");
            DB.Set("keyHS", myHashSet);

            var myHashtable = DB.CreateHashTable("keyHT");
            myHashtable.Set("keyHT1", "Yankin M.I., LR4 Redis");
            myHashtable.Set("keyHT2", 123.456);
            myHashtable.Set("keyHT3", 123456);

            UserRegistration UserInfo = new UserRegistration("Michael", 20, DateTime.Today);
            DB.Set("keyObj", UserInfo);

            // Izvlekaem is BD

            var gString = DefaultRedis.Get<string>("keyAV1");
            Console.WriteLine("Stroka: " + gString);

            var gNumber = DefaultRedis.Get<int>("keyAV2");
            Console.WriteLine("Chislo: " + gNumber);

            var gByteArray = DefaultRedis.Get<byte[]>("keyBA");
            Console.WriteLine("Byte Array: " + gByteArray.ToString());

            var gList = DefaultRedis.Get<List<string>>("keyL");
            Console.WriteLine("List: " + gList.ToString());

            var gHashSet = DefaultRedis.Get<ISet<Object>>("keyHS");
            Console.WriteLine("HashSet: " + gHashSet.ToString());

            var gHashTable = DefaultRedis.Get<System.Collections.Hashtable>("keyHT");
            Console.WriteLine("Hashtable: " + gHashTable.ToString());

            var gUserRegistration = DefaultRedis.Get<UserRegistration>("keyObj");
            Console.WriteLine("Object: " + gUserRegistration.ToString());

            DB.Dispose();
            Console.ReadKey();

        }
    }
}

`
In MVS it compiles the app, but it only outputs strings:redis result
I cannot understand whether it's the problem of inputting data in DB or extracting it or both.
In the end, my question is - what do I do to make my DB to input and extract data from it?


问:
How to make SPECIFIC dataframe content in e-mail go red in html based off results using html styler
I am e-mailing a dataframe in the body of the e-mail. However, I want to format the dataframe results so that if my results are a specific value (non-0 value) then the text turns red. I got help earlier that does convert all of my dataframe results to red but now i need to make the text red for SPECIFIC functions if they output a non-value.

Please see below for my function which I turn into a dataframe to be sent in an e-mail

Please see below for my function which I turn into a dataframe to be sent in an e-mail:

```<code>def record_count():
    with open('filename.csv', encoding='utf8') as file:
        record_number = len(list(file))
        print("Number of records on file:", record_number)
        return record_number

def id_check():
    df = pd.read_csv('filename.csv', low_memory=False)
    missing_id = df["id"].isna().sum()
    print("Number of users missing an id:", missing_id)
    return missing_id

def name_check():
    df = pd.read_csv('filename.csv', low_memory=False)
    missing_name = derivs["name"].isna().sum()
    print("Number of users missing a name:", missing_name)
    return missing_name

checks_table = {
    'Check' : ['Record Check', 'ID Check', 'Name Check'],
    'Summary' : ['Number of records on file','Number of records missing an ID', 'Number of users missing a name'],
    'Findings' : [record_count(), id_check(), name_check()]
}

df_checks = pd.DataFrame.from_dict(checks_table)
df_checks.head()
</code>```

result looks like:

Check                              Summary                      Findings
0   Record Count         Number of records on file               10000
1   ID Check          Number of records missing an ID           10
2   Name Check  Number of records missing a name    20

My current html e-mail code works so that if ANY of my findings != 0, the entire line is red but is there a way to make it so that it only applies to specific checks? I only want the entire line for ID check and Name check to turn red if the findings corresponding to those functions != 0.

See below for my html e-mail code:

```<code>    msg = MIMEMultipart('mixed')
    msg['Subject'] = SUBJECT
    msg['From'] = FROM
    msg['To'] = ','.join(TO)

    color= lambda x:  (pd.DataFrame('', index=x.index, columns=x.columns)
                         .mask(x['Findings'].ne(0), 'color:red;'))
    html = df_checks.style.apply(color, axis=None).hide_index().render()

    #this formats the e-mail header and adds the QC summary from the previous cell into the body of the e-mail
    html = f"""
        <html><body>
        <h1> </h1>
        <p> Please see the checks summary below {html} </p>
        </body></html>
        """
</code>```

Body:
I am e-mailing a dataframe in the body of the e-mail. However, I want to format the dataframe results so that if my results are a specific value (non-0 value) then the text turns red. I got help earlier that does convert all of my dataframe results to red but now i need to make the text red for SPECIFIC functions if they output a non-value.

Please see below for my function which I turn into a dataframe to be sent in an e-mail

Please see below for my function which I turn into a dataframe to be sent in an e-mail:

def record_count():
    with open('filename.csv', encoding='utf8') as file:
        record_number = len(list(file))
        print("Number of records on file:", record_number)
        return record_number

def id_check():
    df = pd.read_csv('filename.csv', low_memory=False)
    missing_id = df["id"].isna().sum()
    print("Number of users missing an id:", missing_id)
    return missing_id

def name_check():
    df = pd.read_csv('filename.csv', low_memory=False)
    missing_name = derivs["name"].isna().sum()
    print("Number of users missing a name:", missing_name)
    return missing_name

checks_table = {
    'Check' : ['Record Check', 'ID Check', 'Name Check'],
    'Summary' : ['Number of records on file','Number of records missing an ID', 'Number of users missing a name'],
    'Findings' : [record_count(), id_check(), name_check()]
}

df_checks = pd.DataFrame.from_dict(checks_table)
df_checks.head()

result looks like:

Check                              Summary                      Findings
0   Record Count         Number of records on file               10000
1   ID Check          Number of records missing an ID           10
2   Name Check  Number of records missing a name    20

My current html e-mail code works so that if ANY of my findings != 0, the entire line is red but is there a way to make it so that it only applies to specific checks? I only want the entire line for ID check and Name check to turn red if the findings corresponding to those functions != 0.

See below for my html e-mail code:

    msg = MIMEMultipart('mixed')
    msg['Subject'] = SUBJECT
    msg['From'] = FROM
    msg['To'] = ','.join(TO)

    color= lambda x:  (pd.DataFrame('', index=x.index, columns=x.columns)
                         .mask(x['Findings'].ne(0), 'color:red;'))
    html = df_checks.style.apply(color, axis=None).hide_index().render()

    #this formats the e-mail header and adds the QC summary from the previous cell into the body of the e-mail
    html = f"""

 Please see the checks summary below {html}

        """


问:
I can't put anything after my react-native snap carousel
I'm currently creating an app using react-native for a capstone project, but have run into a small issue when I try using the snap carousel. It seems that all text does not appear under the carousel for some reason.

```<code>const YourApp = () => {
  return (
    <ScrollView>
      <View style={styles.container}>
        <View style={{width: '100%', height: 200, backgroundColor: '#c89686',}}>
          <Text style={styles.txt}>SPARTAN</Text>
          <Text style={styles.txt1}>FITNESS</Text>
        </View>
        <Text style={styles.txt2}>New Arrivals</Text>
        <CarouselCards></CarouselCards>
        ***<Text style={{}}>Swipe to View</Text>***
      </View>
    </ScrollView>
  );
}

</code>```

I tried styling, adding margin-top to see if it was for some reason inside of the carousel, but nothing related to styling worked, it instead just added whitespace on the app. Tried adding another container for the text but it did the same thing as the styling, and didn't display.

Body:
I'm currently creating an app using react-native for a capstone project, but have run into a small issue when I try using the snap carousel. It seems that all text does not appear under the carousel for some reason.

const YourApp = () => {
  return (
    <ScrollView>
      <View style={styles.container}>
        <View style={{width: '100%', height: 200, backgroundColor: '#c89686',}}>
          <Text style={styles.txt}>SPARTAN</Text>
          <Text style={styles.txt1}>FITNESS</Text>
        </View>
        <Text style={styles.txt2}>New Arrivals</Text>
        <CarouselCards></CarouselCards>
        ***<Text style={{}}>Swipe to View</Text>***
      </View>
    </ScrollView>
  );
}

I tried styling, adding margin-top to see if it was for some reason inside of the carousel, but nothing related to styling worked, it instead just added whitespace on the app. Tried adding another container for the text but it did the same thing as the styling, and didn't display.


问:
Google Maps API: Wait until Cloud-based styling applied
Is there a way to wait until the Cloud-based styling of a Google Map has been applied before displaying it?

Currently my map appears with default styling, then after 1-2 seconds updates with my Cloud-based styling. Since my Cloud-based colours are quite different, this is jarring.

I tried waiting for the map idle event, but that fires before styling gets applied.


问:
How to write a txt file to an explicit FTP TLS with Delphi 10.3 on Android?
I have this code that works perfectly on Windows, but when running the application on Android, the connection to FTP is successful, but when writing the file, the app stays paused without doing anything.

It should be noted that on the FTP server, it appears that I am loading the file as in the image:

This is my code:

```<code>procedure TForm1.Button1Click(Sender: TObject);
begin
//  testClever;
//  exit;

    IdFTP:=TIdFTP.Create(nil);
    IdSSLIO:=TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      IdFTP.Disconnect();
        {$ifdef mswindows}
          idopensslsetlibpath('C:\Users\karol.campos\Desktop\FTPSExample\SSL');
        {$endif}
        {$ifdef android}
          idopensslsetlibpath(TPath.GetDocumentsPath);
        {$endif}
        IdSSLIO.SSLOptions.Method:=TIdSSLVersion.sslvSSLv23;
        IdSSLIO.PassThrough:=true;
        IdFTP.IOHandler:=IdSSLIO;
        IdFTP.ListenTimeout:=0;
        IdFTP.ReadTimeout:=0;
        IdFTP.TransferTimeout:=0;
        IdFTP.Passive:=true;
        IdFTP.UseTLS:=TIdUseTLS.utUseExplicitTLS;
        IdFTP.DataPortProtection:=TIdFTPDataPortSecurity.ftpdpsPrivate;

        IdFTP.Host := '(ip_ftp)';
        IdFTP.Username := '(user)';
        IdFTP.Password := '(pass)';

        try
        IdFTP.Connect;

        try
            {$ifdef mswindows}
              IdFTP.Put('D:\SeLogro.txt','SeLogro.txt',false);
            {$endif}
            {$ifdef android}
              IdFTP.Put('storage/emulated/0/SeLogro.txt','SeLogro.txt',false);
            {$endif}
              ShowMessage('Ready!');
            finally
              IdFTP.Disconnect();

            end;
        except
        on E : Exception do
         begin
           ShowMessage('Exception class name = '+E.ClassName);
           ShowMessage('Exception message = '+E.Message);
         end;
        end;
end;
</code>```

I found a similar question, but the code is in Java, will it be possible to do it in Delphi 10.3?

android ftp file tranfer over explicit TLS

Body:
I have this code that works perfectly on Windows, but when running the application on Android, the connection to FTP is successful, but when writing the file, the app stays paused without doing anything.

It should be noted that on the FTP server, it appears that I am loading the file as in the image:

This is my code:

procedure TForm1.Button1Click(Sender: TObject);
begin
//  testClever;
//  exit;

    IdFTP:=TIdFTP.Create(nil);
    IdSSLIO:=TIdSSLIOHandlerSocketOpenSSL.Create(nil);
      IdFTP.Disconnect();
        {$ifdef mswindows}
          idopensslsetlibpath('C:\Users\karol.campos\Desktop\FTPSExample\SSL');
        {$endif}
        {$ifdef android}
          idopensslsetlibpath(TPath.GetDocumentsPath);
        {$endif}
        IdSSLIO.SSLOptions.Method:=TIdSSLVersion.sslvSSLv23;
        IdSSLIO.PassThrough:=true;
        IdFTP.IOHandler:=IdSSLIO;
        IdFTP.ListenTimeout:=0;
        IdFTP.ReadTimeout:=0;
        IdFTP.TransferTimeout:=0;
        IdFTP.Passive:=true;
        IdFTP.UseTLS:=TIdUseTLS.utUseExplicitTLS;
        IdFTP.DataPortProtection:=TIdFTPDataPortSecurity.ftpdpsPrivate;

        IdFTP.Host := '(ip_ftp)';
        IdFTP.Username := '(user)';
        IdFTP.Password := '(pass)';

        try
        IdFTP.Connect;

        try
            {$ifdef mswindows}
              IdFTP.Put('D:\SeLogro.txt','SeLogro.txt',false);
            {$endif}
            {$ifdef android}
              IdFTP.Put('storage/emulated/0/SeLogro.txt','SeLogro.txt',false);
            {$endif}
              ShowMessage('Ready!');
            finally
              IdFTP.Disconnect();

            end;
        except
        on E : Exception do
         begin
           ShowMessage('Exception class name = '+E.ClassName);
           ShowMessage('Exception message = '+E.Message);
         end;
        end;
end;

I found a similar question, but the code is in Java, will it be possible to do it in Delphi 10.3?

android ftp file tranfer over explicit TLS


问:
Two conda environments with same torch version show different torch.cuda.is_available
I have 2 different conda environments.  Using conda list shows both environments have

```<code># Name                    Version                   Build  Channel
torch                     1.6.0                    pypi_0    pypi
</code>```

For each conda environment, I start the python interpreter from the cmd line and run:

```<code>import torch
torch.cuda.is_available()
</code>```

For 1 environment, torch.cuda.is_available() returns true and for the other it returns false.

What could be causing this?

Body:
I have 2 different conda environments.  Using conda list shows both environments have

# Name                    Version                   Build  Channel
torch                     1.6.0                    pypi_0    pypi

For each conda environment, I start the python interpreter from the cmd line and run:

import torch
torch.cuda.is_available()

For 1 environment, torch.cuda.is_available() returns true and for the other it returns false.

What could be causing this?


问:
How to solve "ValueError: Size is invalid. Valid font size are xx-small, x-small, small, medium, large, x-large, xx-large, larger, smaller, None"?
I used

import matplotlib as mpl
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

t = ax.text(0.5, 0.5, 'Text')

fonts = ['xx-small', 'x-small', 'small', 'medium', 'large',
         'x-large', 'xx-large', 'larger', 'smaller']

for font in fonts:
    t.set_fontsize(font)
    print (font, round(t.get_fontsize(), 2))

plt.close() ```
</div>
</div>
</p>
<p>The output was</p>
<blockquote>
<p>Blockquotexx-small 5.79
x-small 6.94
small 8.33
medium 10.0
large 12.0
x-large 14.4
xx-large 17.28
larger 12.0
smaller 8.33
Blockquote</p>
</blockquote>
<p>Then I run my histogram coding by following codes and found the error.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>import matplotlib.pyplot as plt
# Put your code here to create the plot
# %matplotlib inline
fig = plt.figure(figsize = (10, 5))
ax = fig.gca()
Plot_file['tripduration'].hist(ax = ax, alpha = 0.75, xlabelsize='Seconds', ylabelsize= 'Number of rides', bins=50)</code>```

Is there anyone to solve this error please?

Body:
I used

import matplotlib as mpl
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

t = ax.text(0.5, 0.5, 'Text')

fonts = ['xx-small', 'x-small', 'small', 'medium', 'large',
         'x-large', 'xx-large', 'larger', 'smaller']

for font in fonts:
    t.set_fontsize(font)
    print (font, round(t.get_fontsize(), 2))

plt.close()

The output was

Blockquotexx-small 5.79
x-small 6.94
small 8.33
medium 10.0
large 12.0
x-large 14.4
xx-large 17.28
larger 12.0
smaller 8.33
Blockquote

Then I run my histogram coding by following codes and found the error.

import matplotlib.pyplot as plt
# Put your code here to create the plot
# %matplotlib inline
fig = plt.figure(figsize = (10, 5))
ax = fig.gca()
Plot_file['tripduration'].hist(ax = ax, alpha = 0.75, xlabelsize='Seconds', ylabelsize= 'Number of rides', bins=50)

Is there anyone to solve this error please?


问:
NodRed Modbus exception 11
In my setup I'm using an DS378 as a Modbus TCP to RTU server.

ID 2 is a VFD, Delta MS300
ID 13 is a kWh monitor, DDM18SD

The first time i poll ID13, i get an error "exception 11: unkown error"
The second time i poll, msec later, i get a correct respons

The third time i poll ID2, i get an error "Error: Data length error, expected 23 got 32"
the forth time i poll, i get the correct repons from ID2

ID2 and 13 are both setup up with the same settings.
Is it the DS378 that is giving me trouble?

In need for some insight, thank you

Title: NodRed Modbus exception 11


问:
I get connection failed when i try to read my emails with laravel-imap
I am having the following problem using laravel-imap to retrieve my emails. This error is:

connection failed

I describe what I did:

Install with composer

composer require webklex/laravel-imap

Configuration

```<code>IMAP_HOST=imap.gmail.com
IMAP_PORT=993
IMAP_ENCRYPTION=ssl
IMAP_VALIDATE_CERT=true
IMAP_USERNAME=myemail@example.com
IMAP_PASSWORD=mypassword
IMAP_DEFAULT_ACCOUNT=default
IMAP_PROTOCOL=imap
</code>```

Route:
Route::get('/reademail', [ClientController::class, 'imapMail'])->name('email.read');

Controller:

```<code>$oClient = Client::account('default');
        $oClient->connect();
        $oFolder = $oClient->getFolders();
        dd($oFolder);
</code>```

The problem is found on the line:

```<code>$oClient->connect();
</code>```

I'm freaking out but I can't fix it. Can anyone kindly help me?

Body:
I am having the following problem using laravel-imap to retrieve my emails. This error is:

connection failed

I describe what I did:

Install with composer

composer require webklex/laravel-imap

Configuration

IMAP_HOST=imap.gmail.com
IMAP_PORT=993
IMAP_ENCRYPTION=ssl
IMAP_VALIDATE_CERT=true
IMAP_USERNAME=myemail@example.com
IMAP_PASSWORD=mypassword
IMAP_DEFAULT_ACCOUNT=default
IMAP_PROTOCOL=imap

Route:
Route::get('/reademail', [ClientController::class, 'imapMail'])->name('email.read');

Controller:

$oClient = Client::account('default');
        $oClient->connect();
        $oFolder = $oClient->getFolders();
        dd($oFolder);

The problem is found on the line:

$oClient->connect();

I'm freaking out but I can't fix it. Can anyone kindly help me?


问:
How do I address Neo.DatabaseError.Statement.ExecutionFailed, NOT PART OF CHAIN?
I am trying to compare two fairly complex Neo4j databases.  To that end, I created this script to look at relations:

```<code>//REL-COUNT-A-B
match (n)-[r]->(m)
WITH distinct type(r) as REL, count(r) as REL_COUNT, labels(n) as LA, labels(m) as LB
RETURN REL, REL_COUNT, apoc.coll.sort(LA) as LABELS_A, apoc.coll.sort(LB) as LABELS_B order by REL asc
</code>```

Unfortunately, I get this back:

```<code>Neo.DatabaseError.Statement.ExecutionFailed
NOT PART OF CHAIN! RelationshipTraversalCursor[id=4155363, open state with: denseNode=true, next=4155363, , underlying record=Relationship[4155363,used=true,source=3888733,target=5731,type=217,sPrev=4155261,sNext=4155354,tCount=53,tNext=4149012,prop=45167148,!sFirst, tFirst]]
</code>```

This 'smells like' a db inconsistency reaction was to run a consistency check via neo4j-admin.bat check-consistency --database=neo4j.

This runs for awhile, and the check simply stops at around 20%.  I've tried a few times with the same result, with this partial log:

```<code>Index file: C:\Users\jac\AppData\Local\Neo4j\Relate\Data\dbmss\dbms-a8a1d3cd-3308-41a3-bd5e-0c8cad3d0e82\data\databases
\neo4j\schema\index\native-btree-1.0\41\index-41.
.....2022-12-05 22:20:24.924+0000 WARN [o.n.c.ConsistencyCheckService] Index was dirty on startup which means it was not shutdo
wn correctly and need to be cleaned up with a successful recovery.
        Index file: C:\Users\jac\AppData\Local\Neo4j\Relate\Data\dbmss\dbms-a8a1d3cd-3308-41a3-bd5e-0c8cad3d0e82\data\databases
\neo4j\schema\index\native-btree-1.0\42\index-42.
...... 100%
Consistency check
....................  10%
....................  20%
..........Consistency checking failed.Full consistency check did not complete
</code>```

Any insights from anyone different then 'rebuild the indexes and constraints'?

Thanks

Body:
I am trying to compare two fairly complex Neo4j databases.  To that end, I created this script to look at relations:

//REL-COUNT-A-B
match (n)-[r]->(m)
WITH distinct type(r) as REL, count(r) as REL_COUNT, labels(n) as LA, labels(m) as LB
RETURN REL, REL_COUNT, apoc.coll.sort(LA) as LABELS_A, apoc.coll.sort(LB) as LABELS_B order by REL asc

Unfortunately, I get this back:

Neo.DatabaseError.Statement.ExecutionFailed
NOT PART OF CHAIN! RelationshipTraversalCursor[id=4155363, open state with: denseNode=true, next=4155363, , underlying record=Relationship[4155363,used=true,source=3888733,target=5731,type=217,sPrev=4155261,sNext=4155354,tCount=53,tNext=4149012,prop=45167148,!sFirst, tFirst]]

This 'smells like' a db inconsistency reaction was to run a consistency check via neo4j-admin.bat check-consistency --database=neo4j.

This runs for awhile, and the check simply stops at around 20%.  I've tried a few times with the same result, with this partial log:

Index file: C:\Users\jac\AppData\Local\Neo4j\Relate\Data\dbmss\dbms-a8a1d3cd-3308-41a3-bd5e-0c8cad3d0e82\data\databases
\neo4j\schema\index\native-btree-1.0\41\index-41.
.....2022-12-05 22:20:24.924+0000 WARN [o.n.c.ConsistencyCheckService] Index was dirty on startup which means it was not shutdo
wn correctly and need to be cleaned up with a successful recovery.
        Index file: C:\Users\jac\AppData\Local\Neo4j\Relate\Data\dbmss\dbms-a8a1d3cd-3308-41a3-bd5e-0c8cad3d0e82\data\databases
\neo4j\schema\index\native-btree-1.0\42\index-42.
...... 100%
Consistency check
....................  10%
....................  20%
..........Consistency checking failed.Full consistency check did not complete

Any insights from anyone different then 'rebuild the indexes and constraints'?

Thanks


问:
entire block to be required in YITH WooCommerce Product Add-Ons & Extra Options / disable add to cart button
hello I hope you can help me please.
I am using YITH WooCommerce Product Add-Ons & Extra Options premium

when i set a block (with the options) I would like the entire block to be required, not just the options within the block. is that possible?
in the premium version, it is possible to establish a minimum selection (but only to the option within the block) what I would like is to set the entire block (containing the options) with a minimum of selection.
I would like to set a minimum option for the block. or set the block as required.

another solution that could be is to disable (not hide) the add to cart button if the price is zero.

in the url (https://test.agendaspersonalizadas.com.pe/productos/tour-hab-add-on/), the product cannot be added to the cart if the date is not selected - the button is disabled
the price of the product depends exclusively on the selection of the extra options.
that way it forces the selection of at least 1 extra option

Thanks a lot !

a code snippet or something similar


问:
How to sort the columns of my query in WordPress
hello thanks to the query here below I manage to display various information from my wordpress database it works very well

But now I would like each column to be able to be sorted ascending and descending when the user clicks on the column title, is this possible?

```<code><?php
    // Example for adding WP PageNavi to a new WP_Query call
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    // les 5 dernieres journees de peche
    // 1. On définit les arguments pour définir ce que l'on souhaite récupérer
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => '10',
        'category_name' => 'nouveautes',
              'paged' => $paged
    );

    ?>

     <div >
        <div >Detail</div>
        <div >Date</div>
        <div >Nbre de prise</div>
        <div >Membre</div>

      </div>
    <?php
    $the_query = new WP_Query( $args );
    if ( $the_query->have_posts() ) {
        while ( $the_query->have_posts() ) {
            $the_query->the_post();

        $total_des_prises = get_post_meta( get_the_ID(), 'total_des_prises', true );?>
        <?php $variable=get_the_title();?>
        <?php //echo  get_the_author_meta ; ?>
         <div style=' display: flex;border:3px solid #8ebf42;'>

<div ><?php echo '<a href="' . get_permalink() . '">' . 'Détail' . '</a>';?></div>
        <div ><?php echo  get_the_date() ; ?></div>
        <div ><?php  echo  $total_des_prises ;?></div>
        <div ><?php echo  get_the_author() ;?></div>

      </div>
        <?php

     }

        wp_pagenavi( array( 'query' => $the_query ) );
    }

    wp_reset_postdata();
?>
</code>```

Body:
hello thanks to the query here below I manage to display various information from my wordpress database it works very well

But now I would like each column to be able to be sorted ascending and descending when the user clicks on the column title, is this possible?

<?php
    // Example for adding WP PageNavi to a new WP_Query call
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    // les 5 dernieres journees de peche
    // 1. On définit les arguments pour définir ce que l'on souhaite récupérer
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => '10',
        'category_name' => 'nouveautes',
              'paged' => $paged
    );

    ?>

Detail

Date

Nbre de prise

Membre

    <?php
    $the_query = new WP_Query( $args );
    if ( $the_query->have_posts() ) {
        while ( $the_query->have_posts() ) {
            $the_query->the_post();

        $total_des_prises = get_post_meta( get_the_ID(), 'total_des_prises', true );?>
        <?php $variable=get_the_title();?>
        <?php //echo  get_the_author_meta ; ?>

<?php echo '' . 'Détail' . '';?>

<?php echo  get_the_date() ; ?>

<?php  echo  $total_des_prises ;?>

<?php echo  get_the_author() ;?>

        <?php

     }

        wp_pagenavi( array( 'query' => $the_query ) );
    }

    wp_reset_postdata();
?>


问:
Google Sheet App Script Excel File Download Issue
Once I Download the sent Excel Files from Gmail it shows data as per below Picture 2. I know there are Formulas on google sheet which it is copying as it is but doing problem while enabling the links.

Is there a Way i can Paste those as VALUES ONLY ? Instead of Pasting the Cell Formula?

Looking forward, thank you!

SHOULD BE LIKE THIS:

Once Enable Editing is done, HERE PROBLEM:

Below is the Code I am using to send all these files.

```<code>function sendExcelAttachmentsInOneEmail() {
  var sheets = ['Sheet 1', 'Sheet 2', 'Sheet 3', 'Sheet 4', 'Sheet 5', 'Sheet 6'];
  var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
  var spreadSheetId = spreadSheet.getId();

  var urls = sheets.map(sheet => {
    var sheetId = spreadSheet.getSheetByName(sheet).getSheetId();
    return `https://docs.google.com/feeds/download/spreadsheets/Export?key=${spreadSheetId}&gid=${sheetId}&exportFormat=xlsx`;
  });

  var reportName = spreadSheet.getSheetByName('Sheet 7').getRange(1, 13).getValue();

  var params = {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer ' + ScriptApp.getOAuthToken()
    },
    muteHttpExceptions: true
  };

  var fileNames = ['Sheet 1.xlsx',
                   'Sheet 2.xlsx',
                   'Sheet 3.xlsx',
                   'Sheet 4.xlsx',
                   'Sheet 5.xlsx',
                   'Sheet 6.xlsx'];

  var blobs = urls.map((url, index) => {
    Utilities.sleep(10000);
    return UrlFetchApp.fetch(url, params).getBlob().setName(fileNames[index]);
  });

  var message = {
    to: 'email@example.com',
    cc: 'emails@examples.com',
    subject: 'REPORTS - ' + reportName,
    body: "Hi Team,\n\nPlease find attached Reports.\n\nBest Regards!",
    attachments: blobs
  }

  MailApp.sendEmail(message);
}
</code>```

Body:
Once I Download the sent Excel Files from Gmail it shows data as per below Picture 2. I know there are Formulas on google sheet which it is copying as it is but doing problem while enabling the links.

Is there a Way i can Paste those as VALUES ONLY ? Instead of Pasting the Cell Formula?

Looking forward, thank you!

SHOULD BE LIKE THIS:

Once Enable Editing is done, HERE PROBLEM:

Below is the Code I am using to send all these files.

function sendExcelAttachmentsInOneEmail() {
  var sheets = ['Sheet 1', 'Sheet 2', 'Sheet 3', 'Sheet 4', 'Sheet 5', 'Sheet 6'];
  var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
  var spreadSheetId = spreadSheet.getId();

  var urls = sheets.map(sheet => {
    var sheetId = spreadSheet.getSheetByName(sheet).getSheetId();
    return `https://docs.google.com/feeds/download/spreadsheets/Export?key=${spreadSheetId}&gid=${sheetId}&exportFormat=xlsx`;
  });

  var reportName = spreadSheet.getSheetByName('Sheet 7').getRange(1, 13).getValue();

  var params = {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer ' + ScriptApp.getOAuthToken()
    },
    muteHttpExceptions: true
  };

  var fileNames = ['Sheet 1.xlsx',
                   'Sheet 2.xlsx',
                   'Sheet 3.xlsx',
                   'Sheet 4.xlsx',
                   'Sheet 5.xlsx',
                   'Sheet 6.xlsx'];

  var blobs = urls.map((url, index) => {
    Utilities.sleep(10000);
    return UrlFetchApp.fetch(url, params).getBlob().setName(fileNames[index]);
  });

  var message = {
    to: 'email@example.com',
    cc: 'emails@examples.com',
    subject: 'REPORTS - ' + reportName,
    body: "Hi Team,\n\nPlease find attached Reports.\n\nBest Regards!",
    attachments: blobs
  }

  MailApp.sendEmail(message);
}


问:
How to properly combine aframe, threeJS, npm, and webpack?
I am trying to understand the expected way to set up an AFRAME project and use npm/webpack to install dependencies, including things like three/addons.

I am new to node (and especially webpack), but I have a package.json set up to run a simple server:

```<code>{
  "name": "test",
  "version": "0.0.1",
  "description": "test",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
  },
  "dependencies": {
    "aframe": "^1.3.0"
  }
  "engines": {
    "node": ">=16"
  }
}
</code>```

In my /public directory, I have several html files + js files in various nested directories which use AFRAME (which I was previously loading from CDN).

What's the "right" way to give these scripts access to AFRAME without CDN?  What about three, three/addons, or any other ThreeJS/AFRAME npm package?

I gather that I need to use webpack?  Can I configure webpack to generate a single bundle.js file that includes all of my dependencies, and then import as desired from that?  I don't fully understand the relationship between webpack's bundling and ES6 imports, or how to configure webpack in this way.

Thank you!

EDIT: based on the comments below, here is my package.json now:

```<code>{
  "name": "test",
  "version": "0.0.1",
  "description": "test",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "aframe": "git://github.com/aframevr/aframe.git#54022b80c60b12dc755f4f4a71a779b410dd23d0",
    "aframe-htmlembed-component": "^1.0.0",
    "aframe-extras": "^6.1.1",
    "aframe-instanced-mesh": "^0.6.1",
    "networked-aframe": "^0.11.0",
    "@react-three/drei": "^9.46.3"
  },
  "devDependencies": {
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.0"
  },
  "engines": {
    "node": ">=16"
  }
}
</code>```

webpack.config.js:

```<code>// From: https://github.com/Chabloz/a-frame-webpack-boilerplate
const path = require("path");

const config = {
  mode: "development",
  devtool: "inline-source-map",
  entry: "./src/main.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "public/dist")
  },
  watch: false,
  resolve: {
    modules: [
      path.resolve("./src"),
      path.resolve("./node_modules")
    ]
  },
  externals: {
    three: "THREE"
  }
};

module.exports = (env, argv) => {
  return config;
};
</code>```

and /src/main.js:

```<code>// AFRAME
require("aframe");

// Helpers
require("aframe-htmlembed-component");
require("aframe-extras");
require("aframe-instanced-mesh/src/instanced-mesh");
require("@react-three/drei");

// NAF
require("networked-aframe");
</code>```

This sucessfully generates /public/dist/bundle.js when I run webpack, and I can include it like so:

```<code>    <script src="/dist/bundle.js"></script>
</code>```

But when I try to import any of the modules in the bundle from another script (import * as THREE from "three"), I get Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../"..  If I change it to import * as THREE from "/dist/bundle.js", I get bundle.js:36779 Uncaught Error: A a-node type is already registered

Body:
I am trying to understand the expected way to set up an AFRAME project and use npm/webpack to install dependencies, including things like three/addons.

I am new to node (and especially webpack), but I have a package.json set up to run a simple server:

{
  "name": "test",
  "version": "0.0.1",
  "description": "test",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
  },
  "dependencies": {
    "aframe": "^1.3.0"
  }
  "engines": {
    "node": ">=16"
  }
}

In my /public directory, I have several html files + js files in various nested directories which use AFRAME (which I was previously loading from CDN).

What's the "right" way to give these scripts access to AFRAME without CDN?  What about three, three/addons, or any other ThreeJS/AFRAME npm package?

I gather that I need to use webpack?  Can I configure webpack to generate a single bundle.js file that includes all of my dependencies, and then import as desired from that?  I don't fully understand the relationship between webpack's bundling and ES6 imports, or how to configure webpack in this way.

Thank you!

EDIT: based on the comments below, here is my package.json now:

{
  "name": "test",
  "version": "0.0.1",
  "description": "test",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "aframe": "git://github.com/aframevr/aframe.git#54022b80c60b12dc755f4f4a71a779b410dd23d0",
    "aframe-htmlembed-component": "^1.0.0",
    "aframe-extras": "^6.1.1",
    "aframe-instanced-mesh": "^0.6.1",
    "networked-aframe": "^0.11.0",
    "@react-three/drei": "^9.46.3"
  },
  "devDependencies": {
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.0"
  },
  "engines": {
    "node": ">=16"
  }
}

webpack.config.js:

// From: https://github.com/Chabloz/a-frame-webpack-boilerplate
const path = require("path");

const config = {
  mode: "development",
  devtool: "inline-source-map",
  entry: "./src/main.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "public/dist")
  },
  watch: false,
  resolve: {
    modules: [
      path.resolve("./src"),
      path.resolve("./node_modules")
    ]
  },
  externals: {
    three: "THREE"
  }
};

module.exports = (env, argv) => {
  return config;
};

and /src/main.js:

// AFRAME
require("aframe");

// Helpers
require("aframe-htmlembed-component");
require("aframe-extras");
require("aframe-instanced-mesh/src/instanced-mesh");
require("@react-three/drei");

// NAF
require("networked-aframe");

This sucessfully generates /public/dist/bundle.js when I run webpack, and I can include it like so:

But when I try to import any of the modules in the bundle from another script (import * as THREE from "three"), I get Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../"..  If I change it to import * as THREE from "/dist/bundle.js", I get bundle.js:36779 Uncaught Error: A a-node type is already registered


问:
How to stop fieldset in form from causing a double scroll on the page?
I have a form on a page in which the fieldsets create another scrollbar in the page, and makes the form scrollable. This is so weird, and its even weirder that I cant find any sort of information or solution on this anywhere. It should just continue on in the page, I have no size restriction for the form.

Here is my HTML for the form

```<code><form>
                <fieldset>
                    <legend>Customer Information:</legend>
                    <label for="fname">First name:</label>
                    <input type="text" id="fname" name="fname"><br><br>
                    <label for="lname">Last name:</label>
                    <input type="text" id="lname" name="lname"><br><br>
                    <label for="email">Email:</label>
                    <input type="email" id="email" name="email"><br><br>
                    <label for="area">Please describe your concern:</label><br>
                    <textarea name="area" id="area" rows="5" cols="30"></textarea><br><br>
                </fieldset><br>
                <fieldset>
                    <legend>Product Information:</legend>
                    <label for="pname">Product name:</label>
                    <input type="text" id="pname" name="pname"><br><br>
                    <label for="date">Date of Purchase:</label>
                    <input type="date" id="date" name="date"><br><br>
                    <label>Select your warranty plan:</label> <br>
                    <input type="radio" id="none" name="plan" value="none">
                    <label for="none">None</label><br>
                    <input type="radio" id="six" name="plan" value="six">
                    <label for="css">6 Months</label><br>
                    <input type="radio" id="twelve" name="plan" value="twelve">
                    <label for="javascript">12 Months</label><br>
                    <input type="radio" id="eighteen" name="plan" value="eighteen">
                    <label for="css">18 Months</label><br>
                    <input type="radio" id="twentyfour" name="plan" value="twentyfour">
                    <label for="javascript">24 Months</label><br><br>
                    <label>Select which THE BOARD SHOP locations you have shopped at: </label><br>
                    <input type="checkbox" id="Toronto" name="Toronto" value="Toronto">
                    <label for="Toronto"> Toronto</label><br>
                    <input type="checkbox" id="Montreal" name="Montreal" value="Montreal">
                    <label for="Montreal"> Montreal</label><br>
                    <input type="checkbox" id="California" name="California" value="California">
                    <label for="California"> California</label><br>
                    <input type="checkbox" id="New York" name="New York" value="New York">
                    <label for="New York"> New York</label><br>
                    <input type="checkbox" id="Cairo" name="Cairo" value="Cairo">
                    <label for="Cairo"> Cairo</label><br>

                </fieldset><br>
                <input type="submit" value="Submit" id="submit">
            </form>
</code>```

and the CSS

```<code>form {
    margin: 0 auto;
    width: 50%;
}

textarea {
    resize: none;
}

label,
legend,
input {
    font-family: "Kanit", sans-serif;
}

</code>```

Body:
I have a form on a page in which the fieldsets create another scrollbar in the page, and makes the form scrollable. This is so weird, and its even weirder that I cant find any sort of information or solution on this anywhere. It should just continue on in the page, I have no size restriction for the form.

Here is my HTML for the form

<form>
                <fieldset>
                    <legend>Customer Information:</legend>
                    First name:
                    <input type="text" id="fname" name="fname">

                    Last name:
                    <input type="text" id="lname" name="lname">

                    Email:
                    <input type="email" id="email" name="email">

                    Please describe your concern:

                    <textarea name="area" id="area" rows="5" cols="30"></textarea>

                </fieldset>

                <fieldset>
                    <legend>Product Information:</legend>
                    Product name:
                    <input type="text" id="pname" name="pname">

                    Date of Purchase:
                    <input type="date" id="date" name="date">

                    Select your warranty plan:

                    <input type="radio" id="none" name="plan" value="none">
                    None

                    <input type="radio" id="six" name="plan" value="six">
                    6 Months

                    <input type="radio" id="twelve" name="plan" value="twelve">
                    12 Months

                    <input type="radio" id="eighteen" name="plan" value="eighteen">
                    18 Months

                    <input type="radio" id="twentyfour" name="plan" value="twentyfour">
                    24 Months

                    Select which THE BOARD SHOP locations you have shopped at:

                    <input type="checkbox" id="Toronto" name="Toronto" value="Toronto">
                     Toronto

                    <input type="checkbox" id="Montreal" name="Montreal" value="Montreal">
                     Montreal

                    <input type="checkbox" id="California" name="California" value="California">
                     California

                    <input type="checkbox" id="New York" name="New York" value="New York">
                     New York

                    <input type="checkbox" id="Cairo" name="Cairo" value="Cairo">
                     Cairo

                </fieldset>

                <input type="submit" value="Submit" id="submit">
            </form>

and the CSS

form {
    margin: 0 auto;
    width: 50%;
}

textarea {
    resize: none;
}

label,
legend,
input {
    font-family: "Kanit", sans-serif;
}


问:
How can I make a WordPress gallery called with jQuery?
I have a product.php page, where I want to write 30 types of product page templates, by calling individual content elements with functions.

I want to create a wp gallery in which the main image is a thumbnail of the currently opened wp page. The slide show gallery below consists of images from the gallery provided on the wp page.

I've been looking for a solution for weeks, I've looked through all the forums and I can't find it.

product.php:

```
<p>galery.js:</p>
<pre class="lang-js prettyprint-override"><code>var App = (function () {
'use strict';
var gallery = $('#js-gallery');

var Gallery = {
switch: function(trigger, imgContainer) {
var src = trigger.attr('href'),
thumbs = trigger.siblings(),
img = trigger.parent().prev().children();

      trigger.addClass('is-active');

      thumbs.each(function() {
        if( $(this).hasClass('is-active') ) {
          $(this).removeClass('is-active');
        }
      });
      img.attr('src', src);
    }

};

function init() {

    gallery.delegate('a', 'click', function(event) {
      var trigger = $(this);
      var triggerData = trigger.data("gallery");

      if ( triggerData === 'zoom') {
        var imgContainer = trigger.parent(),
        img = trigger.siblings();
        Gallery.zoom(imgContainer, img);
      } else if ( triggerData === 'thumb') {
        var imgContainer = trigger.parent().siblings();
        Gallery.switch(trigger, imgContainer);
      } else {
        return;
      }
      event.preventDefault();
    });

}

return {
init: init
};
})();
App.init();
</code>```

css:

```<code>.gallery {
overflow: hidden;
}
.gallery__hero {
overflow: hidden;
position: relative;
padding: 2px;
margin: 0 0 3px;
background: #fff;
}
.gallery__thumbs {
text-align: center;
background: #fff;
display: flex;
flex-wrap: nowrap;
display: block;
justify-content: center;
margin-bottom:30px;
}
.gallery__thumbs img {
width: 153px;
height: 153px;
}
.gallery__thumb a {
display: inline-block;
width: 20%;
padding: $base-spacing/2;
opacity: $thumb-opacity-inactive;
transition: opacity $base-transition-duration $base-transition-timing;
}

</code>```

Body:
I have a product.php page, where I want to write 30 types of product page templates, by calling individual content elements with functions.

I want to create a wp gallery in which the main image is a thumbnail of the currently opened wp page. The slide show gallery below consists of images from the gallery provided on the wp page.

I've been looking for a solution for weeks, I've looked through all the forums and I can't find it.

product.php:

galery.js:

var App = (function () {
'use strict';
var gallery = $('#js-gallery');

var Gallery = {
switch: function(trigger, imgContainer) {
var src = trigger.attr('href'),
thumbs = trigger.siblings(),
img = trigger.parent().prev().children();

      trigger.addClass('is-active');

      thumbs.each(function() {
        if( $(this).hasClass('is-active') ) {
          $(this).removeClass('is-active');
        }
      });
      img.attr('src', src);
    }

};

function init() {

    gallery.delegate('a', 'click', function(event) {
      var trigger = $(this);
      var triggerData = trigger.data("gallery");

      if ( triggerData === 'zoom') {
        var imgContainer = trigger.parent(),
        img = trigger.siblings();
        Gallery.zoom(imgContainer, img);
      } else if ( triggerData === 'thumb') {
        var imgContainer = trigger.parent().siblings();
        Gallery.switch(trigger, imgContainer);
      } else {
        return;
      }
      event.preventDefault();
    });

}

return {
init: init
};
})();
App.init();

css:

.gallery {
overflow: hidden;
}
.gallery__hero {
overflow: hidden;
position: relative;
padding: 2px;
margin: 0 0 3px;
background: #fff;
}
.gallery__thumbs {
text-align: center;
background: #fff;
display: flex;
flex-wrap: nowrap;
display: block;
justify-content: center;
margin-bottom:30px;
}
.gallery__thumbs img {
width: 153px;
height: 153px;
}
.gallery__thumb a {
display: inline-block;
width: 20%;
padding: $base-spacing/2;
opacity: $thumb-opacity-inactive;
transition: opacity $base-transition-duration $base-transition-timing;
}


问:
Set class attribute to an inherited class
I have a base class named foo. This class gets inherited by another class named boo. I would like to have all methods within the boo object to go into foo such that I can call boo objects like foo.boo.example_attribute()

```<code>class foo:
    # this class puts things into the env object for use in other files

class boo(foo):
    example_attribute = "Blah Blah"
</code>```

My goal would be to have print(foo.boo.example_attribute) output "Blah Blah"

I've tried explicitly setting everything with boo to be defined as foo.boo.example_attribute but I realized this isn't scalable and seems pretty sloppy.

Body:
I have a base class named foo. This class gets inherited by another class named boo. I would like to have all methods within the boo object to go into foo such that I can call boo objects like foo.boo.example_attribute()

class foo:
    # this class puts things into the env object for use in other files

class boo(foo):
    example_attribute = "Blah Blah"

My goal would be to have print(foo.boo.example_attribute) output "Blah Blah"

I've tried explicitly setting everything with boo to be defined as foo.boo.example_attribute but I realized this isn't scalable and seems pretty sloppy.


问:
Database error that hides all posts/pages on dashboard
I have this website that I build using wordpress.org, and it was working fine but out of nowhere I couldn't see any of my posts/pages/custom pages on the dashboard anymore, even though they exist.
I ran the debug thing and got these errors (on this screenshot you can also see how none of the custom posts are visible, even though they are indeed there (Published (30)):

I have basically zero knowledge on databases, so these errors mean nothing to me lol

I can tell that some changes need to be made but I have no idea where to make them.


问:
Hibernate 6 Wrong query generated
I have the following classes

```<code>@Entity
@Table(name = "users")
public class User extends BaseEntity implements Serializable {

..

    @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.MERGE, CascadeType.PERSIST }, mappedBy = "entity")
    private Set<UserUdfValue> properties = new HashSet<>();

..

}

@Entity
@DiscriminatorValue(UserUdfValue.UDFID)
public class UserUdfValue extends ValueBase {

    private static final long serialVersionUID = -898152830344556386L;

    public final static String UDFID = "1";

    @ManyToOne(fetch=FetchType.LAZY, cascade = {})
    @JoinColumn(name = "entity_id", nullable = false)
    private User entity;

    public User getEntity() {
        return entity;
    }

    public void setEntity(User entity) {
        this.entity = entity;
    }

}

@Entity(name = "udf_value")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "target_type", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorOptions(force = false)
public abstract class ValueBase implements Serializable {
    private static final long serialVersionUID = 1L;

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

...

}
</code>```

Prior migrating to hibernate 6 ( hibernate 5.6 ), when querying a user by id , it was generating an sql query like i expect

```<code>SELECT *
FROM users user0_
LEFT OUTER JOIN udf_value properties14_ ON user0_.id = properties14_.entity_id
    AND properties14_.target_type = 1
WHERE user0_.id = ?
</code>```

However with hibernate 6 the discriminator criteria is no longer on the join but in the where clause

```<code>SELECT *
FROM users u1_0
LEFT JOIN udf_value p2_0 ON u1_0.id = p2_0.entity_id
WHERE p2_0.target_type = 1
    AND u1_0.id = ?
</code>```

Which obvsiouly doesn't give me the same result i expect

EDIT : This has been recognized as a bug in hibernate https://discourse.hibernate.org/t/hibernate-6-wrong-query-generated-with-discriminatorvalue/6984/3

Title: Hibernate 6 Wrong query generated

Body:
I have the following classes

@Entity
@Table(name = "users")
public class User extends BaseEntity implements Serializable {

..

    @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.MERGE, CascadeType.PERSIST }, mappedBy = "entity")
    private Set<UserUdfValue> properties = new HashSet<>();

..

}

@Entity
@DiscriminatorValue(UserUdfValue.UDFID)
public class UserUdfValue extends ValueBase {

    private static final long serialVersionUID = -898152830344556386L;

    public final static String UDFID = "1";

    @ManyToOne(fetch=FetchType.LAZY, cascade = {})
    @JoinColumn(name = "entity_id", nullable = false)
    private User entity;

    public User getEntity() {
        return entity;
    }

    public void setEntity(User entity) {
        this.entity = entity;
    }

}

@Entity(name = "udf_value")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "target_type", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorOptions(force = false)
public abstract class ValueBase implements Serializable {
    private static final long serialVersionUID = 1L;

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

...

}

Prior migrating to hibernate 6 ( hibernate 5.6 ), when querying a user by id , it was generating an sql query like i expect

SELECT *
FROM users user0_
LEFT OUTER JOIN udf_value properties14_ ON user0_.id = properties14_.entity_id
    AND properties14_.target_type = 1
WHERE user0_.id = ?

However with hibernate 6 the discriminator criteria is no longer on the join but in the where clause

SELECT *
FROM users u1_0
LEFT JOIN udf_value p2_0 ON u1_0.id = p2_0.entity_id
WHERE p2_0.target_type = 1
    AND u1_0.id = ?

Which obvsiouly doesn't give me the same result i expect

EDIT : This has been recognized as a bug in hibernate https://discourse.hibernate.org/t/hibernate-6-wrong-query-generated-with-discriminatorvalue/6984/3


问:
How can I set default (global) c_cpp include paths for VSCode when using WSL?
I have the following setting in my settings.json file:

```<code>    "C_Cpp.default.includePath": [
        "/usr/include/**"
    ],
</code>```

which I found details on here

However when I have a WSL VSCode based window opened, this setting is grayed out and hovering over it states:

```<code>This setting cannot be applied in this window. It will be applied when you open a local window.
</code>```

If I open a new window outside of WSL, this setting seems to apply correctly. I would like this setting to be active when using a VSCode window opened for WSL:Ubuntu but am struggling to find a way to do this.

Body:
I have the following setting in my settings.json file:

    "C_Cpp.default.includePath": [
        "/usr/include/**"
    ],

which I found details on here

However when I have a WSL VSCode based window opened, this setting is grayed out and hovering over it states:

This setting cannot be applied in this window. It will be applied when you open a local window.

If I open a new window outside of WSL, this setting seems to apply correctly. I would like this setting to be active when using a VSCode window opened for WSL:Ubuntu but am struggling to find a way to do this.


问:
How can I tell if Javascript is loading on my website?
I'm using Advanced custom Fields Accordion as a repeater.  I found a website that provided the javascript to use to make it work and it works on the site - https://wpbeaches.com/create-an-acf-repeater-accordion-in-wordpress/ and also works on codepen - https://codepen.io/lpjjonline/pen/WNyLJvM  when I tried it there but I can't get it to work on my site.

Javascript -

```<code>var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
   /* Toggle between adding and removing the "active" class,
  to highlight the button that controls the panel */
  this.classList.toggle("active");

  /* Toggle between hiding and showing the active panel */
  var panel = this.nextElementSibling;
  if (panel.style.display === "block") {
  panel.style.display = "none";
   } else {
  panel.style.display = "block";
   }
   });
   }

CSS -

.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
text-align: left;
border: none;
outline: none;
transition: 0.4s;
margin-bottom: 10px;
border: none;
}
.accordion .active, .accordion:hover,
button:focus {
background-color: #ccc;
background: #ccc;
border: none;
}
.panel {
padding: 0 18px;
background-color: white;
display: none;
overflow: hidden;
}
.accordion:after {
content: '\02795'; /* Unicode character for "plus" sign (+) */
font-size: 13px;
color: #777;
float: right;
margin-left: 5px;
}
.accordion .active:after {
content: "\2796"; /* Unicode character for "minus" sign (-) */
}

HTML/PHP -

<div class="faqs">
<?php
// check for rows (parent repeater)
if( have_rows('faqs') ): ?>

<?php
// loop through rows (parent repeater)
while( have_rows('faqs') ): the_row(); ?>

<h2><?php if( get_sub_field('faq_department_name') ): ?>
<?php the_sub_field('faq_department_name'); ?>
<?php endif; ?></h2>

<?php
// check for rows (sub repeater)
if( have_rows('qas') ): ?>
 <ul>
 <?php
// loop through rows (sub repeater)
 while( have_rows('qas') ): the_row();
</code>```

// display each item as a list - with a class of completed ( if completed )

```<code> ?>

<li>

<button class="accordion"><?php if( get_sub_field('faq_question') ): ?>
<?php the_sub_field('faq_question'); ?>
<?php endif; ?></button>
<div class="panel"><?php if( get_sub_field('faq_answer') ): ?>
<?php the_sub_field('faq_answer'); ?></div>
<?php endif; ?>

</li>

<?php endwhile; ?>
</ul>
<?php endif;
endwhile;
endif; ?>

</div>
</code>```

All of the code is on the tutorial site and the codepen link.

The website that it's not working on is - https://collier.tfm-dev.com/township/faq/

My theme has this in the header - .

Can anyone tell me what I'm doing wrong?

Body:
I'm using Advanced custom Fields Accordion as a repeater.  I found a website that provided the javascript to use to make it work and it works on the site - https://wpbeaches.com/create-an-acf-repeater-accordion-in-wordpress/ and also works on codepen - https://codepen.io/lpjjonline/pen/WNyLJvM  when I tried it there but I can't get it to work on my site.

Javascript -

var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
   /* Toggle between adding and removing the "active" class,
  to highlight the button that controls the panel */
  this.classList.toggle("active");

  /* Toggle between hiding and showing the active panel */
  var panel = this.nextElementSibling;
  if (panel.style.display === "block") {
  panel.style.display = "none";
   } else {
  panel.style.display = "block";
   }
   });
   }

CSS -

.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
text-align: left;
border: none;
outline: none;
transition: 0.4s;
margin-bottom: 10px;
border: none;
}
.accordion .active, .accordion:hover,
button:focus {
background-color: #ccc;
background: #ccc;
border: none;
}
.panel {
padding: 0 18px;
background-color: white;
display: none;
overflow: hidden;
}
.accordion:after {
content: '\02795'; /* Unicode character for "plus" sign (+) */
font-size: 13px;
color: #777;
float: right;
margin-left: 5px;
}
.accordion .active:after {
content: "\2796"; /* Unicode character for "minus" sign (-) */
}

HTML/PHP -

<?php
// check for rows (parent repeater)
if( have_rows('faqs') ): ?>

<?php
// loop through rows (parent repeater)
while( have_rows('faqs') ): the_row(); ?>

<?php if( get_sub_field('faq_department_name') ): ?>
<?php the_sub_field('faq_department_name'); ?>
<?php endif; ?>

<?php
// check for rows (sub repeater)
if( have_rows('qas') ): ?>

 <?php
// loop through rows (sub repeater)
 while( have_rows('qas') ): the_row();

// display each item as a list - with a class of completed ( if completed )

 ?>

<button class="accordion"><?php if( get_sub_field('faq_question') ): ?>
<?php the_sub_field('faq_question'); ?>
<?php endif; ?></button>

<?php if( get_sub_field('faq_answer') ): ?>
<?php the_sub_field('faq_answer'); ?>

<?php endif; ?>

<?php endwhile; ?>

<?php endif;
endwhile;
endif; ?>

All of the code is on the tutorial site and the codepen link.

The website that it's not working on is - https://collier.tfm-dev.com/township/faq/

My theme has this in the header - .

Can anyone tell me what I'm doing wrong?


问:
Markers not showing up with react-google-maps/api
I am trying to create a marker and have tried isolating the problem to just creating a marker already in the map when it loads.I am using React 17 and cannot upgrade to 18 because it will cause errors in other dependencies.

So far I've tried:

Using both <Marker and <MarkerF> as many articles suggest.

Turning off strict mode many articles suggest. Here is my root file showing this.

```<code>const rootElement = document.getElementById("root");

ReactDOM.render(
  <ChakraProvider theme={theme}>
    <App />
  </ChakraProvider>,
  rootElement
);
</code>```

Here is the map file:

```<code>import { useLoadScript, GoogleMap, MarkerF } from "@react-google-maps/api";
import { newKey } from "../utils/maps";

export const MyMap: React.FC<MapProps> = ({ listOfSchools }) => {

  const { isLoaded } = useLoadScript({
    id: "google-map-script",
    googleMapsApiKey: `${newKey}`,
  });

const center = {
    lat: 41.4925,
    lng: 99.9018,
    };
const containerStyle = {
    width: "70vw",
    height: "100vh",
   };
  if (!isLoaded) return <div> Map is loading ...</div>;
  return (
    <div className="map-box">
      <GoogleMap
        mapContainerStyle={containerStyle}
        center={center}
        zoom={15}

      />
      <MarkerF position={center}/>
    </div>
  );
};
</code>```

The map is loading at the specified center, but no marker is shown.

I see the marker when inspecting, and noticed this error, despite removing the <StrictMode> tags from my root file as shown above. Is there another place to turn it off in React17?

Body:
I am trying to create a marker and have tried isolating the problem to just creating a marker already in the map when it loads.I am using React 17 and cannot upgrade to 18 because it will cause errors in other dependencies.

So far I've tried:

Using both <Marker and <MarkerF> as many articles suggest.

Turning off strict mode many articles suggest. Here is my root file showing this.

const rootElement = document.getElementById("root");

ReactDOM.render(
  <ChakraProvider theme={theme}>
    <App />
  </ChakraProvider>,
  rootElement
);

Here is the map file:

import { useLoadScript, GoogleMap, MarkerF } from "@react-google-maps/api";
import { newKey } from "../utils/maps";

export const MyMap: React.FC<MapProps> = ({ listOfSchools }) => {

  const { isLoaded } = useLoadScript({
    id: "google-map-script",
    googleMapsApiKey: `${newKey}`,
  });

const center = {
    lat: 41.4925,
    lng: 99.9018,
    };
const containerStyle = {
    width: "70vw",
    height: "100vh",
   };
  if (!isLoaded) return
 Map is loading ...
;
  return (

      <GoogleMap
        mapContainerStyle={containerStyle}
        center={center}
        zoom={15}

      />
      <MarkerF position={center}/>

  );
};

The map is loading at the specified center, but no marker is shown.

I see the marker when inspecting, and noticed this error, despite removing the <StrictMode> tags from my root file as shown above. Is there another place to turn it off in React17?


问:
pChart - displaying bar chart above and below the 0 line
This is an old library I know but does anyone know the setting to get the bars to appear above and below the 0 line like the example:

I am getting this:


问:
Transaction with multiple scopes not executing correctly in Spring Web
I have to improve the atomicity of a process in a Spring Boot web application. The idea is the following:

```<code>class X {
    @transactional
    method a() {
        b("STARTING") //Transactional method
        try {
            c() //transactional method
        } except {
            b("FAILED") //transactional method
        }
    }
}

@transactional
class Z {

    b(status) {
        //change status
    }

    c() {
        //do stuff
    }

    // ... More transactional methods

}
</code>```

I am working on class X, the problem is that when I call a() from another class to execute the whole transactional process, it only perform the changes from line 4, b("STARTING") and it completely ignores the rest. I am using Hibernate, so I cannot use NESTED propagation, I have tried some other things but I am not even sure why this happens, as I understand, default REQUIRED propagation setting should merge everything in a single transaction.

When I start the application in DEBUG mode, I can see how the code flows as it is expected, but at the end, when executing COMMIT, the transaction is incomplete. Any ideas?

Body:
I have to improve the atomicity of a process in a Spring Boot web application. The idea is the following:

class X {
    @transactional
    method a() {
        b("STARTING") //Transactional method
        try {
            c() //transactional method
        } except {
            b("FAILED") //transactional method
        }
    }
}

@transactional
class Z {

    b(status) {
        //change status
    }

    c() {
        //do stuff
    }

    // ... More transactional methods

}

I am working on class X, the problem is that when I call a() from another class to execute the whole transactional process, it only perform the changes from line 4, b("STARTING") and it completely ignores the rest. I am using Hibernate, so I cannot use NESTED propagation, I have tried some other things but I am not even sure why this happens, as I understand, default REQUIRED propagation setting should merge everything in a single transaction.

When I start the application in DEBUG mode, I can see how the code flows as it is expected, but at the end, when executing COMMIT, the transaction is incomplete. Any ideas?


问:
Convert UTF-8 apostrophe to ASCII single quote in JavaScript
Note 2:  I found the answer - and it wasn't anywhere else on your site.  You mark things as duplicates far too cavalierly.  Here was the line that fixed my problem.  Where is it on your site?

str = str.replace(/\u2019/g, "'");

Note:  This is not a duplicate of "Remove accents/diacritics in a string in JavaScript."  My question has to do with a sole apostrophe and not an accent or diacritic.

I have an HTML input field being used on an iPhone.  The person is typing the word "don't."  The apostrophe is coming across as 0xE2 0x80 0x99.  I presume that is Unicode.  How can I convert that to an ASCII single quote in JavaScript?

I am basically looking to create a JavaScript function that takes a string (potentially containing any number of those Unicode apostrophes) and returns the string with all of the Unicode apostrophes replaced with the ASCII single quotes in their places.

Thank you!


问:
Accessing a simple get endpoint of a Spring App deployed to a tomcat running in a container in a AWS AC2 instance
I'm trying to deploy a simple spring application (https://github.com/rmmcosta/SampleRestWar.git) to a tomcat server running in a docker container inside an AWS EC2 instance.
I can generate the war file by using maven and following the instructions in this article:

https://www.baeldung.com/spring-boot-war-tomcat-deploy
I copy the war file to the /usr/local/tomcat/webapps folder inside the container and I run the catalina.sh.
I can see the following message:

05-Dec-2022 22:33:32.604 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/SampleRest.war]
05-Dec-2022 22:33:32.756 WARNING [localhost-startStop-1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [5.0]. Default version will be used.
05-Dec-2022 22:33:34.512 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
05-Dec-2022 22:33:34.519 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/SampleRest.war] has finished in [1,915] ms

But when I try to access the rest enpoint or the app url I'm getting a 404.

Can you help in understanding what I'm doing wrong.

Thank you in advance.

I tried different apps with different spring versions but I'm getting the same 404 everytime.
I can see tomcat is running and the example apps already present in there are working fine.


问:
How does firebase auth custom auth domain actually work?
I have a firebase project set up where I am only using the firebase auth features. I have a react app that uses the firebase client-side javascript SDK for authentication and a custom backend + database that does not use any firebase features.

Currently when users are logging in with a popup flow, they see the auth domain "myappname.firebaseapp.com" as per the default firebase config. It all works great.

However, if I now want to set up a custom auth domain, what I've gathered from other answers is that I need to:

Add an authorized redirect URI in firebase console to point to my custom auth domain, say https://auth.myappname.com/__/auth/handler

Change authDomain in my client side code (firebaseConfig object) to my custom auth domain.

Is there anything else I need to do for this to work? How this can work out of the box without me having to write some custom redirect logic? If my react app is being served via static hosting like an S3 bucket, then I won't even have a server running. How is https://auth.myappname.com/__/auth/handler handling anything?

Much of the documentation online is talking about using firebase hosting or other firebase black magic which I do not want to use.

Any explanations appreciated..


问:
Upload file (png, jpeg etc) in Web server with HTTP post request in Swift
I am developing an application in Swift language. I set up a backend service with amazon s3 service and fast api. I want to save an image with .png extension to this backend service. I am getting 422 "422 Unprocessable Entity" error from the server while sending the photo. I know this error occurs because the format is wrong but I couldn't fix the problem. I am sharing the part of the code I wrote in swift and the fast-api screenshot.

format
inputs

```<code>`func uploadImage2(paramName: String, fileName: String, image: UIImage, uid: String) {
        let urlString = ""
        let url = NSURL(string: urlString)!
        let requestURL = NSMutableURLRequest(url: url as URL)
        requestURL.httpMethod = "POST"
        requestURL.addValue("multipart/form-data", forHTTPHeaderField: "Content-Type")

        let body = NSMutableData()
        body.append("file=@\(image)".data(using: String.Encoding.utf8)!)
        body.append("type=image/png".data(using: String.Encoding.utf8)!)
        requestURL.httpBody = body as Data

        let task = URLSession.shared.dataTask(with: requestURL as URLRequest){ data,response,error in
            if let data = data {
                let sendedData = String(data: data, encoding: .utf8)
                print("Succesful + \(String(describing: sendedData))")
            } else {
                print("Error: \(String(describing: error))")
            }
        }
        task.resume()
    }`
</code>```

I'm having trouble uploading photos to the server.

Body:
I am developing an application in Swift language. I set up a backend service with amazon s3 service and fast api. I want to save an image with .png extension to this backend service. I am getting 422 "422 Unprocessable Entity" error from the server while sending the photo. I know this error occurs because the format is wrong but I couldn't fix the problem. I am sharing the part of the code I wrote in swift and the fast-api screenshot.

format
inputs

`func uploadImage2(paramName: String, fileName: String, image: UIImage, uid: String) {
        let urlString = ""
        let url = NSURL(string: urlString)!
        let requestURL = NSMutableURLRequest(url: url as URL)
        requestURL.httpMethod = "POST"
        requestURL.addValue("multipart/form-data", forHTTPHeaderField: "Content-Type")

        let body = NSMutableData()
        body.append("file=@\(image)".data(using: String.Encoding.utf8)!)
        body.append("type=image/png".data(using: String.Encoding.utf8)!)
        requestURL.httpBody = body as Data

        let task = URLSession.shared.dataTask(with: requestURL as URLRequest){ data,response,error in
            if let data = data {
                let sendedData = String(data: data, encoding: .utf8)
                print("Succesful + \(String(describing: sendedData))")
            } else {
                print("Error: \(String(describing: error))")
            }
        }
        task.resume()
    }`

I'm having trouble uploading photos to the server.


问:
Sklearn recall score: what is the average parameter for and how to define it
I was in the middle of evaluating a model using recall score and noticed this one parameter "average" which can take many values.

Interestingly, if I set it to "binary" I get 1.0 score. However, with "micro" and "macro" I get a lesser score.

```<code>print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='binary'))
print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='micro'))
print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='macro'))
print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='weighted'))
</code>```

AdaBoost Classifier Model Recall: 1.0

AdaBoost Classifier Model Recall: 0.9875

AdaBoost Classifier Model Recall: 0.9897959183673469

AdaBoost Classifier Model Recall: 0.9875

So I was wondering how this parameter works exactly. I know I'm in a binary classification problem where my target value takes 0 and 1. So should I be using average="binary" here?

And what insight does each value give exactly?

Sorry I tried reading the documentation but couldn't really get much out of it. I appreciate the help

Body:
I was in the middle of evaluating a model using recall score and noticed this one parameter "average" which can take many values.

Interestingly, if I set it to "binary" I get 1.0 score. However, with "micro" and "macro" I get a lesser score.

print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='binary'))
print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='micro'))
print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='macro'))
print("AdaBoost Classifier Model Recall:", recall_score(y_test, y_pred, average='weighted'))

AdaBoost Classifier Model Recall: 1.0

AdaBoost Classifier Model Recall: 0.9875

AdaBoost Classifier Model Recall: 0.9897959183673469

AdaBoost Classifier Model Recall: 0.9875

So I was wondering how this parameter works exactly. I know I'm in a binary classification problem where my target value takes 0 and 1. So should I be using average="binary" here?

And what insight does each value give exactly?

Sorry I tried reading the documentation but couldn't really get much out of it. I appreciate the help