问:
React FileReader readAsDataURL not working: URL can't be decoded in flask backend as format == None
I'm working on a basic React web app where user can upload images, and images are send to the flask backend to be processed. I'm using FileReader class to convert the uploaded images through  into URLs, and then send them to the backend, where I need to decode the URLs then converted it into an np.array for the processing.

The issue is, when I try to decode the image with image_data = base64.b64decode(image_url) and get the image with Image.open(io.BytesIO(image_data)), somehow it won't recognize the url as an image? Basically I got this error:

```<code>raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x2e8950b30>
</code>```

I checked the image format with image_format = imghdr.what(io.BytesIO(image_data)), and the image_format equals to None. Do I need to specify the format when encoding the image?

Here's my code:

in React App():

```<code>handleImageUploadSelect = (event) => {
    let imageURLs = [];
    const files = event.target.files;

    for ( let i = 0; i < files.length; i++ ) {
      // load file object
      const file = files[i]
      // file reader
      const reader = new FileReader();
      reader.onload = (event) => {
        const dataURL = event.target.result;
        // add dataURL to the state variable
        imageURLs[i] = dataURL;
      }
      reader.readAsDataURL(file);
    }
    this.state.uploadImageURLs = imageURLs;
  }

  handleImageUpload = event => {
    event.preventDefault();
    // send uploadImageURLs back to flask server
    const data = { images: this.state.uploadImageURLs };
    console.log(data)
    fetch('http://127.0.0.1:5000/add_images', {
      method:'POST',
      body: JSON.stringify(data),
      headers: {
        'Content-Type': 'application/json'
      },
    })
      .then((response) => response.json())
      .then((data) => {
        // response data
        console.log(data)
      })
        .catch((error) => {
          console.error(error);
        });
  }
</code>```

And in flask server file:

```<code>@main.route('/add_images', methods=['POST'])
@cross_origin()
def add_images():
    data = request.get_json()
    for imageURL in data['images']:
        image_data = base64.b64decode(imageURL)
        image = Image.open(io.BytesIO(image_data))
        image_array = np.array(image)
        # processing ...
    return jsonify({"condition": "image received"})
</code>```

Please Help! Thanks!

Body:
I'm working on a basic React web app where user can upload images, and images are send to the flask backend to be processed. I'm using FileReader class to convert the uploaded images through  into URLs, and then send them to the backend, where I need to decode the URLs then converted it into an np.array for the processing.

The issue is, when I try to decode the image with image_data = base64.b64decode(image_url) and get the image with Image.open(io.BytesIO(image_data)), somehow it won't recognize the url as an image? Basically I got this error:

raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x2e8950b30>

I checked the image format with image_format = imghdr.what(io.BytesIO(image_data)), and the image_format equals to None. Do I need to specify the format when encoding the image?

Here's my code:

in React App():

handleImageUploadSelect = (event) => {
    let imageURLs = [];
    const files = event.target.files;

    for ( let i = 0; i < files.length; i++ ) {
      // load file object
      const file = files[i]
      // file reader
      const reader = new FileReader();
      reader.onload = (event) => {
        const dataURL = event.target.result;
        // add dataURL to the state variable
        imageURLs[i] = dataURL;
      }
      reader.readAsDataURL(file);
    }
    this.state.uploadImageURLs = imageURLs;
  }

  handleImageUpload = event => {
    event.preventDefault();
    // send uploadImageURLs back to flask server
    const data = { images: this.state.uploadImageURLs };
    console.log(data)
    fetch('http://127.0.0.1:5000/add_images', {
      method:'POST',
      body: JSON.stringify(data),
      headers: {
        'Content-Type': 'application/json'
      },
    })
      .then((response) => response.json())
      .then((data) => {
        // response data
        console.log(data)
      })
        .catch((error) => {
          console.error(error);
        });
  }

And in flask server file:

@main.route('/add_images', methods=['POST'])
@cross_origin()
def add_images():
    data = request.get_json()
    for imageURL in data['images']:
        image_data = base64.b64decode(imageURL)
        image = Image.open(io.BytesIO(image_data))
        image_array = np.array(image)
        # processing ...
    return jsonify({"condition": "image received"})

Please Help! Thanks!


来源: stackexchange

问:
Multiple values after THEN function in Tableau
```<code>IF [X] = "Pings" THEN [Pings]
ELSEIF [Y] = "Money" THEN [Rev]
ELSE NULL
END
</code>```

I want to be able to assign [X] with [Pings] and [REV] in the same line but don't know how. First time using Tableau formula.
example:

```<code>IF [X] = "Pings" THEN [Pings] [REV]
ELSE NULL
END
</code>```

ContentLicense: CC BY-SA 4.0

Body:
IF [X] = "Pings" THEN [Pings]
ELSEIF [Y] = "Money" THEN [Rev]
ELSE NULL
END

I want to be able to assign [X] with [Pings] and [REV] in the same line but don't know how. First time using Tableau formula.
example:

IF [X] = "Pings" THEN [Pings] [REV]
ELSE NULL
END


问:
Using the twitterAPI to page more results
I am currently trying to use the twitter api.cursor to page through pages 1-50, than wait 15 minutes to avoid rate limits, than pages 51-100, wait 15 minutes, than 101-150 etc. Is there an easier way for me to do this rather than how I currently am?

My goal is to get through as many page results as I can. I don't mind if I have to run the script for hours. I am trying to gather as much information as I can into my database.

```<code># Set the starting page number
page = 1

# Set the maximum number of pages to retrieve
max_pages = 25

# Set a flag to indicate when to stop paginating
done = False

# Connect to the database
conn = sqlite3.connect('tweets.db')

# Create a table for the data
conn.execute('''CREATE TABLE IF NOT EXISTS tweets (Username TEXT UNIQUE, Biography TEXT, Created DATE, Followers TEXT)''')

max_followers = 3500
for word in keywords:
    # Create a cursor for the search
    cursor = tweepy.Cursor(api.search_users, q=word, count=100)

    # Iterate through the pages of the search results
    for page in cursor.pages(max_pages):
        # Iterate through the search results and print the screen name and biography of each profile
        for user in page:
            # Get the user's creation date
            creation_date = user.created_at
            # Convert the creation date to the local time zone
            creation_date = creation_date.astimezone(tz=utc)

            # Check if the keywords are in the biography
            if any(keyword in user.description for keyword in keywords) and creation_date >= datetime.datetime(2022, 5, 1, tzinfo=utc) and user.followers_count < max_followers:
                # Insert the screen name and biography into the table
                screen_name = user.screen_name.encode('utf-8')
                biography = user.description.encode('utf-8')
                follower_count = user.followers_count
                conn.execute("INSERT OR IGNORE INTO tweets (Username, Biography, Created, Followers) VALUES (?, ?, ?, ?)", (screen_name, biography, creation_date, follower_count))
                # Print the screen name and biography
                print(f'Screen name: {repr(screen_name)}')
                print(f'Biography: {repr(biography)}')
                print(f'Follower count: {follower_count}')

    # Commit the changes to the database
    conn.commit()

# Wait 15 minutes for the rate limit
print("Sleeping for 15 minutes")
time.sleep(900)

# Set the starting page number for the next set of pages
page = 51

# Set the maximum number of pages to retrieve
max_pages = 100

# Create a cursor for the search
cursor = tweepy.Cursor(api.search_users, q=word, count=100)

# Iterate through the pages of the search results
for page in cursor.pages(max_pages):
    # Iterate through the search results and print the screen name and biography of each profile
    for user in page:
        # Get the user's creation date
        creation_date = user.created_at
        # Convert the creation date to the local time zone
        creation_date = creation_date.astimezone(tz=utc)

        # Check if the keywords are in the biography
        if any(keyword in user.description for keyword in keywords) and creation_date >= datetime.datetime(2022, 5, 1, tzinfo=utc) and user.followers_count < max_followers:
            # Insert the screen name and biography into the table
            screen_name = user.screen_name.encode('utf-8')
            biography = user.description.encode('utf-8')
            follower_count = user.followers_count
            conn.execute("INSERT OR IGNORE INTO tweets (Username, Biography, Created, Followers) VALUES (?, ?, ?, ?)", (screen_name, biography, creation_date, follower_count))
            # Print the screen name and biography
            print(f'Screen name: {repr(screen_name)}')
            print(f'Biography: {repr(biography)}')
            print(f'Follower count: {follower_count}')

    # Commit the changes to the database
    conn.commit()

# Wait 15 minutes for the rate limit
print("Sleeping for 15 minutes")
time.sleep(900)

# Set the starting page number for the next set of pages
page = 101

# Set the maximum number of pages to retrieve
max_pages = 150
</code>```

Body:
I am currently trying to use the twitter api.cursor to page through pages 1-50, than wait 15 minutes to avoid rate limits, than pages 51-100, wait 15 minutes, than 101-150 etc. Is there an easier way for me to do this rather than how I currently am?

My goal is to get through as many page results as I can. I don't mind if I have to run the script for hours. I am trying to gather as much information as I can into my database.

# Set the starting page number
page = 1

# Set the maximum number of pages to retrieve
max_pages = 25

# Set a flag to indicate when to stop paginating
done = False

# Connect to the database
conn = sqlite3.connect('tweets.db')

# Create a table for the data
conn.execute('''CREATE TABLE IF NOT EXISTS tweets (Username TEXT UNIQUE, Biography TEXT, Created DATE, Followers TEXT)''')

max_followers = 3500
for word in keywords:
    # Create a cursor for the search
    cursor = tweepy.Cursor(api.search_users, q=word, count=100)

    # Iterate through the pages of the search results
    for page in cursor.pages(max_pages):
        # Iterate through the search results and print the screen name and biography of each profile
        for user in page:
            # Get the user's creation date
            creation_date = user.created_at
            # Convert the creation date to the local time zone
            creation_date = creation_date.astimezone(tz=utc)

            # Check if the keywords are in the biography
            if any(keyword in user.description for keyword in keywords) and creation_date >= datetime.datetime(2022, 5, 1, tzinfo=utc) and user.followers_count < max_followers:
                # Insert the screen name and biography into the table
                screen_name = user.screen_name.encode('utf-8')
                biography = user.description.encode('utf-8')
                follower_count = user.followers_count
                conn.execute("INSERT OR IGNORE INTO tweets (Username, Biography, Created, Followers) VALUES (?, ?, ?, ?)", (screen_name, biography, creation_date, follower_count))
                # Print the screen name and biography
                print(f'Screen name: {repr(screen_name)}')
                print(f'Biography: {repr(biography)}')
                print(f'Follower count: {follower_count}')

    # Commit the changes to the database
    conn.commit()

# Wait 15 minutes for the rate limit
print("Sleeping for 15 minutes")
time.sleep(900)

# Set the starting page number for the next set of pages
page = 51

# Set the maximum number of pages to retrieve
max_pages = 100

# Create a cursor for the search
cursor = tweepy.Cursor(api.search_users, q=word, count=100)

