问:
I'm seeing a lot of konnectivity-agent errors in Logs Explorer, is this a problem? how do I fix it?
It's basically three repeating errors</p>
```<code>"could not read stream..."
"connection read failure..."
"conn write failure..."
</code>```

Body:
It's basically three repeating errors

"could not read stream..."
"connection read failure..."
"conn write failure..."


来源: stackexchange

问:
Understanding mice's loggedEvents
I'm having trouble understanding what loggedEvents in mice mean. I don't know how to reproduce this error and I can't share my data, but don't think this is necessary.

Mice outputs LoggedEvents as a DF with 5 columns:
it, imp, dep, meth and out

According to https://cran.r-project.org/web/packages/mice/mice.pdf page 143, these are

it iteration number at which the record was added,

im imputation
number, dep name of the dependent variable,

meth imputation
method used,

out a (possibly long) character vector with the names
of the altered or removed predictors.

my question is: how do I know what the actual issue is? i have an event logged for every single column, with meth filled with "pmm" (which is my selected imputation method), while the out column in 28 out of 33 cases has the same three columns (patient age, i.e. numeric; diagnosis date, i.e. date; and finally some lab result value, numeric as well). How do I know what the problem is or what causes it?

ContentLicense: CC BY-SA 4.0

Title: Understanding mice's loggedEvents


问:
How do you scale real-life coordinates into computer-readable coordinates? (tkinter lab)
problem:

im trying to print the 48 states of USA with tkinter canvas, but there seems to be a problem with the scaling/dimensions of the code. I have tried debugging the list comprehesion and all i got was a list of very very high numbers much larger than the width and height of the canvas window. How do i fix this?

note: lab313.txt is the data file of latitude and longitude points of USA (excluding hawaii and alaska)

```<code>from tkinter import Tk , Canvas
#
w , h = 640 , 480
#
root = Tk()
#
cnvs = Canvas( root , width = w , height = h , bg = 'white' )
#
cnvs . pack()

def usa():
   global w,h
   ###code for max and min of whole list
   j = open('lab313.txt', "r").read().split()
   m = []
   k = 0
   while j[k] != 'END_FILE':
      k+=1
      while j[k] != 'END_ALL_POLY' :
         while j[k] != 'END_ONE_POLY' :
            m.append(j[k])
            k += 1
            m.append(j[k])
            k += 1
         k+=1
      k+=1
   long = m[::2]
   lati = m[1::2]
   lonmin = float(min(long))
   lonmax = float(max(long))
   latmin = float(min(lati))
   latmax = float(max(lati))

   ###
   x = open('lab313.txt', "r").read().split()
   l = []
   abrev = []
   i = 0
   while x[i] != 'END_FILE':
      abrev.append(x[i])
      i+=1
      while x[i] != 'END_ALL_POLY' :
         while x[i] != 'END_ONE_POLY' :
            l.append(float(x[i]))
            i += 1
            l.append(float(x[i]))
            i += 1

         lon = l[::2]
         lat = l[1::2]
         lon =[int((h*(o-lonmin))/(lonmax-lonmin))for o in lon]
         print(lon)
         lat =[int((w*(o-latmin))/(latmax-latmin))for o in lat]
         l[::2] = lon
         l[1::2] = lat

         cnvs . create_polygon(l, fill = 'green' , outline = 'black' )
         l.clear()
         i+= 1 #endone
      i += 1 #endall
def main() :
   global lonmin, lonmax, latmin, latmax
   usa()

   #
   #
   root . mainloop()
   #
#
if __name__ == '__main__' :

   main()
   #
</code>```

Body:
problem:

im trying to print the 48 states of USA with tkinter canvas, but there seems to be a problem with the scaling/dimensions of the code. I have tried debugging the list comprehesion and all i got was a list of very very high numbers much larger than the width and height of the canvas window. How do i fix this?

note: lab313.txt is the data file of latitude and longitude points of USA (excluding hawaii and alaska)

from tkinter import Tk , Canvas
#
w , h = 640 , 480
#
root = Tk()
#
cnvs = Canvas( root , width = w , height = h , bg = 'white' )
#
cnvs . pack()

def usa():
   global w,h
   ###code for max and min of whole list
   j = open('lab313.txt', "r").read().split()
   m = []
   k = 0
   while j[k] != 'END_FILE':
      k+=1
      while j[k] != 'END_ALL_POLY' :
         while j[k] != 'END_ONE_POLY' :
            m.append(j[k])
            k += 1
            m.append(j[k])
            k += 1
         k+=1
      k+=1
   long = m[::2]
   lati = m[1::2]
   lonmin = float(min(long))
   lonmax = float(max(long))
   latmin = float(min(lati))
   latmax = float(max(lati))

   ###
   x = open('lab313.txt', "r").read().split()
   l = []
   abrev = []
   i = 0
   while x[i] != 'END_FILE':
      abrev.append(x[i])
      i+=1
      while x[i] != 'END_ALL_POLY' :
         while x[i] != 'END_ONE_POLY' :
            l.append(float(x[i]))
            i += 1
            l.append(float(x[i]))
            i += 1

         lon = l[::2]
         lat = l[1::2]
         lon =[int((h*(o-lonmin))/(lonmax-lonmin))for o in lon]
         print(lon)
         lat =[int((w*(o-latmin))/(latmax-latmin))for o in lat]
         l[::2] = lon
         l[1::2] = lat

         cnvs . create_polygon(l, fill = 'green' , outline = 'black' )
         l.clear()
         i+= 1 #endone
      i += 1 #endall
def main() :
   global lonmin, lonmax, latmin, latmax
   usa()

   #
   #
   root . mainloop()
   #
#
if __name__ == '__main__' :

   main()
   #


问:
Apollo refetchQueries unit test with vue testing library
I am new to graphql and apollo. I have a useMutation query which on completion perform a refetchQueries operation of 2 other queries. How to write a unit for refetchQueries specific, so that if I remove the refetchQueries code my test should fail.

I am using vitest, vite, vue3, apollo, graphql, vue-testing-library and msw for mocking.

Note: The queries which I want to perform in refetchQueries will reflect data change in some other component and will not be visible in the current component, so the assertion which I am looking something like this:

```<code>expect(getQuery1).toHaveBeenCalled()
</code>```

Is it possible to perform this assertion?

Body:
I am new to graphql and apollo. I have a useMutation query which on completion perform a refetchQueries operation of 2 other queries. How to write a unit for refetchQueries specific, so that if I remove the refetchQueries code my test should fail.

I am using vitest, vite, vue3, apollo, graphql, vue-testing-library and msw for mocking.

Note: The queries which I want to perform in refetchQueries will reflect data change in some other component and will not be visible in the current component, so the assertion which I am looking something like this:

expect(getQuery1).toHaveBeenCalled()

Is it possible to perform this assertion?


问:
Before Delete Trigger With Update Other Rows Postgres
I have a table with a foreign key column referencing the same table. This is to do a grouping. I will have one group_master, and then every item in the table that is sufficiently similar to the group_master has a FK referencing that group_master id.

On delete, if the group_master is deleted, I need to update the group to have a new master so I use a Before delete trigger and in the trigger I identify the rows to be updated. Trigger and function code included below.

```<code>        CREATE OR REPLACE FUNCTION assign_new_group_master()
        RETURNS TRIGGER
        LANGUAGE plpgsql
        AS
        $$
        DECLARE
            new_group_master details%ROWTYPE;
        BEGIN
            IF (SELECT COUNT(*) FROM details WHERE group_master_id = old.id AND old.id <> id) = 0
                THEN RETURN old;
            END IF;
            SELECT * INTO new_group_master
                FROM details
                WHERE group_master_id = old.id AND old.id <> id
                ORDER BY similarity_to_master DESC
                LIMIT 1;
            UPDATE details
                SET group_master_id = new_group_master.id
                WHERE group_master_id = old.id AND id <> old.id;
            PERFORM pg_notify('group_master_id_updated'::Text,row_to_json(new_group_master)::text);
            RETURN old;
        END;
        $$;

        CREATE TRIGGER group_master_deleted_trigger
        BEFORE DELETE ON details
        FOR EACH ROW
        WHEN (old.id = old.group_master_id)
        EXECUTE FUNCTION assign_new_group_master();
</code>```

This works great when deleting 1 detail element. The problem is if I try to delete many detail elements at 1, it is likely that I am deleting 2 items from the same group which causes this error to be thrown.

```<code>ERROR:  tuple to be updated was already modified by an operation triggered by the current command
HINT:  Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.
SQL state: 27000
</code>```

As far as I understand, this is because 1 group_master gets deleted, all its children are updated, then the new group_master gets deleted and so all its children need to be updated again which is not allowed.

How can I get around this issue? I can not change to an After trigger as the hint suggests because then I would be violating the FK constraints of the group_master_id on the children.

Thanks

Body:
I have a table with a foreign key column referencing the same table. This is to do a grouping. I will have one group_master, and then every item in the table that is sufficiently similar to the group_master has a FK referencing that group_master id.

On delete, if the group_master is deleted, I need to update the group to have a new master so I use a Before delete trigger and in the trigger I identify the rows to be updated. Trigger and function code included below.

        CREATE OR REPLACE FUNCTION assign_new_group_master()
        RETURNS TRIGGER
        LANGUAGE plpgsql
        AS
        $$
        DECLARE
            new_group_master details%ROWTYPE;
        BEGIN
            IF (SELECT COUNT(*) FROM details WHERE group_master_id = old.id AND old.id <> id) = 0
                THEN RETURN old;
            END IF;
            SELECT * INTO new_group_master
                FROM details
                WHERE group_master_id = old.id AND old.id <> id
                ORDER BY similarity_to_master DESC
                LIMIT 1;
            UPDATE details
                SET group_master_id = new_group_master.id
                WHERE group_master_id = old.id AND id <> old.id;
            PERFORM pg_notify('group_master_id_updated'::Text,row_to_json(new_group_master)::text);
            RETURN old;
        END;
        $$;

        CREATE TRIGGER group_master_deleted_trigger
        BEFORE DELETE ON details
        FOR EACH ROW
        WHEN (old.id = old.group_master_id)
        EXECUTE FUNCTION assign_new_group_master();

This works great when deleting 1 detail element. The problem is if I try to delete many detail elements at 1, it is likely that I am deleting 2 items from the same group which causes this error to be thrown.

ERROR:  tuple to be updated was already modified by an operation triggered by the current command
HINT:  Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows.
SQL state: 27000

As far as I understand, this is because 1 group_master gets deleted, all its children are updated, then the new group_master gets deleted and so all its children need to be updated again which is not allowed.

How can I get around this issue? I can not change to an After trigger as the hint suggests because then I would be violating the FK constraints of the group_master_id on the children.

Thanks


问:
'WaveSurfer' only refers to a type, but is being used as a namespace here
As I merged the work from one of my classmates, for who this works without any problems. I'm getting this error for every WaveSurfer.Region[] in the angular project.

Here is the import (everything worked until now):

```<code>import WaveSurfer from 'wavesurfer.js';
</code>```

and i'm using it like this :

