问:
Search from a list of Firebase Users with TextField and StreamProvider in Flutter
I'm building a chat app with Firebase in flutter and I want to be able to search from a list of users,. I also want that when no text is typed, no user should be shown

I tried a lot of things but I never got it right. This is what I did :

search_page.dart:

```<code>class SearchPage extends StatefulWidget {
  const SearchPage({Key? key}) : super(key: key);

  @override
  State<SearchPage> createState() => _SearchPageState();
}

class _SearchPageState extends State<SearchPage> {
  TextEditingController searchController = TextEditingController();

  @override
  void initState() {
    super.initState();
    searchController.addListener(_onSearchChanged);
  }

  _onSearchChanged() {
    print(searchController.text);
  }

  @override
  void dispose() {
    searchController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return StreamProvider<List<AppUserData>>.value(
      initialData: [],
      value: DatabaseService().users,
      child: Scaffold(
          resizeToAvoidBottomInset: false,
          backgroundColor: dDarkGrey,
          body:
              Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
            const SizedBox(
              height: 3,
            ),
            Stack(
              alignment: Alignment.center,
              children: [
                Container(
                  height: 90,
                  decoration: BoxDecoration(color: dDarkGrey, boxShadow: [
                    BoxShadow(
                        color: dBlack.withOpacity(0.16),
                        spreadRadius: 3,
                        blurRadius: 3,
                        offset: const Offset(0, 4))
                  ]),
                ),
                Column(
                  children: [
                    const SizedBox(
                      height: 20,
                    ),
                    Row(
                      children: [
                        IconButton(
                          onPressed: () {
                            Navigator.of(context).push(MaterialPageRoute(
                                builder: (context) => const HomePage()));
                          },
                          icon: const Icon(SocketIconv2.ic_back),
                          color: dLightGrey,
                        ),
                        SizedBox(
                            width: MediaQuery.of(context).size.width - 60,
                            child: TextField(
                                enabled: true,
                                controller: searchController,
                                style: const TextStyle(color: dLightGrey),
                                decoration: const InputDecoration(
                                  contentPadding:
                                      EdgeInsets.fromLTRB(0, 0, 0, 0),
                                  filled: true,
                                  fillColor: dDarkGrey,
                                  prefixIcon: Icon(
                                    SocketIconv2.ic_search,
                                    color: dLightGrey,
                                  ),
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(15))),
                                  hintStyle: TextStyle(
                                      color: dLightGrey,
                                      fontFamily: 'SegoeUI',
                                      fontSize: 18,
                                      fontWeight: FontWeight.w300),
                                  hintText: 'Search',
                                ))),
                      ],
                    ),
                  ],
                ),
              ],
            ),
            // search bar
            SizedBox(
              height: MediaQuery.of(context).size.height - 95,
              width: MediaQuery.of(context).size.width,
              child: SearchList(
                controller: searchController,
              ),
            )
          ])),
    );
  }
}
</code>```

search_list.dart:

```<code>class SearchList extends StatelessWidget {
  SearchList({Key? key, required this.controller}) : super(key: key);
  final TextEditingController controller;

  @override
  Widget build(BuildContext context) {
    final users = Provider.of<List<AppUserData>>(context);
    return Scaffold(
        backgroundColor: Colors.transparent,
        body: ListView.separated(
          itemBuilder: (context, index) {
            if (controller.text.isEmpty) {
              return Container();
            }
            if (controller.text.isNotEmpty) {
              return searchAccount(context, name, username, users[index]);
            }
            if (users[index].name.startsWith(controller.text.toLowerCase())) {
              return searchAccount(context, name, username, users[index]);
            } else {
              return Container();
            }
          },
          itemCount: users.length,
          separatorBuilder: (context, index) => const SizedBox(height: 20),
        ));
  }
}
</code>```

search_account.dart:

```<code>Widget searchAccount(
    BuildContext context, String name, String username, AppUserData users) {
  return Row(
    children: [
      const SizedBox(
        width: 20,
      ),
      Row(
        children: [
          ClipOval(
            child: Image.asset(
              imagePp,
              scale: 9,
            ),
          ),
          const SizedBox(
            width: 30,
          ),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(users.name,
                  style: SegoeUiPreset(dLightGrey).customTileName()),
              Text(users.username,
                  style: SegoeUiPreset(dLightGrey).customTileSubtitle())
            ],
          )
        ],
      ),
    ],
  );
}
</code>```

user.dart:

```<code>class AppUser {
  final String? uid;
  AppUser({this.uid});
}

class AppUserData {
  final String? uid;
  final String name;
  final String username;

  AppUserData({this.uid, required this.name, required this.username});
}
</code>```

database.dart:

```<code>class DatabaseService {
  final String? uid;

  DatabaseService({this.uid});
  final CollectionReference chatRoomCollection =
      FirebaseFirestore.instance.collection("chatrooms");
  final CollectionReference userCollection =
      FirebaseFirestore.instance.collection("users");

  Future<void> saveUser(String name, String username) async {
    return await userCollection
        .doc(uid)
        .set({'name': name, 'username': username});
  }

  AppUserData _userFromSnapshot(DocumentSnapshot snapshot) {
    return AppUserData(
        name: snapshot['name'],
        uid: snapshot.id,
        username: snapshot['username']);
  }

  Stream<AppUserData> get user {
    return userCollection.doc(uid).snapshots().map(_userFromSnapshot);
  }

  List<AppUserData> _userListFromSnapshot(QuerySnapshot snapshot) {
    return snapshot.docs.map((doc) {
      return _userFromSnapshot(doc);
    }).toList();
  }

  Stream<List<AppUserData>> get users {
    return userCollection.snapshots().map(_userListFromSnapshot);
  }
}
</code>```

Got any hints ? I'm a begginner :/

Thank you in advance :)

Body:
I'm building a chat app with Firebase in flutter and I want to be able to search from a list of users,. I also want that when no text is typed, no user should be shown

I tried a lot of things but I never got it right. This is what I did :

search_page.dart:

class SearchPage extends StatefulWidget {
  const SearchPage({Key? key}) : super(key: key);

  @override
  State<SearchPage> createState() => _SearchPageState();
}

class _SearchPageState extends State<SearchPage> {
  TextEditingController searchController = TextEditingController();

  @override
  void initState() {
    super.initState();
    searchController.addListener(_onSearchChanged);
  }

  _onSearchChanged() {
    print(searchController.text);
  }

  @override
  void dispose() {
    searchController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return StreamProvider<List<AppUserData>>.value(
      initialData: [],
      value: DatabaseService().users,
      child: Scaffold(
          resizeToAvoidBottomInset: false,
          backgroundColor: dDarkGrey,
          body:
              Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
            const SizedBox(
              height: 3,
            ),
            Stack(
              alignment: Alignment.center,
              children: [
                Container(
                  height: 90,
                  decoration: BoxDecoration(color: dDarkGrey, boxShadow: [
                    BoxShadow(
                        color: dBlack.withOpacity(0.16),
                        spreadRadius: 3,
                        blurRadius: 3,
                        offset: const Offset(0, 4))
                  ]),
                ),
                Column(
                  children: [
                    const SizedBox(
                      height: 20,
                    ),
                    Row(
                      children: [
                        IconButton(
                          onPressed: () {
                            Navigator.of(context).push(MaterialPageRoute(
                                builder: (context) => const HomePage()));
                          },
                          icon: const Icon(SocketIconv2.ic_back),
                          color: dLightGrey,
                        ),
                        SizedBox(
                            width: MediaQuery.of(context).size.width - 60,
                            child: TextField(
                                enabled: true,
                                controller: searchController,
                                style: const TextStyle(color: dLightGrey),
                                decoration: const InputDecoration(
                                  contentPadding:
                                      EdgeInsets.fromLTRB(0, 0, 0, 0),
                                  filled: true,
                                  fillColor: dDarkGrey,
                                  prefixIcon: Icon(
                                    SocketIconv2.ic_search,
                                    color: dLightGrey,
                                  ),
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.all(
                                          Radius.circular(15))),
                                  hintStyle: TextStyle(
                                      color: dLightGrey,
                                      fontFamily: 'SegoeUI',
                                      fontSize: 18,
                                      fontWeight: FontWeight.w300),
                                  hintText: 'Search',
                                ))),
                      ],
                    ),
                  ],
                ),
              ],
            ),
            // search bar
            SizedBox(
              height: MediaQuery.of(context).size.height - 95,
              width: MediaQuery.of(context).size.width,
              child: SearchList(
                controller: searchController,
              ),
            )
          ])),
    );
  }
}

search_list.dart:

class SearchList extends StatelessWidget {
  SearchList({Key? key, required this.controller}) : super(key: key);
  final TextEditingController controller;

  @override
  Widget build(BuildContext context) {
    final users = Provider.of<List<AppUserData>>(context);
    return Scaffold(
        backgroundColor: Colors.transparent,
        body: ListView.separated(
          itemBuilder: (context, index) {
            if (controller.text.isEmpty) {
              return Container();
            }
            if (controller.text.isNotEmpty) {
              return searchAccount(context, name, username, users[index]);
            }
            if (users[index].name.startsWith(controller.text.toLowerCase())) {
              return searchAccount(context, name, username, users[index]);
            } else {
              return Container();
            }
          },
          itemCount: users.length,
          separatorBuilder: (context, index) => const SizedBox(height: 20),
        ));
  }
}

search_account.dart:

Widget searchAccount(
    BuildContext context, String name, String username, AppUserData users) {
  return Row(
    children: [
      const SizedBox(
        width: 20,
      ),
      Row(
        children: [
          ClipOval(
            child: Image.asset(
              imagePp,
              scale: 9,
            ),
          ),
          const SizedBox(
            width: 30,
          ),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(users.name,
                  style: SegoeUiPreset(dLightGrey).customTileName()),
              Text(users.username,
                  style: SegoeUiPreset(dLightGrey).customTileSubtitle())
            ],
          )
        ],
      ),
    ],
  );
}

user.dart:

class AppUser {
  final String? uid;
  AppUser({this.uid});
}

