问:
Sphinx parent class in another package: how to disable single backtick reference warnings
I am working on implementing a Python package that inherits from networkx. Networkx seems to use numpydoc, but also wraps certain parts of their docstrings in single backtick characters: `. This normally in rst files denotes italics, but in numpydoc this attempts to create a reference.

So when I have a file like the following where I use autodoc's autosummary directive:

```<code>.. currentmodule:: pywhy_graphs.classes.timeseries

.. autosummary::
   :toctree: generated/

   TimeSeriesGraph
   TimeSeriesDiGraph
   TimeSeriesMixedEdgeGraph
</code>```

I get the following errors (I copy-pasted only 3 examples for the sake of space):

```<code>/Users/adam2392/Documents/pywhy-graphs/pywhy_graphs/classes/timeseries/timeseries.py:docstring of networkx.classes.graph.Graph.to_undirected:33: WARNING: py:obj reference target not found: G = nx.DiGraph(D)
/Users/adam2392/Documents/pywhy-graphs/pywhy_graphs/classes/timeseries/timeseries.py:docstring of networkx.classes.graph.Graph.update:25: WARNING: py:obj reference target not found: edges is None
/Users/adam2392/Documents/pywhy-graphs/pywhy_graphs/classes/timeseries/timeseries.py:docstring of networkx.classes.graph.Graph.update:25: WARNING: py:obj reference target not found: nodes is None
</code>```

These come for example from docstrings like: https://github.com/networkx/networkx/blob/83948b6dc61f507adb4cd1a71561eac9ed3b72ec/networkx/classes/graph.py#L1183.

Questions

If I am using numpydoc, why am I getting this error, but networkx does not when building docs with sphinx?

How do I disable, or workaround this error?

I don't understand what is going on. If someone can help elaborate what I should do and why, that would be very helpful in learning Sphinx/numpydoc.

Body:
I am working on implementing a Python package that inherits from networkx. Networkx seems to use numpydoc, but also wraps certain parts of their docstrings in single backtick characters: `. This normally in rst files denotes italics, but in numpydoc this attempts to create a reference.

So when I have a file like the following where I use autodoc's autosummary directive:

.. currentmodule:: pywhy_graphs.classes.timeseries

.. autosummary::
   :toctree: generated/

   TimeSeriesGraph
   TimeSeriesDiGraph
   TimeSeriesMixedEdgeGraph

I get the following errors (I copy-pasted only 3 examples for the sake of space):

/Users/adam2392/Documents/pywhy-graphs/pywhy_graphs/classes/timeseries/timeseries.py:docstring of networkx.classes.graph.Graph.to_undirected:33: WARNING: py:obj reference target not found: G = nx.DiGraph(D)
/Users/adam2392/Documents/pywhy-graphs/pywhy_graphs/classes/timeseries/timeseries.py:docstring of networkx.classes.graph.Graph.update:25: WARNING: py:obj reference target not found: edges is None
/Users/adam2392/Documents/pywhy-graphs/pywhy_graphs/classes/timeseries/timeseries.py:docstring of networkx.classes.graph.Graph.update:25: WARNING: py:obj reference target not found: nodes is None

These come for example from docstrings like: https://github.com/networkx/networkx/blob/83948b6dc61f507adb4cd1a71561eac9ed3b72ec/networkx/classes/graph.py#L1183.

Questions

If I am using numpydoc, why am I getting this error, but networkx does not when building docs with sphinx?

How do I disable, or workaround this error?

I don't understand what is going on. If someone can help elaborate what I should do and why, that would be very helpful in learning Sphinx/numpydoc.


来源: stackexchange

问:
Merge rows if they contain a duplicate value in one of many columns
SQL Fiddle

I'd like a query that will merge rows that have if they have the same value in one of 3 columns.

If one of of the following columns matches the rows should merge.

customerid, externalid, customername

It should retain the date and customerId of the record most recent joindate.

The externalId, customerName & shiptocode columns should be concatinated if they are not the same

I don't want to update the table, I just want a query.

Given this table:

customerid
externalid
customername
shiptocode
joindate

01
1234567
Test Customer
1
2023-01-04

01
123567
Test Customer
2
2022-12-31

03
1234567
Test
10
2022-01-05

04
ARACODE
ARACODE Customer
1
2022-12-28

05
ARACODE2
ARACODE Customer
2
2023-01-04

06
CBE1EX
Normal Customer
1
2023-01-04

07
ZOCDOC
NormAL Customer
1
2023-01-01

They query should result in this result:

customerid
externalid
customername
shiptocode
joindate

03
1234567, 123567
Test Customer, Test
1, 2, 10
2023-01-04

05
ARACODE2,ARACODE
ARACODE Customer
2, 1
2023-01-04

06
CBE1EX, ZOCDOC
Normal Customer
1
2023-01-04

I have this working for one field but I'm not sure how to get it to concat the additional fields. It seems like I'd need to use a Partition by but I don't see a way to concat with that.

```<code>SELECT
  DISTINCT(customerId),
  array_to_string(array_agg(distinct externalId),', ') AS externalId,
  array_to_string(array_agg(distinct customerName),', ') AS customerName,
  array_to_string(array_agg(distinct shipToCode),', ') AS shipToCode,
  MAX(joinDate)
 FROM customers
 GROUP BY customerId
 ORDER BY MAX(joinDate) DESC;
</code>```

ContentLicense: CC BY-SA 4.0

Body:
SQL Fiddle

I'd like a query that will merge rows that have if they have the same value in one of 3 columns.

If one of of the following columns matches the rows should merge.

customerid, externalid, customername

It should retain the date and customerId of the record most recent joindate.

The externalId, customerName & shiptocode columns should be concatinated if they are not the same

I don't want to update the table, I just want a query.

Given this table:

customerid
externalid
customername
shiptocode
joindate

01
1234567
Test Customer
1
2023-01-04

01
123567
Test Customer
2
2022-12-31

03
1234567
Test
10
2022-01-05

04
ARACODE
ARACODE Customer
1
2022-12-28

05
ARACODE2
ARACODE Customer
2
2023-01-04

06
CBE1EX
Normal Customer
1
2023-01-04

07
ZOCDOC
NormAL Customer
1
2023-01-01

They query should result in this result:

customerid
externalid
customername
shiptocode
joindate

03
1234567, 123567
Test Customer, Test
1, 2, 10
2023-01-04

05
ARACODE2,ARACODE
ARACODE Customer
2, 1
2023-01-04

06
CBE1EX, ZOCDOC
Normal Customer
1
2023-01-04

I have this working for one field but I'm not sure how to get it to concat the additional fields. It seems like I'd need to use a Partition by but I don't see a way to concat with that.

SELECT
  DISTINCT(customerId),
  array_to_string(array_agg(distinct externalId),', ') AS externalId,
  array_to_string(array_agg(distinct customerName),', ') AS customerName,
  array_to_string(array_agg(distinct shipToCode),', ') AS shipToCode,
  MAX(joinDate)
 FROM customers
 GROUP BY customerId
 ORDER BY MAX(joinDate) DESC;


问:
Superscript some commented text in WebStorm?
I want to superscript 2 in the commented text below.

```<code>// O(n2)
</code>```

Any way to achieve this format?

Body:
I want to superscript 2 in the commented text below.

// O(n2)

Any way to achieve this format?


问:
Artifactory Polling timeout in github action CICD
I have a CICD process to build docker and deploy it. I am using Jfrog to save the docker image and use it for deployment.

For each project, I just save a couple of latest images so I don't think the issue is due to having low storage issue.

I am able to build the image without issue but when I want to deploy, with "docker run" command, I receive this error:

2022-12-19T20:15:34.0073431Z 2022-12-19 20:15:34 INFO     Current task: Docker push -app
Blockquote

2022-12-19T20:20:15.0249846Z cloud.exceptions.PlayTimeout: Polling
timeout has been reached for d8bdabd4-7fd9-11ed-b4e3-005056bc8da6.
Status remains running.

2022-12-19T20:20:15.0711629Z ##[error]Process completed with exit code
1.

The docker run command is something like this:

```<code>docker run -e USER={{ DB_USER }} -e PASSWORD={{ DB_PASSWORD}} -e ENV={{RUNNING_HOSTNAME}} -d -p 8140:8140 --restart unless-stopped --name AAA artifacts******/analytics-docker/dataservices/AAA/dev:AAA-{{ RUN_NUMBER }}
</code>```

duration of the failed process:

Total duration

35m 48s

Build process duration

29m 58s

Deploy process duration

5m 34s

let me know if you need more information.

Body:
I have a CICD process to build docker and deploy it. I am using Jfrog to save the docker image and use it for deployment.

For each project, I just save a couple of latest images so I don't think the issue is due to having low storage issue.

I am able to build the image without issue but when I want to deploy, with "docker run" command, I receive this error:

2022-12-19T20:15:34.0073431Z 2022-12-19 20:15:34 INFO     Current task: Docker push -app
Blockquote

2022-12-19T20:20:15.0249846Z cloud.exceptions.PlayTimeout: Polling
timeout has been reached for d8bdabd4-7fd9-11ed-b4e3-005056bc8da6.
Status remains running.

2022-12-19T20:20:15.0711629Z ##[error]Process completed with exit code
1.

The docker run command is something like this:

docker run -e USER={{ DB_USER }} -e PASSWORD={{ DB_PASSWORD}} -e ENV={{RUNNING_HOSTNAME}} -d -p 8140:8140 --restart unless-stopped --name AAA artifacts******/analytics-docker/dataservices/AAA/dev:AAA-{{ RUN_NUMBER }}

duration of the failed process:

Total duration

35m 48s

Build process duration

29m 58s

Deploy process duration

5m 34s

let me know if you need more information.


问:
Flexmark Typographic Extension silently dropping characters?
Using Flexmark 0.64.0 with Java 17 I'm expecting the Typographic Extension to turn ' into ’ with its default configuration, but instead it seems merely to drop the character. The same happens e.g. with ---.

I'm setting up my parser and HTML renderer like this:

MutableDataHolder parserOptions = new MutableDataSet()
    //emoji; see https://www.webfx.com/tools/emoji-cheat-sheet/
    .set(EmojiExtension.USE_IMAGE_TYPE, EmojiImageType.UNICODE_ONLY)
    //GFM tables
    .set(TablesExtension.COLUMN_SPANS, false).set(TablesExtension.APPEND_MISSING_COLUMNS, true).set(TablesExtension.DISCARD_EXTRA_COLUMNS, true)
    .set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true)
    //extensions
    .set(Parser.EXTENSIONS, List.of(DefinitionExtension.create(), EmojiExtension.create(), SuperscriptExtension.create(), TablesExtension.create(),
        TypographicExtension.create(), YamlFrontMatterExtension.create()));
parser = Parser.builder(parserOptions).build();
htmlRenderer = HtmlRenderer.builder().build();
```
<p>Note that I just use <code>TypographicExtension.create()</code>. Maybe there are further configurations to do, but by default I wouldn't expect the extension just to drop characters.</p>
<p>I use the parser like this:</p>
<pre class="lang-java prettyprint-override"><code>com.vladsch.flexmark.util.ast.Document markdownDocument = parser.parse("it's working");
System.out.println(htmlRenderer.render(markdownDocument));
</code>```

I expect:

it’s working

Instead I get:

its working

I tried mucking with the settings, using a literal character instead of a character reference:

.set(TypographicExtension.ENABLE_QUOTES, true)
.set(TypographicExtension.SINGLE_QUOTE_UNMATCHED, "x")
```
<p>Nothing changed. The character still simply disappeared</p>
<p>However I was able to <em>disable quote processing altogether</em>:</p>
<pre class="lang-java prettyprint-override"><code>.set(TypographicExtension.ENABLE_QUOTES, false)
</code>```

Then I got my original string back. (Of course this defeats the purpose of the extension.)

Does this mean the Typographic Extension is simply broken, or am I missing some additional configuration? (In any case, I certainly wouldn't expect the default configuration to silently discard content.)

I opened Flexmark Issue #547, but so far I haven't had any responses. Maybe someone can point out my error.

Body:
Using Flexmark 0.64.0 with Java 17 I'm expecting the Typographic Extension to turn ' into ’ with its default configuration, but instead it seems merely to drop the character. The same happens e.g. with ---.

I'm setting up my parser and HTML renderer like this:

MutableDataHolder parserOptions = new MutableDataSet()
    //emoji; see https://www.webfx.com/tools/emoji-cheat-sheet/
    .set(EmojiExtension.USE_IMAGE_TYPE, EmojiImageType.UNICODE_ONLY)
    //GFM tables
    .set(TablesExtension.COLUMN_SPANS, false).set(TablesExtension.APPEND_MISSING_COLUMNS, true).set(TablesExtension.DISCARD_EXTRA_COLUMNS, true)
    .set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true)
    //extensions
    .set(Parser.EXTENSIONS, List.of(DefinitionExtension.create(), EmojiExtension.create(), SuperscriptExtension.create(), TablesExtension.create(),
        TypographicExtension.create(), YamlFrontMatterExtension.create()));
parser = Parser.builder(parserOptions).build();
htmlRenderer = HtmlRenderer.builder().build();

Note that I just use TypographicExtension.create(). Maybe there are further configurations to do, but by default I wouldn't expect the extension just to drop characters.

I use the parser like this:

com.vladsch.flexmark.util.ast.Document markdownDocument = parser.parse("it's working");
System.out.println(htmlRenderer.render(markdownDocument));

I expect:

it’s working

Instead I get:

its working

I tried mucking with the settings, using a literal character instead of a character reference:

.set(TypographicExtension.ENABLE_QUOTES, true)
.set(TypographicExtension.SINGLE_QUOTE_UNMATCHED, "x")

Nothing changed. The character still simply disappeared

However I was able to disable quote processing altogether:

.set(TypographicExtension.ENABLE_QUOTES, false)

Then I got my original string back. (Of course this defeats the purpose of the extension.)

