问:
invalid/missing permissions trying to read leadgen data in webhook Facebook Graph API
I use the version 9.0 of the Grapph API. The leads retrieval was wroking ok, but the last 3 weeks I am not able to retrieve lead form information, using the endpoint :
https://graph.facebook.com/v9.0/${leadId}/?access_token=${process.env.FACEBOOK_PAGE_ACCESS_TOKEN}
The page access token as well as the facebook app has all the permissions like leads_retrieval, pages_manage_ads, pages_manage_metadata, pages_read_engagement, business_management, public_profile, pages_show_list.
When I create a lead form id from the page that is connected to the app, and then use the testing tool (https://developers.facebook.com/tools/lead-ads-testing) to check if the webhook works, everything works ok !!
The facebook and the connected page that are connected and were used for testing purposes, do belong in different businesses.

The problem is that when someone submits a lead from paid campaigs, then the following error message shows:
An invalid response was received from the Facebook API: {"error":{"message":"Unsupported get request. Object with ID '1223289864932223' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api","type":"GraphMethodException","code":100,"error_subcode":33,"fbtrace_id":"AIQ5Q-yJo249IZwdn10dfhi"}}

Is there an error in the set up of the whole system? Something that needs to be changed? Why suddenly did it stop working ?


来源: stackexchange

问:
How to split an image in blocks, based on a predefined mask
I have around 100 images that have a 5x5 grid, each grid cell contains a letter. I want to extract the sub-image of the letter from the main image to its corresponding subfolder (Letter A on image 1 lands in A/1.jpg ...).
The images can also have whitespace around, so I would like to minimize that whitespace somehow (maybe another letter is bigger then the other). After that I want to extract some features, so I think it would benefit the algorithms if the images are all the same size).

I've researched a bit, but haven't done much work with any sub-extraction. I know I could just define a mask or something similar in Numpy, but I'm wondering if there's a beter way. The images are always in the same position on all images.

I have tried something like this:

```<code>#parse PDF, for each page
#for each subblock (hardcoded width)
subframe = image[currentPosX:subFrameWidth, currentPosY:subFrameHeight]
#save subframe in folder
</code>```

But it introduces n^2 time complexity - I'm planning to run this on a low-powered machine, and probably the inputs could get a lot bigger. As mentioned above, I've been reading about using Numpy masks, but I'm kind of confused how to implement them.

ContentLicense: CC BY-SA 4.0

Body:
I have around 100 images that have a 5x5 grid, each grid cell contains a letter. I want to extract the sub-image of the letter from the main image to its corresponding subfolder (Letter A on image 1 lands in A/1.jpg ...).
The images can also have whitespace around, so I would like to minimize that whitespace somehow (maybe another letter is bigger then the other). After that I want to extract some features, so I think it would benefit the algorithms if the images are all the same size).

I've researched a bit, but haven't done much work with any sub-extraction. I know I could just define a mask or something similar in Numpy, but I'm wondering if there's a beter way. The images are always in the same position on all images.

I have tried something like this:

#parse PDF, for each page
#for each subblock (hardcoded width)
subframe = image[currentPosX:subFrameWidth, currentPosY:subFrameHeight]
#save subframe in folder

But it introduces n^2 time complexity - I'm planning to run this on a low-powered machine, and probably the inputs could get a lot bigger. As mentioned above, I've been reading about using Numpy masks, but I'm kind of confused how to implement them.


问:
Double counting problem in Rolling weekly / monthly active endpoints
Here is my current code to calculate DAE,WAE,MAE:

```<code>select event_timestamp as day, Section, users as DAE, SUM(users)
  OVER (PARTITION BY Section
    ORDER BY event_timestamp
    ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as WAE,
    SUM(users)
  OVER (PARTITION BY Section
    ORDER BY event_timestamp
    ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) as MAE
from (

select count(distinct user_pseudo_id) as users, Section, event_timestamp
from
(select distinct *
from
(
select *,
CASE
    WHEN param_value = "Names" or param_value = "SingleName" THEN 'Names'
    ELSE param_value
END AS Section
from(
  select user_pseudo_id, DATE_TRUNC(EXTRACT(DATE from TIMESTAMP_MICROS(event_timestamp)), DAY) as event_timestamp, event_name, params.value.string_value as param_value
from `rayn-deen-app.analytics_317927526.events_*`, unnest(event_params) as params
where (event_name = 'screen_view' and params.key = 'firebase_screen' and (
# Promises
  params.value.string_value = "Promises"
# Favourites
  or params.value.string_value = "Favourites"
))
group by user_pseudo_id, event_timestamp, event_name, param_value
order by event_timestamp, user_pseudo_id) raw
) base
order by event_timestamp) as events_table

group by Section, event_timestamp
)
</code>```

The problem is that for WAE,MAE there is repeat counts of the same users happening. So for example user A was a "daily active user" for 4 days that week. Then in the WAE count, it will consider that as 4 users instead of one. So there is a problem of repeat counts which I need to remove somehow.

Body:
Here is my current code to calculate DAE,WAE,MAE:

select event_timestamp as day, Section, users as DAE, SUM(users)
  OVER (PARTITION BY Section
    ORDER BY event_timestamp
    ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as WAE,
    SUM(users)
  OVER (PARTITION BY Section
    ORDER BY event_timestamp
    ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) as MAE
from (

select count(distinct user_pseudo_id) as users, Section, event_timestamp
from
(select distinct *
from
(
select *,
CASE
    WHEN param_value = "Names" or param_value = "SingleName" THEN 'Names'
    ELSE param_value
END AS Section
from(
  select user_pseudo_id, DATE_TRUNC(EXTRACT(DATE from TIMESTAMP_MICROS(event_timestamp)), DAY) as event_timestamp, event_name, params.value.string_value as param_value
from `rayn-deen-app.analytics_317927526.events_*`, unnest(event_params) as params
where (event_name = 'screen_view' and params.key = 'firebase_screen' and (
# Promises
  params.value.string_value = "Promises"
# Favourites
  or params.value.string_value = "Favourites"
))
group by user_pseudo_id, event_timestamp, event_name, param_value
order by event_timestamp, user_pseudo_id) raw
) base
order by event_timestamp) as events_table

group by Section, event_timestamp
)

The problem is that for WAE,MAE there is repeat counts of the same users happening. So for example user A was a "daily active user" for 4 days that week. Then in the WAE count, it will consider that as 4 users instead of one. So there is a problem of repeat counts which I need to remove somehow.


问:
How to convert wav file to spectrogram?
I am doing my first project about converting the file .wave into spectrogram. When I used this code, some errors occurred and I dont know how to fix this.

```<code> Traceback (most recent call last):
  File "preprocessing.py", line 54, in <module>
    create_spectrogram(filename,name, train_data_path)
  File "preprocessing.py", line 42, in create_spectrogram
    plt.savefig(filename, dpi=400, bbox_inches='tight', pad_inches=0)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\pyplot.py", line 977, in savefig
    res = fig.savefig(*args, **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\figure.py", line 3058, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\backend_bases.py", line 2325, in print_figure
    **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\backend_bases.py", line 1648, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\_api\deprecation.py", line 415, in wrapper
    return func(*inner_args, **inner_kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\backends\backend_agg.py", line 543, in print_png
    dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\image.py", line 1675, in imsave
    image.save(fname, **pil_kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\PIL\Image.py", line 2350, in save
    fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: 'data/train/train\\100032-3-0-0.png'

</code>```

I got the code from: https://github.com/thangnch/MiAI_Sound_Classifier/blob/master/preprocessing.py

Title: How to convert wav file to spectrogram?

Body:
I am doing my first project about converting the file .wave into spectrogram. When I used this code, some errors occurred and I dont know how to fix this.

 Traceback (most recent call last):
  File "preprocessing.py", line 54, in <module>
    create_spectrogram(filename,name, train_data_path)
  File "preprocessing.py", line 42, in create_spectrogram
    plt.savefig(filename, dpi=400, bbox_inches='tight', pad_inches=0)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\pyplot.py", line 977, in savefig
    res = fig.savefig(*args, **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\figure.py", line 3058, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\backend_bases.py", line 2325, in print_figure
    **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\backend_bases.py", line 1648, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\_api\deprecation.py", line 415, in wrapper
    return func(*inner_args, **inner_kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\backends\backend_agg.py", line 543, in print_png
    dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\matplotlib\image.py", line 1675, in imsave
    image.save(fname, **pil_kwargs)
  File "C:\Users\tien chelsea\PycharmProjects\lam lai nhan dang spectogram\venv\lib\site-packages\PIL\Image.py", line 2350, in save
    fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: 'data/train/train\\100032-3-0-0.png'

I got the code from: https://github.com/thangnch/MiAI_Sound_Classifier/blob/master/preprocessing.py


问:
Ktor: Bearer token injected by Dagger Hilt fails at first
Calls made by Ktor fails first most of the time and then use the refreshTokens to get a token and re-try the calls..

This is not acceptable as I see a LOT of Unauthenticated calls, therefore most calls I get is made 2x,  this effectively almost double my network call count.

The ONLY time the calls is authenticated properly is when the previous call was made to the same end point.

Question:

How can I improve this situation so that the token is provided ONCE to all Ktor end-points and
until the token is replaced (via valid login)

I use androidx.datastore:datastore-preferences to store my token and settingsRepository.getAuthToken() correctly retreive it

My DI

I use Dagger Hilt to inject my Bearer token this way

    @Provides
    @Singleton
    fun provideBearerAuthProvider(
        settingsRepository: SettingsRepository
    ) = BearerAuthProvider(
        realm = null,
        loadTokens = {
            val token = settingsRepository.getAuthToken()
            if (token == null) {
                BearerTokens(accessToken = "fake", refreshToken = "")
            } else {
                BearerTokens(accessToken = token, refreshToken = "")
            }
        },
        refreshTokens = {
            val token = settingsRepository.requireAuthToken()
            token?.let { BearerTokens(accessToken = it, refreshToken = "") }
        },
        sendWithoutRequestCallback = { httpRequestBuilder ->
            httpRequestBuilder.url.host == USER_LOGIN
        }
    ).also { bearerAuthProvider ->
        settingsRepository.addOnClearListener(bearerAuthProvider::clearToken)
    }

    @Provides
    @Singleton
    fun provideApiClient(
        bearerAuthProvider: BearerAuthProvider,
    ) = HttpClient(Android) {
        install(Logging) {
            logger = Logger.ANDROID
            LogLevel.ALL
        }
        install(ContentNegotiation) {
            gson()
        }
        install(Auth) {
            providers += bearerAuthProvider
        }
    }
```
<h3>My ApiService</h3>
<p>This is where the HttpClient is injected</p>
<pre class="lang-kotlin prettyprint-override"><code>abstract class BaseApiService(
    protected val httpClient: HttpClient,
    protected val baseUrl: String,
) {
    protected suspend inline fun <reified T> get(endpoint: String, block: HttpRequestBuilder.() -> Unit = {}): T {
        return httpClient.get(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> post(endpoint: String, block: HttpRequestBuilder.() -> Unit): T {
        return httpClient.post(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> put(endpoint: String, block: HttpRequestBuilder.() -> Unit = {}): T {
        return httpClient.put(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> patch(endpoint: String, block: HttpRequestBuilder.() -> Unit): T {
        return httpClient.patch(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> delete(endpoint: String, block: HttpRequestBuilder.() -> Unit = {}): T {
        return httpClient.delete(urlString = baseUrl + endpoint, block = block).body()
    }
}
</code>```

UserApiService

class UserApiService @Inject constructor(
    httpClient: HttpClient
) : BaseApiService(httpClient, BASE_URL) {

    suspend fun authenticate(): BasicApiResponse<Unit> =
        get(endpoint = USER_AUTHENTICATE)

    suspend fun login(loginRequest: LoginRequest): BasicApiResponse<AuthApiResponse> =
        post(endpoint = USER_LOGIN) {
            contentType(ContentType.Application.Json)
            setBody(loginRequest)
        }

    suspend fun updateUserProfile(updateProfileRequest: UpdateProfileRequest): BasicApiResponse<UserApiResponse> =
        patch(endpoint = USER) {
            contentType(ContentType.Application.Json)
            setBody(updateProfileRequest)
        }
}
```
<p><strong>Notes:</strong></p>
<ol>
<li>I use data classes passing variables to the json payloads e.g.</li>
</ol>
<pre class="lang-kotlin prettyprint-override"><code>data class LoginRequest(
    val email: String? = null,
    val password: String
)
</code>```

In above code I also included the sendWithoutRequestCallback endpoint

sendWithoutRequestCallback = { httpRequestBuilder ->
    httpRequestBuilder.url.host == USER_LOGIN
}
```

Body:
Calls made by Ktor fails first most of the time and then use the refreshTokens to get a token and re-try the calls..

This is not acceptable as I see a LOT of Unauthenticated calls, therefore most calls I get is made 2x,  this effectively almost double my network call count.

The ONLY time the calls is authenticated properly is when the previous call was made to the same end point.

Question:

How can I improve this situation so that the token is provided ONCE to all Ktor end-points and
until the token is replaced (via valid login)

I use androidx.datastore:datastore-preferences to store my token and settingsRepository.getAuthToken() correctly retreive it

My DI

I use Dagger Hilt to inject my Bearer token this way

    @Provides
    @Singleton
    fun provideBearerAuthProvider(
        settingsRepository: SettingsRepository
    ) = BearerAuthProvider(
        realm = null,
        loadTokens = {
            val token = settingsRepository.getAuthToken()
            if (token == null) {
                BearerTokens(accessToken = "fake", refreshToken = "")
            } else {
                BearerTokens(accessToken = token, refreshToken = "")
            }
        },
        refreshTokens = {
            val token = settingsRepository.requireAuthToken()
            token?.let { BearerTokens(accessToken = it, refreshToken = "") }
        },
        sendWithoutRequestCallback = { httpRequestBuilder ->
            httpRequestBuilder.url.host == USER_LOGIN
        }
    ).also { bearerAuthProvider ->
        settingsRepository.addOnClearListener(bearerAuthProvider::clearToken)
    }

    @Provides
    @Singleton
    fun provideApiClient(
        bearerAuthProvider: BearerAuthProvider,
    ) = HttpClient(Android) {
        install(Logging) {
            logger = Logger.ANDROID
            LogLevel.ALL
        }
        install(ContentNegotiation) {
            gson()
        }
        install(Auth) {
            providers += bearerAuthProvider
        }
    }

My ApiService

This is where the HttpClient is injected

abstract class BaseApiService(
    protected val httpClient: HttpClient,
    protected val baseUrl: String,
) {
    protected suspend inline fun <reified T> get(endpoint: String, block: HttpRequestBuilder.() -> Unit = {}): T {
        return httpClient.get(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> post(endpoint: String, block: HttpRequestBuilder.() -> Unit): T {
        return httpClient.post(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> put(endpoint: String, block: HttpRequestBuilder.() -> Unit = {}): T {
        return httpClient.put(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> patch(endpoint: String, block: HttpRequestBuilder.() -> Unit): T {
        return httpClient.patch(urlString = baseUrl + endpoint, block = block).body()
    }

    protected suspend inline fun <reified T> delete(endpoint: String, block: HttpRequestBuilder.() -> Unit = {}): T {
        return httpClient.delete(urlString = baseUrl + endpoint, block = block).body()
    }
}

UserApiService

class UserApiService @Inject constructor(
    httpClient: HttpClient
) : BaseApiService(httpClient, BASE_URL) {

    suspend fun authenticate(): BasicApiResponse<Unit> =
        get(endpoint = USER_AUTHENTICATE)

    suspend fun login(loginRequest: LoginRequest): BasicApiResponse<AuthApiResponse> =
        post(endpoint = USER_LOGIN) {
            contentType(ContentType.Application.Json)
            setBody(loginRequest)
        }

    suspend fun updateUserProfile(updateProfileRequest: UpdateProfileRequest): BasicApiResponse<UserApiResponse> =
        patch(endpoint = USER) {
            contentType(ContentType.Application.Json)
            setBody(updateProfileRequest)
        }
}

Notes:

I use data classes passing variables to the json payloads e.g.

data class LoginRequest(
    val email: String? = null,
    val password: String
)

In above code I also included the sendWithoutRequestCallback endpoint

sendWithoutRequestCallback = { httpRequestBuilder ->
    httpRequestBuilder.url.host == USER_LOGIN
}


问:
Stop redirecting page if the url have control character from Nginx
```<code> location /aaa {

        if ($request_uri ~* .*[\x09]+.*) {
                return 404;
        }
            alias /aaaaaa;
            index index.html;

</code>```

I have set the following, but it does not work

i try to set anyway   but not good result .

Body:
 location /aaa {

        if ($request_uri ~* .*[\x09]+.*) {
                return 404;
        }
            alias /aaaaaa;
            index index.html;

I have set the following, but it does not work

i try to set anyway   but not good result .


问:
Spring Transaction on server shutdown
Spring @Transaction does not rollback if the server shuts down in the middle of a transactional method. But that violates the atomicity principle of transactions. Why is that?

That is, if my code looks like this:

```<code>@Transactional
public void method() {
    write();
    // server shuts down
    write();
}
</code>```

The first write is not rolled back.

Title: Spring Transaction on server shutdown

Body:
Spring @Transaction does not rollback if the server shuts down in the middle of a transactional method. But that violates the atomicity principle of transactions. Why is that?

That is, if my code looks like this:

@Transactional
public void method() {
    write();
    // server shuts down
    write();
}

The first write is not rolled back.


问:
Issues reading sdcard on GD32, using IAR EWARM on c
We are using A GD32F1 to run an application on IAR EWARM which is collecting data of uint32_t [2][2][ARR_SIZE], and storing it on an SD card.

The ARR_SIZE was initially declared as 1500, and the code ran well on the board. However, we found that the size allocated would not be sufficient for all edge cases, so we increased the ARR_SIZE to 2000. On flashing the code to the board, and debugging the code would get stuck in a hard fault, and on closer examination the code was looping around on line 509. The program is constantly iterating inside the while loop, without entering the subsequent if block.

We tried reducing the ARR_SIZE and we found that 1800 works okay. We've also tried the same code with even higher sizes of ARR_SIZE (3000) on arm-none-eabi-gcc compiler and that seemed to work fine too.

I'd like to understand why the code is behaving differently on the two compilers.

Also, worth noting the IAR binary is around 39kB whereas the gcc binary is 69kB.


问:
How can I add collection or UserRoles to AppUser (using Identity in ASP.NET)?
I want to add a collection to every user with the roles he/she has and then get all users with their roles as a list, so I can pass it to the FE and add a functionality to edit role from Admin role.

I tried this:

```<code>    public class AppUserRole : IdentityUserRole<int>
    {
    [Key]
    public virtual AppUser User { get; set; }
    [Key]
    public virtual AppRole Role { get; set; }
    }
}
</code>```
```<code> modelBuilder.Entity<AppUser>(b =>
        {
            b.HasMany(e => e.UserRoles)
                .WithOne(e => e.User)
                .HasForeignKey(ur => ur.UserId)
                .IsRequired();
        });

        modelBuilder.Entity<AppRole>(b =>
        {
            b.HasMany(e => e.UserRoles)
                .WithOne(e => e.Role)
                .HasForeignKey(ur => ur.RoleId)
                .IsRequired();
        });
</code>```

Also tried passing Foreign keys directly through the AppUserRole class but it doesn't work. I always end up creating shadow state foreign keys which then don't work when I try to get the users with roles:

```<code> var users = await _userManager.Users
                .Include(r => r.UserRoles)
                .ThenInclude(r => r.RoleId)
                .OrderBy(u => u.UserName)
                .Select(u => new
                {
                    u.Id,
                    Username = u.UserName,
                    Roles = u.UserRoles.ToList()
                })
                .ToListAsync();

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

Body:
I want to add a collection to every user with the roles he/she has and then get all users with their roles as a list, so I can pass it to the FE and add a functionality to edit role from Admin role.

I tried this:

    public class AppUserRole : IdentityUserRole<int>
    {
    [Key]
    public virtual AppUser User { get; set; }
    [Key]
    public virtual AppRole Role { get; set; }
    }
}

 modelBuilder.Entity<AppUser>(b =>
        {
            b.HasMany(e => e.UserRoles)
                .WithOne(e => e.User)
                .HasForeignKey(ur => ur.UserId)
                .IsRequired();
        });

        modelBuilder.Entity<AppRole>(b =>
        {
            b.HasMany(e => e.UserRoles)
                .WithOne(e => e.Role)
                .HasForeignKey(ur => ur.RoleId)
                .IsRequired();
        });

Also tried passing Foreign keys directly through the AppUserRole class but it doesn't work. I always end up creating shadow state foreign keys which then don't work when I try to get the users with roles:

 var users = await _userManager.Users
                .Include(r => r.UserRoles)
                .ThenInclude(r => r.RoleId)
                .OrderBy(u => u.UserName)
                .Select(u => new
                {
                    u.Id,
                    Username = u.UserName,
                    Roles = u.UserRoles.ToList()
                })
                .ToListAsync();

            return Ok(users);


问:
Can't get the File Descriptor of a socket using Java
I'm new to Software Development and currently I am trying to get the file Descriptor of a socket, my job as an intern is to write a java Code (the new update) that has the same functions as a C Code (the older one). The C code is using a function called getFd() , after research I found that java has something similar to that which is getFD() or getFileDescriptor(). Somehow I cannot find them in the Socket Class

I've tried a bunch of solutions like using the SocketImpl() but it didn't work for me... I am stuck in this problem since 2 days and I have no idea what to do after trying dozens of Solutions. Thanks in Advance.


问:
Instagram Ad cost Api call
can I know is there any api to get the ad-cost?
I tried read the instagram-api document but can't find any related calls
https://developers.facebook.com/docs/instagram-api/</p>

Title: Instagram Ad cost Api call


问:
Getting velocity in scrollView in SwiftUI
I am going create a scrollView and getting the velocity for other actions
the code in UIKit scrollView is

```<code>func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>)
</code>```

But SwiftUI Drag Gesture seems cannot get the value when I drag the scrollView It needs to be waiting at the end of the scrolling animation end.
Plz

I have tried

```<code>.gesture(
     DragGesture().onChange ..
)
</code>```

But it does not work me

Body:
I am going create a scrollView and getting the velocity for other actions
the code in UIKit scrollView is

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>)

But SwiftUI Drag Gesture seems cannot get the value when I drag the scrollView It needs to be waiting at the end of the scrolling animation end.
Plz

I have tried

.gesture(
     DragGesture().onChange ..
)

But it does not work me


问:
How to add prefix (or scope) to all logging through instance of class?
I would like to have all logging initiated from an instance of a class A prefixed by an id like this:

```<code>A123: Calling B1
A123: Executing B1
A123: Calling B2
A123: Executing B2

A234: Calling B1
A234: Executing B1
A234: Calling B2
A234: Executing B2
</code>```

I made an attempt using BeginScope, but it will not work since BeginScope is not scoped to class A and it's dependencies.

```<code>using Microsoft.Extensions.Logging;

namespace LoggingTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            using var loggerFactory = LoggerFactory.Create(builder =>
            {
                builder
                    .AddConsole()
                    .AddSimpleConsole(options => options.IncludeScopes = true);
            });
            ILogger logger = loggerFactory.CreateLogger<Program>();

            A a = new A(123, logger);
            a.A1();
            a.A2();

            a = new A(234, logger);
            a.A1();
            a.A2();
        }
    }

    public class A
    {
        private ILogger _logger;
        private int _id;
        private B _b;

        public A(int id, ILogger logger)
        {
            _id = id;
            _logger = logger;
            _logger.BeginScope("A{}", _id);
            _b = new B(logger);
        }

        public void A1()
        {
            _logger.LogInformation("Calling B1");
            _b.B1();
        }

        public void A2()
        {
            _logger.LogInformation("Calling B2");
            _b.B2();
        }

    }

    public class B
    {
        ILogger _logger;

        public B(ILogger logger)
        {
            _logger = logger;
        }

        public void B1()
        {
            _logger.LogInformation("Executing B1");
        }

        public void B2()
        {
            _logger.LogInformation("Executing B2");
        }
    }
}

info: LoggingTest.Program[0]
      => A123
      Calling B1
info: LoggingTest.Program[0]
      => A123
      Executing B1
info: LoggingTest.Program[0]
      => A123
      Calling B2
info: LoggingTest.Program[0]
      => A123
      Executing B2
info: LoggingTest.Program[0]
      => A123 => A234
      Calling B1
info: LoggingTest.Program[0]
      => A123 => A234
      Executing B1
info: LoggingTest.Program[0]
      => A123 => A234
      Calling B2
info: LoggingTest.Program[0]
      => A123 => A234
      Executing B2
</code>```

Is it possible to achive this using natural ILogger constructs?

Body:
I would like to have all logging initiated from an instance of a class A prefixed by an id like this:

A123: Calling B1
A123: Executing B1
A123: Calling B2
A123: Executing B2

A234: Calling B1
A234: Executing B1
A234: Calling B2
A234: Executing B2

I made an attempt using BeginScope, but it will not work since BeginScope is not scoped to class A and it's dependencies.

using Microsoft.Extensions.Logging;

namespace LoggingTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            using var loggerFactory = LoggerFactory.Create(builder =>
            {
                builder
                    .AddConsole()
                    .AddSimpleConsole(options => options.IncludeScopes = true);
            });
            ILogger logger = loggerFactory.CreateLogger<Program>();

            A a = new A(123, logger);
            a.A1();
            a.A2();

            a = new A(234, logger);
            a.A1();
            a.A2();
        }
    }

    public class A
    {
        private ILogger _logger;
        private int _id;
        private B _b;

        public A(int id, ILogger logger)
        {
            _id = id;
            _logger = logger;
            _logger.BeginScope("A{}", _id);
            _b = new B(logger);
        }

        public void A1()
        {
            _logger.LogInformation("Calling B1");
            _b.B1();
        }

        public void A2()
        {
            _logger.LogInformation("Calling B2");
            _b.B2();
        }

    }

    public class B
    {
        ILogger _logger;

        public B(ILogger logger)
        {
            _logger = logger;
        }

        public void B1()
        {
            _logger.LogInformation("Executing B1");
        }

        public void B2()
        {
            _logger.LogInformation("Executing B2");
        }
    }
}