# Iterate through the pages of the search results
for page in cursor.pages(max_pages):
    # Iterate through the search results and print the screen name and biography of each profile
    for user in page:
        # Get the user's creation date
        creation_date = user.created_at
        # Convert the creation date to the local time zone
        creation_date = creation_date.astimezone(tz=utc)

        # Check if the keywords are in the biography
        if any(keyword in user.description for keyword in keywords) and creation_date >= datetime.datetime(2022, 5, 1, tzinfo=utc) and user.followers_count < max_followers:
            # Insert the screen name and biography into the table
            screen_name = user.screen_name.encode('utf-8')
            biography = user.description.encode('utf-8')
            follower_count = user.followers_count
            conn.execute("INSERT OR IGNORE INTO tweets (Username, Biography, Created, Followers) VALUES (?, ?, ?, ?)", (screen_name, biography, creation_date, follower_count))
            # Print the screen name and biography
            print(f'Screen name: {repr(screen_name)}')
            print(f'Biography: {repr(biography)}')
            print(f'Follower count: {follower_count}')

    # Commit the changes to the database
    conn.commit()

# Wait 15 minutes for the rate limit
print("Sleeping for 15 minutes")
time.sleep(900)

# Set the starting page number for the next set of pages
page = 101

# Set the maximum number of pages to retrieve
max_pages = 150


问:
Capturing and saving objects with fabric js
I'm using fabric JS to build out a canvas where users can then add any image wanted to this canvas, my question at hand is, how can i save that canvas or the positions of these images so if the user moves to canvas2 its a empty canvas but if user returns to the first canvas those images get loaded up in the last location they moved them?

Should i be using the toJSON() method fabric.js has to get the JSON data of those images then save data in a localStorage but how would i load it after? or is there a more efficient way with fabric.js?


问:
MongoDB Climb Hierarchy up Aggregation
i found a very old project which us using a MongoDB database. Unfortunately I do not get further with a query....

The following case:

We have a document called "folders"

```<code>{
    "_id" : ObjectId("1"),
    "Children" : {
        "Files" : [
            ObjectId("7"),
            ObjectId("8")
        ],
        "Folders" : [
            ObjectId("2"),
        ]
    }
},
{
    "_id" : ObjectId("2"),
    "Children" : {
        "Folders" : [
            ObjectId("3"),
        ]
    }
},
{
    "_id" : ObjectId("3"),
    "Children" : {
        "Folders" : [
            ObjectId("4"),
        ]
    }
},
{
    "_id" : ObjectId("4"),
    "Children" : {
        "Folders" : []
    }
},

</code>```

This is to represent a folder structure:

Folder 1 -> Folder 2 -> Folder 3 -> Folder 4

I now want a query where the id matches to the "folder 4" and the query should go up the hierarchy and pick out the parent folders 1, 2 & 3.

The problem: but folder 4 only shows up in the "Children.Folders" list of Order 3. Folder 3 shows up in the list of folder 2 and so on.

How to make such a query that finds the searched folder + all parent folders?

Title: MongoDB Climb Hierarchy up Aggregation

Body:
i found a very old project which us using a MongoDB database. Unfortunately I do not get further with a query....

The following case:

We have a document called "folders"

{
    "_id" : ObjectId("1"),
    "Children" : {
        "Files" : [
            ObjectId("7"),
            ObjectId("8")
        ],
        "Folders" : [
            ObjectId("2"),
        ]
    }
},
{
    "_id" : ObjectId("2"),
    "Children" : {
        "Folders" : [
            ObjectId("3"),
        ]
    }
},
{
    "_id" : ObjectId("3"),
    "Children" : {
        "Folders" : [
            ObjectId("4"),
        ]
    }
},
{
    "_id" : ObjectId("4"),
    "Children" : {
        "Folders" : []
    }
},

This is to represent a folder structure:

Folder 1 -> Folder 2 -> Folder 3 -> Folder 4

I now want a query where the id matches to the "folder 4" and the query should go up the hierarchy and pick out the parent folders 1, 2 & 3.

The problem: but folder 4 only shows up in the "Children.Folders" list of Order 3. Folder 3 shows up in the list of folder 2 and so on.

How to make such a query that finds the searched folder + all parent folders?


问:
expo-task-manager with expo-location error
Please provide the following:

SDK Version: "expo": "^45.0.0",

IOS Emulator (atm) but all normally.

expo-task-manager & expo-location

Hello, We are setting up background location tracking in our App...

I am defining my background location task before  is loaded

BackgroundLocation.ts

```<code>export const LOCATION_TASK_NAME = 'background-location-task'
function init() {
  TaskManager.defineTask(LOCATION_TASK_NAME, _execute)

    setTimeout(() => {
        TaskManager.getRegisteredTasksAsync().then((tasks) =>
            console.log('registered tasks', tasks) // logs empty array
        )
    }, 5000)
}

export default { init }
</code>```

App.tsx

```<code>import BackgroundLocation from '../../......'
BackgroundLocation.init()

export default App() { ... }
</code>```

Now in the App component hiararchy i have a Component called <LocationTracker />

```<code>import { LOCATION_TASK_NAME } from '../../BackgroundLocation'

...

React.useEffect(() => {
  async function handleLocation() {
            try {
                if (backgroundLocationServicesEnabled) {
                    await Location.startLocationUpdatesAsync(
                        LOCATION_TASK_NAME,
                        {
                            accuracy: Location.Accuracy.Balanced,
                            distanceInterval: 20,
                        }
                    )
                } else {
                    await Location.stopLocationUpdatesAsync(
                        LOCATION_TASK_NAME
                    ).catch((e) => {
                        console.error(
                            'error calling stopLocationUpdatesAsync',
                            e
                        )
                    })
                }
            } catch (e) {
                console.error('error in handleLocation', e)
            }
        }

        handleLocation().then(() => {})
}, [backgroundServicesEnabled])
</code>```

Background location is not enabled in my case so the error being fired is

```<code>error calling stopLocationUpdatesAsync, [Error: Task 'background-location-task' not found for app ID 'mainApplication'.]
at components/LocationTracker.tsx:70:37 in Location.stopLocationUpdatesAsync._catch$argument_0
</code>```

its this part

[Error: Task 'background-location-task' not found for app ID 'mainApplication'.]
that is causing me confusion because i'm registering that task ID right at the begining of the app.

OP over here https://forums.expo.dev/t/expo-task-manager-with-expo-location-error/68515

Body:
Please provide the following:

SDK Version: "expo": "^45.0.0",

IOS Emulator (atm) but all normally.

expo-task-manager & expo-location

Hello, We are setting up background location tracking in our App...

I am defining my background location task before  is loaded

BackgroundLocation.ts

export const LOCATION_TASK_NAME = 'background-location-task'
function init() {
  TaskManager.defineTask(LOCATION_TASK_NAME, _execute)

    setTimeout(() => {
        TaskManager.getRegisteredTasksAsync().then((tasks) =>
            console.log('registered tasks', tasks) // logs empty array
        )
    }, 5000)
}

export default { init }

App.tsx

import BackgroundLocation from '../../......'
BackgroundLocation.init()

export default App() { ... }

Now in the App component hiararchy i have a Component called <LocationTracker />

import { LOCATION_TASK_NAME } from '../../BackgroundLocation'

...

React.useEffect(() => {
  async function handleLocation() {
            try {
                if (backgroundLocationServicesEnabled) {
                    await Location.startLocationUpdatesAsync(
                        LOCATION_TASK_NAME,
                        {
                            accuracy: Location.Accuracy.Balanced,
                            distanceInterval: 20,
                        }
                    )
                } else {
                    await Location.stopLocationUpdatesAsync(
                        LOCATION_TASK_NAME
                    ).catch((e) => {
                        console.error(
                            'error calling stopLocationUpdatesAsync',
                            e
                        )
                    })
                }
            } catch (e) {
                console.error('error in handleLocation', e)
            }
        }

        handleLocation().then(() => {})
}, [backgroundServicesEnabled])

Background location is not enabled in my case so the error being fired is

error calling stopLocationUpdatesAsync, [Error: Task 'background-location-task' not found for app ID 'mainApplication'.]
at components/LocationTracker.tsx:70:37 in Location.stopLocationUpdatesAsync._catch$argument_0

its this part

[Error: Task 'background-location-task' not found for app ID 'mainApplication'.]
that is causing me confusion because i'm registering that task ID right at the begining of the app.

OP over here https://forums.expo.dev/t/expo-task-manager-with-expo-location-error/68515


问:
spring cloud config server with multiple property sources
I have spring cloud config server reading properties from multiple sources (Git and Vault). For a given path, even it finds the resource in Git, it still queries vault and report failure as the resources are not available at both sources. My requirement is to look for a resource and if its found, no need to query the other source. Please suggest if its possible. Thanks</p>


问:
React passwordless login with firebase: Uncaught (in promise) FirebaseError: Firebase: Error (auth/argument-error)
I'm trying to enable passwordless login with React and I'm running into an error.

firebase.ts

```<code>import { initializeApp } from 'firebase/app'
import { getAuth } from 'firebase/auth'

const firebaseConfig = {
    apiKey: 'XXXXX',
    authDomain: 'XXXX',
    projectId: 'XX',
    storageBucket: 'XX',
    messagingSenderId: 'XX',
    appId: 'XXX',
}

const app = initializeApp(firebaseConfig)

export const auth = getAuth(app)
export default app
</code>```

When I try to use any of these functions the code works just fine.

```<code>createUserWithEmailAndPassword,signInWithEmailAndPassword
</code>```

For example, this works fine ->

```<code>import { createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth'
import { TextInput, Button, Box } from '@mantine/core'
import { useForm } from '@mantine/form'
import { auth } from '../../firebase/firebase'
import { useNavigate } from 'react-router-dom'
import passwordAndEmailFormValidation from '../utils/formValidation'

export default function SignUp() {
    const navigate = useNavigate()

    const form = useForm(passwordAndEmailFormValidation)

    const handleSignUp = async () => {
        form.validate()
        const { email, password } = form.values
        console.log(email, password)
        createUserWithEmailAndPassword(auth, email, password)
            .then(userCredential => {
                const user = userCredential.user
                console.log(user)
                sendEmailVerification(user)
                navigate('/verify-email')
            })
            .catch(error => {
                const errorCode = error.code
                const errorMessage = error.message
                console.log({ errorCode, errorMessage })
            })
    }

    return (
        <Box p="3rem">
            Sign Up
            <Box w="400px">
                <TextInput
                    withAsterisk
                    label="Email"
                    placeholder="your@email.com"
                    size="sm"
                    type="email"
                    {...form.getInputProps('email')}
                />
                <TextInput
                    withAsterisk
                    type="password"
                    label="Password"
                    size="sm"
                    placeholder="password"
                    {...form.getInputProps('password')}
                />
                <Box mt="1rem">
                    <Button onClick={handleSignUp}>Submit</Button>
                </Box>
            </Box>
        </Box>
    )
}
</code>```

However, whenever I replace createUserWithEmailAndPassword to sendSignInLinkToEmail  I get the error message Uncaught (in promise) FirebaseError: Firebase: Error (auth/argument-error).

```<code>sendSignInLinkToEmail(auth, email, {url:"http://localhost:3000"}).then(()=>{

    console.log("Email sent")
})
</code>```

Any suggestions on how I could fix this? Been stuck on this for a while so any help would be appreciated. Using Firebase v9 on React 18.

Body:
I'm trying to enable passwordless login with React and I'm running into an error.

firebase.ts

import { initializeApp } from 'firebase/app'
import { getAuth } from 'firebase/auth'

