问:
Paginate joined relations in a many to many relationship with typeorm
I have two entities, Teacher and Student with a many to many relationship, connected using a join table called TeacherStudents. I want to query multiple teachers and the related students under each teacher, but i want to be able to limit how many teachers are fetched per query and also limit how many related students are fetched per teacher.

My entities:

Teacher.ts

```<code>@Entity()
export class Teacher extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @CreateDateColumn({ type: 'timestamp' })
  createdAt: Date;

  @OneToMany(() => TeacherStudents, (ts) => ts.teacher)
  studentConn: Promise<TeacherStudents[]>;
}
</code>```

Student.ts

```<code>@Entity()
export class Student extends BaseEntity {
   @PrimaryGeneratedColumn()
   id: number;

   @Column()
   name: string;

   @CreateDateColumn({ type: 'timestamp' })
   createdAt: Date;

   @OneToMany(() => TeacherStudents, (ts) => ts.student)
   teacherConn: Promise<TeacherStudents[]>;
 }
</code>```

Then I have a separate join table to connect both entities

TeacherStudents.ts

```<code>@Entity()
export class TeacherStudents {
  @PrimaryColumn()
  teacherId: number;

  @PrimaryColumn()
  studentId: number;

  @ManyToOne(() => Teacher, (teacher) => teacher.studentConn)
  @JoinColumn({ name: 'teacherId' })
  teacher: Promise<Teacher>;

  @ManyToOne(() => Student, (student) => student.teacherConn)
  @JoinColumn({ name: 'studentId' })
  student: Promise<Student>;
}
</code>```

So far I have been able to get this working

query.ts

```<code>async getTeachers(limit:number){

    const maxLimit = Math.min(16, limit)
    const teachers = await AppDataSource.getRepository(Teacher)
      .createQueryBuilder('teacher')
      .innerJoin('teacher.studentConn', 'studentConn')
      .innerJoin('studentConn.student', 'student')
      .select('teacher', 'student')
      .take(maxLimit)
      .getMany();

    return teachers;
}
</code>```

The issue with this is that "take" only applies on the parent (Teacher) object. I want to know how I can apply "take" on the child (Student) for each Teacher returned by the query.

Basically I want to paginate for each Teacher and it's relation Student.

Body:
I have two entities, Teacher and Student with a many to many relationship, connected using a join table called TeacherStudents. I want to query multiple teachers and the related students under each teacher, but i want to be able to limit how many teachers are fetched per query and also limit how many related students are fetched per teacher.

My entities:

Teacher.ts

@Entity()
export class Teacher extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @CreateDateColumn({ type: 'timestamp' })
  createdAt: Date;

  @OneToMany(() => TeacherStudents, (ts) => ts.teacher)
  studentConn: Promise<TeacherStudents[]>;
}

Student.ts

@Entity()
export class Student extends BaseEntity {
   @PrimaryGeneratedColumn()
   id: number;

   @Column()
   name: string;

   @CreateDateColumn({ type: 'timestamp' })
   createdAt: Date;

   @OneToMany(() => TeacherStudents, (ts) => ts.student)
   teacherConn: Promise<TeacherStudents[]>;
 }

Then I have a separate join table to connect both entities

TeacherStudents.ts

@Entity()
export class TeacherStudents {
  @PrimaryColumn()
  teacherId: number;

  @PrimaryColumn()
  studentId: number;

  @ManyToOne(() => Teacher, (teacher) => teacher.studentConn)
  @JoinColumn({ name: 'teacherId' })
  teacher: Promise<Teacher>;

  @ManyToOne(() => Student, (student) => student.teacherConn)
  @JoinColumn({ name: 'studentId' })
  student: Promise<Student>;
}

So far I have been able to get this working

query.ts

async getTeachers(limit:number){

    const maxLimit = Math.min(16, limit)
    const teachers = await AppDataSource.getRepository(Teacher)
      .createQueryBuilder('teacher')
      .innerJoin('teacher.studentConn', 'studentConn')
      .innerJoin('studentConn.student', 'student')
      .select('teacher', 'student')
      .take(maxLimit)
      .getMany();

    return teachers;
}

The issue with this is that "take" only applies on the parent (Teacher) object. I want to know how I can apply "take" on the child (Student) for each Teacher returned by the query.

Basically I want to paginate for each Teacher and it's relation Student.


来源: stackexchange

