问:
Why I am getting an empty array?
I want to transfer all the data which is in Detail Page to the Cart Page which is tableView. My main question is that in the CartScreen page an array is still empty even if in Detail Screen I pressed add to cart button (which works fine). I am using MVVM design so here's is a repo class:

```<code>class FoodsDaoRepository {
    var foodList = BehaviorSubject <[Foods]>(value: [Foods]())
    var cartList = BehaviorSubject <[FoodsCart]>(value: [FoodsCart]())

     var cartList = BehaviorSubject <[FoodsCart]>(value: [FoodsCart]())

      func getFromCart (userName: String) {
        let params: Parameters = ["userName" : userName]
        AF.request("http://example.com/foods/getFoodsCart.php", method: .post, parameters: params).response {response in
            if let data = response.data {
                do{
                    let result = try JSONDecoder().decode(CartResponse.self, from: data)
                    if let list = result.cart {
                        self.cartList.onNext(list)
                        print(list)
                    }
                } catch {
                    print(error.localizedDescription)
                }
            }
        }
    }

</code>```

Cart Response class

```<code>struct CartResponse : Codable {
var cart : [FoodsCart]? }
</code>```

FoodsCart class

```<code>class FoodsCart : Codable {
var cartId : Int
var name : String
var image : String
var price : Int
var category : String
var orderAmount : Int
var userName = "rustin_wilde"

 init(cartId: Int, name: String, image: String, price: Int, category: String, orderAmount: Int, userName: String = "rustin_wilde") {
    self.cartId = cartId
    self.name = name
    self.image = image
    self.price = price
    self.category = category
    self.orderAmount = orderAmount
    self.userName = userName
}
</code>```

}

Product table view cell class

```<code>class ProductsTableViewCell: UITableViewCell {

@IBOutlet var productImageCart: UIImageView!

@IBOutlet var productNameCart: UILabel!

@IBOutlet var productCategory: UILabel!
@IBOutlet var productAmountCart: UILabel!

@IBOutlet var productTotalPrice: UILabel!
@IBOutlet var userName: UILabel!

@IBOutlet var viewCart: UIView!

override func awakeFromNib() {
    super.awakeFromNib()

}

override func setSelected(_ selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}

func configure(item : FoodsCart) {

    let url = URL(string: "http://example.com/foods/images/" + item.image)
    productImageCart.kf.setImage(with: url)
    productNameCart.text = item.name
    productCategory.text = item.category
    productTotalPrice.text = "\(item.price)"
    productAmountCart.text = String(item.price)
    userName.text = item.userName

}}
</code>```

CartScreen class

```<code>    class CartScreen : UIViewController, UITableViewDelegate, UITableViewDataSource {

    @IBOutlet var cartTableView: UITableView!

    var cart : FoodsCart?
    var foodsCart = [FoodsCart]()
    var viewModel = CartViewModel()

   public var userName = "rustin_wilde"

    override func viewDidLoad() {
        super.viewDidLoad()

        let _ = viewModel.cartList.subscribe(onNext: { list in
            self.foodsCart = list
            DispatchQueue.main.async {
                self.cartTableView.reloadData()
            }
        })

        cartTableView.delegate = self
        cartTableView.dataSource = self

        //register xib
        cartTableView.register(UINib(nibName: "ProductsTableViewCell", bundle: nil), forCellReuseIdentifier: "ProductsTableViewCell")
    }

    override func viewWillAppear(_ animated: Bool) {
        viewModel.getFromCart(userName: userName)

    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return foodsCart.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let foodCart = foodsCart[indexPath.row]

        let cell = cartTableView.dequeueReusableCell(withIdentifier: "productCell") as! ProductsTableViewCell
        cell.configure(item: foodCart)
        return cell
    }
}
</code>```

Title: Why I am getting an empty array?

Body:
I want to transfer all the data which is in Detail Page to the Cart Page which is tableView. My main question is that in the CartScreen page an array is still empty even if in Detail Screen I pressed add to cart button (which works fine). I am using MVVM design so here's is a repo class:

class FoodsDaoRepository {
    var foodList = BehaviorSubject <[Foods]>(value: [Foods]())
    var cartList = BehaviorSubject <[FoodsCart]>(value: [FoodsCart]())

     var cartList = BehaviorSubject <[FoodsCart]>(value: [FoodsCart]())

      func getFromCart (userName: String) {
        let params: Parameters = ["userName" : userName]
        AF.request("http://example.com/foods/getFoodsCart.php", method: .post, parameters: params).response {response in
            if let data = response.data {
                do{
                    let result = try JSONDecoder().decode(CartResponse.self, from: data)
                    if let list = result.cart {
                        self.cartList.onNext(list)
                        print(list)
                    }
                } catch {
                    print(error.localizedDescription)
                }
            }
        }
    }

Cart Response class

struct CartResponse : Codable {
var cart : [FoodsCart]? }

FoodsCart class

class FoodsCart : Codable {
var cartId : Int
var name : String
var image : String
var price : Int
var category : String
var orderAmount : Int
var userName = "rustin_wilde"

 init(cartId: Int, name: String, image: String, price: Int, category: String, orderAmount: Int, userName: String = "rustin_wilde") {
    self.cartId = cartId
    self.name = name
    self.image = image
    self.price = price
    self.category = category
    self.orderAmount = orderAmount
    self.userName = userName
}

}

Product table view cell class

class ProductsTableViewCell: UITableViewCell {

@IBOutlet var productImageCart: UIImageView!

@IBOutlet var productNameCart: UILabel!

@IBOutlet var productCategory: UILabel!
@IBOutlet var productAmountCart: UILabel!

@IBOutlet var productTotalPrice: UILabel!
@IBOutlet var userName: UILabel!

@IBOutlet var viewCart: UIView!

override func awakeFromNib() {
    super.awakeFromNib()

}

override func setSelected(_ selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}

func configure(item : FoodsCart) {

    let url = URL(string: "http://example.com/foods/images/" + item.image)
    productImageCart.kf.setImage(with: url)
    productNameCart.text = item.name
    productCategory.text = item.category
    productTotalPrice.text = "\(item.price)"
    productAmountCart.text = String(item.price)
    userName.text = item.userName

}}

CartScreen class

    class CartScreen : UIViewController, UITableViewDelegate, UITableViewDataSource {

    @IBOutlet var cartTableView: UITableView!

    var cart : FoodsCart?
    var foodsCart = [FoodsCart]()
    var viewModel = CartViewModel()

   public var userName = "rustin_wilde"

    override func viewDidLoad() {
        super.viewDidLoad()

        let _ = viewModel.cartList.subscribe(onNext: { list in
            self.foodsCart = list
            DispatchQueue.main.async {
                self.cartTableView.reloadData()
            }
        })

        cartTableView.delegate = self
        cartTableView.dataSource = self

        //register xib
        cartTableView.register(UINib(nibName: "ProductsTableViewCell", bundle: nil), forCellReuseIdentifier: "ProductsTableViewCell")
    }

    override func viewWillAppear(_ animated: Bool) {
        viewModel.getFromCart(userName: userName)

    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return foodsCart.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let foodCart = foodsCart[indexPath.row]

        let cell = cartTableView.dequeueReusableCell(withIdentifier: "productCell") as! ProductsTableViewCell
        cell.configure(item: foodCart)
        return cell
    }
}


来源: stackexchange

问:
make install using a conda environement
I'm trying to install HaploStrips, which requires python 2.7 and pip (and a few other libraries). The author suggests to create an anaconda environment using conda create -n haplostrips python=2.7 pandas=0.22 pysam, then activating that environment and installing using that.

However, even when I do that, the installer can't find pandas or pysam, or the correct version of Python (it uses my default python install, which is 3.8).

How can I get make install to use the executables provided by anaconda? Is there a better way to get it to use python 2.7 + the other dependancies?

This is the output from running conda create --name haplostripsb python=2.7:

 >> conda create --name haplostripsb python=2.7
Collecting package metadata (current_repodata.json): failed
WARNING conda.exceptions:print_unexpected_error_report(1216): KeyError('pkgs_dirs')
Traceback (most recent call last):
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 87, in _main
exit_code = do_call(args, p)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main_create.py", line 41, in execute
install(args, parser, 'create')
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/install.py", line 260, in install
unlink_link_transaction = solver.solve_for_transaction(
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 152, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 195, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 300, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/common/io.py", line 88, in decorated
return f(*args, **kwds)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 435, in _collect_all_metadata
_supplement_index_with_system(virtual_pkg_index)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/index.py", line 164, in _supplement_index_with_system
dist_name, dist_version = context.os_distribution_name_version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1214, in print_unexpected_error_report
message_builder.append(get_main_info_str(error_report['conda_info']))
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main_info.py", line 237, in get_main_info_str
info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 87, in _main
exit_code = do_call(args, p)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main_create.py", line 41, in execute
install(args, parser, 'create')
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/install.py", line 260, in install
unlink_link_transaction = solver.solve_for_transaction(
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 152, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 195, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 300, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/common/io.py", line 88, in decorated
return f(*args, **kwds)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 435, in _collect_all_metadata
_supplement_index_with_system(virtual_pkg_index)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/index.py", line 164, in _supplement_index_with_system
dist_name, dist_version = context.os_distribution_name_version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
`$ /home/muthur/anaconda3/bin/conda create --name haplostripsb python=2.7`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.
```
<p>This is the output from running <code>lsb_release -a</code></p>
``` >> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal
```

ContentLicense: CC BY-SA 4.0

Title: make install using a conda environement

Body:
I'm trying to install HaploStrips, which requires python 2.7 and pip (and a few other libraries). The author suggests to create an anaconda environment using conda create -n haplostrips python=2.7 pandas=0.22 pysam, then activating that environment and installing using that.

However, even when I do that, the installer can't find pandas or pysam, or the correct version of Python (it uses my default python install, which is 3.8).

How can I get make install to use the executables provided by anaconda? Is there a better way to get it to use python 2.7 + the other dependancies?

This is the output from running conda create --name haplostripsb python=2.7:

 >> conda create --name haplostripsb python=2.7
Collecting package metadata (current_repodata.json): failed
WARNING conda.exceptions:print_unexpected_error_report(1216): KeyError('pkgs_dirs')
Traceback (most recent call last):
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 87, in _main
exit_code = do_call(args, p)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main_create.py", line 41, in execute
install(args, parser, 'create')
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/install.py", line 260, in install
unlink_link_transaction = solver.solve_for_transaction(
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 152, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 195, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 300, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/common/io.py", line 88, in decorated
return f(*args, **kwds)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 435, in _collect_all_metadata
_supplement_index_with_system(virtual_pkg_index)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/index.py", line 164, in _supplement_index_with_system
dist_name, dist_version = context.os_distribution_name_version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1214, in print_unexpected_error_report
message_builder.append(get_main_info_str(error_report['conda_info']))
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main_info.py", line 237, in get_main_info_str
info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 87, in _main
exit_code = do_call(args, p)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/main_create.py", line 41, in execute
install(args, parser, 'create')
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/cli/install.py", line 260, in install
unlink_link_transaction = solver.solve_for_transaction(
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 152, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 195, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 300, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/common/io.py", line 88, in decorated
return f(*args, **kwds)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/solve.py", line 435, in _collect_all_metadata
_supplement_index_with_system(virtual_pkg_index)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/core/index.py", line 164, in _supplement_index_with_system
dist_name, dist_version = context.os_distribution_name_version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/muthur/anaconda3/lib/python3.8/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
`$ /home/muthur/anaconda3/bin/conda create --name haplostripsb python=2.7`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.

This is the output from running lsb_release -a

 >> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal


问:
Input/Ouput errors only happening in a bash script
I am using a bioinformatics tool (iMOKA) through singularity. The bash script contains rm and mv commands as well as mkdir. The later works but not the first two. They output the following error:

```<code>/bin/rm: Input/output error
</code>```

The first to cause problem is line 256 in the script iMOKA_core/scripts/preprocessed.sh, and the few following.

I've read that it could be a hardware error, but I can manually remove these files without any problem; only the script shows the error. I thus suppose that it rules out hardware issues.

What else could it be ?

The server is virtualised if that is helpful. A lot of other tools do not have this problem.

EDIT: after running the script several times on several files (the script is applied to each file, so all the errors mentioned happen for each file), the errors are consistent within batch, but not between batch. Sometimes the rm errors disappear for all the files.

EDIT EDIT : it seems the rror might have been due to me binding the folder with input files when running singularity. The singularity image was also in the binded folder. I will see if i can replicate that.

Body:
I am using a bioinformatics tool (iMOKA) through singularity. The bash script contains rm and mv commands as well as mkdir. The later works but not the first two. They output the following error:

/bin/rm: Input/output error

The first to cause problem is line 256 in the script iMOKA_core/scripts/preprocessed.sh, and the few following.

I've read that it could be a hardware error, but I can manually remove these files without any problem; only the script shows the error. I thus suppose that it rules out hardware issues.

What else could it be ?

The server is virtualised if that is helpful. A lot of other tools do not have this problem.

EDIT: after running the script several times on several files (the script is applied to each file, so all the errors mentioned happen for each file), the errors are consistent within batch, but not between batch. Sometimes the rm errors disappear for all the files.

EDIT EDIT : it seems the rror might have been due to me binding the folder with input files when running singularity. The singularity image was also in the binded folder. I will see if i can replicate that.


问:
Assigning Clickable Button to hotkey
In MahApps, is there a way to assign one of the clickable buttons to a hotkey?
In essence, clicking on the button or pressing "K" brings up the same sub-menu, or whatever function.

MahApps has some sort of HotKey constructor but the documentation is fuzzy.

Title: Assigning Clickable Button to hotkey


问:
How can I extract a PDF file each column representing a column in Excel, but when the value is missing place a float (0)?
I am trying to convert a PDF file into an excel sheet, with each column respectively but I am having trouble because the PDF file instead of a value it has a space and when my code reads the PDF and keeps recording the value after the space. And when it reads an space it sends an error "ValueError: not enough values to unpack (expected at least 9, got 4)" which make sense because there no values or anything like that. So, I was hoping someone can help me to solve this issue.

enter image description here

```<code>with pdfplumber.open("report.pdf") as pdf:
page = pdf.pages[0]
text = page.extract_text(x_tolerance=2, y_tolerance=0)

for line in text.split('\n'):

    if project_det.search(line):
        in_lines = True
        job, *desc, JTD_Cost, Total_Estimate, Percent_Complete, Revised_Contract, Earned_Contract, To_date_Billed, Billing_in_Excess, Cost_in_Excess = line.split()
        desc = ' '.join(desc)
        print(desc)
        line_info = Line(proj_no, desc, JTD_Cost, Total_Estimate, Percent_Complete, Revised_Contract, Earned_Contract, To_date_Billed, Billing_in_Excess, Cost_in_Excess)
        data.append(line_info)
</code>```

Body:
I am trying to convert a PDF file into an excel sheet, with each column respectively but I am having trouble because the PDF file instead of a value it has a space and when my code reads the PDF and keeps recording the value after the space. And when it reads an space it sends an error "ValueError: not enough values to unpack (expected at least 9, got 4)" which make sense because there no values or anything like that. So, I was hoping someone can help me to solve this issue.

enter image description here

with pdfplumber.open("report.pdf") as pdf:
page = pdf.pages[0]
text = page.extract_text(x_tolerance=2, y_tolerance=0)

for line in text.split('\n'):

    if project_det.search(line):
        in_lines = True
        job, *desc, JTD_Cost, Total_Estimate, Percent_Complete, Revised_Contract, Earned_Contract, To_date_Billed, Billing_in_Excess, Cost_in_Excess = line.split()
        desc = ' '.join(desc)
        print(desc)
        line_info = Line(proj_no, desc, JTD_Cost, Total_Estimate, Percent_Complete, Revised_Contract, Earned_Contract, To_date_Billed, Billing_in_Excess, Cost_in_Excess)
        data.append(line_info)


问:
setting a defaulted value from an ng-model dropdown list based on the value of another ng-model dropdown list
I have an activity-controller.js and an addActivity-panel.html.

In the activity-controller.js, I have a function that checks based on ActivityType if a resolutionOutcome is required for said activity-type.

```<code>```$scope.isResolutionOutcomeRequired = function (activityType) {
    return activityType == '3' || activityType == '4' || activityType == 'CSCN' || activityType == 'DOC' || activityType == 'EMSN'
        || activityType == 'FFFV' || activityType == 'FFMV' || activityType == 'NTAC' || activityType == 'RMAR'
        || activityType == 'SVPL' || activityType == 'VREL' || activityType == 'NTAE' || activityType == 'TR_APPT' || activityType == 'TR_POC'
        || activityType == 'LLA' || activityType == 'TTYA' ;
};```
</code>```

These values are displayed in a DDL rendered by an ng-model. There is another DDL for 'resolutionOutcomeTypes' which displays a list of  resolution-outcome-types based on the value selected in the activity-type DDL. For the last 2 activity-Types 'LLA' and 'TTYA', there is only 1 value in the DDL. I'd like for this value to automatically display in the DDL instead of having to click into the DDL and select it.

This is the section of the addActivity-panel.html where each are displayed to the page.

```<code>```

            <uitk:label required="true">Activity Type</uitk:label>

            <uitk:select class='tk-width-15t' ng-model="activity.activityType"               ref-nm="activityType" custom-ref-filter='activityTypeDisplay'
                         long-desc="true" ng-required="true"></uitk:select>

            <uitk:label required="isResolutionOutcomeRequired(activity.activityType)">Resolution Outcome</uitk:label>

            <uitk:select class='tk-width-15t'                                                        ng-    model="activity.activityResolutionOutcomeType"
                         child-ref-nm="activityResolutionOutcomeType"
                         parent-ref-nm="activityType"
                         parent-model="activity.activityType" long-desc="true"
                         ng-required="isResolutionOutcomeRequired(activity.activityType)"
                         ng-disabled="isResolutionOutcomeDisabled(activity.activityType)"></uitk:select>

```
</code>```

I either need that single value to auto-display if either of those activity types are selected OR the single value to display if the list of values only has 1 value. I'm not sure how to implement this. Any help is appreciated

I'm a developer with about 6 months of experience and am looking for some inout on how to do this. thanks

Body:
I have an activity-controller.js and an addActivity-panel.html.

In the activity-controller.js, I have a function that checks based on ActivityType if a resolutionOutcome is required for said activity-type.

```$scope.isResolutionOutcomeRequired = function (activityType) {
    return activityType == '3' || activityType == '4' || activityType == 'CSCN' || activityType == 'DOC' || activityType == 'EMSN'
        || activityType == 'FFFV' || activityType == 'FFMV' || activityType == 'NTAC' || activityType == 'RMAR'
        || activityType == 'SVPL' || activityType == 'VREL' || activityType == 'NTAE' || activityType == 'TR_APPT' || activityType == 'TR_POC'
        || activityType == 'LLA' || activityType == 'TTYA' ;
};```

These values are displayed in a DDL rendered by an ng-model. There is another DDL for 'resolutionOutcomeTypes' which displays a list of  resolution-outcome-types based on the value selected in the activity-type DDL. For the last 2 activity-Types 'LLA' and 'TTYA', there is only 1 value in the DDL. I'd like for this value to automatically display in the DDL instead of having to click into the DDL and select it.

This is the section of the addActivity-panel.html where each are displayed to the page.

```<tr>
        <td style="text-align: right">
            <uitk:label required="true">Activity Type</uitk:label>
        </td>
        <td colspan="2">
            <uitk:select class='tk-width-15t' ng-model="activity.activityType"               ref-nm="activityType" custom-ref-filter='activityTypeDisplay'
                         long-desc="true" ng-required="true"></uitk:select>
        </td>
        <td style="text-align: right">
            <uitk:label required="isResolutionOutcomeRequired(activity.activityType)">Resolution Outcome</uitk:label>
        </td>
        <td>
            <uitk:select class='tk-width-15t'                                                        ng-    model="activity.activityResolutionOutcomeType"
                         child-ref-nm="activityResolutionOutcomeType"
                         parent-ref-nm="activityType"
                         parent-model="activity.activityType" long-desc="true"
                         ng-required="isResolutionOutcomeRequired(activity.activityType)"
                         ng-disabled="isResolutionOutcomeDisabled(activity.activityType)"></uitk:select>
        </td>
    </tr>```

I either need that single value to auto-display if either of those activity types are selected OR the single value to display if the list of values only has 1 value. I'm not sure how to implement this. Any help is appreciated

I'm a developer with about 6 months of experience and am looking for some inout on how to do this. thanks


问:
Unable to split Sparse Matrix into testing and training sets in R
I have a sparse matrix having around 200k columns and 200k rows. I need to split this matrix into 2 under training and testing data because I want to perform machine learning on the data. How do I do this?

Note: The sparse matrix I have is of class S4.


问:
Windows Search and FindStr - Provide Different Results
I'm trying to write a batch file or powershell script that will search INSIDE a pdf file for the word "invoice" and if it finds it, moves it to a different dir.  The scripting does not seem to be the issue (I don't think).  It seems the searching inside the file is the issue.  Windows 10 search finds the documents I'm looking for.  Dos and or Powershell doesn't seem to.  In this folder are hundreds of documents that DO contain the word "invoice".  On this computer I have an old gui search tool called FileSearchEx and it only find about 7 documents out of the hundreds that contain the word "invoice".  These are the same 7 that my batch file or powershell find.  Again, Windows finds them all.  And if I open a PDF program and search with CTRL+F it also finds the words I'm looking for.  Any idea why Windows finds the words I'm looking for but batch files using FindStr or PowerShell does not?  I'll paste the PowerShell script below just for clarity.  Thanks in advance! - Mike

```<code>$sourceDirectory = "C:\test2"
$targetDirectory = "C:\test2\invoice"

# Get all PDF files in the source directory
$pdfFiles = Get-ChildItem $sourceDirectory -Filter "*.pdf"

# Loop through each PDF file
foreach ($pdfFile in $pdfFiles) {
    # Check if the file contains the word "invoice"
    if (Get-Content $pdfFile.FullName | Select-String "invoice") {
    # If it does, move the file to the target directory
    Move-Item $pdfFile.FullName $targetDirectory
}
</code>```

}

This script works but only moves 7 files it finds.

Body:
I'm trying to write a batch file or powershell script that will search INSIDE a pdf file for the word "invoice" and if it finds it, moves it to a different dir.  The scripting does not seem to be the issue (I don't think).  It seems the searching inside the file is the issue.  Windows 10 search finds the documents I'm looking for.  Dos and or Powershell doesn't seem to.  In this folder are hundreds of documents that DO contain the word "invoice".  On this computer I have an old gui search tool called FileSearchEx and it only find about 7 documents out of the hundreds that contain the word "invoice".  These are the same 7 that my batch file or powershell find.  Again, Windows finds them all.  And if I open a PDF program and search with CTRL+F it also finds the words I'm looking for.  Any idea why Windows finds the words I'm looking for but batch files using FindStr or PowerShell does not?  I'll paste the PowerShell script below just for clarity.  Thanks in advance! - Mike

$sourceDirectory = "C:\test2"
$targetDirectory = "C:\test2\invoice"

# Get all PDF files in the source directory
$pdfFiles = Get-ChildItem $sourceDirectory -Filter "*.pdf"

# Loop through each PDF file
foreach ($pdfFile in $pdfFiles) {
    # Check if the file contains the word "invoice"
    if (Get-Content $pdfFile.FullName | Select-String "invoice") {
    # If it does, move the file to the target directory
    Move-Item $pdfFile.FullName $targetDirectory
}

}

This script works but only moves 7 files it finds.


问:
Connection log on apache FTP server
I am using apache ftp server to set up an ftp server in a LAN environment, for this server I have to keep track of the users that connect, that is, the server must capture a user when connecting and save his nickname, the date and time it was connected and save it to a .txt file.

The problem lies in how to capture this connection.

I have been investigating but the alternatives appear in other technologies, and I still do not have much progress in ftp server.

I'm new to the world of servers so I'm a bit lost.

I would greatly appreciate your help.

Title: Connection log on apache FTP server


问:
PowerBI Count the number of rows in table that is created with field parameters
I created a table in which a user can select the desired columns with a field parameter.

Now i want to create a measure to display the amount of rows that are now inside this table.
Right now the Countrows function will always display the maximum amount of rows.

Does anyone have an idea?


问:
IIS Web Server and web.config: Rewritten URL is displayed in Browser
I use the following rule within a web server configuration file (web.config, IIS Web Server).

The purpose of the rule is to add a new folder to the URL path.
The new folder shouldn't be visible in the browser's address bar.

The rule works fine, but the rewritten URL (www.domain.com/newfolder/...) is displayed in the browser's address bar.
I thought a rewritten URL is only processed by the web server and not by the browser client? What can I do, so that "newfolder" is not visible in the browser?

I don't want to use a 'redirect rule' but a 'rewrite rule'.

'''

```<code>    <rewrite>

        <rules>

            <rule name="New folder" enabled="true" stopProcessing="true">
                <match url="^(.*)$" />
                <conditions>
                    <add input="{REQUEST_URI}" pattern="^/newfolder" negate="true" />
                </conditions>
                <action type="Rewrite" url="/newfolder/{R:0}" appendQueryString="true" logRewrittenUrl="true" />
            </rule>

        </rules>

    </rewrite>
</code>```

'''

Body:
I use the following rule within a web server configuration file (web.config, IIS Web Server).

The purpose of the rule is to add a new folder to the URL path.
The new folder shouldn't be visible in the browser's address bar.

The rule works fine, but the rewritten URL (www.domain.com/newfolder/...) is displayed in the browser's address bar.
I thought a rewritten URL is only processed by the web server and not by the browser client? What can I do, so that "newfolder" is not visible in the browser?

I don't want to use a 'redirect rule' but a 'rewrite rule'.

'''

    <rewrite>

        <rules>

            <rule name="New folder" enabled="true" stopProcessing="true">
                <match url="^(.*)$" />
                <conditions>
                    <add input="{REQUEST_URI}" pattern="^/newfolder" negate="true" />
                </conditions>
                <action type="Rewrite" url="/newfolder/{R:0}" appendQueryString="true" logRewrittenUrl="true" />
            </rule>

        </rules>

    </rewrite>

'''


问:
How to return the largest prime smaller than n, using the sieve of Eratosthenes
I want to make a Java script program to return the largest prime smaller than n using the sieve of Eratosthenes. Can anybody help me with that?

I tried this:-

```<code>function sieve(n){
    let a = new Uint8Array(n+1);
    let max = Math.floor(Math.sqrt(n));
    let p=2;
    while(p<=max)
        for(let i=2*p;i<=n;i+=p)
            a[i]=1;
        while(a[++p])
    while(a[n]) n--;
    return n;
}
console.log(sieve(5))
</code>```

Body:
I want to make a Java script program to return the largest prime smaller than n using the sieve of Eratosthenes. Can anybody help me with that?

I tried this:-

function sieve(n){
    let a = new Uint8Array(n+1);
    let max = Math.floor(Math.sqrt(n));
    let p=2;
    while(p<=max)
        for(let i=2*p;i<=n;i+=p)
            a[i]=1;
        while(a[++p])
    while(a[n]) n--;
    return n;
}
console.log(sieve(5))


问:
Add Custom Debug button inside the text editor in Visual Studio Code
I'm building a VSCode extension to edit and run custom text files and I'm trying to figure out how to add a custom Run or Debug button inside the Text Editor. Unfortunately I can't find any documentation or examples that describe my use case.

What I want to achieve is something like the Debug button displayed in the package.json files, but in a custom file with a specific extension:

Tried to create commands and tasks but nothing seems to work to display the button inside the text editor.

Does anyone know if it's possible?


问:
Horovod Unable to use 2nd GPU worker
Hi I have setup horovod on a k8s cluster with 2 GPU nodes using spark-operator. I have executed the mnist example (https://archive-docs.d2iq.com/dkp/kaptain/1.2.0/tutorials/training/spark/) using tensorflow, and it was executed successfully on both nodes (utilizing GPUs on both nodes). However when I am using KerasEstimator on spark, the training executes successfully but I think that only one gpu is getting used.

I am following this example:
https://docs.databricks.com/_static/notebooks/deep-learning/horovod-spark-estimator-keras.html

here are the logs:

```<code>[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Bootstrap : Using eth0:10.84.52.31<0>
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO NET/Plugin : No plugin found (libnccl-net.so), using internal implementation
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO NET/IB : No device found.
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO NET/Socket : Using [0]eth0:10.84.52.31<0>
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Using network Socket
[1,0]:NCCL version 2.11.4+cuda11.4
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Bootstrap : Using eth0:10.84.179.52<0>
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO NET/Plugin : No plugin found (libnccl-net.so), using internal implementation
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO NET/IB : No device found.
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO NET/Socket : Using [0]eth0:10.84.179.52<0>
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Using network Socket
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Trees [0] -1/-1/-1->1->0 [1] 0/-1/-1->1->-1
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Setting affinity for GPU 0 to 55555555,55555555
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 00/02 : 0 1
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 01/02 : 0 1
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Trees [0] 1/-1/-1->0->-1 [1] -1/-1/-1->0->1
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Setting affinity for GPU 0 to 55555555,55555555
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 00 : 0[2000] -> 1[4000] [receive] via NET/Socket/0
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 01 : 0[2000] -> 1[4000] [receive] via NET/Socket/0
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 00 : 1[4000] -> 0[2000] [send] via NET/Socket/0
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 01 : 1[4000] -> 0[2000] [send] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 00 : 1[4000] -> 0[2000] [receive] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 01 : 1[4000] -> 0[2000] [receive] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 00 : 0[2000] -> 1[4000] [send] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 01 : 0[2000] -> 1[4000] [send] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Connected all rings
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Connected all trees
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO threadThresholds 8/8/64 | 16/8/64 | 8/8/512
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO 2 coll channels, 2 p2p channels, 1 p2p channels per peer
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO comm 0x7fd2247488e0 rank 0 nranks 2 cudaDev 0 busId 2000 - Init COMPLETE
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Launch mode Parallel
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Connected all rings
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Connected all trees
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO threadThresholds 8/8/64 | 16/8/64 | 8/8/512
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO 2 coll channels, 2 p2p channels, 1 p2p channels per peer
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO comm 0x7fad647478a0 rank 1 nranks 2 cudaDev 0 busId 4000 - Init COMPLETE
[1,0]:
[1,1]:WARNING:tensorflow:Callback method on_train_batch_end is slow compared to the batch time (batch time: 0.0086s vs on_train_batch_end time: 0.0658s). Check your callbacks.
[1,0]:WARNING:tensorflow:Callback method on_train_batch_end is slow compared to the batch time (batch time: 0.0053s vs on_train_batch_end time: 0.0687s). Check your callbacks.
1/4851 [..............................] - ETA: 8:35:39 - loss: 1.0356 - accuracy: 0.4844[1,0]: ����
9/4851 [..............................] - ETA: 30s - loss: 0.9629 - accuracy: 0.4219 [1,0]:
17/4851 [..............................] - ETA: 31s - loss: 0.9131 - accuracy: 0.4265[1,0]:
24/4851 [..............................] - ETA: 33s - loss: 0.8747 - accuracy: 0.4421[1,0]:
31/4851 [..............................] - ETA: 34s - loss: 0.8364 - accuracy: 0.4768[1,0]:
39/4851 [..............................] - ETA: 34s - loss: 0.7905 - accuracy: 0.5445[1,0]:
48/4851 [..............................] - ETA: 32s - loss: 0.7389 - accuracy: 0.6286[1,0]:
56/4851 [..............................] - ETA: 32s - loss: 0.6957 - accuracy: 0.6816[1,0]:
64/4851 [..............................] - ETA: 32s - loss: 0.6540 - accuracy: 0.7214[1,0]:
71/4851 [..............................] - ETA: 32s - loss: 0.6205 - accuracy: 0.7489[1,0]:
79/4851 [..............................] - ETA: 32s - loss: 0.5844 - accuracy: 0.7743[1,0]:
87/4851 [..............................] - ETA: 32s - loss: 0.5504 - accuracy: 0.7951[1,0]:
95/4851 [..............................] - ETA: 32s - loss: 0.5194 - accuracy: 0.8123[1,0]:
103/4851 [..............................] - ETA: 32s - loss: 0.4912 - accuracy: 0.8269[1,0]:
112/4851 [..............................] - ETA: 31s - loss: 0.4623 - accuracy: 0.8408[1,0]:
121/4851 [..............................] - ETA: 31s - loss: 0.4364 - accuracy: 0.8525[1,0]:
131/4851 [..............................] - ETA: 30s - loss: 0.4106 - accuracy: 0.8637[1,0]:
140/4851 [..............................] - ETA: 30s - loss: 0.3886 - accuracy: 0.8724[1,0]:
148/4851 [..............................] - ETA: 30s - loss: 0.3706 - accuracy: 0.8793[1,0]:
156/4851 [..............................] - ETA: 30s - loss: 0.3542 - accuracy: 0.8855[1,0]:
164/4851 [>.............................] - ETA: 30s - loss: 0.3388 - accuracy: 0.8911[1,0]:
172/4851 [>.............................] - ETA: 30s - loss: 0.3246 - accuracy: 0.8962[1,0]:
180/4851 [>.............................] - ETA: 30s - loss: 0.3116 - accuracy: 0.9008[1,0]:
188/4851 [>.............................] - ETA: 30s - loss: 0.2994 - accuracy: 0.9050[1,0]:
196/4851 [>.............................] - ETA: 30s - loss: 0.2882 - accuracy: 0.9089[1,0]:
204/4851 [>.............................] - ETA: 30s - loss: 0.2778 - accuracy: 0.9125[1,0]:
212/4851 [>.............................] - ETA: 30s - loss: 0.2680 - accuracy: 0.9158[1,0]:
220/4851 [>.............................] - ETA: 30s - loss: 0.2588 - accuracy: 0.9188[1,0]:
227/4851 [>.............................] - ETA: 30s - loss: 0.2513 - accuracy: 0.9213[1,0]:
235/4851 [>.............................] - ETA: 30s - loss: 0.2432 - accuracy: 0.9240[1,0]:
243/4851 [>.............................] - ETA: 30s - loss: 0.2356 - accuracy: 0.9265[1,0]:
251/4851 [>.............................] - ETA: 30s - loss: 0.2285 - accuracy: 0.9288[1,0]:
259/4851 [>.............................] - ETA: 30s - loss: 0.2218 - accuracy: 0.9310[1,0]:
267/4851 [>.............................] - ETA: 30s - loss: 0.2155 - accuracy: 0.9331[1,0]:
275/4851 [>.............................] - ETA: 30s - loss: 0.2095 - accuracy: 0.9351[1,0]:
283/4851 [>.............................] - ETA: 30s - loss: 0.2038 - accuracy: 0.9369[1,0]:
291/4851 [>.............................] - ETA: 30s - loss: 0.1985 - accuracy: 0.9386[1,0]:
299/4851 [>.............................] - ETA: 30s - loss: 0.1933 - accuracy: 0.9403[1,0]:
307/4851 [>.............................] - ETA: 30s - loss: 0.1885 - accuracy: 0.9418[1,0]:
316/4851 [>.............................] - ETA: 30s - loss: 0.1833 - accuracy: 0.9435[1,0]:
325/4851 [=>............................] - ETA: 30s - loss: 0.1784 - accuracy: 0.9450[1,0]:
334/4851 [=>............................] - ETA: 30s - loss: 0.1738 - accuracy: 0.9465[1,0]:
343/4851 [=>............................] - ETA: 30s - loss: 0.1694 - accuracy: 0.9479[1,0]:
351/4851 [=>............................] - ETA: 29s - loss: 0.1656 - accuracy: 0.9491[1,0]:
358/4851 [=>............................] - ETA: 30s - loss: 0.1625 - accuracy: 0.9501[1,0]:
366/4851 [=>............................] - ETA: 29s - loss: 0.1590 - accuracy: 0.9512[1,0]:
374/4851 [=>............................] - ETA: 29s - loss: 0.1557 - accuracy: 0.9522[1,0]:
383/4851 [=>............................] - ETA: 29s - loss: 0.1521 - accuracy: 0.9534[1,0]:
391/4851 [=>............................] - ETA: 29s - loss: 0.1491 - accuracy: 0.9543[1,0]:
400/4851 [=>............................] - ETA: 29s - loss: 0.1458 - accuracy: 0.9554[1,0]:
408/4851 [=>............................] - ETA: 29s - loss: 0.1430 - accuracy: 0.9562[1,0]:
417/4851 [=>............................] - ETA: 29s - loss: 0.1400 - accuracy: 0.9572[1,0]:
422/4851 [=>............................] - ETA: 29s - loss: 0.1384 - accuracy: 0.9577[1,0]:
428/4851 [=>............................] - ETA: 29s - loss: 0.1365 - accuracy: 0.9583[1,0]:
437/4851 [=>............................] - ETA: 29s - loss: 0.1338 - accuracy: 0.9591[1,0]:
447/4851 [=>............................] - ETA: 29s - loss: 0.1314 - accuracy: 0.9600[1,0]:
456/4851 [=>............................] - ETA: 29s - loss: 0.1289 - accuracy: 0.9608[1,0]:
465/4851 [=>............................] - ETA: 29s - loss: 0.1264 - accuracy: 0.9616[1,0]:
474/4851 [=>............................] - ETA: 29s - loss: 0.1241 - accuracy: 0.9623[1,0]:
483/4851 [=>............................] - ETA: 29s - loss: 0.1218 - accuracy: 0.9630[1,0]:
491/4851 [==>...........................] - ETA: 28s - loss: 0.1199 - accuracy: 0.9636[1,0]:
499/4851 [==>...........................] - ETA: 28s - loss: 0.1180 - accuracy: 0.9642[1,0]:
508/4851 [==>...........................] - ETA: 28s - loss: 0.1160 - accuracy: 0.9648[1,0]:
518/4851 [==>...........................] - ETA: 28s - loss: 0.1138 - accuracy: 0.9655[1,0]:
527/4851 [==>...........................] - ETA: 28s - loss: 0.1118 - accuracy: 0.9661[1,0]:
536/4851 [==>...........................] - ETA: 28s - loss: 0.1100 - accuracy: 0.9667[1,0]:
545/4851 [==>...........................] - ETA: 28s - loss: 0.1082 - accuracy: 0.9672[1,0]:
554/4851 [==>...........................] - ETA: 28s - loss: 0.1065 - accuracy: 0.9677[1,0]:
562/4851 [==>...........................] - ETA: 28s - loss: 0.1050 - accuracy: 0.9682[1,0]:
572/4851 [==>...........................] - ETA: 27s - loss: 0.1032 - accuracy: 0.9688[1,0]:
</code>```

I have tried different spark and horovod configurations, however horovod is not utilizing 2nd node

Title: Horovod Unable to use 2nd GPU worker

Body:
Hi I have setup horovod on a k8s cluster with 2 GPU nodes using spark-operator. I have executed the mnist example (https://archive-docs.d2iq.com/dkp/kaptain/1.2.0/tutorials/training/spark/) using tensorflow, and it was executed successfully on both nodes (utilizing GPUs on both nodes). However when I am using KerasEstimator on spark, the training executes successfully but I think that only one gpu is getting used.

I am following this example:
https://docs.databricks.com/_static/notebooks/deep-learning/horovod-spark-estimator-keras.html

here are the logs:

[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Bootstrap : Using eth0:10.84.52.31<0>
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO NET/Plugin : No plugin found (libnccl-net.so), using internal implementation
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO NET/IB : No device found.
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO NET/Socket : Using [0]eth0:10.84.52.31<0>
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Using network Socket
[1,0]:NCCL version 2.11.4+cuda11.4
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Bootstrap : Using eth0:10.84.179.52<0>
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO NET/Plugin : No plugin found (libnccl-net.so), using internal implementation
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO NET/IB : No device found.
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO NET/Socket : Using [0]eth0:10.84.179.52<0>
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Using network Socket
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Trees [0] -1/-1/-1->1->0 [1] 0/-1/-1->1->-1
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Setting affinity for GPU 0 to 55555555,55555555
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 00/02 : 0 1
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 01/02 : 0 1
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Trees [0] 1/-1/-1->0->-1 [1] -1/-1/-1->0->1
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Setting affinity for GPU 0 to 55555555,55555555
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 00 : 0[2000] -> 1[4000] [receive] via NET/Socket/0
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 01 : 0[2000] -> 1[4000] [receive] via NET/Socket/0
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 00 : 1[4000] -> 0[2000] [send] via NET/Socket/0
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Channel 01 : 1[4000] -> 0[2000] [send] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 00 : 1[4000] -> 0[2000] [receive] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 01 : 1[4000] -> 0[2000] [receive] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 00 : 0[2000] -> 1[4000] [send] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Channel 01 : 0[2000] -> 1[4000] [send] via NET/Socket/0
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Connected all rings
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Connected all trees
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO threadThresholds 8/8/64 | 16/8/64 | 8/8/512
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO 2 coll channels, 2 p2p channels, 1 p2p channels per peer
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO comm 0x7fd2247488e0 rank 0 nranks 2 cudaDev 0 busId 2000 - Init COMPLETE
[1,0]:fraud-engine-application-5422-6f5af3856318205f-exec-1:246:259 [0] NCCL INFO Launch mode Parallel
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Connected all rings
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO Connected all trees
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO threadThresholds 8/8/64 | 16/8/64 | 8/8/512
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO 2 coll channels, 2 p2p channels, 1 p2p channels per peer
[1,1]:fraud-engine-application-5422-6f5af3856318205f-exec-2:1240:1253 [0] NCCL INFO comm 0x7fad647478a0 rank 1 nranks 2 cudaDev 0 busId 4000 - Init COMPLETE
[1,0]:
[1,1]:WARNING:tensorflow:Callback method on_train_batch_end is slow compared to the batch time (batch time: 0.0086s vs on_train_batch_end time: 0.0658s). Check your callbacks.
[1,0]:WARNING:tensorflow:Callback method on_train_batch_end is slow compared to the batch time (batch time: 0.0053s vs on_train_batch_end time: 0.0687s). Check your callbacks.
1/4851 [..............................] - ETA: 8:35:39 - loss: 1.0356 - accuracy: 0.4844[1,0]: ����
9/4851 [..............................] - ETA: 30s - loss: 0.9629 - accuracy: 0.4219 [1,0]:
17/4851 [..............................] - ETA: 31s - loss: 0.9131 - accuracy: 0.4265[1,0]:
24/4851 [..............................] - ETA: 33s - loss: 0.8747 - accuracy: 0.4421[1,0]:
31/4851 [..............................] - ETA: 34s - loss: 0.8364 - accuracy: 0.4768[1,0]:
39/4851 [..............................] - ETA: 34s - loss: 0.7905 - accuracy: 0.5445[1,0]:
48/4851 [..............................] - ETA: 32s - loss: 0.7389 - accuracy: 0.6286[1,0]:
56/4851 [..............................] - ETA: 32s - loss: 0.6957 - accuracy: 0.6816[1,0]:
64/4851 [..............................] - ETA: 32s - loss: 0.6540 - accuracy: 0.7214[1,0]:
71/4851 [..............................] - ETA: 32s - loss: 0.6205 - accuracy: 0.7489[1,0]:
79/4851 [..............................] - ETA: 32s - loss: 0.5844 - accuracy: 0.7743[1,0]:
87/4851 [..............................] - ETA: 32s - loss: 0.5504 - accuracy: 0.7951[1,0]:
95/4851 [..............................] - ETA: 32s - loss: 0.5194 - accuracy: 0.8123[1,0]:
103/4851 [..............................] - ETA: 32s - loss: 0.4912 - accuracy: 0.8269[1,0]:
112/4851 [..............................] - ETA: 31s - loss: 0.4623 - accuracy: 0.8408[1,0]:
121/4851 [..............................] - ETA: 31s - loss: 0.4364 - accuracy: 0.8525[1,0]:
131/4851 [..............................] - ETA: 30s - loss: 0.4106 - accuracy: 0.8637[1,0]:
140/4851 [..............................] - ETA: 30s - loss: 0.3886 - accuracy: 0.8724[1,0]:
148/4851 [..............................] - ETA: 30s - loss: 0.3706 - accuracy: 0.8793[1,0]:
156/4851 [..............................] - ETA: 30s - loss: 0.3542 - accuracy: 0.8855[1,0]:
164/4851 [>.............................] - ETA: 30s - loss: 0.3388 - accuracy: 0.8911[1,0]:
172/4851 [>.............................] - ETA: 30s - loss: 0.3246 - accuracy: 0.8962[1,0]:
180/4851 [>.............................] - ETA: 30s - loss: 0.3116 - accuracy: 0.9008[1,0]:
188/4851 [>.............................] - ETA: 30s - loss: 0.2994 - accuracy: 0.9050[1,0]:
196/4851 [>.............................] - ETA: 30s - loss: 0.2882 - accuracy: 0.9089[1,0]:
204/4851 [>.............................] - ETA: 30s - loss: 0.2778 - accuracy: 0.9125[1,0]:
212/4851 [>.............................] - ETA: 30s - loss: 0.2680 - accuracy: 0.9158[1,0]:
220/4851 [>.............................] - ETA: 30s - loss: 0.2588 - accuracy: 0.9188[1,0]:
227/4851 [>.............................] - ETA: 30s - loss: 0.2513 - accuracy: 0.9213[1,0]:
235/4851 [>.............................] - ETA: 30s - loss: 0.2432 - accuracy: 0.9240[1,0]:
243/4851 [>.............................] - ETA: 30s - loss: 0.2356 - accuracy: 0.9265[1,0]:
251/4851 [>.............................] - ETA: 30s - loss: 0.2285 - accuracy: 0.9288[1,0]:
259/4851 [>.............................] - ETA: 30s - loss: 0.2218 - accuracy: 0.9310[1,0]:
267/4851 [>.............................] - ETA: 30s - loss: 0.2155 - accuracy: 0.9331[1,0]:
275/4851 [>.............................] - ETA: 30s - loss: 0.2095 - accuracy: 0.9351[1,0]:
283/4851 [>.............................] - ETA: 30s - loss: 0.2038 - accuracy: 0.9369[1,0]:
291/4851 [>.............................] - ETA: 30s - loss: 0.1985 - accuracy: 0.9386[1,0]:
299/4851 [>.............................] - ETA: 30s - loss: 0.1933 - accuracy: 0.9403[1,0]:
307/4851 [>.............................] - ETA: 30s - loss: 0.1885 - accuracy: 0.9418[1,0]:
316/4851 [>.............................] - ETA: 30s - loss: 0.1833 - accuracy: 0.9435[1,0]:
325/4851 [=>............................] - ETA: 30s - loss: 0.1784 - accuracy: 0.9450[1,0]:
334/4851 [=>............................] - ETA: 30s - loss: 0.1738 - accuracy: 0.9465[1,0]:
343/4851 [=>............................] - ETA: 30s - loss: 0.1694 - accuracy: 0.9479[1,0]:
351/4851 [=>............................] - ETA: 29s - loss: 0.1656 - accuracy: 0.9491[1,0]:
358/4851 [=>............................] - ETA: 30s - loss: 0.1625 - accuracy: 0.9501[1,0]:
366/4851 [=>............................] - ETA: 29s - loss: 0.1590 - accuracy: 0.9512[1,0]:
374/4851 [=>............................] - ETA: 29s - loss: 0.1557 - accuracy: 0.9522[1,0]:
383/4851 [=>............................] - ETA: 29s - loss: 0.1521 - accuracy: 0.9534[1,0]:
391/4851 [=>............................] - ETA: 29s - loss: 0.1491 - accuracy: 0.9543[1,0]:
400/4851 [=>............................] - ETA: 29s - loss: 0.1458 - accuracy: 0.9554[1,0]:
408/4851 [=>............................] - ETA: 29s - loss: 0.1430 - accuracy: 0.9562[1,0]:
417/4851 [=>............................] - ETA: 29s - loss: 0.1400 - accuracy: 0.9572[1,0]:
422/4851 [=>............................] - ETA: 29s - loss: 0.1384 - accuracy: 0.9577[1,0]:
428/4851 [=>............................] - ETA: 29s - loss: 0.1365 - accuracy: 0.9583[1,0]:
437/4851 [=>............................] - ETA: 29s - loss: 0.1338 - accuracy: 0.9591[1,0]:
447/4851 [=>............................] - ETA: 29s - loss: 0.1314 - accuracy: 0.9600[1,0]:
456/4851 [=>............................] - ETA: 29s - loss: 0.1289 - accuracy: 0.9608[1,0]:
465/4851 [=>............................] - ETA: 29s - loss: 0.1264 - accuracy: 0.9616[1,0]:
474/4851 [=>............................] - ETA: 29s - loss: 0.1241 - accuracy: 0.9623[1,0]:
483/4851 [=>............................] - ETA: 29s - loss: 0.1218 - accuracy: 0.9630[1,0]:
491/4851 [==>...........................] - ETA: 28s - loss: 0.1199 - accuracy: 0.9636[1,0]:
499/4851 [==>...........................] - ETA: 28s - loss: 0.1180 - accuracy: 0.9642[1,0]:
508/4851 [==>...........................] - ETA: 28s - loss: 0.1160 - accuracy: 0.9648[1,0]:
518/4851 [==>...........................] - ETA: 28s - loss: 0.1138 - accuracy: 0.9655[1,0]:
527/4851 [==>...........................] - ETA: 28s - loss: 0.1118 - accuracy: 0.9661[1,0]:
536/4851 [==>...........................] - ETA: 28s - loss: 0.1100 - accuracy: 0.9667[1,0]:
545/4851 [==>...........................] - ETA: 28s - loss: 0.1082 - accuracy: 0.9672[1,0]:
554/4851 [==>...........................] - ETA: 28s - loss: 0.1065 - accuracy: 0.9677[1,0]:
562/4851 [==>...........................] - ETA: 28s - loss: 0.1050 - accuracy: 0.9682[1,0]:
572/4851 [==>...........................] - ETA: 27s - loss: 0.1032 - accuracy: 0.9688[1,0]:

I have tried different spark and horovod configurations, however horovod is not utilizing 2nd node


问:
Machine Learning with Python KerasRegressor
I am new in the Machine Learning field. I am trying to find optimal CNN and mlp layers for my audio classifier. I have data of mfcc with 4-d but this method did not find any result even if hours passed. I got the solution with basic 2 CNN 1 mlp but the result did not well what is wrong here why I could not get any result? PS. I also scaled data using a standard scaler with scikit-learn. My question is my approximation to find parameters which give best result wrong or why does it take too much time without finding solution.

Thank you all.

```<code>def build_model(n_hidden = 1,n_neurons = 30,n_cnn = 1, learning_rate = 3e-3, input_shape = (mfcc_train.shape[1],mfcc_train.shape[2],1)):
    model = keras.models.Sequential()
    for cnn in range(n_cnn):
        model.add(keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=input_shape))
        model.add(keras.layers.MaxPooling2D((3,3), strides=(2,2), padding='same'))
        model.add(keras.layers.BatchNormalization())

    model.add(keras.layers.Flatten())
    model.add(keras.layers.InputLayer())
    for layer in range(n_hidden):
        model.add(keras.layers.Dense(n_neurons,activation = "relu"))
    model.add(keras.layers.Dense(1,activation = "sigmoid"))
    optimizer = keras.optimizers.SGD(lr = learning_rate)
    model.compile(loss = tf.keras.losses.BinaryCrossentropy(from_logits=True),optimizer = optimizer)
    return modeldef build_model(n_hidden = 1,n_neurons = 30,n_cnn = 1, learning_rate = 3e-3, input_shape = (mfcc_train.shape[1],mfcc_train.shape[2],1)):
    model = keras.models.Sequential()
    for cnn in range(n_cnn):
        model.add(keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=input_shape))
        model.add(keras.layers.MaxPooling2D((3,3), strides=(2,2), padding='same'))
        model.add(keras.layers.BatchNormalization())

    model.add(keras.layers.Flatten())
    model.add(keras.layers.InputLayer())
    for layer in range(n_hidden):
        model.add(keras.layers.Dense(n_neurons,activation = "relu"))
    model.add(keras.layers.Dense(1,activation = "sigmoid"))
    optimizer = keras.optimizers.SGD(lr = learning_rate)
    model.compile(loss = tf.keras.losses.BinaryCrossentropy(from_logits=True),optimizer = optimizer)
    return model

xxx = keras.wrappers.scikit_learn.KerasRegressor(build_model)```

param_distribs = {
    "n_hidden":[1,2,3,4],
    "n_neurons": np.arange(1,200),
    "learning_rate": reciprocal(3e-3,3e-1),
    "n_cnn":[2,3,4],
}

rnd_search_cv = RandomizedSearchCV(xxx,param_distribs,n_iter = 20)
rnd_search_cv.fit(mfcc_train,y_train,epochs = 100,batch_size = 32,validation_data =[mfcc_valid,y_valid] ,callbacks = [keras.callbacks.EarlyStopping(patience = 10)])
```

I tried different approximated parameters this function approximates well in mlp but it have could not find any solution.

Body:
I am new in the Machine Learning field. I am trying to find optimal CNN and mlp layers for my audio classifier. I have data of mfcc with 4-d but this method did not find any result even if hours passed. I got the solution with basic 2 CNN 1 mlp but the result did not well what is wrong here why I could not get any result? PS. I also scaled data using a standard scaler with scikit-learn. My question is my approximation to find parameters which give best result wrong or why does it take too much time without finding solution.

Thank you all.

def build_model(n_hidden = 1,n_neurons = 30,n_cnn = 1, learning_rate = 3e-3, input_shape = (mfcc_train.shape[1],mfcc_train.shape[2],1)):
    model = keras.models.Sequential()
    for cnn in range(n_cnn):
        model.add(keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=input_shape))
        model.add(keras.layers.MaxPooling2D((3,3), strides=(2,2), padding='same'))
        model.add(keras.layers.BatchNormalization())

    model.add(keras.layers.Flatten())
    model.add(keras.layers.InputLayer())
    for layer in range(n_hidden):
        model.add(keras.layers.Dense(n_neurons,activation = "relu"))
    model.add(keras.layers.Dense(1,activation = "sigmoid"))
    optimizer = keras.optimizers.SGD(lr = learning_rate)
    model.compile(loss = tf.keras.losses.BinaryCrossentropy(from_logits=True),optimizer = optimizer)
    return modeldef build_model(n_hidden = 1,n_neurons = 30,n_cnn = 1, learning_rate = 3e-3, input_shape = (mfcc_train.shape[1],mfcc_train.shape[2],1)):
    model = keras.models.Sequential()
    for cnn in range(n_cnn):
        model.add(keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=input_shape))
        model.add(keras.layers.MaxPooling2D((3,3), strides=(2,2), padding='same'))
        model.add(keras.layers.BatchNormalization())

