问:
'Detecting rails configuration failed' on Heroku
I've updated my application from Ruby 2.7.7 to Ruby 3.0.5 and from Rails 5.2.0 to Rails 6.0.1.

After updating various Gems and fixing a variety of things I have it running well on my test server but when I try to load the new version on Heroku I get 'Detecting rails configuration failed' and it won't run.  I'm guessing there's something in the configuration files that needs to be updated but I need some guidance on where to look next.

Here's the last part of the Heroku build (where it appears to deploy it) followed by the tail from the logs.

```<code>remote:        Cleaning assets
remote:        Running: rake assets:clean
remote:        I, [2023-01-09T21:32:10.786716 #2870]  INFO -- : Removed bootstrap_and_overrides-f7c23a19b2ec05622b15f940ca67f253265408eb4a2f3ca660f5b033ad48e245.css
remote:        I, [2023-01-09T21:32:10.788253 #2870]  INFO -- : Removed application-1010b7967d5a1017bdba8493f3b3d3e9075bc5b424b558ecabd87213398cd92f.css
remote:        I, [2023-01-09T21:32:10.789685 #2870]  INFO -- : Removed agents-5caf8c2fd005858f766d149bf7d2aa8be7855a86b0193a5a1fbb896a228ab4b2.js
remote:        I, [2023-01-09T21:32:10.791267 #2870]  INFO -- : Removed orders-23fa71cb39213c229aeafcb3a7c1c1ba59ce53eb852dfa5cf0144e4e70b24b97.js
remote:        I, [2023-01-09T21:32:10.792582 #2870]  INFO -- : Removed application-0050256351ac4c8249013d67374531282699b38524ebd667a3414ee861d5676d.js
remote: -----> Detecting rails configuration
remote:
remote: ###### WARNING:
remote:
remote:        Detecting rails configuration failed
remote:        set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
remote:
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> web, worker
remote:        Default types for buildpack -> console, rake
remote:
remote: -----> Compressing...
remote:        Done: 115M
remote: -----> Launching...
remote:        Released v1027
remote:        https://my-dialog-one.herokuapp.com/ deployed to Heroku
remote:
remote: This app is using the Heroku-20 stack, however a newer stack is available.
remote: To upgrade to Heroku-22, see:
remote: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/my-dialog-one.git
   6342203b..f36589c2  master -> master

mpipkorn@Cherwin:~/rails_projects/release/dialog_one$ heroku logs --tail
 ›   Warning: heroku update available from 7.60.1 to 7.66.2.
2023-01-09T21:33:26.326596+00:00 app[worker.1]: ** [NewRelic][2023-01-09 21:33:26 +0000 worker.1 (4)] INFO : Finished instrumentation
2023-01-09T21:33:26.531902+00:00 app[worker.1]: ** [NewRelic][2023-01-09 21:33:26 +0000 worker.1 (4)] INFO : Reporting to: https://rpm.newrelic.com/accounts/1110950/applications/9340224
2023-01-09T21:33:27.159431+00:00 app[worker.1]: []
2023-01-09T21:33:27.590128+00:00 app[web.1]: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:27.590180+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Starting the New Relic agent version 8.14.0 in "production" environment.
2023-01-09T21:33:27.590185+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the "production" section of your newrelic.yml.
2023-01-09T21:33:27.590186+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Reading configuration from config/newrelic.yml (/app)
2023-01-09T21:33:27.590187+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Environment: production
2023-01-09T21:33:27.590187+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Dispatcher: puma
2023-01-09T21:33:27.590187+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Application: My Application
2023-01-09T21:33:27.590188+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Deferring startup of agent reporting thread because puma may fork.
2023-01-09T21:33:27.590188+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing ActiveJob instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notifications based Active Record instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing ActiveStorage instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing ActiveSupport::Logger instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported ActiveSupportLogger instrumentation using Prepend
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Curb instrumentation
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Easy instrumentation using Prepend
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Multi instrumentation using Prepend
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing middleware-based Excon instrumentation
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Logger instrumentation
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Logger instrumentation using Prepend
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Net:HTTP Wrappers
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported NetHTTP instrumentation using MethodChaining
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported URLMap instrumentation using Prepend
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Rails 3+ middleware instrumentation
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Redis Instrumentation
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Redis instrumentation using Prepend
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Sidekiq instrumentation
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Thread Instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported MonitoredThread instrumentation using Prepend
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Tilt instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Tilt instrumentation using Prepend
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notifications based Action Cable instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notifications based Action Controller instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notification based Action View instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Finished instrumentation
2023-01-09T21:33:27.590195+00:00 app[web.1]: []
2023-01-09T21:33:27.590195+00:00 app[web.1]: [4] ! Unable to load application: SystemExit: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:27.728183+00:00 heroku[web.1]: Process exited with status 1
2023-01-09T21:33:27.796943+00:00 heroku[web.1]: State changed from starting to crashed
2023-01-09T21:33:27.826762+00:00 app[worker.1]: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:27.827042+00:00 app[worker.1]: ** [NewRelic][2023-01-09 21:33:27 +0000 worker.1 (4)] INFO : Starting Agent shutdown
2023-01-09T21:33:28.141879+00:00 heroku[worker.1]: Process exited with status 1
2023-01-09T21:33:28.187020+00:00 heroku[worker.1]: State changed from up to crashed
2023-01-09T21:33:41.000000+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_BLACK addon=postgresql-slippery-1471 sample#current_transaction=128271 sample#db_size=64830599bytes sample#tables=105 sample#active-connections=11 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99984 sample#table-cache-hit-rate=0.99997 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.22449 sample#tmp-disk-used=543600640 sample#tmp-disk-available=72435191808 sample#memory-total=8038316kB sample#memory-free=2287912kB sample#memory-cached=4691872kB sample#memory-postgres=22348kB sample#wal-percentage-used=0.06502552817748675
2023-01-09T21:33:43.895111+00:00 heroku[web.2]: Starting process with command `bundle exec puma -C config/puma.rb`
2023-01-09T21:33:45.101204+00:00 app[web.2]: [4] Puma starting in cluster mode...
2023-01-09T21:33:45.101232+00:00 app[web.2]: [4] * Puma version: 6.0.2 (ruby 3.0.5-p211) ("Sunflower")
2023-01-09T21:33:45.101232+00:00 app[web.2]: [4] *  Min threads: 1
2023-01-09T21:33:45.101234+00:00 app[web.2]: [4] *  Max threads: 1
2023-01-09T21:33:45.101251+00:00 app[web.2]: [4] *  Environment: production
2023-01-09T21:33:45.101268+00:00 app[web.2]: [4] *   Master PID: 4
2023-01-09T21:33:45.101283+00:00 app[web.2]: [4] *      Workers: 2
2023-01-09T21:33:45.101306+00:00 app[web.2]: [4] *     Restarts: (✔) hot (✖) phased
2023-01-09T21:33:45.101320+00:00 app[web.2]: [4] * Preloading application
2023-01-09T21:33:49.857555+00:00 app[web.2]: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:49.857628+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Starting the New Relic agent version 8.14.0 in "production" environment.
2023-01-09T21:33:49.857628+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the "production" section of your newrelic.yml.
2023-01-09T21:33:49.857629+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Reading configuration from config/newrelic.yml (/app)
2023-01-09T21:33:49.857629+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Environment: production
2023-01-09T21:33:49.857629+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Dispatcher: puma
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Application: My Application
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Deferring startup of agent reporting thread because puma may fork.
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing ActiveJob instrumentation
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notifications based Active Record instrumentation
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing ActiveStorage instrumentation
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing ActiveSupport::Logger instrumentation
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported ActiveSupportLogger instrumentation using Prepend
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Curb instrumentation
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Easy instrumentation using Prepend
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Multi instrumentation using Prepend
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing middleware-based Excon instrumentation
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Logger instrumentation
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Logger instrumentation using Prepend
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Net:HTTP Wrappers
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported NetHTTP instrumentation using MethodChaining
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported URLMap instrumentation using Prepend
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Rails 3+ middleware instrumentation
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Redis Instrumentation
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Redis instrumentation using Prepend
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Sidekiq instrumentation
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Thread Instrumentation
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported MonitoredThread instrumentation using Prepend
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Tilt instrumentation
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Tilt instrumentation using Prepend
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notifications based Action Cable instrumentation
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notifications based Action Controller instrumentation
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notification based Action View instrumentation
2023-01-09T21:33:49.857637+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Finished instrumentation
2023-01-09T21:33:49.857637+00:00 app[web.2]: []
2023-01-09T21:33:49.857637+00:00 app[web.2]: [4] ! Unable to load application: SystemExit: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:50.017411+00:00 heroku[web.2]: Process exited with status 1
2023-01-09T21:33:50.082930+00:00 heroku[web.2]: State changed from starting to crashed
2023-01-09T21:33:51.411767+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/orders/8632?locale=en" host=my.dialog-one.com request_id=63af2bae-541c-4112-9f59-916b39522969 fwd="63.228.0.79" dyno= connect= service= status=503 bytes= protocol=https
2023-01-09T21:33:51.605410+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=my.dialog-one.com request_id=9734b43e-cb6e-47d8-b2a4-d0d2e1a33363 fwd="63.228.0.79" dyno= connect= service= status=503 bytes= protocol=https
</code>```

