问:
Python Flask forms not capturing form input
I am running the latest Flask, Python 3.10.  The app is installed on a Windows IIS Server.  I have three forms on a single page.  There is one submit button.  Each form has a unique ID.

When I fill out one or all of the forms and hit the Submit button there is a view Class handler for the POST request.  It is being called but the form data is missing.

One of the form elements looks like the following; the other two are similar but without the render_submit_field call:

```<code><form id="add_session_form" action="{{ url_for('session_api') }}" method="POST" novalidate
      role="form">
    {{ session_form.hidden_tag() }}
    {% for field in session_form %}
        {% if not field.flags.hidden %}
            {% if field.type == 'BooleanField' %}
                {{ render_checkbox_field(field, tabindex=loop.index * 300) }}
            {% elif field.type == 'SelectField' or field.type == 'SelectMultipleField' %}
                {{ render_select_field(field, tabindex=loop.index * 300) }}
            {% elif field.type == 'SubmitField' %}
                {{ render_submit_field(field, tabindex=loop.index * 300) }}
            {% else %}
                {{ render_field(field, tabindex=loop.index * 300) }}
            {% endif %}
        {% endif %}
    {% endfor %}
</form>
</code>```

The POST method of the view Class looks like:

```<code>@staticmethod
def post():
    try:
        db_session = db()

        school_form = SchoolForm(obj=current_user)
        class_form = ClassForm(obj=current_user)
        session_form = SessionForm(obj=current_user)

        school_list = SchoolAPI.get_all_schools()

        if school_form.validate_on_submit():
            # Copy form fields to user_profile fields
            school = School()
            school_form.populate_obj(school)

            db_session.add(school)
            db_session.commit()

            school_form = SchoolForm()

        if class_form.validate_on_submit():
            class_ = Class()
            class_form.populate_obj(class_)

            db_session.add(class_)
            db_session.commit()

            classes_form = ClassForm()

        if session_form.validate_on_submit():
            session = Session()
            session_form.populate_obj(session)

            db_session.add(session)
            db_session.commit()

            session_form = ClassForm()

        return render_template(
            'main/user_page.html',
            current_user=current_user,
            school_form=school_form,
            class_form=class_form,
            session_form=session_form,
            school_list=school_list
        )
    except Exception as e:
        return Response(repr(e), status=HTTPStatus.BAD_REQUEST)
</code>```

The curious part is that this was working at the beginning of 2022.  I was pulled onto another project and have recently been put back on this one.  I updated all dependencies and am not seeing any errors.

I am not sure what to check at this point.

Ideas?

Body:
I am running the latest Flask, Python 3.10.  The app is installed on a Windows IIS Server.  I have three forms on a single page.  There is one submit button.  Each form has a unique ID.

When I fill out one or all of the forms and hit the Submit button there is a view Class handler for the POST request.  It is being called but the form data is missing.

One of the form elements looks like the following; the other two are similar but without the render_submit_field call:

<form id="add_session_form" action="{{ url_for('session_api') }}" method="POST" novalidate
      role="form">
    {{ session_form.hidden_tag() }}
    {% for field in session_form %}
        {% if not field.flags.hidden %}
            {% if field.type == 'BooleanField' %}
                {{ render_checkbox_field(field, tabindex=loop.index * 300) }}
            {% elif field.type == 'SelectField' or field.type == 'SelectMultipleField' %}
                {{ render_select_field(field, tabindex=loop.index * 300) }}
            {% elif field.type == 'SubmitField' %}
                {{ render_submit_field(field, tabindex=loop.index * 300) }}
            {% else %}
                {{ render_field(field, tabindex=loop.index * 300) }}
            {% endif %}
        {% endif %}
    {% endfor %}
</form>

The POST method of the view Class looks like:

@staticmethod
def post():
    try:
        db_session = db()

        school_form = SchoolForm(obj=current_user)
        class_form = ClassForm(obj=current_user)
        session_form = SessionForm(obj=current_user)

        school_list = SchoolAPI.get_all_schools()

        if school_form.validate_on_submit():
            # Copy form fields to user_profile fields
            school = School()
            school_form.populate_obj(school)

            db_session.add(school)
            db_session.commit()

            school_form = SchoolForm()

        if class_form.validate_on_submit():
            class_ = Class()
            class_form.populate_obj(class_)

            db_session.add(class_)
            db_session.commit()

            classes_form = ClassForm()

        if session_form.validate_on_submit():
            session = Session()
            session_form.populate_obj(session)

            db_session.add(session)
            db_session.commit()

            session_form = ClassForm()

        return render_template(
            'main/user_page.html',
            current_user=current_user,
            school_form=school_form,
            class_form=class_form,
            session_form=session_form,
            school_list=school_list
        )
    except Exception as e:
        return Response(repr(e), status=HTTPStatus.BAD_REQUEST)

The curious part is that this was working at the beginning of 2022.  I was pulled onto another project and have recently been put back on this one.  I updated all dependencies and am not seeing any errors.

I am not sure what to check at this point.

Ideas?


来源: stackexchange

问:
NodeJS - Multer - optional image upload on multiple images
User field multiple image upload is available, but it is optional.

As I know, Multer preserves ordering in array of images so I have no problem mapping if every User have image.

Problem is if 5th User dont have image, I will have 7 images in the array, and would map it to the wrong entry.

```<code>  const upload = multer({storage: fileStorageEngine}).fields(
      [
        {
          name: 'House',
          maxCount: 1
        },
        {
          name: 'User',
          maxCount: 8
        }
      ]
  )

  // Create a new House
  router.post("/", (req,res) => {
    upload(req, res, function (err) {
      if (err) {
        console.log(err)
        return "An error occurred"
      }

      console.log(req.files)

      const payload = JSON.parse(req.body.data)
      // payload.image = req.file.path
      house.create(req, payload, res)
    })
  });
</code>```

Solutions for this problem worth considering:

I can rename every image when sending from frontend so I would know to which object in payload should I map the image path

Add to multer fields object in the array like this, so after this check each if image exists...

```<code>const upload = multer({storage: fileStorageEngine}).fields(
    [
      {
        name: 'House',
        maxCount: 1
      },
      {
        name: 'User1',
        maxCount: 1
      },
      {
        name: 'User2',
        maxCount: 1
      },
      ........
    ]
)
</code>```

Both of this solutions to me is not something I would like to implement so maybe there is better solution for this problem.

Thanks :)

ContentLicense: CC BY-SA 4.0

Body:
User field multiple image upload is available, but it is optional.

As I know, Multer preserves ordering in array of images so I have no problem mapping if every User have image.

Problem is if 5th User dont have image, I will have 7 images in the array, and would map it to the wrong entry.

  const upload = multer({storage: fileStorageEngine}).fields(
      [
        {
          name: 'House',
          maxCount: 1
        },
        {
          name: 'User',
          maxCount: 8
        }
      ]
  )

  // Create a new House
  router.post("/", (req,res) => {
    upload(req, res, function (err) {
      if (err) {
        console.log(err)
        return "An error occurred"
      }

      console.log(req.files)

      const payload = JSON.parse(req.body.data)
      // payload.image = req.file.path
      house.create(req, payload, res)
    })
  });

Solutions for this problem worth considering:

I can rename every image when sending from frontend so I would know to which object in payload should I map the image path

Add to multer fields object in the array like this, so after this check each if image exists...

const upload = multer({storage: fileStorageEngine}).fields(
    [
      {
        name: 'House',
        maxCount: 1
      },
      {
        name: 'User1',
        maxCount: 1
      },
      {
        name: 'User2',
        maxCount: 1
      },
      ........
    ]
)

Both of this solutions to me is not something I would like to implement so maybe there is better solution for this problem.

Thanks :)


问:
C# XML documentation: dynamic generation of ID Strings?
According to this documentation, I should add an unique ID string to each element.
This ID string is composed of a code that represent the type of the object, followed by a string that is generally namespace.class.method

Problem is, if the namespace, class, or method names change, the doc has to be updated.
In python, I use the name attribute to workaround this kind of problems, when a class is refactored, the doc is also refactored at the same time

Can I do something similar in C# and access the namespace, class name, or method name dynamically ?

I guess the answer is no since C# is a compiled language and the data is not available at this time, but still wondering. Documentation will be generated using Doxygen


问:
Overrides not accepting the specified package in node v16?
In package.json, i specified to override "gatsby-transformer-remark" to use "sanitize-html":"2.7.3" but it always using older sanitize html version -1.27.5,

```<code>{
  "dependencies": {
    "gatsby-transformer-remark":"5.24.0"
  }
  "overrides": {
    "gatsby-transformer-remark":{
      "sanitize-html":"2.7.3"
    }
  }
}
</code>```

In package-lock.json , sanitize-html version specified as 1.27.5

```<code>"node_modules/gatsby-transformer-remark": {
      "version": "5.24.0",

      "dependencies": {
        "@babel/runtime": "^7.15.4",
        "gatsby-core-utils": "^3.24.0",
        "sanitize-html": "^1.27.5",
        "underscore.string": "^3.3.6",
        "unified": "^9.2.2",
        "unist-util-remove-position": "^3.0.0",
        "unist-util-select": "^3.0.4",
        "unist-util-visit": "^2.0.3"
      },
      "engines": {
        "node": ">=14.15.0"
      },
      "peerDependencies": {
        "gatsby": "^4.0.0-next"
      }
    },
</code>```

But there is one another json element present in package-lock which overrides correctly.,

```<code>"gatsby-transformer-remark": {
      "version": "5.24.0",
      "requires": {
        "sanitize-html": "2.7.3",
        "underscore.string": "^3.3.6",
        "unified": "^9.2.2",
        "unist-util-remove-position": "^3.0.0",
        "unist-util-select": "^3.0.4",
        "unist-util-visit": "^2.0.3"
      },
      "dependencies": {
        "mdast-util-to-string": {
        },
      }
    }
</code>```

After npm installation of those packages the transformer-remark using 1.26.5 only instead of 2.7.3, Am i missed anything here? Any help appreciated.

Body:
In package.json, i specified to override "gatsby-transformer-remark" to use "sanitize-html":"2.7.3" but it always using older sanitize html version -1.27.5,

{
  "dependencies": {
    "gatsby-transformer-remark":"5.24.0"
  }
  "overrides": {
    "gatsby-transformer-remark":{
      "sanitize-html":"2.7.3"
    }
  }
}

In package-lock.json , sanitize-html version specified as 1.27.5

"node_modules/gatsby-transformer-remark": {
      "version": "5.24.0",

      "dependencies": {
        "@babel/runtime": "^7.15.4",
        "gatsby-core-utils": "^3.24.0",
        "sanitize-html": "^1.27.5",
        "underscore.string": "^3.3.6",
        "unified": "^9.2.2",
        "unist-util-remove-position": "^3.0.0",
        "unist-util-select": "^3.0.4",
        "unist-util-visit": "^2.0.3"
      },
      "engines": {
        "node": ">=14.15.0"
      },
      "peerDependencies": {
        "gatsby": "^4.0.0-next"
      }
    },