Does this mean the Typographic Extension is simply broken, or am I missing some additional configuration? (In any case, I certainly wouldn't expect the default configuration to silently discard content.)

I opened Flexmark Issue #547, but so far I haven't had any responses. Maybe someone can point out my error.


问:
I am getting an error message using maven in eclipse in pom.xml file .Cannot access defaults field of properties
```<code><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>in.movie.review</groupId>
  <artifactId>MovieReview</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>MovieReview Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <properties>
      <java.version>11</java.version>
      <maven-jar-plugin.version>3.1.0</maven-jar-plugin.version>

  </properties>
</code>```

I am working on maven project.But i am getting an error my first line of pom.xml.I have JDK 11 working on eclipse(Only can use eclipse).Please help me with a solution.

ERROR

Cannot access defaults field of Properties  pom.xml /MovieReview    line 1  Maven Configuration Problem

Body:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>in.movie.review</groupId>
  <artifactId>MovieReview</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>MovieReview Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <properties>
      <java.version>11</java.version>
      <maven-jar-plugin.version>3.1.0</maven-jar-plugin.version>

  </properties>

I am working on maven project.But i am getting an error my first line of pom.xml.I have JDK 11 working on eclipse(Only can use eclipse).Please help me with a solution.

ERROR

Cannot access defaults field of Properties  pom.xml /MovieReview    line 1  Maven Configuration Problem


问:
Is it possible to use a dynamic value as legend?
I have my clustered column chart working just fine, with Rev and Rev SamePeriodLastYear measures:

(Rev is just a sum… and the other measure uses the function SAMEPERIODLASTYEAR.)

In my report I use the YEAR filter:

It works fine, my issue is with the legends:

I want to see as legend;         2023   2022   (when 2023 is selected) and         2022   2021  (when 2022 is selected). (or at least static/generic like "selected year" "previous year")

Is this even possible? The legend section doesn't have a 'function' option to make it dynamic


问:
electron - Import an api from a module imported on runtime
I'm trying to create a extension system like the one on VSCode or Mailspring, I'm able to import and run "extensions" but when I try to import my api (like you can import 'vscode' on vscode extensions to access api functions) it gives this error:

```<code>Uncaught (in promise) TypeError: Failed to resolve module specifier "bluefire". Relative references must start with either "/", "./", or "../".
</code>```

This error originates from this:

import { test } from 'bluefire';

export const activate = () => {
  test();
};
```
<p>But doing the same thing on a file that gets bundled with Vite, doesn't give an error.</p>
<p>My tsconfig.json has this:</p>
<pre class="lang-json prettyprint-override"><code>    "paths": {
      "*": ["src/globals/*"]
    },
</code>```

And here is the src/globals/ folder structure.

I've already tried changing bluefire extension to js, and changing the extensions build target (right now it is building to 'es')

Body:
I'm trying to create a extension system like the one on VSCode or Mailspring, I'm able to import and run "extensions" but when I try to import my api (like you can import 'vscode' on vscode extensions to access api functions) it gives this error:

Uncaught (in promise) TypeError: Failed to resolve module specifier "bluefire". Relative references must start with either "/", "./", or "../".

This error originates from this:

import { test } from 'bluefire';

export const activate = () => {
  test();
};

But doing the same thing on a file that gets bundled with Vite, doesn't give an error.

My tsconfig.json has this:

    "paths": {
      "*": ["src/globals/*"]
    },

And here is the src/globals/ folder structure.

I've already tried changing bluefire extension to js, and changing the extensions build target (right now it is building to 'es')


问:
how to build only a docker image with code changes in Codebuild to send to ecr
I am working with a bitbucket monorepository that sends the code to codebuild and there I create the docker images and then send them to the ECR, what I want is that only the images that have modified their code are built, so as not to send the same images to ECR repositories and save Codebuild time (it's about 16 images per push)

My Buildspec.yml

```<code>version: 0.2
phases:
  install:
    commands:
      - nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
      - timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
  pre_build:
    commands:
    - echo Logging in to Amazon ECR....
    - aws --version
    # update the following line with your own region
    - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
    - COMMIT_HASH=$(echo $RESOLVED_SOURCE_VERSION | cut -c 1-7)
    - IMAGE_TAG=latest
    - REPOSITORY_URI=23685584657641.dkr.ecr.us-east-1.amazonaws.com/my-bitbucket-to-ecr-1
    - REPOSITORY_URI_2=34585584995410.dkr.ecr.us-east-1.amazonaws.com/my-bitbucket-to-ecr-2
  build:
    commands:
    - echo Build started on `date`
    - echo Building the Docker image...
    # update the following line with the name of your own ECR repository
    - ls -a
    - pwd
    - cd api
    - pwd
    - docker build -t $REPOSITORY_URI_2:latest -f Dockerfile.google .
    - cd ..
    - pwd
    - echo ${LAMBDA_TASK_ROOT}
    - docker build -t $REPOSITORY_URI:latest -f Dockerfile.lambda .
    - docker run -d --rm --name lambda_test_container $REPOSITORY_URI:latest
    - docker ps -a
    - docker exec lambda_test_container python -m flake8 /var/task/lambda_function.py /var/task/test_lambda_function.py
    - docker exec lambda_test_container python -m unittest /var/task/test_lambda_function.py
    - docker exec lambda_test_container python -m black /var/task/lambda_function.py /var/task/test_lambda_function.py
    - docker stop lambda_test_container
    # update the following line with the URI of your own ECR repository (view the Push Commands in the console)
    - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
    - docker tag $REPOSITORY_URI_2:latest $REPOSITORY_URI_2:$IMAGE_TAG
  post_build:
    commands:
    - echo Build completed on `date`
    - echo pushing to repo
    # update the following line with the URI of your own ECR repository
    - docker push $REPOSITORY_URI:latest
    - docker push $REPOSITORY_URI:$IMAGE_TAG
    - docker push $REPOSITORY_URI_2:latest
    - docker push $REPOSITORY_URI_2:$IMAGE_TAG

    - echo Writing image definitions file...
    #- printf '[{"ImageURI":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imageDetail.json
    - printf '{"ImageURI":"%s"}' $REPOSITORY_URI:$IMAGE_TAG > imageDetail.json
artifacts:
  files:
    - imageDetail.json
</code>```

I try to pull the images from the repositories to compare but that also takes time

Body:
I am working with a bitbucket monorepository that sends the code to codebuild and there I create the docker images and then send them to the ECR, what I want is that only the images that have modified their code are built, so as not to send the same images to ECR repositories and save Codebuild time (it's about 16 images per push)

My Buildspec.yml

version: 0.2
phases:
  install:
    commands:
      - nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
      - timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
  pre_build:
    commands:
    - echo Logging in to Amazon ECR....
    - aws --version
    # update the following line with your own region
    - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
    - COMMIT_HASH=$(echo $RESOLVED_SOURCE_VERSION | cut -c 1-7)
    - IMAGE_TAG=latest
    - REPOSITORY_URI=23685584657641.dkr.ecr.us-east-1.amazonaws.com/my-bitbucket-to-ecr-1
    - REPOSITORY_URI_2=34585584995410.dkr.ecr.us-east-1.amazonaws.com/my-bitbucket-to-ecr-2
  build:
    commands:
    - echo Build started on `date`
    - echo Building the Docker image...
    # update the following line with the name of your own ECR repository
    - ls -a
    - pwd
    - cd api
    - pwd
    - docker build -t $REPOSITORY_URI_2:latest -f Dockerfile.google .
    - cd ..
    - pwd
    - echo ${LAMBDA_TASK_ROOT}
    - docker build -t $REPOSITORY_URI:latest -f Dockerfile.lambda .
    - docker run -d --rm --name lambda_test_container $REPOSITORY_URI:latest
    - docker ps -a
    - docker exec lambda_test_container python -m flake8 /var/task/lambda_function.py /var/task/test_lambda_function.py
    - docker exec lambda_test_container python -m unittest /var/task/test_lambda_function.py
    - docker exec lambda_test_container python -m black /var/task/lambda_function.py /var/task/test_lambda_function.py
    - docker stop lambda_test_container
    # update the following line with the URI of your own ECR repository (view the Push Commands in the console)
    - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
    - docker tag $REPOSITORY_URI_2:latest $REPOSITORY_URI_2:$IMAGE_TAG
  post_build:
    commands:
    - echo Build completed on `date`
    - echo pushing to repo
    # update the following line with the URI of your own ECR repository
    - docker push $REPOSITORY_URI:latest
    - docker push $REPOSITORY_URI:$IMAGE_TAG
    - docker push $REPOSITORY_URI_2:latest
    - docker push $REPOSITORY_URI_2:$IMAGE_TAG

    - echo Writing image definitions file...
    #- printf '[{"ImageURI":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imageDetail.json
    - printf '{"ImageURI":"%s"}' $REPOSITORY_URI:$IMAGE_TAG > imageDetail.json
artifacts:
  files:
    - imageDetail.json

I try to pull the images from the repositories to compare but that also takes time


问:
react-native-permissions: Do you have to manually call request() after check()?
I'm looking at the following Android Flow for react-native-permissions. In the scenario Is the permission already granted -> NO, it returns RESULTS.DENIED. Does it then automatically call request(), or does the user have to manually call request() after the promise from check() resolves?


问:
Micrsoft Logs AWS CloudWatch Logs
I am currently using Microsoft.Extensions.Logging to log to AWS CloudWatch , but when I look at the logs the stack trace is broken up into separate logs in cloudwatch, I read that it might be an issue with \n in the stack trace, but I'm not sure how to fix this issue.

Any suggestions appreciated.

Title: Micrsoft Logs AWS CloudWatch Logs


问:
gcc compile and missing header file
I have an example C file that looks like this

```<code>#include <stdio.h>
#include "myheader.h"
#include "myheader2.h"
#include "myheader3.h"

int main() {
int car = 0;
int bike = 0;
int boat = 0;

car = ford;
bike = honda;
boat = corsair;

printf("%d\n",car);
printf("%d\n",bike);
printf("%d\n",boat);

}
</code>```

and three header files located in a folder called headers that look like this
myheader.h:

```<code>#ifndef MYHEADER_H
#define MYHEADER_H

#define ford

#endif
</code>```

myheader2.h:

```<code>#ifndef MYHEADER2_H
#define MYHEADER2_H

#define honda 1

#endif
</code>```

myheader3.h

```<code>#ifndef MYHEADER3_H
#define MYHEADER3_H

#define corsair

#endif
</code>```

and then I use the following command:

```<code>strace -e write -f gcc -fsyntax-only mymainfile.c -Iheaders
</code>```

and this is the output. In this case, I can see all the errors present until the "end" of the C file.

```<code>strace: Process 13175 attached
[pid 13175] write(2, "\33[01m\33[Kmymainfile.c:\33[m\33[K In f"..., 62mymainfile.c: In function 'main':
) = 62
[pid 13175] write(2, "\33[01m\33[Kmymainfile.c:12:11:\33[m\33["..., 183mymainfile.c:12:11: error: expected expression before ';' token
   12 | car = ford;
      |           ^
) = 183
[pid 13175] write(2, "\33[01m\33[Kmymainfile.c:14:15:\33[m\33["..., 191mymainfile.c:14:15: error: expected expression before ';' token
   14 | boat = corsair;
      |               ^
) = 191
[pid 13175] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13175, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
+++ exited with 1 +++
</code>```

but if I delete one of the header files and use the same commands on the terminal. Then my output would be like this.

```<code>strace: Process 13186 attached
[pid 13186] write(2, "\33[01m\33[Kmymainfile.c:3:10:\33[m\33[K"..., 198mymainfile.c:3:10:
fatal error: myheader2.h: No such file or directory
3 | #include "myheader2.h"
|          ^~~~~~~~~~~~~
) = 198
[pid 13186] write(2, "compilation terminated.\n", 24compilation terminated.
) = 24
[pid 13186] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13186, si_uid=1000, si_status=1,
si_utime=0, si_stime=0} ---
+++ exited with 1 +++
</code>```

is there a way to tell the compiler to "continue" instead of terminating when it can't find a missing header file? that way I can see other errors present on that C file. I'm a noob with compilers. Thanks.

Title: gcc compile and missing header file

Body:
I have an example C file that looks like this

#include <stdio.h>
#include "myheader.h"
#include "myheader2.h"
#include "myheader3.h"

int main() {
int car = 0;
int bike = 0;
int boat = 0;

car = ford;
bike = honda;
boat = corsair;

printf("%d\n",car);
printf("%d\n",bike);
printf("%d\n",boat);

}

and three header files located in a folder called headers that look like this
myheader.h:

#ifndef MYHEADER_H
#define MYHEADER_H

#define ford

#endif

myheader2.h:

#ifndef MYHEADER2_H
#define MYHEADER2_H

#define honda 1

#endif

myheader3.h

#ifndef MYHEADER3_H
#define MYHEADER3_H

#define corsair

#endif

and then I use the following command:

strace -e write -f gcc -fsyntax-only mymainfile.c -Iheaders

and this is the output. In this case, I can see all the errors present until the "end" of the C file.

strace: Process 13175 attached
[pid 13175] write(2, "\33[01m\33[Kmymainfile.c:\33[m\33[K In f"..., 62mymainfile.c: In function 'main':
) = 62
[pid 13175] write(2, "\33[01m\33[Kmymainfile.c:12:11:\33[m\33["..., 183mymainfile.c:12:11: error: expected expression before ';' token
   12 | car = ford;
      |           ^
) = 183
[pid 13175] write(2, "\33[01m\33[Kmymainfile.c:14:15:\33[m\33["..., 191mymainfile.c:14:15: error: expected expression before ';' token
   14 | boat = corsair;
      |               ^
) = 191
[pid 13175] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13175, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
+++ exited with 1 +++

but if I delete one of the header files and use the same commands on the terminal. Then my output would be like this.

strace: Process 13186 attached
[pid 13186] write(2, "\33[01m\33[Kmymainfile.c:3:10:\33[m\33[K"..., 198mymainfile.c:3:10:
fatal error: myheader2.h: No such file or directory
3 | #include "myheader2.h"
|          ^~~~~~~~~~~~~
) = 198
[pid 13186] write(2, "compilation terminated.\n", 24compilation terminated.
) = 24
[pid 13186] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13186, si_uid=1000, si_status=1,
si_utime=0, si_stime=0} ---
+++ exited with 1 +++

is there a way to tell the compiler to "continue" instead of terminating when it can't find a missing header file? that way I can see other errors present on that C file. I'm a noob with compilers. Thanks.


问:
How can I scan from a txt file in C
I want to scan the number 28 and 210 from this txt file:

```<code>k 8

p edge 28 210

e 4 3

e 5 2

e 6 1

e 7 3
</code>```

and i have this code:

```<code>
 struct VyE
 {
   int vertices;
   int enlaces;
 };

struct VyE obtenerNumVerticesYenlaces(char* ruta){

    // Abre el archivo de texto en modo de lectura
  FILE* fp = fopen(ruta, "r");
  struct VyE datos;
  if (fp == NULL) {
      // Si ha habido un error al abrir el archivo, muestra un mensaje de error y finaliza el programa
      printf("Error al abrir el archivo\n");
      datos.enlaces=0;
      datos.vertices=0;
      return datos;
  }
  // Lee los valores 28 y 210 del archivo
  fscanf(fp, "p edge %d %d", &datos.vertices, &datos.enlaces);
  fclose(fp);
  return datos;

}
</code>```

but when i debug it i get bigger values and not what i want.

How can i get these values?

Title: How can I scan from a txt file in C

Body:
I want to scan the number 28 and 210 from this txt file:

k 8

p edge 28 210

e 4 3

e 5 2

e 6 1

e 7 3

and i have this code:

 struct VyE
 {
   int vertices;
   int enlaces;
 };

struct VyE obtenerNumVerticesYenlaces(char* ruta){

    // Abre el archivo de texto en modo de lectura
  FILE* fp = fopen(ruta, "r");
  struct VyE datos;
  if (fp == NULL) {
      // Si ha habido un error al abrir el archivo, muestra un mensaje de error y finaliza el programa
      printf("Error al abrir el archivo\n");
      datos.enlaces=0;
      datos.vertices=0;
      return datos;
  }
  // Lee los valores 28 y 210 del archivo
  fscanf(fp, "p edge %d %d", &datos.vertices, &datos.enlaces);
  fclose(fp);
  return datos;

}

but when i debug it i get bigger values and not what i want.

How can i get these values?


问:
Dotnet-dump Analyze - how to sum object sizes?
Using dotnet-dump analyze I can inspect a dump, and using the command dumpheap -stat I get a list of Address | Count | Size | Class Name. Is there a way to sum all the sizes?


问:
Missing data when writing output .LAS file with Python Welly Library
I'm writing this post because I'm having trouble with the last step of my code: data exportation of a .las file. The code seems to work fine but when I open the written file, it happens there's no data in it, only the file header.

For those who are not familiar with .las files formatting, it is a world-wide accepted simple format used for the exchange of well log data. In other words, it's just an ascii file, with a header and the data arranged in a matrix way. Rows/indexes is usually represent depth and Columns correspond to different variables.

My code is actually very simple in essence. It imports a .las file, calculates a new curve using as input two of the imported ones and appends the result to the wells data.

You can access to the .las file here.

```<code>pip install welly
from welly import Project, Well, Curve

alias_dict = {'Sonic P': ['DT', 'DT4P'],
              'Sonic S': ['DTS'],
              'Bulk Density': ['RHOB'],
              'Caliper': ['HCAL', 'CALI'],
              }

#Instantiate the well from a Project object.
p = Project.from_las("/content/15_9-F-1A.LAS")
well = p.get_wells()[0]

# Get the curves separated:
rhob = well.get_curve("Bulk Density",alias=alias_dict)
dt = well.get_curve("Sonic P",alias=alias_dict)
dts = well.get_curve('Sonic S', alias=alias_dict)

#Calculate the new curve:
values = rhob.as_numpy()*(dts.as_numpy()**2)

#Create a Curve object with the calculated data:
params = {'mnemonic': 'G', 'units': 'gunits','run':0}
G = Curve(values, **params)

#"Append" the calculated curve to the well data:
well.data["G"] = G

#Write a new .las file with the calculated column:
well.to_las('out.las')

</code>```

You will see that the "out.las" has no data in it, only the header sections.

I hope someone can help me.
Thanks in advance!

Body:
I'm writing this post because I'm having trouble with the last step of my code: data exportation of a .las file. The code seems to work fine but when I open the written file, it happens there's no data in it, only the file header.

For those who are not familiar with .las files formatting, it is a world-wide accepted simple format used for the exchange of well log data. In other words, it's just an ascii file, with a header and the data arranged in a matrix way. Rows/indexes is usually represent depth and Columns correspond to different variables.

My code is actually very simple in essence. It imports a .las file, calculates a new curve using as input two of the imported ones and appends the result to the wells data.

You can access to the .las file here.

pip install welly
from welly import Project, Well, Curve

alias_dict = {'Sonic P': ['DT', 'DT4P'],
              'Sonic S': ['DTS'],
              'Bulk Density': ['RHOB'],
              'Caliper': ['HCAL', 'CALI'],
              }

#Instantiate the well from a Project object.
p = Project.from_las("/content/15_9-F-1A.LAS")
well = p.get_wells()[0]

# Get the curves separated:
rhob = well.get_curve("Bulk Density",alias=alias_dict)
dt = well.get_curve("Sonic P",alias=alias_dict)
dts = well.get_curve('Sonic S', alias=alias_dict)

#Calculate the new curve:
values = rhob.as_numpy()*(dts.as_numpy()**2)

#Create a Curve object with the calculated data:
params = {'mnemonic': 'G', 'units': 'gunits','run':0}
G = Curve(values, **params)

#"Append" the calculated curve to the well data:
well.data["G"] = G

#Write a new .las file with the calculated column:
well.to_las('out.las')

You will see that the "out.las" has no data in it, only the header sections.

I hope someone can help me.
Thanks in advance!


问:
how to change the work directory in java?
This is my project structure. I want to get the data folder's absolute path(/Users/user/IdeaProjects/project/data/post/sourceData) by using relative path, but the test I'm running is inside service folder, so the  absolutePath is always shows "/Users/user/IdeaProjects/project/service/data/post/sourceData".

```<code>project
  -data
   -post
    -sourceData
  -service
   -test
</code>```
```<code>String relativePath = "data/post/sourceData";
Path absolutePath = Paths.get(relativePath).toAbsolutePath();
System.out.println(absolutePath);
</code>```

I tried to set the working directory manually, but after I run the code it still print the error result, how can I fix this?

```<code>String newWorkingDirectory = "/Users/user/IdeaProjects/project/";
System.setProperty("user.dir", newWorkingDirectory);
String relativePath = "data/post/sourceData";
Path absolutePath = Paths.get(relativePath).toAbsolutePath();
System.out.println(absolutePath);  // Outputs
</code>```

Body:
This is my project structure. I want to get the data folder's absolute path(/Users/user/IdeaProjects/project/data/post/sourceData) by using relative path, but the test I'm running is inside service folder, so the  absolutePath is always shows "/Users/user/IdeaProjects/project/service/data/post/sourceData".

project
  -data
   -post
    -sourceData
  -service
   -test

String relativePath = "data/post/sourceData";
Path absolutePath = Paths.get(relativePath).toAbsolutePath();
System.out.println(absolutePath);

I tried to set the working directory manually, but after I run the code it still print the error result, how can I fix this?

String newWorkingDirectory = "/Users/user/IdeaProjects/project/";
System.setProperty("user.dir", newWorkingDirectory);
String relativePath = "data/post/sourceData";
Path absolutePath = Paths.get(relativePath).toAbsolutePath();
System.out.println(absolutePath);  // Outputs


问:
When running Pytest tests individually - they pass. When running all the last one fails
This is my structure:

```<code>.
├── EmployeeApp
├── accounts
└── tests/
    ├── accounts/
    │   ├── __init__.py
    │   └── test_views.py
    ├── EmployeeApp/
    │   ├── __init__.py
    │   └── test_views.py
    ├── __init__.py
    └── conftest.py
</code>```

This is the tests/EmployeeApp/test_views module and the last test is the failing one:

```<code>import pytest
from rest_framework.test import APIClient

client = APIClient()
MOCK_COMPANY_RESPONSE = {'company_name': 'Test Company',
                         'company_description': 'comp descr',
                         'company_logo': 'logo.asd'}

@pytest.mark.django_db
def test_get_company_list_view(register_and_login_user):
    token = register_and_login_user.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    data = {'company_name': 'Test Company',
            'company_description': 'comp descr',
            'company_logo': 'logo.asd'
            }
    client.post('/api/companies', data=data, format='json')
    request = client.get('/api/companies/', format='json')
    assert len(request.data) == 1
    assert request.status_code == 200

@pytest.mark.django_db
def test_company_create(register_and_login_user):
    token = register_and_login_user.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    data = {'company_name': 'Test Company',
            'company_description': 'comp descr',
            'company_logo': 'logo.asd'
            }
    request = client.post('/api/companies', data=data, format='json')

    assert request.data == {'company_name': 'Test Company',
                            'company_description': 'comp descr',
                            'company_logo': 'logo.asd'}
    assert request.status_code == 201

@pytest.mark.django_db
def test_get_own_company_info_successful(register_and_login_user, create_company):
    token = register_and_login_user.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    comp = create_company

    request = client.get('/api/companies/1/', format='json')

    assert request.data == MOCK_COMPANY_RESPONSE
</code>```

These are the fixtures in conftest.py that I am passing:

```<code>import pytest
from rest_framework.test import APIClient

client = APIClient()

@pytest.fixture
def register_and_login_user():
    payload = {
        "username": "testuser",
        "email": "email@mail.com",
        "password": "12345678"
    }

    client.post("/api/auth/signup", payload)
    login_response = client.post("/api/auth/login", {"email": "email@mail.com",
                                                     "password": "12345678"})
    return login_response

@pytest.fixture
def create_company():
    payload = {
        "username": "testuser",
        "email": "email@mail.com",
        "password": "12345678"
    }

    client.post("/api/auth/signup", payload)
    login_response = client.post("/api/auth/login", {"email": "email@mail.com",
                                                     "password": "12345678"})

    token = login_response.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    data = {
            'company_name': 'Test Company',
            'company_description': 'comp descr',
            'company_logo': 'logo.asd'
            }
    request = client.post('/api/companies', data=data, format='json')
    return request

@pytest.fixture
def login():
    login = client.post("/api/auth/login", {"email": "email@mail.com",
                                            "password": "12345678"})
    token = login.data['token']
    return client.credentials(HTTP_AUTHORIZATION='Token ' + token)
</code>```

When I run it with pytest -k test_get_own_company_info_successful it passes.

When I run pytest all the tests pass, but this one with assertion error:

I think it fails to register a user, thus failing to also create a company and call it. What am I missing here?

I tried rearranging the tests and it has an effect on the run order when called with the pytest command.

For example if

```<code>@pytest.mark.django_db
def test_company_create(register_and_login_user):
</code>```

is below

```<code>@pytest.mark.django_db
def test_get_own_company_info_successful(register_and_login_user, create_company):
</code>```

When re-arranged, both fail to create a user in the database and give the bad request warning:

WARNING  django.request:log.py:241 Bad Request: /api/auth/signup

I am using

```<code>@pytest.mark.django_db
</code>```

decorator, so tests should be independent of each other and the test database should be created and deleted after each individual test, but apparently they are somehow intertwined and I can't figure out how.

Would greatly appreciate it if somebody has some input on this!

Body:
This is my structure:

.
├── EmployeeApp
├── accounts
└── tests/
    ├── accounts/
    │   ├── __init__.py
    │   └── test_views.py
    ├── EmployeeApp/
    │   ├── __init__.py
    │   └── test_views.py
    ├── __init__.py
    └── conftest.py

This is the tests/EmployeeApp/test_views module and the last test is the failing one:

import pytest
from rest_framework.test import APIClient

client = APIClient()
MOCK_COMPANY_RESPONSE = {'company_name': 'Test Company',
                         'company_description': 'comp descr',
                         'company_logo': 'logo.asd'}

@pytest.mark.django_db
def test_get_company_list_view(register_and_login_user):
    token = register_and_login_user.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    data = {'company_name': 'Test Company',
            'company_description': 'comp descr',
            'company_logo': 'logo.asd'
            }
    client.post('/api/companies', data=data, format='json')
    request = client.get('/api/companies/', format='json')
    assert len(request.data) == 1
    assert request.status_code == 200

@pytest.mark.django_db
def test_company_create(register_and_login_user):
    token = register_and_login_user.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    data = {'company_name': 'Test Company',
            'company_description': 'comp descr',
            'company_logo': 'logo.asd'
            }
    request = client.post('/api/companies', data=data, format='json')

    assert request.data == {'company_name': 'Test Company',
                            'company_description': 'comp descr',
                            'company_logo': 'logo.asd'}
    assert request.status_code == 201

@pytest.mark.django_db
def test_get_own_company_info_successful(register_and_login_user, create_company):
    token = register_and_login_user.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    comp = create_company

    request = client.get('/api/companies/1/', format='json')

    assert request.data == MOCK_COMPANY_RESPONSE

These are the fixtures in conftest.py that I am passing:

import pytest
from rest_framework.test import APIClient

client = APIClient()

@pytest.fixture
def register_and_login_user():
    payload = {
        "username": "testuser",
        "email": "email@mail.com",
        "password": "12345678"
    }

    client.post("/api/auth/signup", payload)
    login_response = client.post("/api/auth/login", {"email": "email@mail.com",
                                                     "password": "12345678"})
    return login_response

@pytest.fixture
def create_company():
    payload = {
        "username": "testuser",
        "email": "email@mail.com",
        "password": "12345678"
    }

    client.post("/api/auth/signup", payload)
    login_response = client.post("/api/auth/login", {"email": "email@mail.com",
                                                     "password": "12345678"})

    token = login_response.data['token']

    client.credentials(HTTP_AUTHORIZATION='Token ' + token)

    data = {
            'company_name': 'Test Company',
            'company_description': 'comp descr',
            'company_logo': 'logo.asd'
            }
    request = client.post('/api/companies', data=data, format='json')
    return request

@pytest.fixture
def login():
    login = client.post("/api/auth/login", {"email": "email@mail.com",
                                            "password": "12345678"})
    token = login.data['token']
    return client.credentials(HTTP_AUTHORIZATION='Token ' + token)

When I run it with pytest -k test_get_own_company_info_successful it passes.

When I run pytest all the tests pass, but this one with assertion error:

I think it fails to register a user, thus failing to also create a company and call it. What am I missing here?

I tried rearranging the tests and it has an effect on the run order when called with the pytest command.

For example if

@pytest.mark.django_db
def test_company_create(register_and_login_user):

is below

@pytest.mark.django_db
def test_get_own_company_info_successful(register_and_login_user, create_company):

When re-arranged, both fail to create a user in the database and give the bad request warning:

WARNING  django.request:log.py:241 Bad Request: /api/auth/signup

I am using

@pytest.mark.django_db

decorator, so tests should be independent of each other and the test database should be created and deleted after each individual test, but apparently they are somehow intertwined and I can't figure out how.

Would greatly appreciate it if somebody has some input on this!


问:
Unable to resolve service for type 'System.Collections.Generic.Dictionary`2[System.Type,System.Type]' while attempting to activate App
Hello stackoverflow community,

I am attempting to run a .NET MAUI program, however, I am getting the following error:
Unable to resolve service for type 'System.Collections.Generic.Dictionary`2[System.Type,System.Type]' while attempting to activate 'App'.

Here's where the error seems to be happening:

```<code>using System;
using Android.App;
using Models;

namespace Droid
{
    [Application(Label = "[insert name here]", Icon = "@drawable/logo")]
    public class Application: MauiApplication
    {
        public Application(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer) : base(javaReference, transfer) { }

        protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

        public override void OnCreate()
        {
            base.OnCreate(); <-Error happens here.
        }
    }
}
</code>```

While stepping through the app, it also runs the CreateMauiApp function here:

```<code>using Microsoft.Maui.Controls.Hosting;
using Microsoft.Maui.Hosting;

namespace Commander
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder.UseMauiApp<App>();
            return builder.Build();
        }
    }
}
</code>```

And here is the relevant parts of the App class:

```<code>namespace Commander
{
    public class App : Application
    {
        public App(Dictionary<Type, Type> platformDependecies)
        {
        }
</code>```

Body:
Hello stackoverflow community,

I am attempting to run a .NET MAUI program, however, I am getting the following error:
Unable to resolve service for type 'System.Collections.Generic.Dictionary`2[System.Type,System.Type]' while attempting to activate 'App'.

Here's where the error seems to be happening:

using System;
using Android.App;
using Models;

namespace Droid
{
    [Application(Label = "[insert name here]", Icon = "@drawable/logo")]
    public class Application: MauiApplication
    {
        public Application(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer) : base(javaReference, transfer) { }

        protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

        public override void OnCreate()
        {
            base.OnCreate(); <-Error happens here.
        }
    }
}

While stepping through the app, it also runs the CreateMauiApp function here:

using Microsoft.Maui.Controls.Hosting;
using Microsoft.Maui.Hosting;

namespace Commander
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder.UseMauiApp<App>();
            return builder.Build();
        }
    }
}