```<code>export class WaveformComponent implements OnInit, AfterViewInit {
  subscriptionFileNameChange: Subscription | undefined;
  trsData: JSON = {} as JSON;
  trsClusters: string[] = [];
  trsClustersColors: {string : number[]} = {} as {string : number[]};
  trsClustersRegions: {string : WaveSurfer.Region[]} = {} as {string : WaveSurfer.Region[]};
</code>```

I tried editing the tsconfig file with 'es2015' and 'es2016', doesn't work

Body:
As I merged the work from one of my classmates, for who this works without any problems. I'm getting this error for every WaveSurfer.Region[] in the angular project.

Here is the import (everything worked until now):

import WaveSurfer from 'wavesurfer.js';

and i'm using it like this :

export class WaveformComponent implements OnInit, AfterViewInit {
  subscriptionFileNameChange: Subscription | undefined;
  trsData: JSON = {} as JSON;
  trsClusters: string[] = [];
  trsClustersColors: {string : number[]} = {} as {string : number[]};
  trsClustersRegions: {string : WaveSurfer.Region[]} = {} as {string : WaveSurfer.Region[]};

I tried editing the tsconfig file with 'es2015' and 'es2016', doesn't work


问:
Default Google tooltip in angular
How to display a Google tooltip on top, if button is at bottom of
. In my condition the tooltip is half hidden.

Tooltip is displaying bottom half hidden

Title: Default Google tooltip in angular


问:
Storing and fetching line-breaks in MySQL with PHP Data Objects
I'm currently building a SQL database for articles with PHP. However when SELECTING and echoing the result set (which is fetched as an array with PDO) I can't seem to figure out how to echo out the result as html. I'm currently printing the result set out as plain text which makes it impossible to use html elements like
 and
.

Is it common practice to print out content as HTML or is there another standardised way of solving this issue of not being able to paragraph your content.

This is in short how the code currently looks like in the file for the article page:

SELECTING AND FETCHING OF SQL

```<code>$sql = "SELECT a.content, a.id FROM articles AS a WHERE a.id = :id;";
$article = pdo($pdo, $sql, [$id])->fetch();
</code>```

[...]

PRINTING OF RESULTS

```<code><div>
    <p><?= html_escape($article['content']) ?></p>
</div>
</code>```

The result of this will be that all text no matter how its written into the database will be in the same paragraph.

EDIT:

This is the user-defined function used to return PDO

```<code>function pdo(PDO $pdo, string $sql, array $arguments = null)
{
    $statement = $pdo->prepare($sql);
    $statement->execute($arguments);
    return $statement;
}
</code>```

Body:
I'm currently building a SQL database for articles with PHP. However when SELECTING and echoing the result set (which is fetched as an array with PDO) I can't seem to figure out how to echo out the result as html. I'm currently printing the result set out as plain text which makes it impossible to use html elements like
 and
.

Is it common practice to print out content as HTML or is there another standardised way of solving this issue of not being able to paragraph your content.

This is in short how the code currently looks like in the file for the article page:

SELECTING AND FETCHING OF SQL

$sql = "SELECT a.content, a.id FROM articles AS a WHERE a.id = :id;";
$article = pdo($pdo, $sql, [$id])->fetch();

[...]

PRINTING OF RESULTS

<?= html_escape($article['content']) ?>

The result of this will be that all text no matter how its written into the database will be in the same paragraph.

EDIT:

This is the user-defined function used to return PDO

function pdo(PDO $pdo, string $sql, array $arguments = null)
{
    $statement = $pdo->prepare($sql);
    $statement->execute($arguments);
    return $statement;
}


问:
Django case insensitive search in multilevel jsonb field using ORM methods
here is my sample jsonb field:

{
  "name": "XXXXX",
  "duedate": "Wed Aug 31 2022 17:23:13 GMT+0530",
  "structure": {
    "sections": [
      {
        "id": "0",
        "temp_id": 9,
        "expanded": true,
        "requests": [
          {
            "title": "entity onboarding form", # I need to lookup at this level (or key)
            "agents": [
              {
                "email": "ak@xxx.com",
                "user_name": "Akhild",
                "review_status": 0
              }
            ],
            "req_id": "XXXXXXXX",
            "status": "Requested"
          },
          {
            "title": "onboarding", # I need to lookup at this level (or key)
            "agents": [
              {
                "email": "adak@xxx.com",
                "user_name": "gaajj",
                "review_status": 0
              }
            ],
            "req_id": "XXXXXXXX",
            "status": "Requested"
          }
        ],
        "labelText": "Pan Card"
      }
    ]
  },
  "Agentnames": "",
  "clientowners": "Admin",
  "collectionname": "Bank_duplicate"
}
```
<p>In this JSON i need to do case insensitive match for structure->section->request(array)-> title inside each object of request array
I have tried this query filter</p>
```(Q(requests__structure__sections__contains=[{'requests':[{"title": query}]}]))
```
<p>but it becomes case sensitive. Also i have tried</p>
```self.get_queryset().annotate(search=SearchVector(Cast('requests__structure__sections', TextField()))
```

which does gives case insensitive result but also lookup among the keys other than title.

also i tried raw sql where i cannot go beyond the request array.

Im expecting any other method or any other approach in django orm that can be used to achieve the require result.

Body:
here is my sample jsonb field:

{
  "name": "XXXXX",
  "duedate": "Wed Aug 31 2022 17:23:13 GMT+0530",
  "structure": {
    "sections": [
      {
        "id": "0",
        "temp_id": 9,
        "expanded": true,
        "requests": [
          {
            "title": "entity onboarding form", # I need to lookup at this level (or key)
            "agents": [
              {
                "email": "ak@xxx.com",
                "user_name": "Akhild",
                "review_status": 0
              }
            ],
            "req_id": "XXXXXXXX",
            "status": "Requested"
          },
          {
            "title": "onboarding", # I need to lookup at this level (or key)
            "agents": [
              {
                "email": "adak@xxx.com",
                "user_name": "gaajj",
                "review_status": 0
              }
            ],
            "req_id": "XXXXXXXX",
            "status": "Requested"
          }
        ],
        "labelText": "Pan Card"
      }
    ]
  },
  "Agentnames": "",
  "clientowners": "Admin",
  "collectionname": "Bank_duplicate"
}

In this JSON i need to do case insensitive match for structure->section->request(array)-> title inside each object of request array
I have tried this query filter

(Q(requests__structure__sections__contains=[{'requests':[{"title": query}]}]))

but it becomes case sensitive. Also i have tried

self.get_queryset().annotate(search=SearchVector(Cast('requests__structure__sections', TextField()))

which does gives case insensitive result but also lookup among the keys other than title.

also i tried raw sql where i cannot go beyond the request array.

Im expecting any other method or any other approach in django orm that can be used to achieve the require result.


问:
UIDocumentPickerViewController initForExportingURLs asCopy creates zero length file on network volume
I'm using the following code snippet in a Mac Catalyst app to "export" (copy) a file from an URL to a user-selected URL:

UIDocumentPickerViewController* documentPicker = [[UIDocumentPickerViewController alloc] initForExportingURLs:@[ [[NSURL alloc] initFileURLWithPath:path]  ] asCopy:YES];

This works as expected if a local folder is picked (the file in path is copied there). However, if a network folder is picked (in this case, SMB), a zero-length file is generated and no error is shown.

Does anyone know what might cause this?


问:
Initialize pydantic model with missing parameters
I have the following two pydantic models for a Users table in my database for a FastAPI application:

```<code>from fastapi import Form
from pydantic import BaseModel

class UserCreate(BaseModel):
  username: str = Form(...)
  password: str = Form(...)

class UserInDb(BaseModel):
  id: int
  username:str
  hashed_password: str

</code>```

I use the UserCreate class to get form data needed from the client to create a user and then I map it to UserInDb. This is how I initially implemented it:

```<code>password = user_create_instance.password
hashed_password = some_hashing_function(password)
user_in_db = UserInDb(**user_create_instance.dict(), hashed_password=hashed_password)
</code>```

This however throws a value_error.missing error because user_create_instance does not have an id parameter which UserInDb expects to be passed in but the value for that comes from the database.

This issue is fixable by doing something like id: int = None when defining the attribute in the class but it doesn't feel right to do it this way. Is there a better approach?

Body:
I have the following two pydantic models for a Users table in my database for a FastAPI application:

from fastapi import Form
from pydantic import BaseModel

class UserCreate(BaseModel):
  username: str = Form(...)
  password: str = Form(...)

class UserInDb(BaseModel):
  id: int
  username:str
  hashed_password: str

I use the UserCreate class to get form data needed from the client to create a user and then I map it to UserInDb. This is how I initially implemented it:

password = user_create_instance.password
hashed_password = some_hashing_function(password)
user_in_db = UserInDb(**user_create_instance.dict(), hashed_password=hashed_password)

This however throws a value_error.missing error because user_create_instance does not have an id parameter which UserInDb expects to be passed in but the value for that comes from the database.

This issue is fixable by doing something like id: int = None when defining the attribute in the class but it doesn't feel right to do it this way. Is there a better approach?


问:
How can we scrape the data from chromium bugs?
`I was trying to scrape the data from chromium but I was not able to scrape the data. If anyone have any solution would really appreaciate

```<code>import requests
from bs4 import BeautifulSoup

url = 'https://bugs.chromium.org/p/chromium/issues/detail?id=1406673'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.find('div', class_='container-outside')
title
if title:
    title = title.find('aside', class_='metadata-container').find('div', class_='container-issue').find('div', class_='issue-header-container').find('h2').text.strip()
    print(title)`your text`
else:
    print("Title not found")
</code>```

it's showing Title not found!

Body:
`I was trying to scrape the data from chromium but I was not able to scrape the data. If anyone have any solution would really appreaciate

import requests
from bs4 import BeautifulSoup

url = 'https://bugs.chromium.org/p/chromium/issues/detail?id=1406673'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.find('div', class_='container-outside')
title
if title:
    title = title.find('aside', class_='metadata-container').find('div', class_='container-issue').find('div', class_='issue-header-container').find('h2').text.strip()
    print(title)`your text`
else:
    print("Title not found")

it's showing Title not found!


问:
Python3.7.9 to 3.11.1 venv activation issue
Why does my python version/path change from 3.11 to 3.7 when I activate the venv.

I have already set the PowerShell path to 3.11.1 which is recognized by Python before activating the venv and once it's deactivated.


问:
Add different WordPress excerpt formats to different templates
I added the following code to my functions.php file in WordPress 6.1.1 to display excerpts.

```<code>function new_excerpt_length($length) {
    return 100;
    }
add_filter('excerpt_length', 'new_excerpt_length');

function new_excerpt_more($more) {
    return '...';
    }
add_filter('excerpt_more', 'new_excerpt_more');
</code>```

...but I also have a use case to show the full excerpt without a read more link.

On page template 1 I add the below code to display the excerpt:

```<code><?php echo the_excerpt(); ?>
</code>```

...and it displays the excerpt as per the functions.php file but how do I create a 2nd excerpt without the read more link and apply it to page template 2?

Is there a parameter I can use within the_excerpt(parameter); or can I use something like wp_trim_excerpt https://developer.wordpress.org/reference/functions/wp_trim_excerpt/ maybe?

I came across the below code that is supposed to do what I want

```<code>function wpex_get_excerpt( $args = array() ) {

    // Default arguments.
    $defaults = array(
        'post'            => '',
        'length'          => 40,
        'readmore'        => false,
        'readmore_text'   => esc_html__( 'read more', 'text-domain' ),
        'readmore_after'  => '',
        'custom_excerpts' => true,
        'disable_more'    => false,
    );

    // Apply filters to allow child themes mods.
    $args = apply_filters( 'wpex_excerpt_defaults', $defaults );

    // Parse arguments, takes the function arguments and combines them with the defaults.
    $args = wp_parse_args( $args, $defaults );

    // Apply filters to allow child themes mods.
    $args = apply_filters( 'wpex_excerpt_args', $args );

    // Extract arguments to make it easier to use below.
    extract( $args );

    // Get the current post.
        $post = get_post( $post );

    // Get the current post id.
    $post_id = $post->ID;

    // Check for custom excerpts.
    if ( $custom_excerpts && has_excerpt( $post_id ) ) {
        $output = $post->post_excerpt;
    }

    // No custom excerpt...so lets generate one.
    else {

        // Create the readmore link.
        $readmore_link = '<a href="' . esc_url( get_permalink( $post_id ) ) . '" class="readmore">' . $readmore_text . $readmore_after . '</a>';

        // Check for more tag and return content if it exists.
        if ( ! $disable_more && strpos( $post->post_content, '<!--more-->' ) ) {
            $output = apply_filters( 'the_content', get_the_content( $readmore_text . $readmore_after ) );
        }

        // No more tag defined so generate excerpt using wp_trim_words.
        else {

            // Generate an excerpt from the post content.
            $output = wp_trim_words( strip_shortcodes( $post->post_content ), $length );

            // Add the readmore text to the excerpt if enabled.
            if ( $readmore ) {

                $output .= apply_filters( 'wpex_readmore_link', $readmore_link );

            }

        }

    }

    // Apply filters and return the excerpt.
    return apply_filters( 'wpex_excerpt', $output );

}
</code>```

Output using:

```<code><?php echo wpex_get_excerpt ( $defaults = array(
    'length'          => 40,
    'readmore'        => true,
    'readmore_text'   => esc_html__( 'read more', 'wpex-boutique' ),
    'custom_excerpts' => true,
) ); ?>
</code>```

...but doesn't seem to workas intended. Outputs the excerpt with no link but the args don't see to work when changed.  Would be perfect for my use otherwise. Maybe someone sees how to fix this code?

Thanks

Body:
I added the following code to my functions.php file in WordPress 6.1.1 to display excerpts.

function new_excerpt_length($length) {
    return 100;
    }
add_filter('excerpt_length', 'new_excerpt_length');

function new_excerpt_more($more) {
    return '...';
    }
add_filter('excerpt_more', 'new_excerpt_more');

...but I also have a use case to show the full excerpt without a read more link.

On page template 1 I add the below code to display the excerpt:

<?php echo the_excerpt(); ?>

...and it displays the excerpt as per the functions.php file but how do I create a 2nd excerpt without the read more link and apply it to page template 2?

Is there a parameter I can use within the_excerpt(parameter); or can I use something like wp_trim_excerpt https://developer.wordpress.org/reference/functions/wp_trim_excerpt/ maybe?

I came across the below code that is supposed to do what I want

function wpex_get_excerpt( $args = array() ) {

    // Default arguments.
    $defaults = array(
        'post'            => '',
        'length'          => 40,
        'readmore'        => false,
        'readmore_text'   => esc_html__( 'read more', 'text-domain' ),
        'readmore_after'  => '',
        'custom_excerpts' => true,
        'disable_more'    => false,
    );

    // Apply filters to allow child themes mods.
    $args = apply_filters( 'wpex_excerpt_defaults', $defaults );

    // Parse arguments, takes the function arguments and combines them with the defaults.
    $args = wp_parse_args( $args, $defaults );

    // Apply filters to allow child themes mods.
    $args = apply_filters( 'wpex_excerpt_args', $args );

    // Extract arguments to make it easier to use below.
    extract( $args );

    // Get the current post.
        $post = get_post( $post );

    // Get the current post id.
    $post_id = $post->ID;

    // Check for custom excerpts.
    if ( $custom_excerpts && has_excerpt( $post_id ) ) {
        $output = $post->post_excerpt;
    }

    // No custom excerpt...so lets generate one.
    else {

        // Create the readmore link.
        $readmore_link = '' . $readmore_text . $readmore_after . '';

        // Check for more tag and return content if it exists.
        if ( ! $disable_more && strpos( $post->post_content, '' ) ) {
            $output = apply_filters( 'the_content', get_the_content( $readmore_text . $readmore_after ) );
        }

        // No more tag defined so generate excerpt using wp_trim_words.
        else {

            // Generate an excerpt from the post content.
            $output = wp_trim_words( strip_shortcodes( $post->post_content ), $length );

            // Add the readmore text to the excerpt if enabled.
            if ( $readmore ) {

                $output .= apply_filters( 'wpex_readmore_link', $readmore_link );

            }

        }

    }

    // Apply filters and return the excerpt.
    return apply_filters( 'wpex_excerpt', $output );

}

Output using:

<?php echo wpex_get_excerpt ( $defaults = array(
    'length'          => 40,
    'readmore'        => true,
    'readmore_text'   => esc_html__( 'read more', 'wpex-boutique' ),
    'custom_excerpts' => true,
) ); ?>

...but doesn't seem to workas intended. Outputs the excerpt with no link but the args don't see to work when changed.  Would be perfect for my use otherwise. Maybe someone sees how to fix this code?

Thanks


问:
REGEXP_COUNT equivalent in Spark SQL
Is there an equivalent function in Spark SQL that does what REGEXP_COUNT do as in redshift?

Basically I'm trying to count the number of substrings.

```<code>REGEXP('1->2->3->456', '->')
</code>```

should return 3.

Title: REGEXP_COUNT equivalent in Spark SQL

Body:
Is there an equivalent function in Spark SQL that does what REGEXP_COUNT do as in redshift?

Basically I'm trying to count the number of substrings.

REGEXP('1->2->3->456', '->')

should return 3.


问:
How do I implement restore purchase button in ios app if I store subscription info in the database?
I submitted my app to the App Store for review and I received a feedback saying that I need to implement "Restore purchase" button.

I don't understand how I should implement it because my app requires users to sign up and login. And if user buys a subscription I store this information in the database. So basically if user logs in into the app he always gets access to his subscription.

Please advice,
Thank you


问:
How do I find the correct time zone ID for a given location?
Is there some way to determine the time zone ID of a given location?  For example, North Carolina; I search and find it uses "Eastern Time Zone" which isn't a ZoneId.  I also find that it is currently using EDT but will later use EST, which also doesn't help.  I assume I should use "America/New_York" but just finding that string was challenging enough and I still have no gaurantee (that I can find) that I'm using the correct ZoneId for North Carolina.

Some Kotlin to help find zones that might work for North Carolina:

```<code>import java.time.*
import java.time.ZoneId.getAvailableZoneIds

fun getAvailableZoneIdsOfHours(hours: Int) =
    getAvailableZoneIds()
        .map { ZoneId.of(it) }
        .map { it to it.rules.getStandardOffset(Instant.now()) }
        .filter { it.second == ZoneOffset.ofHours(hours) }

fun main() {
    getAvailableZoneIdsOfHours(-5).forEach { println(it.first) }
}
</code>```
```<code>America/Panama -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Petersburg -> ZoneRules[currentStandardOffset=-05:00]
America/Eirunepe -> ZoneRules[currentStandardOffset=-05:00]
America/Grand_Turk -> ZoneRules[currentStandardOffset=-05:00]
America/Fort_Wayne -> ZoneRules[currentStandardOffset=-05:00]
America/Havana -> ZoneRules[currentStandardOffset=-05:00]
America/Porto_Acre -> ZoneRules[currentStandardOffset=-05:00]
America/Louisville -> ZoneRules[currentStandardOffset=-05:00]
America/Guayaquil -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Vevay -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Vincennes -> ZoneRules[currentStandardOffset=-05:00]
America/Indianapolis -> ZoneRules[currentStandardOffset=-05:00]
America/Iqaluit -> ZoneRules[currentStandardOffset=-05:00]
America/Kentucky/Louisville -> ZoneRules[currentStandardOffset=-05:00]
America/Nassau -> ZoneRules[currentStandardOffset=-05:00]
America/Jamaica -> ZoneRules[currentStandardOffset=-05:00]
America/Atikokan -> ZoneRules[currentStandardOffset=-05:00]
America/Kentucky/Monticello -> ZoneRules[currentStandardOffset=-05:00]
America/Coral_Harbour -> ZoneRules[currentStandardOffset=-05:00]
America/Cayman -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Indianapolis -> ZoneRules[currentStandardOffset=-05:00]
America/Thunder_Bay -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Marengo -> ZoneRules[currentStandardOffset=-05:00]
America/Bogota -> ZoneRules[currentStandardOffset=-05:00]
America/Port-au-Prince -> ZoneRules[currentStandardOffset=-05:00]
America/Nipigon -> ZoneRules[currentStandardOffset=-05:00]
America/Cancun -> ZoneRules[currentStandardOffset=-05:00]
America/Lima -> ZoneRules[currentStandardOffset=-05:00]
America/Rio_Branco -> ZoneRules[currentStandardOffset=-05:00]
America/Detroit -> ZoneRules[currentStandardOffset=-05:00]
America/Pangnirtung -> ZoneRules[currentStandardOffset=-05:00]
America/Montreal -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Winamac -> ZoneRules[currentStandardOffset=-05:00]
America/New_York -> ZoneRules[currentStandardOffset=-05:00]
America/Toronto -> ZoneRules[currentStandardOffset=-05:00]
</code>```

Given all of those, how does someone choose the correct one?

Body:
Is there some way to determine the time zone ID of a given location?  For example, North Carolina; I search and find it uses "Eastern Time Zone" which isn't a ZoneId.  I also find that it is currently using EDT but will later use EST, which also doesn't help.  I assume I should use "America/New_York" but just finding that string was challenging enough and I still have no gaurantee (that I can find) that I'm using the correct ZoneId for North Carolina.

Some Kotlin to help find zones that might work for North Carolina:

import java.time.*
import java.time.ZoneId.getAvailableZoneIds

fun getAvailableZoneIdsOfHours(hours: Int) =
    getAvailableZoneIds()
        .map { ZoneId.of(it) }
        .map { it to it.rules.getStandardOffset(Instant.now()) }
        .filter { it.second == ZoneOffset.ofHours(hours) }

fun main() {
    getAvailableZoneIdsOfHours(-5).forEach { println(it.first) }
}

America/Panama -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Petersburg -> ZoneRules[currentStandardOffset=-05:00]
America/Eirunepe -> ZoneRules[currentStandardOffset=-05:00]
America/Grand_Turk -> ZoneRules[currentStandardOffset=-05:00]
America/Fort_Wayne -> ZoneRules[currentStandardOffset=-05:00]
America/Havana -> ZoneRules[currentStandardOffset=-05:00]
America/Porto_Acre -> ZoneRules[currentStandardOffset=-05:00]
America/Louisville -> ZoneRules[currentStandardOffset=-05:00]
America/Guayaquil -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Vevay -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Vincennes -> ZoneRules[currentStandardOffset=-05:00]
America/Indianapolis -> ZoneRules[currentStandardOffset=-05:00]
America/Iqaluit -> ZoneRules[currentStandardOffset=-05:00]
America/Kentucky/Louisville -> ZoneRules[currentStandardOffset=-05:00]
America/Nassau -> ZoneRules[currentStandardOffset=-05:00]
America/Jamaica -> ZoneRules[currentStandardOffset=-05:00]
America/Atikokan -> ZoneRules[currentStandardOffset=-05:00]
America/Kentucky/Monticello -> ZoneRules[currentStandardOffset=-05:00]
America/Coral_Harbour -> ZoneRules[currentStandardOffset=-05:00]
America/Cayman -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Indianapolis -> ZoneRules[currentStandardOffset=-05:00]
America/Thunder_Bay -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Marengo -> ZoneRules[currentStandardOffset=-05:00]
America/Bogota -> ZoneRules[currentStandardOffset=-05:00]
America/Port-au-Prince -> ZoneRules[currentStandardOffset=-05:00]
America/Nipigon -> ZoneRules[currentStandardOffset=-05:00]
America/Cancun -> ZoneRules[currentStandardOffset=-05:00]
America/Lima -> ZoneRules[currentStandardOffset=-05:00]
America/Rio_Branco -> ZoneRules[currentStandardOffset=-05:00]
America/Detroit -> ZoneRules[currentStandardOffset=-05:00]
America/Pangnirtung -> ZoneRules[currentStandardOffset=-05:00]
America/Montreal -> ZoneRules[currentStandardOffset=-05:00]
America/Indiana/Winamac -> ZoneRules[currentStandardOffset=-05:00]
America/New_York -> ZoneRules[currentStandardOffset=-05:00]
America/Toronto -> ZoneRules[currentStandardOffset=-05:00]

Given all of those, how does someone choose the correct one?


问:
Woocommerce how to get specific product quantity in php code
I am new to developing with woocommerce, and I recently found a way to display all of the names of my products and also the quantity. However, I was only able to display ALL of my products, and not just each one individually. If I try and remove the foreach loop, I get an error stating:
Undefined index: data in /filepath of folder.

If anyone has ever been able to display a single quantity of a product in woocommerce, please let me know!

```<code>$items = $woocommerce->cart->get_cart();

    foreach($items as $item => $values) {
        echo " ";

        $_product =  wc_get_product( $values['data']->get_id());
        echo "<b>".$_product->get_title().'</b>  <br> Quantity: '.$values['quantity'].'<br>';
        $price = get_post_meta($values['product_id'] , '_price', true);
        echo "  Price: ".$price."<br>";
    }`
</code>```

I was able to display each of the name and quantity of each product. However, when I tried to reverse engineer the foreach loop, I recieved an error:
Undefined index: data in /filepath of folder.

Body:
I am new to developing with woocommerce, and I recently found a way to display all of the names of my products and also the quantity. However, I was only able to display ALL of my products, and not just each one individually. If I try and remove the foreach loop, I get an error stating:
Undefined index: data in /filepath of folder.

If anyone has ever been able to display a single quantity of a product in woocommerce, please let me know!

$items = $woocommerce->cart->get_cart();

    foreach($items as $item => $values) {
        echo " ";

        $_product =  wc_get_product( $values['data']->get_id());
        echo "".$_product->get_title().'
 Quantity: '.$values['quantity'].'
';
        $price = get_post_meta($values['product_id'] , '_price', true);
        echo "  Price: ".$price."
";
    }`

I was able to display each of the name and quantity of each product. However, when I tried to reverse engineer the foreach loop, I recieved an error:
Undefined index: data in /filepath of folder.


问:
How to test ARKit app using ARGeoTrackingConfig in unsupported area?
I have downloaded and installed this project from Apple ARKit documentation and when opening it says GeoLocation tracking is unsupported in this area. I have gone through the details and in the documentation India is not listed in supported countries or areas.

I want to try this method to test my app, and for that need a recorded session from the Reality Composer app. I searched over the internet to download a test session video but was not able to find it. If anyone can provide a solution for this.


问:
React does not respect the order of requests
Here are my custom hooks:

const useRefreshToken = () => {
    const { setAuth } = useAuth();

    const refresh = async () => {
        await axios.get('/refresh', {
            withCredentials: true
        }).then((response) => {
            setAuth((prev: any) => {
                return {
                    ...prev,
                    role: response.data.role,
                    accessToken: response.data.accessToken
                }
            });
            return response.data.accessToken;
        })
    }
    return refresh;
};

```
<pre class="lang-js prettyprint-override"><code>const useAccessToken = () => {
    const {auth} = useAuth()
    const refresh = useRefreshToken();
    const token = auth?.accessToken

    return async () => {
        if (token && isExpired(token)) {
            await refresh();
        }
    }
}
</code>```

const useAxiosPrivate = () => {
    const refresh = useRefreshToken();
    const { auth } = useAuth();

    useEffect(() => {
        const requestIntercept = axiosPrivate.interceptors.request.use(
            config => {
                if (config.headers !== undefined && !config.headers['Authorization']) {
                    config.headers['Authorization'] = `Bearer ${auth?.accessToken}`;
                }
                return config;
            }, (error) => Promise.reject(error)
        );

        const responseIntercept = axiosPrivate.interceptors.response.use(
            response => response,
            async (error) => {
                const prevRequest = error?.config;
                if (error?.response?.status === 403 && !prevRequest?.sent) {
                    prevRequest.sent = true;
                    const newAccessToken = await refresh();
                    prevRequest.headers['Authorization'] = `Bearer ${newAccessToken}`;
                    return axiosPrivate(prevRequest);
                }
                return Promise.reject(error);
            }
        );

        return () => {
            axiosPrivate.interceptors.request.eject(requestIntercept);
            axiosPrivate.interceptors.response.eject(responseIntercept);
        }
    }, [auth, refresh])

    return axiosPrivate;
}
```
<p>So I want to use <code>useAccessToken()</code> hook to check if the current <code>accessToken</code> in my state is not expired before requesting backend. If it is expired, then I need to use <code>useRefreshToken()</code> to ask backend for new tokens and when the expired token will be replaced with the new one, I wanna send the actual request to backend.</p>
<p>But when I try to use those hooks like this:</p>
<pre class="lang-js prettyprint-override"><code>const Api() {
    const axiosPrivate = useAxiosPrivate()
    const accessToken = useAccessToken()

    const exampleApiCall = async (data: Data) => {

        await accessToken().then(() =>
            axiosPrivate.post(`/api`, data)
        )

    }
}
</code>```

Then the request is sent with the old, expired accessToken. The new one is used when I invoke the request again but it does not satisfy me

Body:
Here are my custom hooks:

const useRefreshToken = () => {
    const { setAuth } = useAuth();

    const refresh = async () => {
        await axios.get('/refresh', {
            withCredentials: true
        }).then((response) => {
            setAuth((prev: any) => {
                return {
                    ...prev,
                    role: response.data.role,
                    accessToken: response.data.accessToken
                }
            });
            return response.data.accessToken;
        })
    }
    return refresh;
};

const useAccessToken = () => {
    const {auth} = useAuth()
    const refresh = useRefreshToken();
    const token = auth?.accessToken

    return async () => {
        if (token && isExpired(token)) {
            await refresh();
        }
    }
}

const useAxiosPrivate = () => {
    const refresh = useRefreshToken();
    const { auth } = useAuth();

    useEffect(() => {
        const requestIntercept = axiosPrivate.interceptors.request.use(
            config => {
                if (config.headers !== undefined && !config.headers['Authorization']) {
                    config.headers['Authorization'] = `Bearer ${auth?.accessToken}`;
                }
                return config;
            }, (error) => Promise.reject(error)
        );

        const responseIntercept = axiosPrivate.interceptors.response.use(
            response => response,
            async (error) => {
                const prevRequest = error?.config;
                if (error?.response?.status === 403 && !prevRequest?.sent) {
                    prevRequest.sent = true;
                    const newAccessToken = await refresh();
                    prevRequest.headers['Authorization'] = `Bearer ${newAccessToken}`;
                    return axiosPrivate(prevRequest);
                }
                return Promise.reject(error);
            }
        );

        return () => {
            axiosPrivate.interceptors.request.eject(requestIntercept);
            axiosPrivate.interceptors.response.eject(responseIntercept);
        }
    }, [auth, refresh])

    return axiosPrivate;
}

So I want to use useAccessToken() hook to check if the current accessToken in my state is not expired before requesting backend. If it is expired, then I need to use useRefreshToken() to ask backend for new tokens and when the expired token will be replaced with the new one, I wanna send the actual request to backend.

But when I try to use those hooks like this:

const Api() {
    const axiosPrivate = useAxiosPrivate()
    const accessToken = useAccessToken()

    const exampleApiCall = async (data: Data) => {

        await accessToken().then(() =>
            axiosPrivate.post(`/api`, data)
        )

    }
}

Then the request is sent with the old, expired accessToken. The new one is used when I invoke the request again but it does not satisfy me


问:
Trying to open a .ks-ipc file but the file type doesn't seem to exist and Word opens a string of random characters. Does anyone know what this is?
I'm home sick and trying to view a worksheet my teacher posted to Canvas. The file is listed on Canvas as a .ks-ipc file, here's a link to it in Google Drive: https://drive.google.com/drive/folders/110hWYFenrT5Ymz5twMsEroS3zVCLi7jN?usp=sharing

The file seemed to contain a bunch of random characters, which I think may or may not be raw bytes according to my limited internet research? Here is what it said:

æ@z gÊ/ Èc| ZI> ♥   ☻   ýµ

☺▼Ïxœí]ol∟G§Ÿ=Û‰c'qâ$ý♥$]%¡
R←Çi„H♦¨ÆiÁRm§±)♣   ¢õÝÆY¸?fw/‰)↕◄¨B¨jÂ↨ª"!ñ…OHù‚„„ø H >ô‼â_)T¨)►J¨PZ’▬³swïnï2gßì¼Ý  ›'|Þ }3û{¿7³óöÍ®A◘1→ÛÖÆßW☼‼2¼P]ò↔¿hï˜ ZüÄä±#‼ôïý“Ç>♦%†▬éá ³–ï:↨Íù§Ûµ|§Röàø–9«d?f-ÙÅAú«¹û¤å7vÓ_°{ô”í:•BíÀ¦úo846U(8TµU¬↔®µñ/Á ÍOØ®↨ì‡ö_§zfÊùbµ×ªìÜY«►vnkì¬WÖT°³±»UióÐöÆ¡Fµµý# º¯Ñj>n—♥eùÇ∟ÏÿÂ^º·~lm-h+™ž_¢•†‚ 2NfOÛVa¾\\ dù§w Q|sã/½ÄaÏ·\®Z2B¶↓)8® ¯ ýð‚SZ):gW☼›æ§\Ç·ÍýÕrÁ>ë”íÂ~ólÅ5í‹+®íÑöz¦ÎòMËµÍf™ÃPÑŽÒ™òÂŠ•·↨]Ë):ååË# ÷¬œñ|wºêù•ÒÉfÝÍFÞµrfé“ž}ÇñP“G♂¶—w §zà¾♠e aÓ*↨LJ7×ª ◘pnýbÕöè♫ ÛU“°ñÌÕðÜJf▼¹¸òxã„Á ÐØX½ð–£ÿO}lúä#&Àe♠È\èÄë„iÖ ▬”Î◄òÜÜ☼J/ÏÞØ•Ðƒ♀…\f0d«]ùs§'oÏxs•²=vñœíÙkk´u„¼▲∟ß]´<¶RpÎ:v RqÑ)Õ
’{¬b±raúNMF¨Ðx©¦%_s¸♣ßò«^¸1F
’Q2← }n~éó =(·ŠÁv4Øèo;Ø~§lÔþW‚í3
Ÿ♫♫æ6(7▲•Õ’
ÎÙ▲l♂ÁÁ4ÎƒKþNpùðÿ¡”t¼‼œ/ªã]†♫#´ÕÝÄuÊþ”7U].Ùeß.Ôý#è°àþ_L—É«c◘Ád„¡ƒ♥î°<↨ríúéC—zñ–ñF³DÍ²† é ☻¤↑ž$è♣††<iÈATð☻Œ♫îôÇ‚,y " ƒh/h]»¨Ž[Ú♂2♠9ˆö☻<“è± k ƒh/¨K.}“ô›↨H 9HØ♂♠Hwi§←¸♦Ñ7ZuôèÛ3‼;~²úÊ•×Œ6í™ˆ¾õÖQD · Ey↓±‰Ä‼*ãU↕—y;&•Œà<T°†‘¨pŒ¨¬~1Æî;Ã—ª’ÕY#™¢V↨¼T•¬Î→%¶µºà¥ªdõ„oÐ3|©*Y 0t(juÁK♣é´z71Ú~ÑmS¨¢ÑSne©h—▬WWl(C“$¶Î”V*nPñ£n¥´{¦∟Ì‹è∟é”kçb¾Z¬6skvÍ»Î²S¶Š'ùÒ*è¹ÛàÜéFäí ŸÖÊß™95ÝLI¡ç¼▬œs/œ³û¾S^ö▲¸Sùªã¯▲ì¸ân¨ ♫TÛ↑h›¯5ÜûšÑ*C'l{Éº →h¶Õy2Œ<™]$Œe(O¦7‼ \Z↨]8¨ º•▬☻§²\s¶Zô  ñõé¼yÁñÏ™5àó¶ÇDøÕ}]►^/‼‰☻↨=▬rß ¿üÓ¥7VŸ☻rƒd ▬↕)‼i”ô▬→aõô´,ÏhÑ↓w€(—,³Ï”îo¨ÝãD…¶#Ûˆ—♫,↔[↑:b¼Oês¸@Òf▼♠¶↑&aåGHÈ>Eà☻I›}↑PH g–ú>  à☻Q }↑↔B▼±O☻¸@ÒfŸ,CIFîû¶ ♂„?ÆÖJ9↑$"Óì▼▲▼Üóé•Þ↑¤½æ♀L³{sP‘yuŽaÝ$æÕ↑Ì$œmÏHN@TH1àÀÐÁZC!aÿª◘\ i³☼#☼ ♥NÁ\¦¤Ø§◘\ i³ •#Ÿ♠œÃ♀↔↕²O◄¸@4ûê’‘‘W◄¸@ÒfŸ,CIFØ§◘\ ü©üPAü¹+½>Œ ?åN¶Ú±å¯|Ýh•◄Í_ ƒýœaÑC♫ËzfÚ ‡♣¢9 ¼§‘!ÔŽ0‼Ó·▼ì‚ézY+¶ªèá´Ñ+OþáÖôæIp↔ ♀„ÓbÍZ   GÆh↓è×1Æ♣^↔C◘:0²V♠►Ú ±ò‡¥ƒc¬íÕì°E1;F@¶c•"♠ý V¬SÁ¸¹▬ñÆ·◄ ý{LOaxuì@Ðñ2Âµü6¹► 6½R¦•I»WÅxuü>¦¼¶^↔»◄®♣cŒ>Äh‡„½‚6½t¦•I»Wø3☻¶²Pã♠‚Ž♥♀³Ú+hÓKgz ´{♣Y♠Œ1„vPC‚☺£ßî§´é¥ë§L♦“Pãß’ÜFbL.3Ò+hÓKgz►‘÷¢ÑÇ©ÑŸª|õéñ↔7þµû↨F›öL<UÁMRîŒ§ƒ↓Òˆ…Ë²üˆŠ♀í►LYHâé↓Fv•♠Tq=µ’å±R„Î•
Æm↨l$%8è÷”dˆéofèˆévGCŽ☻9HÚ^€‘€ù^♦81tdÄ♂4äÒy☺F§‚☺ç@ú&IÊ♂4äÒyÁ←’ÜdJ’¤¼@C. ↨♀Ï↑Qv    L’¥;"E •    {AŽt↨£í↨Ýâ_ËÑ=)=¹Õ← ûàêY«7V V↓ÑÕ←►„í¯µ♣∟ë5X†Ù½♠ìT Ó»ïøX¶yhªXü ‼Õ ”º º©ËŠ ¯ŒÔ◄Œþlá»•o>ÿ·Ñg¯æ:¬” g♂±®Øˆò©▬Z&êˆ÷Ž$1aŒG#↑í ü“xe‡ÈkuÖ8áÁ¢X♫☺RŒ←"‚ ♥ãQ♫¯↔zÕ D±Î‡ Ð;§áIHë‘©%×D…ãg◘V◄AÇ▼Å˜Ã3‼Óp5%möaäæÀI÷e€}ŠÀ♣’6ûdqæŒ°O◄¸@4ûêò€↑œýÆ>A¸@Òf▼Æƒ§Œ°4Ë$↕²O◄¸@ø£çõä]→£+5¢•Ø&_↓¼ýf~mŸÑ¦=‼☺¶øß0Ì;7íœ‼G
…¼È☻#b↨×û\"x◘•´Ÿ´b¬↑¸Ž▬Œv∟►3♂O?¯!G ∟D♣/ EÇ½b&É’↨È¢C►r►§¼@–Ž© ¼@◄ÈAÒö‚}Ú$I{ †:/À€S◄“$å♣→rÔ↑↕ ▼E !½ôío\ûç³·ÞÍµiW(†Ôk¶•H¬‰7Ö↕Ž5↓ r$B½♥œõÆ•ªÂJ™áð‚¸ÌÂ{iXfÁ€¶#♦HÄÌ↕–´?6± q)¼:r◘:î↕ƒ”gˆÕp5%möa¬▼$◘:î◄ƒ3)ö)☻↨HÚìÛ)  œï◄ƒ3)ö)☻↨HÚìÃ↑J0àÌHß§◘\ *°o↑AÇëÉ¥Öh¸š↕õ½x4,BçýÑÃ"/þæûŸýåóç›♠☺Q&,"2¯æ}  @”♣o"^€1ÿæM▼êu♫Ïá♣Y‰ ↓◘:X&‹ÐaPI{ÈÂ˜ý¤H²^R á ¥◘\ i³☼Ã¡%€3)ö)☻↨HÚìÃHËfÝ;òêØ#♠gRìS♦.►§Ø' 3g‰}↕À♣¢ÙW↨Ö·x4ûâ‚♂D$TAçâÑC§sÏ¼ÿ[c3 ï2Ú´ëPEMèß¨) ÐN↕¡^Y>«‹‘F Ù{ØEÌ‚Ñé@Šñ WÁ¯↔óôó→r¶ÈA´↨à™D0Æª½ qÈA´↨Ô♣ãy›àK´úÍ♂$€∟D♣/ÀXj. I²ä♣Š@♫¢½ .↕♀Ïýæ♣↕@♫Òé♣Ý¤u¬§C¢ Q£Ç f♠☼~ôò“W,ƒ´×Üw1¤pü•6↕ ◄↑/‘Åˆÿ↑◘íéàw↕p‼„ËÄ0Y\ï♫ŽÐ™PI{qí›◘♀¾▼☺RÖw2xu°↕Âb→V5ä( ƒ¤í♣ÿ‘Ä$↑ SF¼@C. ↨ÜD0ÉÁ˜àÄ0«„^ !—Î♂0²]÷Ç♦'¯Žÿ&↨hÐ £@♫¢‚↨ü)¦ç¹Ú♂T‡∟„?Ü♠§ÄÿÙÃõ¾í▬ÿ‡☼ Žë
ÿ♠m ▼>|Êh•‼ýða¿~¤¯‡O▼®gš

}¸M↔T▼ì‚ªyaÂœ*.ÛKA♂òfPÞö˜XÏNtÁ:·Î•◄)„Ñ£ìwø{c§þ¹↨è¾pä2♥QöX?ˆÈêãy‼(Ã‘dƒ´rp1¢¯q·}£ ;Xªl„¶F↑ð¨¤ %?@ÄïCX)Û"6↕Å—ç▲Nc'çê
ŒÙÙ8‚Ž[↓ä¥ŠØ ¤ÍK♀Ÿß‚ £_ûKÙ°♥I›—↑÷8↑Ø†mœ§^ªˆ↔HÚ¼$◘¸Ä¥CB☻↨ˆÈ{´i³¢Ïíwñ›K?zßÓ☼↓↔5g`nŸì·Ø içÃ↔M¯3{‘„SƒðÑt„´, (BŽ♣Z↕ Ç¸m
gær7¾W
U♣Çigž‡?BÀí→"V¾Í¸)í¹b–Â◄Ö•♀ô¨PäJÆX§‹\ Ó&½^    Kaø+◄ ´ÙB◄&óÜ&h–↕¢Yš♠KAÒîk…nCDlS³8û,Nª¯Õ,Õ,Õ}¾cèg▬+ß×j–ÀR►Ý×F©Xm▬_gA#%‹u_«Y?KAÒîk…È$b{!÷éyº§YLåZHa&ûZÍRÍRÜ¾6Gº‹Ñö‹nñ/ á_☺ Ì²™ðÖ¹ µlæ²Ñ*'ºlF/ðˆ°˜f=ƒ½Ú o¡š÷ç¬’½.K·7
a»¶ÉÁ£‡?x¶Ž
/Xçk↓∟; LN∟9>qô!óÈñ‼G œ86Ù´âBÃŠa'↔>e-Û♂Î—ì\hçh@¡Àck°@‹ÿJ←►¸G làÈnÀ0ïáàœ«Á±_•œy)×:}lªì]◘ÚxÚ>o[E»►®o$¨ºR¬–Ê▲ñÿ>_Ä|

I first tried opening the .ks-ipc file, and my computer asked what program to try opening it in, so I selected Word. It gave me all the random characters splayed out across a few pages, which was unhelpful. I then looked up what a .ks-ipc file was to see if there were any programs that could open it, but I found absolutely nothing about the existence of that file type. As far as Google is concerned, it doesn't exist. So I thought, okay, maybe it's just a weird ipc file, whatever an ipc file is, because Google does seem to know what an ipc file is. I try opening it in an ipc file converter that allows you to open and view them online. It tells me there's no readable text because it's a binary file and spits out the same random characters Word did. Did some googling and came to the conclusion that the random characters might be raw bytes, so I tried putting them into a raw bytes to string (text?) converter, but I got a few errors and it wouldn't work. The first error was there's an uneven amount of hex characters, the second was that there was an invalid UTF-8, whatever that means. I have no idea what any of this means, and I'm hoping somebody here can help me figure out what's going on. Is there any way to figure out what this says, or did my instructor just screw up?


问:
Excel absolute lock formulas from different sheets

11-Dec
18-dec
25-dec
------
11-Dec
18-dec
25-dec

------
------
------
------
------
------
------

------
------
------
------
------
------
------

What I am expecting to get

18-Dec
25-dec
1-jan
------
1-jan
25-dec
18-dec
11-dec

------
------
------
------
------
------
------
------

------
------
------
------
------
------
------
------

I am trying to insert a new column and just get the 3 most left column dates.

I tried =$E$1 for A1, but when I insert a new column, the formula automatically changes to =$F$1 and results in 25-dec.

My goal is to apply this to reference cells from another sheet.


问:
Mask RCNN compatability issues with tensorflow
I'm trying to run Mask-RCNN on a jupyter notebook (on colab).

Im using the following repository: !git clone https://github.com/matterport/Mask_RCNN.git

there are a few changes that need to be done to make it run properly, for example changing the KE.Layer cases to KE.base_layer.Layer in the model.py file.

but still, at the end the following error is shown:

```<code>TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name=None), name='tf.math.truediv/truediv:0', description="created by layer 'tf.math.truediv'") of unsupported type <class 'keras.engine.keras_tensor.KerasTensor'>.
</code>```

I found this thread, which claims that this is a compatibility issue.

That pulled me into a vicious-cycle of compatibility issues, and still no working solution:

first, I then figured out that the requirements.text file is not being used at all, because of other compatibility issues with the parse_requirements method in the pip package, and the solution for this is here (answer by @sinoroc).

Second, when I'm trying to use an older version of tensorflow, it does not find any:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.3.0 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0)  (only v2+).

This -can- be circumvented by !pip3 install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py3-none-any.whl

BUT there are two following issues:

1 - I need it as part of the requirements.txt file in the maskrcnn folder, and I am not able to make it run from there.

2 - this also creates compatibility issues:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. kapre 0.3.7 requires tensorflow>=2.0.0, but you have tensorflow 1.14.0 which is incompatible.

Question: is there a way to resolve these issues? maybe there is an updated Mask-RCNN version that resolves these compatibilities?

It is crucial for me that the solution will be able to accept custom classes (my data is coco style, but with custom classes) and be able to run on a colab notebook.

Body:
I'm trying to run Mask-RCNN on a jupyter notebook (on colab).

Im using the following repository: !git clone https://github.com/matterport/Mask_RCNN.git

there are a few changes that need to be done to make it run properly, for example changing the KE.Layer cases to KE.base_layer.Layer in the model.py file.

but still, at the end the following error is shown:

TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name=None), name='tf.math.truediv/truediv:0', description="created by layer 'tf.math.truediv'") of unsupported type <class 'keras.engine.keras_tensor.KerasTensor'>.

I found this thread, which claims that this is a compatibility issue.

That pulled me into a vicious-cycle of compatibility issues, and still no working solution:

first, I then figured out that the requirements.text file is not being used at all, because of other compatibility issues with the parse_requirements method in the pip package, and the solution for this is here (answer by @sinoroc).

Second, when I'm trying to use an older version of tensorflow, it does not find any:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.3.0 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0)  (only v2+).

This -can- be circumvented by !pip3 install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.14.0-py3-none-any.whl

BUT there are two following issues:

1 - I need it as part of the requirements.txt file in the maskrcnn folder, and I am not able to make it run from there.

2 - this also creates compatibility issues:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. kapre 0.3.7 requires tensorflow>=2.0.0, but you have tensorflow 1.14.0 which is incompatible.

Question: is there a way to resolve these issues? maybe there is an updated Mask-RCNN version that resolves these compatibilities?

It is crucial for me that the solution will be able to accept custom classes (my data is coco style, but with custom classes) and be able to run on a colab notebook.


问:
Can not squeeze dim[2], expected a dimension of 1, got 2
I'm trying to create a CNN that takes some head images as input and gives output 4 keypoints (in coordinates format (x,y)).

Input Images are in format (1000,1000,1) and keypoints are in format [[0.1,0.2][0.3,0.4][0.5,0.6][0.6,0.7]].

When I Run the program, I get this error:

```<code>Node: 'cond/remove_squeezable_dimensions/cond/Squeeze'
Can not squeeze dim[2], expected a dimension of 1, got 2
     [[{{node cond/remove_squeezable_dimensions/cond/Squeeze}}, {{node mean_squared_error/cond/remove_squeezable_dimensions/cond/Squeeze}}]] [Op:__inference_train_function_1432]
</code>```

Here's the code (at the momento is in a dummy stage):

```<code>dataset = dataset.batch(batch_size)

# for image,keypoints in dataset.as_numpy_iterator():
#     print("Image shape:",image.shape)

input_shape = (1000,1000,1)

model = Sequential()
model.add(Conv2D(3, (3,3), strides = (1,1), padding='same', activation='relu', input_shape=input_shape))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Flatten())
model.add(Dense(10,activation='relu'))
model.add(Dense(4))
model.summary()

#opt = Adam(learning_rate=0.0005,decay=1e-3)

model.compile(loss='mse',optimizer='adam',metrics='mae')

# Train the model for 1 epoch using a dataset
print("Fit on Dataset")
history = model.fit(dataset, epochs=1, batch_size=batch_size)
</code>```

Printing Input shape with commented code we get this output:

```<code>Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
</code>```

Any help will be greatly appreciated.

Body:
I'm trying to create a CNN that takes some head images as input and gives output 4 keypoints (in coordinates format (x,y)).

Input Images are in format (1000,1000,1) and keypoints are in format [[0.1,0.2][0.3,0.4][0.5,0.6][0.6,0.7]].

When I Run the program, I get this error:

Node: 'cond/remove_squeezable_dimensions/cond/Squeeze'
Can not squeeze dim[2], expected a dimension of 1, got 2
     [[{{node cond/remove_squeezable_dimensions/cond/Squeeze}}, {{node mean_squared_error/cond/remove_squeezable_dimensions/cond/Squeeze}}]] [Op:__inference_train_function_1432]

Here's the code (at the momento is in a dummy stage):

dataset = dataset.batch(batch_size)

# for image,keypoints in dataset.as_numpy_iterator():
#     print("Image shape:",image.shape)

input_shape = (1000,1000,1)

model = Sequential()
model.add(Conv2D(3, (3,3), strides = (1,1), padding='same', activation='relu', input_shape=input_shape))
model.add(BatchNormalization())
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Flatten())
model.add(Dense(10,activation='relu'))
model.add(Dense(4))
model.summary()

#opt = Adam(learning_rate=0.0005,decay=1e-3)

model.compile(loss='mse',optimizer='adam',metrics='mae')

# Train the model for 1 epoch using a dataset
print("Fit on Dataset")
history = model.fit(dataset, epochs=1, batch_size=batch_size)

Printing Input shape with commented code we get this output:

Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)
Image shape: (5, 1000, 1000, 1)

