问:
IBM Informix DB 12.1 : Collect data into set/ json array without creating procedures/ functions
I am working to try to collect all data belonging to a particular category into a Json structure or set.

for Example

ID
Status
Dim

A
P
5

B
Q
10

C
R
15

D
S
5

A
T
6

C
U
9

D
V
20

E
W
100

A
X
6

F
Y
69

Output should be:

ID
Collect
Max
Instances

A
{P:5,T:6,X:6}
6
3

B
{Q:10}
10
1

C
{R:15,U:9}
15
2

D
{S:5,V:20}
20
2

E
{W:100}
100
1

F
{Y:69}
69
1

I cannot create procedures since the org has not given me the appropriate privilege.

I was looking into multiset in Informix but that is confusing-

I wrote the query to try to build the first two columns, because I can write the max and instances later

```<code>    select id,multiset(select status, dim from table i where i.id=t.id) Collect from table t where category='A'
</code>```

This gave me 3 rows all containing the same value

id
collect

A
[IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ]

A
[IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ]

A
[IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ]

I would settle for a comma seperated list of values
For example

id
collect

A
"P:5","T:6","X:6"

Body:
I am working to try to collect all data belonging to a particular category into a Json structure or set.

for Example

ID
Status
Dim

A
P
5

B
Q
10

C
R
15

D
S
5

A
T
6

C
U
9

D
V
20

E
W
100

A
X
6

F
Y
69

Output should be:

ID
Collect
Max
Instances

A
{P:5,T:6,X:6}
6
3

B
{Q:10}
10
1

C
{R:15,U:9}
15
2

D
{S:5,V:20}
20
2

E
{W:100}
100
1

F
{Y:69}
69
1

I cannot create procedures since the org has not given me the appropriate privilege.

I was looking into multiset in Informix but that is confusing-

I wrote the query to try to build the first two columns, because I can write the max and instances later

    select id,multiset(select status, dim from table i where i.id=t.id) Collect from table t where category='A'

This gave me 3 rows all containing the same value

id
collect

A
[IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ]

A
[IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ]

A
[IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) , IfxStruct. Type: row ( item_nbr int  not null) ]

I would settle for a comma seperated list of values
For example

id
collect

A
"P:5","T:6","X:6"


来源: stackexchange

问:
is there someone who know to fit image dataset in Logistic Regression
i've a dataset with images, so before processing to the Logistic Regression fit model part i need to split my dataset into train and test, but with this kind of dataset it become difficult for me, with an other dataset(csv) it could be easy, but with images when i tried to split my dataset i'm getting Found input variables with inconsistent numbers of samples: [2110, 660] error, is there someone who implement logistic Regression with images dataset? or who face this king of issue before? it will really be helpful, thank you</p>

ContentLicense: CC BY-SA 4.0


问:
Find outliers in a list of coordinates data
I have a list of coordinates for a boundary line, it looks like this:

```<code>-74.71224,31.11124
-74.70204,31.71901
-74.71414,31.77729
-74.70109,31.74797
-74.49712,31.74914
-74.70144,31.71014
-74.49714,31.49251
-74.70915,31.49724
-74.71194,31.70104
-74.77215,31.71404
-74.77312,31.71092
-74.71137,31.72254
-74.14272,31.71177
-74.14943,31.72044
-74.14515,31.72794
-74.19794,31.72114
-74.91112,31.71751
-74.94971,31.70549
-74.94172,31.70943
-74.97931,31.49104
</code>```

The entire list should gives you a closed-loop boundary line.

And for my data, there's some points that shouldn't be there, i.e. a point that's not part of the boundary line.

And my question is, how can I find these points?

EDIT:

My idea is that, right now I have a circle with some points away from that circle, how can I check every points if it's too far away from that circle to be consider part of it?

Please see picture for what I mean. I think if a points's distance from its closest one's is bigger than x, then it's an outliers.

points in the file are not in order, meaning, not one next to next other in terms of location on the map

ContentLicense: CC BY-SA 3.0

Body:
I have a list of coordinates for a boundary line, it looks like this:

-74.71224,31.11124
-74.70204,31.71901
-74.71414,31.77729
-74.70109,31.74797
-74.49712,31.74914
-74.70144,31.71014
-74.49714,31.49251
-74.70915,31.49724
-74.71194,31.70104
-74.77215,31.71404
-74.77312,31.71092
-74.71137,31.72254
-74.14272,31.71177
-74.14943,31.72044
-74.14515,31.72794
-74.19794,31.72114
-74.91112,31.71751
-74.94971,31.70549
-74.94172,31.70943
-74.97931,31.49104

The entire list should gives you a closed-loop boundary line.

And for my data, there's some points that shouldn't be there, i.e. a point that's not part of the boundary line.

And my question is, how can I find these points?

EDIT:

My idea is that, right now I have a circle with some points away from that circle, how can I check every points if it's too far away from that circle to be consider part of it?

Please see picture for what I mean. I think if a points's distance from its closest one's is bigger than x, then it's an outliers.

points in the file are not in order, meaning, not one next to next other in terms of location on the map


问:
Pytest slow in docker container taking 75s+ for about 15 tests
I have a simple dockerfile that does the following:

```<code>FROM python:3.10.3

RUN pip install -U pip setuptools
RUN pip install poetry==1.1.11

WORKDIR /srv
</code>```

I am using docker compose to mount the relevant directory, but will ignore that here. I am then running this command to run tests in 1 folder:

```<code>docker-compose run -it -e PYTHONPATH=./src api /bin/bash -c "poetry run pytest --pspec ./src/e2e/test_*"
</code>```

That folder has 2 files that match the glob test_* and they contain 15 tests.

When I run the command above using the --collectonly flag, it takes about 75s.

Example output below:

```<code>===================================================== test session starts =====================================================
platform linux -- Python 3.10.3, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /srv
plugins: pspec-0.0.4, mock-3.10.0, anyio-3.6.2
collected 15 items

<Module src/e2e/test_m.py>
  <Function test_b_idempotency>
  <Function test_e_creation>
  <Function test_e_update>
  <Function test_v_creation>
  <Function test_v_update>
  <Function test_s_cleared>
<Module src/e2e/test_q.py>
  <Function test_basic_q>
  <Function test_basic_r>
  <Function test_basic_p>
  <Function test_basic_r2>
  <Function test_time_weight>
  <Function test_s_content>
  <Function test_simple_research_case>
  <Function test_context_e_search>
  <Function test_recent_m_pagination>

=========================================== 15 tests collected in 77.41s (0:01:17) ============================================
</code>```

This used to be an incredibly quick command (<1s) but I am not entirely sure what has slowed it down apart from possibly an upgrade of docker.

The tests also take unusually long to run, however given collection is taking incredibly long, this seems like something outside of what's in the tests themselves.

I am on macOS 12.6 and Docker 4.15.0

Does anyone know what may be causing the issue, or how I may go about troubleshooting?

I have read the answers in this question but the answers revolve around reducing the amount of files being scanned, which I think I'm already doing.

Any help is much appreciated.

EDIT: This does not seem to be a docker issue since collection is also slow when I run locally.

Body:
I have a simple dockerfile that does the following:

FROM python:3.10.3

RUN pip install -U pip setuptools
RUN pip install poetry==1.1.11

WORKDIR /srv

I am using docker compose to mount the relevant directory, but will ignore that here. I am then running this command to run tests in 1 folder:

docker-compose run -it -e PYTHONPATH=./src api /bin/bash -c "poetry run pytest --pspec ./src/e2e/test_*"

That folder has 2 files that match the glob test_* and they contain 15 tests.

When I run the command above using the --collectonly flag, it takes about 75s.

Example output below:

===================================================== test session starts =====================================================
platform linux -- Python 3.10.3, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /srv
plugins: pspec-0.0.4, mock-3.10.0, anyio-3.6.2
collected 15 items

<Module src/e2e/test_m.py>
  <Function test_b_idempotency>
  <Function test_e_creation>
  <Function test_e_update>
  <Function test_v_creation>
  <Function test_v_update>
  <Function test_s_cleared>
<Module src/e2e/test_q.py>
  <Function test_basic_q>
  <Function test_basic_r>
  <Function test_basic_p>
  <Function test_basic_r2>
  <Function test_time_weight>
  <Function test_s_content>
  <Function test_simple_research_case>
  <Function test_context_e_search>
  <Function test_recent_m_pagination>

=========================================== 15 tests collected in 77.41s (0:01:17) ============================================

This used to be an incredibly quick command (<1s) but I am not entirely sure what has slowed it down apart from possibly an upgrade of docker.

The tests also take unusually long to run, however given collection is taking incredibly long, this seems like something outside of what's in the tests themselves.

I am on macOS 12.6 and Docker 4.15.0

Does anyone know what may be causing the issue, or how I may go about troubleshooting?

I have read the answers in this question but the answers revolve around reducing the amount of files being scanned, which I think I'm already doing.

Any help is much appreciated.

EDIT: This does not seem to be a docker issue since collection is also slow when I run locally.


问:
How to load cookies before loading page with Python?
My program uses a proxy and works with several services where I need to load cookies. Using a proxy, loading a website can take a lot of time anyway, but this way
takes even more:

```<code>driver.get('url')
for cookie in pickle.load(open("path", "rb")):
    driver.add_cookie(cookie)
driver.refresh()
</code>```

Also, this method can sometimes cause the service to be suspicious, because first it receives a request without a cookie and then with a cookie. After that, captchas may appear and etc. How can I load cookies before loading page?

Body:
My program uses a proxy and works with several services where I need to load cookies. Using a proxy, loading a website can take a lot of time anyway, but this way
takes even more:

driver.get('url')
for cookie in pickle.load(open("path", "rb")):
    driver.add_cookie(cookie)
driver.refresh()

Also, this method can sometimes cause the service to be suspicious, because first it receives a request without a cookie and then with a cookie. After that, captchas may appear and etc. How can I load cookies before loading page?


问:
How to Ioncube a symfony 5 project
I'm trying to Ioncube my symfony 5 project and I'm facing some issues. I made a small sample project to illustrate my problem https://github.com/NichoSeb2/ioncube-symfony.

When I run a composer install I get a Segmentation fault error, I don't think it comes from the composer install itself but from the php bin/console clear:cache that composer do automatically after. If I run php bin/console clear:cache manually I get the same error.

I'm running the project inside docker, all explanation about how to run the project are on the README.md available in the github repo. Also included in the readme is the Ioncubed version of the src/Service/TestIoncube.php file.