class AppUserData {
  final String? uid;
  final String name;
  final String username;

  AppUserData({this.uid, required this.name, required this.username});
}

database.dart:

class DatabaseService {
  final String? uid;

  DatabaseService({this.uid});
  final CollectionReference chatRoomCollection =
      FirebaseFirestore.instance.collection("chatrooms");
  final CollectionReference userCollection =
      FirebaseFirestore.instance.collection("users");

  Future<void> saveUser(String name, String username) async {
    return await userCollection
        .doc(uid)
        .set({'name': name, 'username': username});
  }

  AppUserData _userFromSnapshot(DocumentSnapshot snapshot) {
    return AppUserData(
        name: snapshot['name'],
        uid: snapshot.id,
        username: snapshot['username']);
  }

  Stream<AppUserData> get user {
    return userCollection.doc(uid).snapshots().map(_userFromSnapshot);
  }

  List<AppUserData> _userListFromSnapshot(QuerySnapshot snapshot) {
    return snapshot.docs.map((doc) {
      return _userFromSnapshot(doc);
    }).toList();
  }

  Stream<List<AppUserData>> get users {
    return userCollection.snapshots().map(_userListFromSnapshot);
  }
}

Got any hints ? I'm a begginner :/

Thank you in advance :)


来源: stackexchange

问:
Transferring Pivot Tables & Charts without Source Data

I need to send the excel workbook tabs from "Combined" to "PPA HQ" that contain pivot tables and graphs, without the source data. Is it possible to do that?

I would like to keep the the tabs  "Combined" to "PPA HQ" in the same workbook and same formats, but without the source data.

Any assistance is greatly appreciated!

ContentLicense: CC BY-SA 4.0


问:
Add a circle at the beginning of a UIBezierPath
I'm building an app with some UIBezierPath instances and I want to position a circle at the beginning of two of them. In the image, it's where the arrows are pointing.

How can I achieve that assuming I have the reference to both UIBezierPath instances?


问:
Examples of unsoundness of conditional types
I was reading a paper that, speaking about conditional types, states:

The unsoundness is caused by the incorrect widening of type parameters in contravariant position. [...] The conditional type unification algorithm
wrongly approximates X => string to any => string and unifies the former with latter, which can
lead to a runtime errors.

I have not precisely understood what they meant. When does the unification algorithm unifies X => string with any => string? An example would be really appreciated.

Something like the following seems to behave correctly, even the other way around:

```<code>type Test<X> = ((x:X) => string) extends ((x:number) => string) ? true : false
</code>```

Body:
I was reading a paper that, speaking about conditional types, states:

The unsoundness is caused by the incorrect widening of type parameters in contravariant position. [...] The conditional type unification algorithm
wrongly approximates X => string to any => string and unifies the former with latter, which can
lead to a runtime errors.

I have not precisely understood what they meant. When does the unification algorithm unifies X => string with any => string? An example would be really appreciated.

Something like the following seems to behave correctly, even the other way around:

type Test<X> = ((x:X) => string) extends ((x:number) => string) ? true : false


问:
Is there a way to authorize a script running through launchd to use the camera on MacOs
I wrote a script to take a picture with my webcam. I want it to run everytime I unlock my mac, so I created a com.example.selfie.plist file in ~/Library/LaunchAgents/. The sh script is working well from a terminal, my plist is working well when I just write text in a file, but I cannot make the imagesnap command to work through the plist file.

selfie.sh

```<code>#!/bin/bash
datetime=$(date "+%Y%m%d_%H%M%S")
imagesnap -q -w 2 "/Users/taccle/Documents/Projets/Selfie/Photos/${datetime}.jpg"
</code>```

com.example.selfie.plist

```<code><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.example.selfie</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Users/taccle/Documents/Projets/Selfie/selfie.sh</string>
    </array>
    <key>WatchPaths</key>
    <array>
      <string>/Library/Preferences/com.apple.biometrickitd.plist</string>
    </array>
  </dict>
</plist>
</code>```

I suppose the issue is coming from Security and Privacy which doesn't allow launchd to access the camera (I'm not sure how I can get the logs when launchd scripts are running).

I found a workaround but I don't like it so much, my plist file calls run_in_command_line.sh which will open a terminal and then run selfie.sh.

```<code>#!/bin/bash

osascript -e 'tell application "Terminal"
    do script "/Users/taccle/Documents/Projets/Selfie/selfie.sh; exit"
end tell'
</code>```

It's working well but I would prefer to have only one script and not starting a terminal like this. Do you know if there's any way to give my launchd access to the camera?

Body:
I wrote a script to take a picture with my webcam. I want it to run everytime I unlock my mac, so I created a com.example.selfie.plist file in ~/Library/LaunchAgents/. The sh script is working well from a terminal, my plist is working well when I just write text in a file, but I cannot make the imagesnap command to work through the plist file.

selfie.sh

#!/bin/bash
datetime=$(date "+%Y%m%d_%H%M%S")
imagesnap -q -w 2 "/Users/taccle/Documents/Projets/Selfie/Photos/${datetime}.jpg"

com.example.selfie.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.example.selfie</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Users/taccle/Documents/Projets/Selfie/selfie.sh</string>
    </array>
    <key>WatchPaths</key>
    <array>
      <string>/Library/Preferences/com.apple.biometrickitd.plist</string>
    </array>
  </dict>
</plist>

I suppose the issue is coming from Security and Privacy which doesn't allow launchd to access the camera (I'm not sure how I can get the logs when launchd scripts are running).

I found a workaround but I don't like it so much, my plist file calls run_in_command_line.sh which will open a terminal and then run selfie.sh.

#!/bin/bash

osascript -e 'tell application "Terminal"
    do script "/Users/taccle/Documents/Projets/Selfie/selfie.sh; exit"
end tell'

It's working well but I would prefer to have only one script and not starting a terminal like this. Do you know if there's any way to give my launchd access to the camera?


问:
How do I Push to Array with Mongodb
I'm trying to update a Mongo record by pushing a JSON object to an array with Node. I've gotten other updateOne() operators like $inc to work, but neither $push nor $addToSet are working. I don't get any errors.

id matches an existing document, and payload is valid JSON with all the appropriate fields.

Here's my updater function in Node:

```<code>async function arrayPusher(id, payload) {
    await client.connect()
    const db = client.db('db')
    await db.collection('collection').updateOne(
        { 'id': id },
        { $push: { 'post': payload } }
    )
}
</code>```

Title: How do I Push to Array with Mongodb

Body:
I'm trying to update a Mongo record by pushing a JSON object to an array with Node. I've gotten other updateOne() operators like $inc to work, but neither $push nor $addToSet are working. I don't get any errors.

id matches an existing document, and payload is valid JSON with all the appropriate fields.

Here's my updater function in Node:

async function arrayPusher(id, payload) {
    await client.connect()
    const db = client.db('db')
    await db.collection('collection').updateOne(
        { 'id': id },
        { $push: { 'post': payload } }
    )
}


问:
How does Envoy participate in tracing using the x-request-id header?
Is x-request-id a header that was standardized in OpenTracing? Do tracing libraries such as those of OpenTelemetry or OpenTracing recognize this header and extract any tracing context from it? If not, can Envoy populate alternative headers such as the b3 (x-b3-traceid, etc.) headers automatically on incoming request?

Alternatively, is bypassing Envoy completely and dealing with the tracing context propagation headers directly using OTel libraries a good alternative? In this case, Envoy would be completely agnostic to tracing.


问:
Trouble with text-wrapping in d3.js when appending text to svg
I'm having some issues formatting text in d3 -- I'm appending text to an svg. Ultimately, I want it to look something like this:

I've gotten fairly close with the following:

```<code>var margin = {top: 40, right: 0, bottom: 40, left: 0},
    width = width - margin.left - margin.right,
    height = height - margin.top - margin.bottom;

var svg = div.append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
    .append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var g = svg.append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var data_access_group = "Ashland County"
var numCases = "26"
var firstYr = "2017"
var lastDate = "6/16/2022"

   var text = svg.append("text")
  .attr("dy", 0)
  .attr("x",0)
  .attr("font-weight", 400)
  .text("Overdose Fatalities Among Residents of ")
  .attr("class", "overview-text")
  .attr("id", "overview-text-1")
  .append("tspan")
  .attr("font-weight", 900)
  .text(data_access_group)
  .attr("class", "overview-text")

  svg.append("text")
    .attr("class", "overview-text")
    .attr("id", "overview-text-2")
    .attr("dy", "3.8em")
    .attr("x",0)
    .attr("font-weight", 900)
    .text(numCases)
    .append("tspan")
    .attr("font-weight", 400)
    .text(" overdose fatalities since ")
    .append("tspan")
    .attr("font-weight", 900)
    .text(firstYr)

      svg.append("text")
    .attr("class", "overview-text")
    .attr("id", "overview-text-3")
    .attr("dy", "8.8em")
    .attr("x",0)
    .attr("font-weight", 400)
    .text("Includes only resident fatalities. Most recent overdose fatality: "+ lastDate)
</code>```

CSS

```<code>#overview-text-1 {
  font-size:30px !important;

}
</code>```

But this produces something like this:

You can see that the text is not wrapping; i.e. the text is getting cut off.  I've tried this:

```<code>function wrap(text, width) {
  text.each(function() {
    var text = d3.select(this),
        words = text.text().split(/\s+/).reverse(),
        word,
        line = [],
        lineNumber = 0,
        lineHeight = 1.1, // ems
        y = text.attr("y"),
        dy = parseFloat(text.attr("dy")),
        tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
    while (word = words.pop()) {
      line.push(word);
      tspan.text(line.join(" "));
      if (tspan.node().getComputedTextLength() > width) {
        line.pop();
        tspan.text(line.join(" "));
        line = [word];
        tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word);
      }
    }
  });
}

setTimeout(()=>{
  d3.selectAll(".overview-text")
    .call(wrap,500);
  }, 0);

</code>```

But it's still not working as it should.  Basically, I just want this text to wrap so that it's not cut off when I resize.  I am open to a better approach in general to producing the desired text.