info: LoggingTest.Program[0]
      => A123
      Calling B1
info: LoggingTest.Program[0]
      => A123
      Executing B1
info: LoggingTest.Program[0]
      => A123
      Calling B2
info: LoggingTest.Program[0]
      => A123
      Executing B2
info: LoggingTest.Program[0]
      => A123 => A234
      Calling B1
info: LoggingTest.Program[0]
      => A123 => A234
      Executing B1
info: LoggingTest.Program[0]
      => A123 => A234
      Calling B2
info: LoggingTest.Program[0]
      => A123 => A234
      Executing B2

Is it possible to achive this using natural ILogger constructs?


问:
How to use Multiple $geoNear in mongodb?
How to use $geoNear in mongodb?

I want to use geoNear 3 times and i want to get all result.

I try to made an aggregationlike this.

but it occurs an error "$geoNear requires a 'near' option as an Array"

Thank you for help

```<code>db.getCollection('collection').aggregate([
    {
        "$geoNear": {
            "$or": [
                {
                    "near": {
                        "type": "Point",
                        "coordinates": [
                            126.7384307,
                            35.9672442
                        ]
                    },
                    "maxDistance": 1000,
                    "query": {
                        "distance": 1000,
                        "use_noti": true,
                    },
                    "distanceField": "location",
                },
                {
                    "near": {
                        "type": "Point",
                        "coordinates": [
                            126.7384307,
                            35.9672442
                        ]
                    },
                    "maxDistance": 5000,
                    "query": {
                        "distance": 5000,
                        "use_noti": true,
                    },
                    "distanceField": "location",
                },
            ]
        }
    },
])
```
```

Body:
How to use $geoNear in mongodb?

I want to use geoNear 3 times and i want to get all result.

I try to made an aggregationlike this.

but it occurs an error "$geoNear requires a 'near' option as an Array"

Thank you for help

db.getCollection('collection').aggregate([
    {
        "$geoNear": {
            "$or": [
                {
                    "near": {
                        "type": "Point",
                        "coordinates": [
                            126.7384307,
                            35.9672442
                        ]
                    },
                    "maxDistance": 1000,
                    "query": {
                        "distance": 1000,
                        "use_noti": true,
                    },
                    "distanceField": "location",
                },
                {
                    "near": {
                        "type": "Point",
                        "coordinates": [
                            126.7384307,
                            35.9672442
                        ]
                    },
                    "maxDistance": 5000,
                    "query": {
                        "distance": 5000,
                        "use_noti": true,
                    },
                    "distanceField": "location",
                },
            ]
        }
    },
])
```