If I replace the Ioncubed file with the original one I get no errors. I'm trying to Ioncube only the src/Service for now as my research showed that Ioncubing the entity and controller files can be more challenging.

I'm open to any idea of what I'm doing wrong or what I can change to get the sample project working with the Ioncubed file. Feel free to fork the repo, if you need more information don't hesitate, I really want this to work.

Title: How to Ioncube a symfony 5 project


问:
Automate Captcha Text Image with Selenium and Python
I have been reading the forums and I have not found a solution to my problem.

Right now I have tried to read this image with tesseract library, but even in the CMD it says "Empty page!!"

I also believe that tesseract is not the best option since I will need this to be compiled into an .exe and the script with tesseract contains one static folder (the tesseract's one).

This is the code I was using to get teseract image:

```<code>                # Set the path to the Tesseract executable
                pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'

                # Locate the element containing the captcha image
                captcha_img = driver.find_element(By.XPATH, '//*[@id="captchaImage"]')

                # Take a screenshot of the element and save it to a file
                captcha_img.screenshot('captcha.png')

                # Open the image file and extract the text using Tesseract OCR
                text = pytesseract.image_to_string(Image.open('captcha.png'))

                # Locate the input field for the captcha text
                captcha_input = driver.find_element(By.XPATH, '//*[@id="resultCaptcha"]')

                # Input the extracted text into the field
                captcha_input.send_keys(text)
</code>```

This is an example of an image:

Any ideas on how to break the captcha and later get the .exe to work on other computers?

Thank you.

Tried to solve a captcha with tesseract but can't read the image.
Also I need the script to run without dependency of the tesseract main folder.

Body:
I have been reading the forums and I have not found a solution to my problem.

Right now I have tried to read this image with tesseract library, but even in the CMD it says "Empty page!!"

I also believe that tesseract is not the best option since I will need this to be compiled into an .exe and the script with tesseract contains one static folder (the tesseract's one).

This is the code I was using to get teseract image:

                # Set the path to the Tesseract executable
                pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'

                # Locate the element containing the captcha image
                captcha_img = driver.find_element(By.XPATH, '//*[@id="captchaImage"]')

                # Take a screenshot of the element and save it to a file
                captcha_img.screenshot('captcha.png')

                # Open the image file and extract the text using Tesseract OCR
                text = pytesseract.image_to_string(Image.open('captcha.png'))

                # Locate the input field for the captcha text
                captcha_input = driver.find_element(By.XPATH, '//*[@id="resultCaptcha"]')

                # Input the extracted text into the field
                captcha_input.send_keys(text)

This is an example of an image:

Any ideas on how to break the captcha and later get the .exe to work on other computers?

Thank you.

Tried to solve a captcha with tesseract but can't read the image.
Also I need the script to run without dependency of the tesseract main folder.


问:
Having a list of sounds in a UIPickerView
I have a UIPickerView, and I have 10 sounds. I want to implement the 10 sounds into a UIPickerView. So once the user scrolls through the picker view, each sound plays.
I'm pretty new to obj c, so bear with me please.

Here is the current code.

```<code>#import <UIKit/UIKit.h>

@interface TesttimeViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {

    IBOutlet UIPickerView *pickerView;
    NSMutableArray *list;
    IBOutlet UILabel *pickLabel;

}

@end

#import "TesttimeViewController.h"

@implementation TesttimeViewController

-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
    return 1;

}

-(NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
    return [list count];
}

-(NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    return [list objectAtIndex:row];
}

-(void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    NSString *string = [NSString stringWithFormat:@"Now Playing: %@", [list objectAtIndex:row]];
                        pickLabel.text = string;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];

    list = [[NSMutableArray alloc]init];
    [list addObject:@"100"];
    [list addObject:@"2100"];
    [list addObject:@"1300"];
    [list addObject:@"1400"];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
</code>```

All this does is select the text then shows in a uilabel which text has been selected in the uipickerview.

Thanks

Body:
I have a UIPickerView, and I have 10 sounds. I want to implement the 10 sounds into a UIPickerView. So once the user scrolls through the picker view, each sound plays.
I'm pretty new to obj c, so bear with me please.

Here is the current code.

#import <UIKit/UIKit.h>

@interface TesttimeViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {

    IBOutlet UIPickerView *pickerView;
    NSMutableArray *list;
    IBOutlet UILabel *pickLabel;

}

@end

#import "TesttimeViewController.h"

@implementation TesttimeViewController

-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
    return 1;

}

-(NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
    return [list count];
}

-(NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    return [list objectAtIndex:row];
}

-(void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    NSString *string = [NSString stringWithFormat:@"Now Playing: %@", [list objectAtIndex:row]];
                        pickLabel.text = string;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];

    list = [[NSMutableArray alloc]init];
    [list addObject:@"100"];
    [list addObject:@"2100"];
    [list addObject:@"1300"];
    [list addObject:@"1400"];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end

All this does is select the text then shows in a uilabel which text has been selected in the uipickerview.

Thanks


问:
Cannot access Query Editor in AWS Redshift
I'm doing an online Data Engineering course and have been given access to an AWS account for practice that's assigned to me.

When I create a Redshift cluster (done using Boto3 library) I wanted to check if my python code successfully inserted data into tables I created programmatically.

I wanted to use the Query Editor (tried both version 1 and 2) to do this online rather than Python. These errors occur when I click on "Connect and Run".

Query Editor v1 error:

I don't know how to resolve this, I'm unable to run queries in the Query Editor.

Query Editor v2 error:

It's worth mentioning that my role only has the following permission policy when I check in IAM:

AmazonS3ReadOnlyAccess

Thanks for your help!!

UPDATE:
I followed instructions from an AWS Redshift page and just added the following permissions to that role:

AmazonRedshiftReadOnlyAccess
AmazonRedshiftQueryEditor
AmazonRedshiftFullAccess
AmazonS3ReadOnlyAccess

However, I'm still getting the same Query Editor errors.


问:
How to rotate and scale a Rectangle2D in java and return a Rectangle2D (not a Shape or Path2D)
Is it possible to scale or rotate a Rectangle2D and get a new transformed Rectangle2D?
I know it is possible to get a Shape or Path2D, but how to get a new Rectangle2D from a specific Affine transform that in theory return a Rectangle also?

Maybe reconstruct a new Rectangle2D from Path2D (iteration?), but how?
Rectangle2D will feed the TexturePaint class anchor parameter.

methods that return a Path2D/Shape

```<code>       private Path2D.Double transformRotate(Rectangle2D.Double rect) {

        AffineTransform transform = new AffineTransform();
          double theta=0.5;
        double angle = Math.toRadians(theta);
    //  transform.rotate(angle, rect.x + rect.width / 2, rect.y + rect.height / 2);
        transform.rotate( orientationX, orientationY, rect.x + rect.width / 2, rect.y + rect.height / 2);

        return new Path2D.Double(rect, transform);
    }

</code>```
```<code>                AffineTransform transformRect = new AffineTransform();
transformRect.rotate(orientationX, orientationY, rectFinal.getX() + rectFinal.getWidth()/2, rectFinal.getY() + rectFinal.getHeight()/2);

Shape rotatedRect =  transformRect.createTransformedShape(rectFinal); //or path2D

</code>```

Body:
Is it possible to scale or rotate a Rectangle2D and get a new transformed Rectangle2D?
I know it is possible to get a Shape or Path2D, but how to get a new Rectangle2D from a specific Affine transform that in theory return a Rectangle also?

Maybe reconstruct a new Rectangle2D from Path2D (iteration?), but how?
Rectangle2D will feed the TexturePaint class anchor parameter.

methods that return a Path2D/Shape

       private Path2D.Double transformRotate(Rectangle2D.Double rect) {

        AffineTransform transform = new AffineTransform();
          double theta=0.5;
        double angle = Math.toRadians(theta);
    //  transform.rotate(angle, rect.x + rect.width / 2, rect.y + rect.height / 2);
        transform.rotate( orientationX, orientationY, rect.x + rect.width / 2, rect.y + rect.height / 2);

        return new Path2D.Double(rect, transform);
    }

                AffineTransform transformRect = new AffineTransform();
transformRect.rotate(orientationX, orientationY, rectFinal.getX() + rectFinal.getWidth()/2, rectFinal.getY() + rectFinal.getHeight()/2);

Shape rotatedRect =  transformRect.createTransformedShape(rectFinal); //or path2D


问:
How to use future::resolved with promises::future_promises
i'm trying to determine if a future_promises is fullified. In the future package one can use the resolved function to check whether a future is resolved or not, but i don't get how to use it with promises. promises seems to resolve immediately :

```<code>> future::plan(future::multisession)
>
> f <- function() {
+   Sys.sleep(10)
+   return(TRUE)
+ }
>
> x <- promises::future_promise({
+   f()
+ })
>
> y <- future::future({
+   f()
+ })
>
> future::resolved(x)
[1] TRUE
> future::resolved(y)
[1] FALSE
</code>```

How to use resolved() with promises ? Or how do you check that a promises is resolved/fullified ?

Ideally i would like to do some operations while the future_promises is evaluating e.g. while (!resolved(future)) Do Something

Body:
i'm trying to determine if a future_promises is fullified. In the future package one can use the resolved function to check whether a future is resolved or not, but i don't get how to use it with promises. promises seems to resolve immediately :

> future::plan(future::multisession)
>
> f <- function() {
+   Sys.sleep(10)
+   return(TRUE)
+ }
>
> x <- promises::future_promise({
+   f()
+ })
>
> y <- future::future({
+   f()
+ })
>
> future::resolved(x)
[1] TRUE
> future::resolved(y)
[1] FALSE

How to use resolved() with promises ? Or how do you check that a promises is resolved/fullified ?

Ideally i would like to do some operations while the future_promises is evaluating e.g. while (!resolved(future)) Do Something


问:
How to disable ALL linting / annotations /error handling in VSCode?
I only want to use VSCode as a syntax highlighter. I don't want any linting, annotations, error handling, or anything besides for syntax highlighting, for any languages. I've been looking all over but I can't find a setting for this.</p>


问:
A chunk of code that doens't work inside a function but works outisde a function
I have a function that one of it's duties is to is perform a batch effect correction, and that is according to the use_batch parameter which takes a boolian value. (it's a parameter that is passed when calling the function).

This is the part of the function that perform this correction:

```<code>  if (use_batch){
    scores = as.data.frame(scores)
    cancer.type = metadata[['Cancer_Type']]
    scores = limma::removeBatchEffect(t(scores) ,batch = cancer.type)
    scores = t(scores)
  }
</code>```