But there is one another json element present in package-lock which overrides correctly.,

"gatsby-transformer-remark": {
      "version": "5.24.0",
      "requires": {
        "sanitize-html": "2.7.3",
        "underscore.string": "^3.3.6",
        "unified": "^9.2.2",
        "unist-util-remove-position": "^3.0.0",
        "unist-util-select": "^3.0.4",
        "unist-util-visit": "^2.0.3"
      },
      "dependencies": {
        "mdast-util-to-string": {
        },
      }
    }

After npm installation of those packages the transformer-remark using 1.26.5 only instead of 2.7.3, Am i missed anything here? Any help appreciated.


问:
Angular Module Federation Shared Module with Npm Alias
I have two Angular 14 projects.  I'm using the @angular-architects/module-federation package to create a host and a remote.  The issue that I am encountering is that I need to share a library as a singleton, but that library is aliased in the package.json file.  It is not a local library, but rather is a library hosted in two different registries.

For instance, I have something like this in the package.json files in both projects:

```<code>"@myRegistry-1-namespace/ui": "npm:@myRegistry-2-namespace/ui@3.0.0",
</code>```

And when trying to share it, I have something like this in my webpack.config.js:

```<code>'@myRegistry-1-namespace/ui': {
    singleton: true,
    strictVersion: true,
    requiredVersion: 'auto',
  },
</code>```

When I attempt to run the host, I get the following error:

```<code>Unsatisfied version 3.0.0 from myproject-host of shared singleton module @myRegistry-1-namespace/ui (required =npm:@myRegistry-2-namespace/ui@3.0.0)
</code>```

Does anyone know how to get it to recognize the fact that I have the correct versions installed in both projects?

If I set requiredVersion to false, the host will load, but the project breaks at runtime (I assume due to the library needing to be a singleton).  If I remove the alias in the package.json files, it also works.  However, I need the alias (due to our projects ability to only connect to one of the registries in environments other than my local machine).

Body:
I have two Angular 14 projects.  I'm using the @angular-architects/module-federation package to create a host and a remote.  The issue that I am encountering is that I need to share a library as a singleton, but that library is aliased in the package.json file.  It is not a local library, but rather is a library hosted in two different registries.

For instance, I have something like this in the package.json files in both projects:

"@myRegistry-1-namespace/ui": "npm:@myRegistry-2-namespace/ui@3.0.0",

And when trying to share it, I have something like this in my webpack.config.js:

'@myRegistry-1-namespace/ui': {
    singleton: true,
    strictVersion: true,
    requiredVersion: 'auto',
  },

When I attempt to run the host, I get the following error:

Unsatisfied version 3.0.0 from myproject-host of shared singleton module @myRegistry-1-namespace/ui (required =npm:@myRegistry-2-namespace/ui@3.0.0)

Does anyone know how to get it to recognize the fact that I have the correct versions installed in both projects?

If I set requiredVersion to false, the host will load, but the project breaks at runtime (I assume due to the library needing to be a singleton).  If I remove the alias in the package.json files, it also works.  However, I need the alias (due to our projects ability to only connect to one of the registries in environments other than my local machine).


问:
Failing to implement a NOT logical operator with itemjs filter option
I've been trying the filter option among those available in itemsjs.

What i need is to revert the gotten result as a "NOT" logical operator would do.

At first I made this first stackblitz in which I pass the data and the config and then I make the filtering and I'm getting two items as result in the console:

