问:
Mock `TableClient.QueryAsync()` for Unit Test
I have the following method that I need to test:

```<code>public async Task<SomeClass> GetAsync(string partitionKey, string rowKey)
{
    var entities = new List<SomeClass>();
    await foreach (var e in _tableClient.QueryAsync<SomeClass>(x => x.PartitionKey == partitionKey && x.RowKey == rowKey))
    {
        entities.Add(e);
    }
    return entities.FirstOrDefault();
}
</code>```

I'd like to setup the _tableClient.QueryAsync() (in the moq) to be able to return different result based on the input parameter. This is important to ensure my unit test covers the logic.

My attempt is:

```<code>var thingsToMock = new List<(string PartitionKey, string RowKey, string Value)>() {
    ("maxCount", "maxCount", "0"),
    ("maxCount", "xyz", "1000"),
    ("maxCount", "abc", "2000")
};
var tableClientMock = new Mock<TableClient>();
foreach (var thingToMock in thingsToMock)
{
    var returnPage = Page<SomeClass>.FromValues(new List<SomeClass>
    {
        new SomeClass{ PartitionKey = thingToMock.PartitionKey, RowKey = thingToMock.RowKey, Value = thingToMock.Value }
    }, null, new Mock<Response>().Object);
    var returnPages = AsyncPageable<SomeClass>.FromPages(new[] { returnPage });
    Expression<Func<SomeClass, bool>> exp = (x) => x.PartitionKey == thingToMock.PartitionKey && x.RowKey == thingToMock.RowKey ? true : false;
    tableClientMock
        .Setup(i => i.QueryAsync<SomeClass>(It.Is<Expression<Func<SomeClass, bool>>>(expression => LambdaExpression.Equals(expression, exp)), null, null, default))
        .Returns(returnPages);
}
</code>```

The issue is that the _tableClientMock doesn't seem to return what I expected when I call GetAsync("maxCount", "abc"). I'd expect with this call, it would pass in the same parameters to tableClient.QueryAsync() method, which in my Mock should return instance of SomeClass with value of 2000. But instead, it throw "Object reference not set to an instance of an object." error.

If I change the tableClientMock setup for QueryAsync to be the following, it somewhat works:

```<code>.Setup(i => i.QueryAsync<SomeClass>(It.IsAny<Expression<Func<SomeClass, bool>>>(), null, null, default))
</code>```

But this will not achieve my objective, which is to be able to pass different parameters (partitionKey and rowKey) to get different result.

I'm using the following NuGet package:

"Azure.Data.Tables" Version="12.7.1"

"moq" Version="4.14.1"

Body:
I have the following method that I need to test:

public async Task<SomeClass> GetAsync(string partitionKey, string rowKey)
{
    var entities = new List<SomeClass>();
    await foreach (var e in _tableClient.QueryAsync<SomeClass>(x => x.PartitionKey == partitionKey && x.RowKey == rowKey))
    {
        entities.Add(e);
    }
    return entities.FirstOrDefault();
}

I'd like to setup the _tableClient.QueryAsync() (in the moq) to be able to return different result based on the input parameter. This is important to ensure my unit test covers the logic.

My attempt is:

var thingsToMock = new List<(string PartitionKey, string RowKey, string Value)>() {
    ("maxCount", "maxCount", "0"),
    ("maxCount", "xyz", "1000"),
    ("maxCount", "abc", "2000")
};
var tableClientMock = new Mock<TableClient>();
foreach (var thingToMock in thingsToMock)
{
    var returnPage = Page<SomeClass>.FromValues(new List<SomeClass>
    {
        new SomeClass{ PartitionKey = thingToMock.PartitionKey, RowKey = thingToMock.RowKey, Value = thingToMock.Value }
    }, null, new Mock<Response>().Object);
    var returnPages = AsyncPageable<SomeClass>.FromPages(new[] { returnPage });
    Expression<Func<SomeClass, bool>> exp = (x) => x.PartitionKey == thingToMock.PartitionKey && x.RowKey == thingToMock.RowKey ? true : false;
    tableClientMock
        .Setup(i => i.QueryAsync<SomeClass>(It.Is<Expression<Func<SomeClass, bool>>>(expression => LambdaExpression.Equals(expression, exp)), null, null, default))
        .Returns(returnPages);
}

The issue is that the _tableClientMock doesn't seem to return what I expected when I call GetAsync("maxCount", "abc"). I'd expect with this call, it would pass in the same parameters to tableClient.QueryAsync() method, which in my Mock should return instance of SomeClass with value of 2000. But instead, it throw "Object reference not set to an instance of an object." error.

If I change the tableClientMock setup for QueryAsync to be the following, it somewhat works:

.Setup(i => i.QueryAsync<SomeClass>(It.IsAny<Expression<Func<SomeClass, bool>>>(), null, null, default))

But this will not achieve my objective, which is to be able to pass different parameters (partitionKey and rowKey) to get different result.

I'm using the following NuGet package:

"Azure.Data.Tables" Version="12.7.1"

"moq" Version="4.14.1"


来源: stackexchange

问:
Smart / fast svg fill method

In vector editors, it is possible to fill a segment with color. This creates an additional svg element. Is it possible to implement this on javascript? I am interested in a ready-made solution like a library or method, or an algorithm, how to achieve this.

In search of a solution, I found libraries for finding intersections of paths, but this is not what I need. Svg can be of any shape. What I can control: there will be only path.

ContentLicense: CC BY-SA 4.0

Title: Smart / fast svg fill method


问:
Installed Yarn, but still not running, just like NPM
I'm on macOS High Sierra and Node new versions don't run, so I installed Yarn. Everything runs OK on yarn install, but I get this error on yarn run watch:

```<code> ✘ marcellopato@MacBook-Pro-de-Marcello  ~/Documents/Sites/social-network   master ±  yarn run watch
yarn run v1.22.19
$ npm run development -- --watch

> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

 10% building modules 1/1 modules 0 active
Webpack is watching the files…

 10% building modules 3/5 modules 2 active ...modules/style-loader/lib/addStyles.jsnode:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:135:10)
    at filename (/Users/marcellopato/Documents/Sites/social-network/node_modules/babel-loader/lib/fs-cache.js:76:21)
    at /Users/marcellopato/Documents/Sites/social-network/node_modules/babel-loader/lib/fs-cache.js:107:37
    at /Users/marcellopato/Documents/Sites/social-network/node_modules/mkdirp/index.js:51:26
    at FSReqCallback.oncomplete (node:fs:200:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.9.1
error Command failed with exit code 1.
</code>```

Body:
I'm on macOS High Sierra and Node new versions don't run, so I installed Yarn. Everything runs OK on yarn install, but I get this error on yarn run watch:

 ✘ marcellopato@MacBook-Pro-de-Marcello  ~/Documents/Sites/social-network   master ±  yarn run watch
yarn run v1.22.19
$ npm run development -- --watch

> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

 10% building modules 1/1 modules 0 active