问:
cs50, tideman, lock_pairs
I have a problem that I have been struggling with the check_pairs function for several days. Finally, I wrote a version of the code that in my opinion everything is correct and indeed in CS50 everything shows green except :( lock_pairs skips final pair if it creates cycle.
And I found this code:

```<code>// Recursive function to check if entry makes a circle
bool makes_circle(int cycle_start, int loser)
{
    if (loser == cycle_start)
    {
        // If the current loser is the cycle start
        // The entry makes a circle
        return true;
    }
    for (int i = 0; i < candidate_count; i++)
    {
        if (locked[loser][i])
        {
            if (makes_circle(cycle_start, i))
            {
                // Forward progress through the circle
                return true;
            }
        }
    }
    return false;
}

// Lock pairs into the candidate graph in order, without creating cycles
void lock_pairs()
{
    for (int i = 0; i < pair_count; i++)
    {
        if (!makes_circle(pairs[i].winner, pairs[i].loser))
        {
            // Lock the pair unless it makes a circle
            locked[pairs[i].winner][pairs[i].loser] = true;
        }
    }
}
</code>```

Found it here: PSET 3 Tideman CS50 lock_pairs doesn't lock correctly

When I pasted it to tideman everything was green with check50 and I can't figure out why and how it differs from my function. I checked various combinations in debug50, drew a few pages and still don't understand what is the detail that makes this recursive function different from mine. Could someone explain to me step by step why this function is correct and mine is not?
My code:

```<code>void lock_pairs(void)
{
    for (int i = 0; i < pair_count; i++)
    {
        bool cycle = false;
        // check if the loser of the actual checking pair won with any other candidate
        for (int j = 0; j < candidate_count && !cycle; j++)
        {
            if (locked[pairs[i].loser][j])
            {
                // if the loser beats any other candidate, check if this other candidate beats the winner of the actual checking pair
                for (int k = 0; k < candidate_count && !cycle; k++)
                {
                    if (locked[j][k])
                    {
                        if (k == pairs[i].winner)
                        {
                            cycle = true;
                        }
                    }
                }
            }
        }
        if (!cycle)
        {
            locked[pairs[i].winner][pairs[i].loser] = true;
        }
    }
    return;
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: cs50, tideman, lock_pairs

Body:
I have a problem that I have been struggling with the check_pairs function for several days. Finally, I wrote a version of the code that in my opinion everything is correct and indeed in CS50 everything shows green except :( lock_pairs skips final pair if it creates cycle.
And I found this code:

// Recursive function to check if entry makes a circle
bool makes_circle(int cycle_start, int loser)
{
    if (loser == cycle_start)
    {
        // If the current loser is the cycle start
        // The entry makes a circle
        return true;
    }
    for (int i = 0; i < candidate_count; i++)
    {
        if (locked[loser][i])
        {
            if (makes_circle(cycle_start, i))
            {
                // Forward progress through the circle
                return true;
            }
        }
    }
    return false;
}

// Lock pairs into the candidate graph in order, without creating cycles
void lock_pairs()
{
    for (int i = 0; i < pair_count; i++)
    {
        if (!makes_circle(pairs[i].winner, pairs[i].loser))
        {
            // Lock the pair unless it makes a circle
            locked[pairs[i].winner][pairs[i].loser] = true;
        }
    }
}

Found it here: PSET 3 Tideman CS50 lock_pairs doesn't lock correctly

When I pasted it to tideman everything was green with check50 and I can't figure out why and how it differs from my function. I checked various combinations in debug50, drew a few pages and still don't understand what is the detail that makes this recursive function different from mine. Could someone explain to me step by step why this function is correct and mine is not?
My code:

void lock_pairs(void)
{
    for (int i = 0; i < pair_count; i++)
    {
        bool cycle = false;
        // check if the loser of the actual checking pair won with any other candidate
        for (int j = 0; j < candidate_count && !cycle; j++)
        {
            if (locked[pairs[i].loser][j])
            {
                // if the loser beats any other candidate, check if this other candidate beats the winner of the actual checking pair
                for (int k = 0; k < candidate_count && !cycle; k++)
                {
                    if (locked[j][k])
                    {
                        if (k == pairs[i].winner)
                        {
                            cycle = true;
                        }
                    }
                }
            }
        }
        if (!cycle)
        {
            locked[pairs[i].winner][pairs[i].loser] = true;
        }
    }
    return;
}


问:
Azure Machine Learning Execute Pipeline Configuration to pass input data
I would like to create a Synapse Pipeline for batch inferencing with data ingestion to store the data into data lake and then use this as input to call a batch endpoint already created (through ML Execute Pipeline) Then, capture the output into the data lake (appended to a table) to continue the next steps...

The documentation from Microsoft to setup such a scenario is very poor and everything I tried is failing.

Below is the Azure Machine Learning Execute Pipeline configuration.  I need to pass the value for the dataset_param with data asset instance already available as below.

But, it complains that the dataset_param is not provided. Not sure, how to pass this value...

Here is the original experiment / pipeline / endpoint created by the DevOps pipeline. I just call this endpoint above from the Synapse Pipeline


问:
Should websockets attempt to deliver events if the connection is closed?
I am designing websockets and trying to understand best practices.

The question is, should my server try to deliver events even if the connection is closed?

Pros of attempting to deliver the events when connection is closed:

I can receive the un delivered events as soon as my connection opens again

Cons:

The events will be backed up, causing the latest events to be delayed.

Can someone recommend me any services that allow 3rd party developers to use websockets and follow the best practices?

Here is my logic:

Open websocket connection

Continue to receive the events while the connection is open

Close the connection when you no longer want to receive the events


问:
Updating Database Using SQLite3 via Swift results in misuse
Trying to UPDATE database using SQLite3 under the function updateBankItem, but I keep getting a misuse in the debugger below. I'm not sure how I am misusing SQLite3.

2023-01-06 16:32:00.872219-0600 L2S Bank Manager[18960:1066654] [logging] misuse at line 94051 of [554764a6e7]

```<code>import Foundation
import SQLite3

class DBHelper {
    var db: OpaquePointer?
    let path = Bundle.main.path(forResource: "L2SDB", ofType: "sqlite")

    init() {
        self.db = setupDB()
    }

    //MARK: SQL Stuff
    func setupDB() -> OpaquePointer? {
        var db: OpaquePointer? = nil
        if sqlite3_open(path, &db) != SQLITE_OK {
            return nil
        } else {
            return db
        }
    }
    //This handles the Nil Assuming Blanks
    func sqlColumnText(statement: OpaquePointer?, column: Int32) -> String {
        if sqlite3_column_text(statement, column) == nil {
            return ""
        } else {
            return String(describing:  String(cString: sqlite3_column_text(statement, column)))
        }
    }

    //MARK: For Loading Indivdual Subjects
    func loadQuestionBank(forBank bankIdentifier: String) -> BankWithIdentifier {
        var questions = [MultipleChoiceQuestion]()
        //New SQL Way
        let query = "SELECT * FROM \(bankIdentifier);"
        var statement : OpaquePointer? = nil
        if sqlite3_prepare(db, query, -1, &statement, nil) == SQLITE_OK {
            while sqlite3_step(statement) == SQLITE_ROW {
                let number = Int(sqlite3_column_int(statement, 0))
                let question = sqlColumnText(statement: statement, column: 1)
                let answers = [
                    sqlColumnText(statement: statement, column: 2),
                    sqlColumnText(statement: statement, column: 3),
                    sqlColumnText(statement: statement, column: 4),
                    sqlColumnText(statement: statement, column: 5)
                    ]
                let correctAnswer = sqlColumnText(statement: statement, column: 6)
                let illustration = sqlColumnText(statement: statement, column: 7)
                let solution = sqlColumnText(statement: statement, column: 8)
                let questionID = sqlColumnText(statement: statement, column: 9)
                let category = sqlColumnText(statement: statement, column: 10)
                let subCategory = sqlColumnText(statement: statement, column: 11)
                let specifier = sqlColumnText(statement: statement, column: 12)
                let subSubject = sqlColumnText(statement: statement, column: 13)

                let model = MultipleChoiceQuestion(number: number, question: question, correctAnswer: correctAnswer, answers: answers, illustration: illustration, solution: solution, questionID: questionID, category: category, subCategory: subCategory, specifier: specifier, subSubject: subSubject)

                questions.append(model)
            }
            sqlite3_finalize(statement)
        }
        return BankWithIdentifier(bankIdentifier: bankIdentifier, questionBank: questions)
    }

    public func updateBankItem(number: Int, question: String, answers: [String], correct: String, illustration: String, solution: String, questionID: String, category: String, subCategory: String, specifier: String, subSubject: String ){

        var bankIdentifier = String()
        for subject in Subjects().combinedSubjects() {
            let bank = loadQuestionBank(forBank: subject.bankIdentifier)
            if bank.questionBank.contains(where: {$0.questionID == questionID}) {
                bankIdentifier = subject.bankIdentifier
                break
            }
        }

        let query = "UPDATE \(bankIdentifier) SET number = \(number), question = '\(question)', ansA = '\(answers[0])', ansB = '\(answers[1])', ansC = '\(answers[2])', ansD = '\(answers[3])', correctAnswer = '\(correct)', illustration = '\(illustration)', solution = '\(solution)', questionID = '\(questionID)', category = '\(category)', subCategory = '\(subCategory)', specifier = '\(specifier)', subSubject = '\(subSubject)' WHERE questionID = '\(questionID)';"

        var statement: OpaquePointer? = nil
        if sqlite3_prepare(db, query, -1, &statement, nil) == SQLITE_OK{
                if sqlite3_step(statement) == SQLITE_DONE {
                    print("Question Updated Success")
                } else {
                    print("Question Update Failed")
                    print("Statement \(sqlite3_step(statement))")
                }
        }
        sqlite3_finalize(statement)
    }

}
</code>```

Any assistance will be appreciated.

Body:
Trying to UPDATE database using SQLite3 under the function updateBankItem, but I keep getting a misuse in the debugger below. I'm not sure how I am misusing SQLite3.

2023-01-06 16:32:00.872219-0600 L2S Bank Manager[18960:1066654] [logging] misuse at line 94051 of [554764a6e7]

import Foundation
import SQLite3

class DBHelper {
    var db: OpaquePointer?
    let path = Bundle.main.path(forResource: "L2SDB", ofType: "sqlite")

    init() {
        self.db = setupDB()
    }

    //MARK: SQL Stuff
    func setupDB() -> OpaquePointer? {
        var db: OpaquePointer? = nil
        if sqlite3_open(path, &db) != SQLITE_OK {
            return nil
        } else {
            return db
        }
    }
    //This handles the Nil Assuming Blanks
    func sqlColumnText(statement: OpaquePointer?, column: Int32) -> String {
        if sqlite3_column_text(statement, column) == nil {
            return ""
        } else {
            return String(describing:  String(cString: sqlite3_column_text(statement, column)))
        }
    }

    //MARK: For Loading Indivdual Subjects
    func loadQuestionBank(forBank bankIdentifier: String) -> BankWithIdentifier {
        var questions = [MultipleChoiceQuestion]()
        //New SQL Way
        let query = "SELECT * FROM \(bankIdentifier);"
        var statement : OpaquePointer? = nil
        if sqlite3_prepare(db, query, -1, &statement, nil) == SQLITE_OK {
            while sqlite3_step(statement) == SQLITE_ROW {
                let number = Int(sqlite3_column_int(statement, 0))
                let question = sqlColumnText(statement: statement, column: 1)
                let answers = [
                    sqlColumnText(statement: statement, column: 2),
                    sqlColumnText(statement: statement, column: 3),
                    sqlColumnText(statement: statement, column: 4),
                    sqlColumnText(statement: statement, column: 5)
                    ]
                let correctAnswer = sqlColumnText(statement: statement, column: 6)
                let illustration = sqlColumnText(statement: statement, column: 7)
                let solution = sqlColumnText(statement: statement, column: 8)
                let questionID = sqlColumnText(statement: statement, column: 9)
                let category = sqlColumnText(statement: statement, column: 10)
                let subCategory = sqlColumnText(statement: statement, column: 11)
                let specifier = sqlColumnText(statement: statement, column: 12)
                let subSubject = sqlColumnText(statement: statement, column: 13)

                let model = MultipleChoiceQuestion(number: number, question: question, correctAnswer: correctAnswer, answers: answers, illustration: illustration, solution: solution, questionID: questionID, category: category, subCategory: subCategory, specifier: specifier, subSubject: subSubject)

                questions.append(model)
            }
            sqlite3_finalize(statement)
        }
        return BankWithIdentifier(bankIdentifier: bankIdentifier, questionBank: questions)
    }

    public func updateBankItem(number: Int, question: String, answers: [String], correct: String, illustration: String, solution: String, questionID: String, category: String, subCategory: String, specifier: String, subSubject: String ){

        var bankIdentifier = String()
        for subject in Subjects().combinedSubjects() {
            let bank = loadQuestionBank(forBank: subject.bankIdentifier)
            if bank.questionBank.contains(where: {$0.questionID == questionID}) {
                bankIdentifier = subject.bankIdentifier
                break
            }
        }

        let query = "UPDATE \(bankIdentifier) SET number = \(number), question = '\(question)', ansA = '\(answers[0])', ansB = '\(answers[1])', ansC = '\(answers[2])', ansD = '\(answers[3])', correctAnswer = '\(correct)', illustration = '\(illustration)', solution = '\(solution)', questionID = '\(questionID)', category = '\(category)', subCategory = '\(subCategory)', specifier = '\(specifier)', subSubject = '\(subSubject)' WHERE questionID = '\(questionID)';"

        var statement: OpaquePointer? = nil
        if sqlite3_prepare(db, query, -1, &statement, nil) == SQLITE_OK{
                if sqlite3_step(statement) == SQLITE_DONE {
                    print("Question Updated Success")
                } else {
                    print("Question Update Failed")
                    print("Statement \(sqlite3_step(statement))")
                }
        }
        sqlite3_finalize(statement)
    }

}

Any assistance will be appreciated.


问:
Xamarin iOS CollectionView Adds Whitespace at the End/Doesn't Show Full List
I'm trying to implement a CollectionView in a Xamarin app that I am writing. It works as expected on Android, but on iOS, there is a large amount of whitespace below the list, which does not show as complete (see screenshots).

Here is my XAML code for the contents of my ContentPage:

```<code><ContentPage.Content>
        <StackLayout>
            <SearchBar Placeholder="Search" TextChanged="SearchBar_TextChanged" />
            <CollectionView x:Name="medicationCollectionView" ItemsSource="{Binding Titles}"
                            SelectionMode="Single" >
                <CollectionView.ItemTemplate >
                    <DataTemplate >
                        <Frame HeightRequest="25" Padding="10" HasShadow="False" BorderColor="LightGray">
                            <Label Text="{Binding .}" FontSize="16" FontAttributes="Bold"
                                       TextColor="Navy" />
                        </Frame>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
        </StackLayout>
    </ContentPage.Content>
</code>```

Here are screenshots of the output on iOS and Android, respectively. As you can see, there is whitespace on the bottom half of the screen on iOS and not Android. I want this page to look like the Android version does on both platforms in terms of white space.

Thank you!

Body:
I'm trying to implement a CollectionView in a Xamarin app that I am writing. It works as expected on Android, but on iOS, there is a large amount of whitespace below the list, which does not show as complete (see screenshots).

Here is my XAML code for the contents of my ContentPage:

<ContentPage.Content>
        <StackLayout>
            <SearchBar Placeholder="Search" TextChanged="SearchBar_TextChanged" />
            <CollectionView x:Name="medicationCollectionView" ItemsSource="{Binding Titles}"
                            SelectionMode="Single" >
                <CollectionView.ItemTemplate >
                    <DataTemplate >
                        <Frame HeightRequest="25" Padding="10" HasShadow="False" BorderColor="LightGray">

                        </Frame>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
        </StackLayout>
    </ContentPage.Content>

Here are screenshots of the output on iOS and Android, respectively. As you can see, there is whitespace on the bottom half of the screen on iOS and not Android. I want this page to look like the Android version does on both platforms in terms of white space.

Thank you!


问:
Script error for "Multiple URLs copy in Sources/Network tab"
I'm not able to write comments, so I have to create new question. May be it would be better for me, idk.
Anyway, 3 days ago I tried @wOxxOm 's script from this thread - Multiple URLs copy in Sources/Network tab

```<code>copy(UI.panels.network.networkLogView.dataGrid.rootNode().flatNodes.map(n => n.request().urlInternal).join('\n'))
</code>```

It worked perfect.
But today I see this error -

Uncaught ReferenceError: UI is not defined

So... could you help me to find out what should I change to run this script again?
Thanks in advance

I tried to use old one script with underscore symbol. Same error.

Body:
I'm not able to write comments, so I have to create new question. May be it would be better for me, idk.
Anyway, 3 days ago I tried @wOxxOm 's script from this thread - Multiple URLs copy in Sources/Network tab

copy(UI.panels.network.networkLogView.dataGrid.rootNode().flatNodes.map(n => n.request().urlInternal).join('\n'))

It worked perfect.
But today I see this error -

Uncaught ReferenceError: UI is not defined

So... could you help me to find out what should I change to run this script again?
Thanks in advance

I tried to use old one script with underscore symbol. Same error.


问:
"pure" HTML to navigate inside React SPA
I know that internal links in a React single page application need to use the React router navigate function instead of normal hyperlinks, or they'll cause the entire application to reload from scratch.  And the idiomatic solution to this is the <Link> component.

However, I have to pass internal links as strings to a third-party library function.  It allows HTML tags in the string data, like .  But I can't pass React JSX snippets directly.

(The specific use case is adding hyperlinks inside a Google Charts type=Table visualization.  The react-google-charts wrapper has an example but it only works for outbound links, not to navigate inside the app.)

My research has revealed that one of the following general ideas might work, but given the finickiness of React when it comes to non-idiomatic solutions, I want an expert option:

Use a React <Link> component and render it to an HTML string before handoff to the non-React code.

Generate href="Internal/SPA/page" onclick="spaLink"> links and export a function spaLink(eventdata), doing some hack with global/window data to find the router navigate function.

Generate href="Internal/SPA/page" class="spaLink"> links and inside a React component, programmatically wire up a click handler that selectively intercepts events coming from that class.

Other approaches that solve the problem of invoking SPA navigation from HTML are welcome.  Frame challenges that I should switch to a different visualization library that allows arbitrary JSX snippets in arbitrary places, are not.  This tail does not wag the dog of chart library selection.

Body:
I know that internal links in a React single page application need to use the React router navigate function instead of normal hyperlinks, or they'll cause the entire application to reload from scratch.  And the idiomatic solution to this is the <Link> component.

However, I have to pass internal links as strings to a third-party library function.  It allows HTML tags in the string data, like .  But I can't pass React JSX snippets directly.

(The specific use case is adding hyperlinks inside a Google Charts type=Table visualization.  The react-google-charts wrapper has an example but it only works for outbound links, not to navigate inside the app.)

My research has revealed that one of the following general ideas might work, but given the finickiness of React when it comes to non-idiomatic solutions, I want an expert option:

Use a React <Link> component and render it to an HTML string before handoff to the non-React code.

Generate  links and export a function spaLink(eventdata), doing some hack with global/window data to find the router navigate function.

Generate  links and inside a React component, programmatically wire up a click handler that selectively intercepts events coming from that class.

Other approaches that solve the problem of invoking SPA navigation from HTML are welcome.  Frame challenges that I should switch to a different visualization library that allows arbitrary JSX snippets in arbitrary places, are not.  This tail does not wag the dog of chart library selection.


问:
How I get href links for elements has no href?
Want to get video name and link from https://bubble.io/videos but I can not find href links, any ideas ?</p>
```<code>WebAutomation.LaunchChrome.LaunchChrome Url: $'''https://bubble.io/videos''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser

LOOP FOREACH CurrentItem IN DataFromWebPage

WebAutomation.ExtractData.ExtractListUsingPagingFromNumberOfPages BrowserInstance: Browser Control: $'''html > body > div:eq(1) > div:eq(3) > div > div:eq(1) > div:eq(0) > div''' ExtractionParameters: {[$'''div > div > div > div:eq(1)''', $'''Own Text''', $''''''] } MaxWebPagesToProcess: 50000 PagerCssSelector: $'''html > body > div:eq(1) > div:eq(3) > div > div:eq(1) > div:eq(1) > div:eq(2)''' PostProcessData: True TimeoutInSeconds: 60 ExtractedData=> DataFromWebPage

WebAutomation.GoToWebPage.GoToWebPage BrowserInstance: Browser Url: DataFromWebPage WaitForPageToLoadTimeout: 60

END

File.WriteToCSVFile.WriteCSV VariableToWrite: DataFromWebPage CSVFile: $'''C:\\Users\\myuser\\Documents\\bubble.csv''' CsvFileEncoding: File.CSVEncoding.UTF8 IncludeColumnNames: False IfFileExists: File.IfFileExists.Overwrite ColumnsSeparator: File.CSVColumnsSeparator.SystemDefault
</code>```

Body:
Want to get video name and link from https://bubble.io/videos but I can not find href links, any ideas ?

WebAutomation.LaunchChrome.LaunchChrome Url: $'''https://bubble.io/videos''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser

LOOP FOREACH CurrentItem IN DataFromWebPage

WebAutomation.ExtractData.ExtractListUsingPagingFromNumberOfPages BrowserInstance: Browser Control: $'''html > body > div:eq(1) > div:eq(3) > div > div:eq(1) > div:eq(0) > div''' ExtractionParameters: {[$'''div > div > div > div:eq(1)''', $'''Own Text''', $''''''] } MaxWebPagesToProcess: 50000 PagerCssSelector: $'''html > body > div:eq(1) > div:eq(3) > div > div:eq(1) > div:eq(1) > div:eq(2)''' PostProcessData: True TimeoutInSeconds: 60 ExtractedData=> DataFromWebPage

WebAutomation.GoToWebPage.GoToWebPage BrowserInstance: Browser Url: DataFromWebPage WaitForPageToLoadTimeout: 60

END

File.WriteToCSVFile.WriteCSV VariableToWrite: DataFromWebPage CSVFile: $'''C:\\Users\\myuser\\Documents\\bubble.csv''' CsvFileEncoding: File.CSVEncoding.UTF8 IncludeColumnNames: False IfFileExists: File.IfFileExists.Overwrite ColumnsSeparator: File.CSVColumnsSeparator.SystemDefault


问:
How can I Properly Install Ruby 3.2.0 on Almalinux with openssl?
I can't get the latest Ruby 3.2.0 installed.

```<code>[Fri Jan 06 18:36:34 user3@server_d ~/build/ruby-3.2.0] cat ext/openssl/mkmf.log
=== OpenSSL for Ruby configurator ===
LD_LIBRARY_PATH=.:../.. "gcc -o conftest -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/openssl -I/usr/bin/openssl/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleaserver_d-indentation -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef conftest.c  -L. -L../.. -L/usr/bin/openssl/lib -Wl,-rpath,/usr/bin/openssl/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby-static -lz -lrt -lrt -ldl -lcrypt -lm -lpthread   -lm -lpthread  -lc"
cc1: error: /usr/bin/openssl/include: Not a directory
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

/home/user3/build/ruby-3.2.0/lib/mkmf.rb:490: The compiler failed to generate an executable file.
You have to install development tools first.

[Fri Jan 06 18:40:43 user3@server_d ~/build/ruby-3.2.0] openssl version
OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)
</code>```

I've gone over all the dev tools I could find, and they're all installed that I can see.  So I guess I am missing one of them.  I'm not sure if this is an openssl or Ruby issue.  But I see this:

cc1: error: /usr/bin/openssl/include: Not a directory

Anybody have insight that can get this to install properly?

Body:
I can't get the latest Ruby 3.2.0 installed.

[Fri Jan 06 18:36:34 user3@server_d ~/build/ruby-3.2.0] cat ext/openssl/mkmf.log
=== OpenSSL for Ruby configurator ===
LD_LIBRARY_PATH=.:../.. "gcc -o conftest -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/openssl -I/usr/bin/openssl/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleaserver_d-indentation -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef conftest.c  -L. -L../.. -L/usr/bin/openssl/lib -Wl,-rpath,/usr/bin/openssl/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby-static -lz -lrt -lrt -ldl -lcrypt -lm -lpthread   -lm -lpthread  -lc"
cc1: error: /usr/bin/openssl/include: Not a directory
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

/home/user3/build/ruby-3.2.0/lib/mkmf.rb:490: The compiler failed to generate an executable file.
You have to install development tools first.

[Fri Jan 06 18:40:43 user3@server_d ~/build/ruby-3.2.0] openssl version
OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)

