问:
Javascript: how to arrange array in properly way?
I'm new to JavaScript. I want to arrange the following array

```<code>{
"movies": [
    { "id": "1", "competition":1, "time":1670854636, "title": "Star Wars", "releaseYear": "1977" },
    { "id": "2", "competition":1, "time":1670854636, "title": "Back to the Future", "releaseYear": "1985" },
    { "id": "3", "competition":2, "time":1670937436, "title": "The Matrix", "releaseYear": "1999" },
    { "id": "4", "competition":1, "time":1670937436, "title": "Inception", "releaseYear": "2010" },
    { "id": "5", "competition":2, "time":1670937436, "title": "Interstellar", "releaseYear": "2014" }
  ]
}
</code>```

into this one, where the first key is time and the nested is competition

```<code>{
"movies": [
    {"time": 1670854636, "competitions": [
        "competition":1, "data": [
           {"title": "Star Wars", "releaseYear": "1977"},
           {"title": "Back to the Future", "releaseYear": "1985"}
        ]
    ]},
    {"time": 1670937436, "competitions": [
        "competition":1, "data": [
           {"title": "The Matrix", "releaseYear": "1999"}
        ],
        "competition":2, "data": [
           {"title": "Inception", "releaseYear": "2010"},
           {"title": "Interstellar", "releaseYear": "2014"}
        ]
    ]}
  ]
}
</code>```

I tried this, and it works, but I can't reproduce the same logic for nested competition array

```<code>var result = json.movies.reduce((actual, match) => {

         const { time, ...restOfMovie } = movie;
         const group = actual.find((item) => movie.time === time);

         if (!group) {
           actual.push({
             time: time
           });
         }
         return actual;
       }, []);
</code>```

How should I complete the code?

Body:
I'm new to JavaScript. I want to arrange the following array

{
"movies": [
    { "id": "1", "competition":1, "time":1670854636, "title": "Star Wars", "releaseYear": "1977" },
    { "id": "2", "competition":1, "time":1670854636, "title": "Back to the Future", "releaseYear": "1985" },
    { "id": "3", "competition":2, "time":1670937436, "title": "The Matrix", "releaseYear": "1999" },
    { "id": "4", "competition":1, "time":1670937436, "title": "Inception", "releaseYear": "2010" },
    { "id": "5", "competition":2, "time":1670937436, "title": "Interstellar", "releaseYear": "2014" }
  ]
}

into this one, where the first key is time and the nested is competition

{
"movies": [
    {"time": 1670854636, "competitions": [
        "competition":1, "data": [
           {"title": "Star Wars", "releaseYear": "1977"},
           {"title": "Back to the Future", "releaseYear": "1985"}
        ]
    ]},
    {"time": 1670937436, "competitions": [
        "competition":1, "data": [
           {"title": "The Matrix", "releaseYear": "1999"}
        ],
        "competition":2, "data": [
           {"title": "Inception", "releaseYear": "2010"},
           {"title": "Interstellar", "releaseYear": "2014"}
        ]
    ]}
  ]
}

I tried this, and it works, but I can't reproduce the same logic for nested competition array

var result = json.movies.reduce((actual, match) => {

         const { time, ...restOfMovie } = movie;
         const group = actual.find((item) => movie.time === time);

         if (!group) {
           actual.push({
             time: time
           });
         }
         return actual;
       }, []);

How should I complete the code?


来源: stackexchange

问:
Encountered error while building for device
```<code>Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/_q/8skxhvms0vv50mgdtp___s600000gp/T/flutter_tools.OEu0nE/flutter_ios_build_temp_dirnYRhtA/temporary_xcresult_bundle

     warning: 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest
     [-Wdeprecated-declarations]
    - (UILocalNotification *)buildStandardUILocalNotification:
</code>```
```<code>   Result bundle written to path:
        /var/folders/_q/8skxhvms0vv50mgdtp___s600000gp/T/flutter_tools.OEu0nE/flutter_ios_build_temp_dirnYRhtA/temporary_xcresult_bundle

Encountered error while building for device.
</code>```

Deleted Pods folder inside the ios directory
Deleted the Podfile.lock file inside the ios directory
cd ios
pod install
pod update
cd ..
flutter clean
flutter pub get
flutter build ios --release

but it same problem

ContentLicense: CC BY-SA 4.0

Body:
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/_q/8skxhvms0vv50mgdtp___s600000gp/T/flutter_tools.OEu0nE/flutter_ios_build_temp_dirnYRhtA/temporary_xcresult_bundle

     warning: 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest
     [-Wdeprecated-declarations]
    - (UILocalNotification *)buildStandardUILocalNotification:

   Result bundle written to path:
        /var/folders/_q/8skxhvms0vv50mgdtp___s600000gp/T/flutter_tools.OEu0nE/flutter_ios_build_temp_dirnYRhtA/temporary_xcresult_bundle

Encountered error while building for device.

Deleted Pods folder inside the ios directory
Deleted the Podfile.lock file inside the ios directory
cd ios
pod install
pod update
cd ..
flutter clean
flutter pub get
flutter build ios --release

but it same problem


问:
Split Dataframe into list of Dataframes
I have the following Dataframe df:

Now i want to split the Dataframe to a list of Dataframes. After each 7 the Dataframe should be separated.

The code:

```<code>m = df['ZWECK'].eq(7)
subdfs = [d for _,d in df[~m].groupby(m.cumsum())]
</code>```

works perfectly, expect the rows with the value 7 in "ZWECK" are deleted. Each new Dataframe should have the 7 in its last row.

Title: Split Dataframe into list of Dataframes

Body:
I have the following Dataframe df:

Now i want to split the Dataframe to a list of Dataframes. After each 7 the Dataframe should be separated.

The code:

m = df['ZWECK'].eq(7)
subdfs = [d for _,d in df[~m].groupby(m.cumsum())]

works perfectly, expect the rows with the value 7 in "ZWECK" are deleted. Each new Dataframe should have the 7 in its last row.


问:
IDE0005 not reported as build failure even with GenerateDocumentationFile set to true
I want the build of my project to fail if there are unused usings. In csproj I have added:

```<code><EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</code>```

Following the solution mentioned in https://github.com/dotnet/roslyn/issues/41640
In .editorconfig I have added:

```<code>dotnet_diagnostic.IDE0005.severity = error
</code>```

However the build still doesn't fail. The errors are reported in the IDE but the build succeeds.

Could someone let me know what am I missing here? I am using visual studio 2022.

Body:
I want the build of my project to fail if there are unused usings. In csproj I have added:

<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

Following the solution mentioned in https://github.com/dotnet/roslyn/issues/41640
In .editorconfig I have added:

dotnet_diagnostic.IDE0005.severity = error

However the build still doesn't fail. The errors are reported in the IDE but the build succeeds.

Could someone let me know what am I missing here? I am using visual studio 2022.


问:
App update in AppStore. if I remove the availability in that region
I have a new version that is available in the App Store for update by mistake.

But I want my clients to use the existing version,

can I downgrade the appstore available version? prevent download of new build? or if I remove the availability regions/remove from sale prevents the user to update the new version?


问:
RSS memory equivalent in cgroup v2
I'm trying to write a script which reports a Docker container's memory consumption. I found out I can get these values by reading the cgroup files.

One of the metrics I'm interested in is the RSS memory (memory.rss) from cgroup v1. However, I found that it is not directly available in cgroup v2, which my container is using.

I'm not well-versed in the kernel memory types. In cgroup v1, memory.rss is defined as "# of bytes of anonymous and swap cache memory (includes transparent hugepages)". In cgroup v2, I think it is equal to the sum of

