问:
What does this error "Thread 1: EXC_BAD_ACCESS (code=2, address=0x30d51fff8)" mean? How do I fix it
```<code>import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var triviaLabel: UILabel!

    @IBOutlet weak var trueButton: UIButton!

    @IBOutlet weak var falseButton: UIButton!

    @IBOutlet weak var progressBar: UIProgressView!

    var quiz = [Question(text: "Blah blah", answer: "True"),
                Question(text: "Ha ha", answer: "True"),Question(text: "Bruh bruh", answer: "False")]

    var questionNumber = 0

    override func viewDidLoad() {
        super.viewDidLoad()
        updateQuestion()
    }

    @IBAction func answerButtonPressed(_ sender: UIButton) {
        let userAnswer = sender.currentTitle
        let actualAnswer = quiz[questionNumber].answer
        if userAnswer == actualAnswer {

        } else {

        }

        if questionNumber < quiz.count-1 {
            questionNumber += 1
        }else {
            questionNumber = 0
        }
        updateQuestion()
    }

    func updateQuestion() {
        triviaLabel.text = quiz[questionNumber].text // Get the error here
        updateQuestion()
    }
}
</code>```

The build succeeds and the app launches but there comes a blank screen and the error occurs. I tried mapping the label again with the storyboard. I speculate that there is some problem with the label declaration or connection.

Body:
import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var triviaLabel: UILabel!

    @IBOutlet weak var trueButton: UIButton!

    @IBOutlet weak var falseButton: UIButton!

    @IBOutlet weak var progressBar: UIProgressView!

    var quiz = [Question(text: "Blah blah", answer: "True"),
                Question(text: "Ha ha", answer: "True"),Question(text: "Bruh bruh", answer: "False")]

    var questionNumber = 0

    override func viewDidLoad() {
        super.viewDidLoad()
        updateQuestion()
    }

    @IBAction func answerButtonPressed(_ sender: UIButton) {
        let userAnswer = sender.currentTitle
        let actualAnswer = quiz[questionNumber].answer
        if userAnswer == actualAnswer {

        } else {

        }

        if questionNumber < quiz.count-1 {
            questionNumber += 1
        }else {
            questionNumber = 0
        }
        updateQuestion()
    }

    func updateQuestion() {
        triviaLabel.text = quiz[questionNumber].text // Get the error here
        updateQuestion()
    }
}

The build succeeds and the app launches but there comes a blank screen and the error occurs. I tried mapping the label again with the storyboard. I speculate that there is some problem with the label declaration or connection.


来源: stackexchange

问:
Codeigniter 4: authfilter filter must have a matching alias defined
I'm new to Codeigniter 4.
I'm developing something localy (Win10/XAMPP) and everything works fine. I uploaded code to linux hosting and suddenly I got error: authfilter filter must have a matching alias defined. 'authfilter' was an allias name in Config/Filters file. Than I noticed that allias is lowercased filter class name, so I changed allias to authfil and now I am getting error: Class 'App\Filters\AuthFilter' not found (SYSTEMPATH/Filters/Filters.php at line 167).

Can anyone explain to me what makes the difference; same code, Windows vs. Linux.

My App/Config/Filters contains following code:

```<code>namespace Config;

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;
use App\Filters\FilterInterface;
use App\Filters\AuthFilter;

class Filters extends BaseConfig
{
    /**
     * Configures aliases for Filter classes to
     * make reading things nicer and simpler.
     *
     * @var array
     */
    public $aliases = [
        'csrf'          => CSRF::class,
        'toolbar'       => DebugToolbar::class,
        'honeypot'      => Honeypot::class,
        'invalidchars'  => InvalidChars::class,
        'secureheaders' => SecureHeaders::class,
        'authfil'    => \App\Filters\AuthFilter::class,
    ];

    /**
     * List of filter aliases that are always
     * applied before and after every request.
     *
     * @var array
     */
    public $globals = [
        'before' => [
            // 'honeypot',
            // 'csrf',
            // 'invalidchars',
            'authfil' ///=> ['except' => 'auth/login']
        ],
        'after' => [
            'toolbar',
            // 'honeypot',
            // 'secureheaders',
        ],
    ];
</code>```

My routes looks like:

```<code>$routes->group('auth', ['filter' => 'authfil'],['namespace' => 'IonAuth\Controllers'], function ($routes) {
    $routes->get('/', 'Auth::index');
    $routes->add('login', 'Auth::login');
    $routes->get('logout', 'Auth::logout');
...
}
</code>```

Thanx in advance,
Siniša

P.S. I put: use App\Filters\AuthFilter to SYSTEMPATH/Filters/Filters.php but with no success. I also tried to add filter to the route, and all combinations that I can think of before I post the question.
The fact is, my project is quite large and today, after few months of working, I find out that I should use filters for login check instead of put login check inside initController function... InitController function is a strange approach to me, instead of using standard OOP concepts (constructors). However, there is a reason for everything, even if it's not obvious to me :).

ContentLicense: CC BY-SA 4.0

Body:
I'm new to Codeigniter 4.
I'm developing something localy (Win10/XAMPP) and everything works fine. I uploaded code to linux hosting and suddenly I got error: authfilter filter must have a matching alias defined. 'authfilter' was an allias name in Config/Filters file. Than I noticed that allias is lowercased filter class name, so I changed allias to authfil and now I am getting error: Class 'App\Filters\AuthFilter' not found (SYSTEMPATH/Filters/Filters.php at line 167).

Can anyone explain to me what makes the difference; same code, Windows vs. Linux.

My App/Config/Filters contains following code:

namespace Config;

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;
use App\Filters\FilterInterface;
use App\Filters\AuthFilter;

class Filters extends BaseConfig
{
    /**
     * Configures aliases for Filter classes to
     * make reading things nicer and simpler.
     *
     * @var array
     */
    public $aliases = [
        'csrf'          => CSRF::class,
        'toolbar'       => DebugToolbar::class,
        'honeypot'      => Honeypot::class,
        'invalidchars'  => InvalidChars::class,
        'secureheaders' => SecureHeaders::class,
        'authfil'    => \App\Filters\AuthFilter::class,
    ];