I've gone over all the dev tools I could find, and they're all installed that I can see.  So I guess I am missing one of them.  I'm not sure if this is an openssl or Ruby issue.  But I see this:

cc1: error: /usr/bin/openssl/include: Not a directory

Anybody have insight that can get this to install properly?


问:
c#: question about interfaces (is / as implimentation)
I am going through headfirst c# and on a section about interfaces and I got to a bit i don't understand:

```<code>    if (bees[i] is INectarCollector) {
        INectarCollector thisCollector;
        thisCollector = bees[i] as INectorCollector;
        thisCollector.GatherNectar();
    }
}
</code>```

now I understand that you use interfaces so that you can pass different class objects into a method and such, and you use a interface reference to call interface methods.

Since the class implements the methods/properties couldn't I just call the implementation inside the field instead of using the reference?

Body:
I am going through headfirst c# and on a section about interfaces and I got to a bit i don't understand:

    if (bees[i] is INectarCollector) {
        INectarCollector thisCollector;
        thisCollector = bees[i] as INectorCollector;
        thisCollector.GatherNectar();
    }
}

now I understand that you use interfaces so that you can pass different class objects into a method and such, and you use a interface reference to call interface methods.

Since the class implements the methods/properties couldn't I just call the implementation inside the field instead of using the reference?