And here is the relevant parts of the App class:

namespace Commander
{
    public class App : Application
    {
        public App(Dictionary<Type, Type> platformDependecies)
        {
        }


问:
TensorFlow 2.x - how to convert EagerTensor to Tensor (i.e. non-eager tensor)
In Tensorflow 2.x in Python how can I convert type tensorflow.python.framework.ops.EagerTensor to tensorflow.python.framework.ops.Tensor?

I tried tf.convert_to_tensor but that didn't work:

```<code>import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf

x = tf.constant([1.0, 2.0, 3.0], dtype=tf.float32)

print(type(x))

# attempt to convert type EagerTensor to type Tensor, but does not work
x = tf.convert_to_tensor(x)

print(type(x))
</code>```

output:

```<code><class 'tensorflow.python.framework.ops.EagerTensor'>
<class 'tensorflow.python.framework.ops.EagerTensor'>
</code>```

Background:

I have to return a 4-element tuple of lists, each with 5 items, from a numpy function, called with tf.numpy_function, and it's manipulating the data structure in a way I don't want it to which is causing a subsequent crash.  Specifically, if I pass in a a Tensor the numpy function successfully returns a 4-element tuple of lists with 5 items each, but if I pass in an EagerTensor for some reason tf.numpy_function concatenates the 4-element tuple into one list with 20 items.

--- Edit ---

It seems one way to do this is to pass the tensor into a function decorated with @tf.function, but when the tensor is returned to the calling function it's still eager though:

```<code>import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf

def main():
    x = tf.constant([1.0, 2.0, 3.0], dtype=tf.float32)

    print('type before dummy function: ' + str(type(x)))   # EagerTensor here

    x = dummy_function(x)

    print('type after dummy function: ' + str(type(x)))   # still EagerTensor here, would like to make it type Tensor

# end function

@tf.function
def dummy_function(x):
    print('type inside dummy function: ' + str(type(x)))  # Tensor here
    return x
# end function

if __name__ == '__main__':
    main()
</code>```

output:

```<code>type before dummy function: <class 'tensorflow.python.framework.ops.EagerTensor'>
type inside dummy function: <class 'tensorflow.python.framework.ops.Tensor'>
type after dummy function: <class 'tensorflow.python.framework.ops.EagerTensor'>
</code>```

Body:
In Tensorflow 2.x in Python how can I convert type tensorflow.python.framework.ops.EagerTensor to tensorflow.python.framework.ops.Tensor?

I tried tf.convert_to_tensor but that didn't work:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf

x = tf.constant([1.0, 2.0, 3.0], dtype=tf.float32)

print(type(x))

# attempt to convert type EagerTensor to type Tensor, but does not work
x = tf.convert_to_tensor(x)

print(type(x))

output:

<class 'tensorflow.python.framework.ops.EagerTensor'>
<class 'tensorflow.python.framework.ops.EagerTensor'>

Background:

I have to return a 4-element tuple of lists, each with 5 items, from a numpy function, called with tf.numpy_function, and it's manipulating the data structure in a way I don't want it to which is causing a subsequent crash.  Specifically, if I pass in a a Tensor the numpy function successfully returns a 4-element tuple of lists with 5 items each, but if I pass in an EagerTensor for some reason tf.numpy_function concatenates the 4-element tuple into one list with 20 items.

--- Edit ---

It seems one way to do this is to pass the tensor into a function decorated with @tf.function, but when the tensor is returned to the calling function it's still eager though:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf

def main():
    x = tf.constant([1.0, 2.0, 3.0], dtype=tf.float32)