Any help will be greatly appreciated.


问:
Adding FPS Sliding using the Character Controller
I'm currently working on a FPS "Speedrun" game & I want to add "Sliding" to the players movement. I already added "Crouching", but currently I'm stuck at getting the sliding done. (I'm using the Character Controller) I've tried many things, but nothing really worked. Heres the current PlayerMovement script:

```<code>using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.UIElements;

 public class PlayerMovement : MonoBehaviour
 {
     public CharacterController controller;
     private Rigidbody rb;
     public Transform cameraTransform;

     public HeadBobController headBobController;

     [Header("Movement")]
     private float speedMultiplier = 1f;
     public float speed = 12f;
     public float sprintSpeed = 20f;
     public float slopeSpeed = 0.01f;

     public float gravity = -9.81f;
     public float jumpHeight = 3f;
     public float sensitivity = 2f;
     public float cameraRotationLimit = 85f;

     [Header("Countermovement")]
     public float counterMovement = 0.175f;
     private float threshold = 0.01f;
     public float maxSlopeAngle = 35f;

     [Header("Sliding / Crouch")]
     public float slideSpeed;
     float originalHeight;
     public float reducedHeight;
     float targetHeight = 2f;
     public float timeToCrouch = 0.25f;
     float timeElapsed = 0;

     bool canStopCrouching;
     bool wantStopCrouch;

     bool isRunning = false;
     public bool isCrouching = false;
     bool canUseHeadbob = true;
     bool WillSlideOnSlopes = true;

     bool IsSliding
     {
         get
         {
             if (controller.isGrounded && Physics.Raycast(transform.position, Vector3.down, out RaycastHit slopeHit, 3f))
             {
                 hitPointNormal = slopeHit.normal;
                 return Vector3.Angle(hitPointNormal, Vector3.up) > controller.slopeLimit;

             } else
             {
                 return false;
             }
         }
     }

     [Header("Headbob")]
     [SerializeField] private float walkBobSpeed = 14f;
     [SerializeField] private float walkBobAmount = 0.05f;
     [SerializeField] private float sprintBobSpeed = 18f;
     [SerializeField] private float sprintBobAmount = 0.11f;
     [SerializeField] private float crouchBobSpeed = 8f;
     [SerializeField] private float crouchBobAmount = 0.025f;
     private float defaultYPos = 0;
     private float timer;

     private Vector3 hitPointNormal;

     [Header("Ground Check")]
     public Transform groundCheck;
     public float groundDistance = 0.4f;
     public LayerMask groundMask;

     Vector3 velocity;
     public bool isGrounded;

     [Header("Camera")]
     float cameraRotationX = 0f;
     float cameraRotationY = 0f;

     public Camera camera;
     public Transform orientation;

     [Header("Other")]
     public GameObject speedlines;
     public ParticleSystem jumpParticle;

     void Start()
     {
         rb = GetComponent<Rigidbody>();
         controller = GetComponent<CharacterController>();
         originalHeight = controller.height;
         defaultYPos = camera.transform.localPosition.y;
         //Cursor.lockState = CursorLockMode.Locked;
         //Cursor.visible = false;
     }

     public void Update()
     {
         isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

         if (isGrounded && velocity.y < 0)
         {
             velocity.y = -2f;
         }

         float x = Input.GetAxis("Horizontal");
         float z = Input.GetAxis("Vertical");

         Vector3 move = transform.right * x + transform.forward * z;
         move = Vector3.ClampMagnitude(move, 1f);

         if (Input.GetKey(KeyCode.LeftShift) && !isCrouching)
         {
             controller.Move(move * sprintSpeed * Time.deltaTime);
             isRunning = true;
             headBobController.amplitude = 0.1f;
             headBobController.frequency = 30f;
         } else
         {
             controller.Move(move * speed * speedMultiplier * Time.deltaTime);
             isRunning = false;
             headBobController.amplitude = 0.0426f;
             headBobController.frequency = 19.1f;
         }

         if (Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             canStopCrouching = false;
         } else
         {
             canStopCrouching = true;
         }

         if (canStopCrouching && wantStopCrouch && !Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             wantStopCrouch = false;
             StopCrouch();
         }

         if (Input.GetKeyDown(KeyCode.LeftControl) && isGrounded)
         {
             //controller.height = Mathf.Lerp(reducedHeight, originalHeight, timeElapsed);
             StartCrouch();
         } else if(Input.GetKeyUp(KeyCode.LeftControl) && isGrounded && !Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             //controller.height = Mathf.Lerp(originalHeight, targetHeight, timeElapsed);
             StopCrouch();
         } else if(Input.GetKeyUp(KeyCode.LeftControl) && isGrounded && Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             wantStopCrouch = true;
         }

         if (Input.GetKey(KeyCode.LeftControl) && isRunning && isGrounded)
         {
             //Sliding
         }

         if (canUseHeadbob && isGrounded)
         {
             if (Mathf.Abs(move.x) > 0.1f || Mathf.Abs(move.z) > 0.1f)
             {
                 timer += Time.deltaTime * (isCrouching ? crouchBobSpeed : isRunning ? sprintBobSpeed : walkBobSpeed);
                 camera.transform.localPosition = new Vector3(camera.transform.localPosition.x, defaultYPos + Mathf.Sin(timer) * (isRunning ? sprintBobAmount : walkBobAmount), camera.transform.localPosition.z);
             }
         }

         if(WillSlideOnSlopes && IsSliding)
         {
             move += new Vector3(hitPointNormal.x, -hitPointNormal.y, hitPointNormal.z) * slopeSpeed;
         }

         if (isRunning)
         {
             speedlines.active = true;
         } else {
             speedlines.active = false;
         }

         controller.Move(move * speed * speedMultiplier * Time.deltaTime);

         if (Input.GetButtonDown("Jump") && isGrounded)
         {
             controller.Move(-transform.forward * 0.1f);
             velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
             jumpParticle.Play();
         }

         velocity.y += gravity * Time.deltaTime;

         controller.Move(velocity * Time.deltaTime);

         // Rotate the player based on mouse input
         float mouseX = Input.GetAxis("Mouse X") * sensitivity;
         float mouseY = Input.GetAxis("Mouse Y") * sensitivity;

         cameraRotationY += mouseX;

         cameraRotationX -= mouseY;
         cameraRotationX = Mathf.Clamp(cameraRotationX, -cameraRotationLimit, cameraRotationLimit);

         cameraTransform.localEulerAngles = new Vector3(cameraRotationX, cameraRotationY, 0f);
         transform.eulerAngles = new Vector3(0f, cameraRotationY, 0f);
     }

     private void StartCrouch()
     {
         controller.height = reducedHeight;
         speedMultiplier = 0.5f;
         isCrouching = true;
     }

     private void StopCrouch()
     {
         controller.height = originalHeight;
         speedMultiplier = 1f;
         isCrouching = false;
     }
 }
</code>```

It would be very nice if anyone could try to explain me how to implement it into this code using the Character Controller! :)