const firebaseConfig = {
    apiKey: 'XXXXX',
    authDomain: 'XXXX',
    projectId: 'XX',
    storageBucket: 'XX',
    messagingSenderId: 'XX',
    appId: 'XXX',
}

const app = initializeApp(firebaseConfig)

export const auth = getAuth(app)
export default app

When I try to use any of these functions the code works just fine.

createUserWithEmailAndPassword,signInWithEmailAndPassword

For example, this works fine ->

import { createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth'
import { TextInput, Button, Box } from '@mantine/core'
import { useForm } from '@mantine/form'
import { auth } from '../../firebase/firebase'
import { useNavigate } from 'react-router-dom'
import passwordAndEmailFormValidation from '../utils/formValidation'

export default function SignUp() {
    const navigate = useNavigate()

    const form = useForm(passwordAndEmailFormValidation)

    const handleSignUp = async () => {
        form.validate()
        const { email, password } = form.values
        console.log(email, password)
        createUserWithEmailAndPassword(auth, email, password)
            .then(userCredential => {
                const user = userCredential.user
                console.log(user)
                sendEmailVerification(user)
                navigate('/verify-email')
            })
            .catch(error => {
                const errorCode = error.code
                const errorMessage = error.message
                console.log({ errorCode, errorMessage })
            })
    }

    return (
        <Box p="3rem">
            Sign Up
            <Box w="400px">
                <TextInput
                    withAsterisk
                    label="Email"
                    placeholder="your@email.com"
                    size="sm"
                    type="email"
                    {...form.getInputProps('email')}
                />
                <TextInput
                    withAsterisk
                    type="password"
                    label="Password"
                    size="sm"
                    placeholder="password"
                    {...form.getInputProps('password')}
                />
                <Box mt="1rem">
                    <Button onClick={handleSignUp}>Submit</Button>
                </Box>
            </Box>
        </Box>
    )
}

However, whenever I replace createUserWithEmailAndPassword to sendSignInLinkToEmail  I get the error message Uncaught (in promise) FirebaseError: Firebase: Error (auth/argument-error).

sendSignInLinkToEmail(auth, email, {url:"http://localhost:3000"}).then(()=>{

    console.log("Email sent")
})

Any suggestions on how I could fix this? Been stuck on this for a while so any help would be appreciated. Using Firebase v9 on React 18.


问:
Why my uint16_t in a Struct uses 4 bytes of memory with a fresh install of GCC in VSCode on Windows?
I just installed VSCODE, MSYS2 and GCC on my W11 PC. This is a by default install.

In order to play with .bmp file I have a small piece of code using a struct for the header.
Start of the struct definition is :

```<code>struct  bmp_header_st{
    uint16_t bfType;
    uint32_t bfSize;
    uint16_t bfReserved1;
    uint16_t bfReserved2;
    uint32_t bfOffBits;
    ...
</code>```

then the variable for the header is declared:
struct bmp_header_st bitmap_header;

When bitmap_header variable is loaded via a file read (fread( &bitmap_header, 1, hsize, pfile);), I do not get the expected values in the struct fields; but if I dump the memory area of the bitmap_header variable I have the exact image of the .bmp file loaded.

It seems that fields of the struct are not aligned where I expect them to be. That's confirmed by displaying fields adress with VSCode :

bfType is in 0xc8e53ff790

bfSize is in 0xc8e53ff794

bfReserved1 is in 0xc8e53ff798

That means that uint32_t is allocated on 4 bytes, which is ok, but also uint16_t which is not and this is why when I load the bmp file in memory, data are not at the right place.

Any idea ?, this is certainly not much, but I have no clue !

Memory dump of the Struct after having being loaded from file
Adresses of the fields of the Struct

Body:
I just installed VSCODE, MSYS2 and GCC on my W11 PC. This is a by default install.

In order to play with .bmp file I have a small piece of code using a struct for the header.
Start of the struct definition is :

struct  bmp_header_st{
    uint16_t bfType;
    uint32_t bfSize;
    uint16_t bfReserved1;
    uint16_t bfReserved2;
    uint32_t bfOffBits;
    ...

then the variable for the header is declared:
struct bmp_header_st bitmap_header;

When bitmap_header variable is loaded via a file read (fread( &bitmap_header, 1, hsize, pfile);), I do not get the expected values in the struct fields; but if I dump the memory area of the bitmap_header variable I have the exact image of the .bmp file loaded.

It seems that fields of the struct are not aligned where I expect them to be. That's confirmed by displaying fields adress with VSCode :

bfType is in 0xc8e53ff790

bfSize is in 0xc8e53ff794

bfReserved1 is in 0xc8e53ff798

That means that uint32_t is allocated on 4 bytes, which is ok, but also uint16_t which is not and this is why when I load the bmp file in memory, data are not at the right place.

Any idea ?, this is certainly not much, but I have no clue !

Memory dump of the Struct after having being loaded from file
Adresses of the fields of the Struct


问:
neovim color scheme is causing everything to be very dark
Inside my ~/.config/nvim/ directory I have my init.vim file and another directory named lua which contains plugins.lua and I am using Packer to install the color schemes.

My inti.vim contains

```<code>lua require('plugins')

set background=dark
colorscheme gruvbox
</code>```

and inside ~/.config/lua/plugins.lua I have

```<code>packer = require 'packer'
packer.init{
}

local use = packer.use
packer.reset()

packer.startup(function()
  use 'wbthomason/packer.nvim'
  use "ellisonleao/gruvbox.nvim"
end)
</code>```

I have tried using Vundle to install the plugins and I also tried different color schemes and I keep getting the same thing.

Body:
Inside my ~/.config/nvim/ directory I have my init.vim file and another directory named lua which contains plugins.lua and I am using Packer to install the color schemes.

My inti.vim contains

lua require('plugins')

set background=dark
colorscheme gruvbox

and inside ~/.config/lua/plugins.lua I have

packer = require 'packer'
packer.init{
}

local use = packer.use
packer.reset()

packer.startup(function()
  use 'wbthomason/packer.nvim'
  use "ellisonleao/gruvbox.nvim"
end)

I have tried using Vundle to install the plugins and I also tried different color schemes and I keep getting the same thing.


问:
Swift Async method
I'my studying asynchronous method right now and trying some code.

I learned that if you don't designate, all your x-code codes are executed on main-thread.

When you designated some task in async, that codes will be executed asynchronously.

That situation might be downloading from network such a heavy file because it may cause ui-update slow.

I understand the situation. But now I have a problem.

codes below is downloading songBytes from url and the final goal is update download progress view.

```<code>func downloadSongBytes(at url: URL, progress: Binding<Float>) async throws {
let (asyncBytes, response) = try await session.bytes(from: url)

let contentLength = Float(response.expectedContentLength)
var data = Data(capacity: Int(contentLength))

for try await byte in asyncBytes {
  data.append(byte)

  let currentProgress = Float(data.count) / contentLength

  if Int(progress.wrappedValue * 100) != Int(currentProgress * 100) {
    progress.wrappedValue = currentProgress
  }
}
</code>```

}

the firstline of this code,

are we waiting for try await session.bytes to finish?

then get the return value(asyncBytes) and execute downside?

In mainUIView file, I don't repeat(call) the func downloadSongBytes, but how can I get repeatedly asynBytes so that I can calculate currentProgress..?

can someone tell me the whole progress of doing this?(total progress by a single line..)

Title: Swift Async method

Body:
I'my studying asynchronous method right now and trying some code.

I learned that if you don't designate, all your x-code codes are executed on main-thread.

When you designated some task in async, that codes will be executed asynchronously.

That situation might be downloading from network such a heavy file because it may cause ui-update slow.

I understand the situation. But now I have a problem.

codes below is downloading songBytes from url and the final goal is update download progress view.

func downloadSongBytes(at url: URL, progress: Binding<Float>) async throws {
let (asyncBytes, response) = try await session.bytes(from: url)

let contentLength = Float(response.expectedContentLength)
var data = Data(capacity: Int(contentLength))

for try await byte in asyncBytes {
  data.append(byte)

  let currentProgress = Float(data.count) / contentLength

  if Int(progress.wrappedValue * 100) != Int(currentProgress * 100) {
    progress.wrappedValue = currentProgress
  }
}

}

the firstline of this code,

are we waiting for try await session.bytes to finish?

then get the return value(asyncBytes) and execute downside?

In mainUIView file, I don't repeat(call) the func downloadSongBytes, but how can I get repeatedly asynBytes so that I can calculate currentProgress..?

can someone tell me the whole progress of doing this?(total progress by a single line..)


问:
How to remove scrollspy effect at the top of the page
I have a fixed menu bar that contains anchor links to some sections. I'm using JS scrollspy to show which section the user is on, it changes the border color of the selected section.

By default none of the anchor links should be selected, I was able to achieve that on page load, but when you scroll back up, even though none of the sections are within page view the first anchor link stays selected.

I want all of the anchor links should turn back to orange every time the user scrolls back up the page

(when they are out of any of the sections that are connected to the anchor links and they are back to the first part of the page, I named the class "first", for your reference)

I assume I'd need to use JavaScript to achieve that but I'm not familiar with it. I would appreciate your help in this area. Thanks!

Following is my complete code for your reference:

var sectionArray = [1, 2, 3, 4];

$.each(sectionArray, function(index, value) {

  $(document).scroll(function() {
    var offsetSection = $('#' + 'section' + value).offset().top - 300;
    var docScroll = $(document).scrollTop();
    var docScroll1 = docScroll + 1;

    if (docScroll1 >= offsetSection) {
      $('.scrollspy a').removeClass('active');
      $('.scrollspy a:link').addClass('inactive');
      $('.scrollspy a').eq(index).addClass('active');
      $('.scrollspy a:link').eq(index).removeClass('inactive');
    }

  });

  $('.scrollspy a').eq(index).click(function(e) {
    var offsetClick = $('#' + 'section' + value).offset().top - 300;
    e.preventDefault();
    $('html, body').animate({
      'scrollTop': offsetClick
    }, 30)

  });
});

$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey").addClass("grey");
  } else {
    $("#grey").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey1").addClass("grey");
  } else {
    $("#grey1").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey2").addClass("grey");
  } else {
    $("#grey2").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey3").addClass("grey");
  } else {
    $("#grey3").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#background").addClass("back");
  } else {
    $("#background").removeClass("back");
  }
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 187px;
}

.header {
  height: 187px;
  width: 1920px;
  background: #161B21 0% 0% no-repeat padding-box;
  box-shadow: 0px 18px 13px #00000029;
  opacity: 1;
  position: fixed;
  z-index: 10;
}

.Nav-bar {
  text-align: left;
  font: 26px;
  letter-spacing: 0px;
  color: #ABAAAA;
  opacity: 1;
  text-decoration: none;
  margin-top: 86px;
  float: left;
  margin-left: 146px;
}

footer {
  background-color: black;
  width: 1920px;
  height: 200px;
}

.first {
  background-color: lightseagreen;
  width: 1920px;
  height: 1200px;
}

.filler {
  padding-bottom: 900px;
}

.anchor1 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 143px;
  text-decoration: none;
  font-size: 40px;
  color: white;
}

.anchor2 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 579px;
  font-size: 40px;
  color: white;
  text-decoration: none;
}