Then I forked that same demo to make a second stackblitz in which I just inverted the boolean returned by the filter function (line 108 in the code)
and I expected I would get the opposite result (which means the items which weren't part of the result in the first demo)
but i got an empty array as items in the searchResult instead of getting the two other items.

Can you please tell me why it's not working as expected ?


问:
How can I properly style video background for a hero section in React?
I want a hero section in my website with a running video instead of an image, styling is easy peasy for a background image but a pain in the a*s for video. This is my code:

```<code>    <section>
            <ReactPlayer
                url={backgroundVideo}
                playing
                loop
                muted
                width="100%"
                height="100%"
            />
        </section>
</code>```

What CSS should I add in order for it to cover all the width of the page but a small height (like 600px let's say)? For the moment it takes all the width (they way I want) but the height is too big, and I can't manage to just frame a portion of the video, because when reducing the height it automatically reduces the width... How can I manage to get just a portion of the video, to fit say 100vw of width and 600px of height?

Body:
I want a hero section in my website with a running video instead of an image, styling is easy peasy for a background image but a pain in the a*s for video. This is my code:

            <ReactPlayer
                url={backgroundVideo}
                playing
                loop
                muted
                width="100%"
                height="100%"
            />

What CSS should I add in order for it to cover all the width of the page but a small height (like 600px let's say)? For the moment it takes all the width (they way I want) but the height is too big, and I can't manage to just frame a portion of the video, because when reducing the height it automatically reduces the width... How can I manage to get just a portion of the video, to fit say 100vw of width and 600px of height?


问:
Save PDF File is not working on android os 10 or less
```<code>    encodedBase64 = response;  // This is the base64 String response which i get from API.
    Log.e("tag",encodedBase64);

    String root = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).toString();
    File directory = new File(root + "/BillReport_pdf");
    if (!directory.exists()) {
        directory.mkdirs();
    }
    Random generator = new Random();
    int n = 100;
    n = generator.nextInt(n);
    String file_name = "billReceipt-"+ n +".pdf";
    File file = new File (directory, file_name);
    if (file.exists ())
        file.delete ();
    try {
        FileOutputStream out = new FileOutputStream(file);
        byte [] decodeBase64 = android.util.Base64.decode(encodedBase64, Base64.DEFAULT); //decoded the encoded string
        out.write(decodeBase64);
        out.flush();
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
</code>```

I tried with this but it is working on OS 11 but not working in OS 10. any one have better idea  to do so.

Body:
    encodedBase64 = response;  // This is the base64 String response which i get from API.
    Log.e("tag",encodedBase64);

    String root = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).toString();
    File directory = new File(root + "/BillReport_pdf");
    if (!directory.exists()) {
        directory.mkdirs();
    }
    Random generator = new Random();
    int n = 100;
    n = generator.nextInt(n);
    String file_name = "billReceipt-"+ n +".pdf";
    File file = new File (directory, file_name);
    if (file.exists ())
        file.delete ();
    try {
        FileOutputStream out = new FileOutputStream(file);
        byte [] decodeBase64 = android.util.Base64.decode(encodedBase64, Base64.DEFAULT); //decoded the encoded string
        out.write(decodeBase64);
        out.flush();
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

I tried with this but it is working on OS 11 but not working in OS 10. any one have better idea  to do so.


问:
Module not found: Error: Can't resolve './redux/store'
I'm new with Redux and while I was trying to replicate my lecture which happened this morning I have the following error message. I don't know what I've missed, I have installed react-redux and redux with yarn for both.

```<code>Module not found: Error: Can't resolve './redux/store' in '/Users/antoine/Documents/Web Projects/Integrify.io/ISA6/7. Redux/redux-practice/src'
ERROR in ./src/index.js 10:0-34
Module not found: Error: Can't resolve './redux/store' in '/Users/antoine/Documents/Web Projects/Integrify.io/ISA6/7. Redux/redux-practice/src'

webpack compiled with 1 error
</code>```

I have installed react-redux and redux with yarn for both.

Edit:
Here is a screenshot from my browser's console:
Uncaught Error: Cannot find module './redux/store'

Edit: I have found the answer to my question, I have not installed TypeScript properly at the beginning of my setup with
yarn create react-app . --template typescript

Body:
I'm new with Redux and while I was trying to replicate my lecture which happened this morning I have the following error message. I don't know what I've missed, I have installed react-redux and redux with yarn for both.

Module not found: Error: Can't resolve './redux/store' in '/Users/antoine/Documents/Web Projects/Integrify.io/ISA6/7. Redux/redux-practice/src'
ERROR in ./src/index.js 10:0-34
Module not found: Error: Can't resolve './redux/store' in '/Users/antoine/Documents/Web Projects/Integrify.io/ISA6/7. Redux/redux-practice/src'

webpack compiled with 1 error

I have installed react-redux and redux with yarn for both.

Edit:
Here is a screenshot from my browser's console:
Uncaught Error: Cannot find module './redux/store'

Edit: I have found the answer to my question, I have not installed TypeScript properly at the beginning of my setup with
yarn create react-app . --template typescript


问:
set/change Hazelcast IMap TTL
I'm using a standalone Hazelcast.

What I need is to change a setting for the entire IMap, not for a specific entry.
It can be done with management-center, so it's not impossible.

But I did not find any ways to do it programmatically from a JVM language.
I've tried this, and it do not even fail, but it doesn't work

val newMapConf = MapConfig()
newMapConf.timeToLiveSeconds = 1
newMapConf.name = "myMap"

val clientConfig = hazelcastClient.config

clientConfig.addMapConfig(newMapConf)
```

Is there a way to do change an IMap setting?

Title: set/change Hazelcast IMap TTL

Body:
I'm using a standalone Hazelcast.

What I need is to change a setting for the entire IMap, not for a specific entry.
It can be done with management-center, so it's not impossible.

But I did not find any ways to do it programmatically from a JVM language.
I've tried this, and it do not even fail, but it doesn't work

val newMapConf = MapConfig()
newMapConf.timeToLiveSeconds = 1
newMapConf.name = "myMap"

val clientConfig = hazelcastClient.config

clientConfig.addMapConfig(newMapConf)

Is there a way to do change an IMap setting?


问:
Getting POST response using requests
I am trying to get the data using post request from this website. I found the POST url in that website but I am not getting the same response as the website gets.

This is my code, the POST request I replicated after extracting the Curl command from the website and converted it to python:

```<code>import requests

headers = {
    'authority': 'gogohd.pro',
    'accept': '*/*',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
    'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
    'origin': 'https://gogohd.pro',
    'referer': 'https://gogohd.pro/download?id=MTkzNTU3&typesub=Gogoanime-SUB&title=Chainsaw+Man+Episode+1',
    'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
    'x-requested-with': 'XMLHttpRequest',
}

data = {
    'captcha_v3': '03AD1IbLB8l82Vx3Zjavs0Oi5IGmZO7CwnmFGQDG-42hJYvtHcCgy-xap9nD3qX7cmtLq8YI722QW2cjwR9zirycDscQB6gMvemy2pGo3saKmU4HR7wrIwTY5WNeenQfrqwbpATv-WOQoMc15fCEo_9GJiyJX4QlbNczgppCdxR8yOhehOjlTJOi8aKglA_46TF7GUQ3PA2YjbOnxC0O53w74H3dU0qpQUDSAI5PEZxuE9Bx0W7z6BGJmVp9QmV4wk7jeXh5inYnZjj5gafSm5GiG0kQo8B2V2Qc0HIhS1qmdDH0fW1WvxKM4LTEFNiCtJJdN2XL8UbDuI8hdlfnrTol_CZDop-Zu6O92IZdaPszxbMBHfB9tZYEN-0xY3L-0asRobKItn0XfWkJSnnT864dPg4f4ZW6upCYPt2aADYcgKwCO84D_s3MBIhheeqJT_pncMH7ddbF5ynmIHwzw_TP9gEntEKgdCdNIn4mcadBTk1vhHtTKjTKVM5YjWR0JnSEFI3PIrHalNGUl4sdfIZWu5DDqPrjbI02iw6dCnCFCy4cBIXRwAeMI',
    'id': 'MTkzNTU3',
}

response = requests.post('https://gogohd.pro/download', headers=headers, data=data)
print(response.text)
</code>```

This is the response the website gets where it gets back the links to the different qualities of the video available for download:

```<code><div class="mirror_link">
            <h6>Link download</h6>

            <span class="clr"></span>

                                            <div class="dowload"><a
                            href="https://gogodownload.net/download.php?url=aHR0cHM6LyAawehyfcghysfdsDGDYdgdsfsdfwstdgdsgtert9URASDGHUSRFSJGYfdsffsderFStewthsfSFtrftesdfseWVpYnU0bmM3LmdvY2RuYW5pLmNvbS91c2VyMTM0Mi9lYzBiNzk3NmM1M2Q4YmY5MDU2YTYwNjdmMGY3ZTA3Ny9FUC4xLnYwLjM2MHAubXA0P3Rva2VuPUczZWtqdzVpaW94enZjRldwdk5qVUEmZXhwaXJlcz0xNjcxNjUzNzkzJmlkPTE5MzU1Nw==" download>Download
                        (360P - mp4)</a></div>

                                            <div class="dowload"><a
                            href="https://gogodownload.net/download.php?url=aHR0cHM6LyAdrefsdsdfwerFrefdsfrersfdsrfer363435349AawehyfcghysfdsDGDYdgdsfsdfwstdgdsgtertseWVpYnU0bmM3LmdvY2RuYW5pLmNvbS91c2VyMTM0Mi9lYzBiNzk3NmM1M2Q4YmY5MDU2YTYwNjdmMGY3ZTA3Ny9FUC4xLnYwLjQ4MHAubXA0P3Rva2VuPXRkckVIdmE3Y2UwRFpxZzZvZFJ0aXcmZXhwaXJlcz0xNjcxNjUzNzkzJmlkPTE5MzU1Nw==" download>Download
                        (480P - mp4)</a></div>

                                            <div class="dowload"><a
                            href="https://gogodownload.net/download.php?url=aHR0cHM6LyAdeqwrwedffryretgsdFrsftrsvfsfsr9seWVpYnURASDGHUSRFSJGYfdsffsderFStewthsfSFtrftesdfU0bmM3LmdvY2RuYW5pLmNvbS91c2VyMTM0Mi9lYzBiNzk3NmM1M2Q4YmY5MDU2YTYwNjdmMGY3ZTA3Ny9FUC4xLnYwLjcyMHAubXA0P3Rva2VuPXlob3k4SDJya3VyRmRTZnRSMUs3OXcmZXhwaXJlcz0xNjcxNjUzNzkzJmlkPTE5MzU1Nw==" download>Download
                        (720P - mp4)</a></div>

                                            <div class="dowload"><a
                            href="https://gogodownload.net/download.php?url=aHR0cHM6LyURASDGHUSRFSJGYfdsffsderFStewthsfSFtrfteAdeqwrwedffryretgsdFrsftrsvfsfsrsdf9seWVpYnU0bmM3LmdvY2RuYW5pLmNvbS91c2VyMTM0Mi9lYzBiNzk3NmM1M2Q4YmY5MDU2YTYwNjdmMGY3ZTA3Ny9FUC4xLnYwLjEwODBwLm1wND90b2tlbj1Qb09QcGFNSzBvVTJhNDJhQk11eWdRJmV4cGlyZXM9MTY3MTY1Mzc5MyZpZD0xOTM1NTc=" download>Download
                        (1080P - mp4)</a></div>

                    </div>
        <span class="clr"></span>
        <div class="mirror_link">
            <h6>Mirror Link</h6>

                        <div class="dowload"><a
                        href="https://streamsss.net/d/aat4tegpjl4g" target='_blank'>Download StreamSB</a></div>

                        <div class="dowload"><a
                        href="https://dood.wf/d/c2y9u6k23a2o" target='_blank'>Download DoodStream</a></div>

                        <div class="dowload"><a
                        href="https://fembed9hd.com/f/gl1enu-757y2l2l" target='_blank'>Download Xstreamcdn</a></div>

            <div class="dowload"><a
                            href="https://bodelen.com/afu.php?zoneid=2052717" target='_blank'>Download For Ad</a></div>

        </div>
        <span class="clr"></span>
</code>```

This is the response I get when I run my python code:

```<code><span class="clr"></span>
<div id="captcha-v2"></div>
<button type="submit" id="btn-submit">Get Link</button>

<script>
    site_key = '6LflndkbAAAAAMtC8hy8LXjRop4gJqLVz0S1OyJQ';
    captcha_v2 = grecaptcha.render('captcha-v2', {'sitekey' : site_key, "theme": "dark"});

    $('#btn-submit').on( "click", function() {
        token = grecaptcha.getResponse(captcha_v2);
        if(token.length > 0){
            $.post(window.location.pathname, {
                   captcha_v2: token,
                   id: 'MTkzNTU3',
            }, function(data, status) {
                $('#content-download').html(data);
            });
        }
    })
</script>
</code>```

Is there any way to get the correct response?

Title: Getting POST response using requests

Body:
I am trying to get the data using post request from this website. I found the POST url in that website but I am not getting the same response as the website gets.

This is my code, the POST request I replicated after extracting the Curl command from the website and converted it to python:

import requests

headers = {
    'authority': 'gogohd.pro',
    'accept': '*/*',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
    'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
    'origin': 'https://gogohd.pro',
    'referer': 'https://gogohd.pro/download?id=MTkzNTU3&typesub=Gogoanime-SUB&title=Chainsaw+Man+Episode+1',
    'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
    'x-requested-with': 'XMLHttpRequest',
}

data = {
    'captcha_v3': '03AD1IbLB8l82Vx3Zjavs0Oi5IGmZO7CwnmFGQDG-42hJYvtHcCgy-xap9nD3qX7cmtLq8YI722QW2cjwR9zirycDscQB6gMvemy2pGo3saKmU4HR7wrIwTY5WNeenQfrqwbpATv-WOQoMc15fCEo_9GJiyJX4QlbNczgppCdxR8yOhehOjlTJOi8aKglA_46TF7GUQ3PA2YjbOnxC0O53w74H3dU0qpQUDSAI5PEZxuE9Bx0W7z6BGJmVp9QmV4wk7jeXh5inYnZjj5gafSm5GiG0kQo8B2V2Qc0HIhS1qmdDH0fW1WvxKM4LTEFNiCtJJdN2XL8UbDuI8hdlfnrTol_CZDop-Zu6O92IZdaPszxbMBHfB9tZYEN-0xY3L-0asRobKItn0XfWkJSnnT864dPg4f4ZW6upCYPt2aADYcgKwCO84D_s3MBIhheeqJT_pncMH7ddbF5ynmIHwzw_TP9gEntEKgdCdNIn4mcadBTk1vhHtTKjTKVM5YjWR0JnSEFI3PIrHalNGUl4sdfIZWu5DDqPrjbI02iw6dCnCFCy4cBIXRwAeMI',
    'id': 'MTkzNTU3',
}

response = requests.post('https://gogohd.pro/download', headers=headers, data=data)
print(response.text)

This is the response the website gets where it gets back the links to the different qualities of the video available for download:

Link download

Download
                        (360P - mp4)

Download
                        (480P - mp4)

Download
                        (720P - mp4)

Download
                        (1080P - mp4)

Mirror Link

Download StreamSB

Download DoodStream

Download Xstreamcdn

Download For Ad

This is the response I get when I run my python code:

<button type="submit" id="btn-submit">Get Link</button>

Is there any way to get the correct response?


问:
How to check if addition of two,s complement getting overflow?
I just solved a question and i will share the picture as well below in my opinion this question got overflow and also after addition the answer is wrong please check and suggest enter image description here</p>


问:
How do I create a widget on android to display a graph of online data?
I have a profile page as a music curator account, where it shows the score for various parameters there. The most relevant one, monthly listeners, is easily inferred (just a simple excel that I've compiled with the values found on the page), but not shown.
Even though I can constantly calculate it (approximately, because the page might not be consistently updated or might have some flawed calculations), I'm still trying to find a way to have that monthly listeners value updated constantly, and seen as a graph over time.
I was wondering if it's best to do it on android, windows or any other way, to simplify for a complete noob like me, any coding process that i might have to do.
I've only had a little experience in Arduino, so even the basics as to what language to use or the code neccesary for this are foreign to me, but I'm quite interested in learning more about it.
Any help is appreciated, thanks!</p>


问:
How can one get the memory and cpu usage of a particular tab using Chrome APIs?
Using Chrome's runtime method, I can get a list of tabs using:

```<code>chrome.runtime.sendMessage({getTabs: true}, function(response) {
  for (const tab of response.tabs) {
    console.log(tab);
  }
});
</code>```

How can I measure the resources used for each tab? Memory, CPU, GPU?

I don't see this in the tab object in the Google Chrome Docs on Tabs.

Ideally I'd like to do something like this:

```<code>chrome.runtime.sendMessage({getTabs: true}, function(response) {
  for (const tab of response.tabs) {
    // Get information about the tab
    chrome.tabs.get(tab.id, function(tab) {
      let memoryUsage = tab.memoryUsage;
    });
  }
});

</code>```

An alternative could be to use the chrome.processes API, but this is only available in dev channels.

```<code>chrome.processes.getProcessIdForTab(tab.id, function(processId) {
  // Get the memory usage of the tab's process
  chrome.processes.getProcessInfo([processId], true, function(processes) {
    const process = processes[processId];

    // The memory usage of the tab is stored in the "privateMemory" property
    // of the process object (in bytes)
    const memoryUsage = process.privateMemory / 1024 / 1024;  // in MB

    console.log(`Memory usage of tab ${tab.id}: ${memoryUsage} MB`);
  });
});
</code>```

Body:
Using Chrome's runtime method, I can get a list of tabs using:

chrome.runtime.sendMessage({getTabs: true}, function(response) {
  for (const tab of response.tabs) {
    console.log(tab);
  }
});

How can I measure the resources used for each tab? Memory, CPU, GPU?

I don't see this in the tab object in the Google Chrome Docs on Tabs.

Ideally I'd like to do something like this:

chrome.runtime.sendMessage({getTabs: true}, function(response) {
  for (const tab of response.tabs) {
    // Get information about the tab
    chrome.tabs.get(tab.id, function(tab) {
      let memoryUsage = tab.memoryUsage;
    });
  }
});

An alternative could be to use the chrome.processes API, but this is only available in dev channels.

chrome.processes.getProcessIdForTab(tab.id, function(processId) {
  // Get the memory usage of the tab's process
  chrome.processes.getProcessInfo([processId], true, function(processes) {
    const process = processes[processId];

    // The memory usage of the tab is stored in the "privateMemory" property
    // of the process object (in bytes)
    const memoryUsage = process.privateMemory / 1024 / 1024;  // in MB

    console.log(`Memory usage of tab ${tab.id}: ${memoryUsage} MB`);
  });
});


问:
How to reliably access root tag's namespace declarations and attributes using lxml?
In the following example, is there a way to either:

only print the root REQ-IF tags's complete attributes without having lxml to print the whole XML document
or

to enumerate the root tag's namespaces and attributes in the same order as they appear in an XML document?

My goal is to get precisely this string and nothing else:

```<code><REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20101201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd">
</code>```

In the code below, I can either print the whole XML document or access independently the nsmap and attrib properties. I can also imagine making a deep copy of a document tree, removing the children nodes and calling tostring() on that parent node only but I was wondering if there was a more elegant solution to just get the exact XML string of the parent tag without accessing its child tags or hacking on the tree structure?

```<code>import io

from lxml import etree

reqif_content = """<?xml version="1.0" encoding="UTF-8"?>
<REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20101201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd">
  <THE-HEADER>
    <REQ-IF-HEADER IDENTIFIER="3dd1a60c-59d1-11da-86ca-4bda04a730ce">
      <COMMENT>Embedded OLE object with multiple representation forms.</COMMENT>
      <CREATION-TIME>2005-05-23T12:00:00+02:00</CREATION-TIME>
      <SOURCE-TOOL-ID>Manually written</SOURCE-TOOL-ID>
      <TITLE>Test data RIF72</TITLE>
    </REQ-IF-HEADER>
  </THE-HEADER>
</REQ-IF>
"""

xml_reqif_root = etree.parse(
    io.BytesIO(bytes(reqif_content, "UTF-8"))
)

print(etree.tostring(xml_reqif_root.getroot(), pretty_print=True).decode("utf8"))
print("nsmap:")
print(xml_reqif_root.getroot().nsmap)
print("attrib:")
print(xml_reqif_root.getroot().attrib)
</code>```

In the output, it is clear that I get a full XML which I don't want and I get some non-identical representation of the namespaces and attributes:

```<code><REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20101201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd">
  <THE-HEADER>
    <REQ-IF-HEADER IDENTIFIER="3dd1a60c-59d1-11da-86ca-4bda04a730ce">
      <COMMENT>Embedded OLE object with multiple representation forms.</COMMENT>
      <CREATION-TIME>2005-05-23T12:00:00+02:00</CREATION-TIME>
      <SOURCE-TOOL-ID>Manually written</SOURCE-TOOL-ID>
      <TITLE>Test data RIF72</TITLE>
    </REQ-IF-HEADER>
  </THE-HEADER>
</REQ-IF>
nsmap:
{None: 'http://www.omg.org/spec/ReqIF/20101201', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
attrib:
{'{http://www.w3.org/2001/XMLSchema-instance}schemaLocation': 'http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd'}
</code>```

Body:
In the following example, is there a way to either:

only print the root REQ-IF tags's complete attributes without having lxml to print the whole XML document
or

to enumerate the root tag's namespaces and attributes in the same order as they appear in an XML document?

My goal is to get precisely this string and nothing else:

<REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20101201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd">

In the code below, I can either print the whole XML document or access independently the nsmap and attrib properties. I can also imagine making a deep copy of a document tree, removing the children nodes and calling tostring() on that parent node only but I was wondering if there was a more elegant solution to just get the exact XML string of the parent tag without accessing its child tags or hacking on the tree structure?

import io

from lxml import etree

reqif_content = """<?xml version="1.0" encoding="UTF-8"?>
<REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20101201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd">
  <THE-HEADER>
    <REQ-IF-HEADER IDENTIFIER="3dd1a60c-59d1-11da-86ca-4bda04a730ce">
      <COMMENT>Embedded OLE object with multiple representation forms.</COMMENT>
      <CREATION-TIME>2005-05-23T12:00:00+02:00</CREATION-TIME>
      <SOURCE-TOOL-ID>Manually written</SOURCE-TOOL-ID>
      <TITLE>Test data RIF72</TITLE>
    </REQ-IF-HEADER>
  </THE-HEADER>
</REQ-IF>
"""

xml_reqif_root = etree.parse(
    io.BytesIO(bytes(reqif_content, "UTF-8"))
)

print(etree.tostring(xml_reqif_root.getroot(), pretty_print=True).decode("utf8"))
print("nsmap:")
print(xml_reqif_root.getroot().nsmap)
print("attrib:")
print(xml_reqif_root.getroot().attrib)

In the output, it is clear that I get a full XML which I don't want and I get some non-identical representation of the namespaces and attributes:

<REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20101201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd">
  <THE-HEADER>
    <REQ-IF-HEADER IDENTIFIER="3dd1a60c-59d1-11da-86ca-4bda04a730ce">
      <COMMENT>Embedded OLE object with multiple representation forms.</COMMENT>
      <CREATION-TIME>2005-05-23T12:00:00+02:00</CREATION-TIME>
      <SOURCE-TOOL-ID>Manually written</SOURCE-TOOL-ID>
      <TITLE>Test data RIF72</TITLE>
    </REQ-IF-HEADER>
  </THE-HEADER>
</REQ-IF>
nsmap:
{None: 'http://www.omg.org/spec/ReqIF/20101201', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
attrib:
{'{http://www.w3.org/2001/XMLSchema-instance}schemaLocation': 'http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd http://www.w3.org/1999/xhtml driver.xsd'}


问:
OxyPlot v2.1.0 DataBinding
My existing c# WPF project with OxyPlot.Wpf v2.0 NuGet Package runs fine and uses Data binding.
OxyPlot.Wpf 2.1.2 is out but I have problems that the data binding no longer processes updates for use as Live-Chart.

To test, I wrote 2 test programs to clarify that.
In both versions INotifyPropertyChanged is implemented and I use the following properties for my data:

```<code>public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

...

private ObservableCollection<DataPoint> valueList1;
public ObservableCollection<DataPoint> ValueList1
{
    get => valueList1;
    set
    {
        valueList1 = value;
        OnPropertyChanged();
    }
}

private ObservableCollection<DataPoint> valueList2;
public ObservableCollection<DataPoint> ValueList2
{
    get => valueList2;
    set
    {
        valueList2 = value;
        OnPropertyChanged();
    }
}
</code>```

In the constructor, I add a few test data that can also be seen directly in the OxyPlot Chart when it starts in both OxyPlot versions. So the data binding should be fine with that.

I add further data to the ObservableCollection Propertys by clicking a button.
In Version 2.0 the WPF-Chart updates and shows the new Data.
In Version 2.1 nothing happens, data binding doesn't seem to trigger any updates...

As part of the update to OxyPlot.Wpf v2.1, I have to move my XAML code to the code behind:

XAML v2.0

```<code><oxy:Plot Title="OxyTest" >
    <oxy:Plot.Axes>
        <oxy:LinearAxis MaximumPadding="0.1" IsZoomEnabled="True" MajorStep="100" />
    </oxy:Plot.Axes>
    <oxy:Plot.Series>
        <oxy:AreaSeries Color="Red" Title="DataLine1" ItemsSource="{Binding Path=ValueList1}" />
        <oxy:LineSeries Color="Blue" Title="DataLine2" ItemsSource="{Binding Path=ValueList2}" />
    </oxy:Plot.Series>
</oxy:Plot>
</code>```

Code Behind v2.1

```<code>MyModel = new PlotModel
{
    Title = "OxyTest",
};

MyModel.Axes.Add(new LinearAxis
{
    MaximumPadding = 0.1,
    IsZoomEnabled = true,
    MajorStep = 100
});

MyModel.Series.Add(new AreaSeries
{
    Color = OxyColor.FromRgb(255, 0, 0),
    Title = "DataLine1",
    ItemsSource = ValueList1
});

MyModel.Series.Add(new LineSeries
{
    Color = OxyColor.FromRgb(0, 0, 255),
    Title = "DataLine2",
    ItemsSource = ValueList2
});
</code>```

EDIT:

The InvalidatePlot() method must be called for the display to be updated. The method has existed for a long time but in version 2.0 I didn't have to trigger it manually!?

Thanks to this Article How to refresh oxyplot plot when data changes

The Solution from heltonbiker looks good so i added this in my project:

```<code>ValueList1.CollectionChanged += (a, b) => MyModel.InvalidatePlot(true);
ValueList2.CollectionChanged += (a, b) => MyModel.InvalidatePlot(true);
</code>```

Maybe this will help someone else.

The offical OxyPlot documentation is labeld as under construction.

EDIT2:

I found another Solution for my DataBinding Problem.
Just add OxyPlot.Contrib.Wpf to the Project and change the XMLNS from "http://oxyplot.org/wpf" to "http://oxyplot.org/wpf/contrib" and use the Exact same XAML from v2.0. No need to trigger the CollectionChanged Event. Databinding works fine.

Title: OxyPlot v2.1.0 DataBinding

Body:
My existing c# WPF project with OxyPlot.Wpf v2.0 NuGet Package runs fine and uses Data binding.
OxyPlot.Wpf 2.1.2 is out but I have problems that the data binding no longer processes updates for use as Live-Chart.

To test, I wrote 2 test programs to clarify that.
In both versions INotifyPropertyChanged is implemented and I use the following properties for my data:

public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

...

private ObservableCollection<DataPoint> valueList1;
public ObservableCollection<DataPoint> ValueList1
{
    get => valueList1;
    set
    {
        valueList1 = value;
        OnPropertyChanged();
    }
}

private ObservableCollection<DataPoint> valueList2;
public ObservableCollection<DataPoint> ValueList2
{
    get => valueList2;
    set
    {
        valueList2 = value;
        OnPropertyChanged();
    }
}

In the constructor, I add a few test data that can also be seen directly in the OxyPlot Chart when it starts in both OxyPlot versions. So the data binding should be fine with that.

I add further data to the ObservableCollection Propertys by clicking a button.
In Version 2.0 the WPF-Chart updates and shows the new Data.
In Version 2.1 nothing happens, data binding doesn't seem to trigger any updates...

As part of the update to OxyPlot.Wpf v2.1, I have to move my XAML code to the code behind:

XAML v2.0

<oxy:Plot Title="OxyTest" >
    <oxy:Plot.Axes>
        <oxy:LinearAxis MaximumPadding="0.1" IsZoomEnabled="True" MajorStep="100" />
    </oxy:Plot.Axes>
    <oxy:Plot.Series>
        <oxy:AreaSeries Color="Red" Title="DataLine1" ItemsSource="{Binding Path=ValueList1}" />
        <oxy:LineSeries Color="Blue" Title="DataLine2" ItemsSource="{Binding Path=ValueList2}" />
    </oxy:Plot.Series>
</oxy:Plot>

Code Behind v2.1

MyModel = new PlotModel
{
    Title = "OxyTest",
};

MyModel.Axes.Add(new LinearAxis
{
    MaximumPadding = 0.1,
    IsZoomEnabled = true,
    MajorStep = 100
});

MyModel.Series.Add(new AreaSeries
{
    Color = OxyColor.FromRgb(255, 0, 0),
    Title = "DataLine1",
    ItemsSource = ValueList1
});

MyModel.Series.Add(new LineSeries
{
    Color = OxyColor.FromRgb(0, 0, 255),
    Title = "DataLine2",
    ItemsSource = ValueList2
});

EDIT:

The InvalidatePlot() method must be called for the display to be updated. The method has existed for a long time but in version 2.0 I didn't have to trigger it manually!?

Thanks to this Article How to refresh oxyplot plot when data changes

The Solution from heltonbiker looks good so i added this in my project:

ValueList1.CollectionChanged += (a, b) => MyModel.InvalidatePlot(true);
ValueList2.CollectionChanged += (a, b) => MyModel.InvalidatePlot(true);

Maybe this will help someone else.

The offical OxyPlot documentation is labeld as under construction.

EDIT2:

I found another Solution for my DataBinding Problem.
Just add OxyPlot.Contrib.Wpf to the Project and change the XMLNS from "http://oxyplot.org/wpf" to "http://oxyplot.org/wpf/contrib" and use the Exact same XAML from v2.0. No need to trigger the CollectionChanged Event. Databinding works fine.


问:
External driver for Excel for end-to-end tests
Is there an external driver for Excel (e.g., something roughly analogous to chromedriver) that would let me write end-to-end tests for a complex spreadsheet setup?

I have a script that generates a somewhat complex Excel spreadsheet, and I'd like to write automated tests to verify that the spreadsheet behaves as expected when opened in Excel.

In particular, I'd like to verify that

The expected columns are hidden, and

The expected cells are locked, and all remaining cells are unlocked.

I'd like to test by actually driving Excel. Although I could write tests using rubyXL to verify that the cell properties are set as expected, that does not verify that the way I set the properties does, in fact, produce the expected behavior when the spreadsheet is loaded into Excel.


问:
Is there a way to reduce the binary size of a Cobra app
I'd like to use Cobra in a project where I have some strict binary size limitations. The binary size of a "hello world" Cobra app (as shown below) comes in at 4.1 MB. If I build it with go build -ldflags "-w -s" . then I can get it down to 2.8 MB. Does Cobra have any build tags (or other methods) to give up any functionality to further reduce the binary size? As an example, the Gin library has a -tags=nomsgpack flag to disable the MsgPack rendering feature. Does Cobra offer anything like that?

package main

import (
    "fmt"
    "os"

    "github.com/spf13/cobra"
)

func main() {
    if err := rootCmd.Execute(); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
}

var rootCmd = &cobra.Command{
    Use:   "hugo",
    Short: "Hugo is a very fast static site generator",
    Long: `A Fast and Flexible Static Site Generator built with
                love by spf13 and friends in Go.
                Complete documentation is available at https://gohugo.io/documentation/`,
    Run: func(cmd *cobra.Command, args []string) {

    },
}
```


问:
Activity with tablayout and another tablayout within fragment
I have an activity with tablayout and four fragments. This works fine and i can swipe between the fragments.
But now i need a tablayout within one of this fragments for a submenu. So there will be two tablayout on top of each other. I thought i can do the same like in activity in the fragment. But it doesn't work how i hoped :D

Know is my question, is this possible or i need something else to get a submenu in a fragment?

MainActivity:

```<code>    public class MainActivity extends AppCompatActivity implements TabLayoutMediator.TabConfigurationStrategy{
ViewPager2 viewPager2;
TabLayout tabLayout;
ArrayList<String> titles;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        viewPager2 = findViewById(R.id.vp2MainMenu);
        tabLayout = findViewById(R.id.tlMainMenu);
        titles = new ArrayList<String>();
        titles.add("Dashboard");
        titles.add("Logs");
        titles.add("Chat");
        titles.add("FAQ");
        setViewPagerAdapter();
        new TabLayoutMediator(tabLayout, viewPager2, this).attach();
    }

    public void setViewPagerAdapter() {
        TabMainAdapter tabMainAdapter = new
                TabMainAdapter(this);
        ArrayList<Fragment> fragmentList = new ArrayList<>(); //creates an ArrayList of Fragments
        fragmentList.add(new DashboardFragment());
        fragmentList.add(new LogsFragment());
        fragmentList.add(new ChatFragment());
        fragmentList.add(new FaqFragment());
        tabMainAdapter.setData(fragmentList); //sets the data for the adapter
        viewPager2.setAdapter(tabMainAdapter);
    }

    @Override
    public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
        tab.setText(titles.get(position));
    }

    public class TabMainAdapter extends FragmentStateAdapter {
        private ArrayList<Fragment> fragments;

        public TabMainAdapter(@NonNull FragmentActivity fragmentActivity) {
            super(fragmentActivity);

        }

        @NonNull
        @Override
        public Fragment createFragment(int position) {
            return fragments.get(position);
        }

        @Override
        public int getItemCount() {
            return fragments.size();
        }

        public void setData(ArrayList<Fragment> fragments) {
            this.fragments = fragments;
        }
    }
}
</code>```

activity_man.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tlMainMenu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabMode="scrollable"
        app:layout_constraintTop_toTopOf="parent"
        android:background="@color/black" />

    <androidx.viewpager2.widget.ViewPager2
        android:id="@+id/vp2MainMenu"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintTop_toBottomOf="@id/tlMainMenu"
        app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

"Main" fragment with tablayout and the submenu fragment:

```<code>public class LogsFragment extends Fragment implements TabLayoutMediator.TabConfigurationStrategy{

    //global variables
    ViewPager2 viewPager2;
    TabLayout tabLayout;
    ArrayList<String> titles;

    public LogsFragment() {
        // Required empty public constructor
    }

    public static LogsFragment newInstance(String param1, String param2) {
        LogsFragment fragment = new LogsFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getActivity().setContentView(R.layout.fragment_logs);

        viewPager2 = getActivity().findViewById(R.id.viewpager);
        tabLayout = getActivity().findViewById(R.id.result_tabs);
        titles = new ArrayList<String>();
        titles.add("Shop");
        titles.add("Tribe");
        setViewPagerAdapter();
        new TabLayoutMediator(tabLayout, viewPager2, this).attach();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootview =  inflater.inflate(R.layout.fragment_logs,container,false);

        return rootview;
    }

    public void setViewPagerAdapter() {
        TabLogsAdapter tabMainAdapter = new
                TabLogsAdapter(getActivity());
        ArrayList<Fragment> fragmentList = new ArrayList<>(); //creates an ArrayList of Fragments
        fragmentList.add(new LogsShopFragment());
        fragmentList.add(new LogsTribeFragment());
        //and more fragment for the submenu
        tabMainAdapter.setData(fragmentList); //sets the data for the adapter
        viewPager2.setAdapter(tabMainAdapter);
    }

    @Override
    public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
        tab.setText(titles.get(position));
    }

    public class TabLogsAdapter extends FragmentStateAdapter {
        private ArrayList<Fragment> fragments;
        public TabLogsAdapter(@NonNull FragmentActivity fragmentActivity) {
            super(fragmentActivity);

        }

        @NonNull
        @Override
        public Fragment createFragment(int position) {
            return fragments.get(position);
        }

        @Override
        public int getItemCount() {
            return fragments.size();
        }

        public void setData(ArrayList<Fragment> fragments) {
            this.fragments = fragments;
        }
    }
}
</code>```

fragment_logs.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            tools:ignore="MissingConstraints">

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/result_tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabMode="scrollable"
                app:layout_constraintTop_toTopOf="parent"
                android:background="@color/black" />

            <androidx.viewpager2.widget.ViewPager2
                android:id="@+id/viewpager"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:layout_constraintTop_toBottomOf="@id/result_tabs"
                app:layout_constraintBottom_toBottomOf="parent"/>
        </com.google.android.material.appbar.AppBarLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</code>```