I've tried multiple Youtube Tutorial solutions & a lot in Online Forums, nothing really worked for me for some reason. Often the system wouldn't even work (nothing happened). I want the player to have the crouching ability (which is implemented) & to slide when isRunning & when the player isGrounded

Body:
I'm currently working on a FPS "Speedrun" game & I want to add "Sliding" to the players movement. I already added "Crouching", but currently I'm stuck at getting the sliding done. (I'm using the Character Controller) I've tried many things, but nothing really worked. Heres the current PlayerMovement script:

using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.UIElements;

 public class PlayerMovement : MonoBehaviour
 {
     public CharacterController controller;
     private Rigidbody rb;
     public Transform cameraTransform;

     public HeadBobController headBobController;

     [Header("Movement")]
     private float speedMultiplier = 1f;
     public float speed = 12f;
     public float sprintSpeed = 20f;
     public float slopeSpeed = 0.01f;

     public float gravity = -9.81f;
     public float jumpHeight = 3f;
     public float sensitivity = 2f;
     public float cameraRotationLimit = 85f;

     [Header("Countermovement")]
     public float counterMovement = 0.175f;
     private float threshold = 0.01f;
     public float maxSlopeAngle = 35f;

     [Header("Sliding / Crouch")]
     public float slideSpeed;
     float originalHeight;
     public float reducedHeight;
     float targetHeight = 2f;
     public float timeToCrouch = 0.25f;
     float timeElapsed = 0;

     bool canStopCrouching;
     bool wantStopCrouch;

     bool isRunning = false;
     public bool isCrouching = false;
     bool canUseHeadbob = true;
     bool WillSlideOnSlopes = true;

     bool IsSliding
     {
         get
         {
             if (controller.isGrounded && Physics.Raycast(transform.position, Vector3.down, out RaycastHit slopeHit, 3f))
             {
                 hitPointNormal = slopeHit.normal;
                 return Vector3.Angle(hitPointNormal, Vector3.up) > controller.slopeLimit;

             } else
             {
                 return false;
             }
         }
     }

     [Header("Headbob")]
     [SerializeField] private float walkBobSpeed = 14f;
     [SerializeField] private float walkBobAmount = 0.05f;
     [SerializeField] private float sprintBobSpeed = 18f;
     [SerializeField] private float sprintBobAmount = 0.11f;
     [SerializeField] private float crouchBobSpeed = 8f;
     [SerializeField] private float crouchBobAmount = 0.025f;
     private float defaultYPos = 0;
     private float timer;

     private Vector3 hitPointNormal;

     [Header("Ground Check")]
     public Transform groundCheck;
     public float groundDistance = 0.4f;
     public LayerMask groundMask;

     Vector3 velocity;
     public bool isGrounded;

     [Header("Camera")]
     float cameraRotationX = 0f;
     float cameraRotationY = 0f;

     public Camera camera;
     public Transform orientation;

     [Header("Other")]
     public GameObject speedlines;
     public ParticleSystem jumpParticle;

     void Start()
     {
         rb = GetComponent<Rigidbody>();
         controller = GetComponent<CharacterController>();
         originalHeight = controller.height;
         defaultYPos = camera.transform.localPosition.y;
         //Cursor.lockState = CursorLockMode.Locked;
         //Cursor.visible = false;
     }

     public void Update()
     {
         isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

         if (isGrounded && velocity.y < 0)
         {
             velocity.y = -2f;
         }

         float x = Input.GetAxis("Horizontal");
         float z = Input.GetAxis("Vertical");

         Vector3 move = transform.right * x + transform.forward * z;
         move = Vector3.ClampMagnitude(move, 1f);

         if (Input.GetKey(KeyCode.LeftShift) && !isCrouching)
         {
             controller.Move(move * sprintSpeed * Time.deltaTime);
             isRunning = true;
             headBobController.amplitude = 0.1f;
             headBobController.frequency = 30f;
         } else
         {
             controller.Move(move * speed * speedMultiplier * Time.deltaTime);
             isRunning = false;
             headBobController.amplitude = 0.0426f;
             headBobController.frequency = 19.1f;
         }

         if (Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             canStopCrouching = false;
         } else
         {
             canStopCrouching = true;
         }

         if (canStopCrouching && wantStopCrouch && !Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             wantStopCrouch = false;
             StopCrouch();
         }

         if (Input.GetKeyDown(KeyCode.LeftControl) && isGrounded)
         {
             //controller.height = Mathf.Lerp(reducedHeight, originalHeight, timeElapsed);
             StartCrouch();
         } else if(Input.GetKeyUp(KeyCode.LeftControl) && isGrounded && !Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             //controller.height = Mathf.Lerp(originalHeight, targetHeight, timeElapsed);
             StopCrouch();
         } else if(Input.GetKeyUp(KeyCode.LeftControl) && isGrounded && Physics.Raycast(camera.transform.position, Vector3.up, 1f))
         {
             wantStopCrouch = true;
         }

         if (Input.GetKey(KeyCode.LeftControl) && isRunning && isGrounded)
         {
             //Sliding
         }

         if (canUseHeadbob && isGrounded)
         {
             if (Mathf.Abs(move.x) > 0.1f || Mathf.Abs(move.z) > 0.1f)
             {
                 timer += Time.deltaTime * (isCrouching ? crouchBobSpeed : isRunning ? sprintBobSpeed : walkBobSpeed);
                 camera.transform.localPosition = new Vector3(camera.transform.localPosition.x, defaultYPos + Mathf.Sin(timer) * (isRunning ? sprintBobAmount : walkBobAmount), camera.transform.localPosition.z);
             }
         }

         if(WillSlideOnSlopes && IsSliding)
         {
             move += new Vector3(hitPointNormal.x, -hitPointNormal.y, hitPointNormal.z) * slopeSpeed;
         }

         if (isRunning)
         {
             speedlines.active = true;
         } else {
             speedlines.active = false;
         }

         controller.Move(move * speed * speedMultiplier * Time.deltaTime);

         if (Input.GetButtonDown("Jump") && isGrounded)
         {
             controller.Move(-transform.forward * 0.1f);
             velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
             jumpParticle.Play();
         }

         velocity.y += gravity * Time.deltaTime;

         controller.Move(velocity * Time.deltaTime);

         // Rotate the player based on mouse input
         float mouseX = Input.GetAxis("Mouse X") * sensitivity;
         float mouseY = Input.GetAxis("Mouse Y") * sensitivity;

         cameraRotationY += mouseX;

         cameraRotationX -= mouseY;
         cameraRotationX = Mathf.Clamp(cameraRotationX, -cameraRotationLimit, cameraRotationLimit);

         cameraTransform.localEulerAngles = new Vector3(cameraRotationX, cameraRotationY, 0f);
         transform.eulerAngles = new Vector3(0f, cameraRotationY, 0f);
     }

     private void StartCrouch()
     {
         controller.height = reducedHeight;
         speedMultiplier = 0.5f;
         isCrouching = true;
     }

     private void StopCrouch()
     {
         controller.height = originalHeight;
         speedMultiplier = 1f;
         isCrouching = false;
     }
 }

It would be very nice if anyone could try to explain me how to implement it into this code using the Character Controller! :)