    print('type before dummy function: ' + str(type(x)))   # EagerTensor here

    x = dummy_function(x)

    print('type after dummy function: ' + str(type(x)))   # still EagerTensor here, would like to make it type Tensor

# end function

@tf.function
def dummy_function(x):
    print('type inside dummy function: ' + str(type(x)))  # Tensor here
    return x
# end function

if __name__ == '__main__':
    main()

output:

type before dummy function: <class 'tensorflow.python.framework.ops.EagerTensor'>
type inside dummy function: <class 'tensorflow.python.framework.ops.Tensor'>
type after dummy function: <class 'tensorflow.python.framework.ops.EagerTensor'>


问:
Where can I perform EDA and run machine learning model on a large dataset?
I want to perform EDA, feature selection, and run a machine learning model on a large dataset.
I run the code (python) in google colab with Colab Pro.
I'm combining 3 tables (all in csv files) and doing some feature engineering so I end up with 11,521,958 rows × 50 columns (I started with 20,000,000 entries but downsized it because I got the error in a much earlier stage).
From that point on, when I run any code, I get the error:
"Your session crashed after using all available RAM. If you are interested in access to high-RAM runtimes, you may want to check out Colab Pro." - Even though I am using Colab Pro.

In addition, I'm using the following code to reduce memory size:

```<code>from pandas.api.types import is_datetime64_any_dtype as is_datetime
from pandas.api.types import is_categorical_dtype

def reduce_mem_usage(df, use_float16=False):
    """ iterate through all the columns of a dataframe and modify the data type
        to reduce memory usage.
    """
    start_mem = df.memory_usage().sum() / 1024**2
    print('Memory usage of dataframe is {:.2f} MB'.format(start_mem))

    #iterating over every column and finding the type of the column
    for col in df.columns:
        if is_datetime(df[col]) or is_categorical_dtype(df[col]):
            continue
        col_type = df[col].dtype

        #If the columns is not object
        if col_type != object:
          #Get the minimum and maximum value
            c_min = df[col].min()
            c_max = df[col].max()
            #If the type is int
            if str(col_type)[:3] == 'int':
              #If the min max values lies with thin the range of int8 type then assign the type as int8
                if c_min > np.iinfo(np.int8).min and c_max < np.iinfo(np.int8).max:
                    df[col] = df[col].astype(np.int8)
              #If the min max values lies with thin the range of int16 type then assign the type as int16
                elif c_min > np.iinfo(np.int16).min and c_max < np.iinfo(np.int16).max:
                    df[col] = df[col].astype(np.int16)
              #If the min max values lies with thin the range of int32 type then assign the type as int32
                elif c_min > np.iinfo(np.int32).min and c_max < np.iinfo(np.int32).max:
                    df[col] = df[col].astype(np.int32)
              #If the min max values lies with thin the range of int64 type then assign the type as int64
                elif c_min > np.iinfo(np.int64).min and c_max < np.iinfo(np.int64).max:
                    df[col] = df[col].astype(np.int64)
            else:
              #If the min max values lies with thin the range of float16 type then assign the type as float16
                if c_min > np.finfo(np.float16).min and c_max < np.finfo(np.float16).max:
                    df[col] = df[col].astype(np.float16)
              #If the min max values lies with thin the range of float32 type then assign the type as float32
                elif c_min > np.finfo(np.float32).min and c_max < np.finfo(np.float32).max:
                    df[col] = df[col].astype(np.float32)
                else:
                    df[col] = df[col].astype(np.float64)
        else:
            df[col] = df[col].astype('category')

    end_mem = df.memory_usage().sum() / 1024**2
    print('Memory usage after optimization is: {:.2f} MB'.format(end_mem))
    print('Decreased by {:.1f}%'.format(100 * (start_mem - end_mem) / start_mem))

    return df
</code>```

`

Nothing helps. I wish to remain with this dataset and not removing entries.

What other options do I have for analyzing a large dataframe on my local machine? Cloud computing services is not my strong side, so I'll be happy to get some help.

Thank you all!

Body:
I want to perform EDA, feature selection, and run a machine learning model on a large dataset.
I run the code (python) in google colab with Colab Pro.
I'm combining 3 tables (all in csv files) and doing some feature engineering so I end up with 11,521,958 rows × 50 columns (I started with 20,000,000 entries but downsized it because I got the error in a much earlier stage).
From that point on, when I run any code, I get the error:
"Your session crashed after using all available RAM. If you are interested in access to high-RAM runtimes, you may want to check out Colab Pro." - Even though I am using Colab Pro.

In addition, I'm using the following code to reduce memory size:

from pandas.api.types import is_datetime64_any_dtype as is_datetime
from pandas.api.types import is_categorical_dtype

def reduce_mem_usage(df, use_float16=False):
    """ iterate through all the columns of a dataframe and modify the data type
        to reduce memory usage.
    """
    start_mem = df.memory_usage().sum() / 1024**2
    print('Memory usage of dataframe is {:.2f} MB'.format(start_mem))

    #iterating over every column and finding the type of the column
    for col in df.columns:
        if is_datetime(df[col]) or is_categorical_dtype(df[col]):
            continue
        col_type = df[col].dtype

        #If the columns is not object
        if col_type != object:
          #Get the minimum and maximum value
            c_min = df[col].min()
            c_max = df[col].max()
            #If the type is int
            if str(col_type)[:3] == 'int':
              #If the min max values lies with thin the range of int8 type then assign the type as int8
                if c_min > np.iinfo(np.int8).min and c_max < np.iinfo(np.int8).max:
                    df[col] = df[col].astype(np.int8)
              #If the min max values lies with thin the range of int16 type then assign the type as int16
                elif c_min > np.iinfo(np.int16).min and c_max < np.iinfo(np.int16).max:
                    df[col] = df[col].astype(np.int16)
              #If the min max values lies with thin the range of int32 type then assign the type as int32
                elif c_min > np.iinfo(np.int32).min and c_max < np.iinfo(np.int32).max:
                    df[col] = df[col].astype(np.int32)
              #If the min max values lies with thin the range of int64 type then assign the type as int64
                elif c_min > np.iinfo(np.int64).min and c_max < np.iinfo(np.int64).max:
                    df[col] = df[col].astype(np.int64)
            else:
              #If the min max values lies with thin the range of float16 type then assign the type as float16
                if c_min > np.finfo(np.float16).min and c_max < np.finfo(np.float16).max:
                    df[col] = df[col].astype(np.float16)
              #If the min max values lies with thin the range of float32 type then assign the type as float32
                elif c_min > np.finfo(np.float32).min and c_max < np.finfo(np.float32).max:
                    df[col] = df[col].astype(np.float32)
                else:
                    df[col] = df[col].astype(np.float64)
        else:
            df[col] = df[col].astype('category')

    end_mem = df.memory_usage().sum() / 1024**2
    print('Memory usage after optimization is: {:.2f} MB'.format(end_mem))
    print('Decreased by {:.1f}%'.format(100 * (start_mem - end_mem) / start_mem))

    return df

`

Nothing helps. I wish to remain with this dataset and not removing entries.

What other options do I have for analyzing a large dataframe on my local machine? Cloud computing services is not my strong side, so I'll be happy to get some help.

Thank you all!


问:
How can my httpPlatformHandler service determine the caller IP Address
I wrote a httpPlatformHandler service using C++ which seems to work well. I actually have two questions.

1 - How can I determine the client IP address? The Winsock function getpeername only returns the IP of the machine IIS is running on.

2 - How can I determine if HTTPS is in use? The first line of the headers ends with HTTP/1.1 even when HTTPS is used.


问:
Angular Material SASS Breakpoint Variables matching the CDK?
The Angular Material CDK has a builtin breakpoints constant.

Does Angular Material also have a SASS Map or variables that we can import that match the breakpoints provided in the CDK?

Something similar to what is defined in this question.


问:
Python - SharePoint List - SharePlum
Currently my firm is using Excel to pull the contents of a SharePoint List.  The list gets pulled in and a set of VBA macros are run to produce the required Excel workbooks.  This method provides all the joy associated with working with Excel and VBA.
There is one thing this method does do:  It maintains the formatting found in the SharePoint List all the way through to Excel.  So Bolding and underlines in the text fields are maintained.

Question:  using Python and SharePlum is it possible to maintain the bolding found in SharePoint List text fields.  Want to extract the text field from SharePoint List and copy it into an Excel cell.

Have not found any postings on this exact topic.

Thank you for your attention to this matter.

KD

Title: Python - SharePoint List - SharePlum


问:
Cant exit while loop on Simpson's Rule
I am trying to calculate an integral using Simpson's Rule formula.The catch is that the value of the integral is the one that satisfies the following condition:You find the Ih and Ih/2.If the absolute of (Ih-Ih/2)<error the loop is complete.Otherwise you repeat the process with half the h,which means it calculates the absolute of (Ih/2-Ih/4) and so on and so on.

```<code>while True:
    ###Ih part
    h = (b - a) / N
    y1 = np.linspace(a, b, N)
    Ez11 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y1 - fa))) / (
                (aa ** 2 - 2 * ra * R * np.cos(y1 - fa)) ** (3 / 2))
    I11 = (h/3) * (Ez11[0] + 2*sum(Ez11[:N-2:2]) \
            + 4*sum(Ez11[1:N-1:2]) + Ez11[N-1])
    #####Ih/2 part
    h = (b-a)/(2*N)
    y2 = np.linspace(a, b, 2*N)
    Ez22 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y2 - fa))) / (
            (aa ** 2 - 2 * ra * R * np.cos(y2 - fa)) ** (3 / 2))
    print(Ez22)
    I22 = (h/ 3) * (Ez22[0] + 2 * sum(Ez22[:N - 2:2]) \
                     + 4 * sum(Ez22[1:N - 1:2]) + Ez22[N - 1])
    # error condition I1=Ih I2=Ih/2
    if np.abs(I11 - I22) < error:
        break
    else:
        N = 2*N # h/2
        print(np.abs(I11 - I22))
</code>```

As far as I can tell,my approach should be correct.However the loop goes on and on,never to stop.

My code is as follows:

```<code>import numpy as np
from scipy.integrate import simps
import scipy.integrate as integrate
import scipy.special as special

# variables
a = 0
b = np.pi * 2
N = 100
ra = 0.1  # ρα
R = 0.05
fa = 35 * (np.pi / 180)  # φα
za = 0.4
Q = 10 ** (-6)
k = 9 * 10 ** 9
aa = np.sqrt(ra ** 2 + R ** 2 + za ** 2)
error = 0.55 * 10 ** (-8)
h=(b-a)/N
I1 = np.nan
I11 = np.nan

#Simpsons section

############   Ez

#automated Simpson

while True:
    ###Ih part
    y1 = np.linspace(a, b, N)
    Ez1 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y1 - fa))) / (
                (aa ** 2 - 2 * ra * R * np.cos(y1 - fa)) ** (3 / 2))
    print(len(Ez1))
    I1 = simps(Ez1, y1)
    #####Ih/2 part
    y2 = np.linspace(a, b, 2*N)
    Ez2 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y2 - fa))) / (
            (aa ** 2 - 2 * ra * R * np.cos(y2 - fa)) ** (3 / 2))
    I2 = simps(Ez2, y2)
    # error condition I1=Ih I2=Ih/2
    if np.abs(I1 - I2) < error:
        break
    else:
        N *= 2  # h/2

#custom-made Simpson

N = 100

while True:
    ###Ih part
    h = (b - a) / N
    y1 = np.linspace(a, b, N)
    Ez11 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y1 - fa))) / (
                (aa ** 2 - 2 * ra * R * np.cos(y1 - fa)) ** (3 / 2))
    I11 = (h/3) * (Ez11[0] + 2*sum(Ez11[:N-2:2]) \
            + 4*sum(Ez11[1:N-1:2]) + Ez11[N-1])
    #####Ih/2 part
    h = (b-a)/(2*N)
    y2 = np.linspace(a, b, 2*N)
    Ez22 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y2 - fa))) / (
            (aa ** 2 - 2 * ra * R * np.cos(y2 - fa)) ** (3 / 2))
    print(Ez22)
    I22 = (h/ 3) * (Ez22[0] + 2 * sum(Ez22[:N - 2:2]) \
                     + 4 * sum(Ez22[1:N - 1:2]) + Ez22[N - 1])
    # error condition I1=Ih I2=Ih/2
    if np.abs(I11 - I22) < error:
        break
    else:
        N = 2*N # h/2
        print(np.abs(I11 - I22))

print(I1)
print(I11)
</code>```

Simpson's Rule is as follows:

After a while it's stuck in this situation

The 5.23 part is the absolute diff of those 2 which shouldnt be that high.

Title: Cant exit while loop on Simpson's Rule

Body:
I am trying to calculate an integral using Simpson's Rule formula.The catch is that the value of the integral is the one that satisfies the following condition:You find the Ih and Ih/2.If the absolute of (Ih-Ih/2)<error the loop is complete.Otherwise you repeat the process with half the h,which means it calculates the absolute of (Ih/2-Ih/4) and so on and so on.

while True:
    ###Ih part
    h = (b - a) / N
    y1 = np.linspace(a, b, N)
    Ez11 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y1 - fa))) / (
                (aa ** 2 - 2 * ra * R * np.cos(y1 - fa)) ** (3 / 2))
    I11 = (h/3) * (Ez11[0] + 2*sum(Ez11[:N-2:2]) \
            + 4*sum(Ez11[1:N-1:2]) + Ez11[N-1])
    #####Ih/2 part
    h = (b-a)/(2*N)
    y2 = np.linspace(a, b, 2*N)
    Ez22 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y2 - fa))) / (
            (aa ** 2 - 2 * ra * R * np.cos(y2 - fa)) ** (3 / 2))
    print(Ez22)
    I22 = (h/ 3) * (Ez22[0] + 2 * sum(Ez22[:N - 2:2]) \
                     + 4 * sum(Ez22[1:N - 1:2]) + Ez22[N - 1])
    # error condition I1=Ih I2=Ih/2
    if np.abs(I11 - I22) < error:
        break
    else:
        N = 2*N # h/2
        print(np.abs(I11 - I22))