The result i get, when i start the app:
After starting app

This looks first fine. But if i swipe or click on logs, chat or faq, i get this:
After swipe to another fragment

Where i have my mistake?

Body:
I have an activity with tablayout and four fragments. This works fine and i can swipe between the fragments.
But now i need a tablayout within one of this fragments for a submenu. So there will be two tablayout on top of each other. I thought i can do the same like in activity in the fragment. But it doesn't work how i hoped :D

Know is my question, is this possible or i need something else to get a submenu in a fragment?

MainActivity:

    public class MainActivity extends AppCompatActivity implements TabLayoutMediator.TabConfigurationStrategy{
ViewPager2 viewPager2;
TabLayout tabLayout;
ArrayList<String> titles;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        viewPager2 = findViewById(R.id.vp2MainMenu);
        tabLayout = findViewById(R.id.tlMainMenu);
        titles = new ArrayList<String>();
        titles.add("Dashboard");
        titles.add("Logs");
        titles.add("Chat");
        titles.add("FAQ");
        setViewPagerAdapter();
        new TabLayoutMediator(tabLayout, viewPager2, this).attach();
    }

    public void setViewPagerAdapter() {
        TabMainAdapter tabMainAdapter = new
                TabMainAdapter(this);
        ArrayList<Fragment> fragmentList = new ArrayList<>(); //creates an ArrayList of Fragments
        fragmentList.add(new DashboardFragment());
        fragmentList.add(new LogsFragment());
        fragmentList.add(new ChatFragment());
        fragmentList.add(new FaqFragment());
        tabMainAdapter.setData(fragmentList); //sets the data for the adapter
        viewPager2.setAdapter(tabMainAdapter);
    }

    @Override
    public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
        tab.setText(titles.get(position));
    }

    public class TabMainAdapter extends FragmentStateAdapter {
        private ArrayList<Fragment> fragments;

        public TabMainAdapter(@NonNull FragmentActivity fragmentActivity) {
            super(fragmentActivity);

        }

        @NonNull
        @Override
        public Fragment createFragment(int position) {
            return fragments.get(position);
        }

        @Override
        public int getItemCount() {
            return fragments.size();
        }

        public void setData(ArrayList<Fragment> fragments) {
            this.fragments = fragments;
        }
    }
}