Webpack is watching the files…

 10% building modules 3/5 modules 2 active ...modules/style-loader/lib/addStyles.jsnode:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:135:10)
    at filename (/Users/marcellopato/Documents/Sites/social-network/node_modules/babel-loader/lib/fs-cache.js:76:21)
    at /Users/marcellopato/Documents/Sites/social-network/node_modules/babel-loader/lib/fs-cache.js:107:37
    at /Users/marcellopato/Documents/Sites/social-network/node_modules/mkdirp/index.js:51:26
    at FSReqCallback.oncomplete (node:fs:200:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.9.1
error Command failed with exit code 1.


问:
Remove Scrollsbar from Widget
I have a website where I use an Eventbrite Widget to checkout a page on my website.

It turns out that when running the script, the iframe, especially on cell phones, does not show the entire checkout. Scrollsbar appears to scroll and see some information.

It turns out that I would like to remove these scrollsbars, because some users don't bother to scroll them down  and end up not filling in some data and not being able to proceed with the purchase.

The code I have is this:

I tried a height on the div, but it didn't work.

```<code>type her<div id="eventbrite-widget-container-489731288460" style="display: block; height: 100%;"></div>
<p>
<script src="https://www.eventbrite.com.br/static/widgets/eb_widgets.js"></script>
<script type="text/javascript">
var exampleCallback = function() {
       console.log('Order complete!');
};
window.EBWidgets.createWidget({
// Required
widgetType: 'checkout',
eventId: '489731288460',
iframeContainerId: 'eventbrite-widget-container-489731288460',
// Optional
iframeContainerHeight: 900, // Widget height in pixels. Defaults to a minimum of 425px if not provided
onOrderComplete: exampleCallback // Method called when an order has successfully completed
});
</script>e
</code>```

I also put the iframeContainerHeight: 900, but on the cell phone the scrollbar continues to appear

If anyone knows how to solve it, I'm grateful.

Remove eventbrite iframe scrollbar

Title: Remove Scrollsbar from Widget

Body:
I have a website where I use an Eventbrite Widget to checkout a page on my website.

It turns out that when running the script, the iframe, especially on cell phones, does not show the entire checkout. Scrollsbar appears to scroll and see some information.

It turns out that I would like to remove these scrollsbars, because some users don't bother to scroll them down  and end up not filling in some data and not being able to proceed with the purchase.

The code I have is this:

I tried a height on the div, but it didn't work.

type her

e

I also put the iframeContainerHeight: 900, but on the cell phone the scrollbar continues to appear

If anyone knows how to solve it, I'm grateful.

Remove eventbrite iframe scrollbar


问:
How to present the 'greater than or equal' in Python?
I'm using ReportLab to create PDF documents. I'm importing text from .txt files to Python so these texts display in my document.
For things to look nice, I would like to display the literal 'greater than or equal' symbol in my document.

How can I present the symbol ≥ in the .txt file (not >=) in a way Python understands?
Same question for 'less than or equal' symbol.

Thank you!


问:
Is it possible to use Django's Replace in a case-insensitive way?
With a query like this:

from django.db.models import Value
from django.db.models.functions import Replace

MyModel.objects.update(description=Replace("description", Value("old"), Value("new")))
```

Django will have the database search for the substring old in the description field, and replace it with new. Is it possible to also match oLd, and OLD, etc without explicitly specifying each combination? Have Replace look for old with any case, and replace it with the new string?

The documentation for Replace doesn't seem to specify a case insensitive option.

Body:
With a query like this:

from django.db.models import Value
from django.db.models.functions import Replace

MyModel.objects.update(description=Replace("description", Value("old"), Value("new")))

Django will have the database search for the substring old in the description field, and replace it with new. Is it possible to also match oLd, and OLD, etc without explicitly specifying each combination? Have Replace look for old with any case, and replace it with the new string?

The documentation for Replace doesn't seem to specify a case insensitive option.


问:
How do I have to fill out the GooglePlay Data safety section?
My app doesn't collect any data that I would see. But it has GoogleADs so I guess it collesct some data since it is Google.

I tried to search it but all I could find was pretty wage.


问:
Google Drive API: search file and get a snippet of the content of the results
I have a php script that uses the google/apiclient from composer libraries to search for files on Google Drive.
I know I can get extra data/metadata of the results using fields but there is no field like fullText that comes with the results and contains either the full text or a snippet of the text where the search query was found.
My goal is to give the end user some context of what the result is and if it really is the file they are looking for.

Has anyone done something like this? Maybe a hidden field?

To give a more visual idea of what I have running:

```<code>$result = $service->files->listFiles(
  [
    'q' => "fullText contains 'find this on the file content'",
    'supportsAllDrives' => TRUE,
    'includeItemsFromAllDrives' => TRUE,
    'corpora' => 'allDrives',
    'fields' => 'files(id, size, thisFieldContainsTheTextSnippetWhereTheQueryWasFound )'
  ]
);
</code>```

And I want this as a result:

```<code> $result = Google\Service\Drive\FileList Object
(
    [collection_key:protected] => files
    [filesType:protected] => Google\Service\Drive\DriveFile
    [filesDataType:protected] => array
    [files] => Array
        (
            [0] => Google\Service\Drive\DriveFile Object
                (
                    [collection_key:protected] => spaces
                    [appProperties] =>
                    [capabilitiesType:protected] => Google\Service\Drive\DriveFileCapabilities
                    [capabilitiesDataType:protected] =>
                    [capabilities] =>
                    [contentHintsType:protected] => Google\Service\Drive\DriveFileContentHints
                    [contentHintsDataType:protected] =>
                    [contentHints] =>
                    [contentRestrictionsType:protected] => Google\Service\Drive\ContentRestriction
                    [contentRestrictionsDataType:protected] => array
                    [contentRestrictions] =>
                    [copyRequiresWriterPermission] =>
                    [createdTime] =>
                    [description] =>
                    [driveId] =>
                    [explicitlyTrashed] =>
                    [exportLinks] =>
                    [fileExtension] =>
                    [folderColorRgb] =>
                    [fullFileExtension] =>
                    [hasAugmentedPermissions] =>
                    [hasThumbnail] =>
                    [headRevisionId] =>
                    [iconLink] =>
                    [id] => hAshID
                    [imageMediaMetadataType:protected] => Google\Service\Drive\DriveFileImageMediaMetadata
                    [imageMediaMetadataDataType:protected] =>
                    [imageMediaMetadata] =>
                    [isAppAuthorized] =>
                    [kind] =>
                    [labelInfoType:protected] => Google\Service\Drive\DriveFileLabelInfo
                    [labelInfoDataType:protected] =>
                    [labelInfo] =>
                    [lastModifyingUserType:protected] => Google\Service\Drive\User
                    [lastModifyingUserDataType:protected] =>
                    [lastModifyingUser] =>
                    [linkShareMetadataType:protected] => Google\Service\Drive\DriveFileLinkShareMetadata
                    [linkShareMetadataDataType:protected] =>
                    [linkShareMetadata] =>
                    [md5Checksum] =>
                    [mimeType] =>
                    [modifiedByMe] =>
                    [modifiedByMeTime] =>
                    [modifiedTime] =>
                    [name] =>
                    [originalFilename] =>
                    [ownedByMe] =>
                    [ownersType:protected] => Google\Service\Drive\User
                    [ownersDataType:protected] => array
                    [owners] =>
                    [parents] =>
                    [permissionIds] =>
                    [permissionsType:protected] => Google\Service\Drive\Permission
                    [permissionsDataType:protected] => array
                    [permissions] =>
                    [properties] =>
                    [quotaBytesUsed] =>
                    [resourceKey] =>
                    [sha1Checksum] =>
                    [sha256Checksum] =>
                    [shared] =>
                    [sharedWithMeTime] =>
                    [sharingUserType:protected] => Google\Service\Drive\User
                    [sharingUserDataType:protected] =>
                    [sharingUser] =>
                    [shortcutDetailsType:protected] => Google\Service\Drive\DriveFileShortcutDetails
                    [shortcutDetailsDataType:protected] =>
                    [shortcutDetails] =>
                    [size] => fileSize
                    [spaces] =>
                    [starred] =>
                    [teamDriveId] =>
                    [thumbnailLink] =>
                    [thumbnailVersion] =>
                    [trashed] =>
                    [trashedTime] =>
                    [trashingUserType:protected] => Google\Service\Drive\User
                    [trashingUserDataType:protected] =>
                    [trashingUser] =>
                    [version] =>
                    [videoMediaMetadataType:protected] => Google\Service\Drive\DriveFileVideoMediaMetadata
                    [videoMediaMetadataDataType:protected] =>
                    [videoMediaMetadata] =>
                    [viewedByMe] =>
                    [viewedByMeTime] =>
                    [viewersCanCopyContent] =>
                    [webContentLink] =>
                    [webViewLink] =>
                    [writersCanShare] =>
                    [internal_gapi_mappings:protected] => Array
                        (
                        )

                    [modelData:protected] => Array
                        (
                        )

                    [processed:protected] => Array
                        (
                        )
              >>>>> [thisFieldContainsTheTextSnippetWhereTheQueryWasFound] => '...as i was broswing the website to find this on the file content, i was forced to ask about on st...'  <<<<<

                )
        (
            [1] => Google\Service\Drive\DriveFile Object
                (
... cut to avoid repeating unnecessary stuff ...
                    [id] => AnotherhAshID
... cut to avoid repeating unnecessary stuff ...
              >>>>> [thisFieldContainsTheTextSnippetWhereTheQueryWasFound] => '...this file has the text "find this on the file content", but just as an example and it is not what I am looking for...'  <<<<<

                )

        )

    [incompleteSearch] =>
    [kind] =>
    [nextPageToken] =>
    [internal_gapi_mappings:protected] => Array
        (
        )

    [modelData:protected] => Array
        (
        )

    [processed:protected] => Array
        (
        )

)

</code>```

Body:
I have a php script that uses the google/apiclient from composer libraries to search for files on Google Drive.
I know I can get extra data/metadata of the results using fields but there is no field like fullText that comes with the results and contains either the full text or a snippet of the text where the search query was found.
My goal is to give the end user some context of what the result is and if it really is the file they are looking for.

Has anyone done something like this? Maybe a hidden field?

To give a more visual idea of what I have running:

$result = $service->files->listFiles(
  [
    'q' => "fullText contains 'find this on the file content'",
    'supportsAllDrives' => TRUE,
    'includeItemsFromAllDrives' => TRUE,
    'corpora' => 'allDrives',
    'fields' => 'files(id, size, thisFieldContainsTheTextSnippetWhereTheQueryWasFound )'
  ]
);

And I want this as a result:

 $result = Google\Service\Drive\FileList Object
(
    [collection_key:protected] => files
    [filesType:protected] => Google\Service\Drive\DriveFile
    [filesDataType:protected] => array
    [files] => Array
        (
            [0] => Google\Service\Drive\DriveFile Object
                (
                    [collection_key:protected] => spaces
                    [appProperties] =>
                    [capabilitiesType:protected] => Google\Service\Drive\DriveFileCapabilities
                    [capabilitiesDataType:protected] =>
                    [capabilities] =>
                    [contentHintsType:protected] => Google\Service\Drive\DriveFileContentHints
                    [contentHintsDataType:protected] =>
                    [contentHints] =>
                    [contentRestrictionsType:protected] => Google\Service\Drive\ContentRestriction
                    [contentRestrictionsDataType:protected] => array
                    [contentRestrictions] =>
                    [copyRequiresWriterPermission] =>
                    [createdTime] =>
                    [description] =>
                    [driveId] =>
                    [explicitlyTrashed] =>
                    [exportLinks] =>
                    [fileExtension] =>
                    [folderColorRgb] =>
                    [fullFileExtension] =>
                    [hasAugmentedPermissions] =>
                    [hasThumbnail] =>
                    [headRevisionId] =>
                    [iconLink] =>
                    [id] => hAshID
                    [imageMediaMetadataType:protected] => Google\Service\Drive\DriveFileImageMediaMetadata
                    [imageMediaMetadataDataType:protected] =>
                    [imageMediaMetadata] =>
                    [isAppAuthorized] =>
                    [kind] =>
                    [labelInfoType:protected] => Google\Service\Drive\DriveFileLabelInfo
                    [labelInfoDataType:protected] =>
                    [labelInfo] =>
                    [lastModifyingUserType:protected] => Google\Service\Drive\User
                    [lastModifyingUserDataType:protected] =>
                    [lastModifyingUser] =>
                    [linkShareMetadataType:protected] => Google\Service\Drive\DriveFileLinkShareMetadata
                    [linkShareMetadataDataType:protected] =>
                    [linkShareMetadata] =>
                    [md5Checksum] =>
                    [mimeType] =>
                    [modifiedByMe] =>
                    [modifiedByMeTime] =>
                    [modifiedTime] =>
                    [name] =>
                    [originalFilename] =>
                    [ownedByMe] =>
                    [ownersType:protected] => Google\Service\Drive\User
                    [ownersDataType:protected] => array
                    [owners] =>
                    [parents] =>
                    [permissionIds] =>
                    [permissionsType:protected] => Google\Service\Drive\Permission
                    [permissionsDataType:protected] => array
                    [permissions] =>
                    [properties] =>
                    [quotaBytesUsed] =>
                    [resourceKey] =>
                    [sha1Checksum] =>
                    [sha256Checksum] =>
                    [shared] =>
                    [sharedWithMeTime] =>
                    [sharingUserType:protected] => Google\Service\Drive\User
                    [sharingUserDataType:protected] =>
                    [sharingUser] =>
                    [shortcutDetailsType:protected] => Google\Service\Drive\DriveFileShortcutDetails
                    [shortcutDetailsDataType:protected] =>
                    [shortcutDetails] =>
                    [size] => fileSize
                    [spaces] =>
                    [starred] =>
                    [teamDriveId] =>
                    [thumbnailLink] =>
                    [thumbnailVersion] =>
                    [trashed] =>
                    [trashedTime] =>
                    [trashingUserType:protected] => Google\Service\Drive\User
                    [trashingUserDataType:protected] =>
                    [trashingUser] =>
                    [version] =>
                    [videoMediaMetadataType:protected] => Google\Service\Drive\DriveFileVideoMediaMetadata
                    [videoMediaMetadataDataType:protected] =>
                    [videoMediaMetadata] =>
                    [viewedByMe] =>
                    [viewedByMeTime] =>
                    [viewersCanCopyContent] =>
                    [webContentLink] =>
                    [webViewLink] =>
                    [writersCanShare] =>
                    [internal_gapi_mappings:protected] => Array
                        (
                        )

                    [modelData:protected] => Array
                        (
                        )

                    [processed:protected] => Array
                        (
                        )
              >>>>> [thisFieldContainsTheTextSnippetWhereTheQueryWasFound] => '...as i was broswing the website to find this on the file content, i was forced to ask about on st...'  <<<<<

                )
        (
            [1] => Google\Service\Drive\DriveFile Object
                (
... cut to avoid repeating unnecessary stuff ...
                    [id] => AnotherhAshID
... cut to avoid repeating unnecessary stuff ...
              >>>>> [thisFieldContainsTheTextSnippetWhereTheQueryWasFound] => '...this file has the text "find this on the file content", but just as an example and it is not what I am looking for...'  <<<<<

                )

        )

    [incompleteSearch] =>
    [kind] =>
    [nextPageToken] =>
    [internal_gapi_mappings:protected] => Array
        (
        )

    [modelData:protected] => Array
        (
        )

    [processed:protected] => Array
        (
        )

)


问:
Is there a ways for zsh completion to ignore multiple command prefixes?
I'm trying to add zsh completions for some aliases which are prefixed by a command and some args. More specifically, I have some commands which are aliased to an envchain ENV_NAME prefix.

For example:

alias brew='envchain homebrew-credentials brew'
```

What I'm trying to achieve is having completions for brew command.

What I've been able to do so far is set compdef _precommand envchain, but it doesn't work because envchain takes an argument before the actual command.

Body:
I'm trying to add zsh completions for some aliases which are prefixed by a command and some args. More specifically, I have some commands which are aliased to an envchain ENV_NAME prefix.

For example:

alias brew='envchain homebrew-credentials brew'

What I'm trying to achieve is having completions for brew command.

What I've been able to do so far is set compdef _precommand envchain, but it doesn't work because envchain takes an argument before the actual command.


问:
ToolBar Icons showing when in secondary order Maui
So I'm coding in my toolbar items to sort through my data, but on iOS the images show up but on android it does the 3 dots like it's supposed to. I don't know if this is a bug with MAUI (I didn't see anything in the git about it). I know the secondary order is supposed to have the dots by default, but I'm pretty sure they shouldn't get overridden by pictures.

Here's my code for the toolbars:

```<code>public void SortByLocation()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.Distance;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_location_string;
}

public void SortByName()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.Name;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_name_string;
}

public void SortByNewest()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.DateLatest;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_recent_string;
}

public void SortByOldest()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.DateEarliest;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_earliest_string;
}

private void SortByLabelTapped()
{
    // Do nothing for now. Ideally we would pop up the toolbar, but am unsure how to do it
}

private IList<ToolbarItem> GetSortToolbarItems()
{
    var list = new List<ToolbarItem>();
    // Add default item
    list.Add(
       new ToolbarItem(
           sort_method_string_,
           "mow.png",
           SortByLabelTapped,
           ToolbarItemOrder.Primary, 0)
       );
    // Add options to choose from
    list.Add(
        new ToolbarItem(
            sort_by_location_string,
            "mow.png",
            SortByLocation,
            ToolbarItemOrder.Secondary, 0)
        );
    list.Add(
        new ToolbarItem(
            sort_by_name_string,
            "mow.png",
            SortByName,
            ToolbarItemOrder.Secondary, 1)
        );
    list.Add(
        new ToolbarItem(
            sort_by_recent_string,
            "mow.png",
            SortByNewest,
            ToolbarItemOrder.Secondary, 2)
        );
    list.Add(
       new ToolbarItem(
           sort_by_earliest_string,
           "mow.png",
           SortByOldest,
           ToolbarItemOrder.Secondary, 3)
       );

    return list;
}
</code>```

I need the 3 dots to show up on iOS.

Body:
So I'm coding in my toolbar items to sort through my data, but on iOS the images show up but on android it does the 3 dots like it's supposed to. I don't know if this is a bug with MAUI (I didn't see anything in the git about it). I know the secondary order is supposed to have the dots by default, but I'm pretty sure they shouldn't get overridden by pictures.