.anchor3 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 1015px;
  font-size: 40px;
  color: white;
  text-decoration: none;
}

.anchor4 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 1451px;
  font-size: 40px;
  text-decoration: none;
  color: white;
}

.back {
  position: fixed;
  top: 187px;
  width: 1920px;
  height: 115px;
  background-color: #161B21;
  transition: all 1s ease-in-out;
}

.grey {
  border: 4px solid #ABAAAA;
  position: fixed;
  top: 187px;
  transition: all 0.5s ease-in-out;
  transform: scale(0.8);
}

#section1 {
  width: 1920px;
  height: 916px;
  background: green;
}

#section2 {
  width: 1920px;
  height: 916px;
  background: blueviolet;
}

#section3 {
  width: 1920px;
  height: 916px;
  background: red;
}

#section4 {
  width: 1920px;
  height: 916px;
  background: orange;
}

.active {
  border-color: #F4A950;
}

.inactive {
  border-color: #ABAAAA;
}</code>```

<!DOCTYPE html>

      Item 1
      Item 2
      Item 3
      Item 4

Section 1

Section 2

Section 3

Section 4

Section 1

Section 2

Section 3

Section 4

```

Body:
I have a fixed menu bar that contains anchor links to some sections. I'm using JS scrollspy to show which section the user is on, it changes the border color of the selected section.

By default none of the anchor links should be selected, I was able to achieve that on page load, but when you scroll back up, even though none of the sections are within page view the first anchor link stays selected.

I want all of the anchor links should turn back to orange every time the user scrolls back up the page

(when they are out of any of the sections that are connected to the anchor links and they are back to the first part of the page, I named the class "first", for your reference)

I assume I'd need to use JavaScript to achieve that but I'm not familiar with it. I would appreciate your help in this area. Thanks!

Following is my complete code for your reference:

var sectionArray = [1, 2, 3, 4];

$.each(sectionArray, function(index, value) {

  $(document).scroll(function() {
    var offsetSection = $('#' + 'section' + value).offset().top - 300;
    var docScroll = $(document).scrollTop();
    var docScroll1 = docScroll + 1;

    if (docScroll1 >= offsetSection) {
      $('.scrollspy a').removeClass('active');
      $('.scrollspy a:link').addClass('inactive');
      $('.scrollspy a').eq(index).addClass('active');
      $('.scrollspy a:link').eq(index).removeClass('inactive');
    }

  });

  $('.scrollspy a').eq(index).click(function(e) {
    var offsetClick = $('#' + 'section' + value).offset().top - 300;
    e.preventDefault();
    $('html, body').animate({
      'scrollTop': offsetClick
    }, 30)

  });
});

$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey").addClass("grey");
  } else {
    $("#grey").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey1").addClass("grey");
  } else {
    $("#grey1").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey2").addClass("grey");
  } else {
    $("#grey2").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#grey3").addClass("grey");
  } else {
    $("#grey3").removeClass("grey");
  }
});
$(window).scroll(function() {
  var scroll = $(window).scrollTop();

  if (scroll >= 597) {
    $("#background").addClass("back");
  } else {
    $("#background").removeClass("back");
  }
});

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 187px;
}

.header {
  height: 187px;
  width: 1920px;
  background: #161B21 0% 0% no-repeat padding-box;
  box-shadow: 0px 18px 13px #00000029;
  opacity: 1;
  position: fixed;
  z-index: 10;
}

.Nav-bar {
  text-align: left;
  font: 26px;
  letter-spacing: 0px;
  color: #ABAAAA;
  opacity: 1;
  text-decoration: none;
  margin-top: 86px;
  float: left;
  margin-left: 146px;
}

footer {
  background-color: black;
  width: 1920px;
  height: 200px;
}

.first {
  background-color: lightseagreen;
  width: 1920px;
  height: 1200px;
}

.filler {
  padding-bottom: 900px;
}

.anchor1 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 143px;
  text-decoration: none;
  font-size: 40px;
  color: white;
}

.anchor2 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 579px;
  font-size: 40px;
  color: white;
  text-decoration: none;
}

.anchor3 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 1015px;
  font-size: 40px;
  color: white;
  text-decoration: none;
}

.anchor4 {
  border: 4px solid #F4A950;
  opacity: 1;
  width: 326px;
  height: 91px;
  position: absolute;
  margin-left: 1451px;
  font-size: 40px;
  text-decoration: none;
  color: white;
}

.back {
  position: fixed;
  top: 187px;
  width: 1920px;
  height: 115px;
  background-color: #161B21;
  transition: all 1s ease-in-out;
}

.grey {
  border: 4px solid #ABAAAA;
  position: fixed;
  top: 187px;
  transition: all 0.5s ease-in-out;
  transform: scale(0.8);
}

#section1 {
  width: 1920px;
  height: 916px;
  background: green;
}

#section2 {
  width: 1920px;
  height: 916px;
  background: blueviolet;
}

#section3 {
  width: 1920px;
  height: 916px;
  background: red;
}

#section4 {
  width: 1920px;
  height: 916px;
  background: orange;
}

.active {
  border-color: #F4A950;
}

.inactive {
  border-color: #ABAAAA;
}

<!DOCTYPE html>

      Item 1
      Item 2
      Item 3
      Item 4

Section 1

Section 2

Section 3

Section 4

Section 1

Section 2

Section 3

Section 4


问:
USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
What I'm trying to do:

I'm trying to make a Python Selenium code that send a specific keys in a specific boxes

What I've written in the code:

import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from time import sleep

driver = webdriver.Chrome()

driver.get(url="https://netflix.com/login")
sleep(5)
email= driver.find_element(By.ID, ("id_userLoginId"))
sleep(1)
email.send_keys("this is a test")
```
<p><strong>What didn't work:</strong></p>
<blockquote>
<p>The <code>email.send_keys()</code> function didn't work.</p>
</blockquote>
<p><strong>The FULL traceback:</strong></p>
```DevTools listening on ws://127.0.0.1:57667/devtools/browser/02d155e8-cdf4-46ce-b2a0-db7cab336de7
[21032:13540:1222/231537.176:ERROR:device_event_log_impl.cc(215)] [23:15:37.176] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
```

Body:
What I'm trying to do:

I'm trying to make a Python Selenium code that send a specific keys in a specific boxes

What I've written in the code:

import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from time import sleep

driver = webdriver.Chrome()

driver.get(url="https://netflix.com/login")
sleep(5)
email= driver.find_element(By.ID, ("id_userLoginId"))
sleep(1)
email.send_keys("this is a test")

What didn't work:

The email.send_keys() function didn't work.

The FULL traceback:

DevTools listening on ws://127.0.0.1:57667/devtools/browser/02d155e8-cdf4-46ce-b2a0-db7cab336de7
[21032:13540:1222/231537.176:ERROR:device_event_log_impl.cc(215)] [23:15:37.176] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)


问:
Mozilla Android Kiosk-mode
I'm working on trying to use Firefox on Android in kiosk mode.

My objective is to disable to the ability to use address bar and browse to other places.

It has to be Firefox because that is what our vendor supports. Our Enterprise Home Screen has a kiosk feature and the users won't be able to exit out but they will still be able to browse around.

Currently using Firefox 103.2.0 on Android 11

I have tried disabling the keyboard since it won't be needed much but the users will still eventually need to use it as well.

Is this still not something Firefox can do?

Title: Mozilla Android Kiosk-mode


问:
Transpile async/await to Generator functions with tsc with target >= ES2017
I hardly try to transpile async/await patterns to generator functions for targets >= ES2017 with tsc. This seems to be possible with babel (@babel/plugin-proposal-async-generator-function or @babel/plugin-transform-async-to-generator), but I try to stick with tsc only.

I would like to use zone.js for something, until we found a better solution. Becasue zone.js does not support native async/await, I look for workarounds.

Do you know, if tsc supports this now or soon? Thank you for any hint!

Best regards,
Dominic

Google research and I tried if any of https://github.com/microsoft/TypeScript/tree/main/src/lib could match my issue.


问:
How do I set the Domain-level access policy in OpenSearch for only the VPC that it is in?
Current configuration:

```<code>{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "es:*",
      "Resource": "arn:aws:es:us-west-2:000000000000:domain/opensearch-dev/*"
    }
  ]
}
</code>```

My goal is to ensure only systems within our dev VPC can access this opensearch cluster. Would this accomplish this or is this too permissive?

Body:
Current configuration:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "es:*",
      "Resource": "arn:aws:es:us-west-2:000000000000:domain/opensearch-dev/*"
    }
  ]
}

My goal is to ensure only systems within our dev VPC can access this opensearch cluster. Would this accomplish this or is this too permissive?


问:
React Native Firebase Firestore Cannot read property 'scope' of null
Since today, I have this error when running my app :
node_modules/@firebase/firestore/dist/rn/prebuilt.rn-d6d8673f.js: Cannot read property 'scope' of null

```<code>"react-native": "~0.63.4"
</code>```
```<code>"firebase": "8.10.0"
</code>```

Any idea?

I already removed my node_modules and reinstalled.

Body:
Since today, I have this error when running my app :
node_modules/@firebase/firestore/dist/rn/prebuilt.rn-d6d8673f.js: Cannot read property 'scope' of null

"react-native": "~0.63.4"

"firebase": "8.10.0"

Any idea?

I already removed my node_modules and reinstalled.


问:
How do you detect CTRL + keypress in linux terminal?
I have this function that gets one character input in the terminal without the user having to press Enter. I can detect ALT + another key by checking for '\033' (escape), but how do I check if user pressed CTRL + another key?</p>
```<code>int getch() {
    struct termios oldt, newt;
    int ch;
    tcgetattr(STDIN_FILENO, &oldt);
    newt = oldt;
    newt.c_lflag &= ~(ICANON | ECHO);
    tcsetattr(STDIN_FILENO, TCSANOW, &newt);
    ch = getc(stdin);
    tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
    return ch;
}
</code>```

Body:
I have this function that gets one character input in the terminal without the user having to press Enter. I can detect ALT + another key by checking for '\033' (escape), but how do I check if user pressed CTRL + another key?

int getch() {
    struct termios oldt, newt;
    int ch;
    tcgetattr(STDIN_FILENO, &oldt);
    newt = oldt;
    newt.c_lflag &= ~(ICANON | ECHO);
    tcsetattr(STDIN_FILENO, TCSANOW, &newt);
    ch = getc(stdin);
    tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
    return ch;
}


问:
Dry-validation/Dry-schema uninitialized constant Dry::Schema::PredicateRegistry
I'm attempting to update the ruby version of an empty, stock API (which is forked to create new API) from Ruby 2.6.3 to Ruby 2.7.3 using TrailBlazer.

Currently, I'm having issues with the Dry gems, specifically Dry-Validation (1.8.0), Dry-Schema (1.9.1), and their Predicate Registry extension.

Every time I run bundle exec rspec , I get this error:

```<code>Failure/Error: require './initialize'

NameError:
  uninitialized constant Dry::Schema::PredicateRegistry