Body:
I've updated my application from Ruby 2.7.7 to Ruby 3.0.5 and from Rails 5.2.0 to Rails 6.0.1.

After updating various Gems and fixing a variety of things I have it running well on my test server but when I try to load the new version on Heroku I get 'Detecting rails configuration failed' and it won't run.  I'm guessing there's something in the configuration files that needs to be updated but I need some guidance on where to look next.

Here's the last part of the Heroku build (where it appears to deploy it) followed by the tail from the logs.

remote:        Cleaning assets
remote:        Running: rake assets:clean
remote:        I, [2023-01-09T21:32:10.786716 #2870]  INFO -- : Removed bootstrap_and_overrides-f7c23a19b2ec05622b15f940ca67f253265408eb4a2f3ca660f5b033ad48e245.css
remote:        I, [2023-01-09T21:32:10.788253 #2870]  INFO -- : Removed application-1010b7967d5a1017bdba8493f3b3d3e9075bc5b424b558ecabd87213398cd92f.css
remote:        I, [2023-01-09T21:32:10.789685 #2870]  INFO -- : Removed agents-5caf8c2fd005858f766d149bf7d2aa8be7855a86b0193a5a1fbb896a228ab4b2.js
remote:        I, [2023-01-09T21:32:10.791267 #2870]  INFO -- : Removed orders-23fa71cb39213c229aeafcb3a7c1c1ba59ce53eb852dfa5cf0144e4e70b24b97.js
remote:        I, [2023-01-09T21:32:10.792582 #2870]  INFO -- : Removed application-0050256351ac4c8249013d67374531282699b38524ebd667a3414ee861d5676d.js
remote: -----> Detecting rails configuration
remote:
remote: ###### WARNING:
remote:
remote:        Detecting rails configuration failed
remote:        set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
remote:
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> web, worker
remote:        Default types for buildpack -> console, rake
remote:
remote: -----> Compressing...
remote:        Done: 115M
remote: -----> Launching...
remote:        Released v1027
remote:        https://my-dialog-one.herokuapp.com/ deployed to Heroku
remote:
remote: This app is using the Heroku-20 stack, however a newer stack is available.
remote: To upgrade to Heroku-22, see:
remote: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/my-dialog-one.git
   6342203b..f36589c2  master -> master

mpipkorn@Cherwin:~/rails_projects/release/dialog_one$ heroku logs --tail
 ›   Warning: heroku update available from 7.60.1 to 7.66.2.
2023-01-09T21:33:26.326596+00:00 app[worker.1]: ** [NewRelic][2023-01-09 21:33:26 +0000 worker.1 (4)] INFO : Finished instrumentation
2023-01-09T21:33:26.531902+00:00 app[worker.1]: ** [NewRelic][2023-01-09 21:33:26 +0000 worker.1 (4)] INFO : Reporting to: https://rpm.newrelic.com/accounts/1110950/applications/9340224
2023-01-09T21:33:27.159431+00:00 app[worker.1]: []
2023-01-09T21:33:27.590128+00:00 app[web.1]: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:27.590180+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Starting the New Relic agent version 8.14.0 in "production" environment.
2023-01-09T21:33:27.590185+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the "production" section of your newrelic.yml.
2023-01-09T21:33:27.590186+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Reading configuration from config/newrelic.yml (/app)
2023-01-09T21:33:27.590187+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Environment: production
2023-01-09T21:33:27.590187+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Dispatcher: puma
2023-01-09T21:33:27.590187+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Application: My Application
2023-01-09T21:33:27.590188+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Deferring startup of agent reporting thread because puma may fork.
2023-01-09T21:33:27.590188+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing ActiveJob instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notifications based Active Record instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing ActiveStorage instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing ActiveSupport::Logger instrumentation
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported ActiveSupportLogger instrumentation using Prepend
2023-01-09T21:33:27.590189+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Curb instrumentation
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Easy instrumentation using Prepend
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Multi instrumentation using Prepend
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing middleware-based Excon instrumentation
2023-01-09T21:33:27.590190+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Logger instrumentation
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Logger instrumentation using Prepend
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Net:HTTP Wrappers
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported NetHTTP instrumentation using MethodChaining
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:27.590191+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported URLMap instrumentation using Prepend
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Rails 3+ middleware instrumentation
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Redis Instrumentation
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Redis instrumentation using Prepend
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Sidekiq instrumentation
2023-01-09T21:33:27.590192+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Thread Instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported MonitoredThread instrumentation using Prepend
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing Tilt instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing New Relic supported Tilt instrumentation using Prepend
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notifications based Action Cable instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notifications based Action Controller instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Installing notification based Action View instrumentation
2023-01-09T21:33:27.590193+00:00 app[web.1]: ** [NewRelic][2023-01-09 21:33:25 +0000 web.1 (4)] INFO : Finished instrumentation
2023-01-09T21:33:27.590195+00:00 app[web.1]: []
2023-01-09T21:33:27.590195+00:00 app[web.1]: [4] ! Unable to load application: SystemExit: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:27.728183+00:00 heroku[web.1]: Process exited with status 1
2023-01-09T21:33:27.796943+00:00 heroku[web.1]: State changed from starting to crashed
2023-01-09T21:33:27.826762+00:00 app[worker.1]: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:27.827042+00:00 app[worker.1]: ** [NewRelic][2023-01-09 21:33:27 +0000 worker.1 (4)] INFO : Starting Agent shutdown
2023-01-09T21:33:28.141879+00:00 heroku[worker.1]: Process exited with status 1
2023-01-09T21:33:28.187020+00:00 heroku[worker.1]: State changed from up to crashed
2023-01-09T21:33:41.000000+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_BLACK addon=postgresql-slippery-1471 sample#current_transaction=128271 sample#db_size=64830599bytes sample#tables=105 sample#active-connections=11 sample#waiting-connections=0 sample#index-cache-hit-rate=0.99984 sample#table-cache-hit-rate=0.99997 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.22449 sample#tmp-disk-used=543600640 sample#tmp-disk-available=72435191808 sample#memory-total=8038316kB sample#memory-free=2287912kB sample#memory-cached=4691872kB sample#memory-postgres=22348kB sample#wal-percentage-used=0.06502552817748675
2023-01-09T21:33:43.895111+00:00 heroku[web.2]: Starting process with command `bundle exec puma -C config/puma.rb`
2023-01-09T21:33:45.101204+00:00 app[web.2]: [4] Puma starting in cluster mode...
2023-01-09T21:33:45.101232+00:00 app[web.2]: [4] * Puma version: 6.0.2 (ruby 3.0.5-p211) ("Sunflower")
2023-01-09T21:33:45.101232+00:00 app[web.2]: [4] *  Min threads: 1
2023-01-09T21:33:45.101234+00:00 app[web.2]: [4] *  Max threads: 1
2023-01-09T21:33:45.101251+00:00 app[web.2]: [4] *  Environment: production
2023-01-09T21:33:45.101268+00:00 app[web.2]: [4] *   Master PID: 4
2023-01-09T21:33:45.101283+00:00 app[web.2]: [4] *      Workers: 2
2023-01-09T21:33:45.101306+00:00 app[web.2]: [4] *     Restarts: (✔) hot (✖) phased
2023-01-09T21:33:45.101320+00:00 app[web.2]: [4] * Preloading application
2023-01-09T21:33:49.857555+00:00 app[web.2]: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:49.857628+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Starting the New Relic agent version 8.14.0 in "production" environment.
2023-01-09T21:33:49.857628+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the "production" section of your newrelic.yml.
2023-01-09T21:33:49.857629+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Reading configuration from config/newrelic.yml (/app)
2023-01-09T21:33:49.857629+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Environment: production
2023-01-09T21:33:49.857629+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Dispatcher: puma
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Application: My Application
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Deferring startup of agent reporting thread because puma may fork.
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing ActiveJob instrumentation
2023-01-09T21:33:49.857630+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notifications based Active Record instrumentation
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing ActiveStorage instrumentation
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing ActiveSupport::Logger instrumentation
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported ActiveSupportLogger instrumentation using Prepend
2023-01-09T21:33:49.857631+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Curb instrumentation
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Easy instrumentation using Prepend
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Multi instrumentation using Prepend
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing middleware-based Excon instrumentation
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Logger instrumentation
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Logger instrumentation using Prepend
2023-01-09T21:33:49.857632+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Net:HTTP Wrappers
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported NetHTTP instrumentation using MethodChaining
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Rack instrumentation using Prepend
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported URLMap instrumentation using Prepend
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Rails 3+ middleware instrumentation
2023-01-09T21:33:49.857633+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Redis Instrumentation
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Redis instrumentation using Prepend
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Sidekiq instrumentation
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Thread Instrumentation
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported MonitoredThread instrumentation using Prepend
2023-01-09T21:33:49.857634+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing Tilt instrumentation
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing New Relic supported Tilt instrumentation using Prepend
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notifications based Action Cable instrumentation
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notifications based Action Controller instrumentation
2023-01-09T21:33:49.857636+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Installing notification based Action View instrumentation
2023-01-09T21:33:49.857637+00:00 app[web.2]: ** [NewRelic][2023-01-09 21:33:48 +0000 web.2 (4)] INFO : Finished instrumentation
2023-01-09T21:33:49.857637+00:00 app[web.2]: []
2023-01-09T21:33:49.857637+00:00 app[web.2]: [4] ! Unable to load application: SystemExit: Abort testing: Your Rails environment is running in production mode!
2023-01-09T21:33:50.017411+00:00 heroku[web.2]: Process exited with status 1
2023-01-09T21:33:50.082930+00:00 heroku[web.2]: State changed from starting to crashed
2023-01-09T21:33:51.411767+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/orders/8632?locale=en" host=my.dialog-one.com request_id=63af2bae-541c-4112-9f59-916b39522969 fwd="63.228.0.79" dyno= connect= service= status=503 bytes= protocol=https
2023-01-09T21:33:51.605410+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=my.dialog-one.com request_id=9734b43e-cb6e-47d8-b2a4-d0d2e1a33363 fwd="63.228.0.79" dyno= connect= service= status=503 bytes= protocol=https


来源: stackexchange

问:
How to use the certificate from the NSS database in CURL from the PHP file?
I have a pfx certificate which dosent work with curl command. Than I am try to import this file to NSS DB and after this curl command from terminal will work, but i can’t figure out how to add this certificate to curl in php file.

import certificate to NSS DB

```<code>pk12util -i key.pfx -d sql:/etc/pki/nssdb
certutil -L -d sql:/etc/pki/nssdb

</code>```

"pfx-key" is the cert name in NSS DB "password" is the password when importing certificate to NSS DB

```<code>curl --cert pfx-key:password --location --request POST 'https://example.com' --header 'Content-Type: application/json' --data '{}'
</code>```

this command works

but how make it works from code?

curl

```<code>        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-type: application/json']);

        curl_setopt($ch, CURLOPT_URL, 'https://example.com');

        curl_setopt($ch, CURLOPT_SSLCERT, 'pfx-key');
        curl_setopt($ch, CURLOPT_SSLKEY, 'pfx-key');
        curl_setopt($ch, CURLOPT_KEYPASSWD, 'password');

        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        if (! $result = curl_exec($ch)) {
           var_dump(curl_error($ch));
        }

        curl_close($ch);
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a pfx certificate which dosent work with curl command. Than I am try to import this file to NSS DB and after this curl command from terminal will work, but i can’t figure out how to add this certificate to curl in php file.

import certificate to NSS DB

pk12util -i key.pfx -d sql:/etc/pki/nssdb
certutil -L -d sql:/etc/pki/nssdb

"pfx-key" is the cert name in NSS DB "password" is the password when importing certificate to NSS DB

curl --cert pfx-key:password --location --request POST 'https://example.com' --header 'Content-Type: application/json' --data '{}'

this command works

but how make it works from code?

curl

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-type: application/json']);

        curl_setopt($ch, CURLOPT_URL, 'https://example.com');

        curl_setopt($ch, CURLOPT_SSLCERT, 'pfx-key');
        curl_setopt($ch, CURLOPT_SSLKEY, 'pfx-key');
        curl_setopt($ch, CURLOPT_KEYPASSWD, 'password');

        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        if (! $result = curl_exec($ch)) {
           var_dump(curl_error($ch));
        }

        curl_close($ch);


问:
CS0103 Error on some obviously in-scope variables - .NET Forms
Below is a small code snippet from a large C# Forms application.  This and all the other code in the application has worked properly through numerous iterations of VS and still does with the latest version of VS2022 Community.

In the past I have been able to view the values of any variables in the program by breakpointing with them in scope then hovering over them or putting them in the watch list.  However, I can no longer do this for a large percentage of them.  Instead, the hover shows nothing and a CS0103 error shows in the watch list.

For example, when I breakpoint on the "if (indexOfItem > -1)" line of the code below the only variables that can be hovered or do not produce a CS0103 watch error are regex_MatchNameForDirectory, SectionInfos, comboBox_Sections, and comboBox_Sections.SelectedIndex, yet the code itself works perfectly.  I don't know when this issue started but I assume it was due to some configuration change or VS update.

I have searched the Web and this site for this issue but still have not been able to resolve it.

```<code>     Match m = regex_MatchNameForDirectory.Match(Settings.Default.SelectedSection);
     if (m.Success)
     {
        string sectionKey = m.Groups["sectionID"].Value;
        if (SectionInfos.ContainsKey(sectionKey))
        {
           string nameInComboBox = SectionInfos[sectionKey].NameForDirectory;
           int indexOfItem = comboBox_Sections.FindStringExact(nameInComboBox);
           if (indexOfItem > -1)
              comboBox_Sections.SelectedIndex = indexOfItem;
        }
     }
</code>```

Body:
Below is a small code snippet from a large C# Forms application.  This and all the other code in the application has worked properly through numerous iterations of VS and still does with the latest version of VS2022 Community.

In the past I have been able to view the values of any variables in the program by breakpointing with them in scope then hovering over them or putting them in the watch list.  However, I can no longer do this for a large percentage of them.  Instead, the hover shows nothing and a CS0103 error shows in the watch list.

For example, when I breakpoint on the "if (indexOfItem > -1)" line of the code below the only variables that can be hovered or do not produce a CS0103 watch error are regex_MatchNameForDirectory, SectionInfos, comboBox_Sections, and comboBox_Sections.SelectedIndex, yet the code itself works perfectly.  I don't know when this issue started but I assume it was due to some configuration change or VS update.

I have searched the Web and this site for this issue but still have not been able to resolve it.

     Match m = regex_MatchNameForDirectory.Match(Settings.Default.SelectedSection);
     if (m.Success)
     {
        string sectionKey = m.Groups["sectionID"].Value;
        if (SectionInfos.ContainsKey(sectionKey))
        {
           string nameInComboBox = SectionInfos[sectionKey].NameForDirectory;
           int indexOfItem = comboBox_Sections.FindStringExact(nameInComboBox);
           if (indexOfItem > -1)
              comboBox_Sections.SelectedIndex = indexOfItem;
        }
     }


问:
Im new to this and I think I created a nice piece of code but has to many errors trying to create an indicator based off my strategy
This is the code I created:

```<code>//@version=5

// This variable stores the length of the EMAs
length = input(32, "EMA Length")

// These variables store the values of the EMAs
closeEma = ema(input(close, "Close Source"), length)
lowEma = ema(input(low, "Low Source"), length)
highEma = ema(input(high, "High Source"), length)

// This variable stores the value of the previous close
prevClose = close[1]

// This variable stores the percentage required for a bullish rejection candle
bullishRejectionPct = input(40, "Bullish Rejection Candle Percentage")

// This condition checks if the current candle comes from above all 3 EMAs
// and rejects off the 32, close or 32, low EMAs with a bullish candle
// that closes at least the required percentage larger than the previous candle
if close > highEma and close > lowEma and close < closeEma and close > prevClose and close / prevClose > (100 + bullishRejectionPct) / 100
    // If the condition is true, it plots a visual on screen green arrow
    plotarrow(high, "Bullish Rejection", color=color.green)
    // It also sets an alert to the indicator
    alert("Bullish rejection detected")

// This variable stores the percentage required for a bearish rejection candle
bearishRejectionPct = input(40, "Bearish Rejection Candle Percentage")

// This condition checks if the current candle comes from below all 3 EMAs
// and rejects off the 32, close or 32, high EMAs with a bearish candle
// that closes at least the required percentage larger than the previous candle
if close < highEma and close < lowEma and close > closeEma and close < prevClose and prevClose / close > (100 + bearishRejectionPct) / 100
    // If the condition is true, it plots a visual on screen red arrow
    plotarrow(low, "Bearish Rejection", color=color.red)
    // It also sets an alert to the indicator
    alert("Bearish rejection detected")
</code>```

What I shooting for it this. This code creates three exponential moving averages (EMAs) with a user-specified length and source. It then checks if the current candle has a close price that is above the high EMA and the low EMA, but below the close EMA, and if it is at least a user-specified percentage larger than the previous candle's close price. If these conditions are all true, the code plots a green arrow on the chart and sets an alert to the indicator.

The code also checks if the current candle has a close price that is below the high EMA and the low EMA, but above the close EMA, and if it is at least a user-specified percentage smaller than the previous candle's close price. If these conditions are all true, the code plots a red arrow on the chart and sets an alert to the indicator.

In the settings of the indicator, the user can change the EMA style, color, length, and source, as well as the percentage of the bullish and bearish rejection candles. The color. prefix is used to access the color functions.

Im trying to be clear as possible I have a background in only html and css so this is a whole new ball game for me. And I keep getting allot of Could not find function or function reference errors and Undeclared identifier errors.

Body:
This is the code I created:

//@version=5

// This variable stores the length of the EMAs
length = input(32, "EMA Length")

// These variables store the values of the EMAs
closeEma = ema(input(close, "Close Source"), length)
lowEma = ema(input(low, "Low Source"), length)
highEma = ema(input(high, "High Source"), length)

// This variable stores the value of the previous close
prevClose = close[1]

// This variable stores the percentage required for a bullish rejection candle
bullishRejectionPct = input(40, "Bullish Rejection Candle Percentage")

// This condition checks if the current candle comes from above all 3 EMAs
// and rejects off the 32, close or 32, low EMAs with a bullish candle
// that closes at least the required percentage larger than the previous candle
if close > highEma and close > lowEma and close < closeEma and close > prevClose and close / prevClose > (100 + bullishRejectionPct) / 100
    // If the condition is true, it plots a visual on screen green arrow
    plotarrow(high, "Bullish Rejection", color=color.green)
    // It also sets an alert to the indicator
    alert("Bullish rejection detected")

// This variable stores the percentage required for a bearish rejection candle
bearishRejectionPct = input(40, "Bearish Rejection Candle Percentage")

// This condition checks if the current candle comes from below all 3 EMAs
// and rejects off the 32, close or 32, high EMAs with a bearish candle
// that closes at least the required percentage larger than the previous candle
if close < highEma and close < lowEma and close > closeEma and close < prevClose and prevClose / close > (100 + bearishRejectionPct) / 100
    // If the condition is true, it plots a visual on screen red arrow
    plotarrow(low, "Bearish Rejection", color=color.red)
    // It also sets an alert to the indicator
    alert("Bearish rejection detected")

What I shooting for it this. This code creates three exponential moving averages (EMAs) with a user-specified length and source. It then checks if the current candle has a close price that is above the high EMA and the low EMA, but below the close EMA, and if it is at least a user-specified percentage larger than the previous candle's close price. If these conditions are all true, the code plots a green arrow on the chart and sets an alert to the indicator.

The code also checks if the current candle has a close price that is below the high EMA and the low EMA, but above the close EMA, and if it is at least a user-specified percentage smaller than the previous candle's close price. If these conditions are all true, the code plots a red arrow on the chart and sets an alert to the indicator.

In the settings of the indicator, the user can change the EMA style, color, length, and source, as well as the percentage of the bullish and bearish rejection candles. The color. prefix is used to access the color functions.

Im trying to be clear as possible I have a background in only html and css so this is a whole new ball game for me. And I keep getting allot of Could not find function or function reference errors and Undeclared identifier errors.


问:
Resampling Data by daily mean

I have an excel file with timeseries data of discharge for various locations, but some years are missing in between, for example, I could have 1983-1985 for a station, then 1990 again, and so on. I intend to create a model, but the input required is an average daily discharge, i.e. for a station with two years or more of data, I need to create a pandas with average rainfall values for each day. To be more specific, if I have data from 1983, 1984, and 1985. I'll have one pandas with average rainfall from January 1st to December 31st.

I tried this simple formula: df avg = df.resample('D').mean(), but it did not return the desired result.

For example if I have:
Date        |  Discharge
01/01/1990  |  15
till
31/12/2015  |  20 (as shown in first image 1)

But in between, there could be missing days, months or even years, I now need just one pandas with 366 rows (to accomodate leap years) now that will take the average of each day for all the available years and return it, e.g.
Date    |  Avg Discharge
Jan 1st |   16           As shown in the second image 2

Title: Resampling Data by daily mean


问:
Firebase DB Query with Await in Swift
I am trying to query my realtime database using async/await architecture but am getting some errors. I was able to using async/await without query but for some reason the query is throwing this error:

```<code>ERROR: Error Domain=com.firebase.core Code=1 "Unable to get latest value for query FQuerySpec (path: /PromoCodes, params: {
    ep = JASON;
    i = code;
    sp = JASON;
}), client offline with no active listeners and no matching disk cache entries" UserInfo={NSLocalizedFailureReason=Index not defined, add ".indexOn": "code", for path "/PromoCodes", to the rules, NSLocalizedDescription=Unable to get latest value for query FQuerySpec (path: /PromoCodes, params: {
    ep = JASON;
    i = code;
    sp = JASON;
}), client offline with no active listeners and no matching disk cache entries}
</code>```

from this code:

let data = try await promoCodes.queryOrdered(byChild: "code").queryEqual(toValue: code.code.uppercased()).getData()

Title: Firebase DB Query with Await in Swift

Body:
I am trying to query my realtime database using async/await architecture but am getting some errors. I was able to using async/await without query but for some reason the query is throwing this error:

ERROR: Error Domain=com.firebase.core Code=1 "Unable to get latest value for query FQuerySpec (path: /PromoCodes, params: {
    ep = JASON;
    i = code;
    sp = JASON;
}), client offline with no active listeners and no matching disk cache entries" UserInfo={NSLocalizedFailureReason=Index not defined, add ".indexOn": "code", for path "/PromoCodes", to the rules, NSLocalizedDescription=Unable to get latest value for query FQuerySpec (path: /PromoCodes, params: {
    ep = JASON;
    i = code;
    sp = JASON;
}), client offline with no active listeners and no matching disk cache entries}

from this code:

let data = try await promoCodes.queryOrdered(byChild: "code").queryEqual(toValue: code.code.uppercased()).getData()


问:
Error between view and controller which I can not find
Today I found a problem in my app and have not found a solution yet.

The problem is, I have a view with a form where records you have previously selected, then need to select a new state to then update the records, but I get the error when I run the submit button . ERR_TOO_MANY_REDIRECTS.

I don't see the problem but I think it's something simple I'm missing.

I already tried delete browser cache and route cache.

```<code>// this is the form
<form action="{{ route('handovers.updateData') }}" method="POST">
@csrf
<table class="table">

    <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Handover Date</th>
        <th>Inventory Number</th>
        <th>Model</th>
        <th>Choose a status</th>

    </tr>

    @foreach($handovers as $handover)
        <tr>
            <input type="hidden" name="handoversid[]" value="{{ $handover->id }}">
            <td>{{ $handover->employee->Firstname }}</td>
            <td>{{ $handover->employee->Surname }}</td>
            <td>{{  date('d.m.Y', strtotime($handover->Handover_Date)) }}</td>
            <td><a href=" {{ route('devices.edit', $handover->Device_id ) }}">{{$handover->device->Inventory_id }}</a></td>
            <td>{{ $handover->device->devicemodel->Model }}</td>
            <td> <select name="ddStatus[]">
                    <option value="default">Select a Status</option>
                    @foreach($availableStatuses as $avStatus)
                        <option value="{{ $avStatus->id }}"> {{ $avStatus->Status_Name }} </option>
                    @endforeach
                </select></td>
        </tr>
  @endforeach