Produces this error:

```<code>Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be numeric
</code>```

And this code works fine outside the function. my_scores and my_meta are the real dataframes that I use:

```<code>> if (TRUE){
     scoresx = as.data.frame(my_scores)
     cancer.type = my_meta[['Cancer_Type']]
     scoresx = limma::removeBatchEffect(t(scoresx) ,batch = cancer.type)
     scoresx = t(scoresx)
 }
</code>```

It's important to note that the function works perfectly when use_batch = FALSE, therefore the problem is only with this chunk I provided here. The Show Traceback option tells me the problem is here: scores = limma::removeBatchEffect(t(scores) ,batch = cancer.type). What is the problem? why does it work good outside the function? Here are small subsets of the two used dataframes in the function:

```<code>> dput(my_scores[1:6,1:6])
structure(c(-0.0741098696855045, -0.094401270881699, 0.0410284948786532,
-0.163302950330185, -0.0942478217207681, -0.167314411991775,
-0.178835447722468, -0.253897294559596, -0.0372301980787381,
-0.230579110769457, -0.224125346052727, -0.196933050675633, -0.0384421660291032,
-0.0275306107582565, 0.186447606591857, -0.124972070102036, -0.15348122673842,
-0.106812144494277, -0.0924083910597563, -0.172356328661097,
-0.0172673823614314, 0.0280649471541352, -0.128925304635747,
-0.0875076743713435, -0.0680848706469295, -0.173427291586957,
-0.0106773958944477, -0.0015805672257001, -0.0751114943036091,
-0.0737177243152751, -0.0391833488213571, -0.0275279418713283,
0.0156454755097513, 0.0285160860867748, -0.0633367938488132,
0.0252778805872529), dim = c(6L, 6L), dimnames = list(c("Pt1",
"Pt10", "Pt101", "Pt103", "Pt106", "Pt11"), c("CD4-T-cells",
"CD8-T-cells", "T-helpers", "NK-cells", "Monocytes", "Neutrophils"
)))

> View(dput(my_meta[1:6,2:7]))
structure(list(samples = c("Pt1", "Pt10", "Pt101", "Pt103", "Pt106",
"Pt11"), Response = c("NoResponse", "NoResponse", "Response",
"NoResponse", "NoResponse", "NoResponse"), RECIST = c("PD", "SD",
"PR", "PD", "PD", "PD"), Gender = c("male", "female", "female",
"female", "male", "female"), treatment = c("anti-PD1", "anti-PD1",
"anti-PD1", "anti-PD1", "anti-PD1", "anti-PD1"), Cancer_Type = c("Melanoma",
"Melanoma", "Melanoma", "Melanoma", "Melanoma", "Melanoma")), row.names = c("Pt1",
"Pt10", "Pt101", "Pt103", "Pt106", "Pt11"), class = "data.frame")
</code>```

Body:
I have a function that one of it's duties is to is perform a batch effect correction, and that is according to the use_batch parameter which takes a boolian value. (it's a parameter that is passed when calling the function).

This is the part of the function that perform this correction:

  if (use_batch){
    scores = as.data.frame(scores)
    cancer.type = metadata[['Cancer_Type']]
    scores = limma::removeBatchEffect(t(scores) ,batch = cancer.type)
    scores = t(scores)
  }

Produces this error:

Error in rowMeans(y$exprs, na.rm = TRUE) : 'x' must be numeric

And this code works fine outside the function. my_scores and my_meta are the real dataframes that I use:

> if (TRUE){
     scoresx = as.data.frame(my_scores)
     cancer.type = my_meta[['Cancer_Type']]
     scoresx = limma::removeBatchEffect(t(scoresx) ,batch = cancer.type)
     scoresx = t(scoresx)
 }

It's important to note that the function works perfectly when use_batch = FALSE, therefore the problem is only with this chunk I provided here. The Show Traceback option tells me the problem is here: scores = limma::removeBatchEffect(t(scores) ,batch = cancer.type). What is the problem? why does it work good outside the function? Here are small subsets of the two used dataframes in the function:

> dput(my_scores[1:6,1:6])
structure(c(-0.0741098696855045, -0.094401270881699, 0.0410284948786532,
-0.163302950330185, -0.0942478217207681, -0.167314411991775,
-0.178835447722468, -0.253897294559596, -0.0372301980787381,
-0.230579110769457, -0.224125346052727, -0.196933050675633, -0.0384421660291032,
-0.0275306107582565, 0.186447606591857, -0.124972070102036, -0.15348122673842,
-0.106812144494277, -0.0924083910597563, -0.172356328661097,
-0.0172673823614314, 0.0280649471541352, -0.128925304635747,
-0.0875076743713435, -0.0680848706469295, -0.173427291586957,
-0.0106773958944477, -0.0015805672257001, -0.0751114943036091,
-0.0737177243152751, -0.0391833488213571, -0.0275279418713283,
0.0156454755097513, 0.0285160860867748, -0.0633367938488132,
0.0252778805872529), dim = c(6L, 6L), dimnames = list(c("Pt1",
"Pt10", "Pt101", "Pt103", "Pt106", "Pt11"), c("CD4-T-cells",
"CD8-T-cells", "T-helpers", "NK-cells", "Monocytes", "Neutrophils"
)))

> View(dput(my_meta[1:6,2:7]))
structure(list(samples = c("Pt1", "Pt10", "Pt101", "Pt103", "Pt106",
"Pt11"), Response = c("NoResponse", "NoResponse", "Response",
"NoResponse", "NoResponse", "NoResponse"), RECIST = c("PD", "SD",
"PR", "PD", "PD", "PD"), Gender = c("male", "female", "female",
"female", "male", "female"), treatment = c("anti-PD1", "anti-PD1",
"anti-PD1", "anti-PD1", "anti-PD1", "anti-PD1"), Cancer_Type = c("Melanoma",
"Melanoma", "Melanoma", "Melanoma", "Melanoma", "Melanoma")), row.names = c("Pt1",
"Pt10", "Pt101", "Pt103", "Pt106", "Pt11"), class = "data.frame")


问:
Adding a sorting alogrithm animation crashes the browser d3.js
Welcome , I tring to animate diffrent kinds of sorting alogrithms for now i want to setup animation with first that is bubble sort.My problem is when i click the start button to run the animation the whole browser crushes I am aware that this is triggered by the sorting function but I have no idea what to do so that there is no such problem.

this is my code for drawingVisualisation

```<code>import * as d3 from "d3";

const drawVisualization = (data: number[]) => {
  const margin = { top: 10, right: 30, bottom: 30, left: 40 };
  const width = 800 - margin.left - margin.right;
  const height = 400 - margin.top - margin.bottom;

  // If it is .visualization del it first
  d3.select(".visualization").selectAll("rect").remove();
  d3.select(".visualization").select("svg").remove();

  const svg = d3
    .select(".visualization")
    .append("svg")
    .attr("width", width)
    .attr("height", height)
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

  const rects = svg.selectAll("rect").data(data).enter().append("rect");

  rects
    .attr("x", (_d, i) => i * (width / data.length))
    .attr("y", (d) => height - d)
    .attr("width", () => width / data.length - 1)
    .attr("height", (d) => d)
    .on("mouseover", function (_d, i) {
      d3.select(this.parentElement)
        .append("text")
        .text(i)
        .attr(
          "x",
          () =>
            data.indexOf(i) * (width / data.length) + width / data.length / 2
        )
        .attr("y", height - i - 20)
        .attr("font-size", "14px")
        .attr("fill", "blue")
        .attr("text-anchor", "middle");

      d3.select(this).style("opacity", 0.85);
    })
    .on("mouseleave", function () {
      d3.select(this.parentElement).select("text").remove();

      d3.select(this).style("opacity", 1);
    });

  const startButton = document.querySelector(
    ".run-sorting-btn"
  ) as HTMLButtonElement;

  startButton.addEventListener("click", () => {
    for (let i = 0; i < data.length - 1; i++) {
      for (let j = 0; j < data.length - i - 1; j++) {
        if (data[j] > data[j + 1]) {
          const temp = data[j];
          data[j] = data[j + 1];
          data[j + 1] = temp;

          // Animate the movement here
          rects
            .data(data)
            .transition()
            .delay((d, i) => i * 50)
            .duration(500)
            .attr("x", (_d, i) => i * (width / data.length));
        }
      }
    }
  });
};

export default drawVisualization;
</code>```