Body:
I'm having some issues formatting text in d3 -- I'm appending text to an svg. Ultimately, I want it to look something like this:

I've gotten fairly close with the following:

var margin = {top: 40, right: 0, bottom: 40, left: 0},
    width = width - margin.left - margin.right,
    height = height - margin.top - margin.bottom;

var svg = div.append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
    .append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var g = svg.append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var data_access_group = "Ashland County"
var numCases = "26"
var firstYr = "2017"
var lastDate = "6/16/2022"

   var text = svg.append("text")
  .attr("dy", 0)
  .attr("x",0)
  .attr("font-weight", 400)
  .text("Overdose Fatalities Among Residents of ")
  .attr("class", "overview-text")
  .attr("id", "overview-text-1")
  .append("tspan")
  .attr("font-weight", 900)
  .text(data_access_group)
  .attr("class", "overview-text")

  svg.append("text")
    .attr("class", "overview-text")
    .attr("id", "overview-text-2")
    .attr("dy", "3.8em")
    .attr("x",0)
    .attr("font-weight", 900)
    .text(numCases)
    .append("tspan")
    .attr("font-weight", 400)
    .text(" overdose fatalities since ")
    .append("tspan")
    .attr("font-weight", 900)
    .text(firstYr)

      svg.append("text")
    .attr("class", "overview-text")
    .attr("id", "overview-text-3")
    .attr("dy", "8.8em")
    .attr("x",0)
    .attr("font-weight", 400)
    .text("Includes only resident fatalities. Most recent overdose fatality: "+ lastDate)

CSS

#overview-text-1 {
  font-size:30px !important;

}

But this produces something like this:

You can see that the text is not wrapping; i.e. the text is getting cut off.  I've tried this:

function wrap(text, width) {
  text.each(function() {
    var text = d3.select(this),
        words = text.text().split(/\s+/).reverse(),
        word,
        line = [],
        lineNumber = 0,
        lineHeight = 1.1, // ems
        y = text.attr("y"),
        dy = parseFloat(text.attr("dy")),
        tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
    while (word = words.pop()) {
      line.push(word);
      tspan.text(line.join(" "));
      if (tspan.node().getComputedTextLength() > width) {
        line.pop();
        tspan.text(line.join(" "));
        line = [word];
        tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word);
      }
    }
  });
}

setTimeout(()=>{
  d3.selectAll(".overview-text")
    .call(wrap,500);
  }, 0);

But it's still not working as it should.  Basically, I just want this text to wrap so that it's not cut off when I resize.  I am open to a better approach in general to producing the desired text.


问:
In Django website even if I add an item by pressing add to cart button the status of True for the product added is not shown and still false is visibl
I have made a django e-comm website , when I press the add to cart button on my home page I have written a function which should change the status of a product from false to true once it is added in the cart but it does not work
I have given my cart.py and index.html code
Thank you

cart.py

```<code>from django import template

register = template.Library()

@register.filter(name='is_in_cart')

def is_in_cart(product,cart):
    keys = cart.keys()
    for id in keys:
        print(id , product.id)
        if int(id) == product.id:
            return True
    return False

</code>```

index.html

```<code>{% extends 'main/base.html'%}
{% block title %}
index
{% endblock %}

{% block content %}
{% load cart %}
<div class="container-fluid">
 <div class="row">
  <div class="col-lg-3">
    <div class="list-group mt-3">
      {% for items in category %}
      <a href="/?category={{items.id}}" class="list-group-item list-group-item-action mb-1">{{items.Category_name}}</a> <!--i first used a small c for category but it did not pick the words from my category.py fle-->
      {% endfor %}

    </div>
  </div>
  <div class="col-lg-9">
    <div class="row">
      {% for items in product %}
      <div class="card mx-auto mb-3 mt-3" style="width: 18rem;">
        <img class="card-img-top" src="{{items.product_image.url}}" alt="Card image cap">
        <div class="card-body">
          <h5 class="card-title">{{items.product_name}}</h5>
          <p class="card-text"><b>{{items.product_price}}</b></p>
          <p class="card-text"><b>{{items.product_detail}}</b></p>
          {{product | is_in_cart:request.session.cart }}
         <form action="/" mthod="POST">
            {% csrf_token %}
          <input hidden type="text" name='product' value='{{items.id}}'>
          <input href="#" type="submit" class="float-right btn btn-light border btn-sm" value="Add to Cart">

         </form>
        </div>
      </div>
      {% endfor %}
    </div>
  </div>

 </div>
</div>
{% endblock %}

</code>```

Body:
I have made a django e-comm website , when I press the add to cart button on my home page I have written a function which should change the status of a product from false to true once it is added in the cart but it does not work
I have given my cart.py and index.html code
Thank you

cart.py

from django import template

register = template.Library()

@register.filter(name='is_in_cart')

def is_in_cart(product,cart):
    keys = cart.keys()
    for id in keys:
        print(id , product.id)
        if int(id) == product.id:
            return True
    return False

index.html

{% extends 'main/base.html'%}
{% block title %}
index
{% endblock %}

{% block content %}
{% load cart %}

      {% for items in category %}
      {{items.Category_name}}
      {% endfor %}

      {% for items in product %}

{{items.product_name}}

{{items.product_price}}

{{items.product_detail}}

          {{product | is_in_cart:request.session.cart }}
         <form action="/" mthod="POST">
            {% csrf_token %}
          <input hidden type="text" name='product' value='{{items.id}}'>
          <input href="#" type="submit" class="float-right btn btn-light border btn-sm" value="Add to Cart">

         </form>

      {% endfor %}

{% endblock %}


问:
Sub folder not found with Borales
I have a monorepo and I'm trying to run 'borales' to use yarn in a specific subfolder which in this case is the "backend" and soon there will be another one for "frontend".

However, it cannot find the folder and returns the following:

```<code>Error: The cwd: /home/runner/work/TEST/TEST/backend does not exist!
</code>```

This is my folder hierarchy:

MY YML:

```<code>name: BACKEND TEST
on: [workflow_dispatch]

jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x]
        architecture: [x64]
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v3

      - name: Yarn [INSTALL]
        uses: borales/actions-yarn@v4
        with:
          cmd: install
          dir: 'backend' # will run in sub folder

      - name: RUN PRETTIER [TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: prettier:check
          dir: 'backend' # will run in sub folder

      - name: RUN LINT CONTRACTS [TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: lint-contracts:check
          dir: 'backend' # will run in sub folder

      - name: RUN LINT ALL FILES [TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: lint:check
          dir: 'backend' # will run in sub folder

      - name: RUN MOCHA AND CHAI [UNIT TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: test
          dir: 'backend' # will run in sub folder
</code>```

Title: Sub folder not found with Borales

Body:
I have a monorepo and I'm trying to run 'borales' to use yarn in a specific subfolder which in this case is the "backend" and soon there will be another one for "frontend".

However, it cannot find the folder and returns the following:

Error: The cwd: /home/runner/work/TEST/TEST/backend does not exist!

This is my folder hierarchy:

MY YML:

name: BACKEND TEST
on: [workflow_dispatch]

jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x]
        architecture: [x64]
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v3

      - name: Yarn [INSTALL]
        uses: borales/actions-yarn@v4
        with:
          cmd: install
          dir: 'backend' # will run in sub folder

      - name: RUN PRETTIER [TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: prettier:check
          dir: 'backend' # will run in sub folder

      - name: RUN LINT CONTRACTS [TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: lint-contracts:check
          dir: 'backend' # will run in sub folder

      - name: RUN LINT ALL FILES [TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: lint:check
          dir: 'backend' # will run in sub folder

      - name: RUN MOCHA AND CHAI [UNIT TEST]
        uses: borales/actions-yarn@v4
        with:
          cmd: test
          dir: 'backend' # will run in sub folder


问:
Esp32 not connecting to WebSocket Server deployed in glitch.com
I am trying to connect my esp32 with my WebSocket server deployed in glitch.com. My web socket server has been perfectly deployed in glitch.com. I can connect my frontend (React.js app) hosted in firebase to my WebSocket server. When the esp32, frontend and WebSocket Server is in localhost or in the same network everything connects perfectly and data is transferred without any problem. But, when I deployed my WebSocket server in glitch and frontend in firebase hosting both of these connect to each other, but the esp32 cannot connect to the WebSocket server.

Esp32 code

```<code>#include <ArduinoWebsockets.h>
#include <ArduinoJson.h>
#include <WiFi.h>

const char* ssid = "TP-Link_7EEF"; //Enter SSID
const char* password = "__________"; //Enter Password

const char* websockets_connection_string = "wss://sugar-fabulous-coat.glitch.me/"; //Enter server adress

const char echo_org_ssl_ca_cert[] PROGMEM = \
"-----BEGIN CERTIFICATE-----\n" \
"MIIDhTCCAm0CFA+uuIM2KjxS8GAsr6QZaqHv1BYWMA0GCSqGSIb3DQEBCwUAMH8x\n" \
"CzAJBgNVBAYTAkJEMRMwEQYDVQQIDApTb21lLVN0YXRlMSIwIAYDVQQKDBlFeGNl\n" \
"bGxlbnQgVGVjaG5vbG9naWVzIEJEMTcwNQYJKoZIhvcNAQkBFihleGNlbGxlbnQu\n" \
"dGVjaG5vbG9naWVzLmxpbWl0ZWRAZ21haWwuY29tMB4XDTIyMTIwMzEwMjQ1NFoX\n" \
"DTIzMTIwMzEwMjQ1NFowfzELMAkGA1UEBhMCQkQxEzARBgNVBAgMClNvbWUtU3Rh\n" \
"dGUxIjAgBgNVBAoMGUV4Y2VsbGVudCBUZWNobm9sb2dpZXMgQkQxNzA1BgkqhkiG\n" \
"9w0BCQEWKGV4Y2VsbGVudC50ZWNobm9sb2dpZXMubGltaXRlZEBnbWFpbC5jb20w\n" \
"ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTt943oNt1+++837JO621n\n" \
"SiMaRzrMt6SKjZNNLJKurdlsPkcibMoLoE7A3VfmYh/1dM9kWS2ANYxXMP8QBsD8\n" \
"I8m3i6pFFZVORX14iPNvpxkgzGoZkXsD0CYRC8pErv5O3GSgXfHjunvaqxrtCGsQ\n" \
"x/x/tqErp9Hn9cnWV0XiIZhkl2qI6O7f84tyYVc7rK3BII6AVLwp0KXjGk3SxE0+\n" \
"P37UPSfy4kgY2JJBJmdz+AJ79AgGpuSW3nQPjzG0ULjWCCAwwPVbeagilqqrsBhk\n" \
"fI+TVb6wN8qXnuHSdKHjpgFbpM0VrvtLcZXNW0HgTqqVQnM0ZlRWA6qH8bp3IxRx\n" \
"AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKJEQhswcQBE5zqavvcaEuUd3x6NeO75\n" \
"5xR5PplJm0IB7FC2S8LPEZQuM22qTdvrO6sp1Hl9ddGCPhdBJjRVRZxUz9mVbpZH\n" \
"hO0C26nfxwhSMP4XoJvVP0yBMRpulBC3YpOC6IDRjxlj3+dCHS42EJpeyVLChZA/\n" \
"URiwwAcS1myS3dR7Gnj/6hKRu654qS3UI9cFayxbaF2IBi7xk3qXhkvsJ/Z2TJ9i\n" \
"SxMrgEzrUVbTVt11bS7MvrOhwCFQBH97+0JrON3csRf4ZEGBSH3jSLVTCFGTi/wQ\n" \
"oMBYySQqFSrTd5zvxyklqHjAjlq815kYSXMAEmhL8T/7IVFAj/lUW2Q=\n" \
"-----END CERTIFICATE-----\n";

int value1=0;
int value2=0;
StaticJsonDocument<100> doc;

using namespace websockets;

void onMessageCallback(WebsocketsMessage message) {
    Serial.print("Got Message: ");
    Serial.println(message.data());
}

void onEventsCallback(WebsocketsEvent event, String data) {
    if(event == WebsocketsEvent::ConnectionOpened) {
        Serial.println("Connnection Opened");
    } else if(event == WebsocketsEvent::ConnectionClosed) {
        Serial.println("Connnection Closed");
    } else if(event == WebsocketsEvent::GotPing) {
        Serial.println("Got a Ping!");
    } else if(event == WebsocketsEvent::GotPong) {
        Serial.println("Got a Pong!");
    }
}

WebsocketsClient client;
void setup() {
    Serial.begin(115200);
    // Connect to wifi
    WiFi.begin(ssid, password);

    // Wait some time to connect to wifi
    for(int i = 0; i < 10 && WiFi.status() != WL_CONNECTED; i++) {
        Serial.print("wifi connecting....");
        delay(1000);
    }
    Serial.print("");
    Serial.print("wifi connected.");

  // Before connecting, set the ssl fingerprint of the server
    client.setCACert(echo_org_ssl_ca_cert);

    // Connect to server
    client.connect(websockets_connection_string);

    // run callback when messages are received
    client.onMessage(onMessageCallback);

    // run callback when events are occuring
    client.onEvent(onEventsCallback);

    // Send a message
    serializeJson(doc,Serial);
    // Send a message
//    client.send("Hello Server");

    // Send a ping
    client.ping();
}

void loop() {
  //    generate random number 1
    value1=random(86, 100);
//    generate random number 2
    value2=random(50, 160);

    doc["deviceID"] = "D_0001";
    doc["BPM"] = value2;
    doc["SPo2"] = value1;

    Serial.println();
    Serial.println();
    Serial.println("Shundor JSON Doc: ");
    serializeJsonPretty(doc, Serial);

    char output[50];
    serializeJson(doc, output);
    Serial.println("output: ");
    Serial.print(output);
    client.send(output);

    client.poll();
    delay(1000);
}
</code>```

Server code:

```<code>
var bodyParser = require("body-parser");
const express = require("express"); //express framework to have a higher level of methods
const app = express(); //assign app variable the express class/method
var http = require("http");
var path = require("path");
const port = process.env.PORT || 5000;
const fs = require("fs");

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const server = http.createServer({
        ssl: true,
        port: 3000,
        ssl_key: fs.readFileSync(path.join(__dirname, "cert", "key.pem")),
        ssl_cert: fs.readFileSync(path.join(__dirname, "cert", "cert.pem")),
    },app); //create a server
//******this snippet gets the local ip of the node.js server. copy this ip to the client side code and add ':3000' **
//*****exmpl. 192.168.56.1---> var sock =new WebSocket("ws://192.168.56.1:3000");************
// require("dns").lookup(require("os").hostname(), function(err, add, fam) {
//     console.log("addr: " + add);
// });
/*******websocket setup*****************************/
//var expressWs = require('express-ws')(app,server);
const WebSocket = require("ws");
const s = new WebSocket.Server({ server });
//when browser sends get request, send html file to browser
// viewed at http://localhost:30000

// app.get("/", function(req, res) {
//     res.sendFile(path.join(__dirname + "/index.html"));
// });

app.get("/", (req, res) => {
    // res.send("Websocket is online. on ");
    res.send({ response: `Server is up and running. PORT: ${port} ` });
});

//*****************************************
//**********ws chat server***************************
//app.ws('/echo', function(ws, req) {
s.on("connection", function(ws, req) {
    // console.log("clients: ", s.clients);
    /*** when server receives messsage from client trigger function with argument message ***/
    ws.on("message", function(message) {
        console.log("Receivedd: ", message.toString(), " Port: ", port);
        s.clients.forEach(function(client) {
            //broadcast incoming message to all clients (s.clients)
            if (client != ws && client.readyState) {
                //except to the same client (ws) that sent this message
                // console.log("message: ", message.toString());
                let xx = message.toString();
                client.send(xx);
            }
        });
        // ws.send("From Server only to sender: "+ message); //send to client where message is from
    });
    ws.on("close", function() {
        console.log("lost one client");
    });
    //ws.send("new client connected");
    console.log("new client connected. Total Clients: >> ", s.clients.size);
});
server.listen(port, () => {
    console.log("Web socket server is running on port: ", port);
});
</code>```

Body:
I am trying to connect my esp32 with my WebSocket server deployed in glitch.com. My web socket server has been perfectly deployed in glitch.com. I can connect my frontend (React.js app) hosted in firebase to my WebSocket server. When the esp32, frontend and WebSocket Server is in localhost or in the same network everything connects perfectly and data is transferred without any problem. But, when I deployed my WebSocket server in glitch and frontend in firebase hosting both of these connect to each other, but the esp32 cannot connect to the WebSocket server.

Esp32 code

#include <ArduinoWebsockets.h>
#include <ArduinoJson.h>
#include <WiFi.h>

const char* ssid = "TP-Link_7EEF"; //Enter SSID
const char* password = "__________"; //Enter Password

const char* websockets_connection_string = "wss://sugar-fabulous-coat.glitch.me/"; //Enter server adress

const char echo_org_ssl_ca_cert[] PROGMEM = \
"-----BEGIN CERTIFICATE-----\n" \
"MIIDhTCCAm0CFA+uuIM2KjxS8GAsr6QZaqHv1BYWMA0GCSqGSIb3DQEBCwUAMH8x\n" \
"CzAJBgNVBAYTAkJEMRMwEQYDVQQIDApTb21lLVN0YXRlMSIwIAYDVQQKDBlFeGNl\n" \
"bGxlbnQgVGVjaG5vbG9naWVzIEJEMTcwNQYJKoZIhvcNAQkBFihleGNlbGxlbnQu\n" \
"dGVjaG5vbG9naWVzLmxpbWl0ZWRAZ21haWwuY29tMB4XDTIyMTIwMzEwMjQ1NFoX\n" \
"DTIzMTIwMzEwMjQ1NFowfzELMAkGA1UEBhMCQkQxEzARBgNVBAgMClNvbWUtU3Rh\n" \
"dGUxIjAgBgNVBAoMGUV4Y2VsbGVudCBUZWNobm9sb2dpZXMgQkQxNzA1BgkqhkiG\n" \
"9w0BCQEWKGV4Y2VsbGVudC50ZWNobm9sb2dpZXMubGltaXRlZEBnbWFpbC5jb20w\n" \
"ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTt943oNt1+++837JO621n\n" \
"SiMaRzrMt6SKjZNNLJKurdlsPkcibMoLoE7A3VfmYh/1dM9kWS2ANYxXMP8QBsD8\n" \
"I8m3i6pFFZVORX14iPNvpxkgzGoZkXsD0CYRC8pErv5O3GSgXfHjunvaqxrtCGsQ\n" \
"x/x/tqErp9Hn9cnWV0XiIZhkl2qI6O7f84tyYVc7rK3BII6AVLwp0KXjGk3SxE0+\n" \
"P37UPSfy4kgY2JJBJmdz+AJ79AgGpuSW3nQPjzG0ULjWCCAwwPVbeagilqqrsBhk\n" \
"fI+TVb6wN8qXnuHSdKHjpgFbpM0VrvtLcZXNW0HgTqqVQnM0ZlRWA6qH8bp3IxRx\n" \
"AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKJEQhswcQBE5zqavvcaEuUd3x6NeO75\n" \
"5xR5PplJm0IB7FC2S8LPEZQuM22qTdvrO6sp1Hl9ddGCPhdBJjRVRZxUz9mVbpZH\n" \
"hO0C26nfxwhSMP4XoJvVP0yBMRpulBC3YpOC6IDRjxlj3+dCHS42EJpeyVLChZA/\n" \
"URiwwAcS1myS3dR7Gnj/6hKRu654qS3UI9cFayxbaF2IBi7xk3qXhkvsJ/Z2TJ9i\n" \
"SxMrgEzrUVbTVt11bS7MvrOhwCFQBH97+0JrON3csRf4ZEGBSH3jSLVTCFGTi/wQ\n" \
"oMBYySQqFSrTd5zvxyklqHjAjlq815kYSXMAEmhL8T/7IVFAj/lUW2Q=\n" \
"-----END CERTIFICATE-----\n";

int value1=0;
int value2=0;
StaticJsonDocument<100> doc;

using namespace websockets;

void onMessageCallback(WebsocketsMessage message) {
    Serial.print("Got Message: ");
    Serial.println(message.data());
}

void onEventsCallback(WebsocketsEvent event, String data) {
    if(event == WebsocketsEvent::ConnectionOpened) {
        Serial.println("Connnection Opened");
    } else if(event == WebsocketsEvent::ConnectionClosed) {
        Serial.println("Connnection Closed");
    } else if(event == WebsocketsEvent::GotPing) {
        Serial.println("Got a Ping!");
    } else if(event == WebsocketsEvent::GotPong) {
        Serial.println("Got a Pong!");
    }
}

WebsocketsClient client;
void setup() {
    Serial.begin(115200);
    // Connect to wifi
    WiFi.begin(ssid, password);

    // Wait some time to connect to wifi
    for(int i = 0; i < 10 && WiFi.status() != WL_CONNECTED; i++) {
        Serial.print("wifi connecting....");
        delay(1000);
    }
    Serial.print("");
    Serial.print("wifi connected.");

  // Before connecting, set the ssl fingerprint of the server
    client.setCACert(echo_org_ssl_ca_cert);

    // Connect to server
    client.connect(websockets_connection_string);

    // run callback when messages are received
    client.onMessage(onMessageCallback);

    // run callback when events are occuring
    client.onEvent(onEventsCallback);

    // Send a message
    serializeJson(doc,Serial);
    // Send a message
//    client.send("Hello Server");

    // Send a ping
    client.ping();
}

void loop() {
  //    generate random number 1
    value1=random(86, 100);
//    generate random number 2
    value2=random(50, 160);

    doc["deviceID"] = "D_0001";
    doc["BPM"] = value2;
    doc["SPo2"] = value1;

    Serial.println();
    Serial.println();
    Serial.println("Shundor JSON Doc: ");
    serializeJsonPretty(doc, Serial);

    char output[50];
    serializeJson(doc, output);
    Serial.println("output: ");
    Serial.print(output);
    client.send(output);

    client.poll();
    delay(1000);
}

Server code:

var bodyParser = require("body-parser");
const express = require("express"); //express framework to have a higher level of methods
const app = express(); //assign app variable the express class/method
var http = require("http");
var path = require("path");
const port = process.env.PORT || 5000;
const fs = require("fs");

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const server = http.createServer({
        ssl: true,
        port: 3000,
        ssl_key: fs.readFileSync(path.join(__dirname, "cert", "key.pem")),
        ssl_cert: fs.readFileSync(path.join(__dirname, "cert", "cert.pem")),
    },app); //create a server
//******this snippet gets the local ip of the node.js server. copy this ip to the client side code and add ':3000' **
//*****exmpl. 192.168.56.1---> var sock =new WebSocket("ws://192.168.56.1:3000");************
// require("dns").lookup(require("os").hostname(), function(err, add, fam) {
//     console.log("addr: " + add);
// });
/*******websocket setup*****************************/
//var expressWs = require('express-ws')(app,server);
const WebSocket = require("ws");
const s = new WebSocket.Server({ server });
//when browser sends get request, send html file to browser
// viewed at http://localhost:30000

// app.get("/", function(req, res) {
//     res.sendFile(path.join(__dirname + "/index.html"));
// });

app.get("/", (req, res) => {
    // res.send("Websocket is online. on ");
    res.send({ response: `Server is up and running. PORT: ${port} ` });
});

//*****************************************
//**********ws chat server***************************
//app.ws('/echo', function(ws, req) {
s.on("connection", function(ws, req) {
    // console.log("clients: ", s.clients);
    /*** when server receives messsage from client trigger function with argument message ***/
    ws.on("message", function(message) {
        console.log("Receivedd: ", message.toString(), " Port: ", port);
        s.clients.forEach(function(client) {
            //broadcast incoming message to all clients (s.clients)
            if (client != ws && client.readyState) {
                //except to the same client (ws) that sent this message
                // console.log("message: ", message.toString());
                let xx = message.toString();
                client.send(xx);
            }
        });
        // ws.send("From Server only to sender: "+ message); //send to client where message is from
    });
    ws.on("close", function() {
        console.log("lost one client");
    });
    //ws.send("new client connected");
    console.log("new client connected. Total Clients: >> ", s.clients.size);
});
server.listen(port, () => {
    console.log("Web socket server is running on port: ", port);
});


问:
Execution failed for task ':advertising_id:compileDebugKotlin' #Flutter #VS Code
I ran a code one of my client gave me, but this error is comming when i debug or do flutter.
I did flutter clean , flutter pub get but still the same. Help Plz

My flutter version
Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 135454af32 (12 days ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

```<code>Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\advertising_id-2.2.0\android\src\main\kotlin\com\os\operando\advertisingid\AdvertisingIdPlugin.kt: (24, 31): Type mismatch: inferred type is Activity? but Activity was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':advertising_id:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7m 22s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
</code>```

I ran the code with --stacktrace

```<code>    [   +1 ms]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
[   +1 ms]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
[        ]      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[        ]      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[        ]      at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
[   +1 ms]      at java.base/java.lang.Thread.run(Thread.java:829)
[   +1 ms] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 19s
[   +1 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[        ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own
scripts or plugins.
[   +1 ms] See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 9 actionable tasks: 1 executed, 8 up-to-date
[        ] Watched directory hierarchies: []
[ +574 ms] Running Gradle task 'assembleDebug'... (completed in 23.1s)
[   +8 ms] "flutter apk" took 27,388ms.
[  +14 ms] Gradle task assembleDebug failed with exit code 1
[  +11 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:408:9)
           <asynchronous suspension>
           #2      AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:184:5)
           <asynchronous suspension>
           #3      BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:109:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
d_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>

[ +263 ms] ensureAnalyticsSent: 254ms
[  +44 ms] Running shutdown hooks
[ +142 ms] Shutdown hooks complete
[   +4 ms] exiting with code 1
</code>```

Body:
I ran a code one of my client gave me, but this error is comming when i debug or do flutter.
I did flutter clean , flutter pub get but still the same. Help Plz

My flutter version
Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 135454af32 (12 days ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\advertising_id-2.2.0\android\src\main\kotlin\com\os\operando\advertisingid\AdvertisingIdPlugin.kt: (24, 31): Type mismatch: inferred type is Activity? but Activity was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':advertising_id:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7m 22s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

I ran the code with --stacktrace

    [   +1 ms]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
[   +1 ms]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
[        ]      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[        ]      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[        ]      at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
[   +1 ms]      at java.base/java.lang.Thread.run(Thread.java:829)
[   +1 ms] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 19s
[   +1 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[        ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own
scripts or plugins.
[   +1 ms] See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 9 actionable tasks: 1 executed, 8 up-to-date
[        ] Watched directory hierarchies: []
[ +574 ms] Running Gradle task 'assembleDebug'... (completed in 23.1s)
[   +8 ms] "flutter apk" took 27,388ms.
[  +14 ms] Gradle task assembleDebug failed with exit code 1
[  +11 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:408:9)
           <asynchronous suspension>
           #2      AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:184:5)
           <asynchronous suspension>
           #3      BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:109:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
d_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>

[ +263 ms] ensureAnalyticsSent: 254ms
[  +44 ms] Running shutdown hooks
[ +142 ms] Shutdown hooks complete
[   +4 ms] exiting with code 1


问:
how to get data in controller on ci3
how to get data in controller using codeigniter 3 framework

i have code in ci3 controller like this:

```<code>public function ajax_list()
{
$list = $this->thesis_title->get_datatables();
$data = array();
$no = $_POST['start'];
$text1 = "Detection of student assignments based on document.";
$text2 ="test program simple levenshtein distance";
$distance=levenshtein($text1, $text2);

foreach ($list as $text_title) {
$no++;
$row = array();
$row[] = $no;
$row[] = $title_text->id_title;
$row[] = $title_text->title;
$row[] = $distance;

$data[] = $row;
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->title_thesis->count_all(),
"recordsFiltered" => $this->title_thesis->count_filtered(),
"data" => $data,
);
//output to json format
echo json_encode($output);
}
</code>```

what I want to do is retrieve the title data from the database and assign the value to the $text1 variable

Title: how to get data in controller on ci3

Body:
how to get data in controller using codeigniter 3 framework

i have code in ci3 controller like this:

public function ajax_list()
{
$list = $this->thesis_title->get_datatables();
$data = array();
$no = $_POST['start'];
$text1 = "Detection of student assignments based on document.";
$text2 ="test program simple levenshtein distance";
$distance=levenshtein($text1, $text2);

foreach ($list as $text_title) {
$no++;
$row = array();
$row[] = $no;
$row[] = $title_text->id_title;
$row[] = $title_text->title;
$row[] = $distance;

$data[] = $row;
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->title_thesis->count_all(),
"recordsFiltered" => $this->title_thesis->count_filtered(),
"data" => $data,
);
//output to json format
echo json_encode($output);
}

what I want to do is retrieve the title data from the database and assign the value to the $text1 variable


问:
HMAC256 with OpenSSL 3
I am new to C++ so go easy :)

I have the following code snippet, however I am using OpenSSL 3, and the compiler is giving various errors: 'HMAC_CTX_new': Since OpenSSL 3.0. I understand that some of the APIs used below are now deprecated and need updating.

Can someone show me to update the below snippet to work with the updated APIs for OpenSSL 3?

```<code>const std::string secretKey = "secret";
std::vector<unsigned char> secretKeyByteArray(secretKey.begin(), secretKey.end());
std::vector<unsigned char> signature(signatureRawData.begin(), signatureRawData.end());
std::vector<unsigned char> signatureBytes(HMAC_MAX_MD_CBLOCK);
unsigned int signatureLength = 0;

HMAC_CTX* hmacCtx = HMAC_CTX_new();
HMAC_Init_ex(hmacCtx, secretKeyByteArray.data(), secretKeyByteArray.size(), EVP_sha256(), nullptr);
HMAC_Update(hmacCtx, signature.data(), signature.size());
HMAC_Final(hmacCtx, signatureBytes.data(), &signatureLength);
HMAC_CTX_free(hmacCtx);

std::ostringstream signatureHex;
for (const auto& c : signatureBytes)
    signatureHex << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(c);

std::string requestSignatureHexString = signatureHex.str();
</code>```

Title: HMAC256 with OpenSSL 3

Body:
I am new to C++ so go easy :)

I have the following code snippet, however I am using OpenSSL 3, and the compiler is giving various errors: 'HMAC_CTX_new': Since OpenSSL 3.0. I understand that some of the APIs used below are now deprecated and need updating.

Can someone show me to update the below snippet to work with the updated APIs for OpenSSL 3?

const std::string secretKey = "secret";
std::vector<unsigned char> secretKeyByteArray(secretKey.begin(), secretKey.end());
std::vector<unsigned char> signature(signatureRawData.begin(), signatureRawData.end());
std::vector<unsigned char> signatureBytes(HMAC_MAX_MD_CBLOCK);
unsigned int signatureLength = 0;

HMAC_CTX* hmacCtx = HMAC_CTX_new();
HMAC_Init_ex(hmacCtx, secretKeyByteArray.data(), secretKeyByteArray.size(), EVP_sha256(), nullptr);
HMAC_Update(hmacCtx, signature.data(), signature.size());
HMAC_Final(hmacCtx, signatureBytes.data(), &signatureLength);
HMAC_CTX_free(hmacCtx);

std::ostringstream signatureHex;
for (const auto& c : signatureBytes)
    signatureHex << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(c);

std::string requestSignatureHexString = signatureHex.str();


问:
PHP How to upload multiple videos in one form to vimeo
I am struggling with the following:

I want to upload 3 videos in one form to Vimeo. I use a template where with some javascript, some magic happens. I am able to get the template working for one file, but when adjusting the javascript and html/php code, I get the following message: Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.

So what am I trying to do:

Part of the html code:

```<code><div class="col-12 col-md-4"><font color="#FFFFFF">Upload trailer video file:</font>
    <div class="form__video">
        <label id="trailer"  for="form__video-upload">Upload trailer video</label>
        <input data-name="#trailer" id="form__trailer" name="trailer" class="form__video-upload" type="file" accept="video/mp4,video/x-m4v,video/*">
    </div>
</div>
<div class="col-12 col-md-4"><font color="#FFFFFF">Upload full/mixed video file:</font>
    <div class="form__video">
        <label id="fullvideo" for="form__fullvideo">Upload full/mixed video</label>
        <input data-name="#fullvideo" id="form__fullvideo" name="fullvideo" class="form__video-upload" type="file" accept="video/*">
    </div>
</div>

<div class="col-12 col-md-4"><font color="#FFFFFF">Upload high cam video file:</font>
    <div class="form__video">
        <label id="higcam" for="form__highcam">Upload high cam</label>
        <input data-name="#higcam" id="form__highcam" name="higcam" class="form__video-upload" type="file" accept="video/*">
    </div>
</div>
</code>```

part of the Javascript for the inputs:

```<code>      $('.form__video-upload').on('change', function() {
        var videoLabel  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel).text($(this)[0].files[0].name);
        } else {
            $(videoLabel).text('Upload video');
        }
    });

    $('.form__trailer').on('change', function() {
        var videoLabel1  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel1).text($(this)[0].files[0].name);
        } else {
            $(videoLabel1).text('Upload trailer video');
        }
    });

    $('.form__fullvideo').on('change', function() {
        var videoLabel2  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel2).text($(this)[0].files[0].name);
        } else {
            $(videoLabel2).text('Upload full video');
        }
    });

    $('.form__highcam').on('change', function() {
        var videoLabel3  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel3).text($(this)[0].files[0].name);
        } else {
            $(videoLabel3).text('Upload high cam video');
        }
    });
</code>```

And then finally some code when submitting (I don't think the error is in this, because when I comment it, the error remains:

```<code>//if trailer file is filled/selected
if (!empty($_FILES['trailer']['name'])) {
    //adjust name to trailer
    $trailername = $basename." - Trailer";
    $filetrailer = $_FILES['trailer']['name'];
    $filetrailertmp = $_FILES['trailer']['tmp_name'];

    // vimeo upload code
    $uri = $client->upload($filetrailertmp, array(
        "name" => $trailername,
        "description" => $_POST["vDescription"],
        "privacy.view" => 'anybody',
        "privacy.embed" => 'public',
    ));
    $response = $client->request($uri . '?fields=transcode.status');
    if ($response['body']['transcode']['status'] === 'complete') {
        print 'Your trailer video finished transcoding.<br>';
    }
    elseif ($response['body']['transcode']['status'] === 'in_progress'){
        print 'Trailer video uploading done. (your video is still processing. please try again to access your video after a few minutes)<br>';
    }
    else {
        print 'Your trailer video encountered an error during transcoding.<br>';
    }
    //retrieve ID for trailer
    $response = $client->request($uri . '?fields=link');
    $videolinktrailer = $response['body']['link'];
    $get_vid_id_trailer = explode("/",$videolinktrailer);
    $get_vid_id_trailer = $get_vid_id_trailer['3'];
} else {
    echo "No trailer file selected<br>";
}

//if full/mixed video file is filled/selected
if (!empty($_FILES['fullvideo']['name'])) {
    //adjust name to trailer
    $fullvideoname = $basename." - Full/Mixed Video";
    $filefullvideo = $_FILES['fullvideo']['name'];
    $filefullvideotmp = $_FILES['fullvideo']['tmp_name'];

    // vimeo upload code
    $uri = $client->upload($filefullvideotmp, array(
        "name" => $fullvideoname,
        "description" => $_POST["vDescription"],
    ));
    $response = $client->request($uri . '?fields=transcode.status');
    if ($response['body']['transcode']['status'] === 'complete') {
        print 'Your full/mixed video finished transcoding.<br>';
    }
    elseif ($response['body']['transcode']['status'] === 'in_progress'){
        print 'Full/mixed video uploading done. (your video is still processing. please try again to access your video after a few minutes)<Br>';
    }
    else {
        print 'Your full/mixed video encountered an error during transcoding.<Br>';
    }
    //retrieve ID for full video
    $response = $client->request($uri . '?fields=link');
    $videolinkfull = $response['body']['link'];
    $get_vid_id_fullvideo = explode("/",$videolinkfull);
    $get_vid_id_fullvideo = $get_vid_id_fullvideo['3'];
} else {
    echo "No full/mixed file selected<br>";
}

//if high cam video file is filled/selected
if (!empty($_FILES['higcam']['name'])) {
    //adjust name to trailer
    $highvideoname = $basename." - High Cam Video";
    $filehighvideo = $_FILES['higcam']['name'];
    $filehighvideotmp = $_FILES['higcam']['tmp_name'];

    // vimeo upload code
    $uri = $client->upload($filehighvideotmp, array(
        "name" => $$highvideoname,
        "description" => $_POST["vDescription"],
    ));
    $response = $client->request($uri . '?fields=transcode.status');
    if ($response['body']['transcode']['status'] === 'complete') {
        print 'Your high cam video finished transcoding.<br>';
    }
    elseif ($response['body']['transcode']['status'] === 'in_progress'){
        print 'High cam video uploading done. (your video is still processing. please try again to access your video after a few minutes)<Br>';
    }
    else {
    print 'Your high cam video encountered an error during transcoding.<Br>';
    }
//retrieve ID for full video
$response = $client->request($uri . '?fields=link');
$videolinkhigh = $response['body']['link'];
$get_vid_id_highvideo = explode("/",$videolinkhigh);
$get_vid_id_highvideo = $get_vid_id_highvideo['3'];
} else {
    echo "No high cam file selected<br>";
}
</code>```

As mentioned, I tried to fill in the form, but it resulted in the error explained above.

Any help would be really appreciated.

Body:
I am struggling with the following:

I want to upload 3 videos in one form to Vimeo. I use a template where with some javascript, some magic happens. I am able to get the template working for one file, but when adjusting the javascript and html/php code, I get the following message: Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.

So what am I trying to do:

Part of the html code:

Upload trailer video file:

        Upload trailer video
        <input data-name="#trailer" id="form__trailer" name="trailer" class="form__video-upload" type="file" accept="video/mp4,video/x-m4v,video/*">

Upload full/mixed video file:

        Upload full/mixed video
        <input data-name="#fullvideo" id="form__fullvideo" name="fullvideo" class="form__video-upload" type="file" accept="video/*">

Upload high cam video file:

        Upload high cam
        <input data-name="#higcam" id="form__highcam" name="higcam" class="form__video-upload" type="file" accept="video/*">

part of the Javascript for the inputs:

      $('.form__video-upload').on('change', function() {
        var videoLabel  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel).text($(this)[0].files[0].name);
        } else {
            $(videoLabel).text('Upload video');
        }
    });

    $('.form__trailer').on('change', function() {
        var videoLabel1  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel1).text($(this)[0].files[0].name);
        } else {
            $(videoLabel1).text('Upload trailer video');
        }
    });

    $('.form__fullvideo').on('change', function() {
        var videoLabel2  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel2).text($(this)[0].files[0].name);
        } else {
            $(videoLabel2).text('Upload full video');
        }
    });

    $('.form__highcam').on('change', function() {
        var videoLabel3  = $(this).attr('data-name');

        if ($(this).val() != '') {
            $(videoLabel3).text($(this)[0].files[0].name);
        } else {
            $(videoLabel3).text('Upload high cam video');
        }
    });

