问:
Heroku H10 "App crashed" on wakeup; cleared by restarting dyno
I have a node.js web app running on a Heroku eco dyno.  Eco dynos sleep if not used for 30 minutes.  My app has been running on the free dynos for a couple of years without issue, and "upgraded" to eco when Heroku eliminated the free tier.  A couple of weeks ago (suspiciously, the first day operating as eco instead of free) when we started work for the day every attempt to access the app returned "Application error".  In the Heroku logs there was an H10 "App crashed" message for each access, but nothing else.  Clicking "Restart all dynos" on the dashboard cleared the problem.  Inconvenient, but problem solved.

Until this morning, exactly two weeks later, when it happened again.  Manually restarting the dyno cleared it again.  My app doesn't log or report any errors, because it doesn't get started.  And the Heroku logs don't appear to contain any useful information.

I've made no changes to the app since the previous kerfuffle two weeks ago; it's been starting fine every morning.

Here's an example error message from logtail (xxx.xxx.xxx.xxx is our IP address):

```<code>2022-12-16 13:33:20.653 [exampledyno] router connect= GET exampledyno.herokuapp.com / xxx.xxx.xxx.xxx at=error code=H10 desc="App crashed" method=GET path="/" host=exampledyno.herokuapp.com request_id=[blah] fwd="xxx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes= protocol=https
</code>```

The last messages in the log prior to this are the normal "Idling" sequence as the dyno goes to sleep:

```<code>2022-12-15 22:59:00.585 [exampledyno] web.1 Idling
2022-12-15 22:59:00.587 [exampledyno] web.1 State changed from up to down
2022-12-15 22:59:01.567 [exampledyno] web.1 Stopping all processes with SIGTERM
2022-12-15 22:59:01.764 [exampledyno] web.1 1 Process exited with status 0
</code>```

Then nothing overnight, until it fails to wake up the next morning.

Now I'd like to figure out what's happening because once is annoying but twice is the beginning of a pattern.

Body:
I have a node.js web app running on a Heroku eco dyno.  Eco dynos sleep if not used for 30 minutes.  My app has been running on the free dynos for a couple of years without issue, and "upgraded" to eco when Heroku eliminated the free tier.  A couple of weeks ago (suspiciously, the first day operating as eco instead of free) when we started work for the day every attempt to access the app returned "Application error".  In the Heroku logs there was an H10 "App crashed" message for each access, but nothing else.  Clicking "Restart all dynos" on the dashboard cleared the problem.  Inconvenient, but problem solved.

Until this morning, exactly two weeks later, when it happened again.  Manually restarting the dyno cleared it again.  My app doesn't log or report any errors, because it doesn't get started.  And the Heroku logs don't appear to contain any useful information.

I've made no changes to the app since the previous kerfuffle two weeks ago; it's been starting fine every morning.

Here's an example error message from logtail (xxx.xxx.xxx.xxx is our IP address):

2022-12-16 13:33:20.653 [exampledyno] router connect= GET exampledyno.herokuapp.com / xxx.xxx.xxx.xxx at=error code=H10 desc="App crashed" method=GET path="/" host=exampledyno.herokuapp.com request_id=[blah] fwd="xxx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes= protocol=https

The last messages in the log prior to this are the normal "Idling" sequence as the dyno goes to sleep:

2022-12-15 22:59:00.585 [exampledyno] web.1 Idling
2022-12-15 22:59:00.587 [exampledyno] web.1 State changed from up to down
2022-12-15 22:59:01.567 [exampledyno] web.1 Stopping all processes with SIGTERM
2022-12-15 22:59:01.764 [exampledyno] web.1 1 Process exited with status 0

Then nothing overnight, until it fails to wake up the next morning.

Now I'd like to figure out what's happening because once is annoying but twice is the beginning of a pattern.


来源: stackexchange

问:
Compilation when trying to convert error from an external crate into my custom error type with `thiserror`
I am trying to use the thiserror crate to convert an error into my custom error but I am getting this compilation error message. The error I am trying to implement is the MiddlewareError from the Ethers-rs crate. Below is the compilation error I am getting.

```<code>`?` couldn't convert the error to `CFFMError<M>`
the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
required because of the requirements on the impl of
`FromResidual<Result<Infallible, <M as Middleware>::Error>>` for `Result<(), CFFMError<M>>