</table>
    <button type="submit">Confirm</button>
<a href="{{ route('activeHandovers') }}" ><button type="button">Cancel</button></a>
</form>

<form action="{{ route('handovers.pdf') }}" method="POST" target="_blank">
    @csrf
    <input type="hidden" name="handovers" value="{{ $handovers }}">
    <button type="submit">Download PDF</button>
</form>

</code>```

web.php

```<code>Route::get('/admin/handovers/offboarding', [HandoverController::class,'getActiveHandovers'])->name('activeHandovers');
Route::get('admin/handovers/search', [HandoverController::class,'search'])->name('handovers.search');
Route::post('admin/handovers/offboarding/selected', [HandoverController::class,'offboarding'])->name('handovers.selected');
Route::get('admin/handovers/offboarding/selected', [HandoverController::class, 'offboarding'])->name('selectedReturns');

Route::post('admin/handovers/updateData', [HandoverController::class, 'updateData'])->name('handovers.updateData');

Route::post('admin/handovers/offboarding/pdf', [PDFController::Class, 'generatePDF'])->name('handovers.pdf');

Route::Resources([
    'devices' => DeviceController::class,
    'admin/types' => TypeController::class,
    'admin/locations' => LocationController::class,
    'admin/devicemodels' => DevicemodelController::class,
    'admin/handovers' => HandoverController::class
]);
</code>```

HandoverController@updateData

```<code>public function updateData(HandoverFormDataRequest $request)
    {
        /* does not work properly
        $request->validate([
            'ddStatus.*' => 'required|not_in:default',
        ]);*/

        $handovers = $request->input('handoversid');
        $statuses = $request->input('ddStatus');

        for ($i = 0; $i < count($handovers); $i++) {
            $handover = Handover::find($handovers[$i]);
            $status = $statuses[$i];

            Device::where('id',$handover->Device_id)->update([
                'Status_id' => $status
            ]);

            $handover->update([
                'Return_Date' => Carbon::now()
            ]);
        }

        return redirect()->route('activeHandovers')->with('success', 'The devices were successfully returned or moved to the offboarding');
    }