And  from this function this is the trouble maker:
Edit i changed the code from .data(data) to .data(data[j],data[j+1]
but still have performance issues

```<code> const startButton = document.querySelector(
    ".run-sorting-btn"
  ) as HTMLButtonElement;

  startButton.addEventListener("click", () => {
    for (let i = 0; i < data.length - 1; i++) {
      for (let j = 0; j < data.length - i - 1; j++) {
        if (data[j] > data[j + 1]) {
          const temp = data[j];
          data[j] = data[j + 1];
          data[j + 1] = temp;

          // Animate the movement here
          rects
            .data([data[j], data[j + 1]])
            .transition()
            .delay((d, i) => i * 50)
            .duration(500)
            .attr("x", (_d, i) => i * (width / data.length));
        }
      }
    }
  });
</code>```

Body:
Welcome , I tring to animate diffrent kinds of sorting alogrithms for now i want to setup animation with first that is bubble sort.My problem is when i click the start button to run the animation the whole browser crushes I am aware that this is triggered by the sorting function but I have no idea what to do so that there is no such problem.

this is my code for drawingVisualisation

import * as d3 from "d3";

const drawVisualization = (data: number[]) => {
  const margin = { top: 10, right: 30, bottom: 30, left: 40 };
  const width = 800 - margin.left - margin.right;
  const height = 400 - margin.top - margin.bottom;

  // If it is .visualization del it first
  d3.select(".visualization").selectAll("rect").remove();
  d3.select(".visualization").select("svg").remove();

  const svg = d3
    .select(".visualization")
    .append("svg")
    .attr("width", width)
    .attr("height", height)
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

  const rects = svg.selectAll("rect").data(data).enter().append("rect");

  rects
    .attr("x", (_d, i) => i * (width / data.length))
    .attr("y", (d) => height - d)
    .attr("width", () => width / data.length - 1)
    .attr("height", (d) => d)
    .on("mouseover", function (_d, i) {
      d3.select(this.parentElement)
        .append("text")
        .text(i)
        .attr(
          "x",
          () =>
            data.indexOf(i) * (width / data.length) + width / data.length / 2
        )
        .attr("y", height - i - 20)
        .attr("font-size", "14px")
        .attr("fill", "blue")
        .attr("text-anchor", "middle");

      d3.select(this).style("opacity", 0.85);
    })
    .on("mouseleave", function () {
      d3.select(this.parentElement).select("text").remove();

      d3.select(this).style("opacity", 1);
    });

  const startButton = document.querySelector(
    ".run-sorting-btn"
  ) as HTMLButtonElement;

  startButton.addEventListener("click", () => {
    for (let i = 0; i < data.length - 1; i++) {
      for (let j = 0; j < data.length - i - 1; j++) {
        if (data[j] > data[j + 1]) {
          const temp = data[j];
          data[j] = data[j + 1];
          data[j + 1] = temp;

          // Animate the movement here
          rects
            .data(data)
            .transition()
            .delay((d, i) => i * 50)
            .duration(500)
            .attr("x", (_d, i) => i * (width / data.length));
        }
      }
    }
  });
};

export default drawVisualization;

And  from this function this is the trouble maker:
Edit i changed the code from .data(data) to .data(data[j],data[j+1]
but still have performance issues

 const startButton = document.querySelector(
    ".run-sorting-btn"
  ) as HTMLButtonElement;

  startButton.addEventListener("click", () => {
    for (let i = 0; i < data.length - 1; i++) {
      for (let j = 0; j < data.length - i - 1; j++) {
        if (data[j] > data[j + 1]) {
          const temp = data[j];
          data[j] = data[j + 1];
          data[j + 1] = temp;

          // Animate the movement here
          rects
            .data([data[j], data[j + 1]])
            .transition()
            .delay((d, i) => i * 50)
            .duration(500)
            .attr("x", (_d, i) => i * (width / data.length));
        }
      }
    }
  });


问:
Discord Bot not detecting Automod
Im trying to make my bot to detect the discord Automod system, i've tried the same code in 2 different bots (one in a big server and the other in a smaller one) but it only works with the bot of the smaller one. I enabled all the intents in both bots. This is the code to detect the automod event:

@client.event
async def on_automod_action(execution):
    print("Working")
```

I also noticed that the bot in the big server takes more time to start up.

When an automod alert is sent, it should print a "working". The event works in another bot (both bots have exactly the same code). The main bot is not printing the "working"

Python version: 3.9
discord.py: 2.1.0

Title: Discord Bot not detecting Automod

Body:
Im trying to make my bot to detect the discord Automod system, i've tried the same code in 2 different bots (one in a big server and the other in a smaller one) but it only works with the bot of the smaller one. I enabled all the intents in both bots. This is the code to detect the automod event:

@client.event
async def on_automod_action(execution):
    print("Working")

I also noticed that the bot in the big server takes more time to start up.

When an automod alert is sent, it should print a "working". The event works in another bot (both bots have exactly the same code). The main bot is not printing the "working"

Python version: 3.9
discord.py: 2.1.0


问:
Using TypeScript aliases in monorepo
I am trying to configure monorepo for my Vue projects. Common practice in Vue is to have '@' alias which points to src folder in current project. I have this structure:

```<code>apps/
    vue-app
        src
            components
                Main.vue

libs/
    vue-lib
        src
            components
                ComponentA.vue
                ComponentB.vue
</code>```

ComponentA looks like this:

```<code>// some template
// some styles
<script>
import ComponentB from '@/components/ComponentB.vue'
// some logic
</script>
</code>```

And Main.vue like this:

```<code><script>
import ComponentA from 'libs/vue-lub/ComponentA.vue'
// some more logic
</script>

</code>```

Both projects has their own tsconfig.json:

```<code>"compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
},
</code>```

So, the problem here is quire tricky: ComponentA trying to resolve the import of the ComponentB using tsconfig from another project, so it obviously fails (there is no ComponentB in vue-app).

I already tried to create shared tsconfig at the root of the monorepo and use it via "extends", but no luck, even though it looked like it should've worked:

```<code>"baseUrl": ".",
"paths": {
  "@vue-lib/*": ["./libs/vue-lib/src/*"]
}
</code>```

ComponentA.vue:

```<code>import ComponentB from '@vue-lib/components/ComponentB.vue'
</code>```

VSCode + Volar extention can resolve this path, but Vite can't. I think I should configure it manually too, but maybe there is a better way to do this? Also, despite being used in template section, Volar doesn't highlight the ComponentB as used when I import it like this.

Title: Using TypeScript aliases in monorepo

Body:
I am trying to configure monorepo for my Vue projects. Common practice in Vue is to have '@' alias which points to src folder in current project. I have this structure:

apps/
    vue-app
        src
            components
                Main.vue

libs/
    vue-lib
        src
            components
                ComponentA.vue
                ComponentB.vue

ComponentA looks like this:

// some template
// some styles

And Main.vue like this:

Both projects has their own tsconfig.json:

"compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
},

So, the problem here is quire tricky: ComponentA trying to resolve the import of the ComponentB using tsconfig from another project, so it obviously fails (there is no ComponentB in vue-app).

I already tried to create shared tsconfig at the root of the monorepo and use it via "extends", but no luck, even though it looked like it should've worked:

"baseUrl": ".",
"paths": {
  "@vue-lib/*": ["./libs/vue-lib/src/*"]
}

ComponentA.vue:

import ComponentB from '@vue-lib/components/ComponentB.vue'

VSCode + Volar extention can resolve this path, but Vite can't. I think I should configure it manually too, but maybe there is a better way to do this? Also, despite being used in template section, Volar doesn't highlight the ComponentB as used when I import it like this.


问:
In Fast AI part 2 lecture 9A of course I get the Cuda Out of Memory Error in PyTorch
I was trying to follow along Jeremy Howard Fast Ai course.
I am on Part 2 of of the course Lecture 9A: https://www.youtube.com/watch?v=0_BBRNYInx8&t=0s

The code I am trying to run can be found below (its the code in the second cell):
https://github.com/fastai/diffusion-nbs/blob/master/Stable%20Diffusion%20Deep%20Dive.ipynb

The imports:

```<code>from base64 import b64encode

import numpy
import torch
from diffusers import AutoencoderKL, LMSDiscreteScheduler, UNet2DConditionModel
from huggingface_hub import notebook_login

# For video display:
from IPython.display import HTML
from matplotlib import pyplot as plt
from PIL import Image
from torch import autocast
from torchvision import transforms as tfms
from tqdm.auto import tqdm
from transformers import CLIPTextModel, CLIPTokenizer, logging

torch.manual_seed(1)
# if not (Path.home()/'.huggingface'/'token').exists(): notebook_login()

# Supress some unnecessary warnings when loading the CLIPTextModel
logging.set_verbosity_error()

# Set device
print(torch.cuda.is_available())
torch_device = "cuda" if torch.cuda.is_available() else "cpu"
</code>```

The actual code:

```<code># Load the autoencoder model which will be used to decode the latents into image space.
vae = AutoencoderKL.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="vae")

# Load the tokenizer and text encoder to tokenize and encode the text.
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
text_encoder = CLIPTextModel.from_pretrained("openai/clip-vit-large-patch14")

# The UNet model for generating the latents.
unet = UNet2DConditionModel.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="unet")

# The noise scheduler
scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)

# To the GPU we go!
vae = vae.to(torch_device)
text_encoder = text_encoder.to(torch_device)
unet = unet.to(torch_device);
</code>```

The Problem: Cuda out of memory error

in the last line I unet.to(torch_device)
I encounter the Cuda out of memory error

I have a 2 GB Nvidia Graphics card (I know this memory is too small, so I tried a few things to fix this)

The solution I tried but it did not work

In the below code

I used set_attention_slice

I set vae and text_encoder to "cpu"

```<code>## To Prevent CUDA out of memory. Change 1024 to any numbeer
slice_size = unet.config.attention_head_dim // 1024
unet.set_attention_slice(slice_size)
# To the GPU we go!
vae = vae.to("cpu") #vae.to(torch_device)
text_encoder = text_encoder.to("cpu")#text_encoder.to(torch_device)
unet = unet.to(torch_device).to_fp16 # to_fp16 is my code comment
</code>```

This did not work,

Is there anything else I can try?

Body:
I was trying to follow along Jeremy Howard Fast Ai course.
I am on Part 2 of of the course Lecture 9A: https://www.youtube.com/watch?v=0_BBRNYInx8&t=0s

The code I am trying to run can be found below (its the code in the second cell):
https://github.com/fastai/diffusion-nbs/blob/master/Stable%20Diffusion%20Deep%20Dive.ipynb

The imports:

from base64 import b64encode

import numpy
import torch
from diffusers import AutoencoderKL, LMSDiscreteScheduler, UNet2DConditionModel
from huggingface_hub import notebook_login

# For video display:
from IPython.display import HTML
from matplotlib import pyplot as plt
from PIL import Image
from torch import autocast
from torchvision import transforms as tfms
from tqdm.auto import tqdm
from transformers import CLIPTextModel, CLIPTokenizer, logging

torch.manual_seed(1)
# if not (Path.home()/'.huggingface'/'token').exists(): notebook_login()

# Supress some unnecessary warnings when loading the CLIPTextModel
logging.set_verbosity_error()

# Set device
print(torch.cuda.is_available())
torch_device = "cuda" if torch.cuda.is_available() else "cpu"

The actual code:

# Load the autoencoder model which will be used to decode the latents into image space.
vae = AutoencoderKL.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="vae")

# Load the tokenizer and text encoder to tokenize and encode the text.
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
text_encoder = CLIPTextModel.from_pretrained("openai/clip-vit-large-patch14")

# The UNet model for generating the latents.
unet = UNet2DConditionModel.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="unet")

# The noise scheduler
scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)

# To the GPU we go!
vae = vae.to(torch_device)
text_encoder = text_encoder.to(torch_device)
unet = unet.to(torch_device);

The Problem: Cuda out of memory error

in the last line I unet.to(torch_device)
I encounter the Cuda out of memory error

I have a 2 GB Nvidia Graphics card (I know this memory is too small, so I tried a few things to fix this)

The solution I tried but it did not work

In the below code

I used set_attention_slice

I set vae and text_encoder to "cpu"

## To Prevent CUDA out of memory. Change 1024 to any numbeer
slice_size = unet.config.attention_head_dim // 1024
unet.set_attention_slice(slice_size)
# To the GPU we go!
vae = vae.to("cpu") #vae.to(torch_device)
text_encoder = text_encoder.to("cpu")#text_encoder.to(torch_device)
unet = unet.to(torch_device).to_fp16 # to_fp16 is my code comment

This did not work,

Is there anything else I can try?


问:
Why does the docs example from the Symphonia Rust crate fail at creating the decoder
I was trying to follow along here and when I copy & paste that code (and replace the path variable with a raw string:)

let path: &str = r#"F:/testing.webm"#;
```