anon (Amount of memory used in anonymous mappings such as brk(), sbrk(), and mmap(MAP_ANONYMOUS)

shmem (Amount of cached filesystem data that is swap-backed, such as tmpfs, shm segments, shared anonymous mmap()s)

Am I right? or did I miss something?

Title: RSS memory equivalent in cgroup v2


问:
How to convert csv file to convert2df using bibliometrix in r
I have bibliometric csv file from wos. Now I want to use it under bibliometrix package using convert2df, I have used the following code

```<code>library(bibliometrix)
data <- read.csv("da.csv",header = TRUE,sep = ",")
N <- convert2df(file=data, dbsource = "wos", format = "csv")
</code>```

but I found an error

```<code>Error in "PY" %in% names(M) : object 'M' not found
</code>```

Body:
I have bibliometric csv file from wos. Now I want to use it under bibliometrix package using convert2df, I have used the following code

library(bibliometrix)
data <- read.csv("da.csv",header = TRUE,sep = ",")
N <- convert2df(file=data, dbsource = "wos", format = "csv")

but I found an error

Error in "PY" %in% names(M) : object 'M' not found


问:
Flutter Dio: Image or File Upload Using Retrofit
i am new to the flutter and i am trying to upload single or multiple images from my Flutter Application using Retrofit via @MultiPart() . I have to upload it using form-data Content-Type, but i am unable to find any good reference for it, can anyone please help me. i am sharing the way i am currently implementing it but i didn't got any success till now

i have tried this
In my @RestApi file i have created a function like below

```<code>@POST('$ENDPOINTS')
@MultiPart()
Future<dynamic> uploadImage(
    @Header("Authorization") authorization,
    @Part(name: 'file') File image,
    @Part(name: 'filetype') String fileType
    );
</code>```

and called this function like

```<code>File file = File(imagePath);

response = await apiClient
    .someClass()
    .uploadImage("myToken", file, "imageType");
</code>```

Can anyone please help

Body:
i am new to the flutter and i am trying to upload single or multiple images from my Flutter Application using Retrofit via @MultiPart() . I have to upload it using form-data Content-Type, but i am unable to find any good reference for it, can anyone please help me. i am sharing the way i am currently implementing it but i didn't got any success till now

i have tried this
In my @RestApi file i have created a function like below

@POST('$ENDPOINTS')
@MultiPart()
Future<dynamic> uploadImage(
    @Header("Authorization") authorization,
    @Part(name: 'file') File image,
    @Part(name: 'filetype') String fileType
    );

and called this function like

File file = File(imagePath);

response = await apiClient
    .someClass()
    .uploadImage("myToken", file, "imageType");

Can anyone please help


问:
Expected sequence or array-like, got <class 'pyspark.sql.dataframe.DataFrame'>
I can't call the value x and y  for train to prediction my data

after i input this variable,

X_Value= df[['% Iron Feed','Ore Pulp pH','Ore Pulp Density']] Y_Value= df['% Iron Concentrate'] X_train, X_test, Y_train, Y_test = train_test_split(X_Value, Y_Value, test_size=0.3, random_state=42)

and this happen

`

```<code>TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_20632\3324427017.py in <module>
----> 1 X_train, X_test, Y_train, Y_test = train_test_split(X_Value, Y_Value, test_size=0.3, random_state=42)

D:\Anaconda\lib\site-packages\sklearn\model_selection\_split.py in train_test_split(test_size, train_size, random_state, shuffle, stratify, *arrays)
   2415         raise ValueError("At least one array required as input")
   2416
-> 2417     arrays = indexable(*arrays)
   2418
   2419     n_samples = _num_samples(arrays[0])

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in indexable(*iterables)
    376
    377     result = [_make_indexable(X) for X in iterables]
--> 378     check_consistent_length(*result)
    379     return result
    380

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in check_consistent_length(*arrays)
    327     """
    328
--> 329     lengths = [_num_samples(X) for X in arrays if X is not None]
    330     uniques = np.unique(lengths)
    331     if len(uniques) > 1:

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in <listcomp>(.0)
    327     """
    328
--> 329     lengths = [_num_samples(X) for X in arrays if X is not None]
    330     uniques = np.unique(lengths)
    331     if len(uniques) > 1:

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in _num_samples(x)
    263             x = np.asarray(x)
    264         else:
--> 265             raise TypeError(message)
    266
    267     if hasattr(x, "shape") and x.shape is not None:

TypeError: Expected sequence or array-like, got <class 'pyspark.sql.dataframe.DataFrame'>
</code>```

`

I try everything like change variable but still no happen

Body:
I can't call the value x and y  for train to prediction my data

after i input this variable,

X_Value= df[['% Iron Feed','Ore Pulp pH','Ore Pulp Density']] Y_Value= df['% Iron Concentrate'] X_train, X_test, Y_train, Y_test = train_test_split(X_Value, Y_Value, test_size=0.3, random_state=42)

and this happen

`

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_20632\3324427017.py in <module>
----> 1 X_train, X_test, Y_train, Y_test = train_test_split(X_Value, Y_Value, test_size=0.3, random_state=42)

D:\Anaconda\lib\site-packages\sklearn\model_selection\_split.py in train_test_split(test_size, train_size, random_state, shuffle, stratify, *arrays)
   2415         raise ValueError("At least one array required as input")
   2416
-> 2417     arrays = indexable(*arrays)
   2418
   2419     n_samples = _num_samples(arrays[0])

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in indexable(*iterables)
    376
    377     result = [_make_indexable(X) for X in iterables]
--> 378     check_consistent_length(*result)
    379     return result
    380

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in check_consistent_length(*arrays)
    327     """
    328
--> 329     lengths = [_num_samples(X) for X in arrays if X is not None]
    330     uniques = np.unique(lengths)
    331     if len(uniques) > 1:

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in <listcomp>(.0)
    327     """
    328
--> 329     lengths = [_num_samples(X) for X in arrays if X is not None]
    330     uniques = np.unique(lengths)
    331     if len(uniques) > 1:

D:\Anaconda\lib\site-packages\sklearn\utils\validation.py in _num_samples(x)
    263             x = np.asarray(x)
    264         else:
--> 265             raise TypeError(message)
    266
    267     if hasattr(x, "shape") and x.shape is not None:

TypeError: Expected sequence or array-like, got <class 'pyspark.sql.dataframe.DataFrame'>

`

I try everything like change variable but still no happen


问:
Looking for an alternative in POSTGRESQL which give windows login username
We need an alternative for oracle function Sys_context('USERENV', 'OS_USER'),which gives Windows username. How to achieve in PostgreSQL. I was able to get only username related to database and not windows login.
Any help would be appreciated.

Below commands tried out gives db username. Looking forward for Windows login username

```<code>SELECT usename FROM pg_user;

select user

SELECT d.datname as "Name",pg_catalog.pg_get_userbyid(d.datdba) as "Owner"
FROM pg_catalog.pg_database d
WHERE d.datname = 'database_name'
ORDER BY 1;
</code>```

Body:
We need an alternative for oracle function Sys_context('USERENV', 'OS_USER'),which gives Windows username. How to achieve in PostgreSQL. I was able to get only username related to database and not windows login.
Any help would be appreciated.

Below commands tried out gives db username. Looking forward for Windows login username

SELECT usename FROM pg_user;

select user

SELECT d.datname as "Name",pg_catalog.pg_get_userbyid(d.datdba) as "Owner"
FROM pg_catalog.pg_database d
WHERE d.datname = 'database_name'
ORDER BY 1;


问:
Can't create Entities with custom entity manager
Symfony 6.2.1

PHP 8.1.2

I tried to create multible entity managers according to https://symfony.com/doc/current/doctrine/multiple_entity_managers.html

content of doctrine.yaml

```<code>doctrine:
dbal:
    default_connection: default
    connections:
        default:
            # configure these for your database server
            url: '%env(resolve:DATABASE_URL)%'
            driver: 'pdo_mysql'
            server_version: '5.7'
            charset: utf8mb4
        customer:
            # configure these for your database server
            url: '%env(resolve:DATABASE_CUSTOMER_URL)%'
            driver: 'pdo_mysql'
            server_version: '5.7'
            charset: utf8mb4
orm:
    default_entity_manager: default
    entity_managers:
        default:
            connection: default
            mappings:
                Main:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Entity/Main'
                    prefix: 'App\Entity\Main'
                    alias: Main
        customer:
            connection: customer
            mappings:
                Customer:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Entity/Customer'
                    prefix: 'App\Entity\Customer'
                    alias: Customer
</code>```

When I try to generate a new entity with my second custom entity manager, it fails.

In my desperation I tried all of the following:

```<code>php bin/console make:entity customer
php bin/console make:entity Customer
php bin/console make:entity 'App\Entity\Customer'
php bin/console make:entity App\\Entity\\Customer
</code>```

All I get is:

Cannot find the entity manager for class
"App\Entity\Customer"

What am I doing wrong?

Body:
Symfony 6.2.1

PHP 8.1.2

I tried to create multible entity managers according to https://symfony.com/doc/current/doctrine/multiple_entity_managers.html

content of doctrine.yaml

doctrine:
dbal:
    default_connection: default
    connections:
        default:
            # configure these for your database server
            url: '%env(resolve:DATABASE_URL)%'
            driver: 'pdo_mysql'
            server_version: '5.7'
            charset: utf8mb4
        customer:
            # configure these for your database server
            url: '%env(resolve:DATABASE_CUSTOMER_URL)%'
            driver: 'pdo_mysql'
            server_version: '5.7'
            charset: utf8mb4
orm:
    default_entity_manager: default
    entity_managers:
        default:
            connection: default
            mappings:
                Main:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Entity/Main'
                    prefix: 'App\Entity\Main'
                    alias: Main
        customer:
            connection: customer
            mappings:
                Customer:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Entity/Customer'
                    prefix: 'App\Entity\Customer'
                    alias: Customer

When I try to generate a new entity with my second custom entity manager, it fails.

In my desperation I tried all of the following:

php bin/console make:entity customer
php bin/console make:entity Customer
php bin/console make:entity 'App\Entity\Customer'
php bin/console make:entity App\\Entity\\Customer

All I get is:

Cannot find the entity manager for class
"App\Entity\Customer"

What am I doing wrong?


问:
typescript use same type with different names to two different functions
I have Prices type like this

interface Prices {
  currentPrice: number;
  totalPrice: number;
}
```
<ul>
<li>I want to use Prices <code>type</code> in some other functions which have different name property.</li>
</ul>
<pre class="lang-js prettyprint-override"><code>const percentage = ({ currentPrice: actual, totalPrice: total }: Prices): string => {
   // do something...
};

const CalculatePercentage = ({ Percentage: percent, totalPrice: total }: Prices): number => { // Here this have different property name - would be error
  // do something...
};
</code>```

Body:
I have Prices type like this

interface Prices {
  currentPrice: number;
  totalPrice: number;
}

I want to use Prices type in some other functions which have different name property.

const percentage = ({ currentPrice: actual, totalPrice: total }: Prices): string => {
   // do something...
};

const CalculatePercentage = ({ Percentage: percent, totalPrice: total }: Prices): number => { // Here this have different property name - would be error
  // do something...
};


问:
How can I write a Python code with openCV that detects and counts the bones of hand?
I am trying to write a python code with openCV to detect and count the bones of hand, and then find the area of detected bones.Same program should also apply for both hands, hand with a 6 finger, or images that also include shapes(like rectange or circle) in the background. Note that we can only use openCV or similar libraries, not libraries like tensorflow or keras for deep learning.

Here is an example images:

2 Hand Bones:

One hand but 6 fingers:

Here is my progress:

```<code>image = cv2.imread('Testbild3.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
plt.imshow(gray, cmap='gray')
</code>```
```<code>blur = cv2.GaussianBlur(gray, (11, 11),2)
plt.imshow(blur, cmap='gray')
</code>```
```<code>img = image.copy()

circles = cv2.HoughCircles(blur ,cv2.HOUGH_GRADIENT,1,40,
                            param1=40,param2=20,minRadius=16,maxRadius=82)
circles = np.uint16(np.around(circles))
for i in circles[0,:]:
    # draw the outer circle
    cv2.circle(img,(i[0],i[1]),i[2],(0,255,0),2)
    # draw the center of the circle
    cv2.circle(img,(i[0],i[1]),2,(0,0,255),3)
plt.imshow(img)
</code>```

Here is the result I am getting:

I was expecting good circles around the bones so that I can count the bones and find their areas.

What can I do differently?

Body:
I am trying to write a python code with openCV to detect and count the bones of hand, and then find the area of detected bones.Same program should also apply for both hands, hand with a 6 finger, or images that also include shapes(like rectange or circle) in the background. Note that we can only use openCV or similar libraries, not libraries like tensorflow or keras for deep learning.

Here is an example images:

2 Hand Bones:

One hand but 6 fingers:

Here is my progress:

image = cv2.imread('Testbild3.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
plt.imshow(gray, cmap='gray')

blur = cv2.GaussianBlur(gray, (11, 11),2)
plt.imshow(blur, cmap='gray')

img = image.copy()

circles = cv2.HoughCircles(blur ,cv2.HOUGH_GRADIENT,1,40,
                            param1=40,param2=20,minRadius=16,maxRadius=82)
circles = np.uint16(np.around(circles))
for i in circles[0,:]:
    # draw the outer circle
    cv2.circle(img,(i[0],i[1]),i[2],(0,255,0),2)
    # draw the center of the circle
    cv2.circle(img,(i[0],i[1]),2,(0,0,255),3)
plt.imshow(img)

Here is the result I am getting:

I was expecting good circles around the bones so that I can count the bones and find their areas.

What can I do differently?


问:
c# Open file with Process.Start and show Previous and Next button in MS Photos app
I need to open files for which I don't know the extension. I use Process.Start() to open the file in the default program. And it works but there is a problem.

If I open an image (from a folder that contain several images) directly from Windows Explorer, in the MS Photos App there are the two buttons "Previous" and "Next". So i can go to the next picture directly from the MS Photos App.

But if I open the same image with Process.Start() there is no "Previous" and "Next" buttons.

I already found this thread here but without solution https://csharpforums.net/threads/process-start-more-image.5557/

It seems that it was working with Windows 7 but no more with Windows 10.


问:
Deleting item and reinserting them , is there a better way?
in an existing application, I need to perform a post on a product item and update/add some related entities accordingly. It's code that was just present and the schema il widely used but I don't like it really.. maybe you can help me to understand if it's correct or if there's a better way of doing that.

var product = await _productRepository.TrackingQueryableSelect(f => f.Id == request.Id,
        i => i.ProductCategories,
        i => i.GuidePrices,
        i => i.ProductWebSiteMappings,
        i => i.ProductAssociatedProducts).SingleAsync(ct)
```
<p>This retrieves the product and the related entities that will be erased, then reinserted from the model passed to the <code>UpdateAsync</code> method</p>
<p>down in the code there are those lines of code</p>
<pre class="lang-cs prettyprint-override"><code>if (request.Categories is { Count: > 0 })
{
    product.ProductCategories.ToList().ForEach(async x => await _productCategoryRepository.DeleteAsync(x, ct));

    //_productCategoryRepository.DeleteAll(product.ProductCategories.ToList());
    product.ProductCategories = request.Categories.Select(s => new ProductCategory()
    {
        CategoryId = s,
        DisplayOrder = 1
    }).ToList();
}

if (request.ProductWebSiteMappings != null)
{
    await _productWebSiteMappingRepository.DeleteRangeAsync(product.ProductWebSiteMappings.ToList(), ct);
    product.ProductWebSiteMappings = request.ProductWebSiteMappings.Select(s => new ProductWebSiteMapping()
    {
        WebSite = s.WebSite,
        ProductId = product.Id
    }).ToList();
}
</code>```

The questions are, it's correct to do so, or it's best just to load the main entity then performing a delete on the related where the ProductId is equals to the one of the Product?
Also I think that here multiple single delete are done, since the implementation of DeleteAsync is

public async Task<bool> DeleteAsync(TEntity entity, CancellationToken ct = default)
{
    if (await IsExistsAsync(entity.Id, ct))
    {
        _context.Remove(entity);
        return true;
    }
    else
    {
        throw new Exception($"Entity with id {entity.Id} not found!");
    }
}
```
<p>and the DeleteRangeAsync is</p>
<pre class="lang-cs prettyprint-override"><code>public async Task DeleteRangeAsync(IEnumerable<TEntity> entities, CancellationToken ct = default)
{
    foreach (var entity in entities)
    {
        await DeleteAsync(entity, ct);
    }
}
</code>```

At the end a call to the    await _unitOfWork.SaveAsync(ct); is done

Any suggestion on how to optimize that?

Body:
in an existing application, I need to perform a post on a product item and update/add some related entities accordingly. It's code that was just present and the schema il widely used but I don't like it really.. maybe you can help me to understand if it's correct or if there's a better way of doing that.

var product = await _productRepository.TrackingQueryableSelect(f => f.Id == request.Id,
        i => i.ProductCategories,
        i => i.GuidePrices,
        i => i.ProductWebSiteMappings,
        i => i.ProductAssociatedProducts).SingleAsync(ct)

This retrieves the product and the related entities that will be erased, then reinserted from the model passed to the UpdateAsync method

down in the code there are those lines of code

if (request.Categories is { Count: > 0 })
{
    product.ProductCategories.ToList().ForEach(async x => await _productCategoryRepository.DeleteAsync(x, ct));

    //_productCategoryRepository.DeleteAll(product.ProductCategories.ToList());
    product.ProductCategories = request.Categories.Select(s => new ProductCategory()
    {
        CategoryId = s,
        DisplayOrder = 1
    }).ToList();
}

if (request.ProductWebSiteMappings != null)
{
    await _productWebSiteMappingRepository.DeleteRangeAsync(product.ProductWebSiteMappings.ToList(), ct);
    product.ProductWebSiteMappings = request.ProductWebSiteMappings.Select(s => new ProductWebSiteMapping()
    {
        WebSite = s.WebSite,
        ProductId = product.Id
    }).ToList();
}

The questions are, it's correct to do so, or it's best just to load the main entity then performing a delete on the related where the ProductId is equals to the one of the Product?
Also I think that here multiple single delete are done, since the implementation of DeleteAsync is

public async Task<bool> DeleteAsync(TEntity entity, CancellationToken ct = default)
{
    if (await IsExistsAsync(entity.Id, ct))
    {
        _context.Remove(entity);
        return true;
    }
    else
    {
        throw new Exception($"Entity with id {entity.Id} not found!");
    }
}

and the DeleteRangeAsync is

public async Task DeleteRangeAsync(IEnumerable<TEntity> entities, CancellationToken ct = default)
{
    foreach (var entity in entities)
    {
        await DeleteAsync(entity, ct);
    }
}

At the end a call to the    await _unitOfWork.SaveAsync(ct); is done

Any suggestion on how to optimize that?


问:
Using tomcat-native (homebrew) with eclipse (Java 11) on Apple M1 Pro
This is my first posting here. I am using a new Apple M1 Pro and I installed Eclipse, java 11 from amazon, tomcat 9 and tomcat-native via homebrew.

My configuration of tomcat works fine, but I want to add tomcat-native to use SSL.

I installed tomcat-native via homebrew to this directory:
/opt/homebrew/opt/tomcat-native/lib/ which links to /opt/homebrew/Cellar/tomcat-native/2.0.2/lib

Then I added in the eclipse configuration the JVM-Parameter:

-Djava.library.path=/opt/homebrew/opt/tomcat-native/lib/

When I start the tomcat service via eclipse tomcat plugin (version 9.1.4) I get the following exception:

WARNING: The Apache Tomcat Native library failed to load. The error reported was [no tcnative-2 in java.library.path: [/opt/homebrew/opt/tomcat-native/lib/]]
java.lang.UnsatisfiedLinkError: no tcnative-2 in java.library.path: [/opt/homebrew/opt/tomcat-native/lib/]

I used this configuration on my "older" macbook and it works. Has someone an idea, so that we can solve my problem?

regards

Florian

Notes:

I tried to reinstall all components, update the components, change to another newest eclipse version, search for the failure, but didn't found any solution, especially on Mac M1 Pro.


问:
Flutter table how to add pagination? and Checkbox value how to stored in firebase database?
Flutter table created Then , Adding the tablePaginator package Code how to connect the table and tablepaginator. how to store checkbox values in firebase database</p>


问:
how to zoom image equal to map zoom level in mapbox
I want to decrease the size of the image when the zoom level of the map is decrease . How can I achieve this?
Here I want zoom image equal to map zoom level
Thanks in advance</p>
```<code>map.value.map.on('load', () => {
// Load an image from an external URL.
  map.value.map.loadImage(
  'https://docs.mapbox.com/mapbox-gl-js/assets/cat.png',
  (error, image) => {
  if (error) throw error;

  // Add the image to the map style.
  map.value.map.addImage('cat', image);

  // Add a data source containing one point feature.
  map.value.map.addSource('point', {
  'type': 'geojson',
  'data': {
  'type': 'FeatureCollection',
  'features': [
  {
  'type': 'Feature',
  'geometry': {
  'type': 'Point',
  'coordinates': [-112.1, 33.5]
  }
  }
  ]
  }
  });

  // Add a layer to use the image to represent the data.
  map.value.map.addLayer({
  'id': 'b7',
  'type': 'symbol',
  'source': 'point', // reference the data source
  'layout': {
  'icon-image': 'cat', // reference the image
  'icon-size': ['interpolate', ['linear'], ['zoom'], 0.5, 15, 1, 10]
  }
  });
  }
  );
  });

</code>```

Body:
I want to decrease the size of the image when the zoom level of the map is decrease . How can I achieve this?
Here I want zoom image equal to map zoom level
Thanks in advance

map.value.map.on('load', () => {
// Load an image from an external URL.
  map.value.map.loadImage(
  'https://docs.mapbox.com/mapbox-gl-js/assets/cat.png',
  (error, image) => {
  if (error) throw error;

  // Add the image to the map style.
  map.value.map.addImage('cat', image);

  // Add a data source containing one point feature.
  map.value.map.addSource('point', {
  'type': 'geojson',
  'data': {
  'type': 'FeatureCollection',
  'features': [
  {
  'type': 'Feature',
  'geometry': {
  'type': 'Point',
  'coordinates': [-112.1, 33.5]
  }
  }
  ]
  }
  });

  // Add a layer to use the image to represent the data.
  map.value.map.addLayer({
  'id': 'b7',
  'type': 'symbol',
  'source': 'point', // reference the data source
  'layout': {
  'icon-image': 'cat', // reference the image
  'icon-size': ['interpolate', ['linear'], ['zoom'], 0.5, 15, 1, 10]
  }
  });
  }
  );
  });


问:
LLVM cmake find_package throws a error that libedit is not found! How to fix it?
I have a small project where I want to use the LLVM IR API. So I made a new cmake project on my wls (host machine is windows) installing the llvm-15 package. An starting to code a basic cmake file.

But following line produces a error in my cmake file:

```<code>find_package(LLVM 15 REQUIRED CONFIG)
</code>```

It produces following error:

```<code>C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/bash -c "export CMAKE_COLOR_DIAGNOSTICS=ON && export CLION_IDE=TRUE && export JETBRAINS_IDE=TRUE && cd /mnt/d/git/llvm-antlr4-starter/cmake-build-debug-wsl && /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G 'CodeBlocks - Unix Makefiles' -S /mnt/d/git/llvm-antlr4-starter -B /mnt/d/git/llvm-antlr4-starter/cmake-build-debug-wsl"
-- Found LLVM 15.0.6
-- Using LLVMConfig.cmake in: /usr/lib/llvm-15/cmake
CMake Warning (dev) at /usr/share/cmake-3.25/Modules/ExternalProject.cmake:2255 (message):
  Policy CMP0114 is not set: ExternalProject step targets fully adopt their
  steps.  Run "cmake --help-policy CMP0114" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  ExternalProject target 'antlr4_runtime' would depend on the targets for
  step(s) 'build_static' under policy CMP0114, but this is being left out for
  compatibility since the policy is not set.
Call Stack (most recent call first):
  CMakeLists.txt:149 (ExternalProject_Add_StepTargets)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake-3.25/Modules/ExternalProject.cmake:2255 (message):
  Policy CMP0114 is not set: ExternalProject step targets fully adopt their
  steps.  Run "cmake --help-policy CMP0114" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  ExternalProject target 'antlr4_runtime' would depend on the targets for
  step(s) 'build_shared' under policy CMP0114, but this is being left out for
  compatibility since the policy is not set.
Call Stack (most recent call first):
  CMakeLists.txt:166 (ExternalProject_Add_StepTargets)
This warning is for project developers.  Use -Wno-dev to suppress it.

LLVM_INCLUDE_DIRS: /usr/lib/llvm-15/include
-- Configuring done
CMake Error at /usr/lib/llvm-15/lib/cmake/llvm/LLVMExports.cmake:1198 (set_target_properties):
  The link interface of target "LLVMLineEditor" contains:

    LibEdit::LibEdit

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /usr/lib/llvm-15/cmake/LLVMConfig.cmake:336 (include)
  CMakeLists.txt:7 (find_package)

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

[Finished]

</code>```

I installed libediit and tried to include libedit manually but that doesn't produce just more errors that he cant find it.

Now I don't know how I can fix the code, reinstalling llvm-15 does not work too.
Thank you in advance!

EDIT:
Temporary fix is to use LLVM 12 instead of LLVM 15, but well obviously thats not a true solution. So hope someone has an idea to fix the problem

Body:
I have a small project where I want to use the LLVM IR API. So I made a new cmake project on my wls (host machine is windows) installing the llvm-15 package. An starting to code a basic cmake file.

But following line produces a error in my cmake file:

find_package(LLVM 15 REQUIRED CONFIG)

It produces following error:

C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/bash -c "export CMAKE_COLOR_DIAGNOSTICS=ON && export CLION_IDE=TRUE && export JETBRAINS_IDE=TRUE && cd /mnt/d/git/llvm-antlr4-starter/cmake-build-debug-wsl && /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G 'CodeBlocks - Unix Makefiles' -S /mnt/d/git/llvm-antlr4-starter -B /mnt/d/git/llvm-antlr4-starter/cmake-build-debug-wsl"
-- Found LLVM 15.0.6
-- Using LLVMConfig.cmake in: /usr/lib/llvm-15/cmake
CMake Warning (dev) at /usr/share/cmake-3.25/Modules/ExternalProject.cmake:2255 (message):
  Policy CMP0114 is not set: ExternalProject step targets fully adopt their
  steps.  Run "cmake --help-policy CMP0114" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  ExternalProject target 'antlr4_runtime' would depend on the targets for
  step(s) 'build_static' under policy CMP0114, but this is being left out for
  compatibility since the policy is not set.
Call Stack (most recent call first):
  CMakeLists.txt:149 (ExternalProject_Add_StepTargets)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake-3.25/Modules/ExternalProject.cmake:2255 (message):
  Policy CMP0114 is not set: ExternalProject step targets fully adopt their
  steps.  Run "cmake --help-policy CMP0114" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  ExternalProject target 'antlr4_runtime' would depend on the targets for
  step(s) 'build_shared' under policy CMP0114, but this is being left out for
  compatibility since the policy is not set.
Call Stack (most recent call first):
  CMakeLists.txt:166 (ExternalProject_Add_StepTargets)
This warning is for project developers.  Use -Wno-dev to suppress it.

LLVM_INCLUDE_DIRS: /usr/lib/llvm-15/include
-- Configuring done
CMake Error at /usr/lib/llvm-15/lib/cmake/llvm/LLVMExports.cmake:1198 (set_target_properties):
  The link interface of target "LLVMLineEditor" contains:

    LibEdit::LibEdit

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /usr/lib/llvm-15/cmake/LLVMConfig.cmake:336 (include)
  CMakeLists.txt:7 (find_package)

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

[Finished]

I installed libediit and tried to include libedit manually but that doesn't produce just more errors that he cant find it.

Now I don't know how I can fix the code, reinstalling llvm-15 does not work too.
Thank you in advance!

EDIT:
Temporary fix is to use LLVM 12 instead of LLVM 15, but well obviously thats not a true solution. So hope someone has an idea to fix the problem


问:
newman postman runner duplicating executions
I am currently running a cloud postman collection which takes through csv data, but when I look at the report (json) it's duplicating the executions (see screenshot).
iteration 0
iteration 1

I've tried using different reporters and it returns the same duplication.
(Reporters used: json,junitfull,execution-lite.
But Cli/Command line shows correct number of executions.

Interestingly if I try an older postman collection (e.g. one created a few months ago) it doesn't duplicate.

Has anyone else come across this? -
I have worked my way around it, as I'm extracting the assertions using powershell, but it's just odd behaviour.

(Postman Version is 10.6, Newman is 5.3.2)

I have tried:
Running older collections. Duplication doesn't appear.
Creating new collection from scratch. Duplication does appear

Using different Reporters. Duplication does appear.

I was expecting only one execution per request, but it is duplicating in results the requests. It is not sending the requests twice. (Proven be POST requests. The assertions return identicial Clients created)


问:
Nested loop in print() (while and for)
I need help with loop inside print().
I have a task:
Interpreter must output first three words that user's input.
How to make it run until an empty string is entered? I know, how code it in few string, but I need only one string</p>
```<code>print(" ".join(input().split(maxsplit=3)[:3]))
</code>```

Title: Nested loop in print() (while and for)

Body:
I need help with loop inside print().
I have a task:
Interpreter must output first three words that user's input.
How to make it run until an empty string is entered? I know, how code it in few string, but I need only one string

print(" ".join(input().split(maxsplit=3)[:3]))


问:
Τell the difference between a direct push commit and a merge commit on GitHub
I want to run a GitHub action on push.

I want however to be able to tell the difference between a direct push and a Pull Request merge. (I don't want my workflow to run on the second case)

I have found a workaround, by allowing only Merge with Squash in which case the head commit produced has the following details in the github.event

```<code>  "committer": {
    "email": "noreply@github.com",
    "name": "GitHub",
    "username": "web-flow"
  },
</code>```

Is there any workaround in case I want to avoid squashes?

Body:
I want to run a GitHub action on push.

I want however to be able to tell the difference between a direct push and a Pull Request merge. (I don't want my workflow to run on the second case)

I have found a workaround, by allowing only Merge with Squash in which case the head commit produced has the following details in the github.event

  "committer": {
    "email": "noreply@github.com",
    "name": "GitHub",
    "username": "web-flow"
  },

Is there any workaround in case I want to avoid squashes?


问:
Get the index upon insertion in SplayTreeSet in dart
I have a SplayTreeSet  in dart and I was wondering wether I could get the position where the object is inserted.

Usually I would know it as length - 1, but since in SplayTreeSet are sorted, I am not sure the item will end up at the end. Is there a way I could get the index upon insertion without looking for it in a second moment?


问:
UI Automation Performance
I see that traversing UI Tree of of any Application, that supports UI Automation and has about 1k elements, takes time in excess of 8 seconds at least, using UI Automation COM library. Tree Walk is done using Control Walker. I understand it involves inter-process communication to make a call like FindAll and then retrieve further properties.

The response time differs from Application to Application, however, the best I see is still more than aforementioned time.

I tried UI Automation Caching (below sample), however, the initial Tree walk still incurs cost of over 7-8 seconds as well Caching the Parent's properties is not a possibility (or at least I could not get it from Cache even using different types of traversals like TreeScope Descendants and Element or a combination). Just a sample code where I try to Create Condition array on all the available Controls and expecting some Properties to be Cached. The Application has about 1500 controls of which about 800 are visible. It takes roughly 9 seconds for Cache to build up.

```<code>    private static IUIAutomationCacheRequest BuildCacheRequest()
    {
        IUIAutomationCacheRequest cacheRequest = _automation.CreateCacheRequest();
        cacheRequest.AddProperty(UIA_PropertyIds.UIA_ControlTypePropertyId);
        cacheRequest.AddProperty(UIA_PropertyIds.UIA_AutomationIdPropertyId);
        ....
        return cacheRequest;
    }
    private static IUIAutomationCondition BuildConditionArray()
    {
        IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[40];
        int controlType = 50000;

        for (int i = 0; i < 40; i++)
        {
            conditionArray[i] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, controlType);
            controlType += 1;
        }

        return _automation.CreateOrConditionFromArray(conditionArray);
    }

    private static IUIAutomationElementArray FindAllDescendantsBuildCache(IUIAutomationElement element, IUIAutomationCacheRequest cacheRequest, IUIAutomationCondition conditionArray)
    {
        IUIAutomationCondition[] condArr = new IUIAutomationCondition[2];
        condArr[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_IsOffscreenPropertyId, false);
        condArr[0] = conditionArray;
        cacheRequest.AutomationElementMode = AutomationElementMode.AutomationElementMode_None;
        cacheRequest.TreeFilter = _automation.ControlViewCondition;

        var cachedElements = element.FindAllBuildCache(TreeScope.TreeScope_Descendants,
         _automation.CreateAndConditionFromArray(condArr), cacheRequest);
        return cachedElements;
    }
</code>```

Once Cached, response time is much faster, understandably.

Question I have -

Is there any possibility to Traverse UI Tree carrying about 2k elements within a second or two using UI Automation (or even otherwise)?
I also look to identify the traversed Elements through their properties, just like Properties' support from UI Automation

Just as a side note, I have tried to use Win32 API at basic level like using EnumChildWindows, however, even that doesn't yield Control handles on different Types of Desktop Frameworks like Electron or WPF.

Title: UI Automation Performance

Body:
I see that traversing UI Tree of of any Application, that supports UI Automation and has about 1k elements, takes time in excess of 8 seconds at least, using UI Automation COM library. Tree Walk is done using Control Walker. I understand it involves inter-process communication to make a call like FindAll and then retrieve further properties.

The response time differs from Application to Application, however, the best I see is still more than aforementioned time.

I tried UI Automation Caching (below sample), however, the initial Tree walk still incurs cost of over 7-8 seconds as well Caching the Parent's properties is not a possibility (or at least I could not get it from Cache even using different types of traversals like TreeScope Descendants and Element or a combination). Just a sample code where I try to Create Condition array on all the available Controls and expecting some Properties to be Cached. The Application has about 1500 controls of which about 800 are visible. It takes roughly 9 seconds for Cache to build up.

    private static IUIAutomationCacheRequest BuildCacheRequest()
    {
        IUIAutomationCacheRequest cacheRequest = _automation.CreateCacheRequest();
        cacheRequest.AddProperty(UIA_PropertyIds.UIA_ControlTypePropertyId);
        cacheRequest.AddProperty(UIA_PropertyIds.UIA_AutomationIdPropertyId);
        ....
        return cacheRequest;
    }
    private static IUIAutomationCondition BuildConditionArray()
    {
        IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[40];
        int controlType = 50000;

        for (int i = 0; i < 40; i++)
        {
            conditionArray[i] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, controlType);
            controlType += 1;
        }

        return _automation.CreateOrConditionFromArray(conditionArray);
    }

    private static IUIAutomationElementArray FindAllDescendantsBuildCache(IUIAutomationElement element, IUIAutomationCacheRequest cacheRequest, IUIAutomationCondition conditionArray)
    {
        IUIAutomationCondition[] condArr = new IUIAutomationCondition[2];
        condArr[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_IsOffscreenPropertyId, false);
        condArr[0] = conditionArray;
        cacheRequest.AutomationElementMode = AutomationElementMode.AutomationElementMode_None;
        cacheRequest.TreeFilter = _automation.ControlViewCondition;

        var cachedElements = element.FindAllBuildCache(TreeScope.TreeScope_Descendants,
         _automation.CreateAndConditionFromArray(condArr), cacheRequest);
        return cachedElements;
    }

Once Cached, response time is much faster, understandably.

Question I have -

Is there any possibility to Traverse UI Tree carrying about 2k elements within a second or two using UI Automation (or even otherwise)?
I also look to identify the traversed Elements through their properties, just like Properties' support from UI Automation

Just as a side note, I have tried to use Win32 API at basic level like using EnumChildWindows, however, even that doesn't yield Control handles on different Types of Desktop Frameworks like Electron or WPF.


问:
How to get word timestamp given an audio and its transcript?
Hi I am working on timestamp generation for my transcript. I have already had the transcript.

I am wondering if there is more accurate way to get timestamp besides algorithms like Montreal-forced-alignment. They have some accuracy issue to me.


问:
Simple Proxy Server in Flutter
Can We Create proxy app to connect with custom proxy servers in flutter?

I have tried flutter_vpn package on pub dev
but want to create custom proxy app that can connect with custom proxy server and also able to set proxy per specific apps in flutter
is it possible with flutter?

Title: Simple Proxy Server in Flutter


问:
Getting Config not Found on Screen while running npm run dev on next project
I am getting a bug called config not found on screen and there are lot of errors in console on running npm run dev while running the new Next.js Project on my computer. Please help me out with following error

The Project contains readme file which have following steps listed to setup the project. I have done all these steps to run the project as they are listed.

enter image description here

**the errors are following on npm run dev after opening the localhost:5000

error pic 1 enter image description here

error pic 2 enter image description here

error pic 3 enter image description here

error pic 4 enter image description here

Image of screen while running npm run dev

enter image description here

I have completed all these steps to run the project as these are written in readme file


问:
When I try to import TensorFlow in Jupyter notebook I get the following error:
In Jupyter Notebook, I have written the code as below:

```<code>    import tensorflow as tf
    import os
    import cv2
    import imghdr
    from matplotlib import pyplot as plt
    import numpy as np
    from tensorflow.keras.models import Sequential
    from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Flatten, Dropout
    from tensorflow.keras.metrics import Precision, Recall, BinaryAccuracy
    from tensorflow.keras.models import load_model
    from tensorflow import keras
</code>```

When I run the code segment, below output is shown:

```<code>WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.autotrackable has been moved to tensorflow.python.trackable.autotrackable. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.base has been moved to tensorflow.python.trackable.base. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.base_delegate has been moved to tensorflow.python.trackable.base_delegate. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.data_structures has been moved to tensorflow.python.trackable.data_structures. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.graph_view has been moved to tensorflow.python.checkpoint.graph_view. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.util has been moved to tensorflow.python.checkpoint.checkpoint. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.checkpoint_management has been moved to tensorflow.python.checkpoint.checkpoint_management. The old module will be deleted in version 2.9.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_7248/3644658907.py in <module>
----> 1 import tensorflow as tf
      2 import os
      3 import cv2
      4 import imghdr
      5 from matplotlib import pyplot as plt

~\anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
     49 from ._api.v2 import autograph
     50 from ._api.v2 import bitwise
---> 51 from ._api.v2 import compat
     52 from ._api.v2 import config
     53 from ._api.v2 import data

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\__init__.py in <module>
     35 import sys as _sys
     36
---> 37 from . import v1
     38 from . import v2
     39 from tensorflow.python.compat.compat import forward_compatibility_horizon

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\__init__.py in <module>
     28 from . import autograph
     29 from . import bitwise
---> 30 from . import compat
     31 from . import config
     32 from . import data

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\compat\__init__.py in <module>
     35 import sys as _sys
     36
---> 37 from . import v1
     38 from . import v2
     39 from tensorflow.python.compat.compat import forward_compatibility_horizon

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\compat\v1\__init__.py in <module>
     29 from tensorflow._api.v2.compat.v1 import autograph
     30 from tensorflow._api.v2.compat.v1 import bitwise
---> 31 from tensorflow._api.v2.compat.v1 import config
     32 from tensorflow._api.v2.compat.v1 import data
     33 from tensorflow._api.v2.compat.v1 import debugging

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\config\__init__.py in <module>
     12 from tensorflow.python.eager.context import LogicalDeviceConfiguration
     13 from tensorflow.python.eager.context import PhysicalDevice
---> 14 from tensorflow.python.eager.def_function import experimental_functions_run_eagerly
     15 from tensorflow.python.eager.def_function import experimental_run_functions_eagerly
     16 from tensorflow.python.eager.def_function import functions_run_eagerly

ImportError: cannot import name 'experimental_functions_run_eagerly' from 'tensorflow.python.eager.def_function' (C:\Users\HP\anaconda3\lib\site-packages\tensorflow\python\eager\def_function.py)
</code>```

The latest version of TensorFlow is to be installed in WLS2 for operating systems Windows 10 or above.
Refer: https://www.tensorflow.org/install/pip
I have correctly followed the steps from the above link. Even though I am getting the issue repeatedly.

I tried installing TensorFlow in Conda environment, but the error persists.
[Installed TensorFlow in Conda env] (https://i.stack.imgur.com/fnRpZ.png)

My laptop has:
Windows 11 Home
Intel Graphics Card
python=3.11.1

Body:
In Jupyter Notebook, I have written the code as below:

    import tensorflow as tf
    import os
    import cv2
    import imghdr
    from matplotlib import pyplot as plt
    import numpy as np
    from tensorflow.keras.models import Sequential
    from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Flatten, Dropout
    from tensorflow.keras.metrics import Precision, Recall, BinaryAccuracy
    from tensorflow.keras.models import load_model
    from tensorflow import keras

When I run the code segment, below output is shown:

WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.autotrackable has been moved to tensorflow.python.trackable.autotrackable. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.base has been moved to tensorflow.python.trackable.base. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.base_delegate has been moved to tensorflow.python.trackable.base_delegate. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.data_structures has been moved to tensorflow.python.trackable.data_structures. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.graph_view has been moved to tensorflow.python.checkpoint.graph_view. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.tracking.util has been moved to tensorflow.python.checkpoint.checkpoint. The old module will be deleted in version 2.11.
WARNING:tensorflow:Please fix your imports. Module tensorflow.python.training.checkpoint_management has been moved to tensorflow.python.checkpoint.checkpoint_management. The old module will be deleted in version 2.9.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_7248/3644658907.py in <module>
----> 1 import tensorflow as tf
      2 import os
      3 import cv2
      4 import imghdr
      5 from matplotlib import pyplot as plt

~\anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
     49 from ._api.v2 import autograph
     50 from ._api.v2 import bitwise
---> 51 from ._api.v2 import compat
     52 from ._api.v2 import config
     53 from ._api.v2 import data

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\__init__.py in <module>
     35 import sys as _sys
     36
---> 37 from . import v1
     38 from . import v2
     39 from tensorflow.python.compat.compat import forward_compatibility_horizon

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\__init__.py in <module>
     28 from . import autograph
     29 from . import bitwise
---> 30 from . import compat
     31 from . import config
     32 from . import data

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\compat\__init__.py in <module>
     35 import sys as _sys
     36
---> 37 from . import v1
     38 from . import v2
     39 from tensorflow.python.compat.compat import forward_compatibility_horizon

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\compat\v1\__init__.py in <module>
     29 from tensorflow._api.v2.compat.v1 import autograph
     30 from tensorflow._api.v2.compat.v1 import bitwise
---> 31 from tensorflow._api.v2.compat.v1 import config
     32 from tensorflow._api.v2.compat.v1 import data
     33 from tensorflow._api.v2.compat.v1 import debugging

~\anaconda3\lib\site-packages\tensorflow\_api\v2\compat\v1\config\__init__.py in <module>
     12 from tensorflow.python.eager.context import LogicalDeviceConfiguration
     13 from tensorflow.python.eager.context import PhysicalDevice
---> 14 from tensorflow.python.eager.def_function import experimental_functions_run_eagerly
     15 from tensorflow.python.eager.def_function import experimental_run_functions_eagerly
     16 from tensorflow.python.eager.def_function import functions_run_eagerly

ImportError: cannot import name 'experimental_functions_run_eagerly' from 'tensorflow.python.eager.def_function' (C:\Users\HP\anaconda3\lib\site-packages\tensorflow\python\eager\def_function.py)

The latest version of TensorFlow is to be installed in WLS2 for operating systems Windows 10 or above.
Refer: https://www.tensorflow.org/install/pip
I have correctly followed the steps from the above link. Even though I am getting the issue repeatedly.

I tried installing TensorFlow in Conda environment, but the error persists.
[Installed TensorFlow in Conda env] (https://i.stack.imgur.com/fnRpZ.png)

My laptop has:
Windows 11 Home
Intel Graphics Card
python=3.11.1


问:
How to register commands in bundle only on dev environment
So I have symfony 4.4 application and I would like to add new bundle that would be used only in dev environment to help with testing some backend functionalities. I would like this bundle to have commands that could be run on this dev enviroment only. On production enviroment such commands should be either not registered either disabled. Depends on implementation but overall goal here is to not be able to run such commands on production.

I know that such thing could be implemented by adding such check to command. But thing is that I would like not to have to add every time such lines. It should be done somehow automatically in other place. So when I would add 5 commands those 5 commands in bundle would be able to run only on dev environment

How can I achieve those 2 goals?


问:
What is returned in the function

def frame(self,src=0):
   if self.isOpened():
      (ret, frame) = self.read()
   if not ret:
      print('Failed to Capture Video.........')
   return frame
```

I am using this function to get this

frame1 = Thread(target = frame(cam1))

When using Frame1 for cv2.imshow("Capture", frame1), it is returning a error.

I was expecting to see the video output

Title: What is returned in the function

Body:
def frame(self,src=0):
   if self.isOpened():
      (ret, frame) = self.read()
   if not ret:
      print('Failed to Capture Video.........')
   return frame

I am using this function to get this

frame1 = Thread(target = frame(cam1))

When using Frame1 for cv2.imshow("Capture", frame1), it is returning a error.

I was expecting to see the video output


问:
Installing already existing laravel application with private packages
One of my teammates created a Laravel application which uses a few private packages and also uses laravel sail. The composer.json file contains this:

```<code>    "repositories": [
        {
            "type": "composer",
            "url": "URL TO SATIS PRIVATE REPOS HERE"
        }
    ],
</code>```

According to laravel sail documentation, the way to install dependencies on an already existing application is this:

```<code>docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs
</code>```

However, when i run it it fails when it tries to install the first private package and shows the following message:

Failed to execute git clone --mirror -- 'git@bitbucket.org:PACKAGENAME' '/.composer/cache/vcs/git-bitbucket.org-org:PACKAGENAME'

fatal: could not create leading directories of '/.composer/cache/vcs/git-bi tbucket.org-PACKAGENAME'

My teammate told me that when he was installing the packages (via sail composer require privatepackagename) it was asked for auth details and in my case is not asking for anything.

If tried to pass my ssh keys to the command but no success:

```<code>docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -v "/path/to/.ssh/id_rsa:/home/sail/.ssh/id_rsa" \
    -v "/path/to/.ssh/id_rsa.pub:/home/sail/.ssh/id_rsa.pub" \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs
</code>```

Am I missing something?

Thanks in advance

Body:
One of my teammates created a Laravel application which uses a few private packages and also uses laravel sail. The composer.json file contains this:

    "repositories": [
        {
            "type": "composer",
            "url": "URL TO SATIS PRIVATE REPOS HERE"
        }
    ],

According to laravel sail documentation, the way to install dependencies on an already existing application is this:

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs

However, when i run it it fails when it tries to install the first private package and shows the following message:

Failed to execute git clone --mirror -- 'git@bitbucket.org:PACKAGENAME' '/.composer/cache/vcs/git-bitbucket.org-org:PACKAGENAME'

fatal: could not create leading directories of '/.composer/cache/vcs/git-bi tbucket.org-PACKAGENAME'

My teammate told me that when he was installing the packages (via sail composer require privatepackagename) it was asked for auth details and in my case is not asking for anything.

If tried to pass my ssh keys to the command but no success:

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -v "/path/to/.ssh/id_rsa:/home/sail/.ssh/id_rsa" \
    -v "/path/to/.ssh/id_rsa.pub:/home/sail/.ssh/id_rsa.pub" \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs

Am I missing something?

Thanks in advance


问:
Using Cloudfront, how can I route based on Host on the server?
We want to use Cloudfront on our API server where we used to use only our existing ALB.
The existing structure is:

```<code>Internet -> ALB -> Istio Gateway -> API Server
</code>```

Here, the Istio Gateway was routing traffic to the appropriate server based on Host.

The structure you want going forward is:

```<code>Internet -> CloudFront -> ALB -> Istio Gateway -> API Server
</code>```

Originally, we used only ALB, so the DNS called by the client was used as the routing standard in the Istio Gateway. But here, when CloudFront calls ALB, which host DNS should we route in Istio Gateway?
Should I host based on the global hostname requested by the client, or should I use the DNS name of the ALB that CloudFront uses when making requests to the ALB as the routing condition for the Istio Gateway?

Body:
We want to use Cloudfront on our API server where we used to use only our existing ALB.
The existing structure is:

Internet -> ALB -> Istio Gateway -> API Server

Here, the Istio Gateway was routing traffic to the appropriate server based on Host.

The structure you want going forward is:

Internet -> CloudFront -> ALB -> Istio Gateway -> API Server

Originally, we used only ALB, so the DNS called by the client was used as the routing standard in the Istio Gateway. But here, when CloudFront calls ALB, which host DNS should we route in Istio Gateway?
Should I host based on the global hostname requested by the client, or should I use the DNS name of the ALB that CloudFront uses when making requests to the ALB as the routing condition for the Istio Gateway?


问:
refactor library to Lazy-Evaluation WITHOUT refactoring call site
How to change code from normal initialization to lazy initialization without refactoring user's code (caller)?

MSVE

I have a library class.

From profiling, there is a sad bottleneck at str parameter evaluation below.

```<code>struct Library{
    static bool debugFlag;//<== user-define. Its value is changed often.
    template<class F1> static void doTask(const std::string& str,F1&& task){
        if(debugFlag){
            /// Do very expensive thing that need "str"
            //     (e.g. for profiling).
        }
        task();
    }
};
bool Library::debugFlag=false;
</code>```

^ By design, the real value of std::string str is needed if and only if Library::debugFlag is true.

However, we can't know in advance.  Its value also changes often.

Here is an example of user's code that call the above Library::doTask().

```<code>//vvvvvvv user code (we can't modify) vvvvvvvvv
int main(){///
    Library::debugFlag=true;  //<== user-define. Its value is changed often.
    int var=5; //<== user-define. Its value is changed often.
    int var2=6; //<== user-define. Its value is changed often.
    Library::doTask(
        "a label for this task id="+std::to_string(var)+" fork custom="+std::to_string(var2)
        ,[](){}
    );
}
</code>```

User can create string in any way, but it is guaranteed to appear in 1 expression.

I heard that lambda is the way of lazy evaluation, but how to do lazy evaluation without refactoring user code?

If possible, I still want to avoid using macro.

Hopefully, as a workaround, there might be a way to 1. implicitly create lambda from expression, or 2. suggest the compiler to check Library::debugFlag before evaluate the std::string str.

Body:
How to change code from normal initialization to lazy initialization without refactoring user's code (caller)?

MSVE

I have a library class.

From profiling, there is a sad bottleneck at str parameter evaluation below.

struct Library{
    static bool debugFlag;//<== user-define. Its value is changed often.
    template<class F1> static void doTask(const std::string& str,F1&& task){
        if(debugFlag){
            /// Do very expensive thing that need "str"
            //     (e.g. for profiling).
        }
        task();
    }
};
bool Library::debugFlag=false;

^ By design, the real value of std::string str is needed if and only if Library::debugFlag is true.

However, we can't know in advance.  Its value also changes often.

Here is an example of user's code that call the above Library::doTask().

//vvvvvvv user code (we can't modify) vvvvvvvvv
int main(){///
    Library::debugFlag=true;  //<== user-define. Its value is changed often.
    int var=5; //<== user-define. Its value is changed often.
    int var2=6; //<== user-define. Its value is changed often.
    Library::doTask(
        "a label for this task id="+std::to_string(var)+" fork custom="+std::to_string(var2)
        ,[](){}
    );
}

User can create string in any way, but it is guaranteed to appear in 1 expression.

I heard that lambda is the way of lazy evaluation, but how to do lazy evaluation without refactoring user code?

If possible, I still want to avoid using macro.

Hopefully, as a workaround, there might be a way to 1. implicitly create lambda from expression, or 2. suggest the compiler to check Library::debugFlag before evaluate the std::string str.


问:
How to reduce an optimization model's bias without changing the weights assigned to a feature?
Given a linear model, say revenue as the dependent variable and f1, f2, ... fn as the independent variables, each with different weights assigned. Can you reduce the model's sensitivity or bias towards any one such variable without changing the weights?

I assumed the sensitivity is related to the weights (be it positive or negative), but assuming the weights remain predetermined through market research, is it possible to reduce the model's bias?


问:
Node JS : Code to calculate number of working days in a month between two dates
I wanted to calculate the number of working days in each of the month, eg Oct'22 Nov'22, Dec'22 Jan'22 and Feb'22 for the resource when assigned between 20-Oct-22 to 22-Feb-22.

Currently I am able to calculate the number of working days in month using the below code. However not able to capture the working days in a month based on the Assigned Start date and End date.

```<code>const month = await db.sequelize.query(`(
                SELECT month from financialmonths
                where id= :id
                )`, {
                    replacements: {
                        id: month_id
                    },
                    type: sequelize.QueryTypes.SELECT,
                    raw: true
                })
                let monthName = month[0].month
                function getMonthNumberFromName(monthName) {
                    return new Date(`${monthName} 1, ${year}`).getMonth() + 1;
                }
                const monthId = getMonthNumberFromName(monthName)
                const days = moment(year + " - " + monthId, "YYYY-MM").monthBusinessDays()
                let count = 0;
                for (let key in days) {
                    ++count;
                }
                //calculating available STU
                const cost_per_stu = bandCost.stu_convertor
                const hours = count * 8;
                const totalStu = cost_per_stu * hours;
                const allocated_stus = (allocated_percentage / 100) * totalStu;
</code>```

I tried using moment function, however not able to capture working days specific to each month based on given start date and end date.

Body:
I wanted to calculate the number of working days in each of the month, eg Oct'22 Nov'22, Dec'22 Jan'22 and Feb'22 for the resource when assigned between 20-Oct-22 to 22-Feb-22.

Currently I am able to calculate the number of working days in month using the below code. However not able to capture the working days in a month based on the Assigned Start date and End date.

const month = await db.sequelize.query(`(
                SELECT month from financialmonths
                where id= :id
                )`, {
                    replacements: {
                        id: month_id
                    },
                    type: sequelize.QueryTypes.SELECT,
                    raw: true
                })
                let monthName = month[0].month
                function getMonthNumberFromName(monthName) {
                    return new Date(`${monthName} 1, ${year}`).getMonth() + 1;
                }
                const monthId = getMonthNumberFromName(monthName)
                const days = moment(year + " - " + monthId, "YYYY-MM").monthBusinessDays()
                let count = 0;
                for (let key in days) {
                    ++count;
                }
                //calculating available STU
                const cost_per_stu = bandCost.stu_convertor
                const hours = count * 8;
                const totalStu = cost_per_stu * hours;
                const allocated_stus = (allocated_percentage / 100) * totalStu;

I tried using moment function, however not able to capture working days specific to each month based on given start date and end date.


问:
How can I reflect the state changes in the React main component / homepage?
I am new to react and learning the basics from a Udemy Course, How ever I'm badly stuck with some issues, not able to resolve it.

I'm trying to append a new element to the existing array and display the updated array back in the homepage i.e after state change, I want it to be redirected to (Route path= "/" in render function )
Please check my code below.

(For the time being I've manually added 'id' value 3)

Main.js

```<code>import React, { Component } from 'react';
import Title from './Title';
import Photowall from './Photowall';
import { Route } from 'react-router-dom';
import { Routes } from 'react-router-dom';
import Newphoto from './Newphoto';

</code>```
```<code>class Main extends Component {
    constructor(){
    super()

        this.state ={
        posts : [{
            id: "0",
            description: "beautiful landscape",
            imageLink: "https://image.jimcdn.com/app/cms/image/transf/none/path/sa6549607c78f5c11/image/i4eeacaa2dbf12d6d/version/1490299332/most-beautiful-landscapes-in-europe-lofoten-european-best-destinations-copyright-iakov-kalinin.jpg" +
            "3919321_1443393332_n.jpg"
            }, {
            id: "1",
            description: "Aliens???",
            imageLink: "https://s3.india.com/wp-content/uploads/2017/12/rocket.jpg"
            }, {
            id: "2",
            description: "On a vacation!",
            imageLink: "https://fm.cnbc.com/applications/cnbc.com/resources/img/editorial/2017/08/24/104670887-VacationExplainsTHUMBWEB.1910x1000.jpg"
            }]
        }

           this.handleSubmit=this.handleSubmit.bind(this)

    }
handleSubmit = (event) => {
        event.preventDefault()
        console.log('new photo added')
        const newlink = event.target.elements.link.value
        const newdesc = event.target.elements.description.value
        const newpost = [{id 3: ,
                    description : newdesc,
                    imageLink : newlink}]
        console.log(newpost)
        console.log(this.state.posts)
        this.setState({posts : this.state.posts.concat(newpost)},
                ()  => {console.log(this.state.posts)})

    }

    render() {
        return (
            <Routes>
                <Route path= "/" element = {
                    <div>
                    <Title title={'My Gallery'}> </Title>
                    <Photowall posts = {this.state.posts}
                            onDelete = {this.handleDelete}>

                    </Photowall>
                    </div>}>
                </Route>
                <Route path= "/addanewphoto" element={
                    <div>
                        <Newphoto submit = {this.handleSubmit} ></Newphoto>
                    </div>
                }>
                </Route>

            </Routes>
       )
    }
}

export default Main;
</code>```

Newphoto.js

```<code>import React, { Component } from 'react';

class Newphoto extends Component {

    render() {
        return (
        <div className='form'>
            <div className='form'>
                    <form onSubmit={this.props.submit}>
                        <input type='text' placeholder='Link' name= 'link'></input>
                        <input type ='text' placeholder='Description' name='description'></input>
                        <button >  Post </button>
                    </form>
                </div>
        </div>);
    }
}

export default Newphoto;
</code>```

Any help would be highly appreciated.
Many thanks in advance
Aparna

Body:
I am new to react and learning the basics from a Udemy Course, How ever I'm badly stuck with some issues, not able to resolve it.

I'm trying to append a new element to the existing array and display the updated array back in the homepage i.e after state change, I want it to be redirected to (Route path= "/" in render function )
Please check my code below.

(For the time being I've manually added 'id' value 3)

Main.js

import React, { Component } from 'react';
import Title from './Title';
import Photowall from './Photowall';
import { Route } from 'react-router-dom';
import { Routes } from 'react-router-dom';
import Newphoto from './Newphoto';

class Main extends Component {
    constructor(){
    super()

        this.state ={
        posts : [{
            id: "0",
            description: "beautiful landscape",
            imageLink: "https://image.jimcdn.com/app/cms/image/transf/none/path/sa6549607c78f5c11/image/i4eeacaa2dbf12d6d/version/1490299332/most-beautiful-landscapes-in-europe-lofoten-european-best-destinations-copyright-iakov-kalinin.jpg" +
            "3919321_1443393332_n.jpg"
            }, {
            id: "1",
            description: "Aliens???",
            imageLink: "https://s3.india.com/wp-content/uploads/2017/12/rocket.jpg"
            }, {
            id: "2",
            description: "On a vacation!",
            imageLink: "https://fm.cnbc.com/applications/cnbc.com/resources/img/editorial/2017/08/24/104670887-VacationExplainsTHUMBWEB.1910x1000.jpg"
            }]
        }

           this.handleSubmit=this.handleSubmit.bind(this)

    }
handleSubmit = (event) => {
        event.preventDefault()
        console.log('new photo added')
        const newlink = event.target.elements.link.value
        const newdesc = event.target.elements.description.value
        const newpost = [{id 3: ,
                    description : newdesc,
                    imageLink : newlink}]
        console.log(newpost)
        console.log(this.state.posts)
        this.setState({posts : this.state.posts.concat(newpost)},
                ()  => {console.log(this.state.posts)})

    }

    render() {
        return (
            <Routes>
                <Route path= "/" element = {

                    <Title title={'My Gallery'}> </Title>
                    <Photowall posts = {this.state.posts}
                            onDelete = {this.handleDelete}>

                    </Photowall>

}>
                </Route>
                <Route path= "/addanewphoto" element={

                        <Newphoto submit = {this.handleSubmit} ></Newphoto>

                }>
                </Route>

            </Routes>
       )
    }
}

export default Main;

Newphoto.js

import React, { Component } from 'react';

class Newphoto extends Component {

    render() {
        return (

                    <form onSubmit={this.props.submit}>
                        <input type='text' placeholder='Link' name= 'link'></input>
                        <input type ='text' placeholder='Description' name='description'></input>
                        <button >  Post </button>
                    </form>

);
    }
}

export default Newphoto;

Any help would be highly appreciated.
Many thanks in advance
Aparna


问:
Aspose Java API : How to fetch Row from excel workbook which has maximum data in it
I want to get a row from XLSX workbook which has maximum data in it. I have the "com.aspose.cells.Cells" object of worksheet.

```<code>workbook = new Workbook(sourceFilePath);
com.aspose.cells.WorksheetCollection sheets = workbook.getWorksheets();
Worksheet worksheets = sheets.get(0);
com.aspose.cells.Cells cells = worksheets.getCells();
</code>```

Could you please help me on this?

Body:
I want to get a row from XLSX workbook which has maximum data in it. I have the "com.aspose.cells.Cells" object of worksheet.

workbook = new Workbook(sourceFilePath);
com.aspose.cells.WorksheetCollection sheets = workbook.getWorksheets();
Worksheet worksheets = sheets.get(0);
com.aspose.cells.Cells cells = worksheets.getCells();

Could you please help me on this?


问:
TraceContext Propagation from Apigee Proxy to Google Cloud Function
I have recently started exploring Google Cloud trace and wanted to trace all the hops a request goes through during its lifecycle. I have an app which calls Apigee Proxy which in turn calls a Google Cloud Function before returning response. Enabled distributed tracing for Apigee by following link- Enabling distributed tracing- ApigeeX and for cloud function by setting environment variable "GOOGLE_CLOUD_TRACE_ENABLED" to true. Now when my application makes a call to Gateway proxy, I was expecting to see a distributed trace similar to below waterfall in trace tool-

API Proxy Start

```<code>Cloud Function Start
Cloud Function End
</code>```

API Proxy End

However, I only see below standalone trace which seems to be coming from cloud function. Is there any config that needs to change for the distributed trace to appear as expected?

Trace

Body:
I have recently started exploring Google Cloud trace and wanted to trace all the hops a request goes through during its lifecycle. I have an app which calls Apigee Proxy which in turn calls a Google Cloud Function before returning response. Enabled distributed tracing for Apigee by following link- Enabling distributed tracing- ApigeeX and for cloud function by setting environment variable "GOOGLE_CLOUD_TRACE_ENABLED" to true. Now when my application makes a call to Gateway proxy, I was expecting to see a distributed trace similar to below waterfall in trace tool-

API Proxy Start

Cloud Function Start
Cloud Function End

API Proxy End

However, I only see below standalone trace which seems to be coming from cloud function. Is there any config that needs to change for the distributed trace to appear as expected?

Trace


问:
pika.exceptions.IncompatibleProtocolError: StreamLostError:
```<code>producer.py

import pika
credentials = pika.PlainCredentials('guest','guest')
parameters = pika.ConnectionParameters(host='20.*.*.*',port=3389,virtual_host='/',credentials=credentials,heartbeat=60)

connection = pika.BlockingConnection(parameters)

channel = connection.channel()

channel.queue_declare(queue='task_queue',durable=True,arguments={"x-queue-type": "quorum"})

message = "Hello World"

channel.basic_publish(exchange='', routing_key='task_queue', body=message)

print("Sent %r" % message)
connection.close()

</code>```

Error

unable to connect to rabbitmq server(from azure)
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.IncompatibleProtocolError: StreamLostError: ('Transport indicated EOF',)

Body:
producer.py

import pika
credentials = pika.PlainCredentials('guest','guest')
parameters = pika.ConnectionParameters(host='20.*.*.*',port=3389,virtual_host='/',credentials=credentials,heartbeat=60)

connection = pika.BlockingConnection(parameters)

channel = connection.channel()

channel.queue_declare(queue='task_queue',durable=True,arguments={"x-queue-type": "quorum"})

message = "Hello World"

channel.basic_publish(exchange='', routing_key='task_queue', body=message)

print("Sent %r" % message)
connection.close()

Error

unable to connect to rabbitmq server(from azure)
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.IncompatibleProtocolError: StreamLostError: ('Transport indicated EOF',)


问:
How can I set it to the original path? (npm nodejs path mismatch)
I want to solve the nodejs path problem now. I need help.

error occurred

npm WARN config global --global, --local are deprecated. Use --location=global instead

So I searched for a solution.

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

npm install --global --production npm-windows-upgrade

npm-windows-upgrade

But... route problem

yarn start
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\corepack\dist\yarn.js'

4.

I copied the corepack folder
from C:\Users\user\AppData\Roaming\npm\node_modules
to C:\Program Files\nodejs\node_modules and it worked.

I updated npm and the path seems to have changed,

****How can I set it to the original path?
(C:\Users\user\AppData\Roaming\npm\node_modules )

I tried the settings below, but no change.
enter image description here