    model.add(keras.layers.Flatten())
    model.add(keras.layers.InputLayer())
    for layer in range(n_hidden):
        model.add(keras.layers.Dense(n_neurons,activation = "relu"))
    model.add(keras.layers.Dense(1,activation = "sigmoid"))
    optimizer = keras.optimizers.SGD(lr = learning_rate)
    model.compile(loss = tf.keras.losses.BinaryCrossentropy(from_logits=True),optimizer = optimizer)
    return model

xxx = keras.wrappers.scikit_learn.KerasRegressor(build_model)```

param_distribs = {
    "n_hidden":[1,2,3,4],
    "n_neurons": np.arange(1,200),
    "learning_rate": reciprocal(3e-3,3e-1),
    "n_cnn":[2,3,4],
}

rnd_search_cv = RandomizedSearchCV(xxx,param_distribs,n_iter = 20)
rnd_search_cv.fit(mfcc_train,y_train,epochs = 100,batch_size = 32,validation_data =[mfcc_valid,y_valid] ,callbacks = [keras.callbacks.EarlyStopping(patience = 10)])

I tried different approximated parameters this function approximates well in mlp but it have could not find any solution.


问:
(Tensorflow) Parameter prediction from image
First I will give some context of my situation:

I have a laser that after propagation is observed by a camera. Now the initial parameters of the laser will determine the pattern observed in the image taken by the camera. I want to train a NN that takes as input the image of the laser after propagation and is capable to output the 6 initial parameters that (in my case) cause the observed shape.
As training data, I have already a simulation that generates the pattern that should be observed for a set of initial parameters and also some experimental data.

My problem is while I know some Tensorflow/keras already (like image classification), i am not sure how to go from an input image to an output vector with non-discrete values. Could anybody give me some indications or some references for similar cases ?

Sorry if it is a really simple question.

Thank you in advance.

I was thinking of instead of outputting a vector with values, to output an image with the values of each px representing each initial parameter value prediction. However, I think is probably much more complicated than a just doing the vector.

I searched on the internet and google scholar but couldn't find anything.


问:
How to correctly add tracking tag for Google Analystics and Google Ads on the same page
I'm trying to add the script tags for Google analytics and Google ads to the same page.

Both Google analytics and Google ads give me pretty much the same script tag to add inside of the head tag. The only difference is that they use a different id.

Is it safe to simply embed both scripts on the same page? Do I need to write my own Javascript to combine them?

I'm worried that adding both scripts might result in only one of the tags registering. Google ads is warning me that it's not getting conversion events. And Google analytics stopped reporting visitors after I added the Google ads script.

Also, Google analytics seems to have an option to suppress registering duplicate tags on the same page. Google analytics doesn't explain if it is smart enough to realize if there are two tags with the same id or two tags with a different id.

Is there a way to have Google analytics and Google ads crawl my page and tell me that their tag is working?


问:
Oracle query for running total
I have the below table and trying to derive the result in the 'expected output' column. I have mentioned the logic on how I derive it in the 'logic' column.

enter image description here

I tried using the rows unbounded preceding

Title: Oracle query for running total


问:
Change between border and border-bottom conditionally with just scss
I'm building a component which should be customizable by a client with css properties like this:

```<code>component {
  --component-border: 2px solid green;
}
</code>```

if the component is not customized it should show the default style (border-bottom).

My first idea was to use it like this, but I can't use custom propertie variables:

```<code> @if (--check-if-input) {
    border: --component-border;
  } @else {
    border-bottom: 1px solid $grey--400;
  }
</code>```

My guess is that I need to put in a scss variable like so:

```<code>@if $check-if-input {
    border: --component-border;
  } @else {
    border-bottom: 1px solid $grey--400;
  }
</code>```

I just don't understand how I can use the condition so it checks if --component-border is used.

Any help is appreciated!

Body:
I'm building a component which should be customizable by a client with css properties like this:

component {
  --component-border: 2px solid green;
}

if the component is not customized it should show the default style (border-bottom).

My first idea was to use it like this, but I can't use custom propertie variables:

 @if (--check-if-input) {
    border: --component-border;
  } @else {
    border-bottom: 1px solid $grey--400;
  }

My guess is that I need to put in a scss variable like so:

@if $check-if-input {
    border: --component-border;
  } @else {
    border-bottom: 1px solid $grey--400;
  }

I just don't understand how I can use the condition so it checks if --component-border is used.

Any help is appreciated!


问:
when i try to build my project i get this error
I don't know how to solve

when i try to bild on vercel the project, i get this error :

```<code>npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
</code>```

this is the error that appears when i try to upload it

```<code>> Build error occurred
Error: Export encountered errors on following paths:
    /category/[slug]: /category/sport
    /posts/[slug]: /posts/che-te-guardi-ah-oh
    /posts/[slug]: /posts/chi-fa-sport-e-omosessuale
    /posts/[slug]: /posts/come-fossero-i-giocatori-senza-denti
    /posts/[slug]: /posts/e-se-il-sium-non-esistesse
    /posts/[slug]: /posts/fabio-rovazzi-esiste-nel-nostro-universo
    /posts/[slug]: /posts/la-terra-e-piatta-basta-dire-cazzate
    /posts/[slug]: /posts/lo-sport-serve-davvero
    at /vercel/path0/node_modules/next/dist/export/index.js:409:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
    at async /vercel/path0/node_modules/next/dist/build/index.js:1345:21
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
    at async /vercel/path0/node_modules/next/dist/build/index.js:1205:17
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
    at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:66:29)