I've tried multiple Youtube Tutorial solutions & a lot in Online Forums, nothing really worked for me for some reason. Often the system wouldn't even work (nothing happened). I want the player to have the crouching ability (which is implemented) & to slide when isRunning & when the player isGrounded


问:
"Cannot unpack non-iterable float object" in system of odes inside a loop
Hi everyone, Im trying to solve a system of odes which describes a catalytic heterogeneous reaction for different temperatures. I'm trying to solve the same equations for different temperatures, using a function f, which is inside a for loop. Here's the code

```<code>import scipy as sc
from scipy.integrate import odeint
import numpy as np

T=np.array([100,200,300,400,500])
for y in T:
    def f(t,x,T):
        [FA,FB,FC,FD,FE,FF]=x
        e=2.711828
        R=8.314
        Tm=723.15
        A1=5.5
        A2=0.686
        A3=1.58
        A4=2.6
        A5=0.787
        E1=90500
        E2=165000
        E3=150000
        E4=139000
        E5=132000
        SB=-215
        HB=-45600
        SD=-42
        HD=-128000
        DH1=-105000
        DH2=-1428000
        DH3=-862000
        DH4=-1323000
        DH5=-757000
        k1=e**(A1-(E1/R)*((1/T)-(1/Tm)))
        k2=e**(A2-(E2/R)*((1/T)-(1/Tm)))
        k3=e**(A3-(E3/R)*((1/T)-(1/Tm)))
        k4=e**(A4-(E4/R)*((1/T)-(1/Tm)))
        k5=e**(A5-(E5/R)*((1/T)-(1/Tm)))
        KB=6.54e-12
        KD=1.19
        m2=0.922
        m3=0.906
        m4=1.23
        m5=0.905
        Patm=0.8*101325
        FT=178.47
        PA=(FA/FT)*Patm
        PB=(FB/FT)*Patm
        PC=(FC/FT)*Patm
        PD=(FD/FT)*Patm
        PE=(FE/FT)*Patm
        PF=(FF/FT)*Patm
        Tast=1/(1+((KB*PB)**0.5)+(KD*PD))
        TB=((KB*PB)**0.5)*Tast
        TD=KD*PD*Tast
        r1=(k1/1000)*TB*PA #mol
        r2=(k2/1000)*(TB**m2)*PA
        r3=(k3/1000)*(TB**m3)*PA
        r4=(k4/1000)*(TB**m4)*PC
        r5=(k5/1000)*(TB**m5)*PC
        rA=-r1-r2-r3
        rB=-r1-7*r2-5*r3-6*r4-4*r5
        rC=r1-r4-r5
        rD=r1+3*r2+3*r3+2*r4+2*r5
        rE=2*r2+2*r4
        rF=2*r3+2*r5
        FAdot=rA
        FBdot=rB
        FCdot=rC
        FDdot=rD
        FEdot=rE
        FFdot=rF
        return [FAdot,FBdot,FCdot,FDdot,FEdot,FFdot]
x0=(5,5,0,0,0,0)
soln=odeint(f,x0,(0,5),args=(T,))
print(soln)

However i get the following message
File "c:\Users\Axel Flores\Documents\Escuela\Proyectos\Python\import scipy as sc.py", line 7, in f
    [FA,FB,FC,FD,FE,FF]=x
TypeError: cannot unpack non-iterable float object
PS C:\Users\Axel Flores>
</code>```