activity_man.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tlMainMenu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabMode="scrollable"
        app:layout_constraintTop_toTopOf="parent"
        android:background="@color/black" />

    <androidx.viewpager2.widget.ViewPager2
        android:id="@+id/vp2MainMenu"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintTop_toBottomOf="@id/tlMainMenu"
        app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

"Main" fragment with tablayout and the submenu fragment:

public class LogsFragment extends Fragment implements TabLayoutMediator.TabConfigurationStrategy{

    //global variables
    ViewPager2 viewPager2;
    TabLayout tabLayout;
    ArrayList<String> titles;

    public LogsFragment() {
        // Required empty public constructor
    }

    public static LogsFragment newInstance(String param1, String param2) {
        LogsFragment fragment = new LogsFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getActivity().setContentView(R.layout.fragment_logs);

        viewPager2 = getActivity().findViewById(R.id.viewpager);
        tabLayout = getActivity().findViewById(R.id.result_tabs);
        titles = new ArrayList<String>();
        titles.add("Shop");
        titles.add("Tribe");
        setViewPagerAdapter();
        new TabLayoutMediator(tabLayout, viewPager2, this).attach();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootview =  inflater.inflate(R.layout.fragment_logs,container,false);

        return rootview;
    }

    public void setViewPagerAdapter() {
        TabLogsAdapter tabMainAdapter = new
                TabLogsAdapter(getActivity());
        ArrayList<Fragment> fragmentList = new ArrayList<>(); //creates an ArrayList of Fragments
        fragmentList.add(new LogsShopFragment());
        fragmentList.add(new LogsTribeFragment());
        //and more fragment for the submenu
        tabMainAdapter.setData(fragmentList); //sets the data for the adapter
        viewPager2.setAdapter(tabMainAdapter);
    }