问:
Libdevice not found Tensorflow
I am trying to run tensorflow using my GPU and have followed the instructions at this link. After running the commands in Step 6, I get the proper output.

Then, when I try to run an actual model I am trying to build, I get the following error.

```<code>2023-01-06 18:39:14.692537: W tensorflow/compiler/xla/service/gpu/nvptx_helper.cc:56] Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice. This may result in compilation or runtime failures, if the program we try to run uses routines from libdevice.
Searched for CUDA in the following directories:
  ./cuda_sdk_lib
  /usr/local/cuda-11.2
  /usr/local/cuda
  .
You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule's DebugOptions.  For most apps, setting the environment variable XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda will work.
2023-01-06 18:39:14.693094: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.693196: I tensorflow/compiler/jit/xla_compilation_cache.cc:477] Compiled cluster using XLA!  This line is logged at most once for the lifetime of the process.
2023-01-06 18:39:14.693275: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
2023-01-06 18:39:14.704458: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.704603: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
Traceback (most recent call last):
  File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 42, in <module>
    main(sys.argv[1:])
  File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 27, in main
    model.train()
  File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_V5.py", line 99, in train
    history = self.model.fit(x, y, batch_size = batchSize, epochs = epochs)
  File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 52, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InternalError: Graph execution error:

Detected at node 'StatefulPartitionedCall_10' defined at (most recent call last):
    File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 42, in <module>
      main(sys.argv[1:])
    File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 27, in main
      model.train()
    File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_V5.py", line 99, in train
      history = self.model.fit(x, y, batch_size = batchSize, epochs = epochs)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 65, in error_handler
      return fn(*args, **kwargs)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1650, in fit
      tmp_logs = self.train_function(iterator)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1249, in train_function
      return step_function(self, iterator)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1233, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1222, in run_step
      outputs = model.train_step(data)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1027, in train_step
      self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 527, in minimize
      self.apply_gradients(grads_and_vars)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1140, in apply_gradients
      return super().apply_gradients(grads_and_vars, name=name)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 634, in apply_gradients
      iteration = self._internal_apply_gradients(grads_and_vars)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1166, in _internal_apply_gradients
      return tf.__internal__.distribute.interim.maybe_merge_call(
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1216, in _distributed_apply_gradients_fn
      distribution.extended.update(
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1211, in apply_grad_to_update_var
      return self._update_step_xla(grad, var, id(self._var_key(var)))
Node: 'StatefulPartitionedCall_10'
libdevice not found at ./libdevice.10.bc
         [[{{node StatefulPartitionedCall_10}}]] [Op:__inference_train_function_8591]
</code>```

After doing some research, it appears that the relevant errors are the following:

```<code>2023-01-06 18:39:14.692537: W tensorflow/compiler/xla/service/gpu/nvptx_helper.cc:56] Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice. This may result in compilation or runtime failures, if the program we try to run uses routines from libdevice.
Searched for CUDA in the following directories:
  ./cuda_sdk_lib
  /usr/local/cuda-11.2
  /usr/local/cuda
  .
You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule's DebugOptions.  For most apps, setting the environment variable XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda will work.
2023-01-06 18:39:14.693094: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.693196: I tensorflow/compiler/jit/xla_compilation_cache.cc:477] Compiled cluster using XLA!  This line is logged at most once for the lifetime of the process.
2023-01-06 18:39:14.693275: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
2023-01-06 18:39:14.704458: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.704603: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
Traceback (most recent call last):
</code>```

For context, this is running in Ubuntu 20.04 and python 3.9. Any ideas on how to fix?

Title: Libdevice not found Tensorflow

Body:
I am trying to run tensorflow using my GPU and have followed the instructions at this link. After running the commands in Step 6, I get the proper output.

Then, when I try to run an actual model I am trying to build, I get the following error.

2023-01-06 18:39:14.692537: W tensorflow/compiler/xla/service/gpu/nvptx_helper.cc:56] Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice. This may result in compilation or runtime failures, if the program we try to run uses routines from libdevice.
Searched for CUDA in the following directories:
  ./cuda_sdk_lib
  /usr/local/cuda-11.2
  /usr/local/cuda
  .
You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule's DebugOptions.  For most apps, setting the environment variable XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda will work.
2023-01-06 18:39:14.693094: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.693196: I tensorflow/compiler/jit/xla_compilation_cache.cc:477] Compiled cluster using XLA!  This line is logged at most once for the lifetime of the process.
2023-01-06 18:39:14.693275: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
2023-01-06 18:39:14.704458: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.704603: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
Traceback (most recent call last):
  File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 42, in <module>
    main(sys.argv[1:])
  File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 27, in main
    model.train()
  File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_V5.py", line 99, in train
    history = self.model.fit(x, y, batch_size = batchSize, epochs = epochs)
  File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 52, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InternalError: Graph execution error:

Detected at node 'StatefulPartitionedCall_10' defined at (most recent call last):
    File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 42, in <module>
      main(sys.argv[1:])
    File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_Main.py", line 27, in main
      model.train()
    File "/home/jerry/Woodburn/Woodburn_Model/model/main/Model_V5.py", line 99, in train
      history = self.model.fit(x, y, batch_size = batchSize, epochs = epochs)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 65, in error_handler
      return fn(*args, **kwargs)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1650, in fit
      tmp_logs = self.train_function(iterator)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1249, in train_function
      return step_function(self, iterator)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1233, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1222, in run_step
      outputs = model.train_step(data)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/engine/training.py", line 1027, in train_step
      self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 527, in minimize
      self.apply_gradients(grads_and_vars)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1140, in apply_gradients
      return super().apply_gradients(grads_and_vars, name=name)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 634, in apply_gradients
      iteration = self._internal_apply_gradients(grads_and_vars)
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1166, in _internal_apply_gradients
      return tf.__internal__.distribute.interim.maybe_merge_call(
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1216, in _distributed_apply_gradients_fn
      distribution.extended.update(
    File "/home/jerry/miniconda3/envs/tensorflow_gpu/lib/python3.9/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1211, in apply_grad_to_update_var
      return self._update_step_xla(grad, var, id(self._var_key(var)))
Node: 'StatefulPartitionedCall_10'
libdevice not found at ./libdevice.10.bc
         [[{{node StatefulPartitionedCall_10}}]] [Op:__inference_train_function_8591]

After doing some research, it appears that the relevant errors are the following:

2023-01-06 18:39:14.692537: W tensorflow/compiler/xla/service/gpu/nvptx_helper.cc:56] Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice. This may result in compilation or runtime failures, if the program we try to run uses routines from libdevice.
Searched for CUDA in the following directories:
  ./cuda_sdk_lib
  /usr/local/cuda-11.2
  /usr/local/cuda
  .
You can choose the search directory by setting xla_gpu_cuda_data_dir in HloModule's DebugOptions.  For most apps, setting the environment variable XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda will work.
2023-01-06 18:39:14.693094: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.693196: I tensorflow/compiler/jit/xla_compilation_cache.cc:477] Compiled cluster using XLA!  This line is logged at most once for the lifetime of the process.
2023-01-06 18:39:14.693275: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
2023-01-06 18:39:14.704458: W tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:326] libdevice is required by this HLO module but was not found at ./libdevice.10.bc
2023-01-06 18:39:14.704603: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:446 : INTERNAL: libdevice not found at ./libdevice.10.bc
Traceback (most recent call last):