Please help I know it is because the for loop but anything that I try provoques the same error. I've looked for solutions on the internet but none have worked.

Body:
Hi everyone, Im trying to solve a system of odes which describes a catalytic heterogeneous reaction for different temperatures. I'm trying to solve the same equations for different temperatures, using a function f, which is inside a for loop. Here's the code

import scipy as sc
from scipy.integrate import odeint
import numpy as np

T=np.array([100,200,300,400,500])
for y in T:
    def f(t,x,T):
        [FA,FB,FC,FD,FE,FF]=x
        e=2.711828
        R=8.314
        Tm=723.15
        A1=5.5
        A2=0.686
        A3=1.58
        A4=2.6
        A5=0.787
        E1=90500
        E2=165000
        E3=150000
        E4=139000
        E5=132000
        SB=-215
        HB=-45600
        SD=-42
        HD=-128000
        DH1=-105000
        DH2=-1428000
        DH3=-862000
        DH4=-1323000
        DH5=-757000
        k1=e**(A1-(E1/R)*((1/T)-(1/Tm)))
        k2=e**(A2-(E2/R)*((1/T)-(1/Tm)))
        k3=e**(A3-(E3/R)*((1/T)-(1/Tm)))
        k4=e**(A4-(E4/R)*((1/T)-(1/Tm)))
        k5=e**(A5-(E5/R)*((1/T)-(1/Tm)))
        KB=6.54e-12
        KD=1.19
        m2=0.922
        m3=0.906
        m4=1.23
        m5=0.905
        Patm=0.8*101325
        FT=178.47
        PA=(FA/FT)*Patm
        PB=(FB/FT)*Patm
        PC=(FC/FT)*Patm
        PD=(FD/FT)*Patm
        PE=(FE/FT)*Patm
        PF=(FF/FT)*Patm
        Tast=1/(1+((KB*PB)**0.5)+(KD*PD))
        TB=((KB*PB)**0.5)*Tast
        TD=KD*PD*Tast
        r1=(k1/1000)*TB*PA #mol
        r2=(k2/1000)*(TB**m2)*PA
        r3=(k3/1000)*(TB**m3)*PA
        r4=(k4/1000)*(TB**m4)*PC
        r5=(k5/1000)*(TB**m5)*PC
        rA=-r1-r2-r3
        rB=-r1-7*r2-5*r3-6*r4-4*r5
        rC=r1-r4-r5
        rD=r1+3*r2+3*r3+2*r4+2*r5
        rE=2*r2+2*r4
        rF=2*r3+2*r5
        FAdot=rA
        FBdot=rB
        FCdot=rC
        FDdot=rD
        FEdot=rE
        FFdot=rF
        return [FAdot,FBdot,FCdot,FDdot,FEdot,FFdot]