consider introducing a `where` clause, but there might be an alternative better way to express this requirement: ` where CFFMError<M>: From<<M as Middleware>::Error>`
</code>```

My error type is defined as

use ethers::prelude::gas_oracle::MiddlewareError;
use ethers::prelude::{AbiError, ContractError};
use ethers::providers::{JsonRpcClient, Middleware, Provider, ProviderError};
use ethers::types::H160;
use thiserror::Error;
use tokio::task::JoinError;
use uniswap_v3_math::error::UniswapV3MathError;

#[derive(Error, Debug)]
pub enum CFFMError<M>
where
    M: Middleware,
{
    #[error("Middleware error")]
    MiddlewareError(#[from] MiddlewareError<M>),
//--snip--
}
```
<p>When trying to add the following, I get another error saying</p>
```conflicting implementations of trait `std::convert::From<error::CFFMError<_>>` for type `error::CFFMError<_>`
conflicting implementation in crate `core`:
- impl<T> From<T> for T;
```
<pre class="lang-rust prettyprint-override"><code>#[derive(Error, Debug)]
pub enum CFFMError<M>
where
    M: Middleware,
{
    #[error("Middleware error")]
    MiddlewareError(#[from] MiddlewareError<M>),

    #[error("some error message")]
    OtherMiddlewareError(#[from] M::Error),
//--snip--
}
</code>```

Can anyone help advise on what do to to resolve this compilation error?

ContentLicense: CC BY-SA 4.0

Body:
I am trying to use the thiserror crate to convert an error into my custom error but I am getting this compilation error message. The error I am trying to implement is the MiddlewareError from the Ethers-rs crate. Below is the compilation error I am getting.

`?` couldn't convert the error to `CFFMError<M>`
the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
required because of the requirements on the impl of
`FromResidual<Result<Infallible, <M as Middleware>::Error>>` for `Result<(), CFFMError<M>>

consider introducing a `where` clause, but there might be an alternative better way to express this requirement: ` where CFFMError<M>: From<<M as Middleware>::Error>`

My error type is defined as

use ethers::prelude::gas_oracle::MiddlewareError;
use ethers::prelude::{AbiError, ContractError};
use ethers::providers::{JsonRpcClient, Middleware, Provider, ProviderError};
use ethers::types::H160;
use thiserror::Error;
use tokio::task::JoinError;
use uniswap_v3_math::error::UniswapV3MathError;

#[derive(Error, Debug)]
pub enum CFFMError<M>
where
    M: Middleware,
{
    #[error("Middleware error")]
    MiddlewareError(#[from] MiddlewareError<M>),
//--snip--
}

When trying to add the following, I get another error saying

conflicting implementations of trait `std::convert::From<error::CFFMError<_>>` for type `error::CFFMError<_>`
conflicting implementation in crate `core`:
- impl<T> From<T> for T;

#[derive(Error, Debug)]
pub enum CFFMError<M>
where
    M: Middleware,
{
    #[error("Middleware error")]
    MiddlewareError(#[from] MiddlewareError<M>),

    #[error("some error message")]
    OtherMiddlewareError(#[from] M::Error),
//--snip--
}

Can anyone help advise on what do to to resolve this compilation error?


问:
Files 'dragged and dropped' into solution explorer in Visual Studio Community 2022 can't be tracked in git?
I wanted to try dragging and dropping files from Windows Explorer in to the Solution Explorer, and it seemed to work at first. However I realised after commiting and pushing my changes to git that I couldn't see any of the .cpp or .h files I dragged in and have no idea why.

I've noticed that these files aren't showing up the same as a source file that is added by right clicking in solution explorer and clicking Add >> New item. The files I dragged and dropped in have the plus icons:
dragged_in_files

But are missing the padlock symbol that I can see on files that are checked in, basically on every other file in my solution explorer:
added_in_files

On the files I have dragged in, I don't get any Git options when I right click on them, I can't see them in Windows Explorer in the project folder. I even tried excluding the files from the project just to see what would happen, but I didn't expect that they would complete disappear and are not even visible when I enable 'Show All Files' in the Solution Explorer.

I've only used Visual Studio Community Ed. for a while now and I'd just like to know how I can rectify this or enable the files to be tracked in my repo as it doesn't seem like they exist anywhere but in the IDE only.


问:
Implementing Struct for Trait: cannot infer type
Getting the following error:

error[E0283]: type annotations needed
  --> src/client.rs:35:30
   |
35 |     println!("client: {:?}", Command::add_task("test", 10));
   |                              ^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Command`

For more information about this error, try `rustc --explain E0283`.
```
<hr />
```pub trait Command {
    fn add_task(name: impl Into<String>, interval: u8) -> AddTask;
}

#[derive(Debug)]
struct AddTask {
    name: String,
    interval: u64,
}

impl Command for AddTask {
    fn add_task(name: impl Into<String>, interval: u8) -> AddTask {
        AddTask {
            name: name.into(),
            interval: 10,
        }
    }
}

println!("{:?}", Command::add_task("test", 10));
```

Body:
Getting the following error:

error[E0283]: type annotations needed
  --> src/client.rs:35:30
   |
35 |     println!("client: {:?}", Command::add_task("test", 10));
   |                              ^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Command`

For more information about this error, try `rustc --explain E0283`.

pub trait Command {
    fn add_task(name: impl Into<String>, interval: u8) -> AddTask;
}

#[derive(Debug)]
struct AddTask {
    name: String,
    interval: u64,
}

impl Command for AddTask {
    fn add_task(name: impl Into<String>, interval: u8) -> AddTask {
        AddTask {
            name: name.into(),
            interval: 10,
        }
    }
}

println!("{:?}", Command::add_task("test", 10));


问:
Innodb Engine Semaphore Waits
I'm not following exactly what i should take away from this wait information.I've been reading some guides and documentation but can't find anything about OS wait amounts and if this should be a reason for concern. We've had some slow inserts recently and am trying to track down a reason. This is mysql 5.7 running on an aws RDS instance.</p>
```<code>----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 60641802
OS WAIT ARRAY INFO: signal count 72330127
RW-shared spins 0, rounds 99448631, OS waits 28947103
RW-excl spins 0, rounds 1297861775, OS waits 23786302
RW-sx spins 2795229, rounds 5258299, OS waits 4114
Spin rounds per wait: 99448631.00 RW-shared, 1297861775.00 RW-excl, 1.88 RW-sx
</code>```

Title: Innodb Engine Semaphore Waits

Body:
I'm not following exactly what i should take away from this wait information.I've been reading some guides and documentation but can't find anything about OS wait amounts and if this should be a reason for concern. We've had some slow inserts recently and am trying to track down a reason. This is mysql 5.7 running on an aws RDS instance.

----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 60641802
OS WAIT ARRAY INFO: signal count 72330127
RW-shared spins 0, rounds 99448631, OS waits 28947103
RW-excl spins 0, rounds 1297861775, OS waits 23786302
RW-sx spins 2795229, rounds 5258299, OS waits 4114
Spin rounds per wait: 99448631.00 RW-shared, 1297861775.00 RW-excl, 1.88 RW-sx


问:
Random text prefixed to App::environment() for laravel app in production
I have a Laravel web app and I call App::environment() in the code to build indexes for elasticsearch. It works fine locally, but in production it seems to have a random string is prepended to the value.

The Laravel web app is running on aws via Laravel vapor

```<code>called App::environment().
expecting "production"
got "Ep9rE9bZ0fproduction"
</code>```

Body:
I have a Laravel web app and I call App::environment() in the code to build indexes for elasticsearch. It works fine locally, but in production it seems to have a random string is prepended to the value.

The Laravel web app is running on aws via Laravel vapor

called App::environment().
expecting "production"
got "Ep9rE9bZ0fproduction"


问:
Cors issue with reverse proxy witn nginx for react app
I have my frontend(react app) run by webpack dev server on localhost:3000
I am running nginx server with the following conf so that i can use ui.mydomain.com to point to localhost:3000 so that in can use this ui.mydomain.com with https.

```<code>server {
    listen       443 http2 ssl;
    listen       [::]:443 http2 ssl;
    server_name  ui.mydomain.com;

    ssl_certificate /etc/certs/mydomain.com.crt;
    ssl_certificate_key /etc/certs/mydomain.com.key;

    location / {
        proxy_pass http://localhost:3000;
    }
}
</code>```

my backend is hosted on backend.mydomain.com and is capable of handling cors.
when I open ui.mydomain.com I make and api call to backend.mydomain.com.
https://backend.mydoamain.com/users/details.
I get the cors error. I am a frontend guy and not able to figure out this.

Access to fetch at 'https://backend.mydomain.com/user/details' from
origin 'https://ui.mydomain.com' has been blocked by CORS policy: The
value of the 'Access-Control-Allow-Origin' header in the response must
not be the wildcard '*' when the request's credentials mode is
'include'.

My fetch code:

```<code>const options = {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        },
        credentials: 'include',
      };
      // Fetch the user data from the JSON file
      const userResponse = await fetch('https://backend.mydomain.com/user/details',options);

      const user = await userResponse.Data.json();
</code>```

I have tried to change my nginx conf and some webpack dev server nothing seems to work.
here is my response headers

```<code>HTTP/1.1 200 OK
Date: Fri, 16 Dec 2022 17:48:13 GMT
Server: Apache/2.4.54 (Unix) OpenSSL/1.1.1l
Strict-Transport-Security: max-age=31536000 ; includeSubdomains;
Allow: *
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Referer, User-Agent
Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS
Content-Length: 1805
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
</code>```

Excerpt from my webpack.config.js for dev server

```<code>output: {
    publicPath: 'http://localhost:3000/'
  },
devServer: {
    port: 3000,
    historyApiFallback: true
  }
</code>```

Also kindly let me know if there are any better approach.

Body:
I have my frontend(react app) run by webpack dev server on localhost:3000
I am running nginx server with the following conf so that i can use ui.mydomain.com to point to localhost:3000 so that in can use this ui.mydomain.com with https.

server {
    listen       443 http2 ssl;
    listen       [::]:443 http2 ssl;
    server_name  ui.mydomain.com;

    ssl_certificate /etc/certs/mydomain.com.crt;
    ssl_certificate_key /etc/certs/mydomain.com.key;

    location / {
        proxy_pass http://localhost:3000;
    }
}

my backend is hosted on backend.mydomain.com and is capable of handling cors.
when I open ui.mydomain.com I make and api call to backend.mydomain.com.
https://backend.mydoamain.com/users/details.
I get the cors error. I am a frontend guy and not able to figure out this.

Access to fetch at 'https://backend.mydomain.com/user/details' from
origin 'https://ui.mydomain.com' has been blocked by CORS policy: The
value of the 'Access-Control-Allow-Origin' header in the response must
not be the wildcard '*' when the request's credentials mode is
'include'.

My fetch code:

const options = {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        },
        credentials: 'include',
      };
      // Fetch the user data from the JSON file
      const userResponse = await fetch('https://backend.mydomain.com/user/details',options);

      const user = await userResponse.Data.json();

I have tried to change my nginx conf and some webpack dev server nothing seems to work.
here is my response headers

HTTP/1.1 200 OK
Date: Fri, 16 Dec 2022 17:48:13 GMT
Server: Apache/2.4.54 (Unix) OpenSSL/1.1.1l
Strict-Transport-Security: max-age=31536000 ; includeSubdomains;
Allow: *
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Referer, User-Agent
Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS
Content-Length: 1805
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

Excerpt from my webpack.config.js for dev server

output: {
    publicPath: 'http://localhost:3000/'
  },
devServer: {
    port: 3000,
    historyApiFallback: true
  }

Also kindly let me know if there are any better approach.


问:
Ubuntu apt failed to install package, unable to purge
Unable to locate and delete failed package, because there are post installation scripts that get triggered.

Package is nvidia-l4t-kernel

I found a Nvidia forum post suggesting to remove the failed package here:
NVIDIA Forum

I'm on Jetson Nano (Ubuntu 18.04), trying to to upgrade jetpack-sdk-461 to jetpack-sdk-463
One of the packages that comes in from apt update / apt upgrade needs to be removed, according to above linked forum post.

That is where the problem lies. I found the packages in /var/lib/dpkg/info and used sudo dpkg --remove --force-remove-reinstreq nvidia-l4t-kernel which seemingly removed the packages as they are not inside the directory any longer. However, from sudo apt list | grep nvidia-l4t-kernel it still shows up and attempting to sudo apt upgrade shows: 3 not fully installed or removed.

That is referring to these packages:

```<code>nvidia-l4t-kernel/stable 4.9.299-tegra-32.7.3-20221122092935 arm64
nvidia-l4t-kernel-dtbs/stable,now 4.9.299-tegra-32.7.3-20221122092935 arm64 [residual-config]
nvidia-l4t-kernel-headers/stable,now 4.9.299-tegra-32.7.3-20221122092935 arm64 [residual-config]
</code>```

which show when using sudo apt list | grep nvidia-l4t-kernel

Here the entire output of above command:

```<code>$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  tensorrt
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nvidia-l4t-bootloader (32.7.3-20221122092935) ...
3448-300-0000--1--jetson-nano-devkit-
Starting bootloader post-install procedure.
ERROR. Procedure for bootloader update FAILED.
Cannot install package. Exiting...
dpkg: error processing package nvidia-l4t-bootloader (--configure):
 installed nvidia-l4t-bootloader package post-installation script subprocess returned error exit status 1
Setting up nvidia-l4t-xusb-firmware (32.7.3-20221122092935) ...
3448-300-0000--1--jetson-nano-devkit-
Starting xusb firmware post-install procedure.
ERROR. Procedure for xusb firmware update FAILED.
Cannot install package. Exiting...
dpkg: error processing package nvidia-l4t-xusb-firmware (--configure):
 installed nvidia-l4t-xusb-firmware package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nvidia-l4t-initrd:
 nvidia-l4t-initrd depends on nvidia-l4t-xusb-firmware (= 32.7.3-20221122092935); however:
  Package nvidia-l4t-xusb-firmware is not configured yet.

dpkg: error processing package nvidia-l4t-initrd (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                Errors were encountered while processing:
 nvidia-l4t-bootloader
 nvidia-l4t-xusb-firmware
 nvidia-l4t-initrd
E: Sub-process /usr/bin/dpkg returned an error code (1)

</code>```

I would highly appreciate if anyone here could kindly point me into the right direction.
Been working on this problem all morning already :-/

Thanks to anyone taking the time to help!

Body:
Unable to locate and delete failed package, because there are post installation scripts that get triggered.

Package is nvidia-l4t-kernel

I found a Nvidia forum post suggesting to remove the failed package here:
NVIDIA Forum

I'm on Jetson Nano (Ubuntu 18.04), trying to to upgrade jetpack-sdk-461 to jetpack-sdk-463
One of the packages that comes in from apt update / apt upgrade needs to be removed, according to above linked forum post.

That is where the problem lies. I found the packages in /var/lib/dpkg/info and used sudo dpkg --remove --force-remove-reinstreq nvidia-l4t-kernel which seemingly removed the packages as they are not inside the directory any longer. However, from sudo apt list | grep nvidia-l4t-kernel it still shows up and attempting to sudo apt upgrade shows: 3 not fully installed or removed.

That is referring to these packages:

nvidia-l4t-kernel/stable 4.9.299-tegra-32.7.3-20221122092935 arm64
nvidia-l4t-kernel-dtbs/stable,now 4.9.299-tegra-32.7.3-20221122092935 arm64 [residual-config]
nvidia-l4t-kernel-headers/stable,now 4.9.299-tegra-32.7.3-20221122092935 arm64 [residual-config]

which show when using sudo apt list | grep nvidia-l4t-kernel

Here the entire output of above command:

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  tensorrt
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nvidia-l4t-bootloader (32.7.3-20221122092935) ...
3448-300-0000--1--jetson-nano-devkit-
Starting bootloader post-install procedure.
ERROR. Procedure for bootloader update FAILED.
Cannot install package. Exiting...
dpkg: error processing package nvidia-l4t-bootloader (--configure):
 installed nvidia-l4t-bootloader package post-installation script subprocess returned error exit status 1
Setting up nvidia-l4t-xusb-firmware (32.7.3-20221122092935) ...
3448-300-0000--1--jetson-nano-devkit-
Starting xusb firmware post-install procedure.
ERROR. Procedure for xusb firmware update FAILED.
Cannot install package. Exiting...
dpkg: error processing package nvidia-l4t-xusb-firmware (--configure):
 installed nvidia-l4t-xusb-firmware package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nvidia-l4t-initrd:
 nvidia-l4t-initrd depends on nvidia-l4t-xusb-firmware (= 32.7.3-20221122092935); however:
  Package nvidia-l4t-xusb-firmware is not configured yet.

dpkg: error processing package nvidia-l4t-initrd (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                Errors were encountered while processing:
 nvidia-l4t-bootloader
 nvidia-l4t-xusb-firmware
 nvidia-l4t-initrd
E: Sub-process /usr/bin/dpkg returned an error code (1)

I would highly appreciate if anyone here could kindly point me into the right direction.
Been working on this problem all morning already :-/

Thanks to anyone taking the time to help!


问:
Are there any docs on how you envision the data engineer workflows looks like with Mage?
We run several environments with different data residency so would like to follow a declarative gitops workflow if possible.

Essentially data engineers writes new pipeline in mage and creates a PR, the PR gets merge and deployed to all Mage environments.


问:
How to access the data in the batch of a deep learning model?
I am training a Fully Connected deep learning model on the MNIST dataset, which has 3 layers (512, 512, 10), and relu and softmax as activation functions. I am using Keras for the models. Is there any way to access the data in a batch of an epoch?

Suppose the batch size is 32, so I would like to see which data was used as input in that batch.


问:
cmake add_custom_command POST_BUILD doesn't work as expected
I generate a iOS framework in my project and pass the GCC_GENERATE_DEBUGGING_SYMBOLS to generate dsym for the built framework. The dsym gets generated as expected, but when I try to copy it to another location it doesn't fully work. It copies only the dsym directory structure but not the dwarf file itself or it copies an empty dwarf file.

```<code>add_library(${TARGET_OBJC_LIB_NAME} SHARED
    ${DIR_SRCS}
    ${sources}
    ${headers}
    ${objc_sources}
)

add_custom_command(TARGET ${TARGET_OBJC_LIB_NAME}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_directory $<TARGET_FILE_DIR:${TARGET_OBJC_LIB_NAME}>/.. destinationDirectory
)
</code>```

I think this is because by the time the TARGET_OBJC_LIB_NAME is built the dsym hasn't fully generated. How do I ask the add_custom_command to wait till the dsym has fully generated?

Body:
I generate a iOS framework in my project and pass the GCC_GENERATE_DEBUGGING_SYMBOLS to generate dsym for the built framework. The dsym gets generated as expected, but when I try to copy it to another location it doesn't fully work. It copies only the dsym directory structure but not the dwarf file itself or it copies an empty dwarf file.

add_library(${TARGET_OBJC_LIB_NAME} SHARED
    ${DIR_SRCS}
    ${sources}
    ${headers}
    ${objc_sources}
)

add_custom_command(TARGET ${TARGET_OBJC_LIB_NAME}
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_directory $<TARGET_FILE_DIR:${TARGET_OBJC_LIB_NAME}>/.. destinationDirectory
)

I think this is because by the time the TARGET_OBJC_LIB_NAME is built the dsym hasn't fully generated. How do I ask the add_custom_command to wait till the dsym has fully generated?


问:
clang-tidy not applying naming
I'm trying to use clang-tidy on Windows from MSVC (Clang 13.0.1 for MSVC 2022 amd). The renaming is applied to the header file, but not fully to the cpp file.

.clang-tidy

```<code>Checks: '-*,readability-identifier-naming'
CheckOptions:
  - { key: readability-identifier-naming.ClassCase,           value: lower_case  }
  - { key: readability-identifier-naming.ClassMemberCase,     value: lower_case }
  - { key: readability-identifier-naming.ClassMethodCase,     value: lower_case }
  - { key: readability-identifier-naming.FunctionCase,        value: lower_case }
  - { key: readability-identifier-naming.ParameterCase,       value: lower_case }
  - { key: readability-identifier-naming.VariableCase,        value: lower_case }

</code>```

Header:

```<code>#pragma once
class NeedsTidying
{
  public:
    int addFunc(int argOne, int argTwo);
    int subFunc(int argOne, int argTwo) {
        return argOne - argTwo;
    }
};
</code>```

cpp:

```<code>#include "tidy.hpp"
int NeedsTidying::addFunc(int argOne, int argTwo) {
    return argOne + argTwo;
}
</code>```

clang-tidy arguments: clang-tidy --fix-errors -p build\compile_commands.json path_to_code*

clang-tidy gets applied to the header file as I expect, but the cpp file doesn't apply the class name or method renames as I expect:

```<code>int NeedsTidying::addFunc(int arg_one, int arg_two) {
    return arg_one + arg_two;
}
</code>```

Title: clang-tidy not applying naming

Body:
I'm trying to use clang-tidy on Windows from MSVC (Clang 13.0.1 for MSVC 2022 amd). The renaming is applied to the header file, but not fully to the cpp file.

.clang-tidy

Checks: '-*,readability-identifier-naming'
CheckOptions:
  - { key: readability-identifier-naming.ClassCase,           value: lower_case  }
  - { key: readability-identifier-naming.ClassMemberCase,     value: lower_case }
  - { key: readability-identifier-naming.ClassMethodCase,     value: lower_case }
  - { key: readability-identifier-naming.FunctionCase,        value: lower_case }
  - { key: readability-identifier-naming.ParameterCase,       value: lower_case }
  - { key: readability-identifier-naming.VariableCase,        value: lower_case }

Header:

#pragma once
class NeedsTidying
{
  public:
    int addFunc(int argOne, int argTwo);
    int subFunc(int argOne, int argTwo) {
        return argOne - argTwo;
    }
};

cpp:

#include "tidy.hpp"
int NeedsTidying::addFunc(int argOne, int argTwo) {
    return argOne + argTwo;
}

clang-tidy arguments: clang-tidy --fix-errors -p build\compile_commands.json path_to_code*

clang-tidy gets applied to the header file as I expect, but the cpp file doesn't apply the class name or method renames as I expect:

int NeedsTidying::addFunc(int arg_one, int arg_two) {
    return arg_one + arg_two;
}


问:
Is there a group key for spring shell?
I have 2 shell mehtods like this:

```<code>@ShellMethod(key = ["context set"])
fun setContext(dbContext: String) {
    println("Set db context to $dbContext")
}

@ShellMethod(key = ["context clear"])
fun clearContext() {
    println("Clear db context")
}
</code>```

I set the key to start with "context" for better clarity. Is there a way to move the "context" to the group and have the shell methods inherit the key?
I didin't find anything in the documentation about it.
Thanks in advance.

Title: Is there a group key for spring shell?

Body:
I have 2 shell mehtods like this:

@ShellMethod(key = ["context set"])
fun setContext(dbContext: String) {
    println("Set db context to $dbContext")
}

@ShellMethod(key = ["context clear"])
fun clearContext() {
    println("Clear db context")
}

I set the key to start with "context" for better clarity. Is there a way to move the "context" to the group and have the shell methods inherit the key?
I didin't find anything in the documentation about it.
Thanks in advance.


问:
Is it possible to add iframe button that opens modal popup form component from your site?
For example, on my site I have a button that opens a modal popup with form and I want to add a button to using an iframe to open this form on other sites

The content from iframe should be in full width and height of the screen with a transparent background, but it turns out that it overlaps the content of another site and takes away the ability to interact with content of another site


问:
The correct way to force @Async work using ProxyFactory
Lets suppose we have an Actor interface:

```<code>  public interface Actor {
      ...
      void doAction(arg1, arg2, etc ...);
  }

</code>```

And we have some implementations:

```<code>    @Async
    void doAction(...) {
</code>```

Now we implement some lib, that has a map of actors, and it code smth like this:

```<code>    var actor = actorMap.get("actorName");
    actor.doAction(...);
</code>```

And @Async doesn't work, cause particular actor is not a proxy, but a real instance.  But we keep fighting.  Lets proxy the call:

```<code>  ProxyFactory factory = new ProxyFactory(actor);
  factory.addInterface(Actor.class);
  factory.addAdvisor(new AsyncAnnotationAdvisor());

  var ifaceActor = (Actor) factory.getProxy();

  // this is a method call on the proxy!
  ifaceActor.doTheAction(update, null, this, session, sender);

</code>```

And this starts to magically work, but I am not sure that the line with factory.addAdvice() is correct enough. Probably, there is a more correct way to get AsyncAdvice, but I failed to google it. (And yes, it is a sample code and I'll reuse adviser object.  More over, I'll try to keep proxy objects, not recreate them always.)

Body:
Lets suppose we have an Actor interface:

  public interface Actor {
      ...
      void doAction(arg1, arg2, etc ...);
  }

And we have some implementations:

    @Async
    void doAction(...) {

Now we implement some lib, that has a map of actors, and it code smth like this:

    var actor = actorMap.get("actorName");
    actor.doAction(...);

And @Async doesn't work, cause particular actor is not a proxy, but a real instance.  But we keep fighting.  Lets proxy the call:

  ProxyFactory factory = new ProxyFactory(actor);
  factory.addInterface(Actor.class);
  factory.addAdvisor(new AsyncAnnotationAdvisor());

  var ifaceActor = (Actor) factory.getProxy();

  // this is a method call on the proxy!
  ifaceActor.doTheAction(update, null, this, session, sender);

And this starts to magically work, but I am not sure that the line with factory.addAdvice() is correct enough. Probably, there is a more correct way to get AsyncAdvice, but I failed to google it. (And yes, it is a sample code and I'll reuse adviser object.  More over, I'll try to keep proxy objects, not recreate them always.)


问:
Google Cloud Vision DOCUMENT_TEXT_DETECTION - always one page?
I have been trying a variety of images (mainly via https://cloud.google.com/vision/docs/drag-and-drop, but also via the API), from pictures of several hand written pages laid out on a table, to an image of a rendered multi-page PDF, to pictures of books, and it seems like it always returns a single "page" (response format is TextAnnotation > Page > Block > Paragraph > Word > Symbol). The documentation is pretty thin on what the meaning of a "page" is, mostly just states the obvious. Could someone with experience clear this up, please?


问:
What is the basic file extension list for Apache Tika standard library?
I am trying to determine a basic list of file extensions supported for tika-parsers-standard-package. They have a formats supported page https://tika.apache.org/2.6.0/formats.html, but is there a way to get an easy list of extensions for each supported parser?</p>


问:
It works the way I want but there's a warning: React Hook useEffect has a missing dependency: 'yxz'. Either include it or remove the dependency array
I'm new to React and need some help.

I came across the concept of useEffect so I started to implement it in my small webapp. I want to calculate the price according a changing value in my formData object. If formData.koerper changes it triggers first the setFormData function and then updateK which I further use to trigger useEffect. setFormData and updateK are inside the handleKoerper function. The code is as following:

```<code>import React, { useState, useEffect, useRef } from 'react'
import { Form } from 'react-bootstrap'
import './Forms.css'

function PictureCustomization({ formData, setFormData }) {

    const settingPrice = () => {
        if (formData.koerper === "Ganzkörper")  {
            let calc = formData.preis + 10
            setFormData({...formData, preis: calc})
        } else {
            let calc = formData.preis - 10
            setFormData({...formData, preis: calc})
        }
    }

    const [updatedK, setUpdatedK] = useState(0)

    const isFirstRun = useRef(true)

    const handleKoerper = (event) => {
        setFormData({...formData, koerper: event.target.value})
        let newUpdate = updatedK + 1
        setUpdatedK(newUpdate)
        console.log(newUpdate)
    }

    const handleHandgemalt = (event) => {
        if (event.target.checked){
            setFormData({ ...formData, handgemalt: event.target.checked })
        } else {
            setFormData({ ...formData, handgemalt: event.target.checked, format: 'Digital' })
        }

    }

    useEffect( () => {
        if (isFirstRun.current) {
            isFirstRun.current = false;
        } else {
            settingPrice()
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [updatedK])

    return (
        <div>
            <div className="form-title">Bild Personalisieren</div>
            <Form>
                <Form.Group controlId='formKoerper'>
                    <Form.Label className="form-label">Körperoption</Form.Label>
                    <Form.Select
                        value={formData.koerper}
                        onChange={ handleKoerper }>
                        <option value="Ganzkörper">Ganzkörper</option>
                        <option value="Halbkörper">Halbkörper</option>
                    </Form.Select>
                </Form.Group>
                <h2>{formData.koerper}</h2>
                <Form.Group controlId='formAura'>
                    <Form.Label className="form-label"></Form.Label>
                    <Form.Check
                        className="form-label-checkbox"
                        type="checkbox"
                        label="Soll das Bild eine Aura enthalten?"
                        checked={formData.aura}
                        onChange={(event) => setFormData({ ...formData, aura: event.target.checked })}
                    />
                </Form.Group>
                <Form.Group controlId='formHintergrund'>
                    <Form.Label className="form-label"></Form.Label>
                    <Form.Check
                        className="form-label-checkbox"
                        type="checkbox"
                        label="Soll das Bild ein Hintergrund haben? Standard Hintergrund ist weiss."
                        checked={formData.hintergrund}
                        onChange={(event) => setFormData({ ...formData, hintergrund: event.target.checked })}
                    />
                </Form.Group>
                <Form.Group controlId='formHandgemalt'>
                    <Form.Label className="form-label"></Form.Label>
                    <Form.Check
                        className="form-label-checkbox"
                        type="checkbox"
                        label="Soll das Bild handgemalt sein?"
                        checked={formData.handgemalt}
                        onChange={ handleHandgemalt }
                    />
                </Form.Group>
                <Form.Group controlId='formLieferung'>
                    <h6 className='form-info-message'>Falls Sie die Option "handgemalt" ausgewählt haben, bitte ich Sie das Format des Bildes auszuwählen. Wenn die Option "handgemalt" nicht aktiv ist, wird die Zeichnung nur digital per E-Mail zugestellt. Das digitale Format ist 320x320 Pixel</h6>
                    <Form.Select aria-label="Default select example"
                        disabled={formData.handgemalt ? false : true}
                        value={formData.format}
                        onChange={(event) => setFormData({ ...formData, format: event.target.value })}>
                        <option value="">Wähle eine Option</option>
                        <option value="A4">A4</option>
                        <option value="A3">A3</option>
                    </Form.Select>
                </Form.Group>
                <Form.Group controlId="formEmail">
                    <Form.Label className="form-label">Was möchtest du mir noch sagen?</Form.Label>
                    <Form.Control
                        type="text"
                        placeholder="Bemerkungen"
                        value={formData.bemerkungen}
                        as="textarea"
                        style={{ height: '100px' }}
                        onChange={(event) => setFormData({ ...formData, bemerkungen: event.target.value })} />
                </Form.Group>
            </Form>
        </div>
    )
}

export default PictureCustomization
</code>```

If I don't include // eslint-disable-next-line react-hooks/exhaustive-deps in my useEffect there will be a warning message which tells me to include settingPrice in my dependencies. If I include settingPrice in my dependencies, useEffect will start an infinite loop which makes sense to me since I'm triggering settingPrice over and over again. So, my question is: Is there something I can change to not bypass the eslint rule? Bypassing the rule just feels wrong to me.

Also, I know I could put setFormData in my useEffect and therefore not use a seperate function but that would lead me to the same problem anyway.

Body:
I'm new to React and need some help.

I came across the concept of useEffect so I started to implement it in my small webapp. I want to calculate the price according a changing value in my formData object. If formData.koerper changes it triggers first the setFormData function and then updateK which I further use to trigger useEffect. setFormData and updateK are inside the handleKoerper function. The code is as following:

import React, { useState, useEffect, useRef } from 'react'
import { Form } from 'react-bootstrap'
import './Forms.css'

function PictureCustomization({ formData, setFormData }) {

    const settingPrice = () => {
        if (formData.koerper === "Ganzkörper")  {
            let calc = formData.preis + 10
            setFormData({...formData, preis: calc})
        } else {
            let calc = formData.preis - 10
            setFormData({...formData, preis: calc})
        }
    }

    const [updatedK, setUpdatedK] = useState(0)

    const isFirstRun = useRef(true)

    const handleKoerper = (event) => {
        setFormData({...formData, koerper: event.target.value})
        let newUpdate = updatedK + 1
        setUpdatedK(newUpdate)
        console.log(newUpdate)
    }

    const handleHandgemalt = (event) => {
        if (event.target.checked){
            setFormData({ ...formData, handgemalt: event.target.checked })
        } else {
            setFormData({ ...formData, handgemalt: event.target.checked, format: 'Digital' })
        }

    }

    useEffect( () => {
        if (isFirstRun.current) {
            isFirstRun.current = false;
        } else {
            settingPrice()
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [updatedK])

    return (

Bild Personalisieren

            <Form>
                <Form.Group controlId='formKoerper'>
                    <Form.Label className="form-label">Körperoption</Form.Label>
                    <Form.Select
                        value={formData.koerper}
                        onChange={ handleKoerper }>
                        <option value="Ganzkörper">Ganzkörper</option>
                        <option value="Halbkörper">Halbkörper</option>
                    </Form.Select>
                </Form.Group>

{formData.koerper}

                <Form.Group controlId='formAura'>
                    <Form.Label className="form-label"></Form.Label>
                    <Form.Check
                        className="form-label-checkbox"
                        type="checkbox"
                        label="Soll das Bild eine Aura enthalten?"
                        checked={formData.aura}
                        onChange={(event) => setFormData({ ...formData, aura: event.target.checked })}
                    />
                </Form.Group>
                <Form.Group controlId='formHintergrund'>
                    <Form.Label className="form-label"></Form.Label>
                    <Form.Check
                        className="form-label-checkbox"
                        type="checkbox"
                        label="Soll das Bild ein Hintergrund haben? Standard Hintergrund ist weiss."
                        checked={formData.hintergrund}
                        onChange={(event) => setFormData({ ...formData, hintergrund: event.target.checked })}
                    />
                </Form.Group>
                <Form.Group controlId='formHandgemalt'>
                    <Form.Label className="form-label"></Form.Label>
                    <Form.Check
                        className="form-label-checkbox"
                        type="checkbox"
                        label="Soll das Bild handgemalt sein?"
                        checked={formData.handgemalt}
                        onChange={ handleHandgemalt }
                    />
                </Form.Group>
                <Form.Group controlId='formLieferung'>

Falls Sie die Option "handgemalt" ausgewählt haben, bitte ich Sie das Format des Bildes auszuwählen. Wenn die Option "handgemalt" nicht aktiv ist, wird die Zeichnung nur digital per E-Mail zugestellt. Das digitale Format ist 320x320 Pixel

                    <Form.Select aria-label="Default select example"
                        disabled={formData.handgemalt ? false : true}
                        value={formData.format}
                        onChange={(event) => setFormData({ ...formData, format: event.target.value })}>
                        <option value="">Wähle eine Option</option>
                        <option value="A4">A4</option>
                        <option value="A3">A3</option>
                    </Form.Select>
                </Form.Group>
                <Form.Group controlId="formEmail">
                    <Form.Label className="form-label">Was möchtest du mir noch sagen?</Form.Label>
                    <Form.Control
                        type="text"
                        placeholder="Bemerkungen"
                        value={formData.bemerkungen}
                        as="textarea"
                        style={{ height: '100px' }}
                        onChange={(event) => setFormData({ ...formData, bemerkungen: event.target.value })} />
                </Form.Group>
            </Form>

    )
}

export default PictureCustomization

If I don't include // eslint-disable-next-line react-hooks/exhaustive-deps in my useEffect there will be a warning message which tells me to include settingPrice in my dependencies. If I include settingPrice in my dependencies, useEffect will start an infinite loop which makes sense to me since I'm triggering settingPrice over and over again. So, my question is: Is there something I can change to not bypass the eslint rule? Bypassing the rule just feels wrong to me.

Also, I know I could put setFormData in my useEffect and therefore not use a seperate function but that would lead me to the same problem anyway.


问:
Execute task with windows Scheduled Task function
I am trying to execute  a.bat file when my sessión closed. I cannot manage to make it. The set-up is as follows:

General
Execute either the session is open or closed
Execute with the highest priviledges

Triggers
Execute daily at specific time

Contitions
None

Thank you!

I tried almost every option. I just want that the .bat runs on unattended mode


问:
combine employee work days and leave days entry in single report
I have one table in which employees daily login entry is present and when employee is on leave he enters leave date entry in other Leave table .want to create monthly report which contains each employees all days records whether he is on leave or worked on that day.
Please help how i can achieve this .

```<code>DECLARE @user_id int
Declare @myresultset Cursor
Set @myresultset = CURSOR for Select USER_ID from users where user_id=679
OPEN @myresultset
Fetch NEXT from @myresultset
into @user_id
While @@Fetch_Status=0
Begin
 While @user_id is not NULL
  Begin

  --SELECT timesheet_id
--INTO #variable
Declare @ts TABLE (Value INT)

INSERT INTO @ts (Value)
SELECT timesheet_id
FROM  timesheet where user_id=@user_id and MONTH(start_time_server)=month(getdate()) and year(start_time_server)=YEAR(getdate()) and user_id=679

  End
  declare @le_ts table (Value INT)
  Insert into @le_ts (Value)
  select timesheet_id from leaves where start_time_server not in (select start_time_server from  timesheet where timesheet_id in (select  * from  @ts)) and user_id=@user_id

  select *,timesheet.login_by from @ts,@le_ts,timesheet where timesheet.user_id=@user_id
 Fetch Next from @myresultset
 into @user_id

End
close @myresultset
</code>```

enter image description here

Body:
I have one table in which employees daily login entry is present and when employee is on leave he enters leave date entry in other Leave table .want to create monthly report which contains each employees all days records whether he is on leave or worked on that day.
Please help how i can achieve this .

DECLARE @user_id int
Declare @myresultset Cursor
Set @myresultset = CURSOR for Select USER_ID from users where user_id=679
OPEN @myresultset
Fetch NEXT from @myresultset
into @user_id
While @@Fetch_Status=0
Begin
 While @user_id is not NULL
  Begin

  --SELECT timesheet_id
--INTO #variable
Declare @ts TABLE (Value INT)

INSERT INTO @ts (Value)
SELECT timesheet_id
FROM  timesheet where user_id=@user_id and MONTH(start_time_server)=month(getdate()) and year(start_time_server)=YEAR(getdate()) and user_id=679

  End
  declare @le_ts table (Value INT)
  Insert into @le_ts (Value)
  select timesheet_id from leaves where start_time_server not in (select start_time_server from  timesheet where timesheet_id in (select  * from  @ts)) and user_id=@user_id

  select *,timesheet.login_by from @ts,@le_ts,timesheet where timesheet.user_id=@user_id
 Fetch Next from @myresultset
 into @user_id

End
close @myresultset

enter image description here


问:
Crash after package execution (npm)
I am trying to include a package to a TypeScript project I cloned and have been working on for a while that is using Vite.
I am trying to install node-scp using the install command, npm install node-scp

Install was successful, but when I am trying to use a sample code in my program I am crashing. When I add this code:

 import { Client } from 'node-scp';

const onReject = () => {
    Client({
        host: inputs.ipadress, //remote host ip
        port: 22, //port used for scp
        username: inputs.username, //username to authenticate
        password: inputs.password, //password to authenticate
    }).then(client => {
        client.uploadDir('./local/dir', '/server/path')
           .then(response => {
            client.close()
           })
           .catch(error => {})
       }).catch(e => console.log(e))
};```
</div>
</div>
</p>
<p>The error I am getting is:</p>
```GET http://localhost:3000/node_modules/.vite/deps/node-scp.js?v=2b2c4f4f net::ERR_ABORTED 504 (Gateway Timeout)
```

and the website does not load.

I did some googling but found nothing relevant to my issue. When I remove the code snippet from my code, the website loads.

Any help will be highly appreciated.

Title: Crash after package execution (npm)

Body:
I am trying to include a package to a TypeScript project I cloned and have been working on for a while that is using Vite.
I am trying to install node-scp using the install command, npm install node-scp

Install was successful, but when I am trying to use a sample code in my program I am crashing. When I add this code:

 import { Client } from 'node-scp';

const onReject = () => {
    Client({
        host: inputs.ipadress, //remote host ip
        port: 22, //port used for scp
        username: inputs.username, //username to authenticate
        password: inputs.password, //password to authenticate
    }).then(client => {
        client.uploadDir('./local/dir', '/server/path')
           .then(response => {
            client.close()
           })
           .catch(error => {})
       }).catch(e => console.log(e))
};

The error I am getting is:

GET http://localhost:3000/node_modules/.vite/deps/node-scp.js?v=2b2c4f4f net::ERR_ABORTED 504 (Gateway Timeout)

and the website does not load.

I did some googling but found nothing relevant to my issue. When I remove the code snippet from my code, the website loads.

Any help will be highly appreciated.


问:
How can I display(code) the outputs they are asking. I am physics major
```<code>rocket = cylinder( pos=vector(0,0,0), color=color.red, size=vector(0.5,0.1,0.1),
                   velocity = vector(0,0,0), mass=100, fuel_mass=10.0,
                   make_trail = True, axis=vector(0,1,0) )

initial_mass = rocket.mass + rocket.fuel_mass
initial_fuel_mass = rocket.fuel_mass

graph(fast=True)
r_pos = gcurve(color=color.red)

exhaust_velocity = vector(0,-100,0)
mdot = 1.0 # Rate of mass loss per time.
dt = 0.001
t = 0
scene.camera.follow(rocket)

while (rocket.fuel_mass > 0):
    rate(500)
    dm = mdot*dt # Amount of mass lost in time dt.
    rocket.velocity = rocket.velocity + dm/(rocket.mass+rocket.fuel_mass)*(-exhaust_velocity)
    rocket.pos = rocket.pos + rocket.velocity*dt
    rocket.fuel_mass = rocket.fuel_mass - dm
    rocket.opacity = rocket.fuel_mass/initial_fuel_mass
    t = t + dt
    r_pos.plot(pos=(t,rocket.pos.y))

print(rocket.velocity.y,mag(exhaust_velocity)*log(initial_mass/rocket.mass))

#-----CALCULATING RANGE, TIME OF FLIGHT, MAXIMUM HEIGHT, LANDING VELOCITY FOR DIFFERENT VALUES OF INITIAL VELOCITY RELATIVE TO TERMINAL VELOCITY------#
low=alpha-0.5
intermediate=alpha
high=alpha+0.5

for vfactor in [low,intermediate,high]:
  velocity=vfactor*vt*vector(cos(theta), sin(theta), 0)
  #constants for drag force
  B1=m*mag(g)/vt
  B2=m*mag(g)/(vt**2)
  #drag forces
  Fdrag1=-B1*velocity
  Fdrag2=-B2*(mag(velocity)**2)*norm(velocity)
  print('For vfactor =', vfactor, '\n')

  print('For motion without drag forces :')
  projectile_cal(vector(0,0,0))
  print('\nFor motion with linear drag force, FD1 = -beta1*v :')
  projectile_cal(Fdrag1)
  print('\nFor motion with quadratic drag force, FD2 = -beta2*(v^2)*norm(v) :')
  projectile_cal(Fdrag2)
  print('-'*80, '\n')

</code>```

I have the simulation, but i don’t know how to display results/outputs. I don’t know how to connect the dots, if you know what i mean.
Thank You.

Use characteristics similar to the Falcon 9 rocket for the following:
Total Mass: 433,100 kg
First Stage Propellant Mass: 321,600 kg
Thrust: 7,607 kN
Exhaust Velocity: 2,766 m/s

A) Calculations:
i. Calculate how long it take for the rocket to burn through its fuel.
ii. Calculate the final velocity of the rocket after all the fuel expended.
B) GlowScript Simulation:
i. Use GlowScript to simulate the motion of the rocket. Your simulation should
calculate the following for each time step: position, velocity, acceleration,
rocket mass.
ii. Plot the position, velocity, acceleration, rocket mass as functions of time.

Body:
rocket = cylinder( pos=vector(0,0,0), color=color.red, size=vector(0.5,0.1,0.1),
                   velocity = vector(0,0,0), mass=100, fuel_mass=10.0,
                   make_trail = True, axis=vector(0,1,0) )

initial_mass = rocket.mass + rocket.fuel_mass
initial_fuel_mass = rocket.fuel_mass

graph(fast=True)
r_pos = gcurve(color=color.red)

exhaust_velocity = vector(0,-100,0)
mdot = 1.0 # Rate of mass loss per time.
dt = 0.001
t = 0
scene.camera.follow(rocket)

while (rocket.fuel_mass > 0):
    rate(500)
    dm = mdot*dt # Amount of mass lost in time dt.
    rocket.velocity = rocket.velocity + dm/(rocket.mass+rocket.fuel_mass)*(-exhaust_velocity)
    rocket.pos = rocket.pos + rocket.velocity*dt
    rocket.fuel_mass = rocket.fuel_mass - dm
    rocket.opacity = rocket.fuel_mass/initial_fuel_mass
    t = t + dt
    r_pos.plot(pos=(t,rocket.pos.y))

print(rocket.velocity.y,mag(exhaust_velocity)*log(initial_mass/rocket.mass))

#-----CALCULATING RANGE, TIME OF FLIGHT, MAXIMUM HEIGHT, LANDING VELOCITY FOR DIFFERENT VALUES OF INITIAL VELOCITY RELATIVE TO TERMINAL VELOCITY------#
low=alpha-0.5
intermediate=alpha
high=alpha+0.5

for vfactor in [low,intermediate,high]:
  velocity=vfactor*vt*vector(cos(theta), sin(theta), 0)
  #constants for drag force
  B1=m*mag(g)/vt
  B2=m*mag(g)/(vt**2)
  #drag forces
  Fdrag1=-B1*velocity
  Fdrag2=-B2*(mag(velocity)**2)*norm(velocity)
  print('For vfactor =', vfactor, '\n')

  print('For motion without drag forces :')
  projectile_cal(vector(0,0,0))
  print('\nFor motion with linear drag force, FD1 = -beta1*v :')
  projectile_cal(Fdrag1)
  print('\nFor motion with quadratic drag force, FD2 = -beta2*(v^2)*norm(v) :')
  projectile_cal(Fdrag2)
  print('-'*80, '\n')

I have the simulation, but i don’t know how to display results/outputs. I don’t know how to connect the dots, if you know what i mean.
Thank You.

Use characteristics similar to the Falcon 9 rocket for the following:
Total Mass: 433,100 kg
First Stage Propellant Mass: 321,600 kg
Thrust: 7,607 kN
Exhaust Velocity: 2,766 m/s

A) Calculations:
i. Calculate how long it take for the rocket to burn through its fuel.
ii. Calculate the final velocity of the rocket after all the fuel expended.
B) GlowScript Simulation:
i. Use GlowScript to simulate the motion of the rocket. Your simulation should
calculate the following for each time step: position, velocity, acceleration,
rocket mass.
ii. Plot the position, velocity, acceleration, rocket mass as functions of time.


问:
Convert js object or json object to a document, .pdf .word ,etc
I'm given some data in a json object and i have to structured the data so it could be downloaded as a text file. So i don't know if i have to use some sort of library or do something else. Thanks

Extra: I'm working with React.


问:
Stepper variants on shopify
I need to develop a quote with dynamic options in shopify, I've searched for plugins but I don't have much freedom in the design, I've also looked for a way to include my code in the store, but I can't find that option, I don't know how to do it or a plugin where I can have the freedom of the design, I am attaching an example of what I am looking for https://www.vashi.com/engagement-rings/make-your-own#path=setting&selection.design_style=5605&step=design_style

different plugins have been tried

Title: Stepper variants on shopify


问:
Kafka Streams - Join two streams and get values ordered by date
I have two streams, both with the same key. Stream1 values are temperatures and the Stream2 values are types of events, "red" or "green". The key is "station".

```<code>KStream<String, String> Stream1 = builder.stream(inputTopic);
KStream<String, String> Stream2 = builder.stream(inputTopic2);
</code>```

The idea is to join both of those streams and get their value by date order. For example, my producer sent the following records:

topic1: -35º (12:10:10)

topic1: -40º (12:10:11)

topic2: "red" (12:10:12)

topic1: 20º (12:10:13)

topic2: "green" (12:11:00)

topic1: 10º (12:11:05)

topic2: "red" (12:11:10)

topic1: 40º (12:11:20)

I want to have a new stream with all those values in that same order. The goal is to associate the temperature with the previous type of event. For example, 20º (12:10:13) is a red type, 10º (12:11:05) is a green type and 40º (12:11:20) is a red type.

How should I proceed?

Body:
I have two streams, both with the same key. Stream1 values are temperatures and the Stream2 values are types of events, "red" or "green". The key is "station".

KStream<String, String> Stream1 = builder.stream(inputTopic);
KStream<String, String> Stream2 = builder.stream(inputTopic2);

The idea is to join both of those streams and get their value by date order. For example, my producer sent the following records:

topic1: -35º (12:10:10)

topic1: -40º (12:10:11)

topic2: "red" (12:10:12)

topic1: 20º (12:10:13)

topic2: "green" (12:11:00)

topic1: 10º (12:11:05)

topic2: "red" (12:11:10)

topic1: 40º (12:11:20)

I want to have a new stream with all those values in that same order. The goal is to associate the temperature with the previous type of event. For example, 20º (12:10:13) is a red type, 10º (12:11:05) is a green type and 40º (12:11:20) is a red type.

How should I proceed?


问:
Future<void>.value();
Im having an issue while running the app. after initializing the app I couldnt properly see the screen at the same tiem there was an error shows which is **Future.value(); inside the feedback.dart. I have tried to catch any error which I have added but I couldnt find any.

I have seen many solution also tried but didnt worked out. Can I anyone please Let me know error which I showed below.

This is loginPage file:

```<code>import 'package:flutter/material.dart';
import 'package:food_app/bottombar/screenA.dart';

class LoginPage extends StatefulWidget {
  const LoginPage({super.key});

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {

  static Future<User?>loginUsingEmailPassword({required String email, required String password, required BuildContext context}) async {
    FirebaseAuth auth = FirebaseAuth.instance;
    User? user;
    try {
      UserCredential userCredential = await auth.signInWithEmailAndPassword(email: email, password: password);
      user = userCredential.user;

    } on FirebaseAuthException catch (e) {
      if(e.code == "user not found"){
        print("No User found for that email");
      }
    }

    return user;
  }

  @override
  Widget build(BuildContext context) {

    TextEditingController emailController = TextEditingController();
    TextEditingController passwordController = TextEditingController();
    return Scaffold(
      appBar: AppBar(
        title: const Text("Hello world"),
      ),

      body: SizedBox(
        height: 400.0,
        child: Column(
          children: [
              Padding(
                padding: const EdgeInsets.all(15.0),
                child: TextFormField(
                  controller: emailController,
                  decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    hintText: "Enter Username",
                  ),
                ),
              ),
              const SizedBox(
                height: 20.0,
              ),
              Padding(
                padding: const EdgeInsets.all(15.0),
                child: TextFormField(
                  controller: passwordController,
                  obscureText: true,
                  decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    hintText: "Enter Password",
                  ),
                ),
              ),
              const SizedBox(
                height: 20.0,
              ),
              ElevatedButton(
                onPressed: () async{
                    User? user = await loginUsingEmailPassword(email: emailController.text, password: passwordController.text, context: context);
                     print(user);
                     if (user != null) {
                      Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) => const ScreenA()));
                     }
                },

                child: const Text("Login")),

          ],
        ),
      ),
    );
  }
}
</code>```

And this is the main.dart file:

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

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  Future<FirebaseApp> _initializeFirebase() async {
    FirebaseApp firebaseApp = await Firebase.initializeApp();
    return firebaseApp;

  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FutureBuilder(
        future: _initializeFirebase(),
        builder:  (context, snapshot){
          if(snapshot.connectionState == ConnectionState.done) {
            return const LoginPage();
          }
          return const Center(
            child: CircularProgressIndicator(),
          );
        },
      ),
    );
  }
}

</code>```

And my error is :

```<code>    context.findRenderObject()!.sendSemanticsEvent(const TapSemanticEvent());
    switch (_platform(context)) {
      case TargetPlatform.android:
      case TargetPlatform.fuchsia:
        return SystemSound.play(SystemSoundType.click);
      case TargetPlatform.iOS:
      case TargetPlatform.linux:
      case TargetPlatform.macOS:
      case TargetPlatform.windows:
        return Future<void>.value();
    }
  }

</code>```

Title: Future<void>.value();

Body:
Im having an issue while running the app. after initializing the app I couldnt properly see the screen at the same tiem there was an error shows which is **Future.value(); inside the feedback.dart. I have tried to catch any error which I have added but I couldnt find any.

I have seen many solution also tried but didnt worked out. Can I anyone please Let me know error which I showed below.

This is loginPage file:

import 'package:flutter/material.dart';
import 'package:food_app/bottombar/screenA.dart';

class LoginPage extends StatefulWidget {
  const LoginPage({super.key});

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {

  static Future<User?>loginUsingEmailPassword({required String email, required String password, required BuildContext context}) async {
    FirebaseAuth auth = FirebaseAuth.instance;
    User? user;
    try {
      UserCredential userCredential = await auth.signInWithEmailAndPassword(email: email, password: password);
      user = userCredential.user;

    } on FirebaseAuthException catch (e) {
      if(e.code == "user not found"){
        print("No User found for that email");
      }
    }

    return user;
  }

  @override
  Widget build(BuildContext context) {

    TextEditingController emailController = TextEditingController();
    TextEditingController passwordController = TextEditingController();
    return Scaffold(
      appBar: AppBar(
        title: const Text("Hello world"),
      ),

      body: SizedBox(
        height: 400.0,
        child: Column(
          children: [
              Padding(
                padding: const EdgeInsets.all(15.0),
                child: TextFormField(
                  controller: emailController,
                  decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    hintText: "Enter Username",
                  ),
                ),
              ),
              const SizedBox(
                height: 20.0,
              ),
              Padding(
                padding: const EdgeInsets.all(15.0),
                child: TextFormField(
                  controller: passwordController,
                  obscureText: true,
                  decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    hintText: "Enter Password",
                  ),
                ),
              ),
              const SizedBox(
                height: 20.0,
              ),
              ElevatedButton(
                onPressed: () async{
                    User? user = await loginUsingEmailPassword(email: emailController.text, password: passwordController.text, context: context);
                     print(user);
                     if (user != null) {
                      Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) => const ScreenA()));
                     }
                },

                child: const Text("Login")),

          ],
        ),
      ),
    );
  }
}

And this is the main.dart file:

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:food_app/loginpage.dart';

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  Future<FirebaseApp> _initializeFirebase() async {
    FirebaseApp firebaseApp = await Firebase.initializeApp();
    return firebaseApp;

  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FutureBuilder(
        future: _initializeFirebase(),
        builder:  (context, snapshot){
          if(snapshot.connectionState == ConnectionState.done) {
            return const LoginPage();
          }
          return const Center(
            child: CircularProgressIndicator(),
          );
        },
      ),
    );
  }
}

And my error is :

    context.findRenderObject()!.sendSemanticsEvent(const TapSemanticEvent());
    switch (_platform(context)) {
      case TargetPlatform.android:
      case TargetPlatform.fuchsia:
        return SystemSound.play(SystemSoundType.click);
      case TargetPlatform.iOS:
      case TargetPlatform.linux:
      case TargetPlatform.macOS:
      case TargetPlatform.windows:
        return Future<void>.value();
    }
  }


问:
Error in SAPUI5 Visual Editor in Adaptation Project in Business Application Studio
We are trying to extend the Import Supplier Invoices Fiori (F3041) app to disable the Post functionality in the app. The Post button on the first page can be hidden using UI Adaptation but for the Post button in the detail page's footer, we have created an Adaptation Project in Business Application Studio. Now, the below error is being returned when trying to navigate to the detail page from the initial page:

"Error occurred during navigation"

A relevant SAP Note https://me.sap.com/notes/0002845173 mentions that related business roles are required to be assigned to the user. The same issue in the S4 system's Fiori Launchpad was resolved by role assignment. But for the Adaptation project, even if the same roles are assigned to the communication user for BAS/BTP to the S4 system, the issue remains.

Please advice.


问:
hyperparameter tuning with cross validation in federated learning
i want to implement the federated learning framework.

for finding a set of optimal hyperparameter values, How should I implement cross-validation procedure?
Should I train a traditional machine learning model or  Federated learning process?

please guide me !!!! please


问:
Validating an ASP.NET WebApi access_token using a function in WebForms
I have a single ASP.NET project that contains WebApi and WebForms with 'Individual accounts' authentication.

I am successfully calling ASP.NET WebApi using Ajax and receiving an access_token which I store in a cookie and use to call WebApi services requiring authentication.

However I would also like to check the validity of the access_token in the Page_Load of WebForms.  I can retrieve the access_token from the cookie within Page_Load but cannot find function that allows me to validate it.

Does anyone know of such a function?

I know that if I have signed in using a WebForms sign in like below:

```<code>var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signinManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
var result = signinManager.PasswordSignIn(email, password, true, shouldLockout: false);
</code>```

Then I can call:

```<code>HttpContext.Current.User.Identity.IsAuthenticated
</code>```

However, this obviously wouldn't work if I sign in using WebApi.  So again how can I sign in using WebApi then validate this in the Page_Load of a WebForm in the same project?

Body:
I have a single ASP.NET project that contains WebApi and WebForms with 'Individual accounts' authentication.

I am successfully calling ASP.NET WebApi using Ajax and receiving an access_token which I store in a cookie and use to call WebApi services requiring authentication.

However I would also like to check the validity of the access_token in the Page_Load of WebForms.  I can retrieve the access_token from the cookie within Page_Load but cannot find function that allows me to validate it.

Does anyone know of such a function?

I know that if I have signed in using a WebForms sign in like below:

var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signinManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
var result = signinManager.PasswordSignIn(email, password, true, shouldLockout: false);

Then I can call:

HttpContext.Current.User.Identity.IsAuthenticated

However, this obviously wouldn't work if I sign in using WebApi.  So again how can I sign in using WebApi then validate this in the Page_Load of a WebForm in the same project?


问:
Bottom Tabs in Drawer Navigator
I read the documentation of react-navigation to create drawer and tab navigator.

The drawer is good but the tab navigator does not meet my need.

I wish a bottom tab navigation was a shorcut to drawer menu and it should be displayed to all other screen.

Drawer menu I have :
Menu A / Menu B / Menu C / Menu D

And in a bottom tab I don't want new screen navigation but just a shortcut navigation to Menu A and Menu D.

I managed to initiate what I wish with this

```<code><>
  <Drawer.Navigator>
   <Drawer.Screen ...>
   <Drawer.Screen ...>
  </Drawer.Navigator />
  <CustomBottomNavigation />
</>
</code>```

The CustomBottonNavigation use BottomNavigation of react-native-paper.

Work fine but the drawer menu does not pass in front of the bottom navigation (expected implementation behaviour)

So my question, is a better way to do this ?
I search about a way to pass a component that should be displayed to all drawer screen but react-navigation drawer don't have a param to do this (to my knowledge).

Title: Bottom Tabs in Drawer Navigator

Body:
I read the documentation of react-navigation to create drawer and tab navigator.

The drawer is good but the tab navigator does not meet my need.

I wish a bottom tab navigation was a shorcut to drawer menu and it should be displayed to all other screen.

Drawer menu I have :
Menu A / Menu B / Menu C / Menu D

And in a bottom tab I don't want new screen navigation but just a shortcut navigation to Menu A and Menu D.

I managed to initiate what I wish with this

<>
  <Drawer.Navigator>
   <Drawer.Screen ...>
   <Drawer.Screen ...>
  </Drawer.Navigator />
  <CustomBottomNavigation />
</>

The CustomBottonNavigation use BottomNavigation of react-native-paper.

Work fine but the drawer menu does not pass in front of the bottom navigation (expected implementation behaviour)

So my question, is a better way to do this ?
I search about a way to pass a component that should be displayed to all drawer screen but react-navigation drawer don't have a param to do this (to my knowledge).


问:
How to trim some text coming from API? Nuxt3 / CompositionAPI / TS
I have a blog page I am writing with a dummy JSON db file for an API. I have this hooked up and I am just wondering how I could trim some text for a snippet from the post body.

Pasting what I have where you can see I've setup for dynamic data, and a {{ snippet }} placeholder already. I tried a few methods but was unsuccessful :(.

```<code><div class="flex flex-col gap-14">
                    <div class="post max-w-xl text-left relative post__wrapper rounded-xl"
                        @click="navigateTo(`/blog/${post.id}`)" v-for="post in posts" :key="post.id" :post="post">
                        <div class="relative">
                            <div
                                class=" absolute rounded-t-lg bg-gradient-to-r from-neutral-600 to to-neutral-800 z-10 opacity-10 w-full h-full">
                            </div>
                            <img :src="post.image" class="rounded-t-lg post__image relative"
                                alt="post image" />
                            <span class="post__category absolute z-20">{{ post.category }}</span>
                        </div>
                        <div class="px-8 py-6 bg-neutral-100 rounded-b-lg">
                            <h3 class="text-2xl font-semibold post__title">{{ post.title }}</h3>
                            <div class="mt-1">
                                <p class="text-base">Posted by <span>{{ post.author }}</span> on <span>{{ post.date
                                }}</span></p>
                            </div>
                            <p class="mt-5">{{ snippet }}</p>
                            <div class="flex flex-row mt-5 gap-2">
                                <span v-for="tag in post.tags" :key="tag" class="bg-neutral-200 rounded-xl p-2">
                                    #{{ tag }}
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
</code>```
```<code><script setup>
const { data: posts } = await useFetch('https://my-json-server.typicode.com/KorbinPerry/posts-data/posts')

</script>
</code>```

There is a "post body" in the dummy API I would use to make this snippet from, something like the first 100 characters but obviously will be easy to adjust. Just can't quite figure this out.

In my vanilla Vue 3 app I'm converting this from it was set up a little differently and I have tried variations of this but to no success.

```<code>import { computed } from 'vue'
export default {
    props: ['post'],
    setup(props) {
        const snippet = computed (() => {
            return props.post.body.substring(0, 240) + '...'
        })
        return { snippet }
    }
}
</code>```

Thanks for any input!

Body:
I have a blog page I am writing with a dummy JSON db file for an API. I have this hooked up and I am just wondering how I could trim some text for a snippet from the post body.

Pasting what I have where you can see I've setup for dynamic data, and a {{ snippet }} placeholder already. I tried a few methods but was unsuccessful :(.

                    <div class="post max-w-xl text-left relative post__wrapper rounded-xl"
                        @click="navigateTo(`/blog/${post.id}`)" v-for="post in posts" :key="post.id" :post="post">

                            {{ post.category }}

{{ post.title }}

Posted by {{ post.author }} on {{ post.date
                                }}

{{ snippet }}

                                    #{{ tag }}

There is a "post body" in the dummy API I would use to make this snippet from, something like the first 100 characters but obviously will be easy to adjust. Just can't quite figure this out.

In my vanilla Vue 3 app I'm converting this from it was set up a little differently and I have tried variations of this but to no success.

import { computed } from 'vue'
export default {
    props: ['post'],
    setup(props) {
        const snippet = computed (() => {
            return props.post.body.substring(0, 240) + '...'
        })
        return { snippet }
    }
}

Thanks for any input!


问:
TeXMaker Configuration
I am trying to configure TeXMaker on the laptop of my company. I thought everything was settled, but when I compile the 'PDFLaTeX' and then click on 'ViewPDF'nothing is actually updated in my document. I wonder if somebody can help me in resolving this issue, see below my configuration.

I will be looking forward to your response.

KR
Ruben

Title: TeXMaker Configuration


问:
Attempting to concatenating data from multiple Excel files with Python but missing columns
```<code>path = "C:\\Users\\Adam\\Desktop\\Stock Trackers\\New Folder\\"

finalDf = pd.DataFrame()

for file in filenames:
    if file.startswith("Stock"):
        df = pd.read_excel(path+file,usecols="A:D,R",index_col=None)
        df['Total Received']
        df['Qty Received']=df['Total Received']
        df['InvoicedValue'] = df['Price']*df['Qty Invoiced']
        df['ReceivedValue'] = df['Price']*df['Qty Received']
        df['DeltaQty']= df['Qty Received']-df['Qty Invoiced']
        df['DeltaValue']= df['ReceivedValue']-df['InvoicedValue']
        finalDf = pd.concat([finalDf, df])
        finalDf.to_excel("finalfile12.xlsx")
</code>```

The above script generates the below:

As you can see, the "Total Received" column is missing and so are columns that directly or indirectly dependent on this. The original files have data for these columns. Also, index_col=None is not removing the index in column A (index_col=False doesn't work either)

Body:
path = "C:\\Users\\Adam\\Desktop\\Stock Trackers\\New Folder\\"

finalDf = pd.DataFrame()

for file in filenames:
    if file.startswith("Stock"):
        df = pd.read_excel(path+file,usecols="A:D,R",index_col=None)
        df['Total Received']
        df['Qty Received']=df['Total Received']
        df['InvoicedValue'] = df['Price']*df['Qty Invoiced']
        df['ReceivedValue'] = df['Price']*df['Qty Received']
        df['DeltaQty']= df['Qty Received']-df['Qty Invoiced']
        df['DeltaValue']= df['ReceivedValue']-df['InvoicedValue']
        finalDf = pd.concat([finalDf, df])
        finalDf.to_excel("finalfile12.xlsx")

The above script generates the below:

As you can see, the "Total Received" column is missing and so are columns that directly or indirectly dependent on this. The original files have data for these columns. Also, index_col=None is not removing the index in column A (index_col=False doesn't work either)


问:
How to pass path variable in thymeleaf to display data from connected table
I have two tables: User and Wallet. This is how Wallet looks like:

As you can see I can assignee wallet to user.

Now, I want to create a controller that will show initial_balance and wallet_name in HTML.

This is how my controller now looks:

```<code> @GetMapping("/userWallet/balance/{user_id}")
 public String getUserWallet(@PathVariable(value = "user_id") Long user_id, Model model) {
    model.addAttribute("wallet", walletService.findByUserId(user_id));
    return "userProfile";
 }
</code>```

And that works fine, when I go to that URL and pass user_id I get his initialBalance, but I need to go to that URL every time manually.

So, I tried to create this in HTML:

```<code><div th:each="wallet : ${wallet}">
<a th:href="@{/api/wallet/userWallet/balance/{user_id}(user_id = ${wallet.id})}">
    <span th:text="${wallet.initialBalance}"></span>
</a>
</div>
</code>```

But it still wont to show me initialBalance of current user on page. Any help?

Body:
I have two tables: User and Wallet. This is how Wallet looks like:

As you can see I can assignee wallet to user.

Now, I want to create a controller that will show initial_balance and wallet_name in HTML.

This is how my controller now looks:

 @GetMapping("/userWallet/balance/{user_id}")
 public String getUserWallet(@PathVariable(value = "user_id") Long user_id, Model model) {
    model.addAttribute("wallet", walletService.findByUserId(user_id));
    return "userProfile";
 }

And that works fine, when I go to that URL and pass user_id I get his initialBalance, but I need to go to that URL every time manually.

So, I tried to create this in HTML:

But it still wont to show me initialBalance of current user on page. Any help?


问:
User's name not showing in multiplayer godot waiting room
so i was following a multiplayer godot tutorial on YouTube by ruyuse everything worked well (the server) until i got to the waiting room which is supposed to show the names of players joined, from this  to this  but when i try mine  the lobby is the same but the waiting room ends up like this  i know there is something of but its my first time making a multiplayer game so pls help.

This is my server side:

server.gd

```<code>func _ready():
    start_server()

func start_server():
    network.create_server(port, max_players)
    get_tree().set_network_peer(network)
    network.connect("peer_connected", self, "_player_connected")
    network.connect("peer_disconnected", self, "_player_disconnected")

    print("server started")

func _player_connected(player_id):
    print("Player: " + str(player_id) + " Connected")

func _player_disconnected(player_id):
    print("Player: " + str(player_id) + " Disconnected")

remote func send_player_info(id, player_data):
    players[id] = player_data
    rset("players", players)
    rpc("update_waiting_room")

</code>```

The client:

server.gd:

```<code>extends Node

const DEFAULT_IP = "127.0.0.1"
const DEFAULT_PORT = 3234

var network = NetworkedMultiplayerENet.new()
var selected_IP
var selected_port

var local_player_id = 0
sync var players = {}
sync var player_data = {}

func ready():
    get_tree().connect("network_peer_connected", self,"_player_connected")
    get_tree().connect("network_peer_disconnected", self,"_player_disconnected")
    get_tree().connect("connection_failed", self,"_connected_fail")
    get_tree().connect("server_disconnected", self,"_server_disconnected")

func _connect_to_server():
        get_tree().connect("connected_to_server", self, "_connected_ok")
        network.create_client(selected_IP, selected_port)
        get_tree().set_network_peer(network)

func _player_connected(id):
    print("player: " + str(id) + "Connected")

func _player_disconnected(id):
    print("player: " + str(id) + "Disconnected")

func _connected_ok():
    print("successfully connected to server")
    register_player()
    rpc_id(1, "send_player_info", local_player_id, player_data)

func _connected_fail():
    print("failed to connect")

func _server_disconnected():
    print("server disconnected")

func register_player():
    local_player_id = get_tree().get_network_unique_id()
    player_data = Save.save_data
    players[local_player_id] = player_data

sync func update_waiting_room():
    get_tree().call_group("WaitingRoom", "refresh_players", players)

</code>```

lobby.gd:

```<code>extends Control

onready var player_name = $CenterContainer/VBoxContainer/GridContainer/NameTextBox
onready var selected_IP = $CenterContainer/VBoxContainer/GridContainer/IPTextBox
onready var selected_port = $CenterContainer/VBoxContainer/GridContainer/PortTextBox
onready var waiting_room = $WaitingRoom
onready var ready_btn = $WaitingRoom/CenterContainer/VBoxContainer/ReadyButton

func _ready():
    player_name.text = Save.save_data["Player_name"]
    selected_IP.text = (Server.DEFAULT_IP)
    selected_port.text = str(Server.DEFAULT_PORT)

func _on_Join_button_pressed():
    Server.selected_IP = selected_IP.text
    Server.selected_port = int(selected_port.text)
    Server._connect_to_server()
    show_waiting_room()

func _on_NameTextBox_text_changed(new_text):
    Save.save_data["Player_name"] = player_name.text
    Save.save_game()

func show_waiting_room():
    waiting_room.popup_centered()

func _on_ReadyButton_pressed():
     ready_btn.disabled = true

</code>```

waiting_room.gd:

```<code>extends Popup

onready var player_list = $CenterContainer/VBoxContainer/ItemList

func _ready():
    player_list.clear()

func refresh_players(players):
    player_list.clear()
    for player_id in players:
        var player = players[player_id]["Player_name"]
        player_list.add_item(player, null, false)

</code>```

save.gd:

```<code>var save_data = {}

func _ready():
    save_data = get_data()

func get_data():
    var file = File.new()

    if not file.file_exists(SAVEGAME):
        save_data = {"Player_name": "Unnamed"}
        save_game()
    file.open(SAVEGAME, File.READ)
    var content = file.get_as_text()
    var data = parse_json(content)
    save_data = data
    file.close()
    return(data)

func save_game():
    var save_game = File.new()
    save_game.open(SAVEGAME, File.WRITE)
    save_game.store_line(to_json(save_data))

</code>```

and these are the errors i get on the server side (i realy don"t know what they mean)

I really hope this is not to long of a question because i really need help.
Thank you for reading.

sorry for the typos

Body:
so i was following a multiplayer godot tutorial on YouTube by ruyuse everything worked well (the server) until i got to the waiting room which is supposed to show the names of players joined, from this  to this  but when i try mine  the lobby is the same but the waiting room ends up like this  i know there is something of but its my first time making a multiplayer game so pls help.

This is my server side:

server.gd

func _ready():
    start_server()

func start_server():
    network.create_server(port, max_players)
    get_tree().set_network_peer(network)
    network.connect("peer_connected", self, "_player_connected")
    network.connect("peer_disconnected", self, "_player_disconnected")

    print("server started")

func _player_connected(player_id):
    print("Player: " + str(player_id) + " Connected")

func _player_disconnected(player_id):
    print("Player: " + str(player_id) + " Disconnected")

remote func send_player_info(id, player_data):
    players[id] = player_data
    rset("players", players)
    rpc("update_waiting_room")

The client:

server.gd:

extends Node

const DEFAULT_IP = "127.0.0.1"
const DEFAULT_PORT = 3234

var network = NetworkedMultiplayerENet.new()
var selected_IP
var selected_port

var local_player_id = 0
sync var players = {}
sync var player_data = {}

func ready():
    get_tree().connect("network_peer_connected", self,"_player_connected")
    get_tree().connect("network_peer_disconnected", self,"_player_disconnected")
    get_tree().connect("connection_failed", self,"_connected_fail")
    get_tree().connect("server_disconnected", self,"_server_disconnected")

func _connect_to_server():
        get_tree().connect("connected_to_server", self, "_connected_ok")
        network.create_client(selected_IP, selected_port)
        get_tree().set_network_peer(network)

func _player_connected(id):
    print("player: " + str(id) + "Connected")

func _player_disconnected(id):
    print("player: " + str(id) + "Disconnected")

func _connected_ok():
    print("successfully connected to server")
    register_player()
    rpc_id(1, "send_player_info", local_player_id, player_data)

func _connected_fail():
    print("failed to connect")

func _server_disconnected():
    print("server disconnected")

func register_player():
    local_player_id = get_tree().get_network_unique_id()
    player_data = Save.save_data
    players[local_player_id] = player_data

sync func update_waiting_room():
    get_tree().call_group("WaitingRoom", "refresh_players", players)

lobby.gd:

extends Control

onready var player_name = $CenterContainer/VBoxContainer/GridContainer/NameTextBox
onready var selected_IP = $CenterContainer/VBoxContainer/GridContainer/IPTextBox
onready var selected_port = $CenterContainer/VBoxContainer/GridContainer/PortTextBox
onready var waiting_room = $WaitingRoom
onready var ready_btn = $WaitingRoom/CenterContainer/VBoxContainer/ReadyButton

func _ready():
    player_name.text = Save.save_data["Player_name"]
    selected_IP.text = (Server.DEFAULT_IP)
    selected_port.text = str(Server.DEFAULT_PORT)

func _on_Join_button_pressed():
    Server.selected_IP = selected_IP.text
    Server.selected_port = int(selected_port.text)
    Server._connect_to_server()
    show_waiting_room()

func _on_NameTextBox_text_changed(new_text):
    Save.save_data["Player_name"] = player_name.text
    Save.save_game()

func show_waiting_room():
    waiting_room.popup_centered()

func _on_ReadyButton_pressed():
     ready_btn.disabled = true

waiting_room.gd:

extends Popup

onready var player_list = $CenterContainer/VBoxContainer/ItemList

func _ready():
    player_list.clear()

func refresh_players(players):
    player_list.clear()
    for player_id in players:
        var player = players[player_id]["Player_name"]
        player_list.add_item(player, null, false)

save.gd:

var save_data = {}

func _ready():
    save_data = get_data()

func get_data():
    var file = File.new()

    if not file.file_exists(SAVEGAME):
        save_data = {"Player_name": "Unnamed"}
        save_game()
    file.open(SAVEGAME, File.READ)
    var content = file.get_as_text()
    var data = parse_json(content)
    save_data = data
    file.close()
    return(data)

func save_game():
    var save_game = File.new()
    save_game.open(SAVEGAME, File.WRITE)
    save_game.store_line(to_json(save_data))

and these are the errors i get on the server side (i realy don"t know what they mean)

I really hope this is not to long of a question because i really need help.
Thank you for reading.

sorry for the typos


问:
log out happens before db operation Kotlin KMM Realm Mongodb
I have a kmm app, and I have a shared repository in Kotlin.
I have a login that does the normal login to Realm MongoDb and add a FCM key.
I have also a logout method that should remove first the FCM token and then do the logOUT() from Realm MongoDB

My logOut method:

```<code>suspend fun doLogout(token: String) {
    val userId = appService.currentUser?.id

    realm.write {

            var user = query<UserInfo>("_id = $0", userId).first().find()
            if (user != null) {
                val productIndex =
                    user.FCMToken.withIndex().findLast { it.value == token }!!.index

                user = findLatest(user)!!.also {
                    it.FCMToken.removeAt(productIndex)
                }
                copyToRealm(user)
            }
    }

    appService.currentUser?.logOut()
}
</code>```

I think what happens is that the logout happens before the DB change.

How can I do the logout after the db change is completed?

Body:
I have a kmm app, and I have a shared repository in Kotlin.
I have a login that does the normal login to Realm MongoDb and add a FCM key.
I have also a logout method that should remove first the FCM token and then do the logOUT() from Realm MongoDB

My logOut method:

suspend fun doLogout(token: String) {
    val userId = appService.currentUser?.id

    realm.write {

            var user = query<UserInfo>("_id = $0", userId).first().find()
            if (user != null) {
                val productIndex =
                    user.FCMToken.withIndex().findLast { it.value == token }!!.index

                user = findLatest(user)!!.also {
                    it.FCMToken.removeAt(productIndex)
                }
                copyToRealm(user)
            }
    }

    appService.currentUser?.logOut()
}

I think what happens is that the logout happens before the DB change.

How can I do the logout after the db change is completed?


问:
How can you log to GCP project when you have three different GCP Projects Referenced?
Current setup:
GCP Project A holds the logs for application.
GCP Project B Namespace has the application running on Kubernetes.
GCP Project C holds the BigQuery Datasets and Tables that are queried by the Application.

We have a service account for Project B to query Project B.
We have a service account from Project B to log to Project A.

In the app, I am getting errors when I try to add logging client. I suspect its because the service account used to run the queries in the application is conflicting with the service account for logging.

Is there any way to get logging in place in this situation?

I tried adding GCP logging on my api route with logging client. I called a function to do the query with bigquery client.


问:
Key Error "None of [Int64Index([ 53, 0,\n 0],\n dtype='int64')] are in the [columns]"
```<code>Unique['DiffTimeMinutes'] = Unique['DiffTimeMinutes'].fillna(0).astype(int)

if Unique[Unique['DiffTimeMinutes']]>30:
    display(Unique)
</code>```

this is my code and it give me error like this

```<code>Key Error "None of [Int64Index([  53,   0,\n               0],\n           dtype='int64')] are in the [columns]"
</code>```

Cant able to find it anywhere

```<code>if Unique[Unique['DiffTimeMinutes']]>30:
    display(Unique)

Unique['DiffTimeMinutes'] = Unique['DiffTimeMinutes'].fillna(0).astype(int)
</code>```

Body:
Unique['DiffTimeMinutes'] = Unique['DiffTimeMinutes'].fillna(0).astype(int)

if Unique[Unique['DiffTimeMinutes']]>30:
    display(Unique)

this is my code and it give me error like this

Key Error "None of [Int64Index([  53,   0,\n               0],\n           dtype='int64')] are in the [columns]"

Cant able to find it anywhere

if Unique[Unique['DiffTimeMinutes']]>30:
    display(Unique)

Unique['DiffTimeMinutes'] = Unique['DiffTimeMinutes'].fillna(0).astype(int)


问:
How to remove image photo gradation in python?
I want to remove gradation in image.

I used K-means algorithms but I can`t get the result I need.

How can I get just one yellow circle composed of just one color?


问:
change in fonts and spacing in a django app
I installed django bootstrap5 but it seems to have messed up the css and fonts and i can't seem to figure out what went wrong..I have a website am trying to clone, innitially things looked pretty the same until i tried installing django bootstrap and django tailwinds, well i later uninstalled tailwinds but the mess is still there. here is the pic of the changesThe current changes in the interface

Here is what it looked like innitially and how the website itself looks like website fonts


问:
Filtering broadcasts by date and category at the same time
I am developing a Django website and faced the following problem: I need to filter broadcasts by date (the date is specified by the user) and category.
Screenshot: https://i.stack.imgur.com/5V1Or.png
Could you tell me how to implement such a thing shown in the screenshot?

Attempts to form a get request with parameters were unsuccessful