Error: Command "npm run build" exited with 1
</code>```

Body:
I don't know how to solve

when i try to bild on vercel the project, i get this error :

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies

this is the error that appears when i try to upload it

> Build error occurred
Error: Export encountered errors on following paths:
    /category/[slug]: /category/sport
    /posts/[slug]: /posts/che-te-guardi-ah-oh
    /posts/[slug]: /posts/chi-fa-sport-e-omosessuale
    /posts/[slug]: /posts/come-fossero-i-giocatori-senza-denti
    /posts/[slug]: /posts/e-se-il-sium-non-esistesse
    /posts/[slug]: /posts/fabio-rovazzi-esiste-nel-nostro-universo
    /posts/[slug]: /posts/la-terra-e-piatta-basta-dire-cazzate
    /posts/[slug]: /posts/lo-sport-serve-davvero
    at /vercel/path0/node_modules/next/dist/export/index.js:409:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
    at async /vercel/path0/node_modules/next/dist/build/index.js:1345:21
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
    at async /vercel/path0/node_modules/next/dist/build/index.js:1205:17
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
    at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:66:29)
Error: Command "npm run build" exited with 1


问:
Terraform Add AWS Region to Aurora
We have an Aurora (8.0.mysql_aurora.3.02.2) Cluster which we need to convert to a Global Database. I see that this can be done from the AWS Console using "Add AWS Region".

However, we've been looking for a way to do this using Terraform but haven't found anything.
We found modify-db-cluster in Terraform but this doesn't have an option for adding an AWS region.

Is there a Terraform API for this?

Title: Terraform Add AWS Region to Aurora


问:
ML.Net : How to define Shape Vectors for GPT2 ONNX model?
I'm trying to use ML.Net to consume an ONNX GPT-2 Model.
https://github.com/onnx/models/blob/main/text/machine_comprehension/gpt-2/README.md

I'm stuck on defining the shape dicionary.

The following are the Input and Output model properties, extracted with Netron:

```<code>name: input1
type: int64[input1_dynamic_axes_1,input1_dynamic_axes_2,input1_dynamic_axes_3]