It gives me a Thread 'main' panicked at 'unsupported codec: Unsupported("core (codec):unsupported codec")'

on the let mut decoder line.

I tried multiple .webm videos did not work.

I tried using mp3's and enabling the mp3 feature on the crate, and no luck.

Body:
I was trying to follow along here and when I copy & paste that code (and replace the path variable with a raw string:)

let path: &str = r#"F:/testing.webm"#;

It gives me a Thread 'main' panicked at 'unsupported codec: Unsupported("core (codec):unsupported codec")'

on the let mut decoder line.

I tried multiple .webm videos did not work.

I tried using mp3's and enabling the mp3 feature on the crate, and no luck.


问:
React MUI Checkbox set checked on false value
I am having this problem with React MUI - Checkbox component. I have the site where I have the checkbox with handler targeting to the REST API endpoint that sets the boolean flag for the user in the database on POST request and returns the boolean value for the logged user.

Backend code:

# Models
class Client(models.Model):

    all_submitted = models.BooleanField(default=False, null=False)

```
<pre class="lang-py prettyprint-override"><code># Views
@api_view(["POST", "GET"])
@permission_classes([IsAuthenticated])
def all_submitted(request):
    current_client = request.user.client

    if request.method == "GET":
        return Response(status=status.HTTP_200_OK, data={
            "submitted": current_client.all_submitted
        })

    elif request.method == "POST":
        checked = request.data['checked']

        if type(checked) == bool:
            with transaction.atomic():
                current_client.all_submitted = checked
                current_client.save()

        return Response(status=status.HTTP_200_OK, data={
            "submitted": current_client.all_submitted
        })

</code>```

and the client code:

const [checked, setChecked] = useState(false);

const handleChange = (event) => {
        api.post("/client/files", {checked: event.target.checked}).then((response) => {
            if (response.status === 200) {
                setChecked(response.data.allEvidenceSubmitted);
            }
        })
    };

useEffect(() => {
     api.get("/client/files").then((response) => {
          if (response.status === 200) {
             setChecked(response.data.allEvidenceSubmitted);
            }
        });
    }, ["checked"])

<FormGroup>
  <FormControlLabel labelPlacement="bottom"
                    control={<Checkbox
                    checked={checked}
                    onChange={handleChange}
                    inputProps={{'aria-label': 'controlled'}}
                    />}
    label={t("checkbox", "I confirm that the documents have been completely uploaded.", {ns: "evidence"})}/>
</FormGroup>
```

Now the problem is that when the value is supposed to be false, then on page refresh, even if the false value is returned, the checkbox gets checked.

Does anyone have some clue about this?

Thank you for any hints.

Body:
I am having this problem with React MUI - Checkbox component. I have the site where I have the checkbox with handler targeting to the REST API endpoint that sets the boolean flag for the user in the database on POST request and returns the boolean value for the logged user.

Backend code:

# Models
class Client(models.Model):

    all_submitted = models.BooleanField(default=False, null=False)

# Views
@api_view(["POST", "GET"])
@permission_classes([IsAuthenticated])
def all_submitted(request):
    current_client = request.user.client

    if request.method == "GET":
        return Response(status=status.HTTP_200_OK, data={
            "submitted": current_client.all_submitted
        })

    elif request.method == "POST":
        checked = request.data['checked']

        if type(checked) == bool:
            with transaction.atomic():
                current_client.all_submitted = checked
                current_client.save()

        return Response(status=status.HTTP_200_OK, data={
            "submitted": current_client.all_submitted
        })

and the client code:

const [checked, setChecked] = useState(false);

const handleChange = (event) => {
        api.post("/client/files", {checked: event.target.checked}).then((response) => {
            if (response.status === 200) {
                setChecked(response.data.allEvidenceSubmitted);
            }
        })
    };

useEffect(() => {
     api.get("/client/files").then((response) => {
          if (response.status === 200) {
             setChecked(response.data.allEvidenceSubmitted);
            }
        });
    }, ["checked"])

<FormGroup>
  <FormControlLabel labelPlacement="bottom"
                    control={<Checkbox
                    checked={checked}
                    onChange={handleChange}
                    inputProps={{'aria-label': 'controlled'}}
                    />}
    label={t("checkbox", "I confirm that the documents have been completely uploaded.", {ns: "evidence"})}/>
</FormGroup>

Now the problem is that when the value is supposed to be false, then on page refresh, even if the false value is returned, the checkbox gets checked.

Does anyone have some clue about this?

Thank you for any hints.


问:
Capture audio coming from iframe element
I am using the Spotify Web playback SDK to play and control spotify in the browser. Then, my plan at least, is to feed the audio through a websocket connection to a python program where I plan to experiment with open AI whisper and attempt to transcribe podcasts.

I've gotten as far as being able control spotify in the browser (mostly copying the code from their docs here). It looks like the spotify SDK creates an iframe element in my html page, it looks like this:

```<code><iframe src="https://sdk.scdn.co/embedded/index.html" alt="Audio Playback Container" tabindex="-1" allow="encrypted-media; autoplay" style="position: absolute !important; left: -1px !important; width: 0px !important; height: 0px !important; border: none !important; outline: none !important;"></iframe>
</code>```

My guess is that the audio is coming from this iframe. I need to somehow capture the audio coming from the iframe and feed into the web audio api of my html page. is that possible at all? My feeling is thats not possible for security reasons.
in the iframe's index.js file, I searched for "AudioContext" and it finds lots of them, so theres some audio context happening in the iframe handling the audio I think. the javascript in this file is all minified so its really hard to read.

my main question is whether its possible to extract the audio coming from an iframe element and manipulate it in the main html file.

Thanks!

Body:
I am using the Spotify Web playback SDK to play and control spotify in the browser. Then, my plan at least, is to feed the audio through a websocket connection to a python program where I plan to experiment with open AI whisper and attempt to transcribe podcasts.

I've gotten as far as being able control spotify in the browser (mostly copying the code from their docs here). It looks like the spotify SDK creates an iframe element in my html page, it looks like this:

My guess is that the audio is coming from this iframe. I need to somehow capture the audio coming from the iframe and feed into the web audio api of my html page. is that possible at all? My feeling is thats not possible for security reasons.
in the iframe's index.js file, I searched for "AudioContext" and it finds lots of them, so theres some audio context happening in the iframe handling the audio I think. the javascript in this file is all minified so its really hard to read.

my main question is whether its possible to extract the audio coming from an iframe element and manipulate it in the main html file.

Thanks!


问:
How to restart a loop in Javascript whilst decrementing a global variable
I want the if statement (line 10) to detect when the next string in the array (line 1) is not matching the string in index0 (outputString0). And then to decrement the variable testLength (line 11) to slice the last character off the strings to allow them to be compared again in the next loop iteration to determine whether they are still matching. Then I want the loop to restart by setting i back to 0, which will increment to 1 once the loop is re-started (line 12).

But it seems to create an infinite loop. Is it because I am trying to modify the global variable testLength (line 11) from within the if statement?

```<code>const wordInput = ['fasts', 'fasta', 'fasts', 'fasts', 'fasts'];
let testLength = 5;

let outputString0 = wordInput[0].toString();
outputString0 = outputString0.slice(0, testLength);

for (let i = 1; i < 5; i++) {
  output = wordInput[i].toString();
  output = output.slice(0, testLength);

if ((this['outputString' + i] = output) !== outputString0) {
  testLength = testLength - 1;
  i = 0; continue;
}

  else {
    this['testString' + i] = output;
    continue;
  }
};
</code>```

I attempted to move the global variable testLength to inside the for loop, but the console also returns an error. Not sure what to do next.

Body:
I want the if statement (line 10) to detect when the next string in the array (line 1) is not matching the string in index0 (outputString0). And then to decrement the variable testLength (line 11) to slice the last character off the strings to allow them to be compared again in the next loop iteration to determine whether they are still matching. Then I want the loop to restart by setting i back to 0, which will increment to 1 once the loop is re-started (line 12).

But it seems to create an infinite loop. Is it because I am trying to modify the global variable testLength (line 11) from within the if statement?

const wordInput = ['fasts', 'fasta', 'fasts', 'fasts', 'fasts'];
let testLength = 5;

let outputString0 = wordInput[0].toString();
outputString0 = outputString0.slice(0, testLength);

for (let i = 1; i < 5; i++) {
  output = wordInput[i].toString();
  output = output.slice(0, testLength);

if ((this['outputString' + i] = output) !== outputString0) {
  testLength = testLength - 1;
  i = 0; continue;
}

  else {
    this['testString' + i] = output;
    continue;
  }
};

I attempted to move the global variable testLength to inside the for loop, but the console also returns an error. Not sure what to do next.


问:
How can I make Angular model work in html page?
I connect with my service without any problem, then I import it into a model, but when I try to print the data with a for loop in the html page, it comes up blank. Where do you think I am doing wrong?

this is component file

```<code>
import { Component, OnInit, ViewChild } from '@angular/core';
import { ResultsModel } from 'src/app/core/models/results.model';

@Component({
  selector: 'app-results',
  templateUrl: './results.component.html',
  styleUrls: ['./results.component.scss']
})

export class ResultsComponent implements OnInit {

    clientResults : ResultsModel[] = [];

    constructor(private httpRequestService : HttpRequestService) {}

    ngOnInit(): void {

        this.getAllResults();

    }

    getAllResults(){
        let apiEndpoint = "results"
        this.httpRequestService.getApi(apiEndpoint, false).subscribe(resultRequest => {
          this.clientResults = resultRequest
          return this.clientResults

    })
}
</code>```

this is model file

```<code>export interface ResultsModel {
    "result": string,
    "createddate": string,
    "clientid": string,
    "id": number,
    "clientusername": string,

}
</code>```

this is html file

```<code>
<table class="table align-middle table-nowrap" id="invoiceTable">
    <thead class="text-muted">
        <tr>

            <th class="sort text-uppercase" data-sort="invoice_id">User Id</th>
            <th class="sort text-uppercase" data-sort="customer_name">Username</th>
            <th class="sort text-uppercase" data-sort="email">Type</th>