And then finally some code when submitting (I don't think the error is in this, because when I comment it, the error remains:

//if trailer file is filled/selected
if (!empty($_FILES['trailer']['name'])) {
    //adjust name to trailer
    $trailername = $basename." - Trailer";
    $filetrailer = $_FILES['trailer']['name'];
    $filetrailertmp = $_FILES['trailer']['tmp_name'];

    // vimeo upload code
    $uri = $client->upload($filetrailertmp, array(
        "name" => $trailername,
        "description" => $_POST["vDescription"],
        "privacy.view" => 'anybody',
        "privacy.embed" => 'public',
    ));
    $response = $client->request($uri . '?fields=transcode.status');
    if ($response['body']['transcode']['status'] === 'complete') {
        print 'Your trailer video finished transcoding.
';
    }
    elseif ($response['body']['transcode']['status'] === 'in_progress'){
        print 'Trailer video uploading done. (your video is still processing. please try again to access your video after a few minutes)
';
    }
    else {
        print 'Your trailer video encountered an error during transcoding.
';
    }
    //retrieve ID for trailer
    $response = $client->request($uri . '?fields=link');
    $videolinktrailer = $response['body']['link'];
    $get_vid_id_trailer = explode("/",$videolinktrailer);
    $get_vid_id_trailer = $get_vid_id_trailer['3'];
} else {
    echo "No trailer file selected
";
}

//if full/mixed video file is filled/selected
if (!empty($_FILES['fullvideo']['name'])) {
    //adjust name to trailer
    $fullvideoname = $basename." - Full/Mixed Video";
    $filefullvideo = $_FILES['fullvideo']['name'];
    $filefullvideotmp = $_FILES['fullvideo']['tmp_name'];

    // vimeo upload code
    $uri = $client->upload($filefullvideotmp, array(
        "name" => $fullvideoname,
        "description" => $_POST["vDescription"],
    ));
    $response = $client->request($uri . '?fields=transcode.status');
    if ($response['body']['transcode']['status'] === 'complete') {
        print 'Your full/mixed video finished transcoding.
';
    }
    elseif ($response['body']['transcode']['status'] === 'in_progress'){
        print 'Full/mixed video uploading done. (your video is still processing. please try again to access your video after a few minutes)
';
    }
    else {
        print 'Your full/mixed video encountered an error during transcoding.
';
    }
    //retrieve ID for full video
    $response = $client->request($uri . '?fields=link');
    $videolinkfull = $response['body']['link'];
    $get_vid_id_fullvideo = explode("/",$videolinkfull);
    $get_vid_id_fullvideo = $get_vid_id_fullvideo['3'];
} else {
    echo "No full/mixed file selected
";
}

//if high cam video file is filled/selected
if (!empty($_FILES['higcam']['name'])) {
    //adjust name to trailer
    $highvideoname = $basename." - High Cam Video";
    $filehighvideo = $_FILES['higcam']['name'];
    $filehighvideotmp = $_FILES['higcam']['tmp_name'];

    // vimeo upload code
    $uri = $client->upload($filehighvideotmp, array(
        "name" => $$highvideoname,
        "description" => $_POST["vDescription"],
    ));
    $response = $client->request($uri . '?fields=transcode.status');
    if ($response['body']['transcode']['status'] === 'complete') {
        print 'Your high cam video finished transcoding.
';
    }
    elseif ($response['body']['transcode']['status'] === 'in_progress'){
        print 'High cam video uploading done. (your video is still processing. please try again to access your video after a few minutes)
';
    }
    else {
    print 'Your high cam video encountered an error during transcoding.
';
    }
//retrieve ID for full video
$response = $client->request($uri . '?fields=link');
$videolinkhigh = $response['body']['link'];
$get_vid_id_highvideo = explode("/",$videolinkhigh);
$get_vid_id_highvideo = $get_vid_id_highvideo['3'];
} else {
    echo "No high cam file selected
";
}

As mentioned, I tried to fill in the form, but it resulted in the error explained above.

Any help would be really appreciated.


问:
/api/login 419 (unknown status) - React fetch API & Laravel
Laravel api + sanctum

Locally, in postman, everything is fine, results return perfectly:-

```<code>curl --location --request POST 'http://127.0.0.1:8000/api/login' \
--header 'Accept: application/vnd.api+json' \
--header 'Content: application/vnd.api+json' \
--form 'email="admin@admin.com"' \
--form 'password="passworD34$"'
</code>```

From a React front-end, not so:-

Login.js

```<code>import { Fragment, useState, useRef } from "react";
import classes from './Login.module.css';

const Login = () => {

  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [message, setMessage] = useState("");

  let handleSubmit = async (e) => {
    e.preventDefault();
    const { email, password } = e.target.elements

    try {
      const res = await fetch("http://127.0.0.1:8000/api/login", {
        method: "POST",
        body: JSON.stringify({
                email: email.value,
                password: password.value
        }),
        headers: {
            "Accept" : "application/vnd.api+json",
            "Content" : "application/vnd.api+json"
        },
      });
      let resJson = await res.json();

// console.log(resJson); return;

      if (res.status === 200) {
        setEmail("");
        setPassword("");
        setMessage("User logged in successfully");
      } else {
        setMessage("Some error occured");
      }
    } catch (err) {
      console.log(err);
    }
  };

    return (
        <Fragment>
            <div className={classes['form-holder']}>
                <div className={classes['form-content']}>
                    <form onSubmit={handleSubmit}>
                        <label>Email</label>
                        <input type="text" id="email" />
                        <label>Password</label>
                        <input type="text" id="password" />
                        <button className={classes['btn-primary']} type="submit" value="Login">Login</button>
                    </form>
                </div>
                {message}
            </div>
        </Fragment>
    );

}

export default Login;
</code>```

The above returns a

Login.js:16,  POST http://127.0.0.1:8000/api/login 419 (unknown status)

Any clues please?

Body:
Laravel api + sanctum

Locally, in postman, everything is fine, results return perfectly:-

curl --location --request POST 'http://127.0.0.1:8000/api/login' \
--header 'Accept: application/vnd.api+json' \
--header 'Content: application/vnd.api+json' \
--form 'email="admin@admin.com"' \
--form 'password="passworD34$"'

From a React front-end, not so:-

Login.js

import { Fragment, useState, useRef } from "react";
import classes from './Login.module.css';

const Login = () => {

  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [message, setMessage] = useState("");

  let handleSubmit = async (e) => {
    e.preventDefault();
    const { email, password } = e.target.elements

    try {
      const res = await fetch("http://127.0.0.1:8000/api/login", {
        method: "POST",
        body: JSON.stringify({
                email: email.value,
                password: password.value
        }),
        headers: {
            "Accept" : "application/vnd.api+json",
            "Content" : "application/vnd.api+json"
        },
      });
      let resJson = await res.json();

// console.log(resJson); return;

      if (res.status === 200) {
        setEmail("");
        setPassword("");
        setMessage("User logged in successfully");
      } else {
        setMessage("Some error occured");
      }
    } catch (err) {
      console.log(err);
    }
  };

    return (
        <Fragment>

                    <form onSubmit={handleSubmit}>
                        Email
                        <input type="text" id="email" />
                        Password
                        <input type="text" id="password" />
                        <button className={classes['btn-primary']} type="submit" value="Login">Login</button>
                    </form>

                {message}

        </Fragment>
    );

}

export default Login;

The above returns a

Login.js:16,  POST http://127.0.0.1:8000/api/login 419 (unknown status)

Any clues please?


问:
Video did not show up with peerJs and NextJs typescript
I'm trying to implement a visio chat with PeerJs and NextJs typescript and the video did not show up but my webcam light is on. I just tried to call the id, I do not implement yet the socket for sharing peer id. It's just a test to show video and remote video, and it does not show any error. Can anyone help me.
This is my code</p>
```<code>import styles from "../styles/Home.module.css";
/* import Peer from "peerjs"; */
import React from "react";
import { NextPage } from "next";

const Visio: NextPage = () => {
  const [peerId, setPeerId] = React.useState<string>("");
  const remoteVideoRef = React.useRef(null);
  const [remotePeerIdValue, setRemotePeerIdValue] = React.useState<string>("");
  React.useEffect(() => {
    /* import("peerjs").then(({ default: Peer }) => {

    }); */

    const fn = async () => {
      const Peer = (await import("peerjs")).default;
      const peer = new Peer();
      peer.on("open", (id) => {
        setPeerId(id);
      });

      peer.on("call", (call) => {
        if (window.navigator !== undefined) {
          const getUserMedia = window.navigator.mediaDevices.getUserMedia;
          getUserMedia({ video: true }, (mediaStream) => {
            call.answer(mediaStream);
          });
        } else {
          console.log("It's not work");
        }
      });
    };

    fn();
  }, []);

  const call = async (remotePeerId: string) => {
    /* import("peerjs").then(async ({ default: Peer }) => {

    }); */

    const Peer = (await import("peerjs")).default;
    const peer = new Peer();

    const getUserMedia = window.navigator.mediaDevices.getUserMedia;

    getUserMedia({ video: true }, (mediaStream) => {
      console.log("tonga ato ilay izy an");
      const call = peer.call(remotePeerId, mediaStream);

      call.on("stream", (remoteStream: MediaStream) => {
        console.log(remoteStream, "remote stream");
        remoteVideoRef.current.srcObject = remoteStream;
        remoteVideoRef.current.onloadedmetadata = () => {
          remoteVideoRef.current.play();
        };
      });
    });
  };

  console.log(peerId, "peer ID");

  return (
    <div className={styles.container}>
      <input
        type="text"
        value={remotePeerIdValue}
        onChange={(e) => setRemotePeerIdValue(e.target.value)}
      />
      <button onClick={() => call(remotePeerIdValue)}>Call</button>
      <div>
        <video />
      </div>
      <div>
        <video ref={remoteVideoRef} autoPlay />
      </div>
    </div>
  );
};

export default Visio;
</code>```

Body:
I'm trying to implement a visio chat with PeerJs and NextJs typescript and the video did not show up but my webcam light is on. I just tried to call the id, I do not implement yet the socket for sharing peer id. It's just a test to show video and remote video, and it does not show any error. Can anyone help me.
This is my code

import styles from "../styles/Home.module.css";
/* import Peer from "peerjs"; */
import React from "react";
import { NextPage } from "next";

const Visio: NextPage = () => {
  const [peerId, setPeerId] = React.useState<string>("");
  const remoteVideoRef = React.useRef(null);
  const [remotePeerIdValue, setRemotePeerIdValue] = React.useState<string>("");
  React.useEffect(() => {
    /* import("peerjs").then(({ default: Peer }) => {

    }); */

    const fn = async () => {
      const Peer = (await import("peerjs")).default;
      const peer = new Peer();
      peer.on("open", (id) => {
        setPeerId(id);
      });

      peer.on("call", (call) => {
        if (window.navigator !== undefined) {
          const getUserMedia = window.navigator.mediaDevices.getUserMedia;
          getUserMedia({ video: true }, (mediaStream) => {
            call.answer(mediaStream);
          });
        } else {
          console.log("It's not work");
        }
      });
    };

    fn();
  }, []);

  const call = async (remotePeerId: string) => {
    /* import("peerjs").then(async ({ default: Peer }) => {

    }); */

    const Peer = (await import("peerjs")).default;
    const peer = new Peer();

    const getUserMedia = window.navigator.mediaDevices.getUserMedia;

    getUserMedia({ video: true }, (mediaStream) => {
      console.log("tonga ato ilay izy an");
      const call = peer.call(remotePeerId, mediaStream);

      call.on("stream", (remoteStream: MediaStream) => {
        console.log(remoteStream, "remote stream");
        remoteVideoRef.current.srcObject = remoteStream;
        remoteVideoRef.current.onloadedmetadata = () => {
          remoteVideoRef.current.play();
        };
      });
    });
  };

  console.log(peerId, "peer ID");

  return (

      <input
        type="text"
        value={remotePeerIdValue}
        onChange={(e) => setRemotePeerIdValue(e.target.value)}
      />
      <button onClick={() => call(remotePeerIdValue)}>Call</button>

        <video />

        <video ref={remoteVideoRef} autoPlay />

  );
};

export default Visio;


问:
How to connect WebHook Django
I use cryptocurrency payment service https://0xprocessing.com/

It has a WebHook And I want to connect this WebHook myself but I can't connect it I'm doing everything in Django REST API my code looks like this

(Here the WebHook connection service works fine, everything comes)

What is wrong here and what can I do?

models.py

```<code>class WebHook(models.Model):
    WebHook = models.JSONField(verbose_name='WebHook')
</code>```

serializers.py

```<code>class WebHookInfo(serializers.ModelSerializer):
    class Meta:
        fields = "__all__"
        model = webhook
</code>```

views.py

```<code>class WebHookList(generics.ListCreateAPIView):
    queryset = WebHook.objects.all()
    serializer_class = WebHookInfo
    permission_classes = [AllowAny]
</code>```

urls.py

```<code>path('pay/webhook/',WebHookList.as_view(), name='webhook'),
</code>```

Title: How to connect WebHook Django

Body:
I use cryptocurrency payment service https://0xprocessing.com/

It has a WebHook And I want to connect this WebHook myself but I can't connect it I'm doing everything in Django REST API my code looks like this

(Here the WebHook connection service works fine, everything comes)

What is wrong here and what can I do?

models.py

class WebHook(models.Model):
    WebHook = models.JSONField(verbose_name='WebHook')

serializers.py

class WebHookInfo(serializers.ModelSerializer):
    class Meta:
        fields = "__all__"
        model = webhook

views.py

class WebHookList(generics.ListCreateAPIView):
    queryset = WebHook.objects.all()
    serializer_class = WebHookInfo
    permission_classes = [AllowAny]

urls.py

path('pay/webhook/',WebHookList.as_view(), name='webhook'),


问:
NextJS Error Exceptions Handling with Classes TypeScript
I'm currently building an app and I want it's backend error exceptions to mimik how NestJS handles exceptions. for example:

if a resource is not found the code would be:

```<code>try {
const data = await fetch(/* ... */);
} catch () {
throw new ResourceNotFound();
}
</code>```

I have managed to build it, but I need to supply res (NextApiResponse object) in order to have it functioning and not throwing "undefined".

Can I eliminate the need of res? can it "absorbe" it from the handler or can be called within the class itself?

Code:

```<code>import { NextApiResponse } from 'next';
import { ApiErrorCodes } from './types/api-error-codes.type';
import { ApiBasicException } from './types/api-exception-responses.type';

export class AppException extends Error {
  constructor(private res: NextApiResponse) {
    super();
  }

  public init(code: ApiErrorCodes, message: string): any {
    const response: ApiBasicException = {
      statusCode: code,
      message: message,
    };

    this.res.status(code).json(response);
  }
}

export class NotFoundException extends AppException {
  constructor(res: NextApiResponse) {
    super(res);

    this.init(ApiErrorCodes.NOT_FOUND, 'Resource was not found.');
  }
}
</code>```

Body:
I'm currently building an app and I want it's backend error exceptions to mimik how NestJS handles exceptions. for example:

if a resource is not found the code would be:

try {
const data = await fetch(/* ... */);
} catch () {
throw new ResourceNotFound();
}

I have managed to build it, but I need to supply res (NextApiResponse object) in order to have it functioning and not throwing "undefined".

Can I eliminate the need of res? can it "absorbe" it from the handler or can be called within the class itself?

Code:

import { NextApiResponse } from 'next';
import { ApiErrorCodes } from './types/api-error-codes.type';
import { ApiBasicException } from './types/api-exception-responses.type';

export class AppException extends Error {
  constructor(private res: NextApiResponse) {
    super();
  }

  public init(code: ApiErrorCodes, message: string): any {
    const response: ApiBasicException = {
      statusCode: code,
      message: message,
    };

    this.res.status(code).json(response);
  }
}

export class NotFoundException extends AppException {
  constructor(res: NextApiResponse) {
    super(res);

    this.init(ApiErrorCodes.NOT_FOUND, 'Resource was not found.');
  }
}


问:
What does "new[]" mean with ReactiveCommand C# and how does this code execute?
I am creating an application using Firebase Firestore and Plugin.CloudFirestore for Xamarin Forms based off of the Sample Project posted on the plugin's GitHub (link:
https://github.com/f-miyu/Plugin.CloudFirestore).

I am trying to learn how to write Async Reactive Commands based off of how they are written in the sample project but I'm having a really hard time reverse engineering this code.

```<code>            UpdateCommand = new[] {
                _todoItem.Select(x => x == null),
                Name.Select(x => string.IsNullOrEmpty(x))
            }.CombineLatestValuesAreAllFalse()
             .ObserveOn(SynchronizationContext.Current)
             .ToAsyncReactiveCommand();

            UpdateCommand.Subscribe(async () =>
            {
                var todoItem = _todoItem.Value;
                todoItem.Name = Name.Value;
                todoItem.Notes = Notes.Value;

                _ = CrossCloudFirestore.Current.Instance.Document($"{TodoItem.CollectionPath}/{todoItem.Id}")
                    .UpdateAsync(todoItem)
                    .ContinueWith(t =>
                    {
                        System.Diagnostics.Debug.WriteLine(t.Exception);
                    }, TaskContinuationOptions.OnlyOnFaulted);

                await navigationService.GoBackAsync();
            });
</code>```

This code snippet is from the "TodoItemDetailPageViewModel.cs" file within the sample project if you would like more context.

The code above updates the field values of the document that is selected from the main page via the Firestore API. The code is working but I don't have any idea what the above code means and how the command works. Could someone break it down for me and explain what is going on? I am sure someone else could benefit as well.

Thanks

Body:
I am creating an application using Firebase Firestore and Plugin.CloudFirestore for Xamarin Forms based off of the Sample Project posted on the plugin's GitHub (link:
https://github.com/f-miyu/Plugin.CloudFirestore).

I am trying to learn how to write Async Reactive Commands based off of how they are written in the sample project but I'm having a really hard time reverse engineering this code.

            UpdateCommand = new[] {
                _todoItem.Select(x => x == null),
                Name.Select(x => string.IsNullOrEmpty(x))
            }.CombineLatestValuesAreAllFalse()
             .ObserveOn(SynchronizationContext.Current)
             .ToAsyncReactiveCommand();

            UpdateCommand.Subscribe(async () =>
            {
                var todoItem = _todoItem.Value;
                todoItem.Name = Name.Value;
                todoItem.Notes = Notes.Value;

                _ = CrossCloudFirestore.Current.Instance.Document($"{TodoItem.CollectionPath}/{todoItem.Id}")
                    .UpdateAsync(todoItem)
                    .ContinueWith(t =>
                    {
                        System.Diagnostics.Debug.WriteLine(t.Exception);
                    }, TaskContinuationOptions.OnlyOnFaulted);

                await navigationService.GoBackAsync();
            });

This code snippet is from the "TodoItemDetailPageViewModel.cs" file within the sample project if you would like more context.

The code above updates the field values of the document that is selected from the main page via the Firestore API. The code is working but I don't have any idea what the above code means and how the command works. Could someone break it down for me and explain what is going on? I am sure someone else could benefit as well.

Thanks


问:
Lilygo T-display rp2040 board - Undeclared lcd pins
I recently bought a lilygo board: Lilygo T-display rp2040, it has a raspberry rp2040 microcontroller. It came with code on the board as standard, but I can't use the LCD on the board with the example codes, the main errors are directed to the LCD pinouts that do not exist in the library that indicate, I tried to configure via software, but without success. You can even download the library that will see the problem:
TFT_eSPI.h

As I said, I tried to configure in one of the library files in the processors folder, the pinouts of the lcd that is embedded in the board, it even stopped giving the problem of "not declared in that file" but the settings are incorrect and I don't even know if that would solve.


问:
Why is this int8 number which is an id of a row in database converted to different number?

**When I type 826074891934531585 in chrome console it gets rounded off to 826074891934531600 **

this data is coming from an api and can't change its type to string.
Please helpenter image description here

When i tried to convert it to string it works fine.
Any number greater that equal to 826074891934531550 is getting rounded off to 826074891934531600.

Any number less than or equal to 826074891934531549 is getting rounded off to 826074891934531500.

please help.