As far as I can tell,my approach should be correct.However the loop goes on and on,never to stop.

My code is as follows:

import numpy as np
from scipy.integrate import simps
import scipy.integrate as integrate
import scipy.special as special

# variables
a = 0
b = np.pi * 2
N = 100
ra = 0.1  # ρα
R = 0.05
fa = 35 * (np.pi / 180)  # φα
za = 0.4
Q = 10 ** (-6)
k = 9 * 10 ** 9
aa = np.sqrt(ra ** 2 + R ** 2 + za ** 2)
error = 0.55 * 10 ** (-8)
h=(b-a)/N
I1 = np.nan
I11 = np.nan

#Simpsons section

############   Ez

#automated Simpson

while True:
    ###Ih part
    y1 = np.linspace(a, b, N)
    Ez1 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y1 - fa))) / (
                (aa ** 2 - 2 * ra * R * np.cos(y1 - fa)) ** (3 / 2))
    print(len(Ez1))
    I1 = simps(Ez1, y1)
    #####Ih/2 part
    y2 = np.linspace(a, b, 2*N)
    Ez2 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y2 - fa))) / (
            (aa ** 2 - 2 * ra * R * np.cos(y2 - fa)) ** (3 / 2))
    I2 = simps(Ez2, y2)
    # error condition I1=Ih I2=Ih/2
    if np.abs(I1 - I2) < error:
        break
    else:
        N *= 2  # h/2