name: output1
type: float32[input1_dynamic_axes_1,input1_dynamic_axes_2,input1_dynamic_axes_3,50257]

name: output2
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output3
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output4
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output5
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output6
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output7
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output8
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output9
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output10
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output11
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output12
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output13
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]
</code>```

What are the correct values for the shape dictionary?
How to represente the input?

```<code>int64[ input1_dynamic_axes_1, input1_dynamic_axes_2, input1_dynamic_axes_3 ]
</code>```

I've tryied:

```<code>{  "input1", new[] { 1, 32, 32 } }
</code>```

Totally guessing...

And the next?

```<code>float32[ input1_dynamic_axes_1, input1_dynamic_axes_2, input1_dynamic_axes_3, 50257 ]

float32[ 2, input1_dynamic_axes_2, 12, input1_dynamic_axes_3, 64]
</code>```

I'm passing Shape Dictionary to ApplyOnnxModel as in this article https://rubikscode.net/2021/10/25/using-huggingface-transformers-with-ml-net/

```<code>    var pipeline = _mlContext.Transforms
                    .ApplyOnnxModel(modelFile: bertModelPath,
                    shapeDictionary: shapeDictionary,
                                    outputColumnNames: outputColumnNames,
                                    inputColumnNames: inputColumnNames,
                                    gpuDeviceId: useGpu ? 0 : (int?)null,
                                    fallbackToCpu: true);