    @Override
    public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
        tab.setText(titles.get(position));
    }

    public class TabLogsAdapter extends FragmentStateAdapter {
        private ArrayList<Fragment> fragments;
        public TabLogsAdapter(@NonNull FragmentActivity fragmentActivity) {
            super(fragmentActivity);

        }

        @NonNull
        @Override
        public Fragment createFragment(int position) {
            return fragments.get(position);
        }

        @Override
        public int getItemCount() {
            return fragments.size();
        }

        public void setData(ArrayList<Fragment> fragments) {
            this.fragments = fragments;
        }
    }
}

fragment_logs.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            tools:ignore="MissingConstraints">

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/result_tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabMode="scrollable"
                app:layout_constraintTop_toTopOf="parent"
                android:background="@color/black" />

            <androidx.viewpager2.widget.ViewPager2
                android:id="@+id/viewpager"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:layout_constraintTop_toBottomOf="@id/result_tabs"
                app:layout_constraintBottom_toBottomOf="parent"/>
        </com.google.android.material.appbar.AppBarLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

The result i get, when i start the app:
After starting app

This looks first fine. But if i swipe or click on logs, chat or faq, i get this:
After swipe to another fragment

Where i have my mistake?


问:
Javascript Integer Point [X,Y] is in or on Polygon [[X,Y],[X,Y],...]
When looking around for a way to determine if a point [X,Y] is within or on a polygon [[X,Y],[X,Y],...] I am running into the issue where the upper bounds (maxX and maxY) are being ignored.

Example:
point = [10,10]
polygon = [[0,0],[10,0],[10,10],[0,10]]

EDIT: polygon could look like [[0,0],[10,0],[10,10],[0,10],[0,0]] if needed; shape may vary and will include convex and concave polygons

It should return true for all cases where the integer is in or on the polygon

I tried nearly every google results/stackoverflow for point in polygon and each equation presented has the same upper bound issue where either I increase all points in the polygon to be 1 greater for all maxX and maxY for it to work properly.

Here are some links to functions I have been trying to use

Check if Point Is Inside A Polygon

Point inside a polygon javascript

How to check if point is in polygon in Javascript

Our usecase will only contain integer coordinates; this is for a game we are working on determining if a player is within a specific region of coordinates to label the region. Open to suggestions for best way to handle doing this.

Currently I have to do something like

```<code>function increaseUpperLimit( polygon ) {
  let maxX = -10000000
  let maxY = -10000000
  polygon.forEach(coordinate => {
    if(coordinate[0] > maxX)
      maxX = coordinate[0]
    if(coordinate[1] > maxY)
      maxY = coordinate[1]
  })
  polygon.forEach(coordinate => {
    if(coordinate[0] == maxX)
      coordinate[0] += 1
    if(coordinate[1] == maxY)
      coordinate[1] += 1
  })
  return polygon
}
</code>```

This increase for all points at max fixes the issue, but it would be more ideal to just fix the original equation to include the upper bounding X and Y

Body:
When looking around for a way to determine if a point [X,Y] is within or on a polygon [[X,Y],[X,Y],...] I am running into the issue where the upper bounds (maxX and maxY) are being ignored.

Example:
point = [10,10]
polygon = [[0,0],[10,0],[10,10],[0,10]]

EDIT: polygon could look like [[0,0],[10,0],[10,10],[0,10],[0,0]] if needed; shape may vary and will include convex and concave polygons

It should return true for all cases where the integer is in or on the polygon

I tried nearly every google results/stackoverflow for point in polygon and each equation presented has the same upper bound issue where either I increase all points in the polygon to be 1 greater for all maxX and maxY for it to work properly.

Here are some links to functions I have been trying to use

Check if Point Is Inside A Polygon

Point inside a polygon javascript

How to check if point is in polygon in Javascript

Our usecase will only contain integer coordinates; this is for a game we are working on determining if a player is within a specific region of coordinates to label the region. Open to suggestions for best way to handle doing this.

Currently I have to do something like

function increaseUpperLimit( polygon ) {
  let maxX = -10000000
  let maxY = -10000000
  polygon.forEach(coordinate => {
    if(coordinate[0] > maxX)
      maxX = coordinate[0]
    if(coordinate[1] > maxY)
      maxY = coordinate[1]
  })
  polygon.forEach(coordinate => {
    if(coordinate[0] == maxX)
      coordinate[0] += 1
    if(coordinate[1] == maxY)
      coordinate[1] += 1
  })
  return polygon
}

This increase for all points at max fixes the issue, but it would be more ideal to just fix the original equation to include the upper bounding X and Y


问:
Command text was not set for the command object
I have this code that I am trying to work in it I am using VB.NET and MS ACCESS as DATA BASE..  As I go along with my code I have encountered many problems such as : Command text was not set for the command object.... Does any one have the idea on how to fix this and can you critique my code for possible mistake?? It will be a huge help for my project.... Thanks Ahead!</p>
```<code>Imports System.Data.OleDb

Public Class Form2

    Dim conn As New OleDb.OleDbConnection
    Dim Myconnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ADMIN\source\repos\TrooTeaFinal\Database\Loginform.accdb"
    Dim da As New OleDb.OleDbDataAdapter
    Dim result As Integer
    Dim imgpath As String
    Dim arrImage() As Byte
    Dim sql As String

    Private Sub ChkBoxRegShowpass_CheckedChanged(sender As Object, e As EventArgs) Handles ChkBoxRegShowpass.CheckedChanged
        If ChkBoxRegShowpass.Checked = True Then
            TxtRegpass.UseSystemPasswordChar = True
        Else
            TxtRegpass.UseSystemPasswordChar = False
        End If
    End Sub

    Private Sub BtnRegClear_Click(sender As Object, e As EventArgs) Handles BtnRegClear.Click
        ComboRole.Text = ""
        TxtRegLastname.Text = ""
        TxtRegFirstname.Text = ""
        TxtRegUsername.Text = ""
        TxtRegpass.Text = ""
    End Sub

    Private Sub BtnRegExit_Click(sender As Object, e As EventArgs) Handles BtnRegExit.Click
        End
    End Sub

    Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles BtnBack.Click
        Me.Hide()
        Form1.Show()
        ComboRole.Text = ""
        TxtRegLastname.Text = ""
        TxtRegFirstname.Text = ""
        TxtRegUsername.Text = ""
        TxtRegpass.Text = ""
    End Sub

    Private Sub BtnBrowse_Click(sender As Object, e As EventArgs) Handles BtnBrowse.Click
        Try

            Dim OFD As FileDialog = New OpenFileDialog()

            OFD.Filter = "Image File (*.jpg;*.bmp;*.gif)|*.jpg;*.bmp;*.gif"

            If OFD.ShowDialog() = DialogResult.OK Then
                imgpath = OFD.FileName
                PBoxProfilepic.ImageLocation = imgpath

            End If

            OFD = Nothing

        Catch ex As Exception
            MsgBox(ex.Message.ToString())
        End Try
    End Sub

    Private Sub BtnRegisterAccount_Click(sender As Object, e As EventArgs) Handles BtnRegisterAccount.Click
        Try

            Dim mstream As New System.IO.MemoryStream()

            PBoxProfilepic.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
            arrImage = mstream.GetBuffer()
            Dim FileSize As UInt32
            FileSize = mstream.Length
            mstream.Close()

            conn.ConnectionString = Myconnection
            conn.Open()
            Dim cmd As New OleDb.OleDbCommand("INSERT INTO member([LASTNAME], [FIRSTNAME], [Role], [USERNAME], [PASSWORD], [Profile]) VALUES (@LASTNAME, @FIRSTNAME, @Role, @USERNAME, @PASSWORD, @Profile)", conn)

            cmd.Connection = conn
            cmd.CommandText = sql
            cmd.Parameters.AddWithValue("@LASTNAME", TxtRegLastname.Text)
            cmd.Parameters.AddWithValue("@FIRSTNAME", TxtRegLastname.Text)
            cmd.Parameters.AddWithValue("@Role", ComboRole.Text)
            cmd.Parameters.AddWithValue("@USERNAME", TxtRegUsername.Text)
            cmd.Parameters.AddWithValue("@PASSWORD", TxtRegpass.Text)
            cmd.Parameters.AddWithValue("@Profile", arrImage)
            Dim r As Integer
            r = cmd.ExecuteNonQuery()
            If r > 0 Then
                MsgBox("User Record hass been Saved!")
            Else
                MsgBox("No record has been saved!")
            End If
            conn.Close()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class
</code>```

Body:
I have this code that I am trying to work in it I am using VB.NET and MS ACCESS as DATA BASE..  As I go along with my code I have encountered many problems such as : Command text was not set for the command object.... Does any one have the idea on how to fix this and can you critique my code for possible mistake?? It will be a huge help for my project.... Thanks Ahead!

Imports System.Data.OleDb