</code>```

Body:
Today I found a problem in my app and have not found a solution yet.

The problem is, I have a view with a form where records you have previously selected, then need to select a new state to then update the records, but I get the error when I run the submit button . ERR_TOO_MANY_REDIRECTS.

I don't see the problem but I think it's something simple I'm missing.

I already tried delete browser cache and route cache.

// this is the form
<form action="{{ route('handovers.updateData') }}" method="POST">
@csrf

        Firstname
        Lastname
        Handover Date
        Inventory Number
        Model
        Choose a status

    @foreach($handovers as $handover)

            <input type="hidden" name="handoversid[]" value="{{ $handover->id }}">
            {{ $handover->employee->Firstname }}
            {{ $handover->employee->Surname }}
            {{  date('d.m.Y', strtotime($handover->Handover_Date)) }}
            Device_id ) }}">{{$handover->device->Inventory_id }}
            {{ $handover->device->devicemodel->Model }}
             <select name="ddStatus[]">
                    <option value="default">Select a Status</option>
                    @foreach($availableStatuses as $avStatus)
                        <option value="{{ $avStatus->id }}"> {{ $avStatus->Status_Name }} </option>
                    @endforeach
                </select>

  @endforeach

    <button type="submit">Confirm</button>
<button type="button">Cancel</button>
</form>

<form action="{{ route('handovers.pdf') }}" method="POST" target="_blank">
    @csrf
    <input type="hidden" name="handovers" value="{{ $handovers }}">
    <button type="submit">Download PDF</button>
</form>

web.php

Route::get('/admin/handovers/offboarding', [HandoverController::class,'getActiveHandovers'])->name('activeHandovers');
Route::get('admin/handovers/search', [HandoverController::class,'search'])->name('handovers.search');
Route::post('admin/handovers/offboarding/selected', [HandoverController::class,'offboarding'])->name('handovers.selected');
Route::get('admin/handovers/offboarding/selected', [HandoverController::class, 'offboarding'])->name('selectedReturns');

Route::post('admin/handovers/updateData', [HandoverController::class, 'updateData'])->name('handovers.updateData');

Route::post('admin/handovers/offboarding/pdf', [PDFController::Class, 'generatePDF'])->name('handovers.pdf');

Route::Resources([
    'devices' => DeviceController::class,
    'admin/types' => TypeController::class,
    'admin/locations' => LocationController::class,
    'admin/devicemodels' => DevicemodelController::class,
    'admin/handovers' => HandoverController::class
]);

HandoverController@updateData

public function updateData(HandoverFormDataRequest $request)
    {
        /* does not work properly
        $request->validate([
            'ddStatus.*' => 'required|not_in:default',
        ]);*/

        $handovers = $request->input('handoversid');
        $statuses = $request->input('ddStatus');

        for ($i = 0; $i < count($handovers); $i++) {
            $handover = Handover::find($handovers[$i]);
            $status = $statuses[$i];

            Device::where('id',$handover->Device_id)->update([
                'Status_id' => $status
            ]);

            $handover->update([
                'Return_Date' => Carbon::now()
            ]);
        }

        return redirect()->route('activeHandovers')->with('success', 'The devices were successfully returned or moved to the offboarding');
    }


问:
Nginx server block doesn't work on Digital Ocean Droplet
I created a fresh Digital Ocean droplet, installed Nginx and I'm trying to set up server blocks and issue SSL certs.

This is my Nginx config:

```<code>user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;
    # server_tokens off;

    server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