</code>```

Thank you!

Body:
I'm trying to use ML.Net to consume an ONNX GPT-2 Model.
https://github.com/onnx/models/blob/main/text/machine_comprehension/gpt-2/README.md

I'm stuck on defining the shape dicionary.

The following are the Input and Output model properties, extracted with Netron:

name: input1
type: int64[input1_dynamic_axes_1,input1_dynamic_axes_2,input1_dynamic_axes_3]

name: output1
type: float32[input1_dynamic_axes_1,input1_dynamic_axes_2,input1_dynamic_axes_3,50257]

name: output2
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output3
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output4
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output5
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output6
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output7
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output8
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output9
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output10
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output11
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output12
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

name: output13
type: float32[2,input1_dynamic_axes_2,12,input1_dynamic_axes_3,64]

What are the correct values for the shape dictionary?
How to represente the input?

int64[ input1_dynamic_axes_1, input1_dynamic_axes_2, input1_dynamic_axes_3 ]

I've tryied:

{  "input1", new[] { 1, 32, 32 } }

Totally guessing...

And the next?

float32[ input1_dynamic_axes_1, input1_dynamic_axes_2, input1_dynamic_axes_3, 50257 ]

float32[ 2, input1_dynamic_axes_2, 12, input1_dynamic_axes_3, 64]

I'm passing Shape Dictionary to ApplyOnnxModel as in this article https://rubikscode.net/2021/10/25/using-huggingface-transformers-with-ml-net/

    var pipeline = _mlContext.Transforms
                    .ApplyOnnxModel(modelFile: bertModelPath,
                    shapeDictionary: shapeDictionary,
                                    outputColumnNames: outputColumnNames,
                                    inputColumnNames: inputColumnNames,
                                    gpuDeviceId: useGpu ? 0 : (int?)null,
                                    fallbackToCpu: true);

Thank you!


问:
Projecting multiple textures on surfaces relative to perspective in three.js
Been working on a project where I unpack and display a game map on the web through three.js. It all looks good, except when a surface is marked as a SKY. As a placeholder I turned the texture into an envMap, but a surface can be marked as something else which I'd like to use the envMap for and wouldn't want to confuse the two. What I want to do is have these "sky-marked textures" be absolutely static, always facing the screen, no matter your perspective. Here's an example of what I'm looking for. https://imgur.com/a/vupPlwx

It would be like there was a hole in the surface looking straight through to a webpage's tiled background picture. I have experimented with RenderTargets in combination with various envMaps, but it has most often looked like a cubed map and the texture sliding and zooming in undesirable ways. I have attempted to use glsl but I could not have one instance for each texture, nor figure out how to feed the one instance with multiple textures.

So I ask what would be the best solution to achieve this effect?


问:
What Fallback should be used for Sharelink in iOS 16?
I have got a button that presents the share sheet using ShareLink. However, this is only available in iOS 16. Therefore it requires a fallback. What can I put in here that would give the same results to the user?

```<code> Button(action: {
                            let link = URL(string: "https://www.website.co.uk")!
                            if #available(iOS 16.0, *) {
                                ShareLink(item: link, message: Text("My own message here"))
                            } else {
                                // Fallback on earlier versions
                            }
                        }) {
                            Image(systemName: "square.and.arrow.up")
                                .foregroundColor(.black)
                                .frame(width: 40, height: 40)
                                .background(Color("WhiteGray"),in: RoundedRectangle(cornerRadius: 10, style: .continuous))
                                .shadow(color: .black.opacity(0.1), radius: 5, x: 5, y: 5)
                        }