#custom-made Simpson

N = 100

while True:
    ###Ih part
    h = (b - a) / N
    y1 = np.linspace(a, b, N)
    Ez11 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y1 - fa))) / (
                (aa ** 2 - 2 * ra * R * np.cos(y1 - fa)) ** (3 / 2))
    I11 = (h/3) * (Ez11[0] + 2*sum(Ez11[:N-2:2]) \
            + 4*sum(Ez11[1:N-1:2]) + Ez11[N-1])
    #####Ih/2 part
    h = (b-a)/(2*N)
    y2 = np.linspace(a, b, 2*N)
    Ez22 = (np.sqrt(ra ** 2 + R ** 2 - 2 * ra * R * np.cos(y2 - fa))) / (
            (aa ** 2 - 2 * ra * R * np.cos(y2 - fa)) ** (3 / 2))
    print(Ez22)
    I22 = (h/ 3) * (Ez22[0] + 2 * sum(Ez22[:N - 2:2]) \
                     + 4 * sum(Ez22[1:N - 1:2]) + Ez22[N - 1])
    # error condition I1=Ih I2=Ih/2
    if np.abs(I11 - I22) < error:
        break
    else:
        N = 2*N # h/2
        print(np.abs(I11 - I22))

print(I1)
print(I11)

Simpson's Rule is as follows:

After a while it's stuck in this situation

The 5.23 part is the absolute diff of those 2 which shouldnt be that high.


问:
Getting sporadic error when getting the active form
I am once in a while getting this error:

Jan 5, 2023, 11:03:48 AM  Error   Exception: Failed to  retrieve form
data. Please wait and try again. at processForm(Code:2:22)

Line 2 is:

```<code>var form = FormApp.getActiveForm();
</code>```

Full script

```<code>function processForm(event) {
  var form = FormApp.getActiveForm();
  Logger.log("Form retrieved " + form)
  var allResponses = form.getResponses();
  var latestResponse = allResponses[allResponses.length - 1];
  var itemResponses = latestResponse.getItemResponses();
  //const itemResponses = event.response.getItemResponses();
  const propertyAddress = itemResponses[0].getResponse();
  Logger.log("Processing address " + propertyAddress);
  // Get the number of units. index 5
  const moreThan200Units = parseInt(itemResponses[5].getResponse(), 10);
  var mainFolder = null;
  if(moreThan200Units > 199) {
    mainFolder = DriveApp.getFolderById('xx');
  } else {
    mainFolder = DriveApp.getFolderById('yy');
  }

  var propertyFolder = null;
  for (var i = 0; i < itemResponses.length; i++) {
    Logger.log(itemResponses[i].getItem().getType())
    if (itemResponses[i].getItem().getType() == "FILE_UPLOAD") {
      if(propertyFolder == null) {
        propertyFolder = mainFolder.createFolder(propertyAddress);
      }
      var ids = itemResponses[i].getResponse();
      for (var j = 0; j < ids.length; j++) {
        var uploadedFile = DriveApp.getFileById(ids[j]);
        Logger.log("Moving file" + uploadedFile + " to " + propertyFolder);
        uploadedFile.moveTo(propertyFolder);
      }
    }
  }
}

</code>```

Body:
I am once in a while getting this error:

Jan 5, 2023, 11:03:48 AM  Error   Exception: Failed to  retrieve form
data. Please wait and try again. at processForm(Code:2:22)

Line 2 is:

var form = FormApp.getActiveForm();

Full script

function processForm(event) {
  var form = FormApp.getActiveForm();
  Logger.log("Form retrieved " + form)
  var allResponses = form.getResponses();
  var latestResponse = allResponses[allResponses.length - 1];
  var itemResponses = latestResponse.getItemResponses();
  //const itemResponses = event.response.getItemResponses();
  const propertyAddress = itemResponses[0].getResponse();
  Logger.log("Processing address " + propertyAddress);
  // Get the number of units. index 5
  const moreThan200Units = parseInt(itemResponses[5].getResponse(), 10);
  var mainFolder = null;
  if(moreThan200Units > 199) {
    mainFolder = DriveApp.getFolderById('xx');
  } else {
    mainFolder = DriveApp.getFolderById('yy');
  }

  var propertyFolder = null;
  for (var i = 0; i < itemResponses.length; i++) {
    Logger.log(itemResponses[i].getItem().getType())
    if (itemResponses[i].getItem().getType() == "FILE_UPLOAD") {
      if(propertyFolder == null) {
        propertyFolder = mainFolder.createFolder(propertyAddress);
      }
      var ids = itemResponses[i].getResponse();
      for (var j = 0; j < ids.length; j++) {
        var uploadedFile = DriveApp.getFileById(ids[j]);
        Logger.log("Moving file" + uploadedFile + " to " + propertyFolder);
        uploadedFile.moveTo(propertyFolder);
      }
    }
  }
}


问:
EAS updates not working possibly due to missing channel-name in Expo.plist
I'm trying to make EAS updates to work, after debugging,  the issue seems to be the missing channel-name, which does not appear in Expo.plist, although,I believe, my eas.json is set up correctly.

I am not using anywhere in the app releaseChannel, replaced it with channel and I did rebuilt the app. Did anyone encounter this issue or knows a solution ? This is how I set the profile in eas.json:

```<code>“build”:{
 "staging-1863": {
      "channel": "staging-1863",
      "env": {
        "ENVIRONMENT": "staging"
      },
      "android": {
        "buildType": "apk",
        "credentialsSource": "local"
      },
      "ios": {
        "credentialsSource": "local"
      }
    },
}
</code>```

Body:
I'm trying to make EAS updates to work, after debugging,  the issue seems to be the missing channel-name, which does not appear in Expo.plist, although,I believe, my eas.json is set up correctly.

