问:
gmail not posting amp form
I'm making a dynamic email with two forms, the first of which has one button and a hidden field with a predefined value (the stem) that will be posted to the backend and send the OTP of a specific user. Once the first form is successfully submitted, I unhide the second form to accept the OTP, which has been validated, and the points for that specific customer are redeemed if the OTP is posted to the backend. The issue is that form submission works fine in playground, but when I send the same HTML to gmail, it wraps my original request and does not hit my server.

Here is my Html,

```<code>
`<!doctype html>
<html amp4email data-css-strict>
   <head>
      <meta charset="utf-8">
      <script async src="https://cdn.ampproject.org/v0.js"></script>
      <script custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js" async></script>
      <!--<script custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js" async></script>-->
      <script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
      <meta name="a" content="width=device-width">
      <style amp4email-boilerplate>body{visibility:hidden}
      </style>
   </head>
   <body>
      <form method="post"
         action-xhr="action"
         on="submit-success:form2.show,form1.hide,AMP.setState({'otpReference': event.response.Data.OtpReference})" id="form1">
         <input type=hidden value="wdDDiFCG" name="stem">
         <input type="submit" value="Redeem Now!">
      </form>
      <form id="form2" method="post" action-xhr="action" hidden>
         <input type=hidden value="wdDDiFCG" name="stem" >
         <input type=hidden [value]="otpReference" name="otpReference" >
         <fieldset>
            <label>
            <span>Please enter OTP:</span>
            <input type="text"
               name="otp"
               required>
            </label>
            <input type="submit"
               value="Submit & Redeem">
         </fieldset>
         <button on="tap:form1.show,form2.hide">Back</button>
      </form>
   </body>
</html>`
</code>```

I get the following errors in the Google Chrome console.

[amp-form] Failed to parse response JSON: SyntaxError: "undefined" is not valid JSON.  [amp-form] Form submission failed: 404.

I searched for solutions on the web but didn't find a satisfactory solution. I don't know exactly what is blocking my form from posting from Gmail.

I configured "CORS" settings as below:

<add name="Access-Control-Allow-Headers" value="Content-Type" />  <add name="Access-Control-Max-Age" value="600" />  <add name="Access-Control-Allow-Origin" value="https://mail.google.com" /> <add name="AMP-Access-Control-Allow-Source-Origin" value="https://mail.google.com/dynamic-email/relay/v2/index.html" /> <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /> <add name="Access-Control-Expose-headers" value="AMP-Access-Control-Allow-Source-Origin" /> <add name="AMP-Email-Allow-Sender" value="amp@gmail.dev"/>

I've also set the AMP-Access-Control-Allow-Source-Origin value to "https://mail.google.com." but it didn't work.

The Access-Control-Allow-Origin value was also set to "*", but it still didn't work.

Title: gmail not posting amp form

Body:
I'm making a dynamic email with two forms, the first of which has one button and a hidden field with a predefined value (the stem) that will be posted to the backend and send the OTP of a specific user. Once the first form is successfully submitted, I unhide the second form to accept the OTP, which has been validated, and the points for that specific customer are redeemed if the OTP is posted to the backend. The issue is that form submission works fine in playground, but when I send the same HTML to gmail, it wraps my original request and does not hit my server.

Here is my Html,

`<!doctype html>

      <meta charset="utf-8">

      <meta name="a" content="width=device-width">

      <form method="post"
         action-xhr="action"
         on="submit-success:form2.show,form1.hide,AMP.setState({'otpReference': event.response.Data.OtpReference})" id="form1">
         <input type=hidden value="wdDDiFCG" name="stem">
         <input type="submit" value="Redeem Now!">
      </form>
      <form id="form2" method="post" action-xhr="action" hidden>
         <input type=hidden value="wdDDiFCG" name="stem" >
         <input type=hidden [value]="otpReference" name="otpReference" >
         <fieldset>

            Please enter OTP:
            <input type="text"
               name="otp"
               required>

            <input type="submit"
               value="Submit & Redeem">
         </fieldset>
         <button on="tap:form1.show,form2.hide">Back</button>
      </form>

`

I get the following errors in the Google Chrome console.

[amp-form] Failed to parse response JSON: SyntaxError: "undefined" is not valid JSON.  [amp-form] Form submission failed: 404.

I searched for solutions on the web but didn't find a satisfactory solution. I don't know exactly what is blocking my form from posting from Gmail.

I configured "CORS" settings as below:

<add name="Access-Control-Allow-Headers" value="Content-Type" />  <add name="Access-Control-Max-Age" value="600" />  <add name="Access-Control-Allow-Origin" value="https://mail.google.com" /> <add name="AMP-Access-Control-Allow-Source-Origin" value="https://mail.google.com/dynamic-email/relay/v2/index.html" /> <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /> <add name="Access-Control-Expose-headers" value="AMP-Access-Control-Allow-Source-Origin" /> <add name="AMP-Email-Allow-Sender" value="amp@gmail.dev"/>

I've also set the AMP-Access-Control-Allow-Source-Origin value to "https://mail.google.com." but it didn't work.

The Access-Control-Allow-Origin value was also set to "*", but it still didn't work.


来源: stackexchange

问:
heroku run rails db:migrate gives ERROR - rails aborted! ActiveRecord::ConnectionNotEstablished: connection to server on socket
I hosted my Ruby on Rails and React app on Heroku back in April and it was working perfectly until recently. I know Heroku made changes and began charging for services. Right now my app currently works perfect on my localhost. I purchased a basic plan for Heroku dynos and tried to push to Heroku again, still not working. When I run 'git push heroku main' the app will say it deployed but then give me this error when running the "release: rake db:migrate" command from my Procfile:

```<code>rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/command.rb:50:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands.rb:18:in `<main>'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/bin/rails:9:in `<main>'

Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:755:in `connect_start'
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:755:in `connect_to_hosts'
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:695:in `new'
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg.rb:69:in `connect'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/command.rb:50:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands.rb:18:in `<main>'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/bin/rails:9:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
</code>```

I currently have postgres running in the background and ran 'sudo service postgresql start' right before to make sure. Right now my heroku app just shows the "We're sorry, but something went wrong" screen. I am wondering if this is because I need to purchase the Heroku add-on for Postgresql or if it is something maybe missing in my Gemfile.

When I first checked in on my app in some months and saw it was not working on Heroku, the first thing I did was update my Ruby versions to 3.1.3 and Rails to version 6, because my heroku logs/errors wrote that I should update them. Not sure if that could be a possibly reason for this.
I'm looking for my first coding job and need this app to be actively deployed on Heroku, can't believe they did this bs.

ContentLicense: CC BY-SA 4.0

Body:
I hosted my Ruby on Rails and React app on Heroku back in April and it was working perfectly until recently. I know Heroku made changes and began charging for services. Right now my app currently works perfect on my localhost. I purchased a basic plan for Heroku dynos and tried to push to Heroku again, still not working. When I run 'git push heroku main' the app will say it deployed but then give me this error when running the "release: rake db:migrate" command from my Procfile:

rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in `block (3 levels) in '
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `block (2 levels) in '
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/command.rb:50:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands.rb:18:in `'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/bin/rails:9:in `'

Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:755:in `connect_start'
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:755:in `connect_to_hosts'
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:695:in `new'
/app/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg.rb:69:in `connect'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/connection_handling.rb:283:in `connection'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in `block (3 levels) in '
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in `block (2 levels) in '
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/app/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/command.rb:50:in `invoke'
/app/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands.rb:18:in `'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/app/bin/rails:9:in `'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I currently have postgres running in the background and ran 'sudo service postgresql start' right before to make sure. Right now my heroku app just shows the "We're sorry, but something went wrong" screen. I am wondering if this is because I need to purchase the Heroku add-on for Postgresql or if it is something maybe missing in my Gemfile.

When I first checked in on my app in some months and saw it was not working on Heroku, the first thing I did was update my Ruby versions to 3.1.3 and Rails to version 6, because my heroku logs/errors wrote that I should update them. Not sure if that could be a possibly reason for this.
I'm looking for my first coding job and need this app to be actively deployed on Heroku, can't believe they did this bs.


问:
Replacement for Drawing in .NET 6 or .NET 7
Recently I was working on .NET Framework 4.8 and decided to change it to .NET 6

At .NET Framework 4.8 I was using the code below to draw a rectangle around the Listbox and  to make the event DrawItem:

```<code>using (Pen penBorder = new Pen(Color.FromArgb(66, 66, 66), 2))
            {
                penBorder.Alignment = PenAlignment.Inset;
                graph.DrawRectangle(penBorder, ModifiersLB.Location.X - 2, ModifiersLB.Location.Y - 2, ModifiersLB.Width + 4F, ModifiersLB.Height + 4F);
            }

private void LB_DrawItem(DrawItemEventArgs e, ListBox LB)
        {
            Color backgroundColor = Color.FromArgb(50, 50, 50);
            Color horizontalColor = Color.FromArgb(100, 100, 100);

            if (e.Index >= 0)
            {
                SolidBrush sb = new SolidBrush(((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? horizontalColor : backgroundColor);
                e.Graphics.FillRectangle(sb, e.Bounds);
                string text = LB.Items[e.Index].ToString();
                SolidBrush tb = new SolidBrush(e.ForeColor);
                e.Graphics.DrawString(text, e.Font, tb, LB.GetItemRectangle(e.Index).Location);
            }
        }
</code>```