For context, this is running in Ubuntu 20.04 and python 3.9. Any ideas on how to fix?


问:
Plotnine 3d graph rotation and interactivity
I've managed to create 3d plots with the plotnine3d library, but I can't figure out how play with it. What i wanted to know is how (if possible) can I:

Make a rotating gif animation

Enable zooming in or out

Make objects like dots interactable

So far what i have is the following:

```<code>plot = (ggplot_3d(df) + aes(x='x1', y='x2', z='x3'))
(plot +
geom_point_3d() +
geom_line_3d(aes(color = "value", alpha = "distance", group = "grp"), size = 1.5) +
geom_label_3d(aes(label = "name")) +
theme(axis_text_x = element_blank(), axis_text_y = element_blank(),
       legend_position = "none",
       figure_size = (8,8)) )
</code>```

Body:
I've managed to create 3d plots with the plotnine3d library, but I can't figure out how play with it. What i wanted to know is how (if possible) can I:

Make a rotating gif animation

Enable zooming in or out

Make objects like dots interactable

So far what i have is the following:

plot = (ggplot_3d(df) + aes(x='x1', y='x2', z='x3'))
(plot +
geom_point_3d() +
geom_line_3d(aes(color = "value", alpha = "distance", group = "grp"), size = 1.5) +
geom_label_3d(aes(label = "name")) +
theme(axis_text_x = element_blank(), axis_text_y = element_blank(),
       legend_position = "none",
       figure_size = (8,8)) )


问:
Is it possible to set generic legend next to four subplots matplotlib?
I have the following code:

```<code>x1 = np.linspace(0, 5, 10)
y1 = x1 + np.random.randn(10)
y2 = x1 + np.random.randn(10)

x2 = np.linspace(0, 5, 10)
y3 = x2 + np.random.randn(10)
y4 = x2 + np.random.randn(10)

x3 = np.linspace(0, 5, 10)
y5 = x3 + np.random.randn(10)
y6 = x3 + np.random.randn(10)

x4 = np.linspace(0, 5, 10)
y7 = x4 + np.random.randn(10)
y8 = x4 + np.random.randn(10)

# Set up a figure with 2 rows and 2 columns of subplots
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)

x = [i for i in range(10,101,10)]

# Plot multiple line charts on each subplot
l1, = ax1.plot(x1, y1, 'o-')
l2, = ax1.plot(x1, y2, '^-')
ax1.legend((l1, l2), ('Line 1', 'Line 2'))

l3, = ax2.plot(x2, y3, 's-')
l4, = ax2.plot(x2, y4, 'd-')
ax2.legend((l3, l4), ('Line 3', 'Line 4'))

l5, = ax3.plot(x3, y5, 'x-')
l6, = ax3.plot(x3, y6, '+-')
ax3.legend((l5, l6), ('Line 5', 'Line 6'))

l7, = ax4.plot(x4, y7, '*-')
l8, = ax4.plot(x4, y8, 'p-')
ax4.legend((l7, l8), ('Line 7', 'Line 8'))

# Set the x- and y-limits and labels for each subplot
ax1.set_xlim([0, 5])
ax1.set_ylim([0, 10])
ax1.set_xlabel('X1')
ax1.set_ylabel('Y1')
ax1.set_title('Subplot 1')

ax2.set_xlim([0, 5])
ax2.set_ylim([0, 10])
ax2.set_xlabel('X2')
ax2.set_ylabel('Y2')
ax2.set_title('Subplot 2')

ax3.set_xlim([0, 5])
ax3.set_ylim([0, 10])
ax3.set_xlabel('X3')
ax3.set_ylabel('Y3')
</code>```

Which yields:

With my actual datasets, the lines with the same color are the same. Hence, I only need one legend on the side of the four subplots. How can I do this?

Body:
I have the following code:

x1 = np.linspace(0, 5, 10)
y1 = x1 + np.random.randn(10)
y2 = x1 + np.random.randn(10)

x2 = np.linspace(0, 5, 10)
y3 = x2 + np.random.randn(10)
y4 = x2 + np.random.randn(10)

x3 = np.linspace(0, 5, 10)
y5 = x3 + np.random.randn(10)
y6 = x3 + np.random.randn(10)

x4 = np.linspace(0, 5, 10)
y7 = x4 + np.random.randn(10)
y8 = x4 + np.random.randn(10)

# Set up a figure with 2 rows and 2 columns of subplots
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)

x = [i for i in range(10,101,10)]

# Plot multiple line charts on each subplot
l1, = ax1.plot(x1, y1, 'o-')
l2, = ax1.plot(x1, y2, '^-')
ax1.legend((l1, l2), ('Line 1', 'Line 2'))

l3, = ax2.plot(x2, y3, 's-')
l4, = ax2.plot(x2, y4, 'd-')
ax2.legend((l3, l4), ('Line 3', 'Line 4'))

l5, = ax3.plot(x3, y5, 'x-')
l6, = ax3.plot(x3, y6, '+-')
ax3.legend((l5, l6), ('Line 5', 'Line 6'))

l7, = ax4.plot(x4, y7, '*-')
l8, = ax4.plot(x4, y8, 'p-')
ax4.legend((l7, l8), ('Line 7', 'Line 8'))

# Set the x- and y-limits and labels for each subplot
ax1.set_xlim([0, 5])
ax1.set_ylim([0, 10])
ax1.set_xlabel('X1')
ax1.set_ylabel('Y1')
ax1.set_title('Subplot 1')

ax2.set_xlim([0, 5])
ax2.set_ylim([0, 10])
ax2.set_xlabel('X2')
ax2.set_ylabel('Y2')
ax2.set_title('Subplot 2')

ax3.set_xlim([0, 5])
ax3.set_ylim([0, 10])
ax3.set_xlabel('X3')
ax3.set_ylabel('Y3')

Which yields:

With my actual datasets, the lines with the same color are the same. Hence, I only need one legend on the side of the four subplots. How can I do this?


问:
Non-linearity and heteroscedasticity in LMM with response with positive and negative numbers
I have a dataset where individual growth is measured over time in different plots. I want to see how environmental factors influence said growth using an LMM with environmental predictors as my fixed effects and individual id nested in the plot as my random effect.

lmer(RGR~Environment1 + Environment2 + initialSize + (1|Plot/IndividualID), data=data)

A challenge is that the growth rates can be both negative (dieback) and positive, so I believe it limits the transformations I can make or other distributions I could fit to the data. I have cube rooted my response, which seemed to help a bit, but has not solved the issue.

The issue I am running into (outside of non-normality) is what I believe to be both non-linearity and heteroscedasticity based on DHARMa residual plot:

One question I have is, does the bounded residuals on the left reflect heteroscedasticity or something else? If it is heteroscedasticity, can we deal with this outside of running a robust regression?

I tried running a robust regression using the robustlmm package, but received the following error, in which I could not find any troubleshooting information:

Error in as(B, "unpackedMatrix") :
no method or default for coercing “dgeMatrix” to “unpackedMatrix”

I have tried fitting the model with polynomial environmental predictors, but that also does not seem to fix the problem. I am assuming this because the issues outlined by the bounded residuals may overweight the non-linear impacts?


问:
Can you use Google Sheets Importxml to get information from google search results
I'm trying to get a unique ID inside a google results page

Example Web Address (Chrome Browser):

https://www.google.com/search?q=charlotte+hornets&rlz=1C1CHBF_enUS909US909&oq=charlotte+hornets&aqs=chrome..69i57j69i61l2.464j0j9&sourceid=chrome&ie=UTF-8

I want to get this ID %2Fm%2F01k8vh

Picture of the line

I'm just not able to figure out what xpath I should use.


问:
modal fade not showing,using vuetify, vue js , axios
My system does not show the modal fade when I click on the button I don't know what to do anymore I'm using vuetify , vue js , and axios in the project follow the code section below

```<code><div
        ref="modal"
        class="modal show"
        :class="{show}"
        tabindex="-1"
        role="dialog"
      >
        <div class="modal-dialog modal-lg" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title">Criação de Marca</h5>
              <button
                type="button"
                class="close"
                data-dismiss="modal"
                aria-label="Close"
                @click="criarMarca"
              >
                <span aria-hidden="true">×</span>
              </button>
            </div>
            <div class="modal-body">
              <form v-on:submit.prevent="cadastroMarca">
              <div class="mb-3">
                <label for="formName" class="form-label">Nome</label>
                <input class="form-control" type="text" v-model="Marca" id="marca">
              </div>

              <div class="mb-3">
                <button type="submit" class="btn btn-primary pull-right">Cadastrar</button>
              </div>
              </form>
              </div>
          </div>
        </div>
      </div>
</code>```

I already tried to reinstall the node module, I already changed it for modal-dialog, then when I change it for modal-dialog it appears more static, I would like to know if anyone has had this problem, if so, what is the way to solve it

Body:
My system does not show the modal fade when I click on the button I don't know what to do anymore I'm using vuetify , vue js , and axios in the project follow the code section below

Criação de Marca

              <button
                type="button"
                class="close"
                data-dismiss="modal"
                aria-label="Close"
                @click="criarMarca"
              >
                ×
              </button>

              <form v-on:submit.prevent="cadastroMarca">

                Nome
                <input class="form-control" type="text" v-model="Marca" id="marca">

                <button type="submit" class="btn btn-primary pull-right">Cadastrar</button>

              </form>