Here's my code for the toolbars:

public void SortByLocation()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.Distance;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_location_string;
}

public void SortByName()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.Name;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_name_string;
}

public void SortByNewest()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.DateLatest;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_recent_string;
}

public void SortByOldest()
{
    view_model_.SortMethod = Utilities.PlanSortMethod.DateEarliest;
    sort_method_ = view_model_.SortMethod;
    sort_method_string_ = ToolbarItems[0].Text = sort_by_earliest_string;
}

private void SortByLabelTapped()
{
    // Do nothing for now. Ideally we would pop up the toolbar, but am unsure how to do it
}

private IList<ToolbarItem> GetSortToolbarItems()
{
    var list = new List<ToolbarItem>();
    // Add default item
    list.Add(
       new ToolbarItem(
           sort_method_string_,
           "mow.png",
           SortByLabelTapped,
           ToolbarItemOrder.Primary, 0)
       );
    // Add options to choose from
    list.Add(
        new ToolbarItem(
            sort_by_location_string,
            "mow.png",
            SortByLocation,
            ToolbarItemOrder.Secondary, 0)
        );
    list.Add(
        new ToolbarItem(
            sort_by_name_string,
            "mow.png",
            SortByName,
            ToolbarItemOrder.Secondary, 1)
        );
    list.Add(
        new ToolbarItem(
            sort_by_recent_string,
            "mow.png",
            SortByNewest,
            ToolbarItemOrder.Secondary, 2)
        );
    list.Add(
       new ToolbarItem(
           sort_by_earliest_string,
           "mow.png",
           SortByOldest,
           ToolbarItemOrder.Secondary, 3)
       );

    return list;
}

I need the 3 dots to show up on iOS.


问:
Cheerio's first().text() returns empty value when applied on an HTML input tag with id
I am trying to access data from a HTML file's input tag using Cheerio. I am able to load the html in cheerio, as well as access the tag's data using first(). However, when I try to convert the returned value from first() using text(), I get a blank return value. The sample html input tag  when obtained, looks like:

```<code><input type="hidden" name="abc" id="abc" value="[
   {
      "Status": "Obtained",
      "History": [
        {
           "HistoryDate": "07/21/2022"
        }
      ]
  }
]" />
</code>```

Below is a sample code that gives me data from the input tag whose id is "abc".

```<code>import * as cheerio from 'cheerio';

const $ = cheerio.load(html);
console.log($('#abc').first())
</code>```

However, when I try to convert the above logged value to a text, by using the following, I get a blank value:

```<code>console.log($('#abc').first().text())
</code>```

Body:
I am trying to access data from a HTML file's input tag using Cheerio. I am able to load the html in cheerio, as well as access the tag's data using first(). However, when I try to convert the returned value from first() using text(), I get a blank return value. The sample html input tag  when obtained, looks like:

<input type="hidden" name="abc" id="abc" value="[
   {
      "Status": "Obtained",
      "History": [
        {
           "HistoryDate": "07/21/2022"
        }
      ]
  }
]" />

Below is a sample code that gives me data from the input tag whose id is "abc".

import * as cheerio from 'cheerio';

const $ = cheerio.load(html);
console.log($('#abc').first())

However, when I try to convert the above logged value to a text, by using the following, I get a blank value:

console.log($('#abc').first().text())


问:
Build fails on vercel but succeeds on local
I have a flutter application that I'm deploying on vercel.

My problem is that after updating a package I use, my build in vercel fails. When I build the exact same location manually, it works.

This indicates to me that there must something be wrong with the way I'm deploying but I have no idea what the differences to building locally are.

The error I get on vercel is:

```<code>../.pub-cache/hosted/pub.dev/audioplayers_web-2.1.0/lib/web_audio_js.dart:8:12:
Error: `@staticInterop` classes should not contain any generative constructors.
  external JsAudioContext();
</code>```

My install command for Vercel is:
if cd flutter; then git pull && cd .. ; else git clone https://github.com/flutter/flutter.git; fi && ls && flutter/bin/flutter doctor && flutter/bin/flutter clean && flutter/bin/flutter config --enable-web