#
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}
</code>```

And this is my server block for one site (sierraidle.online):

```<code>server {
    root /var/www/sierraidle.online/html;
    index index.html index.htm index.nginx-debian.html;
    server_name sierraidle.online www.sierraidle.online;

    location / {
        try_files $uri $uri/ =404;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/sierraidle.online/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sierraidle.online/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.sierraidle.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = sierraidle.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name sierraidle.online www.sierraidle.online;
    return 404; # managed by Certbot
}
</code>```

I have run certbot for this domain, and this is the config file it generated, however when I go to that URL, it says could not connect.

I have verified that Nginx is running, the domain points the DO nameservers, the folder sierraidle.online/html exists in the www folder, the domain in DO is pointing to the appropriate server IP, restarted Nginx, given appropriate permissions to a sudo user, opened the 'Nginx Full' rule in the firewall

I can't think of what else could be wrong, right now I'm just trying to display a simple HTML page to verify serverblocks are working.

Thank you

Body:
I created a fresh Digital Ocean droplet, installed Nginx and I'm trying to set up server blocks and issue SSL certs.

This is my Nginx config:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;
    # server_tokens off;

    server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
#
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

And this is my server block for one site (sierraidle.online):

server {
    root /var/www/sierraidle.online/html;
    index index.html index.htm index.nginx-debian.html;
    server_name sierraidle.online www.sierraidle.online;

    location / {
        try_files $uri $uri/ =404;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/sierraidle.online/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sierraidle.online/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.sierraidle.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = sierraidle.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name sierraidle.online www.sierraidle.online;
    return 404; # managed by Certbot
}

I have run certbot for this domain, and this is the config file it generated, however when I go to that URL, it says could not connect.

I have verified that Nginx is running, the domain points the DO nameservers, the folder sierraidle.online/html exists in the www folder, the domain in DO is pointing to the appropriate server IP, restarted Nginx, given appropriate permissions to a sudo user, opened the 'Nginx Full' rule in the firewall

I can't think of what else could be wrong, right now I'm just trying to display a simple HTML page to verify serverblocks are working.

Thank you


问:
AppCheck with Flutter/Firebase - AppCheck failed: 'The operation couldn't be completed.'
Here's the link of the documentation for the issue I'm facing:
https://firebase.google.com/docs/app-check/flutter/debug-provider?hl=en&authuser=0

I'm following the steps to integrate AppCheck to my Flutter/Firebase application. I've already registered DeviceCheck and AppAttest in the Firebase console and now I want to test if everything works correctly during testing/debug. For this, I have to take additional steps which can be found in the link I've shared above.

I've already completed steps 1 & 2 (Apple platforms) and for #3, I'm not very familiar with XCode but this is what I've tried:
Using Visual Studio Code, I've right clicked the 'ios' folder and then clicked on 'Open with XCode'. In XCode, I've simply clicked on 'Product' and then 'Run'. I'm not sure if this was the right thing to do. The documentation says to open ios/Runner.xcworkspace and then run your project but I'm not sure if I've done this step correctly because once the app opens in the simulator, I'm receiving this message:

```<code>AppCheck failed: 'The operation couldn't be completed. (com.apple.devicecheck.error error 1.)
</code>```

If everything works correctly, I should instead receive a token like the example below:

```<code>[Firebase/AppCheck][I-FAA001001] Firebase App Check Debug Token:
123a4567-b89c-12d3-e456-789012345678
</code>```

And here's the code in the main.dart file:

```<code>import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_app_check/firebase_app_check.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await FirebaseAppCheck.instance.activate(
    androidProvider: AndroidProvider.debug,
  );
  runApp(App());
}
</code>```

Body:
Here's the link of the documentation for the issue I'm facing:
https://firebase.google.com/docs/app-check/flutter/debug-provider?hl=en&authuser=0

I'm following the steps to integrate AppCheck to my Flutter/Firebase application. I've already registered DeviceCheck and AppAttest in the Firebase console and now I want to test if everything works correctly during testing/debug. For this, I have to take additional steps which can be found in the link I've shared above.

I've already completed steps 1 & 2 (Apple platforms) and for #3, I'm not very familiar with XCode but this is what I've tried:
Using Visual Studio Code, I've right clicked the 'ios' folder and then clicked on 'Open with XCode'. In XCode, I've simply clicked on 'Product' and then 'Run'. I'm not sure if this was the right thing to do. The documentation says to open ios/Runner.xcworkspace and then run your project but I'm not sure if I've done this step correctly because once the app opens in the simulator, I'm receiving this message:

AppCheck failed: 'The operation couldn't be completed. (com.apple.devicecheck.error error 1.)

If everything works correctly, I should instead receive a token like the example below:

[Firebase/AppCheck][I-FAA001001] Firebase App Check Debug Token:
123a4567-b89c-12d3-e456-789012345678

And here's the code in the main.dart file:

import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_app_check/firebase_app_check.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await FirebaseAppCheck.instance.activate(
    androidProvider: AndroidProvider.debug,
  );
  runApp(App());
}


问:
Repeated stopping and starting the sound by pressing a keyboard key
```<code>def keyPressEvent(self, event):
      if event.key() == Qt.Key_A and not event.modifiers():
        self.buttonC3_pressed()
def keyReleaseEvent(self, event):
    if event.key() == Qt.Key_A and not event.modifiers():
        self.buttonC3_released()
</code>```

these are the functions that let me play the C3 sound when the 'a' key is pressed. Only problem being that when I press 'a' the sound is repeatedly started and stopped instead of playing continious sound. Do you have any idea on how to fix it? thanks!

i tried rewriting the buttonC3_pressed function, but it seams like it's not caused by it.

Body:
def keyPressEvent(self, event):
      if event.key() == Qt.Key_A and not event.modifiers():
        self.buttonC3_pressed()
def keyReleaseEvent(self, event):
    if event.key() == Qt.Key_A and not event.modifiers():
        self.buttonC3_released()

these are the functions that let me play the C3 sound when the 'a' key is pressed. Only problem being that when I press 'a' the sound is repeatedly started and stopped instead of playing continious sound. Do you have any idea on how to fix it? thanks!

i tried rewriting the buttonC3_pressed function, but it seams like it's not caused by it.


问:
GitHub API: find status of required checks on a pull request towards protected branch, which are github actions
Context:

I have a PR 12345 towards protected branch (master)

This branch is set up to require two jobs for merging: one from GitLab CI gitlab/some-required-test, and one from GitHub Action some-required-github-action

Apart from that I have a ton of non-required jobs in each GL and GH. I don't care about those.

I want to check via GitHub API if the PR has passed all required checks only.

This is similar to Get if pull request passed all required status checks using GitHub API but in particular I want to know if the ones from github-actions have passed which seems very complicated.

The ones from GitLab are easy, by querying https://api.github.com/repos/OWNER/REPO/commits/REFNAME/status I get a reasonably shaped response with all necessary info. But it's only having GitLab check, not GitHub actions.

```<code>{
  state: 'pending',
  statuses: [
    {
        state: 'success',
        context: 'gitlab/check-1',
    },
    {
        state: 'pending',
        context: 'gitlab/check-2',
    }
  ]
  ...
}
</code>```

So, first, I figured that by querying an endpoint for branch protections, I can figure out the required checks. So far so good:

```<code>curl https://api.github.com/repos/ORG/REPO/branches/PROTECTED_BRANCH_NAME/protection/required_status_checks