            <th class="sort text-uppercase" data-sort="date">Type</th>
            <th class="sort text-uppercase" data-sort="invoice_amount">Type</th>
        </tr>
    </thead>

    <tbody>
      <tr *ngFor="let results in clientResults">

        <td>{{results.id}}</td>
        <td class="customer_name">{{results.username}}</td>
        <td>{{results.clientid}}</td>
        <td>{{results.result}}</td>
        <td>{{results.createddate}}</td>
      </tr>
    </tbody>
</table>
</code>```

Where do you think I went wrong? Where could I be doing wrong?

Body:
I connect with my service without any problem, then I import it into a model, but when I try to print the data with a for loop in the html page, it comes up blank. Where do you think I am doing wrong?

this is component file

import { Component, OnInit, ViewChild } from '@angular/core';
import { ResultsModel } from 'src/app/core/models/results.model';

@Component({
  selector: 'app-results',
  templateUrl: './results.component.html',
  styleUrls: ['./results.component.scss']
})

export class ResultsComponent implements OnInit {

    clientResults : ResultsModel[] = [];

    constructor(private httpRequestService : HttpRequestService) {}

    ngOnInit(): void {

        this.getAllResults();

    }

    getAllResults(){
        let apiEndpoint = "results"
        this.httpRequestService.getApi(apiEndpoint, false).subscribe(resultRequest => {
          this.clientResults = resultRequest
          return this.clientResults

    })
}

this is model file

export interface ResultsModel {
    "result": string,
    "createddate": string,
    "clientid": string,
    "id": number,
    "clientusername": string,

}

this is html file

            User Id
            Username
            Type

            Type
            Type

        {{results.id}}
        {{results.username}}
        {{results.clientid}}
        {{results.result}}
        {{results.createddate}}

Where do you think I went wrong? Where could I be doing wrong?


问:
How to Ad Parameters to XML URL?
URL is https://xmlfeed.game.eu/xmloddsfeed/v2/xml/feed.ashx?apikey=8712-d4953-ed11-9f37-003042d5&includeFraction=true&includeCent=true

I want to add a parameter delta="60"

Thanks

I tried

https://xmlfeed.game.eu/xmloddsfeed/v2/xml/feed.ashx?apikey=875e92-d453-ed11-9f37-003048dd5&Delta=60

Title: How to Ad Parameters to XML URL?


问:
Quick Links Only Reporting Click Data?
It's been a while since I have used branch. Can you still create quick links and pass revenue data with them using quick links using key value pairs?

I used this link (https://funnynotfunny.app.link/e/WLFHDadHat) to see if key value pairs can pass just add to cart and revenue. I use to do this all the time but it's been a few years. Thank you.

Title: Quick Links Only Reporting Click Data?


问:
Error in R Quarto document to MS Word with gtsummary
I am trying to produce some output using the gtsummary package in R with the tbl_cross function in a R Quarto document that renders to Microsoft Word.  However, when I run the following code for example, I get the following error in the console:

```<code>label: unnamed-chunk-1
Quitting from lines 17-40 (QuartoDoc.qmd)
Error in max(nrows) : invalid 'type' (list) of argument
Calls: .main ... <Anonymous> -> %>% -> <Anonymous> -> eval_tidy -> <Anonymous>"
</code>```

This is the code I'm trying to run and is the only chunk in my document:

```<code>library(tidyverse)
library(gtsummary)
  dat <- read_table('Q17_1   Q17_2   Q17_3   Q17_4   survey
No  Yes No  Yes m1
No  Yes No  No  m2
Yes Yes Yes Yes m1
No  No  Yes No  m2
No  No  Yes Yes m1
Yes No  Yes No  m2
No  No  Yes Yes m1
No  No  Yes No  m2
Yes No  Yes Yes m1
')

mytable<- dat %>%
  tbl_cross(
    row = Q17_1,
    col = Q17_2,
    percent = "column"
 )

mytable
</code>```

I've tried searching for this error online and have waded through lots of documentation but I don't see what might be going wrong?  Can anyone advise me on how I might be able to avoid generating this error?  That being said, if I run this code in just an R terminal session, the table is generated and output to by the default browser in HTML.  Is there any way to get this to render in my document as an MS Word file?

Thank you!

Body:
I am trying to produce some output using the gtsummary package in R with the tbl_cross function in a R Quarto document that renders to Microsoft Word.  However, when I run the following code for example, I get the following error in the console:

label: unnamed-chunk-1
Quitting from lines 17-40 (QuartoDoc.qmd)
Error in max(nrows) : invalid 'type' (list) of argument
Calls: .main ... <Anonymous> -> %>% -> <Anonymous> -> eval_tidy -> <Anonymous>"

This is the code I'm trying to run and is the only chunk in my document:

library(tidyverse)
library(gtsummary)
  dat <- read_table('Q17_1   Q17_2   Q17_3   Q17_4   survey
No  Yes No  Yes m1
No  Yes No  No  m2
Yes Yes Yes Yes m1
No  No  Yes No  m2
No  No  Yes Yes m1
Yes No  Yes No  m2
No  No  Yes Yes m1
No  No  Yes No  m2
Yes No  Yes Yes m1
')

mytable<- dat %>%
  tbl_cross(
    row = Q17_1,
    col = Q17_2,
    percent = "column"
 )

mytable

I've tried searching for this error online and have waded through lots of documentation but I don't see what might be going wrong?  Can anyone advise me on how I might be able to avoid generating this error?  That being said, if I run this code in just an R terminal session, the table is generated and output to by the default browser in HTML.  Is there any way to get this to render in my document as an MS Word file?

Thank you!


问:
How do I detect collisions between individual particles in LiquidFunProcessing?
I'm using processing's liquidfun library to simulate particle interactions, such as changing color on collision, but I can't find a contactlistener for individual liquid particles. There's a built in contactlistener for JBox2D objects, but it doesn't apply to the particles themselves.

```<code>public void initscene() {

    ...

    world.setContactListener(new MyContactListener());

}

class MyContactListener implements ContactListener {

    @Override
    public void beginContact(Contact contact) {
        println(contact.getFixtureA());
        println(contact.getFixtureB());
    }

    @Override
    public void endContact(Contact contact) {
    }

    @Override
    public void preSolve(Contact contact, Manifold oldManifold) {
    }

    @Override
    public void postSolve(Contact contact, ContactImpulse impulse) {

    }

}
</code>```

This only outputs anything when JBox2D objects come in contact, rather than all interactions, including between LiquidFun particles.

Body:
I'm using processing's liquidfun library to simulate particle interactions, such as changing color on collision, but I can't find a contactlistener for individual liquid particles. There's a built in contactlistener for JBox2D objects, but it doesn't apply to the particles themselves.

public void initscene() {

    ...

    world.setContactListener(new MyContactListener());

}

class MyContactListener implements ContactListener {

    @Override
    public void beginContact(Contact contact) {
        println(contact.getFixtureA());
        println(contact.getFixtureB());
    }

    @Override
    public void endContact(Contact contact) {
    }

    @Override
    public void preSolve(Contact contact, Manifold oldManifold) {
    }

    @Override
    public void postSolve(Contact contact, ContactImpulse impulse) {

    }

}

This only outputs anything when JBox2D objects come in contact, rather than all interactions, including between LiquidFun particles.


问:
Javafx, Itext7, maven dependencies and setting up the proper module-info.java file
Beginner here; I am creating a project with JavaFX and Itext7 and I don't understand how maven dependencies work. I am constructing this project on vsCode and this is how I have my dependencies set up in my pom.xml file.

```<code><dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>kernel</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>io</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>layout</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for forms -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>forms</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for PDF/A -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>pdfa</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for digital signatures -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>sign</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for barcodes -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>barcodes</artifactId>
        <version>${itext.version}</version>
    </dependency>
</code>```

Then in my module-info.java file, I was able to get the desired imports by using the following code,

```<code>requires transitive kernel;
requires transitive io;
requires transitive forms;
requires transitive layout;
requires transitive barcodes;
requires transitive pdfa;
requires transitive sign;
</code>```

For each one of these I am getting the same error -> Name of automatic module 'kernel' is unstable, it is derived from the module's file name.

This is happening for each of these lines - ie: Name of automatic module 'io'... etc.

Now I created a jar file of the project and it runs when I run it from terminal but it doesn't work when I click the jar icon from my desktop. After running from terminal I get the following message, WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @5a65309b'.

How can I resolve these issues and get the project to work when the jar file is clicked from desktop?

Body:
Beginner here; I am creating a project with JavaFX and Itext7 and I don't understand how maven dependencies work. I am constructing this project on vsCode and this is how I have my dependencies set up in my pom.xml file.

<dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>kernel</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>io</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>layout</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>forms</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>pdfa</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>sign</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>barcodes</artifactId>
        <version>${itext.version}</version>
    </dependency>

Then in my module-info.java file, I was able to get the desired imports by using the following code,

requires transitive kernel;
requires transitive io;
requires transitive forms;
requires transitive layout;
requires transitive barcodes;
requires transitive pdfa;
requires transitive sign;

For each one of these I am getting the same error -> Name of automatic module 'kernel' is unstable, it is derived from the module's file name.

This is happening for each of these lines - ie: Name of automatic module 'io'... etc.

Now I created a jar file of the project and it runs when I run it from terminal but it doesn't work when I click the jar icon from my desktop. After running from terminal I get the following message, WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @5a65309b'.

How can I resolve these issues and get the project to work when the jar file is clicked from desktop?


问:
How to read/write to a text file to store an API response with SvelteKit?
Basically, I am going to have a server POSTing a JSON message to a SvelteKit route, every now and again. I want my SvelteKit route to save that response until it gets a new one, and if there is a GET request to it, to reply with the JSON message it saved.

Before switching to SvelteKit, I achieved this using some simple PHP, which would read and write to a .json file. I really don't want to have to bring a database into this, and I couldn't find a way to write/read to a text file in SvelteKit.

Eventually, my app will run on a Node.js server, but I'd like to not have to make further customisations after the build process is complete.

I am aware I may be going about this the wrong way, and I'm new to server-side Javascript, so thank you for reading thus far.


问:
BigDecimal rounding when not knowing desired scale
i know how rounding BigDecimal with the API,
but i actually work witjh a remote API which
sends to me unformated and not rounded BigDecimals.

As examples, the API back-end returns to me

```<code>3.70000000000000017763568394002504646778106689453125
</code>```

which invites me to do something like

```<code>myBg.setScale(1,RoudingMode.HALF_EVEN);
</code>```

when API back-end returns to me

```<code>3.74000000000000017763568394002504646778106689453125
</code>```

it invited me to do something like

```<code>myBg.setScale(2,RoudingMode.HALF_EVEN);
</code>```

So my question is :
is there a way to guess the adhoc scale/rounding to apply to the BigDecimal
without parse the BigDecimal and counting the numbers of 0 inside the number

```<code>3.74 --> 0000000000000 <-- 17763568394002504646778106689453125
</code>```

Thanks by advance.

Body:
i know how rounding BigDecimal with the API,
but i actually work witjh a remote API which
sends to me unformated and not rounded BigDecimals.

As examples, the API back-end returns to me

3.70000000000000017763568394002504646778106689453125

which invites me to do something like

myBg.setScale(1,RoudingMode.HALF_EVEN);

when API back-end returns to me

3.74000000000000017763568394002504646778106689453125

it invited me to do something like

myBg.setScale(2,RoudingMode.HALF_EVEN);

So my question is :
is there a way to guess the adhoc scale/rounding to apply to the BigDecimal
without parse the BigDecimal and counting the numbers of 0 inside the number

3.74 --> 0000000000000 <-- 17763568394002504646778106689453125

Thanks by advance.


问:
Using AWS/S3 SDK v2 with client-side encryption in Java
We are attempting to migrate our application to use AWS/S3 SDK v2.  To that end I've updated our maven dependencies:

```<code><dependency>
  <groupId>software.amazon.awssdk</groupId>
  <artifactId>bom</artifactId>
  <version>2.19.12</version>
  <type>pom</type>
  <scope>import</scope>
</dependency>
</code>```

The changes are mostly obvious, but when we get to using client-side encryption, things are confusing.  I've found pages that talk about migrating the encryption client to V2:

https://aws.amazon.com/blogs/developer/updates-to-the-amazon-s3-encryption-client/

https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/s3-encryption-migration.html

But the required classes like AmazonS3EncryptionClientV2 do not exist in the SDK BOM.  Searching for the maven dependency, I can find https://mvnrepository.com/artifact/com.amazonaws/aws-encryption-sdk-java/2.4.0, but that shows it is dependent on the v1 com.amazonaws:aws-java-sdk version 1.12.162.  Oddly, it also depends on the v2 software.amazon.awssdk:kms.

Now I am confused.  I feel like "SDK V2" and "encryption client V2" refer to a different "V2".  Did I find the right encryption artifact?  Can the v2 SDK be used with client-side encryption?  Do I just plow ahead and try it?

Body:
We are attempting to migrate our application to use AWS/S3 SDK v2.  To that end I've updated our maven dependencies:

<dependency>
  <groupId>software.amazon.awssdk</groupId>
  <artifactId>bom</artifactId>
  <version>2.19.12</version>
  <type>pom</type>
  <scope>import</scope>
</dependency>

The changes are mostly obvious, but when we get to using client-side encryption, things are confusing.  I've found pages that talk about migrating the encryption client to V2:

https://aws.amazon.com/blogs/developer/updates-to-the-amazon-s3-encryption-client/

https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/s3-encryption-migration.html

But the required classes like AmazonS3EncryptionClientV2 do not exist in the SDK BOM.  Searching for the maven dependency, I can find https://mvnrepository.com/artifact/com.amazonaws/aws-encryption-sdk-java/2.4.0, but that shows it is dependent on the v1 com.amazonaws:aws-java-sdk version 1.12.162.  Oddly, it also depends on the v2 software.amazon.awssdk:kms.

Now I am confused.  I feel like "SDK V2" and "encryption client V2" refer to a different "V2".  Did I find the right encryption artifact?  Can the v2 SDK be used with client-side encryption?  Do I just plow ahead and try it?


问:
How to get filenames as array in string using PHP?
In database, the html contents are stored as string.
In there, I want to get the file names as array.

For example, the string is:

```<code>"info": [], "title": "Neues Kapitel", "videos": [], "children": [], "html1": "<p><img class=\"fr-dib fr-fil\" src=\"files\/1\/first.jpg" style=\"width: 300px;\"></p>","info": [], "title": "Neues Kapitel", "videos": [], "children": [], "html2": "<p><img class=\"fr-dib fr-fil\" src=\"files\/1\/second.jpg" style=\"width: 300px;\"></p>"
</code>```

So the result file names will be: ['first', 'second']

Anyone who knows, please let me know.
Thanks.

Body:
In database, the html contents are stored as string.
In there, I want to get the file names as array.

For example, the string is:

"info": [], "title": "Neues Kapitel", "videos": [], "children": [], "html1": "

","info": [], "title": "Neues Kapitel", "videos": [], "children": [], "html2": "

"

So the result file names will be: ['first', 'second']

Anyone who knows, please let me know.
Thanks.


问:
Upload file to Contabo Object Storage (S3 compatible)
I'm trying to upload a file to the contabo object storage from memory stream using AWSSDK.S3

This is my client configuration.

```<code>    string accessKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
    string secretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";

    Amazon.S3.AmazonS3Config config = new Amazon.S3.AmazonS3Config();
    Amazon.S3.AmazonS3Client s3Client;

    public BookingsController()
    {
        config.ServiceURL = "https://eu2.contabostorage.com";
        config.DisableHostPrefixInjection = true;

        s3Client = new Amazon.S3.AmazonS3Client(
                accessKey,
                secretKey,
                config
                );

    }
</code>```

This is the method I'm using:

```<code>    [HttpPost("/api/Bookings/AddFile")]
    public async Task<ActionResult> AddBookingFile([FromForm] IFormFile file)
    {
        using (var newMemoryStream = new MemoryStream())
        {
            ListBucketsResponse response = await s3Client.ListBucketsAsync();

            file.CopyTo(newMemoryStream);

            Amazon.S3.Model.PutObjectRequest request = new Amazon.S3.Model.PutObjectRequest();
            request.BucketName = "test-bucket";
            request.Key = "recording.wav";
            request.ContentType = "audio/wav";
            request.InputStream = newMemoryStream;
            await s3Client.PutObjectAsync(request);

        }

        return Ok();
    }
</code>```

The ListBucket-Method works properly. The PutObject Method throws the exception that the Host "Der angegebene Host ist unbekannt. (test-bucket.eu2.contabostorage.com:443)" cannot be found.

Referenced to the Contabo-docs is that correct, because Contabo doesn't support virtual hosted buckets (dns prefix). Reference to contabo docs

I thought, that the following configuration fix this, but that wasn't the solution.

```<code>config.DisableHostPrefixInjection = true;
</code>```

Does anyone has any advise hot to prevent the prefixing of the url?

Body:
I'm trying to upload a file to the contabo object storage from memory stream using AWSSDK.S3

This is my client configuration.

    string accessKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
    string secretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";

    Amazon.S3.AmazonS3Config config = new Amazon.S3.AmazonS3Config();
    Amazon.S3.AmazonS3Client s3Client;

    public BookingsController()
    {
        config.ServiceURL = "https://eu2.contabostorage.com";
        config.DisableHostPrefixInjection = true;

        s3Client = new Amazon.S3.AmazonS3Client(
                accessKey,
                secretKey,
                config
                );

    }

This is the method I'm using:

    [HttpPost("/api/Bookings/AddFile")]
    public async Task<ActionResult> AddBookingFile([FromForm] IFormFile file)
    {
        using (var newMemoryStream = new MemoryStream())
        {
            ListBucketsResponse response = await s3Client.ListBucketsAsync();

            file.CopyTo(newMemoryStream);

            Amazon.S3.Model.PutObjectRequest request = new Amazon.S3.Model.PutObjectRequest();
            request.BucketName = "test-bucket";
            request.Key = "recording.wav";
            request.ContentType = "audio/wav";
            request.InputStream = newMemoryStream;
            await s3Client.PutObjectAsync(request);

        }

        return Ok();
    }

The ListBucket-Method works properly. The PutObject Method throws the exception that the Host "Der angegebene Host ist unbekannt. (test-bucket.eu2.contabostorage.com:443)" cannot be found.

Referenced to the Contabo-docs is that correct, because Contabo doesn't support virtual hosted buckets (dns prefix). Reference to contabo docs

I thought, that the following configuration fix this, but that wasn't the solution.

config.DisableHostPrefixInjection = true;

Does anyone has any advise hot to prevent the prefixing of the url?


问:
Streamlit - address always online
Goodnight.
I'm starting to use the streamlit package on a linux server and I would like to ask for your support for a question:
When using the command 'streamlit run appname.py' (via ssh putty) it shows the status 'running' and displays a web address to access.
Does anyone know how to leave the web address running even after I close the ssh session?

Would I have to use an apache server?

Thanks.

Title: Streamlit - address always online


问:
Sending polars Dataframe via juniper GraphQL
I am trying to send the Polars dataframe over juniper GraphQL, but #[juniper::graphql_object] is complaining about trail bound

```<code>the trait bound `Result<HashMap<std::string::String, polars::prelude::DataFrame>, FieldError>: IntoResolvable<'_, __S, _, ()>` is not satisfied
the following other types implement trait `IntoResolvable<'a, S, T, C>`:
  <Result<(&'a <T as GraphQLValue<S2>>::Context, T), FieldError<S1>> as IntoResolvable<'a, S2, T, C>>
  <Result<T, E> as IntoResolvable<'a, S, T, C>>
  <Result<std::option::Option<(&'a <T as GraphQLValue<S2>>::Context, T)>, FieldError<S1>> as IntoResolvable<'a, S2, std::option::Option<T>, C>>
</code>```

Here is my Rust code.

use juniper::{EmptySubscription,
            FieldResult,
            RootNode,
            EmptyMutation};
use polars::prelude::DataFrame;
use std::collections::HashMap;

pub struct QueryRoot;

#[juniper::graphql_object]
impl QueryRoot {
    fn fetch_data() -> FieldResult<HashMap<String, DataFrame>> {
        // ...
        let data: HashMap<String, DataFrame> = fetch_my_data();
        Ok(data)
    }
}

pub type Schema = RootNode<'static, QueryRoot, EmptyMutation, EmptySubscription>;

pub fn create_schema() -> Schema {
    Schema::new(QueryRoot {}, EmptyMutation::new(), EmptySubscription::new())
}

```

I am guessing that juniper cannot recognize polar's Dataframe struct as graphqlobject. I am wondering if anyone knows how to fix this compile error. I also tried with serde_json, but no luck so far.

Body:
I am trying to send the Polars dataframe over juniper GraphQL, but #[juniper::graphql_object] is complaining about trail bound

the trait bound `Result<HashMap<std::string::String, polars::prelude::DataFrame>, FieldError>: IntoResolvable<'_, __S, _, ()>` is not satisfied
the following other types implement trait `IntoResolvable<'a, S, T, C>`:
  <Result<(&'a <T as GraphQLValue<S2>>::Context, T), FieldError<S1>> as IntoResolvable<'a, S2, T, C>>
  <Result<T, E> as IntoResolvable<'a, S, T, C>>
  <Result<std::option::Option<(&'a <T as GraphQLValue<S2>>::Context, T)>, FieldError<S1>> as IntoResolvable<'a, S2, std::option::Option<T>, C>>

Here is my Rust code.

use juniper::{EmptySubscription,
            FieldResult,
            RootNode,
            EmptyMutation};
use polars::prelude::DataFrame;
use std::collections::HashMap;

pub struct QueryRoot;

#[juniper::graphql_object]
impl QueryRoot {
    fn fetch_data() -> FieldResult<HashMap<String, DataFrame>> {
        // ...
        let data: HashMap<String, DataFrame> = fetch_my_data();
        Ok(data)
    }
}

pub type Schema = RootNode<'static, QueryRoot, EmptyMutation, EmptySubscription>;

pub fn create_schema() -> Schema {
    Schema::new(QueryRoot {}, EmptyMutation::new(), EmptySubscription::new())
}

I am guessing that juniper cannot recognize polar's Dataframe struct as graphqlobject. I am wondering if anyone knows how to fix this compile error. I also tried with serde_json, but no luck so far.


问:
is it possible to extract "Description" of an ecoinvent activity?
I'm trying to automate the extraction of the "Description" of activities from ecoinvent database (e.g., "wood preservation facility construction, dipping/immersion tank | wood preservation facility, dipping/immersion tank"), using brightway2.

As there seems no such an attribute called "description" in the activity object, I tried "comment" instead. I was expecting the following content from the activity named "wood preservation facility construction, dipping/immersion tank | wood preservation facility, dipping/immersion tank":
"The dipping or immersion tank consists of the main steel tank containing the preservative and an second, larger steel tank as the retention tank, within which the first tank is located. As an alternative design the main tank can be placed in a sealed concrete construction, serving as the retention tank. Appart from the tanks, a lifting device (for lifting the wood into and out of the tank) as well as a hold-down device (to ensure complete immersion) are inventoried.;The length of the inventoried tank is 12 m, corresponding to a medium sized tank, The batch size is between 12 - 16 m3 of wood. Assuming an average input of 9 l of preservative/m3 , a yearly throughput of 6000 m3 of wood and a service life of 75 years, about 4.05E06 kg of wood preservative are applied over the service life of the tank.;;Data on land use and on the building hall are taken from pressure vessel processes as no specific data on these infrastructure inputs could be gathered. These values refer to a yearly throughput of 6000 m3 of wood.; Infrastructure dataset containing the main elements of the facility. The land area and the material (production and disposal) needed for a preservative treatment plant for dipping or immersion treatment including strorage area is included. 60 - 90 kg of 2-component laquers are not inventoried." The content is presented in the "Description" field under "General Information" section, if you open the activity in OpenLCA software.

But what was returned was the following:
"Data from Germany and Switzerland. Location of plant within Europe of minor importance" (which is the content of another "Description" field under "Geography" section, if you open the activity in OpenLCA software).

Is there any way I can retrive the correct Description content of an activity using bw2? Thanks


问:
ARfoundation- extreme overheating
My phone gets extra hot when simply testing Unity's sample AR scene, which is an empty scene.
It happens when the ar camera is on. (I even limited the frame rate)
Is there anything to do about that? How do other AR apps don't get so hot? Is it only because of Unity? AR foundation?</p>

Title: ARfoundation- extreme overheating


问:
C# Entity Framework - Entity only relating to one entry at a time
So I am have difficulty understanding why CompaniesAccepted is only allowing one Company to be related at a time.

So for example if I have 2 entries of File in my Database. The company then accepts one of these files and gets added to CompaniesAccepted list. If I try to add this same company to the other File entry, the Company will be removed from the CompaniesAccepted list from the first file and added to the list of the new one which doesn't make sense to me as I wish to have the Company in both of those lists.

```<code>public class File
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }

    public virtual Company Company { get; set; }

    public string DisplayName { get; set; }

    public virtual List<Company> CompaniesAccepted { get; set; }

    public bool isDeleted { get; set; }
}
</code>```

Company Entity

```<code>
public class Company
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [Key]
    public int Id { get; set; }

    public string ParentCompany { get; set; }

    public string CompanyName { get; set; }

    public string LegalName { get; set; }

    public string DUNS { get; set; }

    [JsonIgnore]
    public virtual Company CustomerCompany { get; set; }

    public bool isActivated { get; set; }

    public bool isDeleted { get; set; }

}
</code>```

Code used to add the relationship.

```<code>        if(accepted)
        {
            var company = file.CompaniesAccepted.FirstOrDefault(x => x.Id == account.Company.Id);
            if(company == null)
            {
                file.CompaniesAccepted.Add(account.Company);
            }
        } else
        {
            file.CompaniesAccepted.Remove(account.Company);
        }
        Db.SaveChanges();
</code>```

Any suggestions? If I haven't provided enough code, please do ask.

Body:
So I am have difficulty understanding why CompaniesAccepted is only allowing one Company to be related at a time.

So for example if I have 2 entries of File in my Database. The company then accepts one of these files and gets added to CompaniesAccepted list. If I try to add this same company to the other File entry, the Company will be removed from the CompaniesAccepted list from the first file and added to the list of the new one which doesn't make sense to me as I wish to have the Company in both of those lists.

public class File
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }

    public virtual Company Company { get; set; }

    public string DisplayName { get; set; }

    public virtual List<Company> CompaniesAccepted { get; set; }

    public bool isDeleted { get; set; }
}

Company Entity

public class Company
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    [Key]
    public int Id { get; set; }

    public string ParentCompany { get; set; }

    public string CompanyName { get; set; }

    public string LegalName { get; set; }

    public string DUNS { get; set; }

    [JsonIgnore]
    public virtual Company CustomerCompany { get; set; }

    public bool isActivated { get; set; }

    public bool isDeleted { get; set; }

}

Code used to add the relationship.

        if(accepted)
        {
            var company = file.CompaniesAccepted.FirstOrDefault(x => x.Id == account.Company.Id);
            if(company == null)
            {
                file.CompaniesAccepted.Add(account.Company);
            }
        } else
        {
            file.CompaniesAccepted.Remove(account.Company);
        }
        Db.SaveChanges();

Any suggestions? If I haven't provided enough code, please do ask.


问:
How to create a GitHub issue using the APIs in a private repo
My goal is to be able to create issues from a Node.js backend application. Everything worked fine when I used a "Fine-grained personal access token" linked to the owner account of the repo. However, I would like to have another account that through the API can create an issue.

If I use the personal access token linked to the non-owner account, I get a 404 HTTP error code.

I also tried creating an organization and setting both accounts as owners of the organization, but I still get a 404. I am probably missing out something.

I set up the API request following the official documentation.

My backend code is:

await octokit.request(`POST /repos/${repoUser}/${repo}/issues`, {
  owner: repoUser,
  repo: repo,
  title: title,
  body: issueBody,
});
```


问:
VLC-python don't read my mp4 video online
I'm just looking for a way to read video from internet with Vlc-python.
i have just a very simple script but it does not work with my video and i don't understand why it's working for some link and why not others...

```<code># importing vlc module
import vlc

# creating vlc media player object
media_player = vlc.MediaPlayer()

# media resource locator
#First link it's woring
#mrl = "https://www.w3schools.com/html/mov_bbb.mp4"
#Second link it does not work
mrl = "https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4"

# setting mrl to the media player
media_player.set_mrl(mrl)

# start playing video
media_player.play()
</code>```

I'm look all the day for a solution but i don't find it...
So i hope that someone can help me
As always i would like to thanks all the people who works and help the others here !
Sorry for my bad english, i'm french X)

Body:
I'm just looking for a way to read video from internet with Vlc-python.
i have just a very simple script but it does not work with my video and i don't understand why it's working for some link and why not others...

# importing vlc module
import vlc

# creating vlc media player object
media_player = vlc.MediaPlayer()

# media resource locator
#First link it's woring
#mrl = "https://www.w3schools.com/html/mov_bbb.mp4"
#Second link it does not work
mrl = "https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4"

# setting mrl to the media player
media_player.set_mrl(mrl)

# start playing video
media_player.play()

I'm look all the day for a solution but i don't find it...
So i hope that someone can help me
As always i would like to thanks all the people who works and help the others here !
Sorry for my bad english, i'm french X)


问:
TextVectorization layer in a deep neaural network
I'm training a neural network with Tensorflow for a NLP problem and I'm using the TextVectorization layer as fisrt layer. This layer has one parameter that give me problems : standardize. For this there are some default options but there is also the possibility to create a custum callable. I've got a functions written by me that I want to use in this layer. My functions receive a string in input and give a string in output. This is not compatible with the input and the output for the callable in this layer.
What is the right output and input that this callable has to have?

If there is a way, how can convert my function?

This is my function:

```<code>import nltk
from nltk.sentiment.util import *
from nltk.stem.wordnet import WordNetLemmatizer
import re
nltk.download('wordnet')

def my_preprocessing(text)
 text=re.split("\\s+",text)
 wnl = WordNetLemmatizer()
 stemmed_words = [wnl.lemmatize(word) for word in text]
 testo = [w for w in stemmed_words if not w.isnumeric()]
 return ' '.join(testo)
</code>```

Body:
I'm training a neural network with Tensorflow for a NLP problem and I'm using the TextVectorization layer as fisrt layer. This layer has one parameter that give me problems : standardize. For this there are some default options but there is also the possibility to create a custum callable. I've got a functions written by me that I want to use in this layer. My functions receive a string in input and give a string in output. This is not compatible with the input and the output for the callable in this layer.
What is the right output and input that this callable has to have?

If there is a way, how can convert my function?

This is my function:

import nltk
from nltk.sentiment.util import *
from nltk.stem.wordnet import WordNetLemmatizer
import re
nltk.download('wordnet')

def my_preprocessing(text)
 text=re.split("\\s+",text)
 wnl = WordNetLemmatizer()
 stemmed_words = [wnl.lemmatize(word) for word in text]
 testo = [w for w in stemmed_words if not w.isnumeric()]
 return ' '.join(testo)