And my build command for vercel is
flutter/bin/flutter build web --profile -t lib/main.dart --web-renderer=canvaskit

Body:
I have a flutter application that I'm deploying on vercel.

My problem is that after updating a package I use, my build in vercel fails. When I build the exact same location manually, it works.

This indicates to me that there must something be wrong with the way I'm deploying but I have no idea what the differences to building locally are.

The error I get on vercel is:

../.pub-cache/hosted/pub.dev/audioplayers_web-2.1.0/lib/web_audio_js.dart:8:12:
Error: `@staticInterop` classes should not contain any generative constructors.
  external JsAudioContext();

My install command for Vercel is:
if cd flutter; then git pull && cd .. ; else git clone https://github.com/flutter/flutter.git; fi && ls && flutter/bin/flutter doctor && flutter/bin/flutter clean && flutter/bin/flutter config --enable-web

And my build command for vercel is
flutter/bin/flutter build web --profile -t lib/main.dart --web-renderer=canvaskit


问:
Unusual Mesh Outline PColorMesh
I am utilizing the pcolormesh function in Matplotlib to plot a series of gridded data (in parallel) across multiple map domains. The code snippet relevant to this question is as follows:

```<code>im = ax2.pcolormesh(xgrid, ygrid, data.variable.data[0], cmap=cmap, norm=norm, alpha=0.90, facecolor=None)
Where: xgrid = array of longitude points, ygrid = array of latitude points, data.variable.data[0] = array of corresponding data values, cmap = defined colormap, & norm = defined value normalization
</code>```

Consider the following image generated from the provided code:

The undesired result I've found in the image above is what appears to be outlines around each grid square, or perhaps better described as patchwork that stands out slightly as the mesh alpha is reduced below 1.

I've set facecolor=None assuming that would remove these outlines, to no avail. What additions or corrections can I make to remove this feature?

Title: Unusual Mesh Outline PColorMesh

Body:
I am utilizing the pcolormesh function in Matplotlib to plot a series of gridded data (in parallel) across multiple map domains. The code snippet relevant to this question is as follows:

im = ax2.pcolormesh(xgrid, ygrid, data.variable.data[0], cmap=cmap, norm=norm, alpha=0.90, facecolor=None)
Where: xgrid = array of longitude points, ygrid = array of latitude points, data.variable.data[0] = array of corresponding data values, cmap = defined colormap, & norm = defined value normalization

Consider the following image generated from the provided code:

The undesired result I've found in the image above is what appears to be outlines around each grid square, or perhaps better described as patchwork that stands out slightly as the mesh alpha is reduced below 1.

I've set facecolor=None assuming that would remove these outlines, to no avail. What additions or corrections can I make to remove this feature?


问:
TFlite model slow/no inference
I am trying to get an opencv pipeline working on a REV control hub for FTC with tensorflow. I have a trained TFLite model and I am processing it and retrieving the confidences. It works well on an android device as an android app, but it doesn't seem to work with the REV control hub. You may see that I have a variable named here2, this always evaluates to false unless it is before model.process, showing that the model doesn't get processed. Any idea why this is?

```<code>package org.firstinspires.ftc.teamcode.vision;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;

import org.firstinspires.ftc.robotcontroller.internal.FtcRobotControllerActivity;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.teamcode.ml.ModelUnquant;
import org.opencv.core.Mat;
import org.openftc.easyopencv.OpenCvPipeline;
import org.opencv.android.Utils;
import org.tensorflow.lite.DataType;
import org.tensorflow.lite.support.tensorbuffer.TensorBuffer;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class CircularTagDetectionPipeline extends OpenCvPipeline {
    Telemetry telemetry;
    public boolean done = false;
    public int pos = -1;
    public boolean here1 = false;
    public boolean here2 = false;
    public CircularTagDetectionPipeline(Telemetry telemetry){
        this.telemetry = telemetry;
    }
    @Override
    public Mat processFrame(Mat input) {
        Bitmap bmp = Bitmap.createBitmap(input.width(), input.height(), Bitmap.Config.ARGB_8888);
        Utils.matToBitmap(input, bmp);
        pos = classifyImage(bmp);
        done = true;
        return input;
    }

    public int classifyImage(Bitmap image){
        try {
            image = Bitmap.createScaledBitmap(image, 224, 224, false);
            //image.setWidth(224);
            //image.setHeight(224);
            ModelUnquant model = ModelUnquant.newInstance(FtcRobotControllerActivity.contextFTC);
            int imageWidth = image.getWidth();
            int imageHeight = image.getHeight();

            TensorBuffer inputFeature0 = TensorBuffer.createFixedSize(new int[]{1, 224, 224, 3}, DataType.FLOAT32);
            ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4*imageWidth*imageHeight*3);
            byteBuffer.order(ByteOrder.nativeOrder());
            int[] intValues = new int[imageWidth*imageHeight];
            image.getPixels(intValues, 0, imageWidth,0, 0, imageWidth, imageHeight);
            int pixel = 0;
            for(int i = 0; i < imageWidth; i++){
                for(int j = 0; j < imageHeight; j++){
                    int val = intValues[pixel++];
                    byteBuffer.putFloat(((val >> 16)&0xFF)*(1.f/255.f));
                    byteBuffer.putFloat(((val >> 8)&0xFF)*(1.f/255.f));
                    byteBuffer.putFloat((val & 0xFF)*(1.f/255.f));
                }
                telemetry.addLine(i+"");
            }
            here1 = true;

            inputFeature0.loadBuffer(byteBuffer);

            ModelUnquant.Outputs outputs = model.process(inputFeature0);

            TensorBuffer outputFeature0 = outputs.getOutputFeature0AsTensorBuffer();
            here2 = true;
            float[] confidences = outputFeature0.getFloatArray();
            int maxPos = 0;
            float maxConfidence = 0;
            for(int i = 0; i < confidences.length; i++){
                if(confidences[i] > maxConfidence){
                    maxConfidence = confidences[i];
                    maxPos = i;
                }
            }

            String[] classes = {"1", "2", "3"};
            int posReturn = Integer.parseInt(classes[maxPos]);
            model.close();
            return posReturn;
        } catch (IOException e) {
            e.printStackTrace();
            return 0;
        }
    }
}
</code>```

I am expecting the robot to go to execute the desired trajectory based on the confidences, but confidences never get processed. I tried on an android app and it worked, just not on the control hub.

Title: TFlite model slow/no inference

Body:
I am trying to get an opencv pipeline working on a REV control hub for FTC with tensorflow. I have a trained TFLite model and I am processing it and retrieving the confidences. It works well on an android device as an android app, but it doesn't seem to work with the REV control hub. You may see that I have a variable named here2, this always evaluates to false unless it is before model.process, showing that the model doesn't get processed. Any idea why this is?

package org.firstinspires.ftc.teamcode.vision;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;

import org.firstinspires.ftc.robotcontroller.internal.FtcRobotControllerActivity;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.teamcode.ml.ModelUnquant;
import org.opencv.core.Mat;
import org.openftc.easyopencv.OpenCvPipeline;
import org.opencv.android.Utils;
import org.tensorflow.lite.DataType;
import org.tensorflow.lite.support.tensorbuffer.TensorBuffer;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class CircularTagDetectionPipeline extends OpenCvPipeline {
    Telemetry telemetry;
    public boolean done = false;
    public int pos = -1;
    public boolean here1 = false;
    public boolean here2 = false;
    public CircularTagDetectionPipeline(Telemetry telemetry){
        this.telemetry = telemetry;
    }
    @Override
    public Mat processFrame(Mat input) {
        Bitmap bmp = Bitmap.createBitmap(input.width(), input.height(), Bitmap.Config.ARGB_8888);
        Utils.matToBitmap(input, bmp);
        pos = classifyImage(bmp);
        done = true;
        return input;
    }

    public int classifyImage(Bitmap image){
        try {
            image = Bitmap.createScaledBitmap(image, 224, 224, false);
            //image.setWidth(224);
            //image.setHeight(224);
            ModelUnquant model = ModelUnquant.newInstance(FtcRobotControllerActivity.contextFTC);
            int imageWidth = image.getWidth();
            int imageHeight = image.getHeight();

            TensorBuffer inputFeature0 = TensorBuffer.createFixedSize(new int[]{1, 224, 224, 3}, DataType.FLOAT32);
            ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4*imageWidth*imageHeight*3);
            byteBuffer.order(ByteOrder.nativeOrder());
            int[] intValues = new int[imageWidth*imageHeight];
            image.getPixels(intValues, 0, imageWidth,0, 0, imageWidth, imageHeight);
            int pixel = 0;
            for(int i = 0; i < imageWidth; i++){
                for(int j = 0; j < imageHeight; j++){
                    int val = intValues[pixel++];
                    byteBuffer.putFloat(((val >> 16)&0xFF)*(1.f/255.f));
                    byteBuffer.putFloat(((val >> 8)&0xFF)*(1.f/255.f));
                    byteBuffer.putFloat((val & 0xFF)*(1.f/255.f));
                }
                telemetry.addLine(i+"");
            }
            here1 = true;

            inputFeature0.loadBuffer(byteBuffer);

            ModelUnquant.Outputs outputs = model.process(inputFeature0);

            TensorBuffer outputFeature0 = outputs.getOutputFeature0AsTensorBuffer();
            here2 = true;
            float[] confidences = outputFeature0.getFloatArray();
            int maxPos = 0;
            float maxConfidence = 0;
            for(int i = 0; i < confidences.length; i++){
                if(confidences[i] > maxConfidence){
                    maxConfidence = confidences[i];
                    maxPos = i;
                }
            }

            String[] classes = {"1", "2", "3"};
            int posReturn = Integer.parseInt(classes[maxPos]);
            model.close();
            return posReturn;
        } catch (IOException e) {
            e.printStackTrace();
            return 0;
        }
    }
}