</code>```

Any ideas?

Body:
I have got a button that presents the share sheet using ShareLink. However, this is only available in iOS 16. Therefore it requires a fallback. What can I put in here that would give the same results to the user?

 Button(action: {
                            let link = URL(string: "https://www.website.co.uk")!
                            if #available(iOS 16.0, *) {
                                ShareLink(item: link, message: Text("My own message here"))
                            } else {
                                // Fallback on earlier versions
                            }
                        }) {
                            Image(systemName: "square.and.arrow.up")
                                .foregroundColor(.black)
                                .frame(width: 40, height: 40)
                                .background(Color("WhiteGray"),in: RoundedRectangle(cornerRadius: 10, style: .continuous))
                                .shadow(color: .black.opacity(0.1), radius: 5, x: 5, y: 5)
                        }

Any ideas?


问:
Python Multiple Process sharing objects from one location?
I'm currently re-writing a piece of software I wrote last year which was written using imperative programming and a database. I'm now looking at using object orientation and a better way of sharing variables via multiple processes.

Esstentially, the software connects to many units of hardware, listens for changes i.e. crosspoint changes on a router, and then saves this to a database/object. I then want a different process to be able to access that new change quickly and easily. This happens with multiple units of hardware all at the same time, hence the multiple processes.

This worked fairly well with an SQLite database, however I want to keep everything as an object to make use of attributes, neater code, spead etc.

Is there a way of sharing objects over multiple processes, being able to select and then 'put back' with relative ease? Also, the objects wouldn't neccessarily be in any particular order, meaning having to index to select an item would be off the cards.

I've previously looked at pickling object and saving them to SQLite, and queues. I'm pretty sure queues are the wrong choices, too limiting. I'm probably going to go with pickling + SQLite solution, just wanted to check with the web to see if anyone had any suggestions.

I hope I've explained myself well enough, thank you for your time!
Ned


问:
Windows Form - Change Array Elements from Textbox Input C#
Create a change password program that allows users to change their password by entering their email and security pin, but code works fine but it doesn't seem to make changes to the textfile array when I input a new password into the password textbox.

```<code>string filename = "./userinfo.csv";
using (var path = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var reader = new StreamReader(path))
{
    string line = reader.ReadLine();
    while ((line = reader.ReadLine()) != null)
    {
        string[] fields = line.Split(',');
        if (fields[1] == email && fields[3] == txtPin.Text)
        {
            fields[2] = txtNewPassword.Text;
            MessageBox.Show("Password Changed");
            break;
        }
        else
        {
            MessageBox.Show("Please enter an valid Username or Pin");
        }
    }
}
</code>```

When I enter input into the textbox it would go to the textfile and change that specific array.

Body:
Create a change password program that allows users to change their password by entering their email and security pin, but code works fine but it doesn't seem to make changes to the textfile array when I input a new password into the password textbox.

string filename = "./userinfo.csv";
using (var path = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var reader = new StreamReader(path))
{
    string line = reader.ReadLine();
    while ((line = reader.ReadLine()) != null)
    {
        string[] fields = line.Split(',');
        if (fields[1] == email && fields[3] == txtPin.Text)
        {
            fields[2] = txtNewPassword.Text;
            MessageBox.Show("Password Changed");
            break;
        }
        else
        {
            MessageBox.Show("Please enter an valid Username or Pin");
        }
    }
}

When I enter input into the textbox it would go to the textfile and change that specific array.


问:
pandas transform the dataframe by adding custom column names based on row data
I am very new to pandas and am trying to figure out how to transform a dataframe by grouping by rows.. The column names need to be changed depending on data. Any help will be greatly appreciated. I added the image to show original vs transformed view.

here is an example of the data.

Original dataframe:
a       b       c
111     2020        33.2
111     2021        48.3
111     2022        68.0
222     2020        32.2
222     2021        45.5
222     2022        57.2
333     2020        45.5
333     2021        78.4
333     2022        67.4

Transformed need to look like this:

a       2020_b      2021_b      2022_b
111     33.2        48.3        68.0
222     32.2        45.5        57.2
333     45.5        78.4        67.4


问:
Im trying to make a script to type out whatever is on my keyboard when I press the \ hotkey. Im writing this in PowerShell. it keeps giving me errors
My code is having issues with line 5 starting at character 18. All I'm trying to do is write a script to make it so any time I press \ on my keyboard, it types out whatever is on my clipboard. I have tried multiple differnt solutions but none have worked. my code is below.

```<code># Import the required assembly
Add-Type -AssemblyName System.Windows.Forms