The problem is this code is only supported by Windows.

I decided to make this question because I was receiving a warning. I never really intended to make my app supported on all platforms. I just wanted to ask if there is a better way to do what I was doing so that I don't get the warning.

Is there a better method to do this code or is there a ListBox replacement that I could use?

Body:
Recently I was working on .NET Framework 4.8 and decided to change it to .NET 6

At .NET Framework 4.8 I was using the code below to draw a rectangle around the Listbox and  to make the event DrawItem:

using (Pen penBorder = new Pen(Color.FromArgb(66, 66, 66), 2))
            {
                penBorder.Alignment = PenAlignment.Inset;
                graph.DrawRectangle(penBorder, ModifiersLB.Location.X - 2, ModifiersLB.Location.Y - 2, ModifiersLB.Width + 4F, ModifiersLB.Height + 4F);
            }

private void LB_DrawItem(DrawItemEventArgs e, ListBox LB)
        {
            Color backgroundColor = Color.FromArgb(50, 50, 50);
            Color horizontalColor = Color.FromArgb(100, 100, 100);

            if (e.Index >= 0)
            {
                SolidBrush sb = new SolidBrush(((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? horizontalColor : backgroundColor);
                e.Graphics.FillRectangle(sb, e.Bounds);
                string text = LB.Items[e.Index].ToString();
                SolidBrush tb = new SolidBrush(e.ForeColor);
                e.Graphics.DrawString(text, e.Font, tb, LB.GetItemRectangle(e.Index).Location);
            }
        }

The problem is this code is only supported by Windows.

I decided to make this question because I was receiving a warning. I never really intended to make my app supported on all platforms. I just wanted to ask if there is a better way to do what I was doing so that I don't get the warning.

Is there a better method to do this code or is there a ListBox replacement that I could use?


问:
How to send command to child process nodejs
I am making an application that handles java commands and want to send java command to my child spawn process how can i achieve this

```<code>  const {
    spawn
  } = require('child_process');

  // Start child process
  var child = spawn('java', ['-server', '-Xms1G', `-Xmx${document.getElementById('ram').value}G`, `-jar`, `${jarname}`], {
    cwd: `${jarfolder}`
  });

  child.stdout.on('data', (data) => {
    $("ol").append(`<li>${data}</li><br>`);
  });

  child.stderr.on('data', (data) => {
    $("ol").append(`<li>${data}</li><br>`);
  });

  child.on('error', (error) => console.log(`error: ${error.message}`));

  child.on('exit', (code, signal) => {
    if (code) $("ol").append(`<li>Process exit with code: ${code}</li><br>`);
    if (signal) $("ol").append(`<li>Process killed with signal: ${signal}</li><br>`);
  });
</code>```

demo code

example i have a button that calls a function and

```<code>function test(){
      var command=document.getElementsById("command").innerHTML;

      // send the command to terminatal
</code>```

Body:
I am making an application that handles java commands and want to send java command to my child spawn process how can i achieve this

  const {
    spawn
  } = require('child_process');

  // Start child process
  var child = spawn('java', ['-server', '-Xms1G', `-Xmx${document.getElementById('ram').value}G`, `-jar`, `${jarname}`], {
    cwd: `${jarfolder}`
  });

  child.stdout.on('data', (data) => {
    $("ol").append(`<li>${data}</li><br>`);
  });

  child.stderr.on('data', (data) => {
    $("ol").append(`<li>${data}</li><br>`);
  });

  child.on('error', (error) => console.log(`error: ${error.message}`));

  child.on('exit', (code, signal) => {
    if (code) $("ol").append(`<li>Process exit with code: ${code}</li><br>`);
    if (signal) $("ol").append(`<li>Process killed with signal: ${signal}</li><br>`);
  });

demo code

example i have a button that calls a function and

function test(){
      var command=document.getElementsById("command").innerHTML;

      // send the command to terminatal


问:
ERR_CERT_COMMON_NAME_INVALID
I have React and Spring boot web application. My web application is in Windows server 2019. I generated a certificate for my webpage www.mypage.com and registered in IIS manager. When I go to my webpage there is a lock symbol and It is fine. But when I make a request to my backend rest api service. It gives me this error. ERR_CERT_COMMON_NAME_INVALID. I also followed the steps for spring boot certificates.
added certificate to under the resources folder.

```<code>http.port=8080
server.ssl.key-alias=mydomain
server.ssl.key-store-password=password
server.ssl.key-store=classpath:KeyStore.p12
server.ssl.key-store-type=PKCS12
</code>```

When I make rest by using chrome with url. It gives NET::ERR_CERT_AUTHORITY_INVALID, when I clicked advance, and processed not secure. It shows the data.

I don't know what to do the fix the error.

Title: ERR_CERT_COMMON_NAME_INVALID

Body:
I have React and Spring boot web application. My web application is in Windows server 2019. I generated a certificate for my webpage www.mypage.com and registered in IIS manager. When I go to my webpage there is a lock symbol and It is fine. But when I make a request to my backend rest api service. It gives me this error. ERR_CERT_COMMON_NAME_INVALID. I also followed the steps for spring boot certificates.
added certificate to under the resources folder.

http.port=8080
server.ssl.key-alias=mydomain
server.ssl.key-store-password=password
server.ssl.key-store=classpath:KeyStore.p12
server.ssl.key-store-type=PKCS12

When I make rest by using chrome with url. It gives NET::ERR_CERT_AUTHORITY_INVALID, when I clicked advance, and processed not secure. It shows the data.

I don't know what to do the fix the error.


问:
NGRX jest-marbles Testing Effect Involving forkJoin Operator

Unit Testing an Effect that Incorporates a forkJoin Operator

I have an Angular 15 project using NGRX. I'm writing unit tests against my store and associated modules.

My effect basically works like a polling service and calls a service inside a forkJoin operator. The code is below.

  getGroupFlow$ = createEffect(() =>
    this.actions$.pipe(
      ofType(StatusPollingActions.pollFlow),
      tap(() => this.continuePolling = true),
      withLatestFrom(of(environment.statusPollingInterval)),
      switchMap(([action, pollingInterval]) =>
        timer(0, pollingInterval).pipe(
          takeWhile(() => this.continuePolling, true),
          switchMap(() =>
            forkJoin([
              this.nifiService.getProcessGroupFlow(this.inputGroupId),
              this.nifiService.getProcessGroupFlow(this.processingGroupId),
              this.nifiService.getProcessGroupFlow(this.outputGroupId),
              this.nifiService.getConnectionsForGroup(this.mainCanvasId),
            ]).pipe(
              map(([incoming, processing, outgoing, groupConnections]) =>
                StatusPollingActions.pollFlowSuccess({
                  incomingGroupFlow: incoming,
                  processingGroupFlow: processing,
                  outputGroupFlow: outgoing,
                  groupConnections: groupConnections,
                })
              ),
              catchError((error) =>
                of(StatusPollingActions.pollFlowFailure({ error }))
              )
            )
          )
        )
      )
    )
  );
```

Of note... the variables referenced in the effect are defined below:

continuePolling: boolean variable scoped to the class

statusPollingInterval: number indicating how frequently to poll (passed in from environment)

I'm a bit new to writing tests against NGRX and I'm using jest and jest-marbles for my test cases.
I need help building out the test case to model the expected flow and output.

Any help would be greatly appreciated!

Body:
Unit Testing an Effect that Incorporates a forkJoin Operator

I have an Angular 15 project using NGRX. I'm writing unit tests against my store and associated modules.

My effect basically works like a polling service and calls a service inside a forkJoin operator. The code is below.

  getGroupFlow$ = createEffect(() =>
    this.actions$.pipe(
      ofType(StatusPollingActions.pollFlow),
      tap(() => this.continuePolling = true),
      withLatestFrom(of(environment.statusPollingInterval)),
      switchMap(([action, pollingInterval]) =>
        timer(0, pollingInterval).pipe(
          takeWhile(() => this.continuePolling, true),
          switchMap(() =>
            forkJoin([
              this.nifiService.getProcessGroupFlow(this.inputGroupId),
              this.nifiService.getProcessGroupFlow(this.processingGroupId),
              this.nifiService.getProcessGroupFlow(this.outputGroupId),
              this.nifiService.getConnectionsForGroup(this.mainCanvasId),
            ]).pipe(
              map(([incoming, processing, outgoing, groupConnections]) =>
                StatusPollingActions.pollFlowSuccess({
                  incomingGroupFlow: incoming,
                  processingGroupFlow: processing,
                  outputGroupFlow: outgoing,
                  groupConnections: groupConnections,
                })
              ),
              catchError((error) =>
                of(StatusPollingActions.pollFlowFailure({ error }))
              )
            )
          )
        )
      )
    )
  );

Of note... the variables referenced in the effect are defined below:

continuePolling: boolean variable scoped to the class

statusPollingInterval: number indicating how frequently to poll (passed in from environment)

I'm a bit new to writing tests against NGRX and I'm using jest and jest-marbles for my test cases.
I need help building out the test case to model the expected flow and output.

Any help would be greatly appreciated!


问:
Kernel size of dimension WxH for MinkowskiConvolution
Can somebody explain how to define a convolutional layer with kernel size of WxH using MinkowskiEngine library? Or it is not possible to do that for some costrains using sparse tensors?

I haven't tried nothing yet cause on the documentation I can't find anything related to the definition of a WxH kernel size for Convolution (at least I didn't find anything)


问:
Expo react native library and build server license
We are building a react native mobile app to scan QR codes using Expo library and their build server. So, we need to publish this app to the Google play & App store. However, this application is a free app and does not earn money. Moreover, we are going to create a company account in Expo to use the library & build server.

Can someone please explain that is it possible to use Expo build server to build an android/iOS app for free if our app is not earning money but we are using our company account?


问:
How supress "jpegtopnm: WRITING PPM FILE" etc within output of jpegtopnm[Solved]
I want to see the sizes of images within a directory. For this purpose I do

```<code>$ for file in *.jpg; do jpegtopnm $file | pnmfile; done
</code>```

Then I can see

```<code>jpegtopnm: WRITING PPM FILE
stdin:  PPM raw, 960 by 1280  maxval 255
jpegtopnm: WRITING PPM FILE
stdin:  PPM raw, 960 by 1280  maxval 255
jpegtopnm: WRITING PPM FILE
stdin:  PPM raw, 1200 by 1600  maxval 255
</code>```

and so on.

I would like to see

```<code>  960 by 1280
  960 by 1280
 1200 by 1600
.............
</code>```

How one can do this?

Answer

The command jpegtopnm is a part of netpbm - package of graphics manipulation programs and libraries:

```<code> $ apt-file -l find pnmfile
 netbpm
</code>```

Then we must read "man netbpm":

-quiet Suppress all informational messages

Thus we solved our problem:

```<code> $ for file in *.jpg; do jpegtopnm $file -quiet | pnmfile | cut -c 16-28; done
 4000 by 3000
 2592 by 1944
 4000 by 3000
 ............
</code>```

About "cut -c 16-28".

This is a filter that selects characters from 16 to 28 in a string

"stdin: PPM raw, 960 by 1280  maxval 255".

If you have at your directory images with different sizes such as 4000x5000, 300x400, 2x3, 40x67 etc it won't work properly. For that reason you have to use more complicated way. It is a "cut" filter by fields(-f). The field separator will be a space character(-d ' ').

```<code>$ for file in *.jpg; do jpegtopnm $file -quiet | pnmfile | cut -d ' ' -f 3-5; done
700 by 900
65 by 40
2 by 3
7000 by 9000
4000 by 3000
............
</code>```

Body:
I want to see the sizes of images within a directory. For this purpose I do

$ for file in *.jpg; do jpegtopnm $file | pnmfile; done

Then I can see

jpegtopnm: WRITING PPM FILE
stdin:  PPM raw, 960 by 1280  maxval 255
jpegtopnm: WRITING PPM FILE
stdin:  PPM raw, 960 by 1280  maxval 255
jpegtopnm: WRITING PPM FILE
stdin:  PPM raw, 1200 by 1600  maxval 255

and so on.

I would like to see

  960 by 1280
  960 by 1280
 1200 by 1600
.............

How one can do this?

Answer

The command jpegtopnm is a part of netpbm - package of graphics manipulation programs and libraries:

 $ apt-file -l find pnmfile
 netbpm

Then we must read "man netbpm":

-quiet Suppress all informational messages

Thus we solved our problem:

 $ for file in *.jpg; do jpegtopnm $file -quiet | pnmfile | cut -c 16-28; done
 4000 by 3000
 2592 by 1944
 4000 by 3000
 ............

About "cut -c 16-28".

This is a filter that selects characters from 16 to 28 in a string

"stdin: PPM raw, 960 by 1280  maxval 255".

If you have at your directory images with different sizes such as 4000x5000, 300x400, 2x3, 40x67 etc it won't work properly. For that reason you have to use more complicated way. It is a "cut" filter by fields(-f). The field separator will be a space character(-d ' ').

$ for file in *.jpg; do jpegtopnm $file -quiet | pnmfile | cut -d ' ' -f 3-5; done
700 by 900
65 by 40
2 by 3
7000 by 9000
4000 by 3000
............


问:
Pip install requirements PyWavelets & scipy takes forever and then fails
I try to build a docker container with a python script on a raspberry pi.

I' using the arm32v7/python latest image (3.12), but also tried it with 3.9 and 3.10 images.

In my Dockerfile I first update pip and then try to install my requirements. But when it tries to install PyWavelets or scipy it wont move further. I just get "installing build dependencies: still running".

```<code> Downloading PyWavelets-1.4.1.tar.gz (4.6 MB)
 => => #       4.6/4.6 MB 11.9 MB/s eta 0:00:00
 => => #   Installing build dependencies: started
 => => #   Installing build dependencies: still running...
</code>```

After 30 mins it fails with

```<code>� Building wheel for ninja (pyproject.toml) did not run successfully.
#0 2857.1         exit code: 1
#0 2857.1         > [11 lines of output]
#0 2857.1             Traceback (most recent call last):
#0 2857.1               File "/tmp/pip-build-env-roddjnvw/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 612, in setup
#0 2857.1                 cmkr = cmaker.CMaker(cmake_executable)
#0 2857.1                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 2857.1               File "/tmp/pip-build-env-roddjnvw/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 149, in __init__
#0 2857.1                 self.cmake_version = get_cmake_version(self.cmake_executable)
#0 2857.1                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 2857.1               File "/tmp/pip-build-env-roddjnvw/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 104, in get_cmake_version
#0 2857.1                 raise SKBuildError(
#0 2857.1
#0 2857.1             Problem with the CMake installation, aborting build. CMake executable is cmake
#0 2857.1             [end of output]

</code>```

I already tried to install them via their apt packages (python3-pywt, python3-scipy) and skip the ones in my requirements.txt, but then I get an error in the installer.

I also tried to use https://www.piwheels.org/simple as index url in my install command but then it wont find any scipy installation candidate.

My Dockerfile:

```<code>FROM arm32v7/python
RUN apt-get update && apt-get -y install vim python3-pywt python3-scipy
WORKDIR /app
COPY main.py /app/main.py
COPY requirements.txt /app/requirements.txt
RUN pip install --upgrade pip
#RUN pip install --index-url=https://www.piwheels.org/simple --no-cache-dir -r requirements.txt
RUN pip install -r requirements.txt
</code>```

My requirements.txt

```<code>certifi==2022.12.7
charset-normalizer==2.1.1
idna==3.4
mysql-connector-python==8.0.25
numpy==1.24.0
Pillow==9.3.0
protobuf==3.20.1
python-dotenv==0.21.0
PyWavelets==1.4.1
requests==2.28.1
scipy==1.9.3
update-checker==0.18.0
urllib3==1.26.13
websocket-client==1.4.2
</code>```

Body:
I try to build a docker container with a python script on a raspberry pi.

I' using the arm32v7/python latest image (3.12), but also tried it with 3.9 and 3.10 images.

In my Dockerfile I first update pip and then try to install my requirements. But when it tries to install PyWavelets or scipy it wont move further. I just get "installing build dependencies: still running".

 Downloading PyWavelets-1.4.1.tar.gz (4.6 MB)
 => => #       4.6/4.6 MB 11.9 MB/s eta 0:00:00
 => => #   Installing build dependencies: started
 => => #   Installing build dependencies: still running...

After 30 mins it fails with

� Building wheel for ninja (pyproject.toml) did not run successfully.
#0 2857.1         exit code: 1
#0 2857.1         > [11 lines of output]
#0 2857.1             Traceback (most recent call last):
#0 2857.1               File "/tmp/pip-build-env-roddjnvw/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 612, in setup
#0 2857.1                 cmkr = cmaker.CMaker(cmake_executable)
#0 2857.1                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 2857.1               File "/tmp/pip-build-env-roddjnvw/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 149, in __init__
#0 2857.1                 self.cmake_version = get_cmake_version(self.cmake_executable)
#0 2857.1                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 2857.1               File "/tmp/pip-build-env-roddjnvw/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 104, in get_cmake_version
#0 2857.1                 raise SKBuildError(
#0 2857.1
#0 2857.1             Problem with the CMake installation, aborting build. CMake executable is cmake
#0 2857.1             [end of output]

I already tried to install them via their apt packages (python3-pywt, python3-scipy) and skip the ones in my requirements.txt, but then I get an error in the installer.

I also tried to use https://www.piwheels.org/simple as index url in my install command but then it wont find any scipy installation candidate.

My Dockerfile:

FROM arm32v7/python
RUN apt-get update && apt-get -y install vim python3-pywt python3-scipy
WORKDIR /app
COPY main.py /app/main.py
COPY requirements.txt /app/requirements.txt
RUN pip install --upgrade pip
#RUN pip install --index-url=https://www.piwheels.org/simple --no-cache-dir -r requirements.txt
RUN pip install -r requirements.txt

My requirements.txt

certifi==2022.12.7
charset-normalizer==2.1.1
idna==3.4
mysql-connector-python==8.0.25
numpy==1.24.0
Pillow==9.3.0
protobuf==3.20.1
python-dotenv==0.21.0
PyWavelets==1.4.1
requests==2.28.1
scipy==1.9.3
update-checker==0.18.0
urllib3==1.26.13
websocket-client==1.4.2


问:
What can I do if an Express app is not exposing a port
I have an Express app that was working well but when I added the Redis server, the app stopped exposing the port.

```<code>import express from "express";
import ejs from "ejs";
import session from "express-session";
import cookieParser from "cookie-parser";
import homeRoute from "./routes/home.routes.js"
import userRoute from "./routes/users.routes.js";
import postRoute from "./routes/post.routes.js";
import commentRoute from "./routes/comments.routes.js";
import newsRoute from "./routes/news.routes.js";
import createRoute from './routes/create.routes.js'
import "./utils/db_conn.js";
// import { sessionStore } from "./utils/sessions.js";
import { redisClient, RedisStore } from "./utils/sessions.js";

/////
import { fileURLToPath } from "url";
import { dirname } from "path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
////

import env from "dotenv";
const { config } = env;
config({ path: "./.env" });

const app = express();

const PORT = process.env.PORT || 5001;
app.listen(PORT, () => {
  console.log(`Running on this port: ${PORT}`);
});

app.set("view engine", "ejs"); // Registering the default view engine => EJS
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use("/static", express.static("public"));
app.use(
  session({
    secret: process.env.SECRET,
    resave: false,
    saveUninitialized: false,
    cookie: { secure: false, maxAge: 60 * 60 * 24 * 1000 },
    // store: sessionStore,
    store: new RedisStore({ client: redisClient }),
  })
);

app.use("/users", userRoute);
app.use("/posts", postRoute);
app.use("/comments", commentRoute);
app.use("/news", newsRoute);
app.use('/create', createRoute)
app.use('/', homeRoute);
</code>```

I have tried to change the port but nothing has changed. If you know what I can change to make this app run again guys?

Body:
I have an Express app that was working well but when I added the Redis server, the app stopped exposing the port.

import express from "express";
import ejs from "ejs";
import session from "express-session";
import cookieParser from "cookie-parser";
import homeRoute from "./routes/home.routes.js"
import userRoute from "./routes/users.routes.js";
import postRoute from "./routes/post.routes.js";
import commentRoute from "./routes/comments.routes.js";
import newsRoute from "./routes/news.routes.js";
import createRoute from './routes/create.routes.js'
import "./utils/db_conn.js";
// import { sessionStore } from "./utils/sessions.js";
import { redisClient, RedisStore } from "./utils/sessions.js";

/////
import { fileURLToPath } from "url";
import { dirname } from "path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
////

import env from "dotenv";
const { config } = env;
config({ path: "./.env" });

const app = express();

const PORT = process.env.PORT || 5001;
app.listen(PORT, () => {
  console.log(`Running on this port: ${PORT}`);
});

app.set("view engine", "ejs"); // Registering the default view engine => EJS
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use("/static", express.static("public"));
app.use(
  session({
    secret: process.env.SECRET,
    resave: false,
    saveUninitialized: false,
    cookie: { secure: false, maxAge: 60 * 60 * 24 * 1000 },
    // store: sessionStore,
    store: new RedisStore({ client: redisClient }),
  })
);

app.use("/users", userRoute);
app.use("/posts", postRoute);
app.use("/comments", commentRoute);
app.use("/news", newsRoute);
app.use('/create', createRoute)
app.use('/', homeRoute);

I have tried to change the port but nothing has changed. If you know what I can change to make this app run again guys?


问:
Idiomatic Rust way to convert image's RgbImage to opencv Mat
I have an RgbImage from the image crate, e.g. created with:

let img = Reader::open("img.jpg").unwrap().decode().unwrap().to_rgb8();
```
<p>I need an object of opencv's Mat. I played around with <code>Mat::from_slice</code> but could not get it working.</p>
<p>What's an idiomatic Rust way of converting the image?</p>
<p>Attempt 1: I save the file as JPG and reload it, it works (slowly):</p>
<pre class="lang-rust prettyprint-override"><code>img.save_with_format(
            "/tmp/1.jpg",
            ImageFormat::Jpeg,
        )
        .unwrap();
let img = opencv::imgcodecs::imread("/tmp/1.jpg", opencv::imgcodecs::IMREAD_COLOR).unwrap();
</code>```

Attempt 2: I played around with Mat::from_slice(_2d):

let mut m: Mat = Mat::from_slice(&rgb).unwrap();
m.set_dims(2);
m.set_rows(img.height() as i32);
m.set_cols(img.width() as i32);
m.set_flags(CV_32FC3);
```

Body:
I have an RgbImage from the image crate, e.g. created with:

let img = Reader::open("img.jpg").unwrap().decode().unwrap().to_rgb8();

I need an object of opencv's Mat. I played around with Mat::from_slice but could not get it working.

What's an idiomatic Rust way of converting the image?

Attempt 1: I save the file as JPG and reload it, it works (slowly):

img.save_with_format(
            "/tmp/1.jpg",
            ImageFormat::Jpeg,
        )
        .unwrap();
let img = opencv::imgcodecs::imread("/tmp/1.jpg", opencv::imgcodecs::IMREAD_COLOR).unwrap();

Attempt 2: I played around with Mat::from_slice(_2d):

let mut m: Mat = Mat::from_slice(&rgb).unwrap();
m.set_dims(2);
m.set_rows(img.height() as i32);
m.set_cols(img.width() as i32);
m.set_flags(CV_32FC3);


问:
PCL transformation error about Quaternion to matrix4f

I use these camera extrinsics parameters to transform .ply file through PCL, but the result is not correct. I think it is because of the formula is not correct from Quaternion to matrix4f.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

master

```<code>    Eigen::Matrix4f transform_1 = Eigen::Matrix4f::Identity();
    qw = 0.980613;
    qx = -0.0777902;
    qy = -0.176786;
    qz = -0.0330758,
    tx = -0.798112;
    ty = -0.774293;
    tz = 3.76053;
    transform_1 (0, 0) = 1 - 2 * pow(qy, 2) - 2 * pow(qz, 2);
    transform_1 (0, 1) = 2 * qx*qy - 2 * qz*qw;
    transform_1 (0, 2) = 2 * qx*qz + 2 * qy*qw;
    transform_1 (0, 3) = tx;

    transform_1 (1, 0) = 2 * qx*qy + 2 * qz*qw;
    transform_1 (1, 1) = 1 - 2 * pow(qx,2) - 2 * pow(qz,2);
    transform_1 (1, 2) = 2 * qy*qz - 2 * qx*qw;
    transform_1 (1, 3) = ty;

    transform_1 (2, 0) = 2 * qx*qz - 2 * qy*qw;
    transform_1 (2, 1) = 2 * qy*qz + 2 * qx*qw;
    transform_1 (2, 2) = 1 - 2 * pow(qx,2) - 2 * pow(qy,2);
    transform_1 (2, 3) = tz;

    transform_1(3, 0) = 0;
    transform_1(3, 1) = 0;
    transform_1(3, 2) = 0;
    transform_1(3, 3) = 1;
</code>```

sub01

```<code>Eigen::Matrix4f transform_2 = Eigen::Matrix4f::Identity();
    qw = 0.861117;
    qx = -0.0716478;
    qy = 0.427619;
    qz = 0.265493,
    tx = -2.94326;
    ty = -1.91445;
    tz = 6.074;
    transform_2(0, 0) = 1 - 2 * pow(qy, 2) - 2 * pow(qz, 2);
    transform_2(0, 1) = 2 * qx*qy - 2 * qz*qw;
    transform_2(0, 2) = 2 * qx*qz + 2 * qy*qw;
    transform_2(0, 3) = tx;

    transform_2(1, 0) = 2 * qx*qy + 2 * qz*qw;
    transform_2(1, 1) = 1 - 2 * pow(qx, 2) - 2 * pow(qz, 2);
    transform_2(1, 2) = 2 * qy*qz - 2 * qx*qw;
    transform_2(1, 3) = ty;

    transform_2(2, 0) = 2 * qx*qz - 2 * qy*qw;
    transform_2(2, 1) = 2 * qy*qz + 2 * qx*qw;
    transform_2(2, 2) = 1 - 2 * pow(qx, 2) - 2 * pow(qy, 2);
    transform_2(2, 3) = tz;

    transform_2(3, 0) = 0;
    transform_2(3, 1) = 0;
    transform_2(3, 2) = 0;
    transform_2(3, 3) = 1;
</code>```

I use cloudcompare also got the same result

Body:
I use these camera extrinsics parameters to transform .ply file through PCL, but the result is not correct. I think it is because of the formula is not correct from Quaternion to matrix4f.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

master

    Eigen::Matrix4f transform_1 = Eigen::Matrix4f::Identity();
    qw = 0.980613;
    qx = -0.0777902;
    qy = -0.176786;
    qz = -0.0330758,
    tx = -0.798112;
    ty = -0.774293;
    tz = 3.76053;
    transform_1 (0, 0) = 1 - 2 * pow(qy, 2) - 2 * pow(qz, 2);
    transform_1 (0, 1) = 2 * qx*qy - 2 * qz*qw;
    transform_1 (0, 2) = 2 * qx*qz + 2 * qy*qw;
    transform_1 (0, 3) = tx;

    transform_1 (1, 0) = 2 * qx*qy + 2 * qz*qw;
    transform_1 (1, 1) = 1 - 2 * pow(qx,2) - 2 * pow(qz,2);
    transform_1 (1, 2) = 2 * qy*qz - 2 * qx*qw;
    transform_1 (1, 3) = ty;

    transform_1 (2, 0) = 2 * qx*qz - 2 * qy*qw;
    transform_1 (2, 1) = 2 * qy*qz + 2 * qx*qw;
    transform_1 (2, 2) = 1 - 2 * pow(qx,2) - 2 * pow(qy,2);
    transform_1 (2, 3) = tz;

    transform_1(3, 0) = 0;
    transform_1(3, 1) = 0;
    transform_1(3, 2) = 0;
    transform_1(3, 3) = 1;

sub01

Eigen::Matrix4f transform_2 = Eigen::Matrix4f::Identity();
    qw = 0.861117;
    qx = -0.0716478;
    qy = 0.427619;
    qz = 0.265493,
    tx = -2.94326;
    ty = -1.91445;
    tz = 6.074;
    transform_2(0, 0) = 1 - 2 * pow(qy, 2) - 2 * pow(qz, 2);
    transform_2(0, 1) = 2 * qx*qy - 2 * qz*qw;
    transform_2(0, 2) = 2 * qx*qz + 2 * qy*qw;
    transform_2(0, 3) = tx;

    transform_2(1, 0) = 2 * qx*qy + 2 * qz*qw;
    transform_2(1, 1) = 1 - 2 * pow(qx, 2) - 2 * pow(qz, 2);
    transform_2(1, 2) = 2 * qy*qz - 2 * qx*qw;
    transform_2(1, 3) = ty;

    transform_2(2, 0) = 2 * qx*qz - 2 * qy*qw;
    transform_2(2, 1) = 2 * qy*qz + 2 * qx*qw;
    transform_2(2, 2) = 1 - 2 * pow(qx, 2) - 2 * pow(qy, 2);
    transform_2(2, 3) = tz;

    transform_2(3, 0) = 0;
    transform_2(3, 1) = 0;
    transform_2(3, 2) = 0;
    transform_2(3, 3) = 1;

I use cloudcompare also got the same result


问:
Apache camel - I want to send to my mock endpoint
I have this test class - currently it is checking the response at the endpoint

```<code>Endpoints.SEDA_PROCESS_ENDPOINT
</code>```

but I need it to check at

```<code> "mock:"+Endpoints.SEDA_PROCESS_ENDPOINT
</code>```

Is there a way to forward the response to this mock endpoint I have just defined?

below is my test class

```<code>package com.sams.pricing.prism.data.processor;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.MockEndpoints;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.sams.pricing.prism.data.processor.model.CostIQRetail;
import com.sams.pricing.prism.data.processor.routes.PrismRouter;
import com.sams.pricing.prism.data.processor.service.RulesEngineClient;
import com.sams.pricing.prism.data.processor.util.Endpoints;

@SpringBootTest
@CamelSpringBootTest
@MockEndpoints( Endpoints.SEDA_PROCESS_ENDPOINT)
public class CamelRouteTests3  {

        @Autowired
        private ProducerTemplate template;

        @EndpointInject( "mock:" + Endpoints.SEDA_PROCESS_ENDPOINT)
        private MockEndpoint mock;

        @Mock
        private  PrismRouter p;

        @Mock
        private RulesEngineClient rulesEngineClientMock;

    public CostIQRetail costIQObject() {

        CostIQRetail obj = new CostIQRetail();

        obj.setItemNbr(123);
        obj.setLocationNbr(4931);
        obj.setIsDcFlag(false) ;
        obj.setStatus("SUCCESS");
        obj.setOrderableCost(new BigDecimal((10.0)));
        obj.setWarehousePackCost(new BigDecimal(100.0));
        obj.setOrderablePrepaidCost(null) ;
        obj.setOrderableCollectCost(null) ;
        obj.setReasonCode("Markdown - category funded");
        obj.setEffectiveDate("2022-12-29");
        obj.setIsFutureEffectiveDate(false);
        obj.setCostType("WAREHOUSE PACK COST");
        obj.setSource("COST IQ");
        obj.setCreatedBy("lab1 account");
        obj.setCreatedByUserId("LB-cost-test");
        obj.setCreatedTs("2022-12-29T02:42:25.529Z");
        obj.setCurrentRetailPrice(new BigDecimal(55.0)) ;
        obj.setCurrentOrderableCost(null);
        obj.setCurrentWarehousePackCost(new BigDecimal((0.0)));
        obj.setCurrentOrderablePrepaidCost(null) ;
        obj.setCurrentOrderableCollectCost(null);
        obj.setMarginChange(new BigDecimal((-100.0)));
        obj.setOwedToClub(new BigDecimal((0.0)));
        obj.setItemSourceId(3572924);
        obj.setPriceDestId(701800);
        obj.setCategory(87);
        obj.setOrderableQty(null);
        obj.setOldMargin(new BigDecimal((100.0)));
        obj.setNewMargin(new BigDecimal(0.0));

        return obj;
    }

    private String costIQPayloadString() throws JsonProcessingException
    {

         String key =  "{\"retailTypeReasonCode\":{\"retailTypeReasonCodeId\":{\"retailType\":\"BP\",\"retailReasonCode\":\"CC\"}},\"expirationDate\":null,\"customerRetailAmount\":0.0,\"auditMessage\":null,\"createdTimestamp\":null,\"clientID\":\"COST IQ\",\"rowNumber\":0,\"auditRecordTimestamp\":null,\"clubNumber\":4931,\"itemNumber\":123,\"effectiveDate\":\"2022-12-29\",\"submissionID\":null,\"retailAmount\":55.0,\"createdBy\":\"lab1 account\"}";
         String key2 = "{\"retailTypeReasonCode\":{\"retailTypeReasonCodeId\":{\"retailType\":\"BP\",\"retailReasonCode\":\"CC\"}},\"expirationDate\":null,\"customerRetailAmount\":0.0,\"auditMessage\":null,\"createdTimestamp\":null,\"clientID\":\"COST IQ\",\"rowNumber\":0,\"auditRecordTimestamp\":null,\"categoryId\":87,\"subCategoryId\":1,\"clubNumber\":4931,\"itemNumber\":123,\"effectiveDate\":\"2022-12-29\",\"submissionID\":null,\"retailAmount\":10.0,\"createdBy\":\"lab1 account\"}";
         return key2;

    }

    @Test
     void test() throws Exception {
        // Set up the mock endpoints
        mock.expectedBodiesReceived(costIQPayloadString());

//p.interceptSendToEndpoint( Endpoints.SEDA_PROCESS_ENDPOINT).to(mock.getEndpointUri());
        Mockito.when(rulesEngineClientMock.validateRules((costIQObject()))).thenReturn(costIQObject());  //.thenR

        Map<String, Object> headers = new HashMap<>();
        headers.put("appName", "costIQ");

        //   Send the test message to the SEDA_SEND_ENDPOINT
        template.sendBodyAndHeaders(Endpoints.SEDA_SEND_ENDPOINT, costIQObject(), headers);

        mock.assertIsSatisfied();

    }

}
</code>```

I have looked at advice with but that involves adding in the cameltestsupport and would need to re-write this code. Is there a way to do this with current implementations?

Body:
I have this test class - currently it is checking the response at the endpoint

Endpoints.SEDA_PROCESS_ENDPOINT

but I need it to check at

 "mock:"+Endpoints.SEDA_PROCESS_ENDPOINT

Is there a way to forward the response to this mock endpoint I have just defined?

below is my test class

package com.sams.pricing.prism.data.processor;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.MockEndpoints;
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.sams.pricing.prism.data.processor.model.CostIQRetail;
import com.sams.pricing.prism.data.processor.routes.PrismRouter;
import com.sams.pricing.prism.data.processor.service.RulesEngineClient;
import com.sams.pricing.prism.data.processor.util.Endpoints;

@SpringBootTest
@CamelSpringBootTest
@MockEndpoints( Endpoints.SEDA_PROCESS_ENDPOINT)
public class CamelRouteTests3  {

        @Autowired
        private ProducerTemplate template;

        @EndpointInject( "mock:" + Endpoints.SEDA_PROCESS_ENDPOINT)
        private MockEndpoint mock;

        @Mock
        private  PrismRouter p;

        @Mock
        private RulesEngineClient rulesEngineClientMock;

    public CostIQRetail costIQObject() {

        CostIQRetail obj = new CostIQRetail();

        obj.setItemNbr(123);
        obj.setLocationNbr(4931);
        obj.setIsDcFlag(false) ;
        obj.setStatus("SUCCESS");
        obj.setOrderableCost(new BigDecimal((10.0)));
        obj.setWarehousePackCost(new BigDecimal(100.0));
        obj.setOrderablePrepaidCost(null) ;
        obj.setOrderableCollectCost(null) ;
        obj.setReasonCode("Markdown - category funded");
        obj.setEffectiveDate("2022-12-29");
        obj.setIsFutureEffectiveDate(false);
        obj.setCostType("WAREHOUSE PACK COST");
        obj.setSource("COST IQ");
        obj.setCreatedBy("lab1 account");
        obj.setCreatedByUserId("LB-cost-test");
        obj.setCreatedTs("2022-12-29T02:42:25.529Z");
        obj.setCurrentRetailPrice(new BigDecimal(55.0)) ;
        obj.setCurrentOrderableCost(null);
        obj.setCurrentWarehousePackCost(new BigDecimal((0.0)));
        obj.setCurrentOrderablePrepaidCost(null) ;
        obj.setCurrentOrderableCollectCost(null);
        obj.setMarginChange(new BigDecimal((-100.0)));
        obj.setOwedToClub(new BigDecimal((0.0)));
        obj.setItemSourceId(3572924);
        obj.setPriceDestId(701800);
        obj.setCategory(87);
        obj.setOrderableQty(null);
        obj.setOldMargin(new BigDecimal((100.0)));
        obj.setNewMargin(new BigDecimal(0.0));

        return obj;
    }

    private String costIQPayloadString() throws JsonProcessingException
    {

         String key =  "{\"retailTypeReasonCode\":{\"retailTypeReasonCodeId\":{\"retailType\":\"BP\",\"retailReasonCode\":\"CC\"}},\"expirationDate\":null,\"customerRetailAmount\":0.0,\"auditMessage\":null,\"createdTimestamp\":null,\"clientID\":\"COST IQ\",\"rowNumber\":0,\"auditRecordTimestamp\":null,\"clubNumber\":4931,\"itemNumber\":123,\"effectiveDate\":\"2022-12-29\",\"submissionID\":null,\"retailAmount\":55.0,\"createdBy\":\"lab1 account\"}";
         String key2 = "{\"retailTypeReasonCode\":{\"retailTypeReasonCodeId\":{\"retailType\":\"BP\",\"retailReasonCode\":\"CC\"}},\"expirationDate\":null,\"customerRetailAmount\":0.0,\"auditMessage\":null,\"createdTimestamp\":null,\"clientID\":\"COST IQ\",\"rowNumber\":0,\"auditRecordTimestamp\":null,\"categoryId\":87,\"subCategoryId\":1,\"clubNumber\":4931,\"itemNumber\":123,\"effectiveDate\":\"2022-12-29\",\"submissionID\":null,\"retailAmount\":10.0,\"createdBy\":\"lab1 account\"}";
         return key2;

    }

    @Test
     void test() throws Exception {
        // Set up the mock endpoints
        mock.expectedBodiesReceived(costIQPayloadString());

//p.interceptSendToEndpoint( Endpoints.SEDA_PROCESS_ENDPOINT).to(mock.getEndpointUri());
        Mockito.when(rulesEngineClientMock.validateRules((costIQObject()))).thenReturn(costIQObject());  //.thenR

        Map<String, Object> headers = new HashMap<>();
        headers.put("appName", "costIQ");

        //   Send the test message to the SEDA_SEND_ENDPOINT
        template.sendBodyAndHeaders(Endpoints.SEDA_SEND_ENDPOINT, costIQObject(), headers);

        mock.assertIsSatisfied();

    }

}

I have looked at advice with but that involves adding in the cameltestsupport and would need to re-write this code. Is there a way to do this with current implementations?


问:
Cabal - Rebuild on file change
Is there a cabal option to rebuild (or even run the tests and do other stuff) on every source file change? With Stack there is the --file-watch option, anything similar for Cabal? Or do people just use ghcid for that?

Title: Cabal - Rebuild on file change


问:
SwiftUI NavigationStack .searchable .onSubmit
I have MainView and where I have NavigationStack. I need to make it so that when I press the Search button, another view is shown and when I press the Cancel button, it is hidden again.

```<code>var body: some View {
        NavigationStack {

            if ($searchText.wrappedValue.isEmpty) {
                ScrollView(.vertical, showsIndicators: true){
                    something()
                }.navigationBarTitle("Summary")}

            else { Text("Find: \(searchText)") }

            if (showView==true) {
                        showSomethingView()
                }

            }
            .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always), prompt: "Look for something")
            .onSubmit(of: .search) { showView=true }

    }
</code>```

I need to perform a search after the user clicks the Search button. At the same time there is no such thing as onCancel.

Body:
I have MainView and where I have NavigationStack. I need to make it so that when I press the Search button, another view is shown and when I press the Cancel button, it is hidden again.

var body: some View {
        NavigationStack {

            if ($searchText.wrappedValue.isEmpty) {
                ScrollView(.vertical, showsIndicators: true){
                    something()
                }.navigationBarTitle("Summary")}

            else { Text("Find: \(searchText)") }

            if (showView==true) {
                        showSomethingView()
                }

            }
            .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always), prompt: "Look for something")
            .onSubmit(of: .search) { showView=true }

    }

I need to perform a search after the user clicks the Search button. At the same time there is no such thing as onCancel.


问:
how to add performance checks for Web Vitals scores in E2E testing with different network conditions using playwright
I want to check the web performances scores like First Contentful Paint (FCP), Time to Interactive (TTI), and other web vitals score using playwright and also want to check network throttling in different conditions like slow 3g how can that be achieved using playwright.


问:
How to get the TeamID of the Apple Developer Profile from the iPad in Xamarin.Forms
I'm working on Xamarin.Forms Application: I want to know the iPad's TeamID linked to Apple Developer Profile which will help in creating a work based on the TeamID in order to distinguish from which account the iPad belongs!

As my company is having multiple TeamID's so I need to know from which TeamID the iPad is registered as I need to create a KeychainAccess Group with the name of the TeamID.


问:
Emacs org-mode TAB not working to unfold headings
Ok I have to say I’m a bit stuck here. I am used to have conflicts between my mac os (at home) and my windows (at work) configuration which use the same .emacs.d init file.
I have recently changed my professionnal computer and needed to synchronize my init file again and now the TAB key which usually fold and unfold heading in org (one of the moste usefull and used key in org I would say) doesn’t work. But it works on my mac OS with the exact same configuration.
Another strange behaviour is that when I use Shift-TAB it actually unfold everything (but only on se second click...)
Is someone out there that have any explanation to this? I’m a bit lost.

I can print my init file here if needed.


问:
erlang gen_tcp:connect/3 not working with rpc:call/4, anyone knows why?
Could not solve this by myself

launched a new node A with ssh command

started a new node B

gen_tcp:connect/3 works on B, but rpc:call(B,gen_tcp,connect,Params) not works.

Both nodes are running on local laptop

and one node returns ok and the other node returns error.

I don't understand.

Anyone knows why?

```<code>~ $ssh allen@127.0.0.1  'erl -name loadtest@127.0.0.1 -detached -setcookie loadtest'
~ $erl -name allen@127.0.0.1 -setcookie loadtest
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.4  (abort with ^G)
(allen@127.0.0.1)1> gen_tcp:connect("www.google.com",80,[]).
{ok,#Port<0.630>}
(allen@127.0.0.1)2> rpc:call('loadtest@127.0.0.1',gen_tcp,connect,["www.google.com",80,[]]).
{error,nxdomain}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Could not solve this by myself

launched a new node A with ssh command

started a new node B

gen_tcp:connect/3 works on B, but rpc:call(B,gen_tcp,connect,Params) not works.

Both nodes are running on local laptop

and one node returns ok and the other node returns error.

I don't understand.

Anyone knows why?

~ $ssh allen@127.0.0.1  'erl -name loadtest@127.0.0.1 -detached -setcookie loadtest'
~ $erl -name allen@127.0.0.1 -setcookie loadtest
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.4  (abort with ^G)
(allen@127.0.0.1)1> gen_tcp:connect("www.google.com",80,[]).
{ok,#Port<0.630>}
(allen@127.0.0.1)2> rpc:call('loadtest@127.0.0.1',gen_tcp,connect,["www.google.com",80,[]]).
{error,nxdomain}


问:
How do you share an expensive component between pages in Angular?
I have an Angular app that shares a table component on several distinct pages. Fetching data for the table is an expensive operation, so I'd like to reuse the same table on different pages. Furthermore, the table is placed differently in each page, so having the table as a part of a common layout is unfortunately not possible.

Here's a few simplified pages.

full-view-page.ts

```<code>@Component({
  selector: `full-page`,
  template:
`
<h1>Accounts Table</h1>
<expensive-table></expensive-table>
`.
)}
</code>```

accounts-page.ts

```<code>@Component({
  selector: 'accounts-page',
  template:
`
<h1>Accounts</h1>
<expensive-table></expensive-table>
<form *ngIf="account">
  // Form content here
</form>
`,
  styles: [// Some styles here...]
})
</code>```

charts-page.ts

```<code>@Component({
  selector: 'charts-page',
  template:
`
<h1>Charts</h1>
<analysis-charts></analysis-charts>
<expensive-table></expensive-table>
<recommendation></recommendation>
`,
  styles: [// Some styles here...]
})
</code>```

Ideally, Angular only loads the component expensive-table only once and builds "around" the component so that the state of the component (current search, scrollbar, filters) is always the same. Right now, I see a separate table being loaded for each page.

Body:
I have an Angular app that shares a table component on several distinct pages. Fetching data for the table is an expensive operation, so I'd like to reuse the same table on different pages. Furthermore, the table is placed differently in each page, so having the table as a part of a common layout is unfortunately not possible.

Here's a few simplified pages.

full-view-page.ts

@Component({
  selector: `full-page`,
  template:
`

Accounts Table

<expensive-table></expensive-table>
`.
)}

accounts-page.ts

@Component({
  selector: 'accounts-page',
  template:
`

Accounts

<expensive-table></expensive-table>
<form *ngIf="account">
  // Form content here
</form>
`,
  styles: [// Some styles here...]
})

charts-page.ts

@Component({
  selector: 'charts-page',
  template:
`

Charts

<analysis-charts></analysis-charts>
<expensive-table></expensive-table>
<recommendation></recommendation>
`,
  styles: [// Some styles here...]
})

Ideally, Angular only loads the component expensive-table only once and builds "around" the component so that the state of the component (current search, scrollbar, filters) is always the same. Right now, I see a separate table being loaded for each page.


问:
Linking between multiple angular libs and angular app without build/watch
before starting, the project structure, everything is an angular project, yes there are many libs:

core-libs:

A

B has dependency to A

C has dependency to A-B

D

intermediate-libs:

F has dependencies to A-D

G has dependencies to D

web-app

X has dependencies with all above libs.

Currently im linking them with npm i [path to lib-dist-folder] and run all projects in watch-mode. It works but has some drawbacks with that many libs.

I need to start all projects manually with the watch mode what some times take. Script for this isn't easy because the next lib needs a finished build/watch from his dependency.
Even in watch mode it takes some time to finish a change in lib A -> Every lib in the chain starts building but can't successful finish because lib A isn't completed. After A is completed the other libs starts again.
And the last point is it is eating all of my performance, RAM and CPU power.

My question is, is there a better solution? Like linking directly to the source files of the libs and the web-apps build all libs in one strike.
Tried to link directly to the src-folder but the web-app can't find the packages. I think angular/ts wants only the build files with this approach.

Adding the libs in the tsconfig.js paths resulted in a great number of different build errors, like

 xy.component.ts:461:98 - error TS2339: Property 'length' does not exist on type 'unknown'.

461     if (text.length > 123) {
```

or Cannot find module 'lib B' or its corresponding type declarations.

Body:
before starting, the project structure, everything is an angular project, yes there are many libs:

core-libs:

A

B has dependency to A

C has dependency to A-B

D

intermediate-libs:

F has dependencies to A-D

G has dependencies to D

web-app

X has dependencies with all above libs.

Currently im linking them with npm i [path to lib-dist-folder] and run all projects in watch-mode. It works but has some drawbacks with that many libs.

I need to start all projects manually with the watch mode what some times take. Script for this isn't easy because the next lib needs a finished build/watch from his dependency.
Even in watch mode it takes some time to finish a change in lib A -> Every lib in the chain starts building but can't successful finish because lib A isn't completed. After A is completed the other libs starts again.
And the last point is it is eating all of my performance, RAM and CPU power.

My question is, is there a better solution? Like linking directly to the source files of the libs and the web-apps build all libs in one strike.
Tried to link directly to the src-folder but the web-app can't find the packages. I think angular/ts wants only the build files with this approach.

Adding the libs in the tsconfig.js paths resulted in a great number of different build errors, like

 xy.component.ts:461:98 - error TS2339: Property 'length' does not exist on type 'unknown'.

461     if (text.length > 123) {

or Cannot find module 'lib B' or its corresponding type declarations.


问:
Object detection and tracking with zed-2i camera
i am new to the zed camera and my goal is to find and track the objects within the scene using zed-2i camera.also objects has to have a unique id and and their distance from the camera. can someone suggest me to right approach how it can be solved? my understanding is integrating zed with yolov5 might solve the problem ?

i am currently working on yolov5 custom detection example from git-hub (zed_examples). but still there is an dependency problem with the custom detection here. is here any alternative approach to track the objects along with their 3D information using Zed-2i.
Please do not hesitate to share your inputs.
Thank you


问:
failed fetch api and changing the variable - javascript
failed in fetch api in javascript, aslo I want to change the "trading_pairs" variable to market and shows for example "market": "BTC-USDT",</p>
```<code>   fetch("https://app.crossexchange.pro/api/v2/peatio/coinmarketcap/summary", {

method:"GET",
body: JSON.stringify({
 trading_pairs: "trading_pairs",

}),
headers: {
  "Content-Type": "application/json"
}

})
  .then(res => {
    return res.json();
  })
  .then(post => {
    console.log(get);
   })
  .catch(err => {

   console.log("failed");
 })
</code>```

Body:
failed in fetch api in javascript, aslo I want to change the "trading_pairs" variable to market and shows for example "market": "BTC-USDT",

   fetch("https://app.crossexchange.pro/api/v2/peatio/coinmarketcap/summary", {

method:"GET",
body: JSON.stringify({
 trading_pairs: "trading_pairs",

}),
headers: {
  "Content-Type": "application/json"
}

})
  .then(res => {
    return res.json();
  })
  .then(post => {
    console.log(get);
   })
  .catch(err => {

   console.log("failed");
 })


问:
Grails 5.2.5 which event is triggered during recompilation
Dear Stackoverflow Gurus,
I am working with Grails for one of the projects and find this technology very fun to work with. During development of some logic however I need to wait for a long time for a restarting of application in order to test the change that is implemented. This means that after changing single line of code I need to wait for 5+ minutes (because of multiple plugins that are loaded during startup of application) to verify it. Also because of custom logic of some service in project for shutdown I am not be able to use some tools like JRebel or DCEVM. So I am trying to find some custom solution for fast restart without loading the plugins again. Auto recompilation of project is enabled. I find that one method of service (that has custom logic for shutdown) annotated with @PreDestroy annotation from JSR standard is executed during recompilation but the methods annotated with @PostConstruct never do. Which event is triggered after Grails Recompilation during initialization? I found that neither methods from BootStrap, nor GrailsAutoConfiguration classes are called (like 'init', 'onStartup', 'doWithApplicationContext').</p>


问:
Breadcrumbs <Link> wrapped in
 not clickable nextjs
I am using this blog as a reference as I implement breadcrumbs for a nextjs app. Everything works well except the breadcrumbs are not clickable. I would like the user to be able to click on a breadcrumb and be redirected to its path.
My assumption is that wrapping the link in li tags is what brings this issue but am not sure why. Will appreciate a third eye

components/BreadrumbItem.jsx

```<code>import Link from "next/link";

const BreadcrumbItem = ({ children, href, ...props }) => {

  return (
    <li {...props}>
      <Link href={href} passHref>
        <a>
          {children}
        </a>
      </Link>
    </li>
  );
};

export default BreadcrumbItem;
</code>```

components/Breadcrumb.jsx

```<code>import { Children } from "react";
import { Fragment } from "react";

const Breadcrumb = ({ children }) => {
  const childrenArray = Children.toArray(children);

  const childrenWtihSeperator = childrenArray.map((child, index) => {
    if (index !== childrenArray.length - 1) {
      return (
        <Fragment key={index}>
          {child}
          <span className="text-gray-400 text-[16px] font-medium">{">"}</span>
        </Fragment>
      );
    }
    return child;
  });

  return (
    <nav className="mx-8 md:mx-16 lg:mx-0 -mt-9 mb-2" aria-label="breadcrumb">
      <ol className="flex items-center space-x-1">{childrenWtihSeperator}</ol>
    </nav>
  );
};

export default Breadcrumb;
</code>```

components/layout.tsx

```<code>const Layout = ({ children }: Props) => {

  const router = useRouter();

  const [breadcrumbs, setBreadcrumbs] = useState();

  useEffect(() => {
    const pathWithoutQuery = router.asPath.split("?")[0];
    let pathArray = pathWithoutQuery.split("/");
    pathArray.shift();

    pathArray = pathArray.filter((path) => path !== "");

    const breadcrumbs = pathArray.map((path, index) => {
      const href = "/" + pathArray.slice(0, index + 1).join("/");
      return {
        href,
        label: path.charAt(0).toUpperCase() + path.slice(1),
        isCurrent: index === pathArray.length - 1,
      };
    });
//@ts-ignore
    setBreadcrumbs(breadcrumbs);
  }, [router.asPath]);

  return (
    <>
     <Breadcrumb>
        <BreadcrumbItem isCurrent={router.pathname === "/"} href="/">
          Home
        </BreadcrumbItem>
        {breadcrumbs &&
        //@ts-ignore
          breadcrumbs.map((breadcrumb) => (
            <BreadcrumbItem
              key={breadcrumb.href}
              href={breadcrumb.href}
              isCurrent={breadcrumb.isCurrent}
            >
              {breadcrumb.label}
            </BreadcrumbItem>
          ))}
      </Breadcrumb>
    </>
  )
}

export default Layout;
</code>```

Title: Breadcrumbs <Link> wrapped in <li> not clickable nextjs

Body:
I am using this blog as a reference as I implement breadcrumbs for a nextjs app. Everything works well except the breadcrumbs are not clickable. I would like the user to be able to click on a breadcrumb and be redirected to its path.
My assumption is that wrapping the link in li tags is what brings this issue but am not sure why. Will appreciate a third eye

components/BreadrumbItem.jsx

import Link from "next/link";

const BreadcrumbItem = ({ children, href, ...props }) => {

  return (

      <Link href={href} passHref>

          {children}

      </Link>

  );
};

export default BreadcrumbItem;

components/Breadcrumb.jsx

import { Children } from "react";
import { Fragment } from "react";

const Breadcrumb = ({ children }) => {
  const childrenArray = Children.toArray(children);

  const childrenWtihSeperator = childrenArray.map((child, index) => {
    if (index !== childrenArray.length - 1) {
      return (
        <Fragment key={index}>
          {child}
          {">"}
        </Fragment>
      );
    }
    return child;
  });

  return (

{childrenWtihSeperator}

  );
};

export default Breadcrumb;

components/layout.tsx

const Layout = ({ children }: Props) => {

  const router = useRouter();

  const [breadcrumbs, setBreadcrumbs] = useState();

  useEffect(() => {
    const pathWithoutQuery = router.asPath.split("?")[0];
    let pathArray = pathWithoutQuery.split("/");
    pathArray.shift();

    pathArray = pathArray.filter((path) => path !== "");

    const breadcrumbs = pathArray.map((path, index) => {
      const href = "/" + pathArray.slice(0, index + 1).join("/");
      return {
        href,
        label: path.charAt(0).toUpperCase() + path.slice(1),
        isCurrent: index === pathArray.length - 1,
      };
    });
//@ts-ignore
    setBreadcrumbs(breadcrumbs);
  }, [router.asPath]);

  return (
    <>
     <Breadcrumb>
        <BreadcrumbItem isCurrent={router.pathname === "/"} href="/">
          Home
        </BreadcrumbItem>
        {breadcrumbs &&
        //@ts-ignore
          breadcrumbs.map((breadcrumb) => (
            <BreadcrumbItem
              key={breadcrumb.href}
              href={breadcrumb.href}
              isCurrent={breadcrumb.isCurrent}
            >
              {breadcrumb.label}
            </BreadcrumbItem>
          ))}
      </Breadcrumb>
    </>
  )
}

export default Layout;


问:
Powershell script to install all the updates from MS software center
I have a machine (windows 2012 R2) with MECM/SCCM client (MS software center).

Is there any powershell script which I could run on my machine to install all the avaiable software patches/updates ?


问:
i am creating orm python and have one question
i can't understand MetaModel, how can explain?

```<code>class BaseManager:

    def __init__(self, model_class):
        self.model_class = model_class

    def select(self, *field_names):
        pass

    def bulk_insert(self, rows: list):
        pass

    def update(self, new_data: dict):
        pass

    def delete(self):
        pass

# ----------------------- Model ----------------------- #
class MetaModel(type):
    manager_class = BaseManager

    def _get_manager(cls):
        return cls.manager_class(model_class=cls)

    @property
    def objects(cls):
        return cls._get_manager()

class BaseModel(metaclass=MetaModel):
    table_name = ""
</code>```

Creating ORM python with metaclass

Body:
i can't understand MetaModel, how can explain?

class BaseManager:

    def __init__(self, model_class):
        self.model_class = model_class

    def select(self, *field_names):
        pass

    def bulk_insert(self, rows: list):
        pass

    def update(self, new_data: dict):
        pass

    def delete(self):
        pass

# ----------------------- Model ----------------------- #
class MetaModel(type):
    manager_class = BaseManager

    def _get_manager(cls):
        return cls.manager_class(model_class=cls)

    @property
    def objects(cls):
        return cls._get_manager()

class BaseModel(metaclass=MetaModel):
    table_name = ""

Creating ORM python with metaclass


问:
Using javax.servlet in jdk11 and wildfly27
I try to use https://github.com/mitre/HTTP-Proxy-Servlet in wildfly27 with jdk11

I get the following error
Should it work as it is , or should i replace javax with jakarta?

Is this problem because i use wildfly, and it won't happen with another server app like tomcat?

```<code>11:23:55,153 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."proxy.war".undertow-deployment.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.deployment.unit."proxy.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start service
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: UT010009: Servlet proxyHostServer of type class org.mitre.dsmiley.httpproxy.ProxyServlet does not implement jakarta.servlet.Servlet
        at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.api.ServletInfo.<init>(ServletInfo.java:98)
        at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:660)
        at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:288)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
</code>```

Body:
I try to use https://github.com/mitre/HTTP-Proxy-Servlet in wildfly27 with jdk11

I get the following error
Should it work as it is , or should i replace javax with jakarta?

Is this problem because i use wildfly, and it won't happen with another server app like tomcat?

11:23:55,153 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."proxy.war".undertow-deployment.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.deployment.unit."proxy.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start service
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: UT010009: Servlet proxyHostServer of type class org.mitre.dsmiley.httpproxy.ProxyServlet does not implement jakarta.servlet.Servlet
        at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.api.ServletInfo.<init>(ServletInfo.java:98)
        at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:660)
        at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:288)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)


问:
i have created an insta image scaper using urllib but the files cannot be opened
so i have tried shutil also, as far as i can figure the file gets generated and downloaded but at the end it refuses to be opened by any software. can someone tell me why??

This is for private use for promotion of events and does not violate any t&s

```<code>import tkinter as tk
import urllib.request
import os

def download_instagram_post(url, counter):
  # Use urllib to download the image data from the URL
  with urllib.request.urlopen(url) as url:
    data = url.read()

  # Save the image data to a file
  filename = f"instagram_post_{counter}.png"
  filepath = os.path.join("path\\i\\have\\used", filename)
  with open(filepath, "wb") as f:
    f.write(data)
  return filepath

class App:
  def __init__(self, master):
    self.master = master
    self.counter = 1
    self.create_widgets()

  def create_widgets(self):
    #a label
    self.label = tk.Label(self.master, text="Enter Instagram post URL:", font=("Helvetica", 16),     fg="#333")
    self.label.pack()

    #entry widget
    self.entry = tk.Entry(self.master, font=("Helvetica", 14), bg="#fafafa")
    self.entry.pack()

    #download button
    self.button = tk.Button(self.master, text="Download", font=("Helvetica", 14), bg="#333",  fg="#fff", command=self.download)
    self.button.pack()

  def download(self):
    url = self.entry.get()
    download_instagram_post(url, self.counter)
    tk.Label(self.master, text="Post downloaded!", font=("Helvetica", 16), fg="#333").pack()
    self.counter += 1

  def exit(self):
    self.master.destroy()

if __name__ == '__main__':
  root = tk.Tk()
  root.geometry("800x600")  #size of the window
  app = App(root)
  root.mainloop()
</code>```

Body:
so i have tried shutil also, as far as i can figure the file gets generated and downloaded but at the end it refuses to be opened by any software. can someone tell me why??

This is for private use for promotion of events and does not violate any t&s

import tkinter as tk
import urllib.request
import os

def download_instagram_post(url, counter):
  # Use urllib to download the image data from the URL
  with urllib.request.urlopen(url) as url:
    data = url.read()

  # Save the image data to a file
  filename = f"instagram_post_{counter}.png"
  filepath = os.path.join("path\\i\\have\\used", filename)
  with open(filepath, "wb") as f:
    f.write(data)
  return filepath

class App:
  def __init__(self, master):
    self.master = master
    self.counter = 1
    self.create_widgets()

  def create_widgets(self):
    #a label
    self.label = tk.Label(self.master, text="Enter Instagram post URL:", font=("Helvetica", 16),     fg="#333")
    self.label.pack()

    #entry widget
    self.entry = tk.Entry(self.master, font=("Helvetica", 14), bg="#fafafa")
    self.entry.pack()

    #download button
    self.button = tk.Button(self.master, text="Download", font=("Helvetica", 14), bg="#333",  fg="#fff", command=self.download)
    self.button.pack()

  def download(self):
    url = self.entry.get()
    download_instagram_post(url, self.counter)
    tk.Label(self.master, text="Post downloaded!", font=("Helvetica", 16), fg="#333").pack()
    self.counter += 1

  def exit(self):
    self.master.destroy()

if __name__ == '__main__':
  root = tk.Tk()
  root.geometry("800x600")  #size of the window
  app = App(root)
  root.mainloop()