I am expecting the robot to go to execute the desired trajectory based on the confidences, but confidences never get processed. I tried on an android app and it worked, just not on the control hub.


问:
Is it possible to connect Web App to TV over WiFi or some other method?
For my web application (React), I either need to connect the app to the TV over WiFi or some other technology, as opposed to manually opening up a browser and entering the URL, or to somehow direct the TV to open my website.

Is this possible currently? Is there a way to scan the WiFi to find all devices connected to it, and somehow push data over WiFi to the TV to open a specific website?

I've found ConnectSDK (https://connectsdk.com/) which seems to make this possible but only for Android/iOS devices.


问:
react native onTextLayout event works in
How can I force the Text element on IOS to read the proper amount of lines in the onTextLayout event, I want to implement read more and initially I slice the text to have 60 characters, it gives 1,5 lines of text. On button press I swap the Text components and display the full text, on this Text component with the full text I have onTextLayout event, and when it fires it has only the truncated text available, how can I force refresh or something like that so that it would use the proper full text and measure lines for a full text? On android, it works fine, here is the code

```<code>const TextContent = ({ content }: TextContentProps) => {
  const [fullDisplay, setFullDisplay] = useState(false);
  const height = useSharedValue(30);

  const animatedStyle = useAnimatedStyle(() => {
    return {
      height: height.value,
    };
  });
  return (
    <Animated.View style={animatedStyle}>
      {fullDisplay ? (
        <Text
          style={styles.textContent}
          onTextLayout={({ nativeEvent }) => {
            height.value = withSpring(nativeEvent.lines.length * nativeEvent.lines[0].height);
          }}
        >
          {content}
        </Text>
      ) : (
        <Text style={styles.textContent}>{content.slice(0, 60)}...</Text>
      )}
      {!fullDisplay && (
        <Pressable style={styles.moreButton} onPress={() => setFullDisplay(true)}>
          <Text style={styles.moreButtonText}>Więcej</Text>
        </Pressable>
      )}
    </Animated.View>
  );
};
</code>```

and after the read more button click this text always ends up as a one-liner overflowing the parent element with the lines count eq 1. Thanks

Body:
How can I force the Text element on IOS to read the proper amount of lines in the onTextLayout event, I want to implement read more and initially I slice the text to have 60 characters, it gives 1,5 lines of text. On button press I swap the Text components and display the full text, on this Text component with the full text I have onTextLayout event, and when it fires it has only the truncated text available, how can I force refresh or something like that so that it would use the proper full text and measure lines for a full text? On android, it works fine, here is the code

const TextContent = ({ content }: TextContentProps) => {
  const [fullDisplay, setFullDisplay] = useState(false);
  const height = useSharedValue(30);

  const animatedStyle = useAnimatedStyle(() => {
    return {
      height: height.value,
    };
  });
  return (
    <Animated.View style={animatedStyle}>
      {fullDisplay ? (
        <Text
          style={styles.textContent}
          onTextLayout={({ nativeEvent }) => {
            height.value = withSpring(nativeEvent.lines.length * nativeEvent.lines[0].height);
          }}
        >
          {content}
        </Text>
      ) : (
        <Text style={styles.textContent}>{content.slice(0, 60)}...</Text>
      )}
      {!fullDisplay && (
        <Pressable style={styles.moreButton} onPress={() => setFullDisplay(true)}>
          <Text style={styles.moreButtonText}>Więcej</Text>
        </Pressable>
      )}
    </Animated.View>
  );
};

and after the read more button click this text always ends up as a one-liner overflowing the parent element with the lines count eq 1. Thanks


问:
Spring Cloud Config Server ResourceController does not map request with useDefaultLabel when path contains slashes
I have a simple Spring Cloud Config Server project (using spring-cloud-config-server-4.0.0)

With a default branch property set
spring.cloud.config.server.git.default-label

This works without a label:
GET http://localhost:8888/myAppName/myProfiles/test.txt?useDefaultLabel

This does not (path includes slash):
GET http://localhost:8888/myAppName/myProfiles/path/test.txt?useDefaultLabel

Throws the following Exception:

```<code>RefNotFoundException: Ref path cannot be resolved
...
at org.springframework.cloud.config.server.resource.ResourceController.retrieve(ResourceController.java:107)
</code>```

It resolves to the wrong controller endpoint:

@GetMapping("/{name}/{profile}/{label}/**")

instead of

@GetMapping(value = "/{name}/{profile}/{path:.*}", params = "useDefaultLabel")

To my understanding this should work because of this change: https://github.com/spring-cloud/spring-cloud-config/issues/824

I've tried without success:

Encoding the slash

Assigning something ("true") to the useDefaultLabel request parameter

Body:
I have a simple Spring Cloud Config Server project (using spring-cloud-config-server-4.0.0)

With a default branch property set
spring.cloud.config.server.git.default-label

This works without a label:
GET http://localhost:8888/myAppName/myProfiles/test.txt?useDefaultLabel

This does not (path includes slash):
GET http://localhost:8888/myAppName/myProfiles/path/test.txt?useDefaultLabel

Throws the following Exception:

RefNotFoundException: Ref path cannot be resolved
...
at org.springframework.cloud.config.server.resource.ResourceController.retrieve(ResourceController.java:107)

It resolves to the wrong controller endpoint:

@GetMapping("/{name}/{profile}/{label}/**")

instead of

@GetMapping(value = "/{name}/{profile}/{path:.*}", params = "useDefaultLabel")

To my understanding this should work because of this change: https://github.com/spring-cloud/spring-cloud-config/issues/824

I've tried without success:

Encoding the slash

Assigning something ("true") to the useDefaultLabel request parameter


问:
Roblox and using the Asset Item ID in API to direct to the image thumbnail
I am working on a website with the Roblox API and was using the Asset ID to pull thumbnails of different assets in the catalog. The code below was working perfect until a few days ago.

```<code><img src="https://www.roblox.com/asset-thumbnail/image?assetId=<?php echo get_field('roblox-item-id', $p->ID ) ?>&width=75&height=75"
</code>```

Please note 'roblox-item-id' = Asset ID in my code above

The asset id is still correct because everything works on our website besides the thumbnails.

I saw a few post where a bit ago they changed the URL to get these images to rbxthumb://type=Asset&id=

This method also did not work and people who posted links to the solution in the past now have the same error I am getting.

It seems like there is some kind of undocumented change to access these thumbnails with the asset ID. Does anyone know of a way for me to access them or an alternative method I could use besides the asset id? This happened only days ago and the Roblox Dev forums don't seem to have anyone posting about it.

Body:
I am working on a website with the Roblox API and was using the Asset ID to pull thumbnails of different assets in the catalog. The code below was working perfect until a few days ago.

<img src="https://www.roblox.com/asset-thumbnail/image?assetId=<?php echo get_field('roblox-item-id', $p->ID ) ?>&width=75&height=75"

Please note 'roblox-item-id' = Asset ID in my code above

The asset id is still correct because everything works on our website besides the thumbnails.

I saw a few post where a bit ago they changed the URL to get these images to rbxthumb://type=Asset&id=

This method also did not work and people who posted links to the solution in the past now have the same error I am getting.

It seems like there is some kind of undocumented change to access these thumbnails with the asset ID. Does anyone know of a way for me to access them or an alternative method I could use besides the asset id? This happened only days ago and the Roblox Dev forums don't seem to have anyone posting about it.


问:
How do I pass through Bearer Token to a different AJAX Call in JQuery?
I have gotten a token using bearer authentication using Ajax. I am unable to pass the token to another Ajax call to connect to another API. I set the alert, and the alert shows the token is passed through the sessionStorage. However, I get the following error. I listed the two Ajax calls below, the first one to get the bearer token, and the second one to use the token in another API call. What am I doing wrong?

POST https://cors-anywhere.herokuapp.com/https://apis-sandbox.fedex.com/address/v1/addresses/resolve 401 (Unauthorized)
send @ jquery-3.6.0.js:10109
ajax @ jquery-3.6.0.js:9690
(anonymous) @ Index:1245
dispatch @ jquery-3.6.0.js:5430
elemData.handle @ jquery-3.6.0.js:5234
Index:1301 {"readyState":4,"responseText":"{\"transactionId\": \"de3465a3-7b79-466b-98be-7a22f1d0a1a0\",\"errors\":[{\"code\":\"NOT.AUTHORIZED.ERROR\",\"message\":\"No access token provided. Please modify your request and try again.\"}]}","responseJSON":{"transactionId":"de3465a3-7b79-466b-98be-7a22f1d0a1a0","errors":[{"code":"NOT.AUTHORIZED.ERROR","message":"No access token provided. Please modify your request and try again."}]},"status":401,"statusText":"Unauthorized"}
```
<pre class="lang-js prettyprint-override"><code>$("#btnStartDiscount").click(function () {
  $.ajax({
    async: true,
    crossDomain: true,

    url: "https://cors-anywhere.herokuapp.com/https://apis-sandbox.fedex.com/oauth/token", //pass your tenant
    method: "POST",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
    },
    data: {
      grant_type: "client_credentials",
      client_id: "xxxxxxxxxxx", //Provide your app id
      client_secret: "xxxxxxxxxxxxx", //Provide your client secret genereated from your app
    },
    success: function (response) {
      console.log(response);
      token = response.access_token;
      console.log(token);
      enterAddressFields();
      document.FedExShip.tokenField.value = token;
      sessionStorage.setItem("myToken", JSON.stringify(token));
      let getToken = sessionStorage.getItem("myToken");

      console.log(getToken);
      alert("Connected Token " + getToken);
    },
    error: function (error) {
      console.log(JSON.stringify(error));
    },
  });
});
</code>```