Public Class Form2

    Dim conn As New OleDb.OleDbConnection
    Dim Myconnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ADMIN\source\repos\TrooTeaFinal\Database\Loginform.accdb"
    Dim da As New OleDb.OleDbDataAdapter
    Dim result As Integer
    Dim imgpath As String
    Dim arrImage() As Byte
    Dim sql As String

    Private Sub ChkBoxRegShowpass_CheckedChanged(sender As Object, e As EventArgs) Handles ChkBoxRegShowpass.CheckedChanged
        If ChkBoxRegShowpass.Checked = True Then
            TxtRegpass.UseSystemPasswordChar = True
        Else
            TxtRegpass.UseSystemPasswordChar = False
        End If
    End Sub

    Private Sub BtnRegClear_Click(sender As Object, e As EventArgs) Handles BtnRegClear.Click
        ComboRole.Text = ""
        TxtRegLastname.Text = ""
        TxtRegFirstname.Text = ""
        TxtRegUsername.Text = ""
        TxtRegpass.Text = ""
    End Sub

    Private Sub BtnRegExit_Click(sender As Object, e As EventArgs) Handles BtnRegExit.Click
        End
    End Sub

    Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles BtnBack.Click
        Me.Hide()
        Form1.Show()
        ComboRole.Text = ""
        TxtRegLastname.Text = ""
        TxtRegFirstname.Text = ""
        TxtRegUsername.Text = ""
        TxtRegpass.Text = ""
    End Sub

    Private Sub BtnBrowse_Click(sender As Object, e As EventArgs) Handles BtnBrowse.Click
        Try

            Dim OFD As FileDialog = New OpenFileDialog()

            OFD.Filter = "Image File (*.jpg;*.bmp;*.gif)|*.jpg;*.bmp;*.gif"

            If OFD.ShowDialog() = DialogResult.OK Then
                imgpath = OFD.FileName
                PBoxProfilepic.ImageLocation = imgpath

            End If

            OFD = Nothing

        Catch ex As Exception
            MsgBox(ex.Message.ToString())
        End Try
    End Sub

    Private Sub BtnRegisterAccount_Click(sender As Object, e As EventArgs) Handles BtnRegisterAccount.Click
        Try

            Dim mstream As New System.IO.MemoryStream()

            PBoxProfilepic.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
            arrImage = mstream.GetBuffer()
            Dim FileSize As UInt32
            FileSize = mstream.Length
            mstream.Close()

            conn.ConnectionString = Myconnection
            conn.Open()
            Dim cmd As New OleDb.OleDbCommand("INSERT INTO member([LASTNAME], [FIRSTNAME], [Role], [USERNAME], [PASSWORD], [Profile]) VALUES (@LASTNAME, @FIRSTNAME, @Role, @USERNAME, @PASSWORD, @Profile)", conn)

            cmd.Connection = conn
            cmd.CommandText = sql
            cmd.Parameters.AddWithValue("@LASTNAME", TxtRegLastname.Text)
            cmd.Parameters.AddWithValue("@FIRSTNAME", TxtRegLastname.Text)
            cmd.Parameters.AddWithValue("@Role", ComboRole.Text)
            cmd.Parameters.AddWithValue("@USERNAME", TxtRegUsername.Text)
            cmd.Parameters.AddWithValue("@PASSWORD", TxtRegpass.Text)
            cmd.Parameters.AddWithValue("@Profile", arrImage)
            Dim r As Integer
            r = cmd.ExecuteNonQuery()
            If r > 0 Then
                MsgBox("User Record hass been Saved!")
            Else
                MsgBox("No record has been saved!")
            End If
            conn.Close()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class


问:
Unable to install mimix package on my windows laptop
I am trying to install mimix package by simply typing:

```<code>install.packages("remotes")
remotes::install_github("UCL/mimix")
</code>```

I got this instruction from https://rdrr.io/github/UCL/mimix/.

My problem is I get this error message:

```<code>Error in parse(outFile) :C:/Users/WC/AppData/Local/Temp/RtmpsjKHP6/R.INSTALL4258415545b8/RefBasedMI/R/Runmimix.R:768:7
unexpected 'else'
767:         #else if(!is.null(methodindiv[1]))
768:     } else
</code>```

Body:
I am trying to install mimix package by simply typing:

install.packages("remotes")
remotes::install_github("UCL/mimix")

I got this instruction from https://rdrr.io/github/UCL/mimix/.

My problem is I get this error message:

Error in parse(outFile) :C:/Users/WC/AppData/Local/Temp/RtmpsjKHP6/R.INSTALL4258415545b8/RefBasedMI/R/Runmimix.R:768:7
unexpected 'else'
767:         #else if(!is.null(methodindiv[1]))
768:     } else


问:
Depth Information and RGB Recoverable Conversion Method
I am currently trying to do some machine learning tasks with depth information obtained using Intel® RealSense™ Depth Cameras.

I am investigating algorithms that can convert depth information into RGB images and recover the original depth information from the RGB images.