I am not using anywhere in the app releaseChannel, replaced it with channel and I did rebuilt the app. Did anyone encounter this issue or knows a solution ? This is how I set the profile in eas.json:

“build”:{
 "staging-1863": {
      "channel": "staging-1863",
      "env": {
        "ENVIRONMENT": "staging"
      },
      "android": {
        "buildType": "apk",
        "credentialsSource": "local"
      },
      "ios": {
        "credentialsSource": "local"
      }
    },
}


问:
A weird behaviour of get_media_prefix of Django
I am monitoring a weird behaviour in the working of my django application. Sometimes the get_media_prefix returns a mix between static and get_media_prefix. I ask here because I have not found any solution in the searchers and If anyone could have any idea because server and web application do not shown any error, It just returns the incorrect path since is a mix between two paths.

The django template is:

```<code>{% load static %}
<!DOCTYPE html>
...
    <script src="{% static "js/bootstrap.bundle.min.js" %}"></script>
    </head>
    <body>
    ...
    <img src="{% get_media_prefix %}{{ website.avatar }}" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
...
</code>```

View:

```<code>def index(request):
    results = cache.get(1)
    if not results:
        # REDACTED code
        cache.set(1, foobar, 86400)
        return render(request,'index.html',{"Foobar" : foobar})
    else:
        return render(request,'index.html',{"Foobar" : foobar})
</code>```

Apache2 server:

```<code>Alias /static/ /home/xxx/xxx.xxx/yyy/static/
Alias /media/ /home/xxx/xxx.xxx/yyy/media/
...
<Directory /home/xxx/xxx.xxx/yyy/static>
        <LimitExcept POST GET>
                Require all granted
        </LimitExcept>
</Directory>
<Directory /home/xxx/xxx.xxx/yyy/media>
        <LimitExcept POST GET>
                Require all granted
        </LimitExcept>
</Directory>
</code>```

The weird situation always begins randomly and always looks like fix with a restart of apache2.

```<code>for i in {1..20};do  curl -s https://xxx.yyyy/ |grep avatar ; done
                          <img src="/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
                          <img src="/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
                          <img src="/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" alt="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
                          <img src="/static/js/bootstrap.bundle.m/media/avatar/avatar2.webp" width="60" height="60" class="img-fluid rounded-circle" al
t="Blog avatar"></img>
</code>```

In the previous code we can show that the template sometimes returns a mix between "/static/js/bootstrap.bundle.min.js" (static) and "/media/avatar/avatar2.webp", I have trying to understand why it is happening but I have not found the explanation yet.

If someone comes up with what could be happening...

Body:
I am monitoring a weird behaviour in the working of my django application. Sometimes the get_media_prefix returns a mix between static and get_media_prefix. I ask here because I have not found any solution in the searchers and If anyone could have any idea because server and web application do not shown any error, It just returns the incorrect path since is a mix between two paths.

The django template is:

{% load static %}
<!DOCTYPE html>
...

    ...

...

View:

def index(request):
    results = cache.get(1)
    if not results:
        # REDACTED code
        cache.set(1, foobar, 86400)
        return render(request,'index.html',{"Foobar" : foobar})
    else:
        return render(request,'index.html',{"Foobar" : foobar})

Apache2 server:

Alias /static/ /home/xxx/xxx.xxx/yyy/static/
Alias /media/ /home/xxx/xxx.xxx/yyy/media/
...
<Directory /home/xxx/xxx.xxx/yyy/static>
        <LimitExcept POST GET>
                Require all granted
        </LimitExcept>
</Directory>
<Directory /home/xxx/xxx.xxx/yyy/media>
        <LimitExcept POST GET>
                Require all granted
        </LimitExcept>
</Directory>

The weird situation always begins randomly and always looks like fix with a restart of apache2.

for i in {1..20};do  curl -s https://xxx.yyyy/ |grep avatar ; done

In the previous code we can show that the template sometimes returns a mix between "/static/js/bootstrap.bundle.min.js" (static) and "/media/avatar/avatar2.webp", I have trying to understand why it is happening but I have not found the explanation yet.

If someone comes up with what could be happening...


问:
Trouble with Qt QCanBus filters
I'm trying to use the QCanBus filters (Qt version 6.4.0) like so:

```<code>if (QCanBus::instance()->plugins().contains(QStringLiteral("vectorcan"))) {
        QString errorString = QString("Error");
        canDevice = QCanBus::instance()->createDevice(QStringLiteral("vectorcan"), QStringLiteral("can0"), &errorString);
        if (!canDevice)
        {
            qDebug() << "Error: " << errorString << Qt::endl;
        }
        else
        {
            QCanBusDevice::Filter filter;
            QList<QCanBusDevice::Filter> filterList;

            filter.frameId = 0x18FFC281;
            filter.frameIdMask = 0x00FFFFFF;
            filter.format = QCanBusDevice::Filter::MatchExtendedFormat;
            filter.type = QCanBusFrame::DataFrame;
            filterList.append(filter);

            //apply filter
            canDevice->setConfigurationParameter(QCanBusDevice::RawFilterKey, QVariant::fromValue(filterList));

            //set baud rate
            canDevice->setConfigurationParameter(QCanBusDevice::BitRateKey, QVariant(250000));

            bool connected = canDevice->connectDevice();
            if (connected)
            {
                connect(canDevice, &QCanBusDevice::framesReceived, this, &CANHandler::ProcessFramesReceived);
            }
            else
            {
                qDebug() << "Error connecting to device." << Qt::endl;
            }
        }
    }
</code>```

I'm expecting this only let messages through that match the filter, yet when I print the ID of incoming messages, it seems no filtering is happening:

```<code>void CANHandler::ProcessFramesReceived()
{
    while(canDevice->framesAvailable())
    {
        QCanBusFrame frame = canDevice->readFrame();
        qDebug() << QString::number(frame.frameId(), 16) << Qt::endl;
        //every CAN message on the bus appears here
    }
}
</code>```

Am I using the filter wrong? Do I have the wrong expectation?

EDIT: After looking into the documentation further I realized the Vector plugin does not actually support filtering at the time of this post. I'm not exactly sure as to why, seems like only a few plugins offered by Qt support filtering.

Title: Trouble with Qt QCanBus filters

Body:
I'm trying to use the QCanBus filters (Qt version 6.4.0) like so:

if (QCanBus::instance()->plugins().contains(QStringLiteral("vectorcan"))) {
        QString errorString = QString("Error");
        canDevice = QCanBus::instance()->createDevice(QStringLiteral("vectorcan"), QStringLiteral("can0"), &errorString);
        if (!canDevice)
        {
            qDebug() << "Error: " << errorString << Qt::endl;
        }
        else
        {
            QCanBusDevice::Filter filter;
            QList<QCanBusDevice::Filter> filterList;

            filter.frameId = 0x18FFC281;
            filter.frameIdMask = 0x00FFFFFF;
            filter.format = QCanBusDevice::Filter::MatchExtendedFormat;
            filter.type = QCanBusFrame::DataFrame;
            filterList.append(filter);

            //apply filter
            canDevice->setConfigurationParameter(QCanBusDevice::RawFilterKey, QVariant::fromValue(filterList));

            //set baud rate
            canDevice->setConfigurationParameter(QCanBusDevice::BitRateKey, QVariant(250000));

            bool connected = canDevice->connectDevice();
            if (connected)
            {
                connect(canDevice, &QCanBusDevice::framesReceived, this, &CANHandler::ProcessFramesReceived);
            }
            else
            {
                qDebug() << "Error connecting to device." << Qt::endl;
            }
        }
    }

I'm expecting this only let messages through that match the filter, yet when I print the ID of incoming messages, it seems no filtering is happening:

void CANHandler::ProcessFramesReceived()
{
    while(canDevice->framesAvailable())
    {
        QCanBusFrame frame = canDevice->readFrame();
        qDebug() << QString::number(frame.frameId(), 16) << Qt::endl;
        //every CAN message on the bus appears here
    }
}

Am I using the filter wrong? Do I have the wrong expectation?

EDIT: After looking into the documentation further I realized the Vector plugin does not actually support filtering at the time of this post. I'm not exactly sure as to why, seems like only a few plugins offered by Qt support filtering.


问:
google cloud authenticating to the wrong project ID
I'm trying to follow the quick start code for using the perspective API but the code fails because it keeps defaulting to another project.

I have already created an appropriate service account for project A, which is my intended project. I downloaded the corresponding SA key file and my API key is affiliated with project A. But every time I run this code (at the line discovery.build()) I get an error message because it's using project B and this service is only enabled for project A.

```<code>from googleapiclient import discovery
from google.oauth2 import service_account
import os

API_KEY = 'myapikey'
SA_FILE = 'my_sa_keyfile.json'
scopes = ['https://www.googleapis.com/auth/cloud-platform']

credentials = service_account.Credentials.from_service_account_file(
    SA_FILE,
    scopes=scopes)

client = discovery.build(
    "commentanalyzer",
    "v1alpha1",
    credentials=credentials,
    developerKey=API_KEY,
    discoveryServiceUrl="https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1",
    static_discovery=False,
)
</code>```

There's no place in discovery.build() to set my project ID. What am I doing wrong?

Body:
I'm trying to follow the quick start code for using the perspective API but the code fails because it keeps defaulting to another project.

I have already created an appropriate service account for project A, which is my intended project. I downloaded the corresponding SA key file and my API key is affiliated with project A. But every time I run this code (at the line discovery.build()) I get an error message because it's using project B and this service is only enabled for project A.

from googleapiclient import discovery
from google.oauth2 import service_account
import os

API_KEY = 'myapikey'
SA_FILE = 'my_sa_keyfile.json'
scopes = ['https://www.googleapis.com/auth/cloud-platform']

credentials = service_account.Credentials.from_service_account_file(
    SA_FILE,
    scopes=scopes)

client = discovery.build(
    "commentanalyzer",
    "v1alpha1",
    credentials=credentials,
    developerKey=API_KEY,
    discoveryServiceUrl="https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1",
    static_discovery=False,
)

There's no place in discovery.build() to set my project ID. What am I doing wrong?