$("#btnAddrValidate").click(function () {
  /*FedEx address validation to validate street lines, city, state, postal code and country code*/

  let getToken = sessionStorage.getItem("myToken");
  $.ajax({
    url: "https://cors-anywhere.herokuapp.com/https://apis-sandbox.fedex.com/address/v1/addresses/resolve", //post address
    method: "POST",

    headers: {
      authorization: "'Bearer  '+  getToken",

      "x-locale": "en_US",
    },
    data: {
      addressesToValidate: [
        {
          address: {
            streetLines: ["7372 PARKRIDGE BLVD", "APT 286"],
            city: "IRVING",
            stateOrProvinceCode: "TX",
            postalCode: "75063-8659",
            countryCode: "US",
          },
        },
      ],
    },

    success: function (response) {
      console.log(response);
      token = response.access_token;
      console.log(getToken);
      alert("Successfully passed token " + token);
      alert("Success");
      /* enterAddressFields();*/
    },
    error: function (error) {
      console.log(JSON.stringify(error));
      /*alert(this.response);*/

      /*  alert("Failure");*/
      alert("Failed to pass token " + getToken);
    },
  });
});
```

I stored the token value as localstorage.token also ,but the result was the same.

Body:
I have gotten a token using bearer authentication using Ajax. I am unable to pass the token to another Ajax call to connect to another API. I set the alert, and the alert shows the token is passed through the sessionStorage. However, I get the following error. I listed the two Ajax calls below, the first one to get the bearer token, and the second one to use the token in another API call. What am I doing wrong?

POST https://cors-anywhere.herokuapp.com/https://apis-sandbox.fedex.com/address/v1/addresses/resolve 401 (Unauthorized)
send @ jquery-3.6.0.js:10109
ajax @ jquery-3.6.0.js:9690
(anonymous) @ Index:1245
dispatch @ jquery-3.6.0.js:5430
elemData.handle @ jquery-3.6.0.js:5234
Index:1301 {"readyState":4,"responseText":"{\"transactionId\": \"de3465a3-7b79-466b-98be-7a22f1d0a1a0\",\"errors\":[{\"code\":\"NOT.AUTHORIZED.ERROR\",\"message\":\"No access token provided. Please modify your request and try again.\"}]}","responseJSON":{"transactionId":"de3465a3-7b79-466b-98be-7a22f1d0a1a0","errors":[{"code":"NOT.AUTHORIZED.ERROR","message":"No access token provided. Please modify your request and try again."}]},"status":401,"statusText":"Unauthorized"}

$("#btnStartDiscount").click(function () {
  $.ajax({
    async: true,
    crossDomain: true,

    url: "https://cors-anywhere.herokuapp.com/https://apis-sandbox.fedex.com/oauth/token", //pass your tenant
    method: "POST",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
    },
    data: {
      grant_type: "client_credentials",
      client_id: "xxxxxxxxxxx", //Provide your app id
      client_secret: "xxxxxxxxxxxxx", //Provide your client secret genereated from your app
    },
    success: function (response) {
      console.log(response);
      token = response.access_token;
      console.log(token);
      enterAddressFields();
      document.FedExShip.tokenField.value = token;
      sessionStorage.setItem("myToken", JSON.stringify(token));
      let getToken = sessionStorage.getItem("myToken");

      console.log(getToken);
      alert("Connected Token " + getToken);
    },
    error: function (error) {
      console.log(JSON.stringify(error));
    },
  });
});

$("#btnAddrValidate").click(function () {
  /*FedEx address validation to validate street lines, city, state, postal code and country code*/

  let getToken = sessionStorage.getItem("myToken");
  $.ajax({
    url: "https://cors-anywhere.herokuapp.com/https://apis-sandbox.fedex.com/address/v1/addresses/resolve", //post address
    method: "POST",

    headers: {
      authorization: "'Bearer  '+  getToken",

      "x-locale": "en_US",
    },
    data: {
      addressesToValidate: [
        {
          address: {
            streetLines: ["7372 PARKRIDGE BLVD", "APT 286"],
            city: "IRVING",
            stateOrProvinceCode: "TX",
            postalCode: "75063-8659",
            countryCode: "US",
          },
        },
      ],
    },

    success: function (response) {
      console.log(response);
      token = response.access_token;
      console.log(getToken);
      alert("Successfully passed token " + token);
      alert("Success");
      /* enterAddressFields();*/
    },
    error: function (error) {
      console.log(JSON.stringify(error));
      /*alert(this.response);*/

      /*  alert("Failure");*/
      alert("Failed to pass token " + getToken);
    },
  });
});

I stored the token value as localstorage.token also ,but the result was the same.


问:
Sublime Text : SQLTools Connection without specifying a database
I'm configuring Sublime to run my SQL queries, I installed the SQLTools package and successfully connected to my host, however I need to specify a database and I don't want that, I want it to connect to all databases on that host , this in order for the autocomplete to work for all the databases, since if I connect to a specific db, the autocomplete only works for the Tables of that db.

enter image description here

When trying to omit the database attribute, the connection is not created correctly, so I suppose the database parameter must be there and I would like to know if there is a possibility of specifying that it take all.

PD: This is the way SQLTools is setting by default.

enter image description here


问:
How can I migrate call to HttpMethodBase.setConnectionCloseForced(true) from commons-httpclient 3.x to httpcomponents-client 4.x?
I have some code that I need to migrate from commons-httpclient 3.x to httpcomponents-client 4.x (or newer). In some error handling code, there are calls to setConnectionCloseForced(true) on subclasses of HttpMethodBase, such as GetMethod or PostMethod. What would be the equivalent in httpcomponents-client 4.x?

HttpMethodBase httpMethod = /* some value */;
try {
    // do something
} catch (Exception e) {
    // handle error
} finally {
    // how to convert this?
    httpMethod.setConnectionCloseForced(true);
}
```


问:
Create Django objects in step increments
I'm trying to write a function to create total number of Django objects in step increments. Note, I'm using factory-boy to generate the fake data. Here is what I have come up with:

```<code>def create_todos_in_batch(total, step):
    quotient, remainder = divmod(total, step)
    for i in range(quotient):
        print(f"Inserting {i * step:,} to {(i + 1) * step:,}")
        todos = TodoFactory.build_batch(step)
        Todo.objects.bulk_create(todos)
    if remainder:
        print(f"Inserting {total - remainder:,} to {total:,}")
        todos = TodoFactory.build_batch(remainder)
        Todo.objects.bulk_create(todos)
</code>```

To create 100 objects in 20 object increments, the function can be called like so:

```<code>create_todos_in_batch(100, 20)
</code>```

I have the following unit test to prove this works correctly:

```<code>@pytest.mark.parametrize(
    "total, step",
    [
        (100, 20),
        (1_000, 100),
        (10_000, 1_000),
    ],
)
@pytest.mark.django_db
def test_create_in_batch(total, step):
    create_todos_in_batch(total=total, step=step)
    count = Todo.objects.count()
    assert count == total, f"{count:,} != {total:,}"
</code>```

Is there a better way to write this function? I feel like this is too verbose because I'm repeating TodoFactory.build_batch() and Todo.objects.bulk_create(todos) multiple times.

Body:
I'm trying to write a function to create total number of Django objects in step increments. Note, I'm using factory-boy to generate the fake data. Here is what I have come up with:

def create_todos_in_batch(total, step):
    quotient, remainder = divmod(total, step)
    for i in range(quotient):
        print(f"Inserting {i * step:,} to {(i + 1) * step:,}")
        todos = TodoFactory.build_batch(step)
        Todo.objects.bulk_create(todos)
    if remainder:
        print(f"Inserting {total - remainder:,} to {total:,}")
        todos = TodoFactory.build_batch(remainder)
        Todo.objects.bulk_create(todos)

To create 100 objects in 20 object increments, the function can be called like so:

create_todos_in_batch(100, 20)

I have the following unit test to prove this works correctly:

@pytest.mark.parametrize(
    "total, step",
    [
        (100, 20),
        (1_000, 100),
        (10_000, 1_000),
    ],
)
@pytest.mark.django_db
def test_create_in_batch(total, step):
    create_todos_in_batch(total=total, step=step)
    count = Todo.objects.count()
    assert count == total, f"{count:,} != {total:,}"

Is there a better way to write this function? I feel like this is too verbose because I'm repeating TodoFactory.build_batch() and Todo.objects.bulk_create(todos) multiple times.


问:
React http-proxy-middleware It works locally but not on the main server
I work locally with http-proxy-middeware and there is no problem
After building the project with npm run build
When I transfer the project to the main server, the proxy does not work anymore and gives a 404 error
Thank you for your advice`

```<code>const { createProxyMiddleware } = require('http-proxy-middleware');
</code>```

module.exports = function(app) {
app.use(
'/api',
createProxyMiddleware({
target: 'https://backend_api.com',
changeOrigin: true
})
);
};

Body:
I work locally with http-proxy-middeware and there is no problem
After building the project with npm run build
When I transfer the project to the main server, the proxy does not work anymore and gives a 404 error
Thank you for your advice`

const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
app.use(
'/api',
createProxyMiddleware({
target: 'https://backend_api.com',
changeOrigin: true
})
);
};


问:
Training with Roboflow-Train-YOLOv5 stops with a '^C'
Running Roboflow's notebook, 'Roboflow-Train-YOLOv5', stops after completion the epochs loop.
Instead a reporting the results, I get the following lines, with a ^C at the end of the 3rd line
from the end.

I would like to know the reason for the failure, and there is a way to fix it.

```<code>10 epochs completed in 0.191 hours.
Optimizer stripped from runs/train/yolov5s_results2/weights/last.pt, 14.9MB
Optimizer stripped from runs/train/yolov5s_results2/weights/best.pt, 14.9MB

Validating runs/train/yolov5s_results2/weights/best.pt...
Fusing layers...
my_YOLOv5s summary: 213 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95:  20% 1/5 [00:01<00:04,  1.03s/it]^C
CPU times: user 7.01 s, sys: 830 ms, total: 7.84 s
Wall time: 12min 31s
</code>```