x0=(5,5,0,0,0,0)
soln=odeint(f,x0,(0,5),args=(T,))
print(soln)

However i get the following message
File "c:\Users\Axel Flores\Documents\Escuela\Proyectos\Python\import scipy as sc.py", line 7, in f
    [FA,FB,FC,FD,FE,FF]=x
TypeError: cannot unpack non-iterable float object
PS C:\Users\Axel Flores>

Please help I know it is because the for loop but anything that I try provoques the same error. I've looked for solutions on the internet but none have worked.


问:
How do you supply multiple TxnIDs to a QBXML request?
From my understand there's only 1 request where you can pass a TxnIDList and that's TimeTrackingQuery. The XML i'm trying to pass is:

```<code><?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnId>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>
</code>```

But this gives me an error of: There is a missing element: "MaxReturned".
Using the SDK validator, this query is marked as valid, however and looking at the documentation it says I can either supply a repeating element of TxnID or a MaxReturned value with nested elements.

If i also pass it a MaxReturned element along with the TxnIDs it will complain that the xml.

```<code><?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnID>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
            <MaxReturned>1000</MaxReturned>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>
</code>```

Lastly, if I close off the TimeTrackingQueryRq tag and re-open it and just include MaxReturned in the second tag, it will say it's valid XML but will return the same errors as the first request. Example of this:

```<code><?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnID>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
        </TimeTrackingQueryRq>
        <TimeTrackingQueryRq requestID="1">
            <MaxReturned>1000</MaxReturned>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>
</code>```

So either I don't know how to pass a TxnIDList or I don't know how to properly read the documentation and provided schema. Any help or examples of how to properly construct this request is appreciated.

Body:
From my understand there's only 1 request where you can pass a TxnIDList and that's TimeTrackingQuery. The XML i'm trying to pass is:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnId>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>

But this gives me an error of: There is a missing element: "MaxReturned".
Using the SDK validator, this query is marked as valid, however and looking at the documentation it says I can either supply a repeating element of TxnID or a MaxReturned value with nested elements.

If i also pass it a MaxReturned element along with the TxnIDs it will complain that the xml.

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnID>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
            <MaxReturned>1000</MaxReturned>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>

Lastly, if I close off the TimeTrackingQueryRq tag and re-open it and just include MaxReturned in the second tag, it will say it's valid XML but will return the same errors as the first request. Example of this:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <TimeTrackingQueryRq requestID="1"  iterator="Start">
            <TxnID >9-1673543531</TxnID>
            <TxnID >A-1673543531</TxnID>
            <TxnID >7-1673543531</TxnID>
            <TxnID >8-1673543531</TxnID>
            <TxnID >B-1673543531</TxnID>
        </TimeTrackingQueryRq>
        <TimeTrackingQueryRq requestID="1">
            <MaxReturned>1000</MaxReturned>
        </TimeTrackingQueryRq>
    </QBXMLMsgsRq>
</QBXML>

So either I don't know how to pass a TxnIDList or I don't know how to properly read the documentation and provided schema. Any help or examples of how to properly construct this request is appreciated.


问:
Flutter Stripe sofort, ideal payment
I create a payment through sofort, ideal, pass the specified parameters and every time I get an error-
Error from Stripe: Invalid Payment Intent client secret: src_client_secret_**********************

```<code>final paymentIntent = await Stripe.instance.confirmPayment(
paymentIntentClientSecret: clientSecret,
data: PaymentMethodParams.sofort(
paymentMethodData: PaymentMethodDataSofort(country: 'de'),
),
);
</code>```

clientSecret-the key is generated without any problems

payment by card is fine

What am I doing wrong?

I am using the latest versions of the libraries: flutter_stripe: ^7.0.0

I looked through all the information in the library and couldn't find anything

Title: Flutter Stripe sofort, ideal payment

Body:
I create a payment through sofort, ideal, pass the specified parameters and every time I get an error-
Error from Stripe: Invalid Payment Intent client secret: src_client_secret_**********************

final paymentIntent = await Stripe.instance.confirmPayment(
paymentIntentClientSecret: clientSecret,
data: PaymentMethodParams.sofort(
paymentMethodData: PaymentMethodDataSofort(country: 'de'),
),
);

clientSecret-the key is generated without any problems

payment by card is fine

What am I doing wrong?

I am using the latest versions of the libraries: flutter_stripe: ^7.0.0

I looked through all the information in the library and couldn't find anything


问:
importing ontologies in owlready
I did some code in owl ready and now I need to import an Ontology to use it. The problem is owlready doesn't do it correctly, no classes found. Like if I try to import go.owl (http://geneontology.org/docs/download-ontology/) and then add a class (for simplicity)
named A with code:

```<code>with onto:
  class A(GO_0046852):
    pass
</code>```

I get the error

NameError: name 'GO_0000030' is not defined

This is because owlready takes into consideration thats the class IRI should be #GO_0000030 not http://purl.obolibrary.org/obo/GO_0046852 or even http://purl.obolibrary.org/obo#GO_0046852
which doesn't make sense. So no class gets detected. How can I fix this, or go around it?

I can't swap to another API now because I already did so much code.
This is the code that yields an error:

```<code>from owlready2 import *

onto = get_ontology("go.owl").load()
with onto:
    class A(GO_0000030):
        pass
onto.save(file = "test.owl", format = "rdfxml")
</code>```

Title: importing ontologies in owlready

Body:
I did some code in owl ready and now I need to import an Ontology to use it. The problem is owlready doesn't do it correctly, no classes found. Like if I try to import go.owl (http://geneontology.org/docs/download-ontology/) and then add a class (for simplicity)
named A with code:

with onto:
  class A(GO_0046852):
    pass

I get the error

NameError: name 'GO_0000030' is not defined

This is because owlready takes into consideration thats the class IRI should be #GO_0000030 not http://purl.obolibrary.org/obo/GO_0046852 or even http://purl.obolibrary.org/obo#GO_0046852
which doesn't make sense. So no class gets detected. How can I fix this, or go around it?

I can't swap to another API now because I already did so much code.
This is the code that yields an error:

from owlready2 import *

onto = get_ontology("go.owl").load()
with onto:
    class A(GO_0000030):
        pass
onto.save(file = "test.owl", format = "rdfxml")