{
    "url": "https://api.github.com/repos/ORG/REPO/branches/PROTECTED_BRANCH_NAME/protection/required_status_checks",
    "strict": false,
    "contexts": [
      "gitlab/some-required-test",
      "some-required-github-action"
    ],
    "contexts_url": "https://api.github.com/repos/ORG/REPO/branches/PROTECTED_BRANCH_NAME/protection/required_status_checks/contexts",
    "checks": [
      {
        "context": "gitlab/some-required-test",
        "app_id": null
      },
      {
        "context": "some-required-github-action",
        "app_id": 15368
      }
    ]
}
</code>```

(app_id 15368 corresponds to "GitHub Actions" app).

Let's now check the status of the checks:

```<code>curl https://api.github.com/repos/ORG/REPO/commits/PR_BRANCH/check-suites

{
  "total_count": 10,
  "check_suites": [{
      "id": 10271137035,
      "node_id": "CS_kwDOCf2-888AAAACZDUdKQ",
      "head_branch": "BRANCHNAME",
      "head_sha": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
      "status": "completed",
      "conclusion": "success",
      "url": "https://api.github.com/repos/OWNER/REPO/check-suites/10271137065",
      "before": "8e579556a3909a0d25dbdd34e6ff0a9535653848",
      "after": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
      "pull_requests": [...],
      "app": {
        "id": 15368,
        "slug": "github-actions",
        "node_id": "MDM6QXBwMTUzNjg=",
        "owner": {
          "login": "github",
          ...
        },
        "name": "GitHub Actions",
        "description": "Automate your workflow from idea to production",
        "external_url": "https://help.github.com/en/actions",
        "html_url": "https://github.com/apps/github-actions",
        "created_at": "2018-07-30T09:30:17Z",
        "updated_at": "2019-12-10T19:04:12Z",
        "permissions": {
          ...
        },
        "events": [
          ...
        ]
      },
      "created_at": "2023-01-09T21:36:29Z",
      "updated_at": "2023-01-09T21:38:16Z",
      "rerequestable": true,
      "runs_rerequestable": false,
      "latest_check_runs_count": 1,
      "check_runs_url": "https://api.github.com/repos/OWNER/REPO/check-suites/10271137035/check-runs",
      "head_commit": {
        "id": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
        "tree_id": "4f341091f31a419915f6d8b70f42febdd115ee2f",
        "message": "COMMIT MESSAGE",
        "timestamp": "2023-01-09T21:36:12Z",
        "author": {...},
        "committer": {...}
      },
      "repository": {...}
  }, ...]
}
</code>```

I get a large array of check_suites but the response is only moderately helpful:
By checking app.id / app.slug + status / conclusion I can see that some GitHub action has completed, but without details whether it is required, and what is its name.

I figured I can check .latest_check_runs_count and if > 0, check check_runs_url:

```<code>curl https://api.github.com/repos/ORG/REPO/check-suites/10271137035/check-runs

{
  "total_count": 1,
  "check_runs": [
    {
      "id": 10536722916,
      "name": "some-required-github-action",
      "node_id": "CR_kwDOCf2-888AAAACdAmh5A",
      "head_sha": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
      "external_id": "373218f8-38be-52de-27db-c87f3616be12",
      "url": "https://api.github.com/repos/ORG/REPO/check-runs/10536722916",
      "html_url": "https://github.com/ORG/REPO/actions/runs/3877963115/jobs/6613591600",
      "details_url": "https://github.com/ORG/REPO/actions/runs/3877963115/jobs/6613591600",
      "status": "completed",
      "conclusion": "success",
      "started_at": "2023-01-09T21:36:38Z",
      "completed_at": "2023-01-09T21:38:14Z",
      "output": {
        "title": null,
        "summary": null,
        "text": null,
        "annotations_count": 0,
        "annotations_url": "https://api.github.com/repos/ORG/REPO/check-runs/10536722916/annotations"
      }
    }
  ]
}
</code>```

Then I can inspect check_runs[i].name and if it's one of required ones obtained earlier, check check_runs[i].status / check_runs[i].conclusion. (In the example, it's "some-required-github-action" which I was looking for)

But for this I have to do N requests, one for each item in .check_suites from previous step where "app.slug": "github-actions".

This sounds very convoluted. Is there a simpler way?

Body:
Context:

I have a PR 12345 towards protected branch (master)

This branch is set up to require two jobs for merging: one from GitLab CI gitlab/some-required-test, and one from GitHub Action some-required-github-action

Apart from that I have a ton of non-required jobs in each GL and GH. I don't care about those.

I want to check via GitHub API if the PR has passed all required checks only.

This is similar to Get if pull request passed all required status checks using GitHub API but in particular I want to know if the ones from github-actions have passed which seems very complicated.

The ones from GitLab are easy, by querying https://api.github.com/repos/OWNER/REPO/commits/REFNAME/status I get a reasonably shaped response with all necessary info. But it's only having GitLab check, not GitHub actions.

{
  state: 'pending',
  statuses: [
    {
        state: 'success',
        context: 'gitlab/check-1',
    },
    {
        state: 'pending',
        context: 'gitlab/check-2',
    }
  ]
  ...
}

So, first, I figured that by querying an endpoint for branch protections, I can figure out the required checks. So far so good:

curl https://api.github.com/repos/ORG/REPO/branches/PROTECTED_BRANCH_NAME/protection/required_status_checks

{
    "url": "https://api.github.com/repos/ORG/REPO/branches/PROTECTED_BRANCH_NAME/protection/required_status_checks",
    "strict": false,
    "contexts": [
      "gitlab/some-required-test",
      "some-required-github-action"
    ],
    "contexts_url": "https://api.github.com/repos/ORG/REPO/branches/PROTECTED_BRANCH_NAME/protection/required_status_checks/contexts",
    "checks": [
      {
        "context": "gitlab/some-required-test",
        "app_id": null
      },
      {
        "context": "some-required-github-action",
        "app_id": 15368
      }
    ]
}

(app_id 15368 corresponds to "GitHub Actions" app).

Let's now check the status of the checks:

curl https://api.github.com/repos/ORG/REPO/commits/PR_BRANCH/check-suites

{
  "total_count": 10,
  "check_suites": [{
      "id": 10271137035,
      "node_id": "CS_kwDOCf2-888AAAACZDUdKQ",
      "head_branch": "BRANCHNAME",
      "head_sha": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
      "status": "completed",
      "conclusion": "success",
      "url": "https://api.github.com/repos/OWNER/REPO/check-suites/10271137065",
      "before": "8e579556a3909a0d25dbdd34e6ff0a9535653848",
      "after": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
      "pull_requests": [...],
      "app": {
        "id": 15368,
        "slug": "github-actions",
        "node_id": "MDM6QXBwMTUzNjg=",
        "owner": {
          "login": "github",
          ...
        },
        "name": "GitHub Actions",
        "description": "Automate your workflow from idea to production",
        "external_url": "https://help.github.com/en/actions",
        "html_url": "https://github.com/apps/github-actions",
        "created_at": "2018-07-30T09:30:17Z",
        "updated_at": "2019-12-10T19:04:12Z",
        "permissions": {
          ...
        },
        "events": [
          ...
        ]
      },
      "created_at": "2023-01-09T21:36:29Z",
      "updated_at": "2023-01-09T21:38:16Z",
      "rerequestable": true,
      "runs_rerequestable": false,
      "latest_check_runs_count": 1,
      "check_runs_url": "https://api.github.com/repos/OWNER/REPO/check-suites/10271137035/check-runs",
      "head_commit": {
        "id": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
        "tree_id": "4f341091f31a419915f6d8b70f42febdd115ee2f",
        "message": "COMMIT MESSAGE",
        "timestamp": "2023-01-09T21:36:12Z",
        "author": {...},
        "committer": {...}
      },
      "repository": {...}
  }, ...]
}

I get a large array of check_suites but the response is only moderately helpful:
By checking app.id / app.slug + status / conclusion I can see that some GitHub action has completed, but without details whether it is required, and what is its name.

I figured I can check .latest_check_runs_count and if > 0, check check_runs_url:

curl https://api.github.com/repos/ORG/REPO/check-suites/10271137035/check-runs

{
  "total_count": 1,
  "check_runs": [
    {
      "id": 10536722916,
      "name": "some-required-github-action",
      "node_id": "CR_kwDOCf2-888AAAACdAmh5A",
      "head_sha": "936b3031077ba7b71e0233fec23783ca0d3ed93e",
      "external_id": "373218f8-38be-52de-27db-c87f3616be12",
      "url": "https://api.github.com/repos/ORG/REPO/check-runs/10536722916",
      "html_url": "https://github.com/ORG/REPO/actions/runs/3877963115/jobs/6613591600",
      "details_url": "https://github.com/ORG/REPO/actions/runs/3877963115/jobs/6613591600",
      "status": "completed",
      "conclusion": "success",
      "started_at": "2023-01-09T21:36:38Z",
      "completed_at": "2023-01-09T21:38:14Z",
      "output": {
        "title": null,
        "summary": null,
        "text": null,
        "annotations_count": 0,
        "annotations_url": "https://api.github.com/repos/ORG/REPO/check-runs/10536722916/annotations"
      }
    }
  ]
}

Then I can inspect check_runs[i].name and if it's one of required ones obtained earlier, check check_runs[i].status / check_runs[i].conclusion. (In the example, it's "some-required-github-action" which I was looking for)

But for this I have to do N requests, one for each item in .check_suites from previous step where "app.slug": "github-actions".

This sounds very convoluted. Is there a simpler way?


问:
Distinct Conditional Group By Month to Quarter : Inclusive or Any?
```<code>select store,fiscalquarter
,count(distinct case when trxcount>=2 then clubno end) as clubcountfreq
,count(distinct clubno ) as clubcountall from(

select
store,clubno,monthname,fiscalquarter, count(distinct trxid) trxcount

from
server.saleslog sh
    left join server.datelookup dd
    on sh.dateid=dd.dateid

where
store in (439,237)
    and
clubno is not null
    and
fiscalquarter between '202201' and '202204'

group by store,clubno, monthname,fiscalquarter
) a