问:
How send large video file to server with chunking in android
I want to send a large video to the server but I have to split the video into multiple parts and send each of the parts to be sent consecutively. Which approach I must use?
Note: I use ktor client to connect to the server</p>


问:
How can I model my clothes ecommerce product in mongodb database with variants?
I am currently making ecommerce application in Next.js with the help of mongodb database in the backend side. I just want to keep mine record of the products like tshirts, hoodies and jackets with various variants like they vary in colors and size.

Can somebody help be desigining the product model for storing my product details with ratings, features, variants, skus, brandname, categories, multiple images, etc.
How can I store multiple images of different variants of a product in mongodb?
Please someone help me!!!

I am stuck with this here. I am just a beginner now .Needs to store various images and variants of the product in mongodb database

I tried to insert different document for all the variants of the products like this: my product collection

I want to know how can I do that by putting all the variants in the same document and can insert multiple images of different variants.


问:
Infinite loop on page load Safari 16.1
Within an Angular component - The bootstrapped component.
I have code that reloads the page if an item in local storage is not present.

```<code>  constructor() {
    if(!localStorage.getItem('reload')) {
      localStorage.setItem('reload', 'true');
      location.reload();
    } else {
      localStorage.removeItem('reload');
    }
  }

ngOnInit(){
  window.addEventListener('beforeunload', (event) => {
    localStorage.removeItem('reload');
  });
}
</code>```

The reason for this code is to do a hard refresh of the page so that it can refresh the cookies.

This code works on Chrome, Firefox, Edge but not on Safari.

On Safari the page loads but flickers infinitely.
Because I can not put break points and step through the code in the Safari devtools. I have put the debugger keyword in the code like below.

```<code>  constructor() {
    debugger
    if(!localStorage.getItem('reload')) {
      localStorage.setItem('reload', 'true');
      location.reload();
    } else {
      localStorage.removeItem('reload');
    }
  }
</code>```

With this change the page loads without the infinite flickering.
The flickering also stops when I right click on the page.

To resolve this I have modified the code in the constructor like below.

```<code>  constructor() {
     const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);

     if(!localStorage.getItem('reload') && !isSafari) {
         localStorage.setItem('reload', 'true');
         location.reload();
     } else {
         localStorage.removeItem('reload');
     }
  }
</code>```

I want to understand why the flickering happens in Safari, is it how Safari loads the page that causes the infinite flickering?

Is there another way to hard refresh a page so that it can use the latest cookies from the server without the hack I have?

Any ideas would be appreciated.

Title: Infinite loop on page load Safari 16.1

Body:
Within an Angular component - The bootstrapped component.
I have code that reloads the page if an item in local storage is not present.

  constructor() {
    if(!localStorage.getItem('reload')) {
      localStorage.setItem('reload', 'true');
      location.reload();
    } else {
      localStorage.removeItem('reload');
    }
  }

ngOnInit(){
  window.addEventListener('beforeunload', (event) => {
    localStorage.removeItem('reload');
  });
}

The reason for this code is to do a hard refresh of the page so that it can refresh the cookies.

This code works on Chrome, Firefox, Edge but not on Safari.

On Safari the page loads but flickers infinitely.
Because I can not put break points and step through the code in the Safari devtools. I have put the debugger keyword in the code like below.

  constructor() {
    debugger
    if(!localStorage.getItem('reload')) {
      localStorage.setItem('reload', 'true');
      location.reload();
    } else {
      localStorage.removeItem('reload');
    }
  }

With this change the page loads without the infinite flickering.
The flickering also stops when I right click on the page.

To resolve this I have modified the code in the constructor like below.

  constructor() {
     const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);

     if(!localStorage.getItem('reload') && !isSafari) {
         localStorage.setItem('reload', 'true');
         location.reload();
     } else {
         localStorage.removeItem('reload');
     }
  }

I want to understand why the flickering happens in Safari, is it how Safari loads the page that causes the infinite flickering?

Is there another way to hard refresh a page so that it can use the latest cookies from the server without the hack I have?

Any ideas would be appreciated.


问:
Action: Copy folder from private to public repo
I want to create a GitHub Action for my private repository (repo A) that does the following:

Check out a private repository (repo A)

Check out a public repository (repo B)

Cleanup subfolder bob of repo B

Copy contents of subfolder repo A/alice to repo B/bob

Push the change as a commit to repo B

Both are repositories from the same organization. I deployed a key pair (ACTIONS_SECRET) in the settings of my private repository like described in this answer. My current action looks like this:

```<code>name: Publish docsify

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout alice
      uses: actions/checkout@v3
      with:
        path: alice
    - name: Checkout bob
      uses: actions/checkout@v3
      with:
        repository: <org/repo B>
        ssh-key: ${{ secrets.ACTIONS_SECRET }}
        ref: main
        path: bob
    - name: Cleanup
      run: |
        pushd bob
        git rm -rf .
        popd
    - name: Copy alice
      run: |
        pushd bob
        cp -rvf ../alice/* .
        popd
        ls -la bob/
    - name: Publish
      run: |
        eval `ssh-agent -s`
        ssh-add - <<< '${{ secrets.ACTIONS_SECRET }}'
        git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
        git config --global user.name "github-actions"
        pushd bob
        git add .
        git commit -m "Build from Action ${GITHUB_SHA}"
        git push origin main
        popd
</code>```

The action fails at the Publish step with the following error:

```<code>ERROR: Permission to <repo B> denied to deploy key
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error: Process completed with exit code 128.
</code>```

This is my first action and I don't know how to solve this error. Please help.

Body:
I want to create a GitHub Action for my private repository (repo A) that does the following:

Check out a private repository (repo A)

Check out a public repository (repo B)

Cleanup subfolder bob of repo B

Copy contents of subfolder repo A/alice to repo B/bob

Push the change as a commit to repo B

Both are repositories from the same organization. I deployed a key pair (ACTIONS_SECRET) in the settings of my private repository like described in this answer. My current action looks like this:

name: Publish docsify

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout alice
      uses: actions/checkout@v3
      with:
        path: alice
    - name: Checkout bob
      uses: actions/checkout@v3
      with:
        repository: <org/repo B>
        ssh-key: ${{ secrets.ACTIONS_SECRET }}
        ref: main
        path: bob
    - name: Cleanup
      run: |
        pushd bob
        git rm -rf .
        popd
    - name: Copy alice
      run: |
        pushd bob
        cp -rvf ../alice/* .
        popd
        ls -la bob/
    - name: Publish
      run: |
        eval `ssh-agent -s`
        ssh-add - <<< '${{ secrets.ACTIONS_SECRET }}'
        git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
        git config --global user.name "github-actions"
        pushd bob
        git add .
        git commit -m "Build from Action ${GITHUB_SHA}"
        git push origin main
        popd

The action fails at the Publish step with the following error:

ERROR: Permission to <repo B> denied to deploy key
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error: Process completed with exit code 128.

This is my first action and I don't know how to solve this error. Please help.


问:
How to set ref on text in Ant Modal?
Is it possible to add a link to AntD Modal.error({ content: ref={"/my-link"}> })?

I'm try to add ref to reactNode as

```<code>function render() {
    return (
      <div ref={"/sublimit-usage-report-filters"}>
        <p>
          Удаление "Типа сценария" невозможно по причине наличия актуальной операции в "Журнале операций" с таким
          сценарием
        </p>
      </div>
    );
  }
</code>```

but, it not work

Title: How to set ref on text in Ant Modal?

Body:
Is it possible to add a link to AntD Modal.error({ content: ref={"/my-link"}> })?

I'm try to add ref to reactNode as

function render() {
    return (

          Удаление "Типа сценария" невозможно по причине наличия актуальной операции в "Журнале операций" с таким
          сценарием

    );
  }

but, it not work


问:
with `with strategy.scope():` BERT output loses it's shape from tf-hub and `encoder_output` is missing
Code:

```<code>!pip install tensorflow-text==2.7.0

import tensorflow_text as text
import tensorflow_hub as hub
# ... other tf imports....

strategy = tf.distribute.MirroredStrategy()
print('Number of GPU: ' + str(strategy.num_replicas_in_sync)) # 1 or 2, shouldn't matter

NUM_CLASS=2

with strategy.scope():
    bert_preprocess = hub.KerasLayer("https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/3")
    bert_encoder = hub.KerasLayer("https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/4")

def get_model():
    text_input = Input(shape=(), dtype=tf.string, name='text')
    preprocessed_text = bert_preprocess(text_input)
    outputs = bert_encoder(preprocessed_text)

    output_sequence = outputs['sequence_output']
    x = Dense(NUM_CLASS,  activation='sigmoid')(output_sequence)

    model = Model(inputs=[text_input], outputs = [x])
    return model

optimizer = Adam()
model = get_model()
model.compile(loss=CategoricalCrossentropy(from_logits=True),optimizer=optimizer,metrics=[Accuracy(), ],)
model.summary() # <- look at the output 1
tf.keras.utils.plot_model(model, show_shapes=True, to_file='model.png') # <- look at the figure 1

with strategy.scope():
    optimizer = Adam()
    model = get_model()
    model.compile(loss=CategoricalCrossentropy(from_logits=True),optimizer=optimizer,metrics=[Accuracy(), ],)

model.summary() # <- compare with output 1, it has already lost it's shape
tf.keras.utils.plot_model(model, show_shapes=True, to_file='model_scoped.png') # <- compare this figure too, for ease
</code>```

With scope, BERT loses seq_length, and it becomes None.

Model summary withOUT scope: (See there is 128 at the very last layer, which is seq_length)

```<code>Model: "model_6"
__________________________________________________________________________________________________
 Layer (type)                   Output Shape         Param #     Connected to
==================================================================================================
 text (InputLayer)              [(None,)]            0           []

 keras_layer_2 (KerasLayer)     {'input_mask': (Non  0           ['text[0][0]']
                                e, 128),
                                 'input_word_ids':
                                (None, 128),
                                 'input_type_ids':
                                (None, 128)}

 keras_layer_3 (KerasLayer)     multiple             109482241   ['keras_layer_2[6][0]',
                                                                  'keras_layer_2[6][1]',
                                                                  'keras_layer_2[6][2]']

 dense_6 (Dense)                (None, 128, 2)       1538        ['keras_layer_3[6][14]']

==================================================================================================
Total params: 109,483,779
Trainable params: 1,538
Non-trainable params: 109,482,241
__________________________________________________________________________________________________
</code>```

Model with scope:

```<code>Model: "model_7"
__________________________________________________________________________________________________
 Layer (type)                   Output Shape         Param #     Connected to
==================================================================================================
 text (InputLayer)              [(None,)]            0           []

 keras_layer_2 (KerasLayer)     {'input_mask': (Non  0           ['text[0][0]']
                                e, 128),
                                 'input_word_ids':
                                (None, 128),
                                 'input_type_ids':
                                (None, 128)}

 keras_layer_3 (KerasLayer)     multiple             109482241   ['keras_layer_2[7][0]',
                                                                  'keras_layer_2[7][1]',
                                                                  'keras_layer_2[7][2]']

 dense_7 (Dense)                (None, None, 2)      1538        ['keras_layer_3[7][14]']

==================================================================================================
Total params: 109,483,779
Trainable params: 1,538
Non-trainable params: 109,482,241
__________________________________________________________________________________________________
</code>```

If these image helps:

Another notable thing encoder_outputs is also missing if you take a look at the 2nd keras layer or 3rd layer of both model.

Body:
Code:

!pip install tensorflow-text==2.7.0

import tensorflow_text as text
import tensorflow_hub as hub
# ... other tf imports....

strategy = tf.distribute.MirroredStrategy()
print('Number of GPU: ' + str(strategy.num_replicas_in_sync)) # 1 or 2, shouldn't matter

NUM_CLASS=2

with strategy.scope():
    bert_preprocess = hub.KerasLayer("https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/3")
    bert_encoder = hub.KerasLayer("https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/4")

def get_model():
    text_input = Input(shape=(), dtype=tf.string, name='text')
    preprocessed_text = bert_preprocess(text_input)
    outputs = bert_encoder(preprocessed_text)

    output_sequence = outputs['sequence_output']
    x = Dense(NUM_CLASS,  activation='sigmoid')(output_sequence)

    model = Model(inputs=[text_input], outputs = [x])
    return model

optimizer = Adam()
model = get_model()
model.compile(loss=CategoricalCrossentropy(from_logits=True),optimizer=optimizer,metrics=[Accuracy(), ],)
model.summary() # <- look at the output 1
tf.keras.utils.plot_model(model, show_shapes=True, to_file='model.png') # <- look at the figure 1

with strategy.scope():
    optimizer = Adam()
    model = get_model()
    model.compile(loss=CategoricalCrossentropy(from_logits=True),optimizer=optimizer,metrics=[Accuracy(), ],)

model.summary() # <- compare with output 1, it has already lost it's shape
tf.keras.utils.plot_model(model, show_shapes=True, to_file='model_scoped.png') # <- compare this figure too, for ease

With scope, BERT loses seq_length, and it becomes None.

Model summary withOUT scope: (See there is 128 at the very last layer, which is seq_length)

Model: "model_6"
__________________________________________________________________________________________________
 Layer (type)                   Output Shape         Param #     Connected to
==================================================================================================
 text (InputLayer)              [(None,)]            0           []

 keras_layer_2 (KerasLayer)     {'input_mask': (Non  0           ['text[0][0]']
                                e, 128),
                                 'input_word_ids':
                                (None, 128),
                                 'input_type_ids':
                                (None, 128)}

 keras_layer_3 (KerasLayer)     multiple             109482241   ['keras_layer_2[6][0]',
                                                                  'keras_layer_2[6][1]',
                                                                  'keras_layer_2[6][2]']

 dense_6 (Dense)                (None, 128, 2)       1538        ['keras_layer_3[6][14]']

==================================================================================================
Total params: 109,483,779
Trainable params: 1,538
Non-trainable params: 109,482,241
__________________________________________________________________________________________________

Model with scope:

Model: "model_7"
__________________________________________________________________________________________________
 Layer (type)                   Output Shape         Param #     Connected to
==================================================================================================
 text (InputLayer)              [(None,)]            0           []

 keras_layer_2 (KerasLayer)     {'input_mask': (Non  0           ['text[0][0]']
                                e, 128),
                                 'input_word_ids':
                                (None, 128),
                                 'input_type_ids':
                                (None, 128)}

 keras_layer_3 (KerasLayer)     multiple             109482241   ['keras_layer_2[7][0]',
                                                                  'keras_layer_2[7][1]',
                                                                  'keras_layer_2[7][2]']

 dense_7 (Dense)                (None, None, 2)      1538        ['keras_layer_3[7][14]']

==================================================================================================
Total params: 109,483,779
Trainable params: 1,538
Non-trainable params: 109,482,241
__________________________________________________________________________________________________

If these image helps:

Another notable thing encoder_outputs is also missing if you take a look at the 2nd keras layer or 3rd layer of both model.


问:
When detecting a brand logo Using 'Yolov7' how to label better results?
While using 'yolov7'

When labeling to detect the brand logo, is it good to label the letter logo in a large box format? Or is it better to label delicately according to the shape of the letters?

Logo data is learned by labeling in two cases.

One is to label the logo with text and images in a large box format.

The rest is to label the shape of the logo image and letters in as much detail as possible.

At this point, most logos are recognized fine, but some are not.

To further improve performance, I want to know if labeling is good in one way, and if I have to do only one thing, which of the ways I do is good.


问:
Deprecated ReplaceWith doesn't work with generics
I got a function old(clazz: Class<T>), I want to deprecate and guide usage of it to new<T>() function.

fun <T> old(clazz: Class<T>): T {
    TODO()
}

@Suppress("DEPRECATION")
inline fun <reified T> new(): T {
    return old(T::class.java)
}
```
<p>If I write</p>
<pre class="lang-kotlin prettyprint-override"><code>@Deprecated(message = "replace with new<T>()", replaceWith = ReplaceWith("new<T>()"))
fun <T> old(clazz: Class<T>): T {
    TODO()
}

// auto correction of
val foo = old(String::class.java)
// becomes
val foo = new()
</code>```

Auto correction of a code val foo = old(String::class.java) suggests "replace with 'new()' and ends up looking like this:
val foo = new(), which is incorrect, compilation error and miss generics.

But, if I change ReplaceWith pattern to "new<T remove>()" for example, which doesn't make sense,  but auto correction correctly identifies generics and replaces it correctly and logically it also concats "remove" to it like this:

// ReplaceWith with "remove" at the end of generics
@Deprecated(message = "replace with new<T>()", replaceWith = ReplaceWith("new<T remove>()"))
fun <T> old(clazz: Class<T>): T {
    TODO()
}

// usage of old
val foo = old(String::class.java)

// becomes (almost correctly)
val foo = new < String remove >()
```

Am I doing something wrong here ? How to define correct pattern for ReplaceWith which leverage inline reified generics in it ?

Body:
I got a function old(clazz: Class<T>), I want to deprecate and guide usage of it to new<T>() function.

fun <T> old(clazz: Class<T>): T {
    TODO()
}

@Suppress("DEPRECATION")
inline fun <reified T> new(): T {
    return old(T::class.java)
}

If I write

@Deprecated(message = "replace with new<T>()", replaceWith = ReplaceWith("new<T>()"))
fun <T> old(clazz: Class<T>): T {
    TODO()
}

// auto correction of
val foo = old(String::class.java)
// becomes
val foo = new()

Auto correction of a code val foo = old(String::class.java) suggests "replace with 'new()' and ends up looking like this:
val foo = new(), which is incorrect, compilation error and miss generics.

But, if I change ReplaceWith pattern to "new<T remove>()" for example, which doesn't make sense,  but auto correction correctly identifies generics and replaces it correctly and logically it also concats "remove" to it like this:

// ReplaceWith with "remove" at the end of generics
@Deprecated(message = "replace with new<T>()", replaceWith = ReplaceWith("new<T remove>()"))
fun <T> old(clazz: Class<T>): T {
    TODO()
}

// usage of old
val foo = old(String::class.java)

// becomes (almost correctly)
val foo = new < String remove >()

Am I doing something wrong here ? How to define correct pattern for ReplaceWith which leverage inline reified generics in it ?


问:
How to simplify `tracing-actix-web` output
The log output by tracing-actix-web is as follows

```<code>2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7}: step 1
2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7}: step 2
2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7}: step 3
2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7 http.status_code=200 otel.status_code="OK"}: tracing_actix_web::root_span_builder: close time.busy=205µs time.idle=13.3µs
</code>```

It gives too much repetitive information

Can I output a log like the following?

```<code>2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: step 1
2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: step 2
2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: step 3
2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7 http.status_code=200 otel.status_code="OK"} close time.busy=205µs time.idle=13.3µs
</code>```

The request_id in span needs to be consistent with the one generated by tracing-actix-web

tracing-actix-web

Part of the code is as follows

use std::str::FromStr;
use actix_web::{App, HttpServer};
use tracing_actix_web::TracingLogger;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    tracing_subscriber::FmtSubscriber::builder()
        .with_max_level(tracing::Level::from_str(&APP_CONFIG.log.level).unwrap())
        .with_span_events(tracing_subscriber::fmt::format::FmtSpan::CLOSE)
        .init();

    db_config::init();

    HttpServer::new(move || {
        App::new()
            .wrap(TracingLogger::default())
            .wrap(auth_config::Auth)
            .configure(router_config::init)
    })
    .bind((APP_CONFIG.server.bind.as_str(), APP_CONFIG.server.port))?
    .run()
    .await
}

{
    tracing::info!("step 1");
    tracing::info!("step 2");
    tracing::info!("step 3");
}
```
<p>I try to implement <code>CustomRootSpanBuilder</code> to generate uuid to replace span in <code>request</code>, but this uuid is different from request_id in request</p>
```2022-12-13T13:36:46.546387Z  INFO 3fdc3e0b-571a-46e1-bf4b-0bc6238247d8: HTTP request{ ...... request_id=813af77e-331a-4818-a84d-7e9bee1a83f7 ......}
```

Body:
The log output by tracing-actix-web is as follows

2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7}: step 1
2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7}: step 2
2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7}: step 3
2022-12-13T13:36:46.546387Z  INFO HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7 http.status_code=200 otel.status_code="OK"}: tracing_actix_web::root_span_builder: close time.busy=205µs time.idle=13.3µs

It gives too much repetitive information

Can I output a log like the following?

2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: step 1
2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: step 2
2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: step 3
2022-12-13T13:36:46.546387Z  INFO 813af77e-331a-4818-a84d-7e9bee1a83f7: HTTP request{http.method=GET http.route=/storeapi/goods/getInfo/{id} http.flavor=1.0 http.scheme=https http.host=store.example.com http.client_ip=127.0.0.1 http.user_agent=okhttp/4.10.0 http.target=/storeapi/goods/getInfo/19 otel.name=HTTP GET /storeapi/goods/getInfo/{id} otel.kind="server" request_id=813af77e-331a-4818-a84d-7e9bee1a83f7 http.status_code=200 otel.status_code="OK"} close time.busy=205µs time.idle=13.3µs

The request_id in span needs to be consistent with the one generated by tracing-actix-web

tracing-actix-web

Part of the code is as follows

use std::str::FromStr;
use actix_web::{App, HttpServer};
use tracing_actix_web::TracingLogger;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    tracing_subscriber::FmtSubscriber::builder()
        .with_max_level(tracing::Level::from_str(&APP_CONFIG.log.level).unwrap())
        .with_span_events(tracing_subscriber::fmt::format::FmtSpan::CLOSE)
        .init();

    db_config::init();

    HttpServer::new(move || {
        App::new()
            .wrap(TracingLogger::default())
            .wrap(auth_config::Auth)
            .configure(router_config::init)
    })
    .bind((APP_CONFIG.server.bind.as_str(), APP_CONFIG.server.port))?
    .run()
    .await
}

{
    tracing::info!("step 1");
    tracing::info!("step 2");
    tracing::info!("step 3");
}

I try to implement CustomRootSpanBuilder to generate uuid to replace span in request, but this uuid is different from request_id in request

2022-12-13T13:36:46.546387Z  INFO 3fdc3e0b-571a-46e1-bf4b-0bc6238247d8: HTTP request{ ...... request_id=813af77e-331a-4818-a84d-7e9bee1a83f7 ......}


问:
Error moving lines/circles in CATIA drawing with VBA macro
I am writing a macro handling a title block in Catia drawings.
I have subs that I use to move circles and lines, which work fine (code initially found here)

```<code>Private Sub moveCircle(oCircle, dX As Double, dY As Double)
    Dim oCtr(1)
    oCircle.GetCenter oCtr

    movePoint oCircle.CenterPoint, dX, dY
    movePoint oCircle.StartPoint, dX, dY
    movePoint oCircle.EndPoint, dX, dY

    oCircle.SetData oCtr(0) + dX, oCtr(1) + dY, oCircle.Radius

    Debug.Print "move circle OK"
End Sub

Private Sub movePoint(oPt, dX As Double, dY As Double)
    Dim oCoord(1)

    oPt.GetCoordinates oCoord
    oPt.SetData oCoord(0) + dX, oCoord(1) + dY
End Sub

Private Sub moveLine(oLine, dX As Double, dY As Double)
    Dim oStartPt As Variant
    Dim oEndPt As Point2D
    Dim myDir(1)
    Dim oPtCoord(1)

    oLine.GetDirection myDir

    Set oStartPt = oLine.StartPoint
    Set oEndPt = oLine.EndPoint
    movePoint oStartPt, dX, dY
    movePoint oEndPt, dX, dY

    oStartPt.GetCoordinates oPtCoord

    oLine.SetData oPtCoord(0), oPtCoord(1), myDir(0), myDir(1)
End Sub
</code>```

So those functions are called in a sub called "DrawView" when I create the drawing to move stuff around depending on the paper format, and everything works well.
If the paper format is changed later on, I want to resize everything and call those functions again from another sub "resizeTitleBlock", exactly the same way, and this is when it doesn't work anymore. I get an error saying the the method SetData in sub movePoint failed.

Those functions are called in both cases like this:

```<code>Dim element
        For Each element In refView.GeometricElements
            Select Case TypeName(element)
                Case "Axis2D":
                    'nothing to do, must be excldued
                Case "Line2D":
                    moveLine element, sheetWidth - 210, 0
                Case "Circle2D":
                    moveCircle element, sheetWidth - 210, 0
            End Select
        Next element
</code>```

Any idea what may cause this issue?

I tried checking that the elements I pass to those functions are the same in both cases (by checking the name of the element). From Sub DrawView, "Line.1" is moved properly. From Sub resizeTitleBlock, I pass "Line.1" to the function again and get the error "the method SetData has failed".

I tried calling calling moveLine from Sub DrawView several times, and it works.

Body:
I am writing a macro handling a title block in Catia drawings.
I have subs that I use to move circles and lines, which work fine (code initially found here)

Private Sub moveCircle(oCircle, dX As Double, dY As Double)
    Dim oCtr(1)
    oCircle.GetCenter oCtr

    movePoint oCircle.CenterPoint, dX, dY
    movePoint oCircle.StartPoint, dX, dY
    movePoint oCircle.EndPoint, dX, dY

    oCircle.SetData oCtr(0) + dX, oCtr(1) + dY, oCircle.Radius

    Debug.Print "move circle OK"
End Sub

Private Sub movePoint(oPt, dX As Double, dY As Double)
    Dim oCoord(1)

    oPt.GetCoordinates oCoord
    oPt.SetData oCoord(0) + dX, oCoord(1) + dY
End Sub

Private Sub moveLine(oLine, dX As Double, dY As Double)
    Dim oStartPt As Variant
    Dim oEndPt As Point2D
    Dim myDir(1)
    Dim oPtCoord(1)

    oLine.GetDirection myDir

    Set oStartPt = oLine.StartPoint
    Set oEndPt = oLine.EndPoint
    movePoint oStartPt, dX, dY
    movePoint oEndPt, dX, dY

    oStartPt.GetCoordinates oPtCoord

    oLine.SetData oPtCoord(0), oPtCoord(1), myDir(0), myDir(1)
End Sub

So those functions are called in a sub called "DrawView" when I create the drawing to move stuff around depending on the paper format, and everything works well.
If the paper format is changed later on, I want to resize everything and call those functions again from another sub "resizeTitleBlock", exactly the same way, and this is when it doesn't work anymore. I get an error saying the the method SetData in sub movePoint failed.

Those functions are called in both cases like this:

Dim element
        For Each element In refView.GeometricElements
            Select Case TypeName(element)
                Case "Axis2D":
                    'nothing to do, must be excldued
                Case "Line2D":
                    moveLine element, sheetWidth - 210, 0
                Case "Circle2D":
                    moveCircle element, sheetWidth - 210, 0
            End Select
        Next element

Any idea what may cause this issue?

I tried checking that the elements I pass to those functions are the same in both cases (by checking the name of the element). From Sub DrawView, "Line.1" is moved properly. From Sub resizeTitleBlock, I pass "Line.1" to the function again and get the error "the method SetData has failed".

I tried calling calling moveLine from Sub DrawView several times, and it works.


问:
Power Automate Sending Multiple Attachments in one mail using "Send an HTTP request to SharePoint"
Good Day!

would like to ask if is possible to send a multiple attachments in one email using "Send an HTTP request to SharePoint" in Power Automate?

Here's my flow

it works well, I just wanted to add uploaded attachments when sending an email, but I don't know where will I add the action for "Get Attachments" and "Initialize Variables"

thanks for the help! still figuring out on how to include the attachments when sending an email.


问:
How to remove extra paths of nested modules from URL Angular 14
I have a nested module structure. And right now I'm accessing the pages like this

when click on a post to read or update

localhost:4200/single-post/63846ef2f20c6912e128f604?id=63846ef2f20c6912e128f604

localhost:4200/update/63846ef2f20c6912e128f604?id=63846ef2f20c6912e128f604

I want to remove single-post and update from my URLs and want to show the URLs like this

```<code>localhost:4200/63846ef2f20c6912e128f604?id=63846ef2f20c6912e128f604
</code>```

Following is the Current Code structure

app-routing.module.ts

```<code>{
    path: 'pages',
    loadChildren: () => PagesModule,
  },
</code>```

pages-routing.module.ts

```<code>{
    path: 'posts',
    loadChildren: () => PostsModule,
  },
</code>```

posts-routing.module.ts

```<code>{ path: 'update/:id', loadChildren: () => UpdateModule },

{ path: 'single-post/:id', loadChildren: () => ReadSinglePostModule },
</code>```

when click on read button

```<code> this.route.navigate([`single-post/${id}`], {
      queryParams: { id: id },
    });
</code>```

when click on update button

```<code> this.route.navigate([`update/${id}`], {
      queryParams: { id: id },
    });
</code>```

Body:
I have a nested module structure. And right now I'm accessing the pages like this

when click on a post to read or update

localhost:4200/single-post/63846ef2f20c6912e128f604?id=63846ef2f20c6912e128f604

localhost:4200/update/63846ef2f20c6912e128f604?id=63846ef2f20c6912e128f604

I want to remove single-post and update from my URLs and want to show the URLs like this

localhost:4200/63846ef2f20c6912e128f604?id=63846ef2f20c6912e128f604

Following is the Current Code structure

app-routing.module.ts

{
    path: 'pages',
    loadChildren: () => PagesModule,
  },

pages-routing.module.ts

{
    path: 'posts',
    loadChildren: () => PostsModule,
  },

posts-routing.module.ts

{ path: 'update/:id', loadChildren: () => UpdateModule },

{ path: 'single-post/:id', loadChildren: () => ReadSinglePostModule },

when click on read button

 this.route.navigate([`single-post/${id}`], {
      queryParams: { id: id },
    });

when click on update button

 this.route.navigate([`update/${id}`], {
      queryParams: { id: id },
    });


问:
Why doesn't Spring Cloud use bootstrap.yml by default anymore?
This is my Spring Cloud test project. As the java version is 1.8, I try to build the cloud project with some new version.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <mysql.version>8.0.30</mysql.version>
    <mybatis.version>3.0.0</mybatis.version>
    <mybatis-plus.version>3.5.2</mybatis-plus.version>
    <spring-boot.version>2.6.11</spring-boot.version>
    <spring-cloud.version>2021.0.4</spring-cloud.version>
    <spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
    <alibaba.nacos.version>2.0.4</alibaba.nacos.version>
    <freemarker.version>2.3.31</freemarker.version>
    <swagger.version>1.6.2</swagger.version>
    <lombok.version>1.18.8</lombok.version>
    <openfeign.version>3.1.5</openfeign.version>
    <loadbalance.version>3.1.4</loadbalance.version>
</properties>
```
<p>enter image description here</p>
<p>https://github.com/Autrui/cloud_test</p>
<p>Then I get the problem. In order and user module, I use bootstrap.yml to config name and nacos, it actually worked. But in gateway module, at first, I set the port 10010 in bootstrap.yml, but the gateway still runs at port 8080. The configuration in application.yml worked.</p>
<p>Then I Google and found that Spring Boot disabled the bootstrap.yml after 2.4.0. Then I have three problems:</p>
<ol>
<li><p>If the bootstrap is actually be abandoned, why my order and user modules can work as usual?</p>
</li>
<li><p>I find we can add the bootstrap dependency in pom, then bootstrap will be loaded again, but I think this is not a elegant way to program.</p>
</li>
</ol>
<pre class="lang-yaml prettyprint-override"><code>config:
  import:
    - optional: nacos:order-dev.yaml
    - nacos: order-dev.yaml
</code>```

I try to  use spring.config.import, but IDEA shows Cannot resolve property 'optional' in java.lang.String. How can I replace bootstrap in my project?

Why Spring disabled the bootstrap? I didn't find the reason also don't know why.

Body:
This is my Spring Cloud test project. As the java version is 1.8, I try to build the cloud project with some new version.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <mysql.version>8.0.30</mysql.version>
    <mybatis.version>3.0.0</mybatis.version>
    <mybatis-plus.version>3.5.2</mybatis-plus.version>
    <spring-boot.version>2.6.11</spring-boot.version>
    <spring-cloud.version>2021.0.4</spring-cloud.version>
    <spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
    <alibaba.nacos.version>2.0.4</alibaba.nacos.version>
    <freemarker.version>2.3.31</freemarker.version>
    <swagger.version>1.6.2</swagger.version>
    <lombok.version>1.18.8</lombok.version>
    <openfeign.version>3.1.5</openfeign.version>
    <loadbalance.version>3.1.4</loadbalance.version>
</properties>

enter image description here

https://github.com/Autrui/cloud_test

Then I get the problem. In order and user module, I use bootstrap.yml to config name and nacos, it actually worked. But in gateway module, at first, I set the port 10010 in bootstrap.yml, but the gateway still runs at port 8080. The configuration in application.yml worked.

Then I Google and found that Spring Boot disabled the bootstrap.yml after 2.4.0. Then I have three problems:

If the bootstrap is actually be abandoned, why my order and user modules can work as usual?

I find we can add the bootstrap dependency in pom, then bootstrap will be loaded again, but I think this is not a elegant way to program.

config:
  import:
    - optional: nacos:order-dev.yaml
    - nacos: order-dev.yaml

I try to  use spring.config.import, but IDEA shows Cannot resolve property 'optional' in java.lang.String. How can I replace bootstrap in my project?

Why Spring disabled the bootstrap? I didn't find the reason also don't know why.


问:
import versioneer gives SyntaxError on *MATCH_ARGS
```<code>python setup.py build --compiler=mingw32
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import versioneer
  File "/cygdrive/c/Users/Mansi/Downloads/cvxopt-1.3.0/versioneer.py", line 1194
    "--always", "--long", *MATCH_ARGS],
                          ^
SyntaxError: invalid syntax
</code>```

Does anyone happen to know why this error is coming?

Body:
python setup.py build --compiler=mingw32
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import versioneer
  File "/cygdrive/c/Users/Mansi/Downloads/cvxopt-1.3.0/versioneer.py", line 1194
    "--always", "--long", *MATCH_ARGS],
                          ^
SyntaxError: invalid syntax

Does anyone happen to know why this error is coming?


问:
MPAndroid Chart / x labels
I am adding values to my chart using this code:
`

```<code>chartEntries.add(new BarEntry(i, Float.parseFloat(json_data.getString("prog_bigl"))));
</code>```

"i" is the index of

```<code>for (int i = 0; i < jArray.length(); i++ ) {
</code>```

` when I get values from a webservice.

The graph is build but in X axis I can see "i" values. I would like to have values from another Json field. It simply a string. How can I substitute "i" with this labels ?

If I tried to put this json value in place of "i" I have no graph.

I can't find any exaustive documentation for this library.

Title: MPAndroid Chart / x labels

Body:
I am adding values to my chart using this code:
`

chartEntries.add(new BarEntry(i, Float.parseFloat(json_data.getString("prog_bigl"))));

"i" is the index of

for (int i = 0; i < jArray.length(); i++ ) {

` when I get values from a webservice.

The graph is build but in X axis I can see "i" values. I would like to have values from another Json field. It simply a string. How can I substitute "i" with this labels ?

If I tried to put this json value in place of "i" I have no graph.

I can't find any exaustive documentation for this library.


问:
Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
I recently installed Tensorflow-gpu and 2 errors popped up.

Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
Ignore above cudart dlerror if you do not have a GPU set up on your machine.

Thing is I want to use my GPU so I am not sure if this will affect it.

I installed cudnn yet still nothing. I installed VS code 2017 and installed c++ with it yet I still get this error. I am using pycharm as my interpreter.


问:
not able to find php.ini FPM/FastCGI
One of my client hosted website on digital ocean server and I want to change some values of php.ini file. When I check the loaded file by using phpinfo() the value I got is below

```<code>/www/server/php/74/etc/php.ini
</code>```

but there is no such folder as www. Server is configured Server API  FPM/FastCGI.

The file under /etc/php/7.4/apache2/php.ini is totally different from the output I am getting using phpinfo()

Can anyone help me where to find the correct loaded php.ini file.

Update

The command
readlink -f  /www/server/php/74/etc/php.ini
is returning nothing.

While the command

```<code>realpath /www/server/php/74/etc/php.ini

realpath: /www/server/php/74/etc/php.ini: No such file or directory
</code>```

Title: not able to find php.ini FPM/FastCGI

Body:
One of my client hosted website on digital ocean server and I want to change some values of php.ini file. When I check the loaded file by using phpinfo() the value I got is below

/www/server/php/74/etc/php.ini

but there is no such folder as www. Server is configured Server API  FPM/FastCGI.

The file under /etc/php/7.4/apache2/php.ini is totally different from the output I am getting using phpinfo()

Can anyone help me where to find the correct loaded php.ini file.

Update

The command
readlink -f  /www/server/php/74/etc/php.ini
is returning nothing.

While the command

realpath /www/server/php/74/etc/php.ini

realpath: /www/server/php/74/etc/php.ini: No such file or directory


问:
'Read' status of the message in Django chat built with django-channels
How can I show read or unread status of the message for the user? I thought about store IDs of messages seen by user - too much info to store. Maybe store tuple(first_seen_message, last_seen_message) - much less memory in use, but we have many chatrooms and direct messages - all messages get IDs in common pull. How to do it?

I haven't tried anything in particular, bc I have no idea howto :D

UPD: I did it through linking message with users that read it with m2m - less memory in use.


问:
Gitlab-ci service command not running
I'm trying to spin up my backend image to use for e2e-testing. When building the backend I make an image which can be used for a service in the frontend. My .gitlab-cy.yml looks partly likes this:

```<code>build-test:
  stage: build
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
    - docker build --build-arg BUILD_ARGUMENT_ENV=test --build-arg BUILD_ARGUMENT_DEBUG_ENABLED=true -t registry.gitlab.com/<company>/<repo>/test:latest .
    - docker push registry.gitlab.com/<company>/<repo>/test:latest
  only:
    changes:
      - Dockerfile
      - docker-compose.yml
      - .gitlab-ci.yml
      - docker/*
      - .env.citest
  when: manual
  tags:
    - test
</code>```

The job in the front-end looks like this:

```<code>e2e-testing:
  image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
  services:
    - name: registry.gitlab.com/<company>/<repo>/test:latest
      alias: <company>-backend
      command: [
        "php artisan db:seed"
      ]
    - name: postgis/postgis:12-3.3
      alias: postgres_citest
    - name: redis:5.0.9
      alias: redis_citest
  variables:
    POSTGRES_DB: <company>_citest
    POSTGRES_USER: <company>
    POSTGRES_PASSWORD: secret
    REDIS_PORT: 6379
  stage: testing
  before_script:
    - yarn
    - yarn run dev &
  script:
    - yarn run e2e:record --parallel --env IS_CI_RUNNING=true
  artifacts:
    when: always
    paths:
      - cypress/videos/**/*.mp4
      - cypress/screenshots/**/*.png
    expire_in: 1 day
  tags:
    - test