    /**
     * List of filter aliases that are always
     * applied before and after every request.
     *
     * @var array
     */
    public $globals = [
        'before' => [
            // 'honeypot',
            // 'csrf',
            // 'invalidchars',
            'authfil' ///=> ['except' => 'auth/login']
        ],
        'after' => [
            'toolbar',
            // 'honeypot',
            // 'secureheaders',
        ],
    ];

My routes looks like:

$routes->group('auth', ['filter' => 'authfil'],['namespace' => 'IonAuth\Controllers'], function ($routes) {
    $routes->get('/', 'Auth::index');
    $routes->add('login', 'Auth::login');
    $routes->get('logout', 'Auth::logout');
...
}

Thanx in advance,
Siniša

P.S. I put: use App\Filters\AuthFilter to SYSTEMPATH/Filters/Filters.php but with no success. I also tried to add filter to the route, and all combinations that I can think of before I post the question.
The fact is, my project is quite large and today, after few months of working, I find out that I should use filters for login check instead of put login check inside initController function... InitController function is a strange approach to me, instead of using standard OOP concepts (constructors). However, there is a reason for everything, even if it's not obvious to me :).


问:
How i send ERC20 tokens using wagmi.sh hooks (useSendTransaction)?
How can I send ERC20 tokens (not native tokens) using wagmi.sh hooks (useSendTransaction)?

This the standard react hook :

```<code>import { useSendTransaction, usePrepareSendTransaction } from 'wagmi'

function App() {
  const { config } = usePrepareSendTransaction({
    request: { to: 'moxey.eth', value: BigNumber.from('10000000000000000') },
  })
  const { data, isLoading, isSuccess, sendTransaction } =
    useSendTransaction(config)

  return (
    <div>
      <button disabled={!sendTransaction} onClick={() => sendTransaction?.()}>
        Send Transaction
      </button>
      {isLoading && <div>Check Wallet</div>}
      {isSuccess && <div>Transaction: {JSON.stringify(data)}</div>}
    </div>
  )
}

</code>```

can we add data field inside the request and assign the token contract address to it as a value?

```<code>import { useSendTransaction, usePrepareSendTransaction } from 'wagmi'

function App() {
  const { config } = usePrepareSendTransaction({
    request: { to: 'moxey.eth', value: BigNumber.from('10000000000000000'), data: "contract address.." },
  })
  const { data, isLoading, isSuccess, sendTransaction } =
    useSendTransaction(config)

  return (
    <div>
      <button disabled={!sendTransaction} onClick={() => sendTransaction?.()}>
        Send Transaction
      </button>
      {isLoading && <div>Check Wallet</div>}
      {isSuccess && <div>Transaction: {JSON.stringify(data)}</div>}
    </div>
  )
}
</code>```

Body:
How can I send ERC20 tokens (not native tokens) using wagmi.sh hooks (useSendTransaction)?

This the standard react hook :

import { useSendTransaction, usePrepareSendTransaction } from 'wagmi'

function App() {
  const { config } = usePrepareSendTransaction({
    request: { to: 'moxey.eth', value: BigNumber.from('10000000000000000') },
  })
  const { data, isLoading, isSuccess, sendTransaction } =
    useSendTransaction(config)

  return (

      <button disabled={!sendTransaction} onClick={() => sendTransaction?.()}>
        Send Transaction
      </button>
      {isLoading &&
Check Wallet
}
      {isSuccess &&
Transaction: {JSON.stringify(data)}
}

  )
}

can we add data field inside the request and assign the token contract address to it as a value?

import { useSendTransaction, usePrepareSendTransaction } from 'wagmi'

function App() {
  const { config } = usePrepareSendTransaction({
    request: { to: 'moxey.eth', value: BigNumber.from('10000000000000000'), data: "contract address.." },
  })
  const { data, isLoading, isSuccess, sendTransaction } =
    useSendTransaction(config)

  return (

      <button disabled={!sendTransaction} onClick={() => sendTransaction?.()}>
        Send Transaction
      </button>
      {isLoading &&
Check Wallet
}
      {isSuccess &&
Transaction: {JSON.stringify(data)}
}

  )
}


问:
Nodejs 'open' lib not working on Raspberry pi 3 when executed via SSH
I'm currently working on a POC for a project and I need to open a website on the Raspberry pi using nodejs.

Program:

```<code>const open = require('open');
const domain = 'https://www.w3schools.com/';

async function main(){
  console.log('before');
  await open(domain);
  console.log('after');
}

main();
</code>```

This works like intended on my Windows OS and the Pi, but only if I start the program directly from the pi's console. If I start the program using SSH via putty I still get the console logs 'before' and 'after' in quick succession but no browser opening.

The pi is only running the 'chromium-webbrowser', I already tried specifying it as an arg but the behavior doesn't change.

Why does my program work when I execute it from the pi directly, but not when I start it via ssh from my computer?

Body:
I'm currently working on a POC for a project and I need to open a website on the Raspberry pi using nodejs.

Program:

const open = require('open');
const domain = 'https://www.w3schools.com/';

async function main(){
  console.log('before');
  await open(domain);
  console.log('after');
}

main();

This works like intended on my Windows OS and the Pi, but only if I start the program directly from the pi's console. If I start the program using SSH via putty I still get the console logs 'before' and 'after' in quick succession but no browser opening.

The pi is only running the 'chromium-webbrowser', I already tried specifying it as an arg but the behavior doesn't change.

Why does my program work when I execute it from the pi directly, but not when I start it via ssh from my computer?


问:
Error message: Error in `vec_as_location()`: ! `...` must be empty
This is for a homework assignment: I am trying to use the group_by function to group a column by species and then I would like to find the mean height of each species. Here was my code, which was suggested to me by some of the homework materials.

Code:

```<code>dataframe.long<-dataframe.long%>%
  group_by(species)%>%
  mutate(height_averages = mean(plant_height))
</code>```

The error code in the console reads as follows:

```<code>> dataframe.long<-dataframe.long%>%
+   group_by(species)%>%
+   mutate(height_averages = mean(plant_height))
Error in `vec_as_location()`:
! `...` must be empty.
x Problematic argument:
* call = call
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlib_error_dots_nonempty>
Error in `vec_as_location()`:
! `...` must be empty.
x Problematic argument:
* call = call
---
Backtrace:
  1. dataframe.long %>% group_by(species) %>% ...
  4. dplyr:::group_by.data.frame(., species)
  5. dplyr::grouped_df(groups$data, groups$group_names, .drop)
  6. dplyr:::compute_groups(data, vars, drop = drop)
  8. tibble:::`[.tbl_df`(as_tibble(data), vars)
  9. tibble:::vectbl_as_col_location(...)
 12. vctrs::vec_as_location(j, n, names, call = call)
Run `rlang::last_trace()` to see the full context.
</code>```

Running 'rlang::last_trace gives this

```<code>---
Backtrace:
     x
  1. +-dataframe.long %>% group_by(species) %>% ...
  2. +-dplyr::mutate(., height_averages = mean(plant_height))
  3. +-dplyr::group_by(., species)
  4. \-dplyr:::group_by.data.frame(., species)
  5.   \-dplyr::grouped_df(groups$data, groups$group_names, .drop)
  6.     \-dplyr:::compute_groups(data, vars, drop = drop)
  7.       +-as_tibble(data)[vars]
  8.       \-tibble:::`[.tbl_df`(as_tibble(data), vars)
  9.         \-tibble:::vectbl_as_col_location(...)
 10.           +-tibble:::subclass_col_index_errors(...)
 11.           | \-base::withCallingHandlers(...)
 12.           \-vctrs::vec_as_location(j, n, names, call = call)
 13.             \-ellipsis::check_dots_empty()
 14.               \-rlang:::action_dots(...)
 15.                 +-base (local) try_dots(...)
 16.                 \-rlang (local) action(...)
</code>```

Here is a glimpse of my data frame

```<code>Rows: 40
Columns: 7
$ date         <chr> "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/20~
$ plant_ID     <chr> "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "21", "22", "23", "24"~
$ observer     <chr> "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "JF~
$ herbivory    <chr> "N", "Y", "Y", "Y", "N", "N", NA, NA, "N", "N", "N", "Y", "N", "N", NA, "~
$ notes        <chr> "", "", "", "", "", "", "Plant dead ", "Plant missing ", "", "", "", "", ~
$ species      <chr> "deba", "deba", "deba", "deba", "deba", "deba", "deba", "deba", "deba", "~
$ plant_height <dbl> 45.5, 23.5, 36.0, 24.5, 23.1, 21.5, 0.0, 0.0, 33.5, 33.7, 15.8, 20.4, 8.6~

</code>```

Please let me know if you have any other solutions! TYIA!

What have I done to try to mitigate this:
-restarted R, my computer, updated all packages and R in general, tried summarise instead of mutate

I thought that this function would create a new column in my dataframe that had a new column labelled height_averages but instead I got the error message above

here is the result from dput function:

```<code>structure(list(date = c("5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022"), plant_ID = c("1", "2", "3", "4", "5",
"6", "7", "8", "9", "10", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "11", "12", "13", "14", "15", "16", "17", "18",
"19", "20", "30", "31", "32", "33", "34", "35", "36", "37", "38",
"39", "40"), observer = c("EBG", "EBG", "EBG", "EBG", "EBG",
"EBG", "EBG", "EBG", "EBG", "EBG", "JF", "JF", "JF", "JF", "JF",
"JF", "JF", "JF", "JF", "KA", "KA", "KA", "KA", "KA", "KA", "KA",
"KA", "KA", "KA", "CM", "CM", "CM", "CM", "CM", "CM", "CM", "CM",
"CM", "CM", "CM"), herbivory = c("N", "Y", "Y", "Y", "N", "N",
NA, NA, "N", "N", "N", "Y", "N", "N", NA, "Y", "Y", "Y", NA,
"N", "N", NA, "Y", "Y", "N", NA, "Y", "N", "Y", "N", "N", NA,
"Y", "N", "N", "Y", NA, "Y", "Y", "N"), notes = c("", "", "",
"", "", "", "Plant dead ", "Plant missing ", "", "", "", "",
"", "", "Plant missing ", "", "", "", "Plant Dead", "", "", "Plant missingÂ ",
"", "", "", "Plant dead", "", "", "", "", "", "Plant missing",
"", "", "", "", "Plant dead", "", "", ""), species = c("deba",
"deba", "deba", "deba", "deba", "deba", "deba", "deba", "deba",
"deba", "denu", "denu", "denu", "denu", "denu", "denu", "denu",
"denu", "denu", "getr", "getr", "getr", "getr", "getr", "getr",
"getr", "getr", "getr", "getr", "lile", "lile", "lile", "lile",
"lile", "lile", "lile", "lile", "lile", "lile", "lile"), plant_height = c(45.5,
23.5, 36, 24.5, 23.1, 21.5, 0, 0, 33.5, 33.7, 15.8, 20.4, 8.6,
18.9, 0, 16.9, 15.2, 32.1, 0, 6.2, 7.4, 0, 1.1, 2.2, 3.1, 0,
6.4, 4.1, 2.2, 41.8, 33.6, 0, 32.4, 37.3, 37.5, 11.9, 0, 46.3,
37.9, 41.6)), row.names = c(NA, -40L), class = "data.frame")
</code>```

Body:
This is for a homework assignment: I am trying to use the group_by function to group a column by species and then I would like to find the mean height of each species. Here was my code, which was suggested to me by some of the homework materials.

Code:

dataframe.long<-dataframe.long%>%
  group_by(species)%>%
  mutate(height_averages = mean(plant_height))

The error code in the console reads as follows:

> dataframe.long<-dataframe.long%>%
+   group_by(species)%>%
+   mutate(height_averages = mean(plant_height))
Error in `vec_as_location()`:
! `...` must be empty.
x Problematic argument:
* call = call
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlib_error_dots_nonempty>
Error in `vec_as_location()`:
! `...` must be empty.
x Problematic argument:
* call = call
---
Backtrace:
  1. dataframe.long %>% group_by(species) %>% ...
  4. dplyr:::group_by.data.frame(., species)
  5. dplyr::grouped_df(groups$data, groups$group_names, .drop)
  6. dplyr:::compute_groups(data, vars, drop = drop)
  8. tibble:::`[.tbl_df`(as_tibble(data), vars)
  9. tibble:::vectbl_as_col_location(...)
 12. vctrs::vec_as_location(j, n, names, call = call)
Run `rlang::last_trace()` to see the full context.

Running 'rlang::last_trace gives this

---
Backtrace:
     x
  1. +-dataframe.long %>% group_by(species) %>% ...
  2. +-dplyr::mutate(., height_averages = mean(plant_height))
  3. +-dplyr::group_by(., species)
  4. \-dplyr:::group_by.data.frame(., species)
  5.   \-dplyr::grouped_df(groups$data, groups$group_names, .drop)
  6.     \-dplyr:::compute_groups(data, vars, drop = drop)
  7.       +-as_tibble(data)[vars]
  8.       \-tibble:::`[.tbl_df`(as_tibble(data), vars)
  9.         \-tibble:::vectbl_as_col_location(...)
 10.           +-tibble:::subclass_col_index_errors(...)
 11.           | \-base::withCallingHandlers(...)
 12.           \-vctrs::vec_as_location(j, n, names, call = call)
 13.             \-ellipsis::check_dots_empty()
 14.               \-rlang:::action_dots(...)
 15.                 +-base (local) try_dots(...)
 16.                 \-rlang (local) action(...)

Here is a glimpse of my data frame

Rows: 40
Columns: 7
$ date         <chr> "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/20~
$ plant_ID     <chr> "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "21", "22", "23", "24"~
$ observer     <chr> "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "EBG", "JF~
$ herbivory    <chr> "N", "Y", "Y", "Y", "N", "N", NA, NA, "N", "N", "N", "Y", "N", "N", NA, "~
$ notes        <chr> "", "", "", "", "", "", "Plant dead ", "Plant missing ", "", "", "", "", ~
$ species      <chr> "deba", "deba", "deba", "deba", "deba", "deba", "deba", "deba", "deba", "~
$ plant_height <dbl> 45.5, 23.5, 36.0, 24.5, 23.1, 21.5, 0.0, 0.0, 33.5, 33.7, 15.8, 20.4, 8.6~

Please let me know if you have any other solutions! TYIA!

What have I done to try to mitigate this:
-restarted R, my computer, updated all packages and R in general, tried summarise instead of mutate

I thought that this function would create a new column in my dataframe that had a new column labelled height_averages but instead I got the error message above

here is the result from dput function:

structure(list(date = c("5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022", "5/22/2022",
"5/22/2022", "5/22/2022"), plant_ID = c("1", "2", "3", "4", "5",
"6", "7", "8", "9", "10", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "11", "12", "13", "14", "15", "16", "17", "18",
"19", "20", "30", "31", "32", "33", "34", "35", "36", "37", "38",
"39", "40"), observer = c("EBG", "EBG", "EBG", "EBG", "EBG",
"EBG", "EBG", "EBG", "EBG", "EBG", "JF", "JF", "JF", "JF", "JF",
"JF", "JF", "JF", "JF", "KA", "KA", "KA", "KA", "KA", "KA", "KA",
"KA", "KA", "KA", "CM", "CM", "CM", "CM", "CM", "CM", "CM", "CM",
"CM", "CM", "CM"), herbivory = c("N", "Y", "Y", "Y", "N", "N",
NA, NA, "N", "N", "N", "Y", "N", "N", NA, "Y", "Y", "Y", NA,
"N", "N", NA, "Y", "Y", "N", NA, "Y", "N", "Y", "N", "N", NA,
"Y", "N", "N", "Y", NA, "Y", "Y", "N"), notes = c("", "", "",
"", "", "", "Plant dead ", "Plant missing ", "", "", "", "",
"", "", "Plant missing ", "", "", "", "Plant Dead", "", "", "Plant missingÂ ",
"", "", "", "Plant dead", "", "", "", "", "", "Plant missing",
"", "", "", "", "Plant dead", "", "", ""), species = c("deba",
"deba", "deba", "deba", "deba", "deba", "deba", "deba", "deba",
"deba", "denu", "denu", "denu", "denu", "denu", "denu", "denu",
"denu", "denu", "getr", "getr", "getr", "getr", "getr", "getr",
"getr", "getr", "getr", "getr", "lile", "lile", "lile", "lile",
"lile", "lile", "lile", "lile", "lile", "lile", "lile"), plant_height = c(45.5,
23.5, 36, 24.5, 23.1, 21.5, 0, 0, 33.5, 33.7, 15.8, 20.4, 8.6,
18.9, 0, 16.9, 15.2, 32.1, 0, 6.2, 7.4, 0, 1.1, 2.2, 3.1, 0,
6.4, 4.1, 2.2, 41.8, 33.6, 0, 32.4, 37.3, 37.5, 11.9, 0, 46.3,
37.9, 41.6)), row.names = c(NA, -40L), class = "data.frame")


问:
"Driver class 'sun.jdbc.odbc.JdbcOdbcDriver' could not be found, make sure the 'MS SQL Server' driver (jar file) is installed. sun.jdbc.odbc.JdbcOdbcD
I am trying to connect pentahoo/spoon with mysql::

Driver class 'sun.jdbc.odbc.JdbcOdbcDriver' could not be found, make sure the 'MySQL' driver (jar file) is installed.
sun.jdbc.odbc.JdbcOdbcDriver

I get the following error, how can I solve it?


问:
Python - OpenCV search until good enough match found and stop
I have a signature:

```<code>def find(outer: ndarray, inner: ndarray, precision: float) -> tuple[int, int] | None:
</code>```

Where outer is image in which to search for inner image (for are RGB numpy arrays).
precision is 0..1 match: 1 is full pixel-perfect match, 0 is anything at all.
If any match with satisfactory precision found, return its top-left corner, else None. It doesn't matter which match is returned: the most precise or any other.

My code for that is

```<code>    comparison = cv2.matchTemplate(outer, inner, cv2.TM_CCOEFF_NORMED)
    _, max_val, _, max_loc = cv2.minMaxLoc(comparison)
    return max_loc if max_val >= precision else None
</code>```

Which works fine, TM_CCOEFF_NORMED was chosen because it's the closest to that 0..1 precision and I can directly compare it.

Issue: this takes the same amount of time when inner is there as when it's not. I would like it to stop when first match is found, and then just fetch the coordinates.

Is it possible to do it this way?

Body:
I have a signature:

def find(outer: ndarray, inner: ndarray, precision: float) -> tuple[int, int] | None:

Where outer is image in which to search for inner image (for are RGB numpy arrays).
precision is 0..1 match: 1 is full pixel-perfect match, 0 is anything at all.
If any match with satisfactory precision found, return its top-left corner, else None. It doesn't matter which match is returned: the most precise or any other.

My code for that is

    comparison = cv2.matchTemplate(outer, inner, cv2.TM_CCOEFF_NORMED)
    _, max_val, _, max_loc = cv2.minMaxLoc(comparison)
    return max_loc if max_val >= precision else None

Which works fine, TM_CCOEFF_NORMED was chosen because it's the closest to that 0..1 precision and I can directly compare it.

Issue: this takes the same amount of time when inner is there as when it's not. I would like it to stop when first match is found, and then just fetch the coordinates.

Is it possible to do it this way?


问:
How do the splits in a decision tree classifier work?
I would like to know how the splits in the decision tree look like.

More specifically, I am wondering if they can be "relative". For example can the criterion be something like:

```<code>if x > y ..
</code>```

or does it have to be some absolute value, as in:

```<code>if x > 0.5 ..
</code>```

I don't know if it's worth creating synthetic features that introduce relationships between features or if that's already included per default.

Body:
I would like to know how the splits in the decision tree look like.

More specifically, I am wondering if they can be "relative". For example can the criterion be something like:

if x > y ..

or does it have to be some absolute value, as in:

if x > 0.5 ..

I don't know if it's worth creating synthetic features that introduce relationships between features or if that's already included per default.


问:
Rust Termion detect key release
Im trying to detect a key-release event with termion (crossterm 0.25.0 didnt work for me).

Im running ubuntu 20.04 and Termion 2.0.1

Ive been looking through the documentation and the crate code but i cant find any code on how to do that.
Ive tried detecting key releases via crossterm but that didnt work with the gnome-terminal.

what i require

I need to detect all currently pressed keys. Thats all i require.

What i want to do is trigger an action as long as a key is pressed.
I Want to write a game and its kinda inconvenient if i have to stop the player movement to shoot or do something else and start the player movement afterwards. It would be a lot nicer if i could keep the keys pressed.

What i tried

Ive tried crossterm

```<code>match key_event.kind {
    KeyEventKind::Release => {
        stdout.queue(MoveTo(128, 6)).unwrap();
        print!("Released:   {:?}", key_event.code);
    },
    KeyEventKind::Press => {
        stdout.queue(MoveTo(128, 7)).unwrap();
        print!("Press:      {:?}", key_event.code);
    },
    KeyEventKind::Repeat => {
        stdout.queue(MoveTo(128, 8)).unwrap();
        print!("Repeat:     {:?}", key_event.code);
    },
}
</code>```

that only showed key presses but not releases.

Ive tried Termion

```<code>match stdin.keys().enumerate().unwrap() {
    Key::Esc => break,
    Key::Char(c) => println!("{}", c),
    Key::Alt(c) => println!("^{}", c),
    Key::Ctrl(c) => println!("*{}", c),
    Key::Left => println!("←"),
    Key::Right => println!("→"),
    Key::Up => println!("↑"),
    Key::Down => println!("↓"),
    Key::Backspace => println!("×"),
    _ => {}
}
</code>```

but it also only shows a single key press and not the release of the key.

Title: Rust Termion detect key release

Body:
Im trying to detect a key-release event with termion (crossterm 0.25.0 didnt work for me).

Im running ubuntu 20.04 and Termion 2.0.1

Ive been looking through the documentation and the crate code but i cant find any code on how to do that.
Ive tried detecting key releases via crossterm but that didnt work with the gnome-terminal.

what i require

I need to detect all currently pressed keys. Thats all i require.

What i want to do is trigger an action as long as a key is pressed.
I Want to write a game and its kinda inconvenient if i have to stop the player movement to shoot or do something else and start the player movement afterwards. It would be a lot nicer if i could keep the keys pressed.

What i tried

Ive tried crossterm

match key_event.kind {
    KeyEventKind::Release => {
        stdout.queue(MoveTo(128, 6)).unwrap();
        print!("Released:   {:?}", key_event.code);
    },
    KeyEventKind::Press => {
        stdout.queue(MoveTo(128, 7)).unwrap();
        print!("Press:      {:?}", key_event.code);
    },
    KeyEventKind::Repeat => {
        stdout.queue(MoveTo(128, 8)).unwrap();
        print!("Repeat:     {:?}", key_event.code);
    },
}

that only showed key presses but not releases.

Ive tried Termion

match stdin.keys().enumerate().unwrap() {
    Key::Esc => break,
    Key::Char(c) => println!("{}", c),
    Key::Alt(c) => println!("^{}", c),
    Key::Ctrl(c) => println!("*{}", c),
    Key::Left => println!("←"),
    Key::Right => println!("→"),
    Key::Up => println!("↑"),
    Key::Down => println!("↓"),
    Key::Backspace => println!("×"),
    _ => {}
}

but it also only shows a single key press and not the release of the key.


问:
erasing input buffer by server's RESET message
I'm reading http and here is my problem, how and why TCP RST packet from the server ( connection reset by peer ) can leades to erase all the input buffer of client? why it is so serious?

and also is there any way to keep that information?

also another question comes in my mind, this can be happend by server anytime it wants? I mean we can use it to kind of attack to a client? use it for our benefit??

tnx in advance

I know maybe these questions would sounds stupid but i tried and i cann't find any convenient answer.


问:
Reacht 3 different cards next to each other
I am new in React and have a problem with my cards here. I want to show 3 cards next to each other but I get 3 same cards. In bootstrap react I Found this loop to show cards next to each other but because I am looping my cars in const cards I get now 3 same cards next to each other.

I have tried using React bootstrap cards but none of them worked.

If anyone knows how I can fix my issue it would be a great help!

Here is my code:

```<code>const cards = hasLoaded ? (
    <>
      {cars.results.length ? (
        <InfiniteScroll
          children={cars.results.map((car) => (
            <Car2 key={car.id} {...car} setCars={setCars} />
          ))}
          dataLength={cars.results.length}
          loader={<Asset spinner />}
          hasMore={!!cars.next}
          next={() => fetchMoreData(cars, setCars)}
        />
      ) : (
        <Container className={appStyles.Content}>
          <Asset src={NoResults} message={message} />
        </Container>
      )}
    </>
  ) : (
    <Container className={appStyles.Content}>
      <Asset spinner />
    </Container>
  );

  return (
    <Container>
      <Row className="h-100">
        <Col className="py-2 p-0 p-lg-2" lg={8}>
          <PopularProfiles mobile />
          <i className={`fas fa-search ${styles.SearchIcon}`} />
          <Form
            className={styles.SearchBar}
            onSubmit={(event) => event.preventDefault()}
          >
            <Form.Control
              value={query}
              onChange={(event) => setQuery(event.target.value)}
              type="text"
              className="mr-sm-2"
              placeholder="Search posts"
            />
          </Form>
        </Col>
      </Row>
      <Row>
        {Array.from({ length: 3 }).map((_, idx) => (
          <Col md={3}>{cards}</Col>
        ))}
        <Col md={3} className="d-none d-lg-block p-0 p-lg-2">
          <PopularProfiles />
        </Col>
      </Row>
    </Container>
  );
</code>```

Body:
I am new in React and have a problem with my cards here. I want to show 3 cards next to each other but I get 3 same cards. In bootstrap react I Found this loop to show cards next to each other but because I am looping my cars in const cards I get now 3 same cards next to each other.

I have tried using React bootstrap cards but none of them worked.

If anyone knows how I can fix my issue it would be a great help!

Here is my code:

const cards = hasLoaded ? (
    <>
      {cars.results.length ? (
        <InfiniteScroll
          children={cars.results.map((car) => (
            <Car2 key={car.id} {...car} setCars={setCars} />
          ))}
          dataLength={cars.results.length}
          loader={<Asset spinner />}
          hasMore={!!cars.next}
          next={() => fetchMoreData(cars, setCars)}
        />
      ) : (
        <Container className={appStyles.Content}>
          <Asset src={NoResults} message={message} />
        </Container>
      )}
    </>
  ) : (
    <Container className={appStyles.Content}>
      <Asset spinner />
    </Container>
  );

  return (
    <Container>
      <Row className="h-100">
        <Col className="py-2 p-0 p-lg-2" lg={8}>
          <PopularProfiles mobile />
          <i className={`fas fa-search ${styles.SearchIcon}`} />
          <Form
            className={styles.SearchBar}
            onSubmit={(event) => event.preventDefault()}
          >
            <Form.Control
              value={query}
              onChange={(event) => setQuery(event.target.value)}
              type="text"
              className="mr-sm-2"
              placeholder="Search posts"
            />
          </Form>
        </Col>
      </Row>
      <Row>
        {Array.from({ length: 3 }).map((_, idx) => (
          <Col md={3}>{cards}</Col>
        ))}
        <Col md={3} className="d-none d-lg-block p-0 p-lg-2">
          <PopularProfiles />
        </Col>
      </Row>
    </Container>
  );


问:
Flutter 3 - Stop Propagation When Tapping On Widget
I have a TextField widget inside a Container and want to be able to tap on the TextField without the tap propagating to the parent (the Container). I also want to unfocus the TextField when tapping outside it. To achieve that I have wrapped the Container with an AbsorbPointer widget inside a GestureDetector. The problem is that this makes all taps go to the Container and I lose the ability to interact with the TextField.

How to stop event propagation from the TextField to the Container?

Edit: Futter docs says that TextField widget has a function for tapping outside:

onTapOutside → TapRegionCallback?
Called for each tap that occurs outside of the TextFieldTapRegion group when the text field is focused.

This property does not show among the available properties on the TextField in my app; Flutter 3.3.10 • channel stable

Code looks something like this:

```<code>class Filters extends StatelessWidget {
  const Filters({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 12),
      child: OutlinedButton.icon(
        .
        .
        onPressed: () => {
          showDialog(
            context: context,
            builder: (_) {
              return Dialog(
                child: SingleChildScrollView(
                  child: GestureDetector(
                    onTap: () => log("parent"),
                    child: AbsorbPointer(
                      child: Container(
                        .
                        .
                        child: Column(
                          children: [
                            .
                            .
                            TextField(
                              controller: textEditingController,
                              focusNode: focusNode,
                              onTap: () {
                                log("textField..............");
                              },
                              .
                              .
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              );
            },
          ),
        },
      ),
    );
  }
}
</code>```

Body:
I have a TextField widget inside a Container and want to be able to tap on the TextField without the tap propagating to the parent (the Container). I also want to unfocus the TextField when tapping outside it. To achieve that I have wrapped the Container with an AbsorbPointer widget inside a GestureDetector. The problem is that this makes all taps go to the Container and I lose the ability to interact with the TextField.

How to stop event propagation from the TextField to the Container?

Edit: Futter docs says that TextField widget has a function for tapping outside:

onTapOutside → TapRegionCallback?
Called for each tap that occurs outside of the TextFieldTapRegion group when the text field is focused.

This property does not show among the available properties on the TextField in my app; Flutter 3.3.10 • channel stable

Code looks something like this:

class Filters extends StatelessWidget {
  const Filters({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 12),
      child: OutlinedButton.icon(
        .
        .
        onPressed: () => {
          showDialog(
            context: context,
            builder: (_) {
              return Dialog(
                child: SingleChildScrollView(
                  child: GestureDetector(
                    onTap: () => log("parent"),
                    child: AbsorbPointer(
                      child: Container(
                        .
                        .
                        child: Column(
                          children: [
                            .
                            .
                            TextField(
                              controller: textEditingController,
                              focusNode: focusNode,
                              onTap: () {
                                log("textField..............");
                              },
                              .
                              .
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              );
            },
          ),
        },
      ),
    );
  }
}


问:
XBee end node reads same IO sample always for rotary angle sensor
I have 3 XBee SMT Grove Development Boards. I configured two of them as coordinator and endnode respectively. Note that the end node is not connected to any intelligent computer via its serial interface. It is simply powered on and is configured to read an analog sample at regular intervals and transmit it to the coordinator.

My intension is to connect an analog sensor (example: Rotary angle sensor) and transmit the knob position at regular intervals to the coordinator (using the IO data sample indicator frame).

I connected the sensor to the AD3 slot of the end node. And end node reads a sample of data and successfully sends this value to the coordinator at regular intervals. However I noticed that for a position of approximately 0-150 degrees, the IO sample value as received at the coordinator seems to be (21-1023). Meaning, the value changes according to the knob position. But when I move the knob position further (the supported rotation range by the sensor is 0-300 degrees), from 150-300 degrees, I notice the value always remains constant(1023).

I know that 2 bytes of analog samples can be transmitted via this frame. And the IO sample of the sensor is also 2 bytes. So I am wondering why the value remains the same for half the position of the rotary where as for the first half it changes as expected ?
Please note that the sensor is already tested on a Grove Pi+ shield on a Raspberry Pi for correctness using the example code. It works perfectly throughout the whole range.

Thank you all for your time.


问:
What are the hex colors for Android 12?
I cannot find the hex colors of Android 12 anywhere.

I have tried googling "Android 12 colors", "Android 12 color palette", "Android 12 Hex Colors", but the search results don't return any hex values.

I found this Stackoverflow answer that has the system values:

```<code>system_accent1_0
system_accent1_10
system_accent1_50

@android:color/system_accent1_0

Also requires min api 31 to use
</code>```

But I don't know how to get the exact hex values from them.

How to use new Material You colors announced for Android 12

I have also tried the google material site, but they don't have the colors either.

https://m3.material.io/styles/color/overview

https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors

Does anyone know of a webpage that has the exact hex colors?

Title: What are the hex colors for Android 12?

Body:
I cannot find the hex colors of Android 12 anywhere.

I have tried googling "Android 12 colors", "Android 12 color palette", "Android 12 Hex Colors", but the search results don't return any hex values.

I found this Stackoverflow answer that has the system values:

system_accent1_0
system_accent1_10
system_accent1_50

@android:color/system_accent1_0

Also requires min api 31 to use

But I don't know how to get the exact hex values from them.

How to use new Material You colors announced for Android 12

I have also tried the google material site, but they don't have the colors either.

https://m3.material.io/styles/color/overview

https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors

Does anyone know of a webpage that has the exact hex colors?


问:
incompatible types: java.sql.Statement cannot be converted to java.beans.Statement
I am trying to make a ATM Project in Net beans but I am stack here.

```<code>Connection con = null;
        PreparedStatement pst = null;
        ResultSet rs = null;
         Statement st = null;
        if (accNumField.getText().isEmpty() || pinField.getText().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Please fill in the Fields");

        }else{

            try {
                con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bankmanagement", "root", "");
                String query = "Select from * clients where AccNum='"+accNumField.getText()+"' and PIN="+pinField.getText()+"";
                **st = con.createStatement();
                rs= st.executeQuery(query); **
                if(rs.next()){
                    new MainMenu().setVisible(true);
                    this.dispose();
                }else{

                }
            } catch (Exception e) {
</code>```

enter image description hereCan someone help me where is the problem in my code?
I am trying to get access in the database and authentication the user in my bank.
Thanks for your time

Body:
I am trying to make a ATM Project in Net beans but I am stack here.

Connection con = null;
        PreparedStatement pst = null;
        ResultSet rs = null;
         Statement st = null;
        if (accNumField.getText().isEmpty() || pinField.getText().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Please fill in the Fields");

        }else{

            try {
                con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bankmanagement", "root", "");
                String query = "Select from * clients where AccNum='"+accNumField.getText()+"' and PIN="+pinField.getText()+"";
                **st = con.createStatement();
                rs= st.executeQuery(query); **
                if(rs.next()){
                    new MainMenu().setVisible(true);
                    this.dispose();
                }else{

                }
            } catch (Exception e) {

enter image description hereCan someone help me where is the problem in my code?
I am trying to get access in the database and authentication the user in my bank.
Thanks for your time


问:
in multithread program does bt a coredump always gives the culprit thread?
this is a little bit general question,
I have a segfault in a multithreaded program, and bt coredump shows below,

```<code>(gdb) bt full
#0  0x0000000000441540 in try_dequeue<std::shared_ptr<Frame> > (item=<synthetic pointer>, this=0xbe3c50) at /root/projects/active/user/include/third_party/concurrentqueue.h:1111
        nonEmptyCount = 0
        best = 0x0
        bestSize = 0
#1  ConsumerNice::listening_nice (this=0xbe3c40) at /root/projects/active/user/include/concurrency/consumer_nice.h:45
        frame = std::shared_ptr (empty) 0x0
#2  0x00000000004c0530 in execute_native_thread_routine ()
No symbol table info available.
#3  0x00007f3eb3f81e65 in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#4  0x00007f3ead70a88d in clone () from /lib64/libc.so.6
No symbol table info available.
</code>```

So I go to look at the source code,
my code as below

```<code> void listening_nice() {
        while (true) {
            std::shared_ptr<Frame> frame;
            if (nice_queue.try_dequeue(frame)) {
                on_frame_nice(frame);
            }
        }
    }
</code>```

and cameron314/concurrentqueue part look like below,

```<code>bool try_dequeue(U& item)
    {
        // Instead of simply trying each producer in turn (which could cause needless contention on the first
        // producer), we score them heuristically.
        size_t nonEmptyCount = 0;
        ProducerBase* best = nullptr;
        size_t bestSize = 0;
        for (auto ptr = producerListTail.load(std::memory_order_acquire); nonEmptyCount < 3 && ptr != nullptr; ptr = ptr->next_prod()) {
            auto size = ptr->size_approx();
            if (size > 0) {
                if (size > bestSize) {
                    bestSize = size;
                    best = ptr;
                }
                ++nonEmptyCount;
            }
        }
</code>```

It doesnt seem possible to cause segfault, therefore I am wondering, is bt always show the culprit thread? or there is a chance segfault is caused by some other problem in some other thread, or even the operating system?

Noted this program is running on 3 same configured machine, but only one machine crashes once a day, that is it runs for 3 straight hours on that one machine, then crashed.

Body:
this is a little bit general question,
I have a segfault in a multithreaded program, and bt coredump shows below,

(gdb) bt full
#0  0x0000000000441540 in try_dequeue<std::shared_ptr<Frame> > (item=<synthetic pointer>, this=0xbe3c50) at /root/projects/active/user/include/third_party/concurrentqueue.h:1111
        nonEmptyCount = 0
        best = 0x0
        bestSize = 0
#1  ConsumerNice::listening_nice (this=0xbe3c40) at /root/projects/active/user/include/concurrency/consumer_nice.h:45
        frame = std::shared_ptr (empty) 0x0
#2  0x00000000004c0530 in execute_native_thread_routine ()
No symbol table info available.
#3  0x00007f3eb3f81e65 in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#4  0x00007f3ead70a88d in clone () from /lib64/libc.so.6
No symbol table info available.

So I go to look at the source code,
my code as below

 void listening_nice() {
        while (true) {
            std::shared_ptr<Frame> frame;
            if (nice_queue.try_dequeue(frame)) {
                on_frame_nice(frame);
            }
        }
    }

and cameron314/concurrentqueue part look like below,

bool try_dequeue(U& item)
    {
        // Instead of simply trying each producer in turn (which could cause needless contention on the first
        // producer), we score them heuristically.
        size_t nonEmptyCount = 0;
        ProducerBase* best = nullptr;
        size_t bestSize = 0;
        for (auto ptr = producerListTail.load(std::memory_order_acquire); nonEmptyCount < 3 && ptr != nullptr; ptr = ptr->next_prod()) {
            auto size = ptr->size_approx();
            if (size > 0) {
                if (size > bestSize) {
                    bestSize = size;
                    best = ptr;
                }
                ++nonEmptyCount;
            }
        }

It doesnt seem possible to cause segfault, therefore I am wondering, is bt always show the culprit thread? or there is a chance segfault is caused by some other problem in some other thread, or even the operating system?

Noted this program is running on 3 same configured machine, but only one machine crashes once a day, that is it runs for 3 straight hours on that one machine, then crashed.


问:
MATLAB - integral function vectorization warning
When trying to use the integral2 function, I get the following warning:

"Integrand function outputs did not match to the required tolerance when the same input values were supplied in two separate calls with different size input matrices. Check that the function is vectorized properly."

My code is:

```<code>z1=0; z2=5;
t1=0; t2=10;

a=1:500;
b=linspace(0.15,0.02,length(a));
c=[a;b];
d=4.9e-07;

func = @(z,t) my_func((z + t),c) .* exp(-d.*t);

int_x = integral2(func,z1,z2,t1,t2,'RelTol',1e-3,'AbsTol',1e-3) ./ (z2 - z1);
</code>```

my_func is:

```<code>function out = my_func(z_in,c)

z=reshape(z_in,1,numel(z_in));

for i=1:length(z)
  if (z(i)<0.0)
    z(i)=0.0;
  end
end

expfactor=exp(-z/150);

sB=5.5*0.9*4*expfactor;

mB=0.9*interpolate(c(1,:),c(2,:),z);

out=sB+mB;

out=reshape(out,size(z_in,1),size(z_in,2));

end
</code>```

z1=0, z2=9.6, t1=0, t2=3000 (i.e. all have the size (1,1)), and I have used element-wise operations, so not sure what the problem is.

When debugging, my_func is called three times, with z and t having different sizes each time (although same as each other; (14,14), (2,3) and (14,14)). When sizes are (14,14), the values of z are unique for each column, but the same for each row (e.g. [3,2,1;3,2,1]), and vice versa for t (e.g. [4,4,4;5,5,5]). But when sizes are (2,3), all values in the z and t matrices are unique. The warning comes after the second and third call.

What could be the reasons for the warning?

Edit: to accommodate the dimension requirements in my_func, I've reshaped z to a vector at the start, then reshaped the output back to matrix at the end, copying a similar function I've seen. But this returns the warning:
"Non-finite result. The integration was unsuccessful. Singularity likely."

Thanks

Body:
When trying to use the integral2 function, I get the following warning:

"Integrand function outputs did not match to the required tolerance when the same input values were supplied in two separate calls with different size input matrices. Check that the function is vectorized properly."

My code is:

z1=0; z2=5;
t1=0; t2=10;

a=1:500;
b=linspace(0.15,0.02,length(a));
c=[a;b];
d=4.9e-07;

func = @(z,t) my_func((z + t),c) .* exp(-d.*t);

int_x = integral2(func,z1,z2,t1,t2,'RelTol',1e-3,'AbsTol',1e-3) ./ (z2 - z1);

my_func is:

function out = my_func(z_in,c)

z=reshape(z_in,1,numel(z_in));

for i=1:length(z)
  if (z(i)<0.0)
    z(i)=0.0;
  end
end

expfactor=exp(-z/150);

sB=5.5*0.9*4*expfactor;

mB=0.9*interpolate(c(1,:),c(2,:),z);

out=sB+mB;

out=reshape(out,size(z_in,1),size(z_in,2));

end

z1=0, z2=9.6, t1=0, t2=3000 (i.e. all have the size (1,1)), and I have used element-wise operations, so not sure what the problem is.

When debugging, my_func is called three times, with z and t having different sizes each time (although same as each other; (14,14), (2,3) and (14,14)). When sizes are (14,14), the values of z are unique for each column, but the same for each row (e.g. [3,2,1;3,2,1]), and vice versa for t (e.g. [4,4,4;5,5,5]). But when sizes are (2,3), all values in the z and t matrices are unique. The warning comes after the second and third call.

What could be the reasons for the warning?

Edit: to accommodate the dimension requirements in my_func, I've reshaped z to a vector at the start, then reshaped the output back to matrix at the end, copying a similar function I've seen. But this returns the warning:
"Non-finite result. The integration was unsuccessful. Singularity likely."

Thanks


问:
How to find out which picture was sent by the telebot
I need to compare the image from the computer with the image that my telegram bot sent.

I need to compare them in order to insert a link with a description for a certain picture

I'm trying:

```<code>if p4 == message.photo
</code>```

but I can't do anything because message.photo = None. Which value exactly do I need to compare?

```<code>p4 = open("img/1 (1).jpg")
    time.sleep(1)
    if p4 == message.photo:
        print(10)
        bot.send_photo(message.chat.id, p4)
</code>```

print(10) - аcts as a link for now

Body:
I need to compare the image from the computer with the image that my telegram bot sent.

I need to compare them in order to insert a link with a description for a certain picture

I'm trying:

if p4 == message.photo

but I can't do anything because message.photo = None. Which value exactly do I need to compare?

p4 = open("img/1 (1).jpg")
    time.sleep(1)
    if p4 == message.photo:
        print(10)
        bot.send_photo(message.chat.id, p4)

print(10) - аcts as a link for now


问:
Uncaught (in promise) CompileError: wasm validation error: at offset 4: failed to match magic number. simple wasm app with javaScript
my  index.html as:

```<code><html>
  <body>
    <h1>WebAssembly Addition App</h1>
    <p>Result: <span id="result">0</span></p>
    <button onclick="add()">Add 1 + 2</button>
    <script src="add.js"></script>
  </body>
</html>
</code>```

then add.js as:

```<code>async function add() {
  // Load the wasm module
  const wasmModule = await WebAssembly.compileStreaming(fetch('add.wasm'));
  const wasmInstance = await WebAssembly.instantiate(wasmModule);

  // Call the "add" function in the wasm module
  const result = wasmInstance.exports.add(1, 2);

  // Update the result on the page
  document.getElementById('result').textContent = result;
}
</code>```

also my add.wasm as:

```<code>(module
  (func $add (param $x i32) (param $y i32) (result i32)
    (i32.add (get_local $x) (get_local $y)))
  (export "add" (func $add)))
</code>```

Now, I run npx http-server in the same folder of all those files. got this error message visiting the localhost index page

```<code>add.js:11 Uncaught (in promise) CompileError: WebAssembly.compileStreaming(): expected magic word 00 61 73 6d, found 28 6d 6f 64 @+0
await (async)
onclick @ (index):5
</code>```

What should I do to solve it?

trying to get mini wasm working with javaScript in the browser with localhost.

Body:
my  index.html as:

WebAssembly Addition App

Result: 0

    <button onclick="add()">Add 1 + 2</button>

then add.js as:

async function add() {
  // Load the wasm module
  const wasmModule = await WebAssembly.compileStreaming(fetch('add.wasm'));
  const wasmInstance = await WebAssembly.instantiate(wasmModule);

  // Call the "add" function in the wasm module
  const result = wasmInstance.exports.add(1, 2);

  // Update the result on the page
  document.getElementById('result').textContent = result;
}

also my add.wasm as:

(module
  (func $add (param $x i32) (param $y i32) (result i32)
    (i32.add (get_local $x) (get_local $y)))
  (export "add" (func $add)))

Now, I run npx http-server in the same folder of all those files. got this error message visiting the localhost index page

add.js:11 Uncaught (in promise) CompileError: WebAssembly.compileStreaming(): expected magic word 00 61 73 6d, found 28 6d 6f 64 @+0
await (async)
onclick @ (index):5

What should I do to solve it?

trying to get mini wasm working with javaScript in the browser with localhost.


问:
WooCommerce: Change required field notice from asterisk to different messaging
I'm trying to make my clients checkout more accessible and one thing I want to do is remove the asterisk representing required fields to say the word 'Required Field' instead. I know this code in the wc-template-functions.php file creates the required field:

```<code>if ( $args['required'] ) {
        $args['class'][] = 'validate-required';
        $required        = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
    } else {
        $required = ' <span class="optional">(' . esc_html__( 'optional', 'woocommerce' ) . ')</span>';
    }
</code>```

That's all good but I can't just tweak that script directly in Woo. I want to create a function to change that message, but can't find a script anywhere to do it. How can I change that message?

Body:
I'm trying to make my clients checkout more accessible and one thing I want to do is remove the asterisk representing required fields to say the word 'Required Field' instead. I know this code in the wc-template-functions.php file creates the required field:

if ( $args['required'] ) {
        $args['class'][] = 'validate-required';
        $required        = ' *';
    } else {
        $required = ' (' . esc_html__( 'optional', 'woocommerce' ) . ')';
    }

That's all good but I can't just tweak that script directly in Woo. I want to create a function to change that message, but can't find a script anywhere to do it. How can I change that message?


问:
Lookup columns don't appear in Interactive Report for Oracle APEX 22.2
I have been doing the Oracle APEX workshop to make a shopping cart. The thing is that when I have to add the Manage Products page with an Interactive Report, the lookup columns do not appear as selectable options. Do you know if there is an alternative or a way to fix this?

This is the only thing that appears to me


问:
Django NoReverseMatch at /account/register/
I am new in Django, trying to get an activation email but can't figure out what's the problem.

Reverse for 'activate' with keyword arguments '{'uidb64': 'MTU', 'token': 'bhp5py-6f0679ec02bc2863df780ea30d2984da'}' not found. 1 pattern(s) tried: ['account/activate/(?P[-a-zA-Z0-9_]+)/(?P[-a-zA-Z0-9_]+)\Z']

views.py

```<code>def account_register(request):

    if request.method == 'POST':
        registraionForm = RegistraionForm(request.POST)
        if registraionForm.is_valid():
            user = registraionForm.save(commit=False)
            user.email = registraionForm.cleaned_data['email']
            user.set_password(registraionForm.cleaned_data['password'])
            user.is_active = False
            user.save()

            # setup email
            current_site = get_current_site(request)
            subject = 'Activate your account'
            message = render_to_string('account/registration/account_activation_email.html',{
                'user': user,
                'domain':current_site.domain,
                'uid': urlsafe_base64_encode(force_bytes(user.pk)),
                'token':account_activation_token.make_token(user),
            })
            user.email_user(subject=subject, message=message)
            return HttpResponse('Successful')
    else:
        registraionForm = RegistraionForm()
    return render(request, 'account/registration/register.html', {'form':registraionForm})

def account_activate(request, uidb64, token):
    try:
        uid = force_text(urlsafe_base64_decode(uidb64))
        user = UserBase.objects.get(pk=uid)
    except:
        pass
    if user is not None and account_activation_token.check_token(user, token):
        user.is_active = True
        user.save()
        login(request, user)
        return redirect('account:dashboard')
    else:
        return render(request, 'account/registraion/activation_invalid.html')
</code>```

urls.py

```<code>from django.urls import path
from . import views

app_name = 'account'

urlpatterns = [
    path('register/', views.account_register, name='register'),
    path('activate/<slug:uid64>/<slug:token>', views.account_activate, name='activate'),

    path('dashboard/', views.account_dashboard, name='dashboard'),

]
</code>```

token.py

```<code>from django.contrib.auth.tokens import PasswordResetTokenGenerator
from six import text_type

class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
    def _make_hash_value(self, user, timestamp):
        return (
            text_type(user.pk) + text_type(timestamp) + text_type(user.is_active)
        )

account_activation_token = AccountActivationTokenGenerator()
</code>```

html

```<code>{% autoescape off %}
Hi {{ user.user_name }},

Your account has successfully created. Please click below link to activate your account

http://{{ domain }}{% url 'account:activate' uidb64=uid token=token %}
{% endautoescape %}
</code>```

Body:
I am new in Django, trying to get an activation email but can't figure out what's the problem.

Reverse for 'activate' with keyword arguments '{'uidb64': 'MTU', 'token': 'bhp5py-6f0679ec02bc2863df780ea30d2984da'}' not found. 1 pattern(s) tried: ['account/activate/(?P[-a-zA-Z0-9_]+)/(?P[-a-zA-Z0-9_]+)\Z']

views.py

def account_register(request):

    if request.method == 'POST':
        registraionForm = RegistraionForm(request.POST)
        if registraionForm.is_valid():
            user = registraionForm.save(commit=False)
            user.email = registraionForm.cleaned_data['email']
            user.set_password(registraionForm.cleaned_data['password'])
            user.is_active = False
            user.save()

            # setup email
            current_site = get_current_site(request)
            subject = 'Activate your account'
            message = render_to_string('account/registration/account_activation_email.html',{
                'user': user,
                'domain':current_site.domain,
                'uid': urlsafe_base64_encode(force_bytes(user.pk)),
                'token':account_activation_token.make_token(user),
            })
            user.email_user(subject=subject, message=message)
            return HttpResponse('Successful')
    else:
        registraionForm = RegistraionForm()
    return render(request, 'account/registration/register.html', {'form':registraionForm})

def account_activate(request, uidb64, token):
    try:
        uid = force_text(urlsafe_base64_decode(uidb64))
        user = UserBase.objects.get(pk=uid)
    except:
        pass
    if user is not None and account_activation_token.check_token(user, token):
        user.is_active = True
        user.save()
        login(request, user)
        return redirect('account:dashboard')
    else:
        return render(request, 'account/registraion/activation_invalid.html')

urls.py

from django.urls import path
from . import views

app_name = 'account'

urlpatterns = [
    path('register/', views.account_register, name='register'),
    path('activate/<slug:uid64>/<slug:token>', views.account_activate, name='activate'),

    path('dashboard/', views.account_dashboard, name='dashboard'),

]

token.py

from django.contrib.auth.tokens import PasswordResetTokenGenerator
from six import text_type

class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
    def _make_hash_value(self, user, timestamp):
        return (
            text_type(user.pk) + text_type(timestamp) + text_type(user.is_active)
        )

account_activation_token = AccountActivationTokenGenerator()

html

{% autoescape off %}
Hi {{ user.user_name }},

Your account has successfully created. Please click below link to activate your account

http://{{ domain }}{% url 'account:activate' uidb64=uid token=token %}
{% endautoescape %}


问:
Collisions in Tiled
Can we make Tiled Layer Collisions work in a game based on Tiled Tile Layers rather than Tiled Object Layers?

Tried:

```<code>for object in self.map.tmxdata.objects:
            if object.name == 'Collision':
                Obstacle(self, object.x, object.y,
                         object.width, object.height)
</code>```

Expecting:

```<code>for object in self.map.tmxdata.get_layer_by_name:
            if object == 'Collision':
                Obstacle(self, object.x, object.y,
                         object.width, object.height)
</code>```

Title: Collisions in Tiled

Body:
Can we make Tiled Layer Collisions work in a game based on Tiled Tile Layers rather than Tiled Object Layers?

Tried:

for object in self.map.tmxdata.objects:
            if object.name == 'Collision':
                Obstacle(self, object.x, object.y,
                         object.width, object.height)

Expecting:

for object in self.map.tmxdata.get_layer_by_name:
            if object == 'Collision':
                Obstacle(self, object.x, object.y,
                         object.width, object.height)


问:
How use genererics in interface
How can I implement a general interface with generics

e.g. I try it

type input interface {
    models.InputUser | models.InputAdmin
}

type output interface {
    models.OutputUser | models.OutputAdmin
}

type useCase[i input, o output] interface {
    Create(i) error
    Get() o
    Update(i) error
}

type User interface {
    useCase
}

type Admin interface {
    useCase
    GetAll() models.OutputAdmin
    Delete(models.InputAdmin) error
}
```

but got it

cannot use generic type useCase[i input, o output] without instantiation

Title: How use genererics in interface

Body:
How can I implement a general interface with generics

e.g. I try it

type input interface {
    models.InputUser | models.InputAdmin
}

type output interface {
    models.OutputUser | models.OutputAdmin
}

type useCase[i input, o output] interface {
    Create(i) error
    Get() o
    Update(i) error
}

type User interface {
    useCase
}

type Admin interface {
    useCase
    GetAll() models.OutputAdmin
    Delete(models.InputAdmin) error
}

but got it

cannot use generic type useCase[i input, o output] without instantiation


问:
Angular-based website auto return to 1st page after some time
My website was developed using Angular v13 and Apache Httpd server. I'm observing that it auto-redirects to 1st visited URL after some time.

E.g: First, I land on the home page, then browse to other pages randomly. After some time, around 15 minutes, the website auto-redirects me to the homepage.

Obviously, this isn't the behavior I expected. Does anyone know what is the culprit here?

I really appreciate any help you can provide.


问:
With angus-activation 1.0 (Jakarta Activation 2.x) where exactly is the API implementation?
I am trying to migrate jakarta.activation from com.sun.activation:jakarta.activation (contains both API implementation and com.sun.registries/) to the "official" Eclipse angus-activation.

How is this supposed to work exactly? When I replace the jar with angus-activation 1.0.0 there is the registries implementation
https://github.com/eclipse-ee4j/angus-activation/tree/master/activation-registry

...but... there doesn't seem to be an API implementation. I understand that we should NOT include jakarta.activation-api artifact as that is compile only.

angus-activation here: https://mvnrepository.com/artifact/org.eclipse.angus/angus-activation

Oracle's implementaton: jakarta.activation here: https://mvnrepository.com/artifact/com.sun.activation/jakarta.activation

The Oracle jakarta.activation-2.0.1.jar contains more classes than Eclipse angus-activation-1.0.0.jar.

The compile-time artifact here:  https://mvnrepository.com/artifact/jakarta.activation/jakarta.activation-api


问:
How are adapters used in django-allauth?
Hi everyone this is my first post on StackOverflow.

I'm building a web application using Django and I would like to:

Only allow people that have a Google account to sign up / log in

Only people with a specific email domain can access the web app and their UserModel will be saved to the database.

I started with coding a middleware, and it worked, I managed to log out those that tried to log in with a Google account associated with a not allowed email BUT they were saved in the database User model.

I then found out about Adapters (for django-allauth) and I saw I could use them to achieve my goals but in the documentation, they are only cited once.

I then started looking at the GitHub repo and found some more info but I'm still not able to implement this myself.

Can anyone help me?

Btw this is my code so far:

Disclaimer:

This code does not work, it's not even called when I try to test it. ( I tried to log in with a wrong Google account to see it it gets triggered but nothing appened)

main_app/adapters.py

```<code>

from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.account.adapter import DefaultAccountAdapter

class DisableSignupAdapter(DefaultAccountAdapter):
    def is_open_for_signup(self, request):
        return False

class UgaSocialAccountAdapter(DefaultSocialAccountAdapter):

    def pre_social_login(self, request, sociallogin):
        # abort if email does not end with @uga.com
        if not sociallogin.user.email.endswith("@uga.com"):
            print("Email domain must be uga.com")
            raise PermissionError("Email domain must be jeupo.com")
        else:
            print("Email domain is uga.com")
            return super().pre_social_login(request, sociallogin)

    def is_open_for_signup(self, request, sociallogin):
        return True
</code>```

settings.py

```<code>
DEFAULT_ACCOUNT_ADAPTER = 'main_app.adapter.DisableSignupAdapter'
DEFAULT_SOCIALACCOUNT_ADAPTER = 'main_app.adapter.UgaSocialAccountAdapter'
</code>```

Things I tried:

Middleware -> Was a good try but still saved wrong users to the database

Adapters -> Does not even get called :/

Body:
Hi everyone this is my first post on StackOverflow.

I'm building a web application using Django and I would like to:

Only allow people that have a Google account to sign up / log in

Only people with a specific email domain can access the web app and their UserModel will be saved to the database.

I started with coding a middleware, and it worked, I managed to log out those that tried to log in with a Google account associated with a not allowed email BUT they were saved in the database User model.

I then found out about Adapters (for django-allauth) and I saw I could use them to achieve my goals but in the documentation, they are only cited once.

I then started looking at the GitHub repo and found some more info but I'm still not able to implement this myself.

Can anyone help me?

Btw this is my code so far:

Disclaimer:

This code does not work, it's not even called when I try to test it. ( I tried to log in with a wrong Google account to see it it gets triggered but nothing appened)

main_app/adapters.py

from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.account.adapter import DefaultAccountAdapter

class DisableSignupAdapter(DefaultAccountAdapter):
    def is_open_for_signup(self, request):
        return False

class UgaSocialAccountAdapter(DefaultSocialAccountAdapter):

    def pre_social_login(self, request, sociallogin):
        # abort if email does not end with @uga.com
        if not sociallogin.user.email.endswith("@uga.com"):
            print("Email domain must be uga.com")
            raise PermissionError("Email domain must be jeupo.com")
        else:
            print("Email domain is uga.com")
            return super().pre_social_login(request, sociallogin)

    def is_open_for_signup(self, request, sociallogin):
        return True

settings.py

DEFAULT_ACCOUNT_ADAPTER = 'main_app.adapter.DisableSignupAdapter'
DEFAULT_SOCIALACCOUNT_ADAPTER = 'main_app.adapter.UgaSocialAccountAdapter'

Things I tried:

Middleware -> Was a good try but still saved wrong users to the database

Adapters -> Does not even get called :/


问:
Quorum monitoring (Cloud Blob monitoring) in WSFC cluster configuration causes name resolution error
I have a Windows server on Azure with domain not joined (WORKGROUP) in a WSFC cluster and I have configured Quorum monitoring for Cloud monitoring (Blob monitoring), but I get an error.
Error: WinRM client cannot resolve server name

Please let me know if you know the cause of the error and how to resolve it.


问:
Can I add a WPF window into a project that is currently using Winforms?
My company is in the process of updating an ancient piece of software from VB6 to c#. We used a conversion tool that converted a lot of our code to use Winforms. We are looking to update the UI to use WPF and want to go through that process slowly. Outside of just rewriting everything from scratch in a new WPF project, can I create WPF windows in the existing winforms project? I feel that would be the simplest way to go through and update the UI in various screens.</p>


问:
How to implement jwt best practice in spring boot?
I have implemented jwt in spring boot using filter as below.

I am wondering why I always get user details from DB with the code

UserDetails userDetails = userDetailsService.loadUserByUsername(username);

Because, this effects performance issue.

I want to understand implementing jwt authentication in spring boot.

JWTAuthenticationFilter

```<code>@Component
public class JWTAuthenticationFilter extends OncePerRequestFilter {

    @Autowired
    private JwtProvider tokenProvider;

    @Autowired
    private UserDetailsService userDetailsService;

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {

 try{
 String authHeader = request.getHeader("Authorization");
String jwt = authHeader.substring(7);

  String username = tokenProvider.getUsernameFromJWT(jwt);
 UserDetails userDetails = userDetailsService.loadUserByUsername(username);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
                        userDetails, null, userDetails.getAuthorities());

authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
                SecurityContextHolder.getContext().setAuthentication(authentication);

  } catch (Exception ex) {
           ex.fillInStackTrace() ;

        }

   filterChain.doFilter(request, response);
    }
}
</code>```

Body:
I have implemented jwt in spring boot using filter as below.

I am wondering why I always get user details from DB with the code

UserDetails userDetails = userDetailsService.loadUserByUsername(username);

Because, this effects performance issue.

I want to understand implementing jwt authentication in spring boot.

JWTAuthenticationFilter

@Component
public class JWTAuthenticationFilter extends OncePerRequestFilter {

    @Autowired
    private JwtProvider tokenProvider;

    @Autowired
    private UserDetailsService userDetailsService;

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {

 try{
 String authHeader = request.getHeader("Authorization");
String jwt = authHeader.substring(7);

  String username = tokenProvider.getUsernameFromJWT(jwt);
 UserDetails userDetails = userDetailsService.loadUserByUsername(username);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
                        userDetails, null, userDetails.getAuthorities());

authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
                SecurityContextHolder.getContext().setAuthentication(authentication);

  } catch (Exception ex) {
           ex.fillInStackTrace() ;

        }

   filterChain.doFilter(request, response);
    }
}


问:
How to fix a misaligned forest plot for hazard ratio with forester package
I'm attempting to generate a forest plot using the Forester package to visualize the stratified hazard ratio. Despite following the instructions in the package guide, I am experiencing issues with proper alignment when only selecting a few variables for the plot.

As an example, when I only include gender and age, the plot is misaligned, as shown in the attached image.

```<code>library(grid)
library(forestploter)

# Read provided sample example data
dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter"))

# Keep needed columns
dt <- dt[,1:6]

# indent the subgroup if there is a number in the placebo column
dt$Subgroup <- ifelse(is.na(dt$Placebo),
                      dt$Subgroup,
                      paste0("   ", dt$Subgroup))

# NA to blank or NA will be transformed to carachter.
dt$Treatment <- ifelse(is.na(dt$Treatment), "", dt$Treatment)
dt$Placebo <- ifelse(is.na(dt$Placebo), "", dt$Placebo)
dt$se <- (log(dt$hi) - log(dt$est))/1.96

# Add blank column for the forest plot to display CI.
# Adjust the column width with space.
dt$` ` <- paste(rep(" ", 20), collapse = " ")

# Create confidence interval column to display
dt$`HR (95% CI)` <- ifelse(is.na(dt$se), "",
                             sprintf("%.2f (%.2f to %.2f)",
                                     dt$est, dt$low, dt$hi))
head(dt)
</code>```

The plot is missalligned when I chose only two variables

```<code>p <- forest(dt[c(2:7),c(1:3, 8:9)],
            est = dt$est,
            lower = dt$low,
            upper = dt$hi,
            sizes = 1,
            ci_column = 4,
            ref_line = 1,
            arrow_lab = c("Placebo Better", "Treatment Better"),
            xlim = c(0, 4),
            ticks_at = c(0.5, 1, 2, 3),
            footnote = "This is the demo data. Please feel free to change\nanything you want.")

# Print plot
plot(p)

</code>```

resulting in this :

Is there a way to specify certain variables for the plot while preserving proper alignment?"

Body:
I'm attempting to generate a forest plot using the Forester package to visualize the stratified hazard ratio. Despite following the instructions in the package guide, I am experiencing issues with proper alignment when only selecting a few variables for the plot.

As an example, when I only include gender and age, the plot is misaligned, as shown in the attached image.

library(grid)
library(forestploter)

# Read provided sample example data
dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter"))

# Keep needed columns
dt <- dt[,1:6]

# indent the subgroup if there is a number in the placebo column
dt$Subgroup <- ifelse(is.na(dt$Placebo),
                      dt$Subgroup,
                      paste0("   ", dt$Subgroup))

# NA to blank or NA will be transformed to carachter.
dt$Treatment <- ifelse(is.na(dt$Treatment), "", dt$Treatment)
dt$Placebo <- ifelse(is.na(dt$Placebo), "", dt$Placebo)
dt$se <- (log(dt$hi) - log(dt$est))/1.96

# Add blank column for the forest plot to display CI.
# Adjust the column width with space.
dt$` ` <- paste(rep(" ", 20), collapse = " ")

# Create confidence interval column to display
dt$`HR (95% CI)` <- ifelse(is.na(dt$se), "",
                             sprintf("%.2f (%.2f to %.2f)",
                                     dt$est, dt$low, dt$hi))
head(dt)

The plot is missalligned when I chose only two variables

p <- forest(dt[c(2:7),c(1:3, 8:9)],
            est = dt$est,
            lower = dt$low,
            upper = dt$hi,
            sizes = 1,
            ci_column = 4,
            ref_line = 1,
            arrow_lab = c("Placebo Better", "Treatment Better"),
            xlim = c(0, 4),
            ticks_at = c(0.5, 1, 2, 3),
            footnote = "This is the demo data. Please feel free to change\nanything you want.")

# Print plot
plot(p)

resulting in this :

Is there a way to specify certain variables for the plot while preserving proper alignment?"


问:
watchOS Complications: How to add context-based deep-links?
I want to create complications that when tapped open the watch app to a specific section in the app. I am using CloudKit and CLKComplicationDataSource.
Apple documentation even recommends deep-linking, but I haven't been able to find out how to do this. There is another similar question but no correct answer.

Note: I need to support watchOS versions below 9, so I cannot use widgetKit and I must use ClockKit (in case that makes a difference)

Here is what Apple says:


问:
I need to calculate values but some values do not give numbers
```<code>switch ($mybb->input['action'])
 {
  case 'ranks':
    $ranks = '';
    $rank['image'] = htmlspecialchars_uni($rank['image']);
    $rank['name'] = htmlspecialchars_uni($rank['name']);
    $query = $db->simple_select('myachievements_ranks', '*', '', array('order_dir' => 'desc', 'order_by' => 'level'));
    while ($rank = $db->fetch_array($query))
    {
        $bgcolor = alt_trow();
        $required = '';
        $rank['image'] = htmlspecialchars_uni($rank['image']);
        $rank['name'] = htmlspecialchars_uni($rank['name']);
        $rank['description'] = nl2br(htmlspecialchars_uni($rank['description']));

        if ($rank['achievements_apid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_numposts', 'numposts,image,name,cat', 'apid='.intval($rank['achievements_apid']));
            $achievement = $db->fetch_array($query2);
            $achievement['numposts'] = ($mybb->user['postnum'] *100) /$achievement['numposts'] ;
            if ($achievement['numposts'] > 100)
            {
             $achievement['pneed'] = 100;
            }else{
             $achievement['pneed'] = $achievement['numposts'];
            }
            if (strlen($achievement['pneed']) > 4)
            $achievement['pneed'] = substr($achievement['pneed'], 0, 4);
            $required .= '<div class="rankprogress d-flex flex-row align-items-center overflow-hidden relative"><div class="profile-yos rounded ml-3 text-center flex-shrink-0 flex-grow-0 yos-'.htmlspecialchars_uni($achievement['cat']).'" data-toggle="tooltip" data-placement="top" title="" data-original-title="'.htmlspecialchars_uni($achievement['name']).'"><i class="far fa-'.htmlspecialchars_uni($achievement['image']).'"></i></div>'.htmlspecialchars_uni($achievement['pneed']).'%<div class="ggprogress" style="width: '.htmlspecialchars_uni($achievement['pneed']).'%;"></div></div>';
        }
        if ($rank['achievements_aaid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_activity', 'time,image,name,cat', 'aaid='.intval($rank['achievements_aaid']));
            $achievement = $db->fetch_array($query2);
            $achievement['time'] = ($mybb->user['timeonline'] *100) /$achievement['time'] ;
            if ($achievement['time'] > 100)
            {
             $achievement['ttneed'] = 100;
            }else{
             $achievement['ttneed'] = $achievement['time'];
            }
            if (strlen($achievement['ttneed']) > 4)
            $achievement['ttneed'] = substr($achievement['ttneed'], 0, 4);
            $required .= '<div class="rankprogress d-flex flex-row align-items-center overflow-hidden relative"><div class="profile-yos rounded ml-3 text-center flex-shrink-0 flex-grow-0 yos-'.htmlspecialchars_uni($achievement['cat']).'" data-toggle="tooltip" data-placement="top" title="" data-original-title="'.htmlspecialchars_uni($achievement['name']).'"><i class="far fa-'.htmlspecialchars_uni($achievement['image']).'"></i></div>'.htmlspecialchars_uni($achievement['ttneed']).'%<div class="ggprogress" style="width: '.htmlspecialchars_uni($achievement['ttneed']).'%;"></div></div>';
        }
        if ($rank['achievements_acid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_custom', 'image,name,cat', 'acid='.intval($rank['achievements_acid']));
            $achievement = $db->fetch_array($query2);
            $required .= '<div class="profile-yos rounded ml-3 text-center flex-shrink-0 flex-grow-0 yos-'.htmlspecialchars_uni($achievement['cat']).'" data-toggle="tooltip" data-placement="top" title="" data-original-title="'.htmlspecialchars_uni($achievement['name']).'"><i class="far fa-'.htmlspecialchars_uni($achievement['image']).'"></i></div>';
        }

        if ($rank['achievements_apoid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_points', 'points,image,name,cat', 'apoid='.intval($rank['achievements_apoid']));
            $achievement = $db->fetch_array($query2);
            $achievement['points'] = ($mybb->user['newpoints'] *100) /$achievement['points'] ;
            if ($achievement['points'] > 100)
            {
             $achievement['npneed'] = 100;
            }else{
             $achievement['npneed'] = $achievement['points'];
            }
            if (strlen($achievement['npneed']) > 4)
            $achievement['npneed'] = substr($achievement['npneed'], 0, 4);
            $required .= '<div class="rankprogress d-flex flex-row align-items-center overflow-hidden relative"><div class="profile-yos rounded ml-3 text-center flex-shrink-0 flex-grow-0 yos-'.htmlspecialchars_uni($achievement['cat']).'" data-toggle="tooltip" data-placement="top" title="" data-original-title="'.htmlspecialchars_uni($achievement['name']).'"><i class="far fa-'.htmlspecialchars_uni($achievement['image']).'"></i></div>'.htmlspecialchars_uni($achievement['npneed']).'%<div class="ggprogress" style="width: '.htmlspecialchars_uni($achievement['npneed']).'%;"></div></div>';
        }

    eval("\$myachievements = \"".$templates->get("myachievements_ranks")."\";");
break;

}
$totalprogress = ($achievement['pneed'] + $achievement['ttneed'] + $achievement['npneed']) /3;`
</code>```

I want to calculate following values

```<code>$totalprogress = ($achievement['pneed'] + $achievement['ttneed'] + $achievement['npneed']) /3;
</code>```

But whole variable is not giving values

Body:
switch ($mybb->input['action'])
 {
  case 'ranks':
    $ranks = '';
    $rank['image'] = htmlspecialchars_uni($rank['image']);
    $rank['name'] = htmlspecialchars_uni($rank['name']);
    $query = $db->simple_select('myachievements_ranks', '*', '', array('order_dir' => 'desc', 'order_by' => 'level'));
    while ($rank = $db->fetch_array($query))
    {
        $bgcolor = alt_trow();
        $required = '';
        $rank['image'] = htmlspecialchars_uni($rank['image']);
        $rank['name'] = htmlspecialchars_uni($rank['name']);
        $rank['description'] = nl2br(htmlspecialchars_uni($rank['description']));

        if ($rank['achievements_apid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_numposts', 'numposts,image,name,cat', 'apid='.intval($rank['achievements_apid']));
            $achievement = $db->fetch_array($query2);
            $achievement['numposts'] = ($mybb->user['postnum'] *100) /$achievement['numposts'] ;
            if ($achievement['numposts'] > 100)
            {
             $achievement['pneed'] = 100;
            }else{
             $achievement['pneed'] = $achievement['numposts'];
            }
            if (strlen($achievement['pneed']) > 4)
            $achievement['pneed'] = substr($achievement['pneed'], 0, 4);
            $required .= '

'.htmlspecialchars_uni($achievement['pneed']).'%

';
        }
        if ($rank['achievements_aaid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_activity', 'time,image,name,cat', 'aaid='.intval($rank['achievements_aaid']));
            $achievement = $db->fetch_array($query2);
            $achievement['time'] = ($mybb->user['timeonline'] *100) /$achievement['time'] ;
            if ($achievement['time'] > 100)
            {
             $achievement['ttneed'] = 100;
            }else{
             $achievement['ttneed'] = $achievement['time'];
            }
            if (strlen($achievement['ttneed']) > 4)
            $achievement['ttneed'] = substr($achievement['ttneed'], 0, 4);
            $required .= '

'.htmlspecialchars_uni($achievement['ttneed']).'%

';
        }
        if ($rank['achievements_acid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_custom', 'image,name,cat', 'acid='.intval($rank['achievements_acid']));
            $achievement = $db->fetch_array($query2);
            $required .= '

';
        }

        if ($rank['achievements_apoid'] > 0)
        {
            // get achievement name
            $query2 = $db->simple_select('myachievements_points', 'points,image,name,cat', 'apoid='.intval($rank['achievements_apoid']));
            $achievement = $db->fetch_array($query2);
            $achievement['points'] = ($mybb->user['newpoints'] *100) /$achievement['points'] ;
            if ($achievement['points'] > 100)
            {
             $achievement['npneed'] = 100;
            }else{
             $achievement['npneed'] = $achievement['points'];
            }
            if (strlen($achievement['npneed']) > 4)
            $achievement['npneed'] = substr($achievement['npneed'], 0, 4);
            $required .= '

'.htmlspecialchars_uni($achievement['npneed']).'%

';
        }

    eval("\$myachievements = \"".$templates->get("myachievements_ranks")."\";");
break;

}
$totalprogress = ($achievement['pneed'] + $achievement['ttneed'] + $achievement['npneed']) /3;`

I want to calculate following values

$totalprogress = ($achievement['pneed'] + $achievement['ttneed'] + $achievement['npneed']) /3;

But whole variable is not giving values


问:
What is CLANG indexing and why is it slow?
I setup an older PC (with 2GB memory) and wanted to try to use that as a compiling machine to free up my laptop.  But, what takes 2 minutes to build on my new laptop takes over 1/2 hour on the old pc!

I'm working in Qt Creator on both machines, and on the old PC it shows "Indexing with clangd" and counts from 1 to 516 (number of files in my project), but that steps takes 30 minutes!

What is the "indexing with clangd" step?

Why is it SO SLOW?  HTOP shows 20% free memory, and the CPU's are averaging 70%

Any tips on how to speed this up?


问:
Create a combined view list in SharePoint 2007
I like to have a main page Web part with a link to each one of the shared documents in our portal.

The problem is that they are from different libraries and also I want the SharePoint to keep track of check in and check outs of the files. When I use, Content Editor to add the links, and then click on the list, it download a copy of file and saved changes do not change the original document.

I thought about creating a modified view in that specific library and filter out just one file. Then put that file in the front page. But, the first problem is that the file is 2 or 3 level deep in hierarchy. Also, even if I manage to do that, what should I do about different files in different libraries?

Please Advise

ContentLicense: CC BY-SA 3.0


问:
Get IDs of all Facebook groups
I need to get all user's groups ID or links to those groups which he belong
The code is executing but nothing is writing down to a file
Has anyone a clue or diffret way to get groups id's
I need it to make an alghortim which will be adding specific ads on every group but i cant get the id's</p>
```<code>import requests

# Replace ACCESS_TOKEN with a valid access token
ACCESS_TOKEN = "TOKEN_ACCCES"

# Set the endpoint URL
url = "https://graph.facebook.com/me/groups"

# Set the HTTP headers
headers = {
    "Authorization": f"Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
}

# Set the params for the request
params = {
    "limit": 100,  # The maximum number of groups to retrieve per request
}

# Initialize an empty list to store the group IDs
group_ids = []

# Flag to determine whether there are more groups to retrieve
more_groups = True

# Keep making requests until all groups have been retrieved
while more_groups:
    # Send the request
    response = requests.get(url, headers=headers, params=params)

    # Check the response status code
    if response.status_code != 200:
        print("Failed to retrieve groups")
        print(response.text)
        break

    # Extract the data from the response
    data = response.json()

    # Add the group IDs to the list
    group_ids.extend([group["id"] for group in data["data"]])

    # Check if there are more groups to retrieve
    if "paging" in data and "next" in data["paging"]:
        # Update the URL and params for the next request
        url = data["paging"]["next"]
        params = {}
    else:
        # No more groups to retrieve
        more_groups = False

# Write the group IDs to a file
with open("group_ids.txt", "w") as f:
    f.write(",".join(group_ids))

print("Done!")

</code>```

Title: Get IDs of all Facebook groups

Body:
I need to get all user's groups ID or links to those groups which he belong
The code is executing but nothing is writing down to a file
Has anyone a clue or diffret way to get groups id's
I need it to make an alghortim which will be adding specific ads on every group but i cant get the id's

import requests

# Replace ACCESS_TOKEN with a valid access token
ACCESS_TOKEN = "TOKEN_ACCCES"

# Set the endpoint URL
url = "https://graph.facebook.com/me/groups"

# Set the HTTP headers
headers = {
    "Authorization": f"Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json",
}

# Set the params for the request
params = {
    "limit": 100,  # The maximum number of groups to retrieve per request
}

# Initialize an empty list to store the group IDs
group_ids = []

# Flag to determine whether there are more groups to retrieve
more_groups = True

# Keep making requests until all groups have been retrieved
while more_groups:
    # Send the request
    response = requests.get(url, headers=headers, params=params)

    # Check the response status code
    if response.status_code != 200:
        print("Failed to retrieve groups")
        print(response.text)
        break

    # Extract the data from the response
    data = response.json()

    # Add the group IDs to the list
    group_ids.extend([group["id"] for group in data["data"]])

    # Check if there are more groups to retrieve
    if "paging" in data and "next" in data["paging"]:
        # Update the URL and params for the next request
        url = data["paging"]["next"]
        params = {}
    else:
        # No more groups to retrieve
        more_groups = False

# Write the group IDs to a file
with open("group_ids.txt", "w") as f:
    f.write(",".join(group_ids))

print("Done!")


问:
Flask mqtt works fine in the web app console (pythonanywhere) but it doesn't work in the web app itself,
I use pythonanywhere for my IoT flask server. My MQTT code runs locally (visualstudio) but fails under pythonanywhere (code below copied from my similar question on pythonanywhere forum).

I configured MQTT credentials and set tls to false and 5 seconds keepalive then I instantiate mqtt=Mqtt(app). In @mqtt.onConnect() function I printed values when rc is zero but it doesn't print in any log file (even I used sys.stderr) meaning that means it doesn't go in this function, therefore publish and onMessage() doesn't work too.

However if I open python in the bash console and import MQTT instance from app file it connects to my broker and when I call the function that publish from the console it publish the message to my broker.

I tried to mqtt=Mqtt() then in main scope mqtt.init_app(app) and also tried in main mqtt.run() didn't work.

```<code>app1.config['MQTT_BROKER_URL'] = 'mybroker'
app1.config['MQTT_BROKER_PORT'] = 1883
app1.config['MQTT_USERNAME'] = ' '
app1.config['MQTT_PASSWORD'] = ' '
app1.config['MQTT_KEEPALIVE'] = 5
app1.config['MQTT_TLS_ENABLED'] = False

mqtt_client = Mqtt(app1)

import sys as syss

@mqtt_client.on_connect()
def handle_connect(client,userdata,flags,rc):
   if rc == 0:
      print('Connected successfully', file = syss.stderr)
      mqtt_client.subscribe('esp/copra')
   else:
      print('Bad connection. Code:', rc , file=syss.stderr)

testmqtt="a"

@mqtt_client.on_message()
def handle_mqtt_message(client,userdata,message):
   payload = message.payload.decode()
   print("payload is " + payload)

@app1.route("/testmqtt")
def testmqtt():
   print("test mqtt here")
   mqtt_client.publish('esp/copra',"pythonanywhere")
   return{"mqtt": "mqtt"}

if name == "main":
   #app.config['SESSION_TYPE'] = 'filesystem'
   mqtt_client.init_app(app1)
   app1.run()
</code>```

Body:
I use pythonanywhere for my IoT flask server. My MQTT code runs locally (visualstudio) but fails under pythonanywhere (code below copied from my similar question on pythonanywhere forum).

I configured MQTT credentials and set tls to false and 5 seconds keepalive then I instantiate mqtt=Mqtt(app). In @mqtt.onConnect() function I printed values when rc is zero but it doesn't print in any log file (even I used sys.stderr) meaning that means it doesn't go in this function, therefore publish and onMessage() doesn't work too.

However if I open python in the bash console and import MQTT instance from app file it connects to my broker and when I call the function that publish from the console it publish the message to my broker.

I tried to mqtt=Mqtt() then in main scope mqtt.init_app(app) and also tried in main mqtt.run() didn't work.

app1.config['MQTT_BROKER_URL'] = 'mybroker'
app1.config['MQTT_BROKER_PORT'] = 1883
app1.config['MQTT_USERNAME'] = ' '
app1.config['MQTT_PASSWORD'] = ' '
app1.config['MQTT_KEEPALIVE'] = 5
app1.config['MQTT_TLS_ENABLED'] = False

mqtt_client = Mqtt(app1)

import sys as syss

@mqtt_client.on_connect()
def handle_connect(client,userdata,flags,rc):
   if rc == 0:
      print('Connected successfully', file = syss.stderr)
      mqtt_client.subscribe('esp/copra')
   else:
      print('Bad connection. Code:', rc , file=syss.stderr)

testmqtt="a"

@mqtt_client.on_message()
def handle_mqtt_message(client,userdata,message):
   payload = message.payload.decode()
   print("payload is " + payload)

@app1.route("/testmqtt")
def testmqtt():
   print("test mqtt here")
   mqtt_client.publish('esp/copra',"pythonanywhere")
   return{"mqtt": "mqtt"}

if name == "main":
   #app.config['SESSION_TYPE'] = 'filesystem'
   mqtt_client.init_app(app1)
   app1.run()