</code>```

With this stack-trace:

```<code># /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:25:in `<class:Config>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:14:in `<module:Schema>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:8:in `<module:Dry>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:7:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry/validation/config.rb:3:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry/validation/contract.rb:9:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry/validation.rb:4:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry-validation.rb:3:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/reform-2.6.2/lib/reform/form/dry.rb:2:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/bundler/gems/<OMITTED, COMPANY SPECIFIC GEM>/system/boot/reform.rb:6:in `block (2 levels) in <top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider.rb:231:in `public_send'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider.rb:231:in `run_step'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider.rb:167:in `start'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider_registrar.rb:252:in `with_provider'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider_registrar.rb:175:in `start'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/container.rb:385:in `start'
# ./initialize.rb:5:in `<top (required)>'
# ./spec/spec_helper.rb:13:in `<top (required)>'
</code>```

Gemfile:

```<code># frozen_string_literal: true

source 'https://rubygems.org'

ruby '2.7.3'

group :production do
  gem 'dry-container', "~>0.7"
  gem 'dry-struct'
  gem 'dry-system'
  gem 'dry-validation', "1.8"
  gem 'dry-schema', "~>1.9", ">=1.9.1"
  gem 'grape-swagger'
  gem 'multi_json'
  gem 'mysql2'
  gem 'aws-sdk-s3'
  # gem 'ruby-oci8'
  <OMITTED, COMPANY-SPECIC GEM>
  gem 'trailblazer', '~>2.0.1'
  gem 'unicorn'
  gem 'activesupport', '~>5.1'
end

group :test, :development do
  gem 'bundler-audit'
  gem 'climate_control'
  gem 'codeclimate-test-reporter'
  gem 'database_cleaner'
  gem 'factory_bot', "~> 6.2.0"
  gem 'faker'
  gem 'pry'
  gem 'rack-test'
  gem 'rake'
  gem 'reek'
  gem 'rspec'
  gem 'rspec_junit_formatter'
  gem 'rspec_sequel_matchers', git: 'https://github.com/openhood/rspec_sequel_matchers.git', branch: 'master'
  gem 'rubocop', '~> 0.9'
  gem 'rubocop-junit_formatter'
  gem 'rubocop-performance'
  gem 'shoulda-matchers', '~>4.5.1'
  gem 'simplecov', require: false
  gem 'webmock'
end
</code>```

Gemfile.lock:

```<code>GIT
  remote: https://github.com/openhood/rspec_sequel_matchers.git
  revision: c0cfbd0599d856970f7cbf9cdd55175110888306
  branch: master
  specs:
    rspec_sequel_matchers (0.5.0)
      sequel (>= 3.8.0)

GIT
  remote: <OMITTED, COMPANY SPECIFIC GEM>
  revision: 697183381bfea3fb8fe1b69d1de54de961768ea3
  branch: sthieme-ruby-updates-test
  specs:
    <OMITTED, COMPANY SPECIFIC GEM>
      activesupport (~> 5.1)
      addressable (~> 2.5)
      aws-sdk-s3 (~> 1.8)
      bunny (~> 2.7)
      dotenv (~> 2.2)
      dry-configurable (~> 0.13)
      dry-matcher (~> 0.8)
      dry-system (~> 0.9)
      dry-validation (~> 1.8)
      elastic-apm (~> 2.1)
      erb-file_out (~> 0.1)
      faker (~> 1.8)
      faraday (~> 0.13)
      grape (~> 1.2)
      jwt (~> 2.2)
      mongo (~> 2.5)
      net-sftp (~> 2.1)
      net-ssh (~> 5.0.0.beta2)
      rack (~> 2.0.9)
      rack-cors (~> 1.0)
      rack-heartbeat (~> 1.1)
      rack-protection (~> 2.0)
      rubyzip (~> 1.2)
      secure_headers (~> 6.0)
      sequel (~> 5.4)
      slack-notifier (~> 2.3)
      trailblazer (~> 2.0)