</code>```

The command php artisan db:seed isn't preformed and I get the following error:
exec: php artisan db:seed: not found

The other services are used by the backend so I figured they need to be spin up as well. How do I get the command working?

Edit: I've tried testing it local and it does work if I go to the right folder cd ../base, so I added this to the command, but it makes no difference. It still says it can't find the command

Edit 2: I overlooked an error and it seems te gitlab runner is not running. Stil don't know how to solve this
Error response from daemon: Cannot link to a non running container

Title: Gitlab-ci service command not running

Body:
I'm trying to spin up my backend image to use for e2e-testing. When building the backend I make an image which can be used for a service in the frontend. My .gitlab-cy.yml looks partly likes this:

build-test:
  stage: build
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
    - docker build --build-arg BUILD_ARGUMENT_ENV=test --build-arg BUILD_ARGUMENT_DEBUG_ENABLED=true -t registry.gitlab.com/<company>/<repo>/test:latest .
    - docker push registry.gitlab.com/<company>/<repo>/test:latest
  only:
    changes:
      - Dockerfile
      - docker-compose.yml
      - .gitlab-ci.yml
      - docker/*
      - .env.citest
  when: manual
  tags:
    - test

The job in the front-end looks like this:

e2e-testing:
  image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
  services:
    - name: registry.gitlab.com/<company>/<repo>/test:latest
      alias: <company>-backend
      command: [
        "php artisan db:seed"
      ]
    - name: postgis/postgis:12-3.3
      alias: postgres_citest
    - name: redis:5.0.9
      alias: redis_citest
  variables:
    POSTGRES_DB: <company>_citest
    POSTGRES_USER: <company>
    POSTGRES_PASSWORD: secret
    REDIS_PORT: 6379
  stage: testing
  before_script:
    - yarn
    - yarn run dev &
  script:
    - yarn run e2e:record --parallel --env IS_CI_RUNNING=true
  artifacts:
    when: always
    paths:
      - cypress/videos/**/*.mp4
      - cypress/screenshots/**/*.png
    expire_in: 1 day
  tags:
    - test

The command php artisan db:seed isn't preformed and I get the following error:
exec: php artisan db:seed: not found

The other services are used by the backend so I figured they need to be spin up as well. How do I get the command working?

Edit: I've tried testing it local and it does work if I go to the right folder cd ../base, so I added this to the command, but it makes no difference. It still says it can't find the command

Edit 2: I overlooked an error and it seems te gitlab runner is not running. Stil don't know how to solve this
Error response from daemon: Cannot link to a non running container


问:
Python Multiprocessing - Executing multiple programs utilizing different core counts
I want to execute multiple programs in parallel on physical cores, which each use a different number of cores.
Let's say I have the following programs:
p1.exe (using 1 core), p2.exe (using 2 cores), p4.exe (4 cores), and p8.exe (8 cores)

I currently call these in serial using subprocess.Popen, but want to execute p1, p2 and p4 parallel and then p8, when using an 8 core machine. While executing p1, p2 and p4, I don't want p4 to run on e.g. cores 0, 1, 2, 3 while p2 or p1 use and of those.

Does pythons multiprocessing have an option to specify which cores to use, or is there a different way to achieve this?


问:
In chroot , running apt install stuck at processing triggers for?
I create a shell scripts for unattended  install proxmox-ve.

```<code>chroot $pve_target apt update
DEBIAN_FRONTEND=noninteractive chroot $pve_target apt install init systemd  -y
DEBIAN_FRONTEND=noninteractive chroot $pve_target apt install ifenslave ifupdown proxmox-ve  -y
</code>```

It will be ok when i enter commond and run it in tty3.But,in tty2,it will stuck at processing triggers for .

```<code>invoke-rc.d: policy-rc.d denied execution of start .
Setting up dbus (1. 12.24-0+deb11u1)
invoke-rc.d: policy-rc.d denied execution of start .
Setting up 1ibpam-systemd : amd64 (247.3-7+deb11u1)
Processing triggers for libc-bin (2.31- 13+deb11u5)
Progress:[98%][#####并###################################
</code>```

I read the proxinstall
,I can use this commond  and install deb from cdrom.

```<code>
proxmox_libdir="/var/lib/proxmox-installer"
cp $proxmox_libdir/policy-disable-rc.d $pve_target/usr/sbin/policy-rc.d
cp $proxmox_libdir/fake-start-stop-daemon $pve_target/sbin/

diversion_add(){
    chroot $1 dpkg-divert --package proxmox --add --rename $2
    ln -sf $3 $1/$2
}

diversion_add $pve_target /sbin/start-stop-daemon /sbin/fake-start-stop-daemon
diversion_add $pve_target /usr/sbin/update-grub /bin/true
diversion_add $pve_target /usr/sbin/update-initramfs /bin/true
xxxxx
xxxxx
DEBIAN_FRONTEND=noninteractive chroot $pve_target dpkg --force-depends --no-triggers --force-unsafe-io --force-confold  --unpack /media/proxmox/packages/*;
DEBIAN_FRONTEND=noninteractive chroot $pve_target dpkg --force-confold --configure --force-unsafe-io -a
</code>```

The proxmox-ve packages will not latest by this way.
So i want use apt to install proxmox-ve.
I have pushed my code ,see github

Could anyone here help me please?

thanks a lot!

Body:
I create a shell scripts for unattended  install proxmox-ve.

chroot $pve_target apt update
DEBIAN_FRONTEND=noninteractive chroot $pve_target apt install init systemd  -y
DEBIAN_FRONTEND=noninteractive chroot $pve_target apt install ifenslave ifupdown proxmox-ve  -y

It will be ok when i enter commond and run it in tty3.But,in tty2,it will stuck at processing triggers for .

invoke-rc.d: policy-rc.d denied execution of start .
Setting up dbus (1. 12.24-0+deb11u1)
invoke-rc.d: policy-rc.d denied execution of start .
Setting up 1ibpam-systemd : amd64 (247.3-7+deb11u1)
Processing triggers for libc-bin (2.31- 13+deb11u5)
Progress:[98%][#####并###################################

I read the proxinstall
,I can use this commond  and install deb from cdrom.

proxmox_libdir="/var/lib/proxmox-installer"
cp $proxmox_libdir/policy-disable-rc.d $pve_target/usr/sbin/policy-rc.d
cp $proxmox_libdir/fake-start-stop-daemon $pve_target/sbin/

diversion_add(){
    chroot $1 dpkg-divert --package proxmox --add --rename $2
    ln -sf $3 $1/$2
}

diversion_add $pve_target /sbin/start-stop-daemon /sbin/fake-start-stop-daemon
diversion_add $pve_target /usr/sbin/update-grub /bin/true
diversion_add $pve_target /usr/sbin/update-initramfs /bin/true
xxxxx
xxxxx
DEBIAN_FRONTEND=noninteractive chroot $pve_target dpkg --force-depends --no-triggers --force-unsafe-io --force-confold  --unpack /media/proxmox/packages/*;
DEBIAN_FRONTEND=noninteractive chroot $pve_target dpkg --force-confold --configure --force-unsafe-io -a

The proxmox-ve packages will not latest by this way.
So i want use apt to install proxmox-ve.
I have pushed my code ,see github

Could anyone here help me please?

thanks a lot!