group by store,fiscalquarter
order by store,fiscalquarter asc
</code>```

As the internal function creates a monthly transaction count per customer, the outside function groups these months to the quarter level, will the

```<code>,count(distinct case when trxcount>=2 then clubno end) as clubcountfreq
</code>```

evaluate a customer as included if they are >=2 in all 3 months of the quarter?
or bc there is a 'distinct' outside the 'case when', does it only need to be >=2 in only 1 month?

How would one find 'only if >=2 in all 3 months' from this example?

Pretty sure it's only evaluating as >=2 in a single of the 3 months since it only trims to distinct after the case when is complete.

I'm leaning towards just pulling if their average is 2x+/month, or >=6 total/qtr to avoid having to parse through how to do only >=2/month in all months/qtr. That includes a handful of fringe cases though that could be argued to be useful or biasing depending on the use case.

Body:
select store,fiscalquarter
,count(distinct case when trxcount>=2 then clubno end) as clubcountfreq
,count(distinct clubno ) as clubcountall from(

select
store,clubno,monthname,fiscalquarter, count(distinct trxid) trxcount

from
server.saleslog sh
    left join server.datelookup dd
    on sh.dateid=dd.dateid

where
store in (439,237)
    and
clubno is not null
    and
fiscalquarter between '202201' and '202204'

group by store,clubno, monthname,fiscalquarter
) a

group by store,fiscalquarter
order by store,fiscalquarter asc

As the internal function creates a monthly transaction count per customer, the outside function groups these months to the quarter level, will the

,count(distinct case when trxcount>=2 then clubno end) as clubcountfreq

evaluate a customer as included if they are >=2 in all 3 months of the quarter?
or bc there is a 'distinct' outside the 'case when', does it only need to be >=2 in only 1 month?

How would one find 'only if >=2 in all 3 months' from this example?

Pretty sure it's only evaluating as >=2 in a single of the 3 months since it only trims to distinct after the case when is complete.

I'm leaning towards just pulling if their average is 2x+/month, or >=6 total/qtr to avoid having to parse through how to do only >=2/month in all months/qtr. That includes a handful of fringe cases though that could be argued to be useful or biasing depending on the use case.


问:
Meshlab dialog box font size is unreadable
Font size example

"Simple" problem is that I can't read the text in the dialog boxes...

I have a large monitor, which I expect is part of the problem. Note that the Menu text is fine.

Is there a solution to this other than using a lower resolution monitor?

I was expecting to be able to read the dialog boxes. I've tried changing resolution/monitors.


问:
Websockets with flask/uwsgi/nginx
I have this problem that i'm developing a flask api and need to add just 1 websocket call, i had tried wit 3 different python packages but i had no luck

```<code>from gevent.monkey import patch_all
patch_all()
# pylint: disable=wrong-import-position
from flask_uwsgi_websocket import GeventWebSocket  # noqa: E402
# More imports...
# pylint: enable=wrong-import-position

app = Flask(__name__)
websocket = GeventWebSocket(app)

# A lot of @app.route('/routes')

@websocket.route('/api/websocket/echo')
def echo(w_s):
    """Websocket"""
    print(1)
    print(w_s)
    print(2)
    while True:
        msg = w_s.receive()
        w_s.send(msg)

if __name__ == '__main__':
    app.run(debug=True, threaded=True, gevent=100)
</code>```

That is my flask code that is inside a main.py file

```<code>[uwsgi]

app = main
module = %(app)
callable = app

socket = /tmp/module_name.sock
chdir = /path_to_module
chmod-socket = 666
virtualenv = /path_to_module/venv
enable-threads = true
http-websockets = true

master = true
processes = 1
die-on-term = true
</code>```

That is my config-uwsgi.ini

```<code>server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;
    server_name some.server.com;

    ssl_certificate   /etc/letsencrypt/live/some.server.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/some.server.com/privkey.pem;
    server_tokens off;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/module_name.sock;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
    }
}
</code>```

And that's my config-nginx.conf file

I can access all the app.route's, but can not the websocket.route

I been searching and found that "Upgrade" thing in the HTTP headers, so added that to the nginx config file, all the time I can reach the endpoint but can not establish the connection, it closes almost immediately, and after added headers on nginx it just takes a little bit more to close but is not getting connected

```<code>Jan 09 22:23:25 ip-192-168-1-50 uwsgi[242836]: [pid: 242836|app: 0|req: 5/5] 189.XXX.XXX.XXX () {52 vars in 914 bytes} [Mon Jan  9 22:23:25 2023] GET /api/websocket/echo => generated 207 bytes in 0 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)
</code>```

That's the result in the uwsgi log

Now i don't know what more to try, or where to search because, that is almost the same from the documentation example https://pypi.org/project/Flask-uWSGI-WebSocket/

Title: Websockets with flask/uwsgi/nginx

Body:
I have this problem that i'm developing a flask api and need to add just 1 websocket call, i had tried wit 3 different python packages but i had no luck

from gevent.monkey import patch_all
patch_all()
# pylint: disable=wrong-import-position
from flask_uwsgi_websocket import GeventWebSocket  # noqa: E402
# More imports...
# pylint: enable=wrong-import-position

app = Flask(__name__)
websocket = GeventWebSocket(app)

# A lot of @app.route('/routes')

@websocket.route('/api/websocket/echo')
def echo(w_s):
    """Websocket"""
    print(1)
    print(w_s)
    print(2)
    while True:
        msg = w_s.receive()
        w_s.send(msg)

if __name__ == '__main__':
    app.run(debug=True, threaded=True, gevent=100)

That is my flask code that is inside a main.py file

[uwsgi]

app = main
module = %(app)
callable = app

socket = /tmp/module_name.sock
chdir = /path_to_module
chmod-socket = 666
virtualenv = /path_to_module/venv
enable-threads = true
http-websockets = true

master = true
processes = 1
die-on-term = true

That is my config-uwsgi.ini

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;
    server_name some.server.com;

    ssl_certificate   /etc/letsencrypt/live/some.server.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/some.server.com/privkey.pem;
    server_tokens off;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/module_name.sock;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
    }
}

And that's my config-nginx.conf file

I can access all the app.route's, but can not the websocket.route

I been searching and found that "Upgrade" thing in the HTTP headers, so added that to the nginx config file, all the time I can reach the endpoint but can not establish the connection, it closes almost immediately, and after added headers on nginx it just takes a little bit more to close but is not getting connected

Jan 09 22:23:25 ip-192-168-1-50 uwsgi[242836]: [pid: 242836|app: 0|req: 5/5] 189.XXX.XXX.XXX () {52 vars in 914 bytes} [Mon Jan  9 22:23:25 2023] GET /api/websocket/echo => generated 207 bytes in 0 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)

That's the result in the uwsgi log

Now i don't know what more to try, or where to search because, that is almost the same from the documentation example https://pypi.org/project/Flask-uWSGI-WebSocket/


问:
How to fix ValueError: operands could not be broadcast together with shapes from audio wav. file
I'm triying to plot an spectogram from a wav file, in python but I'm always having this value error:

"ValueError: operands could not be broadcast together with shapes (129,30749) (60,)"

This is the code I'm using:

```<code>import matplotlib.pyplot as plt
import scipy.io.wavfile as wavfile
import statistics
import numpy as np
import scipy.signal as sg

Fs, aud = wavfile.read('bowhead_file_1.wav')

#%%
# FIGURE 1

#%%
aud=aud/1.0
first = aud[:int(Fs*123)]
powerSpectrum, frequenciesFound, time, imageAxis = plt.specgram(first, Fs=Fs)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.ylim(300,1100)
plt.xlim(10,40)
plt.title("A) Raw spectrogram (good example)") # Sin filtrar el ruido
plt.show()