I already tried to reinstall the node module, I already changed it for modal-dialog, then when I change it for modal-dialog it appears more static, I would like to know if anyone has had this problem, if so, what is the way to solve it


问:
How to write test case for onChange method of multiple inputs and radio buttons in react?
I'm beginner to Unit test Cases. I want to write a test case for multiple inputs and radio buttons onchange method. I've gone through the link https://www.pluralsight.com/guides/how-to-test-react-components-in-typescript but multiple onChange methods have been written for separate inputs.

Here is my code:

```<code><TextField id="outlined-basic" label="first Name" variant="outlined" name="fName" onChange={(e) => this.updateData("firstName", e.target.value)} />
<TextField id="filled-basic" variant="filled" name="lName" label="last Name" onChange={(e) => this.updateData("lastName", e.target.value)} />

 <RadioGroup row aria-labelledby="demo-row-radio-buttons-group-label" name="row-radio-buttons-group">
    <FormControlLabel value="female" control={<Radio />} label="Female" name="genderFemale" onChange={(e) => this.updateData("gender", e.target.value)} />
    <FormControlLabel value="male" control={<Radio />} label="Male" name="genderMale" onChange={(e) => this.updateData("gender", e.target.value)} />
    <FormControlLabel value="other" control={<Radio />} label="Other" name="Other" onChange={(e) => this.updateData("gender", e.target.value)} />
 </RadioGroup>

</code>```

onChange method:

```<code>updateData = (fieldKey: string, value: any) => {
 setFormData({
  ...formData,
  [fieldKey]: value,
 })
}
</code>```

Can anyone help me on this to write onChange method test case passing 2 parameters (key, value)?

It would be more helpful. Thanks in advance.

Body:
I'm beginner to Unit test Cases. I want to write a test case for multiple inputs and radio buttons onchange method. I've gone through the link https://www.pluralsight.com/guides/how-to-test-react-components-in-typescript but multiple onChange methods have been written for separate inputs.

Here is my code:

<TextField id="outlined-basic" label="first Name" variant="outlined" name="fName" onChange={(e) => this.updateData("firstName", e.target.value)} />
<TextField id="filled-basic" variant="filled" name="lName" label="last Name" onChange={(e) => this.updateData("lastName", e.target.value)} />

 <RadioGroup row aria-labelledby="demo-row-radio-buttons-group-label" name="row-radio-buttons-group">
    <FormControlLabel value="female" control={<Radio />} label="Female" name="genderFemale" onChange={(e) => this.updateData("gender", e.target.value)} />
    <FormControlLabel value="male" control={<Radio />} label="Male" name="genderMale" onChange={(e) => this.updateData("gender", e.target.value)} />
    <FormControlLabel value="other" control={<Radio />} label="Other" name="Other" onChange={(e) => this.updateData("gender", e.target.value)} />
 </RadioGroup>

onChange method:

updateData = (fieldKey: string, value: any) => {
 setFormData({
  ...formData,
  [fieldKey]: value,
 })
}

Can anyone help me on this to write onChange method test case passing 2 parameters (key, value)?

It would be more helpful. Thanks in advance.


问:
Django inline formset not valid on update
My create method works perfectly, but the update does not.  It returns one error for each inline as an empty list []

forms.py

```<code>StructureFormset = inlineformset_factory(Plan, Structure,
        fields = (
            'material_type',
            'weight',
            'thickness',
            'provider'
        ),
        extra=0,
        can_delete=True
        )

TestFormset = inlineformset_factory(Plan, Test,
        fields=(
            'essay',
            'critic',
            'spec'
        ),
        extra = 0,
        can_delete=True
        )

class PlanForm(ModelForm):
    class Meta:
        model = Plan
        fields = (
            'format',
            'pc',
            'revission',
            'rev_date',
            'client',
            'product',
            'gp_code',
            'code',
            'observation',
            'continuation',
            'dispatch_conditions',
            'elaborator',
            'reviewer'
        )
        localized_fields=('rev_date',)
</code>```

views.py

```<code>def editPlan(request, pk):

    plan = Plan.objects.get(id = pk)

    form = PlanForm(instance = plan)
    sformset = StructureFormset(instance=plan)
    tformset = TestFormset(instance=plan)

    context = {
            'form': form,
            'sformset': sformset,
            'tformset': tformset
        }

    if request.method == 'POST':
        print('----------------------------request----------------------------')
        print(request.POST)

        form = PlanForm(request.POST, instance = plan)

        sformset = StructureFormset(request.POST, instance=plan, prefix='structure')
        tformset = TestFormset(request.POST, instance=plan, prefix='test')

        if form.is_valid() and sformset.is_valid() and tformset.is_valid():

            print('-----------------------is valid-----------------------')

            form.save()

            instances = sformset.save(commit=False)
            for instance in instances:
                sformset.save_m2m()
                instance.save()

            tformset.save()

            return redirect('/plans/')
        else:#printing errors
            print('-----------------------is not valid-----------------------')
            print(sformset.total_error_count())
            print(sformset.errors)
            print(tformset.total_error_count())
            print(tformset.errors)

    return render(request, 'home/plan_forms.html', context)
</code>```

template.html

```<code>{{ tformset.management_form }}
<table>
    <thead>
        <tr>
            <th>Essay</th>
            <th>
                <abb title="Critical Variable">Crit.</abb>
            </th>
            <th>Spec</th>
            {% if tformset.instance.pk %}
            <th class="text-center px-1 col-1 pb-2">
                <i class="material-icons">delete</i>
            </th>
            {% endif %}
        </tr>
    </thead>
    <tbody id="tform_set">

        <!--Test form goes here-->

        {% if tformset %}
        {% for tt in tformset %}
        {% for hidden in tt.hidden_fields %}
        {{ hidden }}
        {% endfor %}
        <tr>
            <td>
                {{ tt.essay }}
            </td>
            <td class="px-1 col-1 text-center justify-content-center">
                {{ tt.critic }}
            </td>
            <td>
                {{ tt.spec }}
            </td>
            <td>
                {% if tt.instance.pk %}{{ tt.DELETE }}{% endif %}
            </td>
        </tr>
        {% endfor %}
        {% endif %}
    </tbody>

    <tbody id="tempty_form" style="display:none !important;">
        <tr>
            <td>
                {{ tformset.empty_form.essay }}
            </td>
            <td>
                {{ tformset.empty_form.critic }}
            </td>
            <td>
                {{ tformset.empty_form.spec }}
            </td>
        </tr>
    </tbody>
</table>

{{ sformset.management_form }}
<table>
    <thead>
        <tr>
            <th>Material</th>
            <th>Weight (g/m²)</th>
            <th>Thickness (μ)</th>
            <th>Provider</th>
            {% if sformset.instance.pk %}
            <th class="text-center col-1 px-1 pb-2">
                <i class="material-icons">delete</i>
            </th>
            {% endif %}
        </tr>
    </thead>
    <tbody id="sform_set">

        <!--Structure form goes here-->
        {% if sformset %}
        {% for ss in sformset %}
        {% for hidden in ss.hidden_fields %}
        {{ hidden }}
        {% endfor %}
        <tr>
            <td>
                {{ ss.material_type }}
            </td>
            <td>
                {{ ss.weight }}
            </td>
            <td>
                {{ ss.thickness }}
            </td>
            <td>
                {{ ss.provider }}
            </td>
            <td>
                {% if ss.instance.pk %}{{ ss.DELETE }}{% endif %}
            </td>
        </tr>
        {% endfor %}
        {% endif %}
    </tbody>

    <tbody id="sempty_form" style="display:none !important;">
        <tr>
            <td>
                {{ sformset.empty_form.material_type }}
            </td>
            <td>
                {{ sformset.empty_form.weight }}
            </td>
            <td>
                {{ sformset.empty_form.thickness }}
            </td>
            <td>
                {{ sformset.empty_form.provider }}
                </div>
            </td>
        </tr>
    </tbody>
</table>

This is what i get from the prints;
notice the:
`
1
[]
1
[]
` bellow the `is not valid`

[![Print Output](https://i.stack.imgur.com/whRc0.png)](https://i.stack.imgur.com/whRc0.png)
</code>```

Body:
My create method works perfectly, but the update does not.  It returns one error for each inline as an empty list []

forms.py

StructureFormset = inlineformset_factory(Plan, Structure,
        fields = (
            'material_type',
            'weight',
            'thickness',
            'provider'
        ),
        extra=0,
        can_delete=True
        )

TestFormset = inlineformset_factory(Plan, Test,
        fields=(
            'essay',
            'critic',
            'spec'
        ),
        extra = 0,
        can_delete=True
        )

class PlanForm(ModelForm):
    class Meta:
        model = Plan
        fields = (
            'format',
            'pc',
            'revission',
            'rev_date',
            'client',
            'product',
            'gp_code',
            'code',
            'observation',
            'continuation',
            'dispatch_conditions',
            'elaborator',
            'reviewer'
        )
        localized_fields=('rev_date',)

views.py