# Create a new form object
$form = New-Object System.Windows.Forms.Form

# Create a hotkey for "\" using the Register-EngineEvent cmdlet
$backslashKeys = New-Object System.Windows.Forms.Keys 'Oem5'
$backslashHotkey = Register-EngineEvent -SourceIdentifier backslashHotkey -Action {
  # Get the current clipboard content
  $clipboard = Get-Clipboard

  # Type out the clipboard content
  [System.Windows.Forms.SendKeys]::SendWait($clipboard)
}

# Wait indefinitely for the hotkey event to be triggered
while ($true) {
  $hotkey = Wait-Event -SourceIdentifier backslashHotkey -ErrorAction Ignore
  if ($hotkey -and $hotkey.KeyCode -eq $backslashKeys) {
    Invoke-Command -ScriptBlock $backslashHotkey.Action
  }
}
</code>```

One more thing is that whenever I try to run this code it gives me this error in PowerShell. Im up for any suggestions.

```<code>New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.Windows.Forms.Keys.
At C:\Users\poo\Desktop\09iabdshu.ps1:9 char:18
+ $backslashKeys = New-Object System.Windows.Forms.Keys 'Oem5'
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand
</code>```

Body:
My code is having issues with line 5 starting at character 18. All I'm trying to do is write a script to make it so any time I press \ on my keyboard, it types out whatever is on my clipboard. I have tried multiple differnt solutions but none have worked. my code is below.

# Import the required assembly
Add-Type -AssemblyName System.Windows.Forms

# Create a new form object
$form = New-Object System.Windows.Forms.Form

# Create a hotkey for "\" using the Register-EngineEvent cmdlet
$backslashKeys = New-Object System.Windows.Forms.Keys 'Oem5'
$backslashHotkey = Register-EngineEvent -SourceIdentifier backslashHotkey -Action {
  # Get the current clipboard content
  $clipboard = Get-Clipboard

  # Type out the clipboard content
  [System.Windows.Forms.SendKeys]::SendWait($clipboard)
}

# Wait indefinitely for the hotkey event to be triggered
while ($true) {
  $hotkey = Wait-Event -SourceIdentifier backslashHotkey -ErrorAction Ignore
  if ($hotkey -and $hotkey.KeyCode -eq $backslashKeys) {
    Invoke-Command -ScriptBlock $backslashHotkey.Action
  }
}

One more thing is that whenever I try to run this code it gives me this error in PowerShell. Im up for any suggestions.

New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.Windows.Forms.Keys.
At C:\Users\poo\Desktop\09iabdshu.ps1:9 char:18
+ $backslashKeys = New-Object System.Windows.Forms.Keys 'Oem5'
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand


问:
`os.environ.get()` can't find token/signing secret on macOS
I run this code to initialize my slack bot:

```<code>    app = App(token=os.environ.get("SLACK_BOT_TOKEN"),
    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
</code>```

I picked up the project after a month-long break and now get this error message when I run the file:

```<code>slack_bolt.error.BoltError: Either an env variable `SLACK_BOT_TOKEN` or `token` argument in the constructor is required.
</code>```

When I change the code like so it works:

```<code>app = App(token="SLACK_BOT_TOKEN"),
    signing_secret="SLACK_SIGNING_SECRET")
)
</code>```

Why would os.environ.get() not work on my machine / how can I check if everything is set up correctly? Very inexperienced with .venv unfortunately. I'm on macOS 12.6

Body:
I run this code to initialize my slack bot:

    app = App(token=os.environ.get("SLACK_BOT_TOKEN"),
    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)

I picked up the project after a month-long break and now get this error message when I run the file:

slack_bolt.error.BoltError: Either an env variable `SLACK_BOT_TOKEN` or `token` argument in the constructor is required.

When I change the code like so it works:

app = App(token="SLACK_BOT_TOKEN"),
    signing_secret="SLACK_SIGNING_SECRET")
)

Why would os.environ.get() not work on my machine / how can I check if everything is set up correctly? Very inexperienced with .venv unfortunately. I'm on macOS 12.6