GEM
  remote: https://rubygems.org/
  specs:
    activemodel (5.2.8.1)
      activesupport (= 5.2.8.1)
    activerecord (5.2.8.1)
      activemodel (= 5.2.8.1)
      activesupport (= 5.2.8.1)
      arel (>= 9.0)
    activesupport (5.2.8.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.8.1)
      public_suffix (>= 2.0.2, < 6.0)
    amq-protocol (2.3.2)
    arel (9.0.0)
    ast (2.4.2)
    aws-eventstream (1.2.0)
    aws-partitions (1.683.0)
    aws-sdk-core (3.168.4)
      aws-eventstream (~> 1, >= 1.0.2)
      aws-partitions (~> 1, >= 1.651.0)
      aws-sigv4 (~> 1.5)
      jmespath (~> 1, >= 1.6.1)
    aws-sdk-kms (1.61.0)
      aws-sdk-core (~> 3, >= 3.165.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-s3 (1.117.2)
      aws-sdk-core (~> 3, >= 3.165.0)
      aws-sdk-kms (~> 1)
      aws-sigv4 (~> 1.4)
    aws-sigv4 (1.5.2)
      aws-eventstream (~> 1, >= 1.0.2)
    bson (4.15.0)
    builder (3.2.4)
    bundler-audit (0.9.1)
      bundler (>= 1.2.0, < 3)
      thor (~> 1.0)
    bunny (2.20.1)
      amq-protocol (~> 2.3, >= 2.3.1)
      sorted_set (~> 1, >= 1.0.2)
    climate_control (1.2.0)
    codeclimate-test-reporter (1.0.7)
      simplecov
    coderay (1.1.3)
    concurrent-ruby (1.1.10)
    crack (0.4.5)
      rexml
    database_cleaner (2.0.1)
      database_cleaner-active_record (~> 2.0.0)
    database_cleaner-active_record (2.0.1)
      activerecord (>= 5.a)
      database_cleaner-core (~> 2.0.0)
    database_cleaner-core (2.0.1)
    declarative (0.0.20)
    diff-lcs (1.5.0)
    disposable (0.6.3)
      declarative (>= 0.0.9, < 1.0.0)
      representable (>= 3.1.1, < 4)
    docile (1.4.0)
    domain_name (0.5.20190701)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.8.1)
    dry-auto_inject (0.9.0)
      dry-container (>= 0.3.4)
    dry-configurable (0.16.1)
      dry-core (~> 0.6)
      zeitwerk (~> 2.6)
    dry-container (0.11.0)
      concurrent-ruby (~> 1.0)
    dry-core (0.9.1)
      concurrent-ruby (~> 1.0)
      zeitwerk (~> 2.6)
    dry-inflector (0.3.0)
    dry-initializer (3.1.1)
    dry-logic (1.3.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.9, >= 0.9)
      zeitwerk (~> 2.6)
    dry-matcher (0.9.0)
      dry-core (~> 0.4, >= 0.4.8)
    dry-schema (1.11.3)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 0.16, >= 0.16)
      dry-core (~> 0.9, >= 0.9)
      dry-initializer (~> 3.0)
      dry-logic (~> 1.3)
      dry-types (~> 1.6)
      zeitwerk (~> 2.6)
    dry-struct (1.5.2)
      dry-core (~> 0.9, >= 0.9)
      dry-types (~> 1.6)
      ice_nine (~> 0.11)
      zeitwerk (~> 2.6)
    dry-system (0.27.2)
      dry-auto_inject (>= 0.4.0)
      dry-configurable (~> 0.16, >= 0.16.0)
      dry-container (~> 0.10, >= 0.10.0)
      dry-core (~> 0.9, >= 0.9.0)
      dry-inflector (~> 0.1, >= 0.1.2)
      zeitwerk (~> 2.6)
    dry-types (1.6.1)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.3)
      dry-core (~> 0.9, >= 0.9)
      dry-inflector (~> 0.1, >= 0.1.2)
      dry-logic (~> 1.3, >= 1.3)
      zeitwerk (~> 2.6)
    dry-validation (1.8.0)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.7, >= 0.7.1)
      dry-core (~> 0.5, >= 0.5)
      dry-initializer (~> 3.0)
      dry-schema (~> 1.9, >= 1.9.1)
    elastic-apm (2.12.0)
      concurrent-ruby (~> 1.0)
      http (>= 3.0)
    erb-file_out (0.1.2)
    factory_bot (6.2.1)
      activesupport (>= 5.0.0)
    faker (1.9.6)
      i18n (>= 0.7)
    faraday (0.17.6)
      multipart-post (>= 1.2, < 3)
    ffi (1.15.5)
    ffi-compiler (1.0.1)
      ffi (>= 1.0.0)
      rake
    grape (1.7.0)
      activesupport
      builder
      dry-types (>= 1.1)
      mustermann-grape (~> 1.0.0)
      rack (>= 1.3.0)
      rack-accept
    grape-swagger (1.5.0)
      grape (~> 1.3)
    hashdiff (1.0.1)
    http (5.1.1)
      addressable (~> 2.8)
      http-cookie (~> 1.0)
      http-form_data (~> 2.2)
      llhttp-ffi (~> 0.4.0)
    http-cookie (1.0.5)
      domain_name (~> 0.5)
    http-form_data (2.3.0)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    ice_nine (0.11.2)
    jmespath (1.6.2)
    jwt (2.6.0)
    kgio (2.11.4)
    kwalify (0.7.2)
    llhttp-ffi (0.4.0)
      ffi-compiler (~> 1.0)
      rake (~> 13.0)
    method_source (1.0.0)
    minitest (5.16.3)
    mongo (2.18.2)
      bson (>= 4.14.1, < 5.0.0)
    multi_json (1.15.0)
    multipart-post (2.2.3)
    mustermann (3.0.0)
      ruby2_keywords (~> 0.0.1)
    mustermann-grape (1.0.2)
      mustermann (>= 1.0.0)
    mysql2 (0.5.4)
    net-sftp (2.1.2)
      net-ssh (>= 2.6.5)
    net-ssh (5.0.2)
    parallel (1.22.1)
    parser (3.1.3.0)
      ast (~> 2.4.1)
    pipetree (0.1.1)
    pry (0.14.1)
      coderay (~> 1.1)
      method_source (~> 1.0)
    public_suffix (5.0.1)
    rack (2.0.9.1)
    rack-accept (0.4.5)
      rack (>= 0.4)
    rack-cors (1.1.1)
      rack (>= 2.0.0)
    rack-heartbeat (1.1.0)
      rack
    rack-protection (2.2.4)
      rack
    rack-test (2.0.2)
      rack (>= 1.3)
    rainbow (3.1.1)
    raindrops (0.20.0)
    rake (13.0.6)
    rbtree (0.4.6)
    reek (6.1.2)
      kwalify (~> 0.7.0)
      parser (~> 3.1.0)
      rainbow (>= 2.0, < 4.0)
    reform (2.6.2)
      disposable (>= 0.5.0, < 1.0.0)
      representable (>= 3.1.1, < 4)
      uber (< 0.2.0)
    regexp_parser (2.6.1)
    representable (3.2.0)
      declarative (< 0.1.0)
      trailblazer-option (>= 0.1.1, < 0.2.0)
      uber (< 0.2.0)
    rexml (3.2.5)
    rspec (3.12.0)
      rspec-core (~> 3.12.0)
      rspec-expectations (~> 3.12.0)
      rspec-mocks (~> 3.12.0)
    rspec-core (3.12.0)
      rspec-support (~> 3.12.0)
    rspec-expectations (3.12.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-mocks (3.12.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-support (3.12.0)
    rspec_junit_formatter (0.6.0)
      rspec-core (>= 2, < 4, != 2.12.0)
    rubocop (0.93.1)
      parallel (~> 1.10)
      parser (>= 2.7.1.5)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 1.8)
      rexml
      rubocop-ast (>= 0.6.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 1.4.0, < 2.0)
    rubocop-ast (1.24.0)
      parser (>= 3.1.1.0)
    rubocop-junit_formatter (0.2)
      rubocop (~> 0.49)
    rubocop-performance (1.10.2)
      rubocop (>= 0.90.0, < 2.0)
      rubocop-ast (>= 0.4.0)
    ruby-progressbar (1.11.0)
    ruby2_keywords (0.0.5)
    rubyzip (1.3.0)
    secure_headers (6.5.0)
    sequel (5.63.0)
    set (1.0.3)
    shoulda-matchers (4.5.1)
      activesupport (>= 4.2.0)
    simplecov (0.21.2)
      docile (~> 1.1)
      simplecov-html (~> 0.11)
      simplecov_json_formatter (~> 0.1)
    simplecov-html (0.12.3)
    simplecov_json_formatter (0.1.4)
    slack-notifier (2.4.0)
    sorted_set (1.0.3)
      rbtree
      set (~> 1.0)
    thor (1.2.1)
    thread_safe (0.3.6)
    trailblazer (2.0.7)
      declarative
      reform (>= 2.2.0, < 3.0.0)
      trailblazer-operation (>= 0.0.12, < 0.1.0)
    trailblazer-operation (0.0.13)
      declarative
      pipetree (>= 0.1.1, < 0.2.0)
      uber
    trailblazer-option (0.1.2)
    tzinfo (1.2.10)
      thread_safe (~> 0.1)
    uber (0.1.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.8.2)
    unicode-display_width (1.8.0)
    unicorn (6.1.0)
      kgio (~> 2.6)
      raindrops (~> 0.7)
    webmock (3.18.1)
      addressable (>= 2.8.0)
      crack (>= 0.3.2)
      hashdiff (>= 0.4.0, < 2.0.0)
    zeitwerk (2.6.6)

PLATFORMS
  arm64-darwin-21

DEPENDENCIES
  activesupport (~> 5.1)
  aws-sdk-s3
  bundler-audit
  climate_control
  codeclimate-test-reporter
  database_cleaner
  dry-container (~> 0.7)
  dry-schema (~> 1.9, >= 1.9.1)
  dry-struct
  dry-system
  dry-validation (= 1.8)
  factory_bot (~> 6.2.0)
  faker
  grape-swagger
  multi_json
  mysql2
  pry
  rack-test
  rake
  reek
  rspec
  rspec_junit_formatter
  rspec_sequel_matchers!
  rubocop (~> 0.9)
  rubocop-junit_formatter
  rubocop-performance
  <OMITTED, COMPANY SPECIFIC GEM>
  shoulda-matchers (~> 4.5.1)
  simplecov
  trailblazer (~> 2.0.1)
  unicorn
  webmock

RUBY VERSION
   ruby 2.7.3p183

BUNDLED WITH
   2.3.26
</code>```

It seems like the error is occurring from within the Dry-gem files when Dry-Validation attempts to require Dry-Schema, meaning I can't really edit that code. I can technically get into the Dry-gem files locally, but editing them will, of course, not carry over when deployed.

I've read up on dry-rb.org, making sure all of my dry-gems are compatible versions of each other and Validation and Schema are versions that can use the Predicate Registry extension.

I've attempted to load the predicate registry in a file I can edit, but if I use Dry-RB's Dry::Validation.load_extensions(:predicates_as_macros), I get this error:

```<code>Failure/Error: require './initialize'

NoMethodError:
  undefined method `load_extensions' for Dry::Validation:Module
  Did you mean?  load_dependency
</code>```

Body:
I'm attempting to update the ruby version of an empty, stock API (which is forked to create new API) from Ruby 2.6.3 to Ruby 2.7.3 using TrailBlazer.

Currently, I'm having issues with the Dry gems, specifically Dry-Validation (1.8.0), Dry-Schema (1.9.1), and their Predicate Registry extension.

Every time I run bundle exec rspec , I get this error:

Failure/Error: require './initialize'

NameError:
  uninitialized constant Dry::Schema::PredicateRegistry

With this stack-trace:

# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:25:in `<class:Config>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:14:in `<module:Schema>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:8:in `<module:Dry>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-schema-1.11.3/lib/dry/schema/config.rb:7:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry/validation/config.rb:3:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry/validation/contract.rb:9:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry/validation.rb:4:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-validation-1.8.0/lib/dry-validation.rb:3:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/reform-2.6.2/lib/reform/form/dry.rb:2:in `<top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/bundler/gems/<OMITTED, COMPANY SPECIFIC GEM>/system/boot/reform.rb:6:in `block (2 levels) in <top (required)>'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider.rb:231:in `public_send'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider.rb:231:in `run_step'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider.rb:167:in `start'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider_registrar.rb:252:in `with_provider'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/provider_registrar.rb:175:in `start'
# /Users/sthieme/.rvm/gems/ruby-2.7.3/gems/dry-system-0.27.2/lib/dry/system/container.rb:385:in `start'
# ./initialize.rb:5:in `<top (required)>'
# ./spec/spec_helper.rb:13:in `<top (required)>'

Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'

ruby '2.7.3'

group :production do
  gem 'dry-container', "~>0.7"
  gem 'dry-struct'
  gem 'dry-system'
  gem 'dry-validation', "1.8"
  gem 'dry-schema', "~>1.9", ">=1.9.1"
  gem 'grape-swagger'
  gem 'multi_json'
  gem 'mysql2'
  gem 'aws-sdk-s3'
  # gem 'ruby-oci8'
  <OMITTED, COMPANY-SPECIC GEM>
  gem 'trailblazer', '~>2.0.1'
  gem 'unicorn'
  gem 'activesupport', '~>5.1'
end

group :test, :development do
  gem 'bundler-audit'
  gem 'climate_control'
  gem 'codeclimate-test-reporter'
  gem 'database_cleaner'
  gem 'factory_bot', "~> 6.2.0"
  gem 'faker'
  gem 'pry'
  gem 'rack-test'
  gem 'rake'
  gem 'reek'
  gem 'rspec'
  gem 'rspec_junit_formatter'
  gem 'rspec_sequel_matchers', git: 'https://github.com/openhood/rspec_sequel_matchers.git', branch: 'master'
  gem 'rubocop', '~> 0.9'
  gem 'rubocop-junit_formatter'
  gem 'rubocop-performance'
  gem 'shoulda-matchers', '~>4.5.1'
  gem 'simplecov', require: false
  gem 'webmock'
end

Gemfile.lock:

GIT
  remote: https://github.com/openhood/rspec_sequel_matchers.git
  revision: c0cfbd0599d856970f7cbf9cdd55175110888306
  branch: master
  specs:
    rspec_sequel_matchers (0.5.0)
      sequel (>= 3.8.0)

GIT
  remote: <OMITTED, COMPANY SPECIFIC GEM>
  revision: 697183381bfea3fb8fe1b69d1de54de961768ea3
  branch: sthieme-ruby-updates-test
  specs:
    <OMITTED, COMPANY SPECIFIC GEM>
      activesupport (~> 5.1)
      addressable (~> 2.5)
      aws-sdk-s3 (~> 1.8)
      bunny (~> 2.7)
      dotenv (~> 2.2)
      dry-configurable (~> 0.13)
      dry-matcher (~> 0.8)
      dry-system (~> 0.9)
      dry-validation (~> 1.8)
      elastic-apm (~> 2.1)
      erb-file_out (~> 0.1)
      faker (~> 1.8)
      faraday (~> 0.13)
      grape (~> 1.2)
      jwt (~> 2.2)
      mongo (~> 2.5)
      net-sftp (~> 2.1)
      net-ssh (~> 5.0.0.beta2)
      rack (~> 2.0.9)
      rack-cors (~> 1.0)
      rack-heartbeat (~> 1.1)
      rack-protection (~> 2.0)
      rubyzip (~> 1.2)
      secure_headers (~> 6.0)
      sequel (~> 5.4)
      slack-notifier (~> 2.3)
      trailblazer (~> 2.0)

GEM
  remote: https://rubygems.org/
  specs:
    activemodel (5.2.8.1)
      activesupport (= 5.2.8.1)
    activerecord (5.2.8.1)
      activemodel (= 5.2.8.1)
      activesupport (= 5.2.8.1)
      arel (>= 9.0)
    activesupport (5.2.8.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.8.1)
      public_suffix (>= 2.0.2, < 6.0)
    amq-protocol (2.3.2)
    arel (9.0.0)
    ast (2.4.2)
    aws-eventstream (1.2.0)
    aws-partitions (1.683.0)
    aws-sdk-core (3.168.4)
      aws-eventstream (~> 1, >= 1.0.2)
      aws-partitions (~> 1, >= 1.651.0)
      aws-sigv4 (~> 1.5)
      jmespath (~> 1, >= 1.6.1)
    aws-sdk-kms (1.61.0)
      aws-sdk-core (~> 3, >= 3.165.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-s3 (1.117.2)
      aws-sdk-core (~> 3, >= 3.165.0)
      aws-sdk-kms (~> 1)
      aws-sigv4 (~> 1.4)
    aws-sigv4 (1.5.2)
      aws-eventstream (~> 1, >= 1.0.2)
    bson (4.15.0)
    builder (3.2.4)
    bundler-audit (0.9.1)
      bundler (>= 1.2.0, < 3)
      thor (~> 1.0)
    bunny (2.20.1)
      amq-protocol (~> 2.3, >= 2.3.1)
      sorted_set (~> 1, >= 1.0.2)
    climate_control (1.2.0)
    codeclimate-test-reporter (1.0.7)
      simplecov
    coderay (1.1.3)
    concurrent-ruby (1.1.10)
    crack (0.4.5)
      rexml
    database_cleaner (2.0.1)
      database_cleaner-active_record (~> 2.0.0)
    database_cleaner-active_record (2.0.1)
      activerecord (>= 5.a)
      database_cleaner-core (~> 2.0.0)
    database_cleaner-core (2.0.1)
    declarative (0.0.20)
    diff-lcs (1.5.0)
    disposable (0.6.3)
      declarative (>= 0.0.9, < 1.0.0)
      representable (>= 3.1.1, < 4)
    docile (1.4.0)
    domain_name (0.5.20190701)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.8.1)
    dry-auto_inject (0.9.0)
      dry-container (>= 0.3.4)
    dry-configurable (0.16.1)
      dry-core (~> 0.6)
      zeitwerk (~> 2.6)
    dry-container (0.11.0)
      concurrent-ruby (~> 1.0)
    dry-core (0.9.1)
      concurrent-ruby (~> 1.0)
      zeitwerk (~> 2.6)
    dry-inflector (0.3.0)
    dry-initializer (3.1.1)
    dry-logic (1.3.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.9, >= 0.9)
      zeitwerk (~> 2.6)
    dry-matcher (0.9.0)
      dry-core (~> 0.4, >= 0.4.8)
    dry-schema (1.11.3)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 0.16, >= 0.16)
      dry-core (~> 0.9, >= 0.9)
      dry-initializer (~> 3.0)
      dry-logic (~> 1.3)
      dry-types (~> 1.6)
      zeitwerk (~> 2.6)
    dry-struct (1.5.2)
      dry-core (~> 0.9, >= 0.9)
      dry-types (~> 1.6)
      ice_nine (~> 0.11)
      zeitwerk (~> 2.6)
    dry-system (0.27.2)
      dry-auto_inject (>= 0.4.0)
      dry-configurable (~> 0.16, >= 0.16.0)
      dry-container (~> 0.10, >= 0.10.0)
      dry-core (~> 0.9, >= 0.9.0)
      dry-inflector (~> 0.1, >= 0.1.2)
      zeitwerk (~> 2.6)
    dry-types (1.6.1)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.3)
      dry-core (~> 0.9, >= 0.9)
      dry-inflector (~> 0.1, >= 0.1.2)
      dry-logic (~> 1.3, >= 1.3)
      zeitwerk (~> 2.6)
    dry-validation (1.8.0)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.7, >= 0.7.1)
      dry-core (~> 0.5, >= 0.5)
      dry-initializer (~> 3.0)
      dry-schema (~> 1.9, >= 1.9.1)
    elastic-apm (2.12.0)
      concurrent-ruby (~> 1.0)
      http (>= 3.0)
    erb-file_out (0.1.2)
    factory_bot (6.2.1)
      activesupport (>= 5.0.0)
    faker (1.9.6)
      i18n (>= 0.7)
    faraday (0.17.6)
      multipart-post (>= 1.2, < 3)
    ffi (1.15.5)
    ffi-compiler (1.0.1)
      ffi (>= 1.0.0)
      rake
    grape (1.7.0)
      activesupport
      builder
      dry-types (>= 1.1)
      mustermann-grape (~> 1.0.0)
      rack (>= 1.3.0)
      rack-accept
    grape-swagger (1.5.0)
      grape (~> 1.3)
    hashdiff (1.0.1)
    http (5.1.1)
      addressable (~> 2.8)
      http-cookie (~> 1.0)
      http-form_data (~> 2.2)
      llhttp-ffi (~> 0.4.0)
    http-cookie (1.0.5)
      domain_name (~> 0.5)
    http-form_data (2.3.0)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    ice_nine (0.11.2)
    jmespath (1.6.2)
    jwt (2.6.0)
    kgio (2.11.4)
    kwalify (0.7.2)
    llhttp-ffi (0.4.0)
      ffi-compiler (~> 1.0)
      rake (~> 13.0)
    method_source (1.0.0)
    minitest (5.16.3)
    mongo (2.18.2)
      bson (>= 4.14.1, < 5.0.0)
    multi_json (1.15.0)
    multipart-post (2.2.3)
    mustermann (3.0.0)
      ruby2_keywords (~> 0.0.1)
    mustermann-grape (1.0.2)
      mustermann (>= 1.0.0)
    mysql2 (0.5.4)
    net-sftp (2.1.2)
      net-ssh (>= 2.6.5)
    net-ssh (5.0.2)
    parallel (1.22.1)
    parser (3.1.3.0)
      ast (~> 2.4.1)
    pipetree (0.1.1)
    pry (0.14.1)
      coderay (~> 1.1)
      method_source (~> 1.0)
    public_suffix (5.0.1)
    rack (2.0.9.1)
    rack-accept (0.4.5)
      rack (>= 0.4)
    rack-cors (1.1.1)
      rack (>= 2.0.0)
    rack-heartbeat (1.1.0)
      rack
    rack-protection (2.2.4)
      rack
    rack-test (2.0.2)
      rack (>= 1.3)
    rainbow (3.1.1)
    raindrops (0.20.0)
    rake (13.0.6)
    rbtree (0.4.6)
    reek (6.1.2)
      kwalify (~> 0.7.0)
      parser (~> 3.1.0)
      rainbow (>= 2.0, < 4.0)
    reform (2.6.2)
      disposable (>= 0.5.0, < 1.0.0)
      representable (>= 3.1.1, < 4)
      uber (< 0.2.0)
    regexp_parser (2.6.1)
    representable (3.2.0)
      declarative (< 0.1.0)
      trailblazer-option (>= 0.1.1, < 0.2.0)
      uber (< 0.2.0)
    rexml (3.2.5)
    rspec (3.12.0)
      rspec-core (~> 3.12.0)
      rspec-expectations (~> 3.12.0)
      rspec-mocks (~> 3.12.0)
    rspec-core (3.12.0)
      rspec-support (~> 3.12.0)
    rspec-expectations (3.12.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-mocks (3.12.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.12.0)
    rspec-support (3.12.0)
    rspec_junit_formatter (0.6.0)
      rspec-core (>= 2, < 4, != 2.12.0)
    rubocop (0.93.1)
      parallel (~> 1.10)
      parser (>= 2.7.1.5)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 1.8)
      rexml
      rubocop-ast (>= 0.6.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 1.4.0, < 2.0)
    rubocop-ast (1.24.0)
      parser (>= 3.1.1.0)
    rubocop-junit_formatter (0.2)
      rubocop (~> 0.49)
    rubocop-performance (1.10.2)
      rubocop (>= 0.90.0, < 2.0)
      rubocop-ast (>= 0.4.0)
    ruby-progressbar (1.11.0)
    ruby2_keywords (0.0.5)
    rubyzip (1.3.0)
    secure_headers (6.5.0)
    sequel (5.63.0)
    set (1.0.3)
    shoulda-matchers (4.5.1)
      activesupport (>= 4.2.0)
    simplecov (0.21.2)
      docile (~> 1.1)
      simplecov-html (~> 0.11)
      simplecov_json_formatter (~> 0.1)
    simplecov-html (0.12.3)
    simplecov_json_formatter (0.1.4)
    slack-notifier (2.4.0)
    sorted_set (1.0.3)
      rbtree
      set (~> 1.0)
    thor (1.2.1)
    thread_safe (0.3.6)
    trailblazer (2.0.7)
      declarative
      reform (>= 2.2.0, < 3.0.0)
      trailblazer-operation (>= 0.0.12, < 0.1.0)
    trailblazer-operation (0.0.13)
      declarative
      pipetree (>= 0.1.1, < 0.2.0)
      uber
    trailblazer-option (0.1.2)
    tzinfo (1.2.10)
      thread_safe (~> 0.1)
    uber (0.1.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.8.2)
    unicode-display_width (1.8.0)
    unicorn (6.1.0)
      kgio (~> 2.6)
      raindrops (~> 0.7)
    webmock (3.18.1)
      addressable (>= 2.8.0)
      crack (>= 0.3.2)
      hashdiff (>= 0.4.0, < 2.0.0)
    zeitwerk (2.6.6)