# Apenas hay diferencia porque  al ser una señal pequeña (x - m < 5),
# el factor Wi es cercano a 1 por lo que apenas tiene efecto.
#%%

# Click removal

thresh = 50 # Un gran abanico para filtrar, el valor predeterminado es 5
# pero nuestra muestra es mucho más grande
power = 6 # Valor predeterminado
aud2 = aud

for i in range(0,len(aud),512):
    xi=aud[i:i+512]
    m = statistics.mean(xi) # Mean = m
    SD = np.std(xi) # Standard deviation = SD
    wi = 1/(1+((xi-m)/thresh*SD)**power)
    aud2[i:i+512]=xi*wi

#%%

# Median filter

aud3=aud2

for i in range(0,len(aud2),61):
    if i > 30 and i < (len(aud2)-30):
        xi = aud2[i-30:i+30]
        med = statistics.median(xi) # Median = med
        yf = powerSpectrum
        lyf = 10*np.log10(yf)
        aud3[i-30:i+30] = lyf-(med*xi)

first = aud3[:int(Fs*123)]
powerSpectrum, frequenciesFound, time, imageAxis = plt.specgram(first, Fs=Fs)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.ylim(300,1100)
plt.xlim(10,40)
plt.title("B) De-clicked & median filtered")
plt.show()
</code>```

The error appears in the #median section, I believe it has something to do with the loop or the values in it but I have no idea on how to make this work. Could someone help me please?

Body:
I'm triying to plot an spectogram from a wav file, in python but I'm always having this value error:

"ValueError: operands could not be broadcast together with shapes (129,30749) (60,)"

This is the code I'm using:

import matplotlib.pyplot as plt
import scipy.io.wavfile as wavfile
import statistics
import numpy as np
import scipy.signal as sg

Fs, aud = wavfile.read('bowhead_file_1.wav')

#%%
# FIGURE 1

#%%
aud=aud/1.0
first = aud[:int(Fs*123)]
powerSpectrum, frequenciesFound, time, imageAxis = plt.specgram(first, Fs=Fs)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.ylim(300,1100)
plt.xlim(10,40)
plt.title("A) Raw spectrogram (good example)") # Sin filtrar el ruido
plt.show()

# Apenas hay diferencia porque  al ser una señal pequeña (x - m < 5),
# el factor Wi es cercano a 1 por lo que apenas tiene efecto.
#%%

# Click removal

thresh = 50 # Un gran abanico para filtrar, el valor predeterminado es 5
# pero nuestra muestra es mucho más grande
power = 6 # Valor predeterminado
aud2 = aud

for i in range(0,len(aud),512):
    xi=aud[i:i+512]
    m = statistics.mean(xi) # Mean = m
    SD = np.std(xi) # Standard deviation = SD
    wi = 1/(1+((xi-m)/thresh*SD)**power)
    aud2[i:i+512]=xi*wi

#%%

# Median filter

aud3=aud2

for i in range(0,len(aud2),61):
    if i > 30 and i < (len(aud2)-30):
        xi = aud2[i-30:i+30]
        med = statistics.median(xi) # Median = med
        yf = powerSpectrum
        lyf = 10*np.log10(yf)
        aud3[i-30:i+30] = lyf-(med*xi)

first = aud3[:int(Fs*123)]
powerSpectrum, frequenciesFound, time, imageAxis = plt.specgram(first, Fs=Fs)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.ylim(300,1100)
plt.xlim(10,40)
plt.title("B) De-clicked & median filtered")
plt.show()

The error appears in the #median section, I believe it has something to do with the loop or the values in it but I have no idea on how to make this work. Could someone help me please?


问:
Is there a way to enable Chrome screen sharing in OSX via Zsh?
I am looking for a way to enable screen sharing of the desktop in OSX from Chrome via CLI.

I often interact with users via Google Meet and their default OSX permissions do no allow the Chrome browser to record the screen. I can walk the user through changing the privacy and security settings manually, but it would be a lot easier if I could just have them paste a command in ZSH.

I have Googled around and found CLI commands from ARD. I am not looking to remote into the computer.

I have not been able to find any commands that set privacy settings in ZSH. The closest I was able to find was tccutil and the man page seems to only allow settings to be reset to default.


问:
java jna negative value returned in ByteBuffer from a native function
I use a native C function from a dll like that:

```<code>short sSmartISOEx(USHORT usInDataLen, const UCHAR *pucDataIn, USHORT *pusOutDataLen, UCHAR *pucDataOut);
</code>```

This function is declared in my java like that:

```<code>short sSmartISOEx(short usInDataLen, ByteBuffer pucDataIn, ShortBuffer pusOutDataLen, ByteBuffer pucDataOut);
</code>```

So to use it i send a ByteBuffer pucDataIn with a lenght of usInDataLen.
And normaly i retrieve a ByteBuffer pucDataOut with a lenght of pusOutDataLen.

The function work correctly, but my problem is after retrieving the ByteBuffer pucDataOut, i do something like that:

```<code>System.out.println("first byte: " + pucDataOut.get(0));
System.out.println("second byte: " + pucDataOut.get(1));
</code>```

In my specifice case normaly "First byte" value is 0x69 and "Second byte" value is 0x86
But when i execute my code, this is what i obtain:

```<code>first byte: 105
second byte: -122
</code>```

For 105 it's ok, it correspond to 0x69
But for -122, it correspond to 0xffffff86

Why this "pucDataOut.get(1)" correspond to 4 byte and not just only one byte.
How to obtain exactly a byte array of two values 0x69 and 0x86

Body:
I use a native C function from a dll like that:

short sSmartISOEx(USHORT usInDataLen, const UCHAR *pucDataIn, USHORT *pusOutDataLen, UCHAR *pucDataOut);

This function is declared in my java like that:

short sSmartISOEx(short usInDataLen, ByteBuffer pucDataIn, ShortBuffer pusOutDataLen, ByteBuffer pucDataOut);

So to use it i send a ByteBuffer pucDataIn with a lenght of usInDataLen.
And normaly i retrieve a ByteBuffer pucDataOut with a lenght of pusOutDataLen.

The function work correctly, but my problem is after retrieving the ByteBuffer pucDataOut, i do something like that:

System.out.println("first byte: " + pucDataOut.get(0));
System.out.println("second byte: " + pucDataOut.get(1));

In my specifice case normaly "First byte" value is 0x69 and "Second byte" value is 0x86
But when i execute my code, this is what i obtain:

first byte: 105
second byte: -122

For 105 it's ok, it correspond to 0x69
But for -122, it correspond to 0xffffff86

Why this "pucDataOut.get(1)" correspond to 4 byte and not just only one byte.
How to obtain exactly a byte array of two values 0x69 and 0x86


问:
I'm having a problem on ReactJS that is having a undefined in Mapping of array
I'm currently having a problem on javascript that is: "Uncaught TypeError: Cannot read properties of undefined (reading 'map')"

I tried removing the useEffect hook, didn't work, tried put ? after array like: array?.map. Didn't work
You can see it right here:
`

```<code>function blabla(){
    const [itemIndex,setItemIndex] = useState(1)
    const [items, setItems] = useState()
    useEffect(function(){
        function success1(data){
            setItems(data)
        }
        var def ={
            type: "GET",
            url: "http://localhost:3001/blabla",
            success: success1
        }
        jQuery.ajax(def)
    }, [])
    return(
        <>
            <Navbar/>
            <section className="items">
                <div className="items-col">{
                    items.map(function(element){
                        if((itemIndex-1)%3 === 0){
                            setItemIndex(itemIndex+1)
                            return <span>{element.name}</span>
                        }
                        return null
                    })
                }</div>
                <div className="items-col">{
                    items.map(function(element){
                        if(itemIndex%3 === 2){
                            setItemIndex(itemIndex+1)
                            return <span>{element.name}</span>
                        }
                        return null
                    })
                }</div>
                <div className="items-col">{
                    items.map(function(element){
                        if(itemIndex%3 === 0){
                            setItemIndex(itemIndex+1)
                            return <span>{element.name}</span>
                        }
                        return null
                    })
                }</div>
            </section>
        </>
    )
}
export default blabla
</code>```

Body:
I'm currently having a problem on javascript that is: "Uncaught TypeError: Cannot read properties of undefined (reading 'map')"

I tried removing the useEffect hook, didn't work, tried put ? after array like: array?.map. Didn't work
You can see it right here:
`

function blabla(){
    const [itemIndex,setItemIndex] = useState(1)
    const [items, setItems] = useState()
    useEffect(function(){
        function success1(data){
            setItems(data)
        }
        var def ={
            type: "GET",
            url: "http://localhost:3001/blabla",
            success: success1
        }
        jQuery.ajax(def)
    }, [])
    return(
        <>
            <Navbar/>

{
                    items.map(function(element){
                        if((itemIndex-1)%3 === 0){
                            setItemIndex(itemIndex+1)
                            return {element.name}
                        }
                        return null
                    })
                }

{
                    items.map(function(element){
                        if(itemIndex%3 === 2){
                            setItemIndex(itemIndex+1)
                            return {element.name}
                        }
                        return null
                    })
                }

{
                    items.map(function(element){
                        if(itemIndex%3 === 0){
                            setItemIndex(itemIndex+1)
                            return {element.name}
                        }
                        return null
                    })
                }

        </>
    )
}
export default blabla