def editPlan(request, pk):

    plan = Plan.objects.get(id = pk)

    form = PlanForm(instance = plan)
    sformset = StructureFormset(instance=plan)
    tformset = TestFormset(instance=plan)

    context = {
            'form': form,
            'sformset': sformset,
            'tformset': tformset
        }

    if request.method == 'POST':
        print('----------------------------request----------------------------')
        print(request.POST)

        form = PlanForm(request.POST, instance = plan)

        sformset = StructureFormset(request.POST, instance=plan, prefix='structure')
        tformset = TestFormset(request.POST, instance=plan, prefix='test')

        if form.is_valid() and sformset.is_valid() and tformset.is_valid():

            print('-----------------------is valid-----------------------')

            form.save()

            instances = sformset.save(commit=False)
            for instance in instances:
                sformset.save_m2m()
                instance.save()

            tformset.save()

            return redirect('/plans/')
        else:#printing errors
            print('-----------------------is not valid-----------------------')
            print(sformset.total_error_count())
            print(sformset.errors)
            print(tformset.total_error_count())
            print(tformset.errors)

    return render(request, 'home/plan_forms.html', context)

template.html

{{ tformset.management_form }}

            Essay

                <abb title="Critical Variable">Crit.</abb>

            Spec
            {% if tformset.instance.pk %}

                delete

            {% endif %}

        {% if tformset %}
        {% for tt in tformset %}
        {% for hidden in tt.hidden_fields %}
        {{ hidden }}
        {% endfor %}

                {{ tt.essay }}

                {{ tt.critic }}

                {{ tt.spec }}

                {% if tt.instance.pk %}{{ tt.DELETE }}{% endif %}

        {% endfor %}
        {% endif %}

                {{ tformset.empty_form.essay }}

                {{ tformset.empty_form.critic }}

                {{ tformset.empty_form.spec }}

{{ sformset.management_form }}

            Material
            Weight (g/m²)
            Thickness (μ)
            Provider
            {% if sformset.instance.pk %}

                delete

            {% endif %}

        {% if sformset %}
        {% for ss in sformset %}
        {% for hidden in ss.hidden_fields %}
        {{ hidden }}
        {% endfor %}

                {{ ss.material_type }}

                {{ ss.weight }}

                {{ ss.thickness }}

                {{ ss.provider }}

                {% if ss.instance.pk %}{{ ss.DELETE }}{% endif %}

        {% endfor %}
        {% endif %}

                {{ sformset.empty_form.material_type }}

                {{ sformset.empty_form.weight }}

                {{ sformset.empty_form.thickness }}

                {{ sformset.empty_form.provider }}

This is what i get from the prints;
notice the:
`
1
[]
1
[]
` bellow the `is not valid`

[![Print Output](https://i.stack.imgur.com/whRc0.png)](https://i.stack.imgur.com/whRc0.png)


问:
How is each column of natural spline calculated?
If I run the code below, I will get a spline object with 4 columns.

```<code>library(splines)

x <- seq(0, 1, length.out = 11)

ns(x,df=4)
</code>```

Could you help me understand how each column(for example, column 1, 0.00, 0.01066, 0.08533....) is calculated?

I did some searching and found that the number of columns(4) is related to the number of knots in the natural spline as each trajectory needs a column. However, I didn't find any material mentioning how each column is calculated.

Body:
If I run the code below, I will get a spline object with 4 columns.

library(splines)

x <- seq(0, 1, length.out = 11)

ns(x,df=4)

Could you help me understand how each column(for example, column 1, 0.00, 0.01066, 0.08533....) is calculated?

I did some searching and found that the number of columns(4) is related to the number of knots in the natural spline as each trajectory needs a column. However, I didn't find any material mentioning how each column is calculated.


问:
Prettier not working. Already set to default formatter
Getting this error:
Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'TypeScript React'-files

I've tried in all types of files including typescriptreact, javascriptreact, javascript, etc.

To be more specific, I am using ESLint with Prettier for a NextJS13 app. Below are my settings.json

```<code>  "files.autoSave": "afterDelay",
  "[php]": {
    "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
  },
  "[erb]": {
    "editor.defaultFormatter": "aliariff.vscode-erb-beautify"
  },
  "javascript.updateImportsOnFileMove.enabled": "always",
  "git.autofetch": true,
  "editor.fontSize": 16,
  "eslint.format.enable": true,
  "python.formatting.provider": "black",
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  },
  "editor.fontFamily": "JetBrains Mono",
  "editor.accessibilitySupport": "off",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "workbench.iconTheme": "vscode-icons",
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "terminal.integrated.env.osx": {
    "FIG_NEW_SESSION": "1"
  },
  "snyk.yesWelcomeNotification": false,
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[ruby]": {
    "editor.defaultFormatter": "rebornix.ruby"
  },
  "bracket-pair-colorizer-2.depreciation-notice": false,
  "eslint.workingDirectories": [
    "./react-client"
  ],
</code>```

Body:
Getting this error:
Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'TypeScript React'-files

I've tried in all types of files including typescriptreact, javascriptreact, javascript, etc.

To be more specific, I am using ESLint with Prettier for a NextJS13 app. Below are my settings.json

  "files.autoSave": "afterDelay",
  "[php]": {
    "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
  },
  "[erb]": {
    "editor.defaultFormatter": "aliariff.vscode-erb-beautify"
  },
  "javascript.updateImportsOnFileMove.enabled": "always",
  "git.autofetch": true,
  "editor.fontSize": 16,
  "eslint.format.enable": true,
  "python.formatting.provider": "black",
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  },
  "editor.fontFamily": "JetBrains Mono",
  "editor.accessibilitySupport": "off",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "workbench.iconTheme": "vscode-icons",
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "terminal.integrated.env.osx": {
    "FIG_NEW_SESSION": "1"
  },
  "snyk.yesWelcomeNotification": false,
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[ruby]": {
    "editor.defaultFormatter": "rebornix.ruby"
  },
  "bracket-pair-colorizer-2.depreciation-notice": false,
  "eslint.workingDirectories": [
    "./react-client"
  ],


问:
Error when upload excel to SSMS: The value violated the integrity constraints for the column
I tried to upload an excel file to SSMS but I got the following message:

Copying to [dbo].[test] (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Unspecified error".
(SQL Server Import and Export Wizard)

Error 0xc020901c: Data Flow Task 1: There was an error with Destination - test.Inputs[Destination Input].Columns[PCN] on Destination - test.Inputs[Destination Input]. The column status returned was: "The value violated the integrity constraints for the column.".
(SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "Destination - test.Inputs[Destination Input]" failed because error code 0xC020907D occurred, and the error row disposition on "Destination - test.Inputs[Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Destination - test" (29) failed with error code 0xC0209029 while processing input "Destination Input" (42). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)

My destination is SQL Server Native Client 11.0.The server name is just my local server name.
Thank you. Any advice is appreciated.

I did some research and I tried to alter the nullable in mapping but I can't:enter image description here I am not able to check the "Nullable" box.


问:
Is it possible to add responsive background image using cloudinary in React?
I have just discovered cloudinary and I am making a website where I am trying to make several sections of the page with different background images to be responsive by size as well by format for older browsers.

I have set up React SDK and with AdvancedImage I am getting responsive images.

My question is it possible to set up the AdvancedImage to be background image?
Or for the background images I have to set functions for the screen width and in which browser the page is viewed to set manually the screen width and format to include into url when requesting an image from cloudinary?
Or should I get the image using the AdvancedImage and place it as absolute in the container?

I was googling and checking the documentation of cloudinary with no luck.


问:
AWS Datastore.query - Reachability Notifying reachability chnage is false instead of true
Working on a React Native Expo project, I am fetching data using DataStore.query to my amplify backend.

```<code>const fetchRestaurants = async () => {
        const results = await DataStore.query(Restaurant)
        setRestaurants(results)
    }

    useEffect(() => {
        fetchRestaurants()
    }, [])
</code>```

For iOS, I get:

```<code>iOS Bundling complete 53ms
 LOG  [INFO] 49:57.609 Reachability - subscribing to reachability in React Native
 LOG  [INFO] 50:58.504 Reachability - Notifying reachability change true
</code>```

However for Android, I get:

```<code>Android Bundling complete 73ms
 LOG  [INFO] 50:58.358 Reachability - subscribing to reachability in React Native
 LOG  [INFO] 51:58.380 Reachability - Notifying reachability change false
</code>```

The Notifying reachability for android is false, as a result it fails to fetch any data from the backend. For iOS it works.

Body:
Working on a React Native Expo project, I am fetching data using DataStore.query to my amplify backend.

const fetchRestaurants = async () => {
        const results = await DataStore.query(Restaurant)
        setRestaurants(results)
    }

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

For iOS, I get:

iOS Bundling complete 53ms
 LOG  [INFO] 49:57.609 Reachability - subscribing to reachability in React Native
 LOG  [INFO] 50:58.504 Reachability - Notifying reachability change true

However for Android, I get:

Android Bundling complete 73ms
 LOG  [INFO] 50:58.358 Reachability - subscribing to reachability in React Native
 LOG  [INFO] 51:58.380 Reachability - Notifying reachability change false

The Notifying reachability for android is false, as a result it fails to fetch any data from the backend. For iOS it works.


问:
How do I determine if the values are unique, then take the sum of the booleans?
I want to determine if the values in my dataframe are unique as booleans, (true, false) then count the ones that are unique so where unique is true.

Here is what I have so far:

 c=~df[col].duplicated(keep=False).sum()

I'm not sure if I can add .sum() at the end of this or if there is another way to do it?


问:
I am getting wrong height of the view so the view at the bottom is getting cropped in Dynamic view pager
I am using the below code to calculate the height dynamically

```<code>@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mCurrentView == null) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
int height = 0;
mCurrentView.measure(widthMeasureSpec,
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = mCurrentView.getMeasuredHeight();
if (h > height) height = h;
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
</code>```

If i hard code the "heightMeasureSpec" to some big random number the layout is properly visible, If its dynamically calculating "heightMeasureSpec" then the bottom of the view is getting cropped.

Body:
I am using the below code to calculate the height dynamically

@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mCurrentView == null) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
int height = 0;
mCurrentView.measure(widthMeasureSpec,
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = mCurrentView.getMeasuredHeight();
if (h > height) height = h;
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

If i hard code the "heightMeasureSpec" to some big random number the layout is properly visible, If its dynamically calculating "heightMeasureSpec" then the bottom of the view is getting cropped.


问:
Reset Source Control with GitHub in Visual Studio Code
Somehow I messed up the source control with GitHub in VS Code. Is there a way to reset the source control settings so I can get a fresh start?

I already tried to close repositories but they always reopen. I tried to find some settings but could not find anything useful.


问:
How to work on different interdependent maven modules in IntelliJ
I have a maven project A that depends on another maven project B. So in the pom of project A there is dependency element that refers to a version of project B. I use IntelliJ, as my IDE and now I want to make changes in project B like add a new method and I want this method to be available immediately in project A. But because project B is a different maven project. I have to make the changes in B and then do a mvn install so that the jar gets created in my local repository before those changes be available for project A. I tried creating a project from existing sources for project A and then 'Import Module from Existing Sources' for project B so that all source code for project A and B are in the same IntelliJ window but this doesn't work. How can I setup IntelliJ such that I have project A refer the source code for project B in the same IntelliJ window rather than going to the local maven repository?</p>


问:
How to add some of my code to xaml property ResizeMode= CanResizeWithGrip or whenever it is called
Hi at the begining of this question i want to say that i'm beginer and thing i've done here could prolly be done better but i'm still learnig. i want to set a value of some variable that contains the actual width of grid, and whenever i resize my window obviously this width change and I don't know how to access it. What i want to do ? Just want my progress bar to scale up or down when resizing

Here is some code

```<code><Window x:Class="Lista6.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Lista6"
        mc:Ignorable="d"
        Title="MainPage" Height="650" Width="1000"
        Background="#36393F"
        ResizeMode="CanResizeWithGrip"
        Icon="/img/Ikonka2.png"
        WindowStyle="None">
    ///other xaml code

                <ProgressBar  Foreground="White"
                              Value="50"
                              BorderThickness="0"
                              Background="Gray"
                              Height="5"
                              Width="{Binding Path=ProgresBarWidth[0], Mode=OneWay}"/>
            </StackPanel>

        </Grid>
    </Grid>
</Window>
</code>```
```<code>ObservableCollection<double> width = new ObservableCollection<double> { };

        public ObservableCollection<double> ProgresBarWidth
        {
            get
            {
               return width;
            }
            set
            {
                width = value;
            }
        }

        public AppOperator()
        {
            width.Add(0);
        }
        private void ProgresbarWidthSetter()
        {
            MainPage mp = new MainPage();
            width[0] = mp.MusicBar.Width;
        }
</code>```

Here as u can see i ve binded progres bar width to ObservColl property, and i want to call it when im resizing my window but i ve no idea how to do that.
Thanks for any help and wish u all good.

Body:
Hi at the begining of this question i want to say that i'm beginer and thing i've done here could prolly be done better but i'm still learnig. i want to set a value of some variable that contains the actual width of grid, and whenever i resize my window obviously this width change and I don't know how to access it. What i want to do ? Just want my progress bar to scale up or down when resizing

Here is some code

<Window x:Class="Lista6.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Lista6"
        mc:Ignorable="d"
        Title="MainPage" Height="650" Width="1000"
        Background="#36393F"
        ResizeMode="CanResizeWithGrip"
        Icon="/img/Ikonka2.png"
        WindowStyle="None">
    ///other xaml code

                <ProgressBar  Foreground="White"
                              Value="50"
                              BorderThickness="0"
                              Background="Gray"
                              Height="5"
                              Width="{Binding Path=ProgresBarWidth[0], Mode=OneWay}"/>
            </StackPanel>

        </Grid>
    </Grid>
</Window>

ObservableCollection<double> width = new ObservableCollection<double> { };

        public ObservableCollection<double> ProgresBarWidth
        {
            get
            {
               return width;
            }
            set
            {
                width = value;
            }
        }

        public AppOperator()
        {
            width.Add(0);
        }
        private void ProgresbarWidthSetter()
        {
            MainPage mp = new MainPage();
            width[0] = mp.MusicBar.Width;
        }

Here as u can see i ve binded progres bar width to ObservColl property, and i want to call it when im resizing my window but i ve no idea how to do that.
Thanks for any help and wish u all good.


问:
input causes EOF if program has piped stdin

import sys

piped_stdin = sys.stdin.read()
print(piped_stdin)
lucky_number = input('Enter your lucky number: ')
print(lucky_number)
```
```% echo hi | python test.py
hi

Enter your lucky number: Traceback (most recent call last):
  File "test.py", line 5, in <module>
    lucky_number = input('Enter your lucky number: ')
EOFError: EOF when reading a line
```

How can I use input after reading piped stdin?

sys.stdin.read() is not the culprit, echo hi | python -c 'input(); input()' has the same error as above, but above is what I want to achieve.

Body:
import sys

piped_stdin = sys.stdin.read()
print(piped_stdin)
lucky_number = input('Enter your lucky number: ')
print(lucky_number)

% echo hi | python test.py
hi

Enter your lucky number: Traceback (most recent call last):
  File "test.py", line 5, in <module>
    lucky_number = input('Enter your lucky number: ')
EOFError: EOF when reading a line

How can I use input after reading piped stdin?

sys.stdin.read() is not the culprit, echo hi | python -c 'input(); input()' has the same error as above, but above is what I want to achieve.


问:
Is it necessary to install all libraries in qpypi
Good evening, I am new to qpython 3 and would like to know if it's necessary to install all packages that are in QPYPI library?

The only library I installed was numpy.


问:
Running all unit tests together throws ModuleNotFoundError
I am currently having an issue, when I run the folders battery and engine, seperately, in the test folder all the tests are accepted, but when I try to run them running the test folder it fails and gives 5 ModuleNotFoundError errors.

Project structure:

```<code>lyft-back-end-engineering-virtual-experience-program
    -battery
          __init__.py
          battery.py
          nubbin_battery.py
          spindler_battery.py
     -engine
          __init__.py
          capulet_engine.py
          engine.py
          sternman_engine.py
          willoughby_engine.py
     -test
          -battery
                __init__.py
                test_nubbin_battery.py
                test_spindler_battery.py
          -engine
                __init__.py
                test_capulet_engine.py
                test_sternman_engine.py
                test_willoughby_engine.py
          __init__.py
     .gitignore
     car.py
     car_factory.py
     README.md
     serviceable.py
</code>```

Stack trace

```<code>Error
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 34, in testFailure
    raise self._exception
ImportError: Failed to import test module: battery.test_nubbin_battery
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "C:\Users\David\PycharmProjects\lyft-back-end-engineering-virtual-experience-program\test\battery\test_nubbin_battery.py", line 4, in <module>
    from battery.nubbin_battery import NubbinBattery
ModuleNotFoundError: No module named 'battery.nubbin_battery'

Error
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 34, in testFailure
    raise self._exception
ImportError: Failed to import test module: battery.test_spindler_battery
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "C:\Users\David\PycharmProjects\lyft-back-end-engineering-virtual-experience-program\test\battery\test_spindler_battery.py", line 4, in <module>
    from battery.spindler_battery import SpindlerBattery
ModuleNotFoundError: No module named 'battery.spindler_battery'
</code>```

Body:
I am currently having an issue, when I run the folders battery and engine, seperately, in the test folder all the tests are accepted, but when I try to run them running the test folder it fails and gives 5 ModuleNotFoundError errors.

Project structure:

lyft-back-end-engineering-virtual-experience-program
    -battery
          __init__.py
          battery.py
          nubbin_battery.py
          spindler_battery.py
     -engine
          __init__.py
          capulet_engine.py
          engine.py
          sternman_engine.py
          willoughby_engine.py
     -test
          -battery
                __init__.py
                test_nubbin_battery.py
                test_spindler_battery.py
          -engine
                __init__.py
                test_capulet_engine.py
                test_sternman_engine.py
                test_willoughby_engine.py
          __init__.py
     .gitignore
     car.py
     car_factory.py
     README.md
     serviceable.py

Stack trace

Error
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 34, in testFailure
    raise self._exception
ImportError: Failed to import test module: battery.test_nubbin_battery
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "C:\Users\David\PycharmProjects\lyft-back-end-engineering-virtual-experience-program\test\battery\test_nubbin_battery.py", line 4, in <module>
    from battery.nubbin_battery import NubbinBattery
ModuleNotFoundError: No module named 'battery.nubbin_battery'

Error
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 34, in testFailure
    raise self._exception
ImportError: Failed to import test module: battery.test_spindler_battery
Traceback (most recent call last):
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "C:\Users\David\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "C:\Users\David\PycharmProjects\lyft-back-end-engineering-virtual-experience-program\test\battery\test_spindler_battery.py", line 4, in <module>
    from battery.spindler_battery import SpindlerBattery
ModuleNotFoundError: No module named 'battery.spindler_battery'