PLATFORMS
  arm64-darwin-21

DEPENDENCIES
  activesupport (~> 5.1)
  aws-sdk-s3
  bundler-audit
  climate_control
  codeclimate-test-reporter
  database_cleaner
  dry-container (~> 0.7)
  dry-schema (~> 1.9, >= 1.9.1)
  dry-struct
  dry-system
  dry-validation (= 1.8)
  factory_bot (~> 6.2.0)
  faker
  grape-swagger
  multi_json
  mysql2
  pry
  rack-test
  rake
  reek
  rspec
  rspec_junit_formatter
  rspec_sequel_matchers!
  rubocop (~> 0.9)
  rubocop-junit_formatter
  rubocop-performance
  <OMITTED, COMPANY SPECIFIC GEM>
  shoulda-matchers (~> 4.5.1)
  simplecov
  trailblazer (~> 2.0.1)
  unicorn
  webmock

RUBY VERSION
   ruby 2.7.3p183

BUNDLED WITH
   2.3.26

It seems like the error is occurring from within the Dry-gem files when Dry-Validation attempts to require Dry-Schema, meaning I can't really edit that code. I can technically get into the Dry-gem files locally, but editing them will, of course, not carry over when deployed.

I've read up on dry-rb.org, making sure all of my dry-gems are compatible versions of each other and Validation and Schema are versions that can use the Predicate Registry extension.

I've attempted to load the predicate registry in a file I can edit, but if I use Dry-RB's Dry::Validation.load_extensions(:predicates_as_macros), I get this error:

Failure/Error: require './initialize'

NoMethodError:
  undefined method `load_extensions' for Dry::Validation:Module
  Did you mean?  load_dependency


问:
Bivariate tables on R
I have been trying to create bivariate tables on R using the summary(univariateTable function.
I have been trying

```<code>write.csv(
  summary(univariateTable(subgroup1+subgroup2~
                            variable    + variable
</code>```

Which should mean stratification along the two subgroups of all variables..
But I keep getting an error: non numeric argument to binary operator. Is there a way to fix this?

Title: Bivariate tables on R

Body:
I have been trying to create bivariate tables on R using the summary(univariateTable function.
I have been trying

write.csv(
  summary(univariateTable(subgroup1+subgroup2~
                            variable    + variable

Which should mean stratification along the two subgroups of all variables..
But I keep getting an error: non numeric argument to binary operator. Is there a way to fix this?


问:
My react app has vulnerabilities, how do i get rid of them?
So i created this react app and the terminal told me i had 68 vulnerabilities (12 low, 19 moderate, 33 high, 4 critical), then it told me to run npm audit fix and npm audit fix --force, but none of these solutions worked and i still have vulnerabilities, first of all, what are these vulnerabilities?
Here are some for example:

```<code>
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEntry.js' in 'C:\Users\maxim\react-social'
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEntry.js' in 'C:\Users\maxim\react-social'
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEntry.js' in 'C:\Users\maxim\react-social'
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

</code>```

How can i fix them? Do these vulnerabilities matter? Can i go on without caring about them?

Body:
So i created this react app and the terminal told me i had 68 vulnerabilities (12 low, 19 moderate, 33 high, 4 critical), then it told me to run npm audit fix and npm audit fix --force, but none of these solutions worked and i still have vulnerabilities, first of all, what are these vulnerabilities?
Here are some for example:

ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEntry.js' in 'C:\Users\maxim\react-social'
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEntry.js' in 'C:\Users\maxim\react-social'
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\react-refresh-webpack-plugin\client\ReactRefreshEntry.js' in 'C:\Users\maxim\react-social'
ERROR in Module not found: Error: Can't resolve 'C:\Users\maxim\react-social\node_modules\@pmmmwh\
Failed to compile.

How can i fix them? Do these vulnerabilities matter? Can i go on without caring about them?


问:
How to pass parameterized variable into Chart.yml file for gitlab CI/CD?
Currently my Chart.yml file looks like this:

apiVersion: v2
name: test-api
version: 0.0.0
description: This is the job for testing
sources:
- <gitlab project link>
maintainers:
- name: <Team Name>
  email: <Team email>```
</div>
</div>
</p>
<p>I would like to pass the variable from <em><strong>gitlab-ci.yml</strong></em> file for name of the Chart so
in my <em><strong>gitlab-ci.yml</strong></em> file, I have defined the variable name for Chart name something like this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>   variables:
 CHART_NAME: 'test-api'</code>```

Next, I would like to pass the variable CHART_NAME from gitlab-ci.yml into Chart.yml file, so now the Chart.yml file looks like this:

apiVersion: v2
name: ${CHART_NAME}
version: 0.0.0
description: This is the job for testing
sources:
- <gitlab project link>
maintainers:
- name: <Team Name>
  email: <Team email>```

but my pipeline failed while trying to publish the helm since my Chart.yml file is not able to read the value of variable CHART_NAME.

Can someone help If it is possible to pass the variable into Chart.yml file from gitlab-ci.yml?

Body:
Currently my Chart.yml file looks like this:

apiVersion: v2
name: test-api
version: 0.0.0
description: This is the job for testing
sources:
- <gitlab project link>
maintainers:
- name: <Team Name>
  email: <Team email>

I would like to pass the variable from gitlab-ci.yml file for name of the Chart so
in my gitlab-ci.yml file, I have defined the variable name for Chart name something like this:

   variables:
 CHART_NAME: 'test-api'

Next, I would like to pass the variable CHART_NAME from gitlab-ci.yml into Chart.yml file, so now the Chart.yml file looks like this:

apiVersion: v2
name: ${CHART_NAME}
version: 0.0.0
description: This is the job for testing
sources:
- <gitlab project link>
maintainers:
- name: <Team Name>
  email: <Team email>

but my pipeline failed while trying to publish the helm since my Chart.yml file is not able to read the value of variable CHART_NAME.

Can someone help If it is possible to pass the variable into Chart.yml file from gitlab-ci.yml?


问:
constrained convolution layer
I would like to create a custom convolution layer in which, after each back-propagation, the weights of my kernel matrix should be in a specific format: the central value must be -1, and the sum of the rest must be 1.

I want to implement it in Pytorch.

Title: constrained convolution layer


问:
Convert pixels to mm on image
I am working on a project where I calculate the length of a line drawn by the user on an image. A canvas is set to the image height and width. In order to measure the length of line, I need to convert the pixels into a real life measurement such as millimeters. Each image provides a scaling system such as 1:100...1:25 that the user inputs. My goal is to measure the length of the line in pixels and convert it to real life millimeters depending on the line drawn by the user. I came up with this formula which works but only if the image height and width are 1536 x 912 but doesn't work for other images, refer to the code below.</p>
```<code>/ Calculate the length of the line using the formula in pixels
  const length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));

  // Convert the length from pixels to the scale specified (1:50 in this case) in mm
  //0.02514 is the known measurement within the drawings
  // 176 px (length of line drawn) = 7000 mm (as shown on image)
  // therefore, 1 px = 0.02514 making the scale work in a 1:50
  const lengthInScalemm = length / 0.02514285714;

</code>```

Title: Convert pixels to mm on image

Body:
I am working on a project where I calculate the length of a line drawn by the user on an image. A canvas is set to the image height and width. In order to measure the length of line, I need to convert the pixels into a real life measurement such as millimeters. Each image provides a scaling system such as 1:100...1:25 that the user inputs. My goal is to measure the length of the line in pixels and convert it to real life millimeters depending on the line drawn by the user. I came up with this formula which works but only if the image height and width are 1536 x 912 but doesn't work for other images, refer to the code below.

/ Calculate the length of the line using the formula in pixels
  const length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));

  // Convert the length from pixels to the scale specified (1:50 in this case) in mm
  //0.02514 is the known measurement within the drawings
  // 176 px (length of line drawn) = 7000 mm (as shown on image)
  // therefore, 1 px = 0.02514 making the scale work in a 1:50
  const lengthInScalemm = length / 0.02514285714;


问:
Problem downloading video from url using Python, Requests, BeautifulSoup
I'm trying to download the video from this url which i scraped as well but all it stores is a 70kb .mp4 file. Am I doing something wrong? I saw the chunk and writing binary to file part on a youtube video that also explained how to download videos from a url but to no avail. Am i doing something wrong?</p>
```<code>import requests
from bs4 import BeautifulSoup

headers = {
    'authority': 'gogohd.pro',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
    'referer': 'https://gogoanime.bid/',
    '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': 'iframe',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'cross-site',
    'upgrade-insecure-requests': '1',
    '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',
}

params = {
    'id': 'MTkzNTU3',
    'title': 'Chainsaw Man Episode 1',
}

links = []

response = requests.get('https://gogohd.pro/streaming.php', params=params, headers=headers)
soup = BeautifulSoup(response.content, 'html.parser')
tags = soup.find_all('li', {'class' : 'linkserver'})
for tag in tags:
    links.append(tag.get('data-video'))
print(links)
print('\nDownloading from first link...\n')

headers = {
    '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',
}
chunk_size = 256
r = requests.get(links[1], stream=True, headers=headers)
with open("anime.mp4", 'wb') as f:
    for chunk in r.iter_content(chunk_size=chunk_size):
        f.write(chunk)

</code>```

Body:
I'm trying to download the video from this url which i scraped as well but all it stores is a 70kb .mp4 file. Am I doing something wrong? I saw the chunk and writing binary to file part on a youtube video that also explained how to download videos from a url but to no avail. Am i doing something wrong?

import requests
from bs4 import BeautifulSoup

headers = {
    'authority': 'gogohd.pro',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
    'referer': 'https://gogoanime.bid/',
    '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': 'iframe',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'cross-site',
    'upgrade-insecure-requests': '1',
    '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',
}

params = {
    'id': 'MTkzNTU3',
    'title': 'Chainsaw Man Episode 1',
}

links = []

response = requests.get('https://gogohd.pro/streaming.php', params=params, headers=headers)
soup = BeautifulSoup(response.content, 'html.parser')
tags = soup.find_all('li', {'class' : 'linkserver'})
for tag in tags:
    links.append(tag.get('data-video'))
print(links)
print('\nDownloading from first link...\n')

headers = {
    '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',
}
chunk_size = 256
r = requests.get(links[1], stream=True, headers=headers)
with open("anime.mp4", 'wb') as f:
    for chunk in r.iter_content(chunk_size=chunk_size):
        f.write(chunk)


问:
FPDF referencing old path
I wrote a database form using tkinter and I'm using FPDF to generate labels. I get an errno2 when trying to save the label I just made. The path it is reference is on my lab PC but not the PC I'm running the script from. Knowing this I use os.getcwd() and use child directories to make sure the script is portable.

Here is the function that is returning an error:

```<code>skid_number = config.get('DEFAULT','skid_number')

pdf = FPDF('L', 'mm', (101.6,152.4))
pdf.add_page()

pdf.add_font('free3of9', '',f'{os.getcwd()}\\free3of9.ttf',uni=True)

pdf.set_font("Arial", size=45,style='B')
pdf.cell(131,10, txt='AUD-PLT',align='C')

pdf.ln(h=16.5)
pdf.set_font("free3of9", size=55,style='')
pdf.cell(131,10, txt='*AUD-PLT*',align='C')

pdf.ln(h=16.5)
pdf.set_font("Arial", size=45,style='B')
pdf.cell(131,10, txt=skid_number,align='C')

pdf.ln(h=16.5)
pdf.set_font("free3of9", size=55,style='')
pdf.cell(131,10, txt=f'*{skid_number}*',align='C')

pdf.ln(h=16.5)
pdf.set_font("Arial", size=45,style='B')
pdf.cell(131,5, txt=date.today().strftime('%b-%d-%y'),align='C')

pdf.output(name='skid_label.pdf', dest=os.getcwd())
</code>```

and the traceback:

```<code>Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\onlineuser\Desktop\gui.py", line 474, in new_pallet
    self.print_skid_label()
  File "C:\Users\onlineuser\Desktop\gui.py", line 398, in print_skid_label
    pdf.output(name='skid_label.pdf', dest=os.getcwd())
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1065, in output
    self.close()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 246, in close
    self._enddoc()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1637, in _enddoc
    self._putresources()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1584, in _    putresources
    self._putfonts()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1288, in _putfonts
    ttfontstream = ttf.makeSubset(font['ttffile'], subset)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\ttfonts.py", line 459, in makeSubset
    self.fh = open(file ,'rb')
              ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory:     'C:\\Users\\DavidSonnen\\Documents\\Projects\\Silver Inventory Python\\Lib\\site-        packages\\fpdf\\fonts\\free3of9.ttf'
</code>```

The "No such file or directory" is reference where I built the form on my lab PC. and the error gets thrown on the pdf.output line

I suspect the problem is coming from the "free3of9" font on the add_font line. So I have tried hard coding the path to the ttf.
I have also peeked in the other files in the traceback but I didn't see anything that I thought was wrong.

Title: FPDF referencing old path

Body:
I wrote a database form using tkinter and I'm using FPDF to generate labels. I get an errno2 when trying to save the label I just made. The path it is reference is on my lab PC but not the PC I'm running the script from. Knowing this I use os.getcwd() and use child directories to make sure the script is portable.

Here is the function that is returning an error:

skid_number = config.get('DEFAULT','skid_number')

pdf = FPDF('L', 'mm', (101.6,152.4))
pdf.add_page()

pdf.add_font('free3of9', '',f'{os.getcwd()}\\free3of9.ttf',uni=True)

pdf.set_font("Arial", size=45,style='B')
pdf.cell(131,10, txt='AUD-PLT',align='C')

pdf.ln(h=16.5)
pdf.set_font("free3of9", size=55,style='')
pdf.cell(131,10, txt='*AUD-PLT*',align='C')

pdf.ln(h=16.5)
pdf.set_font("Arial", size=45,style='B')
pdf.cell(131,10, txt=skid_number,align='C')

pdf.ln(h=16.5)
pdf.set_font("free3of9", size=55,style='')
pdf.cell(131,10, txt=f'*{skid_number}*',align='C')

pdf.ln(h=16.5)
pdf.set_font("Arial", size=45,style='B')
pdf.cell(131,5, txt=date.today().strftime('%b-%d-%y'),align='C')

pdf.output(name='skid_label.pdf', dest=os.getcwd())

and the traceback:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\onlineuser\Desktop\gui.py", line 474, in new_pallet
    self.print_skid_label()
  File "C:\Users\onlineuser\Desktop\gui.py", line 398, in print_skid_label
    pdf.output(name='skid_label.pdf', dest=os.getcwd())
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1065, in output
    self.close()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 246, in close
    self._enddoc()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1637, in _enddoc
    self._putresources()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1584, in _    putresources
    self._putfonts()
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\fpdf.py", line 1288, in _putfonts
    ttfontstream = ttf.makeSubset(font['ttffile'], subset)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\fpdf\ttfonts.py", line 459, in makeSubset
    self.fh = open(file ,'rb')
              ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory:     'C:\\Users\\DavidSonnen\\Documents\\Projects\\Silver Inventory Python\\Lib\\site-        packages\\fpdf\\fonts\\free3of9.ttf'

The "No such file or directory" is reference where I built the form on my lab PC. and the error gets thrown on the pdf.output line

I suspect the problem is coming from the "free3of9" font on the add_font line. So I have tried hard coding the path to the ttf.
I have also peeked in the other files in the traceback but I didn't see anything that I thought was wrong.


问:
Apache Airflow 2.5.0- sqlite3.IntegrityError: FOREIGN KEY constraint failed
I am trying to install apache airflow on PyCharm IDE using virtual environment.

Installation is done but in the event of initialising airflow's db(sqlite by default), i got this error - sqlite3.IntegrityError: FOREIGN KEY constraint failed

I typed on PyCharm console - airflow db init