Intel has published an official method (https://dev.intelrealsense.com/docs/depth-image-compression-by-colorization-for-intel-realsense-depth-cameras). I tried it in Python, but it did not work and did not give the expected results, as if the branching formula listed was incorrect.

If anyone knows of any better way, I'd appreciate it, thanks!


问:
How to use audio from discord so recognize_google can understand
I am trying to take audio said in a discord Voice chat and put it inside the recognize_google function to find what is said in the VC. I am doing it by using the pycord libary for record and stop_recording and once_done is a callback function for stop_recording.

This is my code- as you can see I go through every file and I make an AudioData object using file.fp.read(). I don't get any error when I run the code it is just that the recognize_google funtion does not understand the words I am saying. Thank you in advance for any help :)

```<code>import discord
import speech_recognition as sr

async def once_done(sink: discord.sinks, channel: discord.TextChannel, *args):

    r = sr.Recognizer()

    await sink.vc.disconnect()  # Disconnect from the voice channel.
    files = [discord.File(audio.file, f"{user_id}.{sink.encoding}") for user_id, audio in sink.audio_data.items()]  # List down the files.

    for file in files:
        try:
            audio_data = sr.AudioData(file.fp.read(), 48000, 2)

            text = r.recognize_google(audio_data=audio_data).lower()
</code>```

Body:
I am trying to take audio said in a discord Voice chat and put it inside the recognize_google function to find what is said in the VC. I am doing it by using the pycord libary for record and stop_recording and once_done is a callback function for stop_recording.

This is my code- as you can see I go through every file and I make an AudioData object using file.fp.read(). I don't get any error when I run the code it is just that the recognize_google funtion does not understand the words I am saying. Thank you in advance for any help :)

import discord
import speech_recognition as sr

async def once_done(sink: discord.sinks, channel: discord.TextChannel, *args):

    r = sr.Recognizer()

    await sink.vc.disconnect()  # Disconnect from the voice channel.
    files = [discord.File(audio.file, f"{user_id}.{sink.encoding}") for user_id, audio in sink.audio_data.items()]  # List down the files.

    for file in files:
        try:
            audio_data = sr.AudioData(file.fp.read(), 48000, 2)

            text = r.recognize_google(audio_data=audio_data).lower()


问:
How to make an array in database?
I create an a array of wordsParasits in firebase:

```<code>   set(ref(db, 'users/' + res.data.localId), {
            ArrOfParasites: [],
}
</code>```

How can i update it?
If i try like this, it doesn't work:

```<code>  update(ref(db, 'users/' + user.localId), {
    ArrOfParasites: filteredArr.push()
// if i try this, outpi looks like: ArrOfParasites : 4
}
</code>```

Filtered array looks like:

```<code>[["блин", 1], ["допустим", 1], ["фактически", 1], ["получается", 1]]
</code>```

I need to update all array in firebase db

Title: How to make an array in database?

Body:
I create an a array of wordsParasits in firebase:

   set(ref(db, 'users/' + res.data.localId), {
            ArrOfParasites: [],
}

How can i update it?
If i try like this, it doesn't work:

  update(ref(db, 'users/' + user.localId), {
    ArrOfParasites: filteredArr.push()
// if i try this, outpi looks like: ArrOfParasites : 4
}

Filtered array looks like:

[["блин", 1], ["допустим", 1], ["фактически", 1], ["получается", 1]]

I need to update all array in firebase db


问:
Getting the position of the tile map in relation to the rest of the game objects
FYI On about in Unity in 2D

The tile map (which is under the grid) has a different position then other game object I create.
No matter where I create the tile maps object, they have a position of (0,0,0).
However I want to get the position of the tile map object in relation to the centre of the world.
the following is screenshots of the objects:

The boxes on the top right is the rest of the objects and the centre of the world.

I've tried stuff I've found on the internet but really understood it and it hasn't worked so if you could explain your solutions too that would be a great help.


问:
create cloud function with trigger cloud storage
I'm trying to deploy a cloud function from the serverless framework, and setting as a trigger that is activated when files are created in a bucket, but it doesn't work and I can't find more information about this in the documentation

serverless.yml

```<code>read-file:
handler: ReadFile
events:
  - event:
      eventType: providers/cloud.storage/eventTypes/google.storage.object.archive
      resource: "projects/${self:provider.project}/buckets/${env:BUCKET_NAME_GS}"
memorySize: 128
environment:
  AUDIENCE_AUTH0: ${env:AUDIENCE_AUTH0}
  DOMAIN_AUTH0: ${env:DOMAIN_AUTH0}
</code>```

serverless response:

```<code>{
"code":400,
"message":"The request has errors",
"status":"INVALID_ARGUMENT",
"details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"event_trigger","description":"Unknown event_type providers/cloud.storage/eventTypes/google.storage.object.archive"
}
</code>```

Body:
I'm trying to deploy a cloud function from the serverless framework, and setting as a trigger that is activated when files are created in a bucket, but it doesn't work and I can't find more information about this in the documentation

serverless.yml

read-file:
handler: ReadFile
events:
  - event:
      eventType: providers/cloud.storage/eventTypes/google.storage.object.archive
      resource: "projects/${self:provider.project}/buckets/${env:BUCKET_NAME_GS}"
memorySize: 128
environment:
  AUDIENCE_AUTH0: ${env:AUDIENCE_AUTH0}
  DOMAIN_AUTH0: ${env:DOMAIN_AUTH0}

serverless response:

{
"code":400,
"message":"The request has errors",
"status":"INVALID_ARGUMENT",
"details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"event_trigger","description":"Unknown event_type providers/cloud.storage/eventTypes/google.storage.object.archive"
}


问:
Onboarding Windows 2008 R2 to Defender for Cloud
I was trying to onboard Windows 2008 R2 to Defender for Cloud via Azure Arc. On the docs sites, there's information that this version is supported and also, with Defender for Servers plan 2 you will get a licences for MDE (Microsoft Defender for Endpoint).

The onboarding was done but only MMA extension was installed but MDE extensions not which resulted in error saying "no supported version".

Does anybody met this issues before ? What's the way how to proceed with onboarding ? Maybe through SCEP ?

Thank you


问:
Problem finding the right syntax for group() and by() commands
I have the following Gremlin code:

g.V('body4608', 'body491')
    .repeat(
        __.as('body')
        .in().aggregate('allVertices')
        .bothE().as('edges')
        .otherV().as('otherV')
        .where('otherV', within('allVertices')).as('vertices')
        .dedup()
    )
    .until(
        __.count().is(1))
//    .group()
//        .by(__.select('body').id())
//        .by(select('vertices').id().dedup().fold()).as('gVertices')

    .group()
        .by(__.select('body').id())
        .by(select('edges').label().fold()).as('gEdges')
```
<p>Each of the <code>group()</code> commands work individually where the output look like this for the 'edges':</p>
````{'body4608': ['add', 'add', 'start', 'push', 'push_task_through', 'add'],
  'body491': ['can_claim_task_for', 'is_in', 'Additionally_should_familiarize', 'can_claim_task_for', 'are_assigned_to', 'are', 'are_assigned_to', 'completes', 'can_use']}
```

What I would like to achieve is to include the words from the group that currently is commented out in the list of words from the 'edge' group so that I will have a combined list of words for each 'body'

Body:
I have the following Gremlin code:

g.V('body4608', 'body491')
    .repeat(
        __.as('body')
        .in().aggregate('allVertices')
        .bothE().as('edges')
        .otherV().as('otherV')
        .where('otherV', within('allVertices')).as('vertices')
        .dedup()
    )
    .until(
        __.count().is(1))
//    .group()
//        .by(__.select('body').id())
//        .by(select('vertices').id().dedup().fold()).as('gVertices')

    .group()
        .by(__.select('body').id())
        .by(select('edges').label().fold()).as('gEdges')

Each of the group() commands work individually where the output look like this for the 'edges':

`{'body4608': ['add', 'add', 'start', 'push', 'push_task_through', 'add'],
  'body491': ['can_claim_task_for', 'is_in', 'Additionally_should_familiarize', 'can_claim_task_for', 'are_assigned_to', 'are', 'are_assigned_to', 'completes', 'can_use']}

What I would like to achieve is to include the words from the group that currently is commented out in the list of words from the 'edge' group so that I will have a combined list of words for each 'body'


问:
seekg() before each .get() call VS seekg() before for loop
I am just trying to read simple text file with ifstream. Suppose my text file looks like this (I don't know how to properly format it here, so here is how I wrote it notepad):
a\tb\nc\t\d\n

Output from reading text file using .seekg() before each .get() differs from output when .seekg() is called only before for loop (see output).

Question:

Is this expected behaviour? If yes then why is it happening?

Code:

```<code>#include <iostream>
#include <fstream>

using namespace std;

int main()
{

    ifstream myfile("test.txt");
    if (myfile)
    {

        cout << "Using seekg before each myfile.get():" << endl;
        cout << "***********************" << endl;
        myfile.seekg(0);
        cout << (char)myfile.get();
        myfile.seekg(1);
        cout << (char)myfile.get();
        myfile.seekg(2);
        cout << (char)myfile.get();
        myfile.seekg(3);
        cout << (char)myfile.get();
        myfile.seekg(4);
        cout << (char)myfile.get() << endl;
        cout << "***********************" << endl;

        cout << "Using seekg only before loop:" << endl;
        cout << "***********************" << endl;
        myfile.seekg(0);
        for (int i = 0; i <= 4; i++)
        {
            cout << (char)myfile.get();
        }
        cout << endl;
        cout << "***********************" << endl;

        myfile.close();
    }

}
</code>```

Output:

Output after running above code

After debugging:

In text file:

a is at position 0

'\t' is at position 1

b is at position 2

when .seekg(3) is used right before .get() then .get() returns '\n'

when .seekg(4) is used right before .get() then .get() returns '\n' also

when .seekg(0) is used only before for loop (see code) then .get() only returns single '\n' at position 3/4 , meaning '\n' is at the position 3 and 'c' is at position 4

Body:
I am just trying to read simple text file with ifstream. Suppose my text file looks like this (I don't know how to properly format it here, so here is how I wrote it notepad):
a\tb\nc\t\d\n

Output from reading text file using .seekg() before each .get() differs from output when .seekg() is called only before for loop (see output).

Question:

Is this expected behaviour? If yes then why is it happening?

Code:

#include <iostream>
#include <fstream>

using namespace std;

int main()
{

    ifstream myfile("test.txt");
    if (myfile)
    {

        cout << "Using seekg before each myfile.get():" << endl;
        cout << "***********************" << endl;
        myfile.seekg(0);
        cout << (char)myfile.get();
        myfile.seekg(1);
        cout << (char)myfile.get();
        myfile.seekg(2);
        cout << (char)myfile.get();
        myfile.seekg(3);
        cout << (char)myfile.get();
        myfile.seekg(4);
        cout << (char)myfile.get() << endl;
        cout << "***********************" << endl;

        cout << "Using seekg only before loop:" << endl;
        cout << "***********************" << endl;
        myfile.seekg(0);
        for (int i = 0; i <= 4; i++)
        {
            cout << (char)myfile.get();
        }
        cout << endl;
        cout << "***********************" << endl;

        myfile.close();
    }

}

Output:

Output after running above code

After debugging:

In text file:

a is at position 0

'\t' is at position 1

b is at position 2

when .seekg(3) is used right before .get() then .get() returns '\n'

when .seekg(4) is used right before .get() then .get() returns '\n' also

when .seekg(0) is used only before for loop (see code) then .get() only returns single '\n' at position 3/4 , meaning '\n' is at the position 3 and 'c' is at position 4


问:
why doesn't enemy spawn
I have a script where i clone enemy from replicated storage and make folder in the workspace a parent of an enemy. But, when i run code, it doesn't show any error and enemy doesn't spawn. I don't what I have to do. HELP

Code:

```<code>local player = game:GetService("Players").LocalPlayer
local rs = game:GetService("ReplicatedStorage")
local anim = rs.EnemiesScripts:FindFirstChild("Animation"):Clone()
local move = rs.EnemiesScripts:FindFirstChild("Movement"):Clone()
local hpBar = rs.BillboardUi.HpBar:Clone()

for i, island in ipairs(workspace:WaitForChild("Islands"):GetDescendants()) do
    for i,v in ipairs(island:GetChildren()) do
        if v:IsA("ObjectValue") then
            if v.Value == player  then
                print("1")
                local marine = rs.Enemies.OnePiece.Marine2:Clone()
                hpBar.Parent = marine
                move.Parent = marine
                anim.Parent = marine
                marine.Parent = island.Bodies:FindFirstChild("Enemies")
                marine.HumanoidRootPart.CFrame = island:FindFirstChild("enemySpawner").CFrame * CFrame.new(0,10,0) * CFrame.Angles(0,3.2,0)
                print("2")
            end
            print("is value")
        end

    end
end
</code>```

Title: why doesn't enemy spawn

Body:
I have a script where i clone enemy from replicated storage and make folder in the workspace a parent of an enemy. But, when i run code, it doesn't show any error and enemy doesn't spawn. I don't what I have to do. HELP

Code:

local player = game:GetService("Players").LocalPlayer
local rs = game:GetService("ReplicatedStorage")
local anim = rs.EnemiesScripts:FindFirstChild("Animation"):Clone()
local move = rs.EnemiesScripts:FindFirstChild("Movement"):Clone()
local hpBar = rs.BillboardUi.HpBar:Clone()

for i, island in ipairs(workspace:WaitForChild("Islands"):GetDescendants()) do
    for i,v in ipairs(island:GetChildren()) do
        if v:IsA("ObjectValue") then
            if v.Value == player  then
                print("1")
                local marine = rs.Enemies.OnePiece.Marine2:Clone()
                hpBar.Parent = marine
                move.Parent = marine
                anim.Parent = marine
                marine.Parent = island.Bodies:FindFirstChild("Enemies")
                marine.HumanoidRootPart.CFrame = island:FindFirstChild("enemySpawner").CFrame * CFrame.new(0,10,0) * CFrame.Angles(0,3.2,0)
                print("2")
            end
            print("is value")
        end

    end
end


问:
Learning to use Fetch for API
I'm just learning how to fetch data using online tutorials. I have this component working

```<code><!DOCTYPE html>
<html>
<body>

<h1>JavaScript Fetch API</h1>
<h2>The fetch() Method</h2>
<p id="demo">Fetch a file to change this text.</p>

<script>
fetch ("https://gbfs.citibikenyc.com/gbfs/en/station_information.json")
.then(x => x.text())
.then(y => document.getElementById("demo").innerHTML = y);
</script>

</body>
</html>
</code>```

My next goal is to convert the data to json and then print the json data to the console (browser). I changed the script to be as follows, but this doesn't produce the result. Can someone suggest how I might fix my code to display the result as the json object?

```<code><script>
fetch ("https://gbfs.citibikenyc.com/gbfs/en/station_information.json")
.then(file => file.json())
.then(data => console.log(data));
</script>
</code>```

Title: Learning to use Fetch for API

Body:
I'm just learning how to fetch data using online tutorials. I have this component working

<!DOCTYPE html>

JavaScript Fetch API

The fetch() Method

Fetch a file to change this text.

My next goal is to convert the data to json and then print the json data to the console (browser). I changed the script to be as follows, but this doesn't produce the result. Can someone suggest how I might fix my code to display the result as the json object?


问:
Compose Card always overdrawn

Issue

Compose card surface shows always overdrawn. However, it's not the case if we use old style CardView in xml.

From here it's always recommended to reduce overdrawing of any view to make it more towards green, blue.

Just this following code will produce some output like this, which means it's overdrawn 3 or 4 times.

```<code> Card(
        elevation = CardDefaults.cardElevation(defaultElevation = 10.dp),
        modifier = modifier.fillMaxWidth().padding(vertical = 10.dp)
       ) {
        Column(
            modifier = Modifier
                .padding(all = 16.dp)
        ) {
            Text("randomText")
        }
    }
</code>```

I tried to look into NowInAndroid sample application but even that produces all red output when debugged to show overdrawn areas.

Question

Is the Debug GPU Overdraw option in developer settings giving right information?

Can we really avoid this overdraw? If so, how?

Title: Compose Card always overdrawn

Body:
Issue

Compose card surface shows always overdrawn. However, it's not the case if we use old style CardView in xml.

From here it's always recommended to reduce overdrawing of any view to make it more towards green, blue.

Just this following code will produce some output like this, which means it's overdrawn 3 or 4 times.

 Card(
        elevation = CardDefaults.cardElevation(defaultElevation = 10.dp),
        modifier = modifier.fillMaxWidth().padding(vertical = 10.dp)
       ) {
        Column(
            modifier = Modifier
                .padding(all = 16.dp)
        ) {
            Text("randomText")
        }
    }

I tried to look into NowInAndroid sample application but even that produces all red output when debugged to show overdrawn areas.

Question

Is the Debug GPU Overdraw option in developer settings giving right information?

Can we really avoid this overdraw? If so, how?