My Colab plan is Colab pro, so I guess it is not a problem of resources.

Body:
Running Roboflow's notebook, 'Roboflow-Train-YOLOv5', stops after completion the epochs loop.
Instead a reporting the results, I get the following lines, with a ^C at the end of the 3rd line
from the end.

I would like to know the reason for the failure, and there is a way to fix it.

10 epochs completed in 0.191 hours.
Optimizer stripped from runs/train/yolov5s_results2/weights/last.pt, 14.9MB
Optimizer stripped from runs/train/yolov5s_results2/weights/best.pt, 14.9MB

Validating runs/train/yolov5s_results2/weights/best.pt...
Fusing layers...
my_YOLOv5s summary: 213 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs
               Class     Images     Labels          P          R     mAP@.5 mAP@.5:.95:  20% 1/5 [00:01<00:04,  1.03s/it]^C
CPU times: user 7.01 s, sys: 830 ms, total: 7.84 s
Wall time: 12min 31s

My Colab plan is Colab pro, so I guess it is not a problem of resources.


问:
Using Swift reflection to initialize a general class object with data. Cant iterate through properties
I have noticed a class where the coding key for a new property was not added to a Codable object. As a result, data was silently getting dropped. I would like for this to never happen again.

The goal is to write a more general unit test for any object that is Codable that does the following.

Create an instance of the object with "random" data

Encode the object

Decode the object and see if it is equal to the original object

Thus far I have tried Mirror(reflecting: ClassName.self). The goal is that I could essentially go through each property and come up for a way to generally initialize it with random data. The problem is its children object is not particularly useful. Its a very weird object that does not even loop like a collection as I have seen in some example code.

Curious then if it is even possible to initialize an object with random data in its fields using Swift reflection. A lot of the example code for doing on this rely on the object being set up properly with Encode/Decode which is an assumption I cannot take.


问:
Angular 15 + i18next - Property 'languageChanged' in type 'I18NextEvents' is not assignable to the same property in base type 'ITranslationEvents'
I try to implement i18next library for Angular in version 15.
For implementation I use "angular-i18next": "^15.0.0-0" and "i18next": "^22.4.6" and below files:

.module.ts file:

```<code>import {NgModule} from '@angular/core';
import {I18NextModule} from 'angular-i18next';
import {I18N_PROVIDERS} from '@config/i18next.config';

const imports = [
    I18NextModule.forRoot(),
]

@NgModule({
    imports: [...imports],
    providers: [
        I18N_PROVIDERS,
    ],
})
export class CoreModule { }
</code>```

and finaly config for i18next file:

```<code>import {APP_INITIALIZER, LOCALE_ID} from "@angular/core";
import {I18NEXT_SERVICE, ITranslationService} from 'angular-i18next';
import {registerLocaleData} from '@angular/common';
import i18nextLanguageDetector from 'i18next-browser-languagedetector';
import HttpApi from 'i18next-http-backend';
import localePl from '@angular/common/locales/pl';
import {appSettings} from '@core/const/app-settings';

registerLocaleData(localePl, 'pl-PL')

export function appInit(i18next: ITranslationService) {
    return () => i18next
        .use(HttpApi)
        .use(i18nextLanguageDetector)
        .init({
            supportedLngs: appSettings.languages,
            fallbackLng: 'en-US',
            debug: false,
            returnEmptyString: false,
            defaultNS: 'app',
            load: 'currentOnly',
            ns: [
                'translation',
                'validation',
                'error',
            ],
        })
}

export function localeIdFactory(i18next: ITranslationService) {
    return i18next.language
}

export const I18N_PROVIDERS = [
    {
        provide: APP_INITIALIZER,
        useFactory: appInit,
        deps: [I18NEXT_SERVICE],
        multi: true,
    },
    {
        provide: LOCALE_ID,
        deps: [I18NEXT_SERVICE],
        useFactory: localeIdFactory,
    },
]
</code>```

On application start I receive following error:

enter image description here

Any ideas?

I tried modyfied several properties in i18next.init but same error still occours.

Body:
I try to implement i18next library for Angular in version 15.
For implementation I use "angular-i18next": "^15.0.0-0" and "i18next": "^22.4.6" and below files:

.module.ts file:

import {NgModule} from '@angular/core';
import {I18NextModule} from 'angular-i18next';
import {I18N_PROVIDERS} from '@config/i18next.config';

const imports = [
    I18NextModule.forRoot(),
]

@NgModule({
    imports: [...imports],
    providers: [
        I18N_PROVIDERS,
    ],
})
export class CoreModule { }

and finaly config for i18next file:

import {APP_INITIALIZER, LOCALE_ID} from "@angular/core";
import {I18NEXT_SERVICE, ITranslationService} from 'angular-i18next';
import {registerLocaleData} from '@angular/common';
import i18nextLanguageDetector from 'i18next-browser-languagedetector';
import HttpApi from 'i18next-http-backend';
import localePl from '@angular/common/locales/pl';
import {appSettings} from '@core/const/app-settings';

registerLocaleData(localePl, 'pl-PL')

export function appInit(i18next: ITranslationService) {
    return () => i18next
        .use(HttpApi)
        .use(i18nextLanguageDetector)
        .init({
            supportedLngs: appSettings.languages,
            fallbackLng: 'en-US',
            debug: false,
            returnEmptyString: false,
            defaultNS: 'app',
            load: 'currentOnly',
            ns: [
                'translation',
                'validation',
                'error',
            ],
        })
}

export function localeIdFactory(i18next: ITranslationService) {
    return i18next.language
}

export const I18N_PROVIDERS = [
    {
        provide: APP_INITIALIZER,
        useFactory: appInit,
        deps: [I18NEXT_SERVICE],
        multi: true,
    },
    {
        provide: LOCALE_ID,
        deps: [I18NEXT_SERVICE],
        useFactory: localeIdFactory,
    },
]

On application start I receive following error:

enter image description here

Any ideas?

I tried modyfied several properties in i18next.init but same error still occours.


问:
How do I nest this React component in another React component?
Kind of embarrassing, since I worked as a React developer for over a year.  But the system was set up when I came in, and when I created new components I just followed the syntax for the existing components and everything worked.  But trying to do even simple React stuff on my home system has been really challenging.  I'm not sure the problem is in my syntax, but maybe in my javascript environment.

Here is a simple thing that works:

react-test.html

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>react-test-2</title>
    <script type="text/javascript" src="../jquery-1.3.2.min.js"></script>

    <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>

    <script src="React_Components/AAA.js"></script>

    <script>
      $(document).ready(function() {
          const domContainer = document.querySelector('#react-container');
          const root = ReactDOM.createRoot(domContainer);
          root.render(React.createElement(AAA));
      });
    </script>

</head>

<body>
  <div id="react-container"></div>
</body>
</html>
</code>```

AAA.jsx

```<code>function AAA(){
    return (<div>AAA</div>);
}
</code>```

The .jsx files are in React_Components_JSX, which is watched by the Babel preprocessor, which makes analogous .js files in React_Components. When I navigate to the html page, it renders the expected "AAA" on the page.

Now I'm just trying to nest another component inside the AAA component.  So I update the file AAA.jsx and create a file BBB.jsx, something like the following (although I have tried various syntaxes hoping to make this work).  I am expecting to see a webpage that renders "AAABBB".

AAA.jsx

```<code>import BBB from '../React_Components_JSX/BBB.jsx';

function AAA(){
    return (<div>AAA<BBB/></div>);
}
</code>```

BBB.jsx

```<code>export default function BBB(){
    return (<div>BBB</div>);
}
</code>```

The main error I am getting is "Cannot use import statement outside a module".  Which I know explains the problem, but I don't really understand what that means on a fundamental level, as far as how I have to set my application up.

Body:
Kind of embarrassing, since I worked as a React developer for over a year.  But the system was set up when I came in, and when I created new components I just followed the syntax for the existing components and everything worked.  But trying to do even simple React stuff on my home system has been really challenging.  I'm not sure the problem is in my syntax, but maybe in my javascript environment.

Here is a simple thing that works:

react-test.html

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>react-test-2</title>

AAA.jsx

function AAA(){
    return (
AAA
);
}

The .jsx files are in React_Components_JSX, which is watched by the Babel preprocessor, which makes analogous .js files in React_Components. When I navigate to the html page, it renders the expected "AAA" on the page.

Now I'm just trying to nest another component inside the AAA component.  So I update the file AAA.jsx and create a file BBB.jsx, something like the following (although I have tried various syntaxes hoping to make this work).  I am expecting to see a webpage that renders "AAABBB".

AAA.jsx

import BBB from '../React_Components_JSX/BBB.jsx';

function AAA(){
    return (
AAA<BBB/>
);
}

BBB.jsx

export default function BBB(){
    return (
BBB
);
}

The main error I am getting is "Cannot use import statement outside a module".  Which I know explains the problem, but I don't really understand what that means on a fundamental level, as far as how I have to set my application up.


问:
I get a clang error when running rush lint fix
I'm trying to run rush lint fix (to run the linting on the code), and I get the following error:

```<code>node:internal/child_process:413
    throw errnoException(err, 'spawn');
    ^

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at spawn (node:child_process:700:9)
    at /Users/wscott/dev/hz/common/temp/node_modules/.pnpm/clang-format@1.5.0/node_modules/clang-format/index.js:91:42
    at /Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:3641:28
    at replenish (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:446:21)
    at /Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:451:13
    at eachOfLimit$1 (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:477:34)
    at awaitable (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:211:32)
    at eachOfSeries (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:813:16)
    at awaitable (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:211:32) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}
</code>```

Does anyone know what the problem is?

Body:
I'm trying to run rush lint fix (to run the linting on the code), and I get the following error:

node:internal/child_process:413
    throw errnoException(err, 'spawn');
    ^

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at spawn (node:child_process:700:9)
    at /Users/wscott/dev/hz/common/temp/node_modules/.pnpm/clang-format@1.5.0/node_modules/clang-format/index.js:91:42
    at /Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:3641:28
    at replenish (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:446:21)
    at /Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:451:13
    at eachOfLimit$1 (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:477:34)
    at awaitable (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:211:32)
    at eachOfSeries (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:813:16)
    at awaitable (/Users/wscott/dev/hz/common/temp/node_modules/.pnpm/async@3.2.2/node_modules/async/dist/async.js:211:32) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

Does anyone know what the problem is?


问:
Why don't I get anything from this API call?
I'm trying to get a the JSON received from this API https://70aidzp7ck-2.algolianet.com/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20JavaScript%20(4.14.2)%3B%20Browser%20(lite)%3B%20instantsearch.js%20(4.49.1)%3B%20JS%20Helper%20(3.11.1)&x-algolia-api-key=a4a35644550d8855512297e93a18e30a&x-algolia-application-id=70AIDZP7CK

I copied it directly to postman and I get a 400, I've also tried copying the cUrl still the same issue. Any idea why I'm not able to replicate the request using postman? This is a POST request.


问:
About the phenomenon that the slide bar moves to the right end
in c#I'm creating a mod that sets the time with a slider in c#, but the slider doesn't work. After setting the time, closing the setting panel and opening it again, for some reason the slider moves to the right end. Is there any way to fix this phenomenon?

various numbers I tried resetting the numbers, but it didn't work.


问:
Cant find Qt5Core.lib
When building a project with

```<code>cmake .
</code>```

the command

```<code>find_package(Qt5Core REQUIRED)
</code>```

in the CMakeLists fails.
It throws

```<code>CMake Error at C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:14 (message):
  The imported target "Qt5::Core" references the file

     "C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/Qt5Core.lib"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/cmake/Qt5Core/Qt5CoreConfig.cmake"

  but not all the files it references.
</code>```

as an error.
When searching for Qt5Core.lib through regular file explorer I can only find Qt5Core.prl and Qt5Core.dll but no Qt5Core.lib. How do I get Qt5Core.lib? Why doesn't it exist?

The code in Qt5CoreConfig.cmake in line 13 to 23:

```<code>if(NOT EXISTS "${file}" )
        message(FATAL_ERROR "The imported target \"Qt5::Core\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
</code>```

Title: Cant find Qt5Core.lib

Body:
When building a project with

cmake .

the command

find_package(Qt5Core REQUIRED)

in the CMakeLists fails.
It throws

CMake Error at C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:14 (message):
  The imported target "Qt5::Core" references the file

     "C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/Qt5Core.lib"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/cmake/Qt5Core/Qt5CoreConfig.cmake"

  but not all the files it references.

as an error.
When searching for Qt5Core.lib through regular file explorer I can only find Qt5Core.prl and Qt5Core.dll but no Qt5Core.lib. How do I get Qt5Core.lib? Why doesn't it exist?

The code in Qt5CoreConfig.cmake in line 13 to 23:

if(NOT EXISTS "${file}" )
        message(FATAL_ERROR "The imported target \"Qt5::Core\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()


问:
Can I get froala data without editor instance
Something like that document.getElementById('example')['data-froala.editor'].html.get().
Can I do that or can other suggestions</p>


问:
How to get errors message from form-request and give it to controller
i need to get error from form request in controller and pass to JSON and front-end

in past i solve this problem in controller i mean my validation was in controller but now i don`t know how to handle this problem

in my form request i have rules and custom Persian message :

```<code><?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class CreateAdminRequest extends FormRequest
{
/**
 * Determine if the user is authorized to make this request.
 *
 * @return bool
 */
public function authorize()
{
    return true;
}

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
        'first_name' => 'required|min:3|regex:/^[a-zA-ZÑñ\s]+$/',
        'email' => 'required|email|unique:admins',
        'password' => 'required|min:8',
    ];
}

public function messages()
{
    return [
        'first_name.required' => 'لطفا نام را وارد کنید',
        'first_name.min' => 'نام حداقل باید ۳ کاراکتر باشد',
        'first_name.regex' => 'لطفا حروف را به انگلیسی تایپ کنید',
        'email.required' => 'لطفا ایمیل را وارد کنید',
        'email.email' => 'فرمت ایمیل باید اینگونه باشد : example@gmail.com',
        'email.unique' => 'ایمیل تکراری است',
        'password.required' => 'فیلد رمز را وارد کنید',
        'password.min' => 'رمز حداقل باید ۸ کاراکتر باشد',
    ];
}
</code>```

}

in my controller i want a way to get something from form-request and say if this variable get error and fails get error and give it to front-end :

```<code><?php

namespace App\Http\Controllers;

use App\Http\Requests\Admin\CreateAdminRequest;
use App\Services\AdminService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class AdminController extends Controller
{
    public function create(CreateAdminRequest $req)
    {
        if ($->fails()) {
            return response()->json([
                "status" => false,
                "errors" => $->errors()->all(),
            ]);
        } else {
            $create = AdminService::create($req->first_name, $req->email, $req->password);
            return response()->json([
                "status" => $create["status"],
                "message" => $create["message"],
            ]);
        }
    }
}
</code>```

Body:
i need to get error from form request in controller and pass to JSON and front-end

in past i solve this problem in controller i mean my validation was in controller but now i don`t know how to handle this problem

in my form request i have rules and custom Persian message :

<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class CreateAdminRequest extends FormRequest
{
/**
 * Determine if the user is authorized to make this request.
 *
 * @return bool
 */
public function authorize()
{
    return true;
}

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
        'first_name' => 'required|min:3|regex:/^[a-zA-ZÑñ\s]+$/',
        'email' => 'required|email|unique:admins',
        'password' => 'required|min:8',
    ];
}

public function messages()
{
    return [
        'first_name.required' => 'لطفا نام را وارد کنید',
        'first_name.min' => 'نام حداقل باید ۳ کاراکتر باشد',
        'first_name.regex' => 'لطفا حروف را به انگلیسی تایپ کنید',
        'email.required' => 'لطفا ایمیل را وارد کنید',
        'email.email' => 'فرمت ایمیل باید اینگونه باشد : example@gmail.com',
        'email.unique' => 'ایمیل تکراری است',
        'password.required' => 'فیلد رمز را وارد کنید',
        'password.min' => 'رمز حداقل باید ۸ کاراکتر باشد',
    ];
}

}

in my controller i want a way to get something from form-request and say if this variable get error and fails get error and give it to front-end :

<?php

namespace App\Http\Controllers;

use App\Http\Requests\Admin\CreateAdminRequest;
use App\Services\AdminService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class AdminController extends Controller
{
    public function create(CreateAdminRequest $req)
    {
        if ($->fails()) {
            return response()->json([
                "status" => false,
                "errors" => $->errors()->all(),
            ]);
        } else {
            $create = AdminService::create($req->first_name, $req->email, $req->password);
            return response()->json([
                "status" => $create["status"],
                "message" => $create["message"],
            ]);
        }
    }
}


问:
Fetch All Properties Missing Room Information
this is a question and possibly an improvement request.  When I use the model derivative api to fetch object properties from a converted Revit model, I don't understand why it won't fetch the room data.

In my example we are only processing 2D views, and those 2D views are interactive, similar to BIM 360 I'm able to select a room and query its properties in forge viewer.  So I know the properties are there in the conversion, but for some reason, Object Tree doesn't give room objects and thus it doesn't give room parameter data.

What I tried:

Convert a Model Revit Model floor plan using the model derivative API.  Viewing the model in Forge Viewer should allow you to select a room element and query its properties, such as the screenshot below.

Image of Room Selected in Forge Viewer Floor Plan View

so we know the data for the Room objects is in the forge conversion.

Using the model derivative api to fetch the object tree and / or metadata, the room objects don't exist.  I read something that seemed to indicate to generate master views, but I'm not sure I understand why that is necessary because the 2D conversions I am doing, we aren't generating master views, but still seem to have the room data accessible in Forge Viewer.

What I expected
It seems to me as a developer and user that the model derivative API could fetch the room objects and their data.  Please correct me if I'm missing something.


问:
I keep getting 'Could not determine ADB version' in Android Studio. I am using a mac with the M1 chip

This keeps popping up non-stop.

I have 0 ideas how to fix it. I am also new to the IDE.


问:
How to make PanResponder work as expected when user double taps by inadvertance while dragging his finger?
I'm trying to build a recording button where the user needs to keep pressing on the button to record, and then release the button when he wants to finish recording. Also, if the user releases its finger while outside of the button area, the recording gets cancelled.

I'm using a PanResponder to implement this behavior:

```<code><View {...panResponder.panHandlers}>
   <Button />
</View>
</code>```

Everything works fine in the most cases. However, if the user taps somewhere else on the screen with another finger while recording (most often by inadvertance), then the PanResponder stops to capture the recording drag. The onResponderRelease method is not called.

I have no clue how to solve this. I want the recording drag to be resilient to extra touches.

I have tried catching and blocking any extra touch, if in recording state, inside the parent view but it does not work.

Any help is appreciated !

Body:
I'm trying to build a recording button where the user needs to keep pressing on the button to record, and then release the button when he wants to finish recording. Also, if the user releases its finger while outside of the button area, the recording gets cancelled.

I'm using a PanResponder to implement this behavior:

<View {...panResponder.panHandlers}>
   <Button />
</View>

Everything works fine in the most cases. However, if the user taps somewhere else on the screen with another finger while recording (most often by inadvertance), then the PanResponder stops to capture the recording drag. The onResponderRelease method is not called.

I have no clue how to solve this. I want the recording drag to be resilient to extra touches.

I have tried catching and blocking any extra touch, if in recording state, inside the parent view but it does not work.

Any help is appreciated !