问:
Grafana 2 queries in same panel but set query interval difference
I have 2 queries in a grafana panel.
I want to run Query A every 5 min
I want to run Query B every 10 min, so I can check the value difference between each query using transform.
How can I set the query interval, I know I can change scrape interval but my goal here is to check pending messages and if it doesnt change in 10 min trigger an alert. I am trying to get a count at 1st minute and get count again at 10th minute. check the difference using transform and trigger an alert if no change (messages are not getting processed )
using grafana 7
Thanks !</p>


来源: stackexchange

问:
Why my cache gets empty after I reload the page in offline mode?
I am working on a PWA with react.js. I implemented the service worker for caching data but after I reload the page in offline mode the cache is empty.

I added The service worker and a few images below

```<code> const CACHE_NAME = "version-1";
const urlsToCache =

[
    'index.html',
    'offline.html',
    'assets/icons/archive.svg',
    'assets/icons/arrow-left.svg',
    'assets/icons/arrow-top.svg',
];

const self = this;

self.addEventListener('install', (event) => {
    event.waitUntil(
        caches.open(CACHE_NAME)
            .then((cache) => {
                console.log('Opened cache');

                return cache.addAll(urlsToCache);
            })
    )
});

// Listen for requests
self.addEventListener('fetch', (event) => {
    event.respondWith(
        caches.match(event.request)
            .then(() => {
                return fetch(event.request)
                    .catch(() => caches.match('offline.html'))
            })
    )
});

self.addEventListener('activate', (event) => {
    const cacheWhitelist = [];
    cacheWhitelist.push(CACHE_NAME);

    event.waitUntil(
        caches.keys().then((cacheNames) => Promise.all(
            cacheNames.map((cacheName) => {
                if(!cacheWhitelist.includes(cacheName)) {
                    return caches.delete(cacheName);
                }
            })
        ))

    )
});
</code>```

Thank you for helping

ContentLicense: CC BY-SA 4.0

Body:
I am working on a PWA with react.js. I implemented the service worker for caching data but after I reload the page in offline mode the cache is empty.

I added The service worker and a few images below

 const CACHE_NAME = "version-1";
const urlsToCache =

[
    'index.html',
    'offline.html',
    'assets/icons/archive.svg',
    'assets/icons/arrow-left.svg',
    'assets/icons/arrow-top.svg',
];

const self = this;

self.addEventListener('install', (event) => {
    event.waitUntil(
        caches.open(CACHE_NAME)
            .then((cache) => {
                console.log('Opened cache');

                return cache.addAll(urlsToCache);
            })
    )
});

// Listen for requests
self.addEventListener('fetch', (event) => {
    event.respondWith(
        caches.match(event.request)
            .then(() => {
                return fetch(event.request)
                    .catch(() => caches.match('offline.html'))
            })
    )
});

self.addEventListener('activate', (event) => {
    const cacheWhitelist = [];
    cacheWhitelist.push(CACHE_NAME);

    event.waitUntil(
        caches.keys().then((cacheNames) => Promise.all(
            cacheNames.map((cacheName) => {
                if(!cacheWhitelist.includes(cacheName)) {
                    return caches.delete(cacheName);
                }
            })
        ))

    )
});

Thank you for helping


问:
Managing Disk Quotas in Powershell Remotely
I'm trying to eventually create a winform powershell tool that manages disk quotas on a Windows 2016 server from a Windows 10 client workstation. Given that Every single user has at least 2 mapped drives is there any way to query a specific user and volume without get-wmiobject cycling through every single quota first? The goal is to create a tool as fast or faster than just remoting into the file server to increase quotas as requests come in but to increase a quota we need to know the quota limit first.

I also know that I could map the root of a drive to a letter using my admin creds, but we don't allow saving credentials for mapped drives because we have to follow guidelines set up by federal government (State Health Care Agency) and our security team doesn't allow for credentials to be saved in any kind of windows logon. So that being said the powers that be are wanting me to find a way around us remoting into the server with our admin credentials and increasing quotas.

We don't use FSRM on the server but instead manage quotas for each volume. That decision was made before my time.

For testing I have tried using the following:

```<code>$query = "Select * from win32_diskquota where QuotaVolume=""Win32_LogicalDisk.DeviceID='$volume'"" AND User =""Win32_Account.Domain='$domain',Name='$Username'"""
Get-WmiObject -Query $query -ComputerName server

</code>```

This one I knew was going to take forever, but tried it anyway:

```<code>Get-WMIObject Win32_DiskQuota -ComputerName $computer | where {$_.deviceid -eq "Win32_LogicalDisk.DeviceID=$drive" -and $_.user -eq "Win32_Account.Domain=$Domain"+",Name=$name"}
</code>```

I've also used get-ciminstance just to see if it would compile the list of quotas from the remote server any faster, but no dice.

Any suggestions, hints, or advice would be great. Thanks in advance.

Body:
I'm trying to eventually create a winform powershell tool that manages disk quotas on a Windows 2016 server from a Windows 10 client workstation. Given that Every single user has at least 2 mapped drives is there any way to query a specific user and volume without get-wmiobject cycling through every single quota first? The goal is to create a tool as fast or faster than just remoting into the file server to increase quotas as requests come in but to increase a quota we need to know the quota limit first.

I also know that I could map the root of a drive to a letter using my admin creds, but we don't allow saving credentials for mapped drives because we have to follow guidelines set up by federal government (State Health Care Agency) and our security team doesn't allow for credentials to be saved in any kind of windows logon. So that being said the powers that be are wanting me to find a way around us remoting into the server with our admin credentials and increasing quotas.

We don't use FSRM on the server but instead manage quotas for each volume. That decision was made before my time.

For testing I have tried using the following:

$query = "Select * from win32_diskquota where QuotaVolume=""Win32_LogicalDisk.DeviceID='$volume'"" AND User =""Win32_Account.Domain='$domain',Name='$Username'"""
Get-WmiObject -Query $query -ComputerName server

This one I knew was going to take forever, but tried it anyway:

Get-WMIObject Win32_DiskQuota -ComputerName $computer | where {$_.deviceid -eq "Win32_LogicalDisk.DeviceID=$drive" -and $_.user -eq "Win32_Account.Domain=$Domain"+",Name=$name"}

I've also used get-ciminstance just to see if it would compile the list of quotas from the remote server any faster, but no dice.

Any suggestions, hints, or advice would be great. Thanks in advance.


问:
Firebase Emulator authentication best practices
I have plans to serve the Firebase Emulator inside a proper docker image for the use case of integration and e2e test pipeline, remotely executed. In this scenario, what are the best practices for authentication in Firebase Emulator?

I've only found documentation where the emulator's configuration is directly bind to the actual project. Thus, not allowing to externally configure a anonymous emulation with the desired specifications.

My goal is the bare minimum authorization to have the setup running inside the container itself. And by minimum, I mean that even someone with directly access to the container will not have power to affect the production environment in any sense - neither to use any authentication state saved in the container to escalate privileges.


问:
Salesforce experience cloud vertical menu apporach
I have some requirement to build vertical menu in user digital experience page.
I've followed https://trailhead.salesforce.com/content/learn/projects/communities_theme_layout/nav_menu
to build complete custom layout to nail that. That's ok, it works. Our client wants also certain icons for each menu entry. So right now it is as follows:

```<code><aura:iteration items="{!v.menuItems"} var="item">
...
<aura:renderIf isTrue="{!item.label == 'Name'}">
    <lightning:icon iconName="utility:groups"/>
</aura:renderIf>
</code>```

And I find it not appropriate for further development. I know this is narrow topic of Salesforce and not so many of devs have ever encountered such task but maybe someone has...
What's the better viable solution?

Body:
I have some requirement to build vertical menu in user digital experience page.
I've followed https://trailhead.salesforce.com/content/learn/projects/communities_theme_layout/nav_menu
to build complete custom layout to nail that. That's ok, it works. Our client wants also certain icons for each menu entry. So right now it is as follows:

<aura:iteration items="{!v.menuItems"} var="item">
...
<aura:renderIf isTrue="{!item.label == 'Name'}">
    <lightning:icon iconName="utility:groups"/>
</aura:renderIf>

And I find it not appropriate for further development. I know this is narrow topic of Salesforce and not so many of devs have ever encountered such task but maybe someone has...
What's the better viable solution?


问:
Debugging OAuth API Request
I am trying to use the TradeMe API in R, but I keep getting a 401 error when I make the request. Here is my code:

```<code># Install and load needed libraries
library(httr)

# Set keys and secrets
consumer_key <- "my_consumer_key"
consumer_secret <- "my_consumer_secret"
access_token <- "my_access_token"
access_secret <- "my_access_secret"

# Set up the API request
url <- "https://api.tmsandbox.co.nz/v1/MyTradeMe/Watchlist/All.xml"
auth <- paste0("OAuth oauth_consumer_key=", consumer_key,
               ", oauth_token=", access_token,
               ", oauth_signature_method=HMAC-SHA1",
               ", oauth_signature=", consumer_secret, "%26", access_secret)
headers <- c(Authorization = auth)

# Make the request and store the response
response <- GET(url, headers = headers)

# Check the status code of the response
status_code <- response$status_code
print(status_code)
</code>```

I have double-checked that my keys and secrets are correct and that the OAuth signature method and signature are properly formatted. I have also checked the documentation for the API to make sure that I am using the correct endpoint and that my request is formatted correctly.

However, I am still getting a 401 error. Is there anything else I should be checking or any other potential causes for this error?

Title: Debugging OAuth API Request

Body:
I am trying to use the TradeMe API in R, but I keep getting a 401 error when I make the request. Here is my code:

# Install and load needed libraries
library(httr)

# Set keys and secrets
consumer_key <- "my_consumer_key"
consumer_secret <- "my_consumer_secret"
access_token <- "my_access_token"
access_secret <- "my_access_secret"

# Set up the API request
url <- "https://api.tmsandbox.co.nz/v1/MyTradeMe/Watchlist/All.xml"
auth <- paste0("OAuth oauth_consumer_key=", consumer_key,
               ", oauth_token=", access_token,
               ", oauth_signature_method=HMAC-SHA1",
               ", oauth_signature=", consumer_secret, "%26", access_secret)
headers <- c(Authorization = auth)

# Make the request and store the response
response <- GET(url, headers = headers)

# Check the status code of the response
status_code <- response$status_code
print(status_code)

I have double-checked that my keys and secrets are correct and that the OAuth signature method and signature are properly formatted. I have also checked the documentation for the API to make sure that I am using the correct endpoint and that my request is formatted correctly.

However, I am still getting a 401 error. Is there anything else I should be checking or any other potential causes for this error?


问:
How can I remove a Document from Firestore Database after refreshing oder closing the Angular Page
I wrote a code that should remove a Document from my Firestore Database. It works manually, but it should also work when the user closes the tab with the angular app or when refreshing it. Is there a way to do it?

I tried to call my remove method with ngOnDestroy(), but it doesn't work. After closing or refreshing the tab with the angular app, my document is still in my Firestore Database.

Thank you for helping!


Title: Obtain Time and Distance from a route between two locations

Body:
I am using OpenStreetMap and obtaining routes between location A and location B.
Assume at 8:00 AM, a vehicle is at location A and arrives at location B at 9:10. On the other hand, there is a charging center (lat/long) that I wish to obtain how far (miles/minutes) the vehicle is from the center every 5 minutes through the route from location A to location B.

Is there any approach to obtaining this insight?

Here is an example of OpenStreetMap call.

{'route': [(32.75064, -117.14949), (32.75136, -117.14927), (32.75176, -117.1504), (32.7513, -117.15367), (32.75148, -117.1551), (32.75329, -117.15779), (32.75694, -117.15943), (32.75958, -117.16214), (32.76075, -117.16293), (32.76278, -117.16331), (32.76428, -117.16289), (32.76474, -117.16215), (32.76434, -117.16171), (32.7638, -117.16196), (32.76326, -117.16403), (32.76157, -117.16626), (32.75943, -117.17566), (32.75968, -117.1864), (32.76077, -117.19434), (32.75986, -117.20236), (32.76047, -117.20365), (32.76204, -117.20446), (32.76705, -117.20566), (32.77047, -117.2059), (32.76953, -117.20765), (32.76872, -117.20845), (32.76478, -117.20897), (32.76358, -117.20965), (32.76246, -117.21117), (32.7618, -117.21421), (32.76234, -117.21449), (32.76185, -117.21632), (32.76192, -117.21778), (32.76249, -117.21889), (32.76357, -117.21967), (32.76418, -117.21974), (32.76438, -117.21834)], 'start_point': [32.750637, -117.149489], 'end_point': [32.764382, -117.218338], 'distance': 10047.2, 'duration': 700.3}]


问:
Problem with submitting an upload key restoration form on Google Play Console
I deleted my keystore by accident and need to ask Google for a new signing key. So I filled the form on Google Console Help, created a new keystore, converted it to a PEM certificate, and attached it to the form. Hitting the submit button produces an error, saying that the location isn't right:

screenshot of the problematic field

Changing the country doesn't help, giving the browser permission to access my current location does not either. Just in case, the browser is Firefox, OS - Ubuntu.
Does anyone know what can possibly be wrong?


问:
ComboBox options based on another ComboBox
below is the code I'm working on to make a UserForm. I'm new to using UserForm and am tryin to populate ComboBox 2 with ComboBox 1 selection. ComboBox 1 holds the name of the worksheets and I'd like ComboBox 2 to update with the column heading names of the selected worksheet. Any help would be greatly appreciated.</p>
```<code>Private m_Cancelled As Boolean

Public Property Get Cancelled() As Variant
    Cancelled = m_Cancelled
End Property

Private Sub ComboBox1_Change()
    'Initialize ComboBox2
    Application.EnableEvents = False
    ComboBox2.Clear
    Application.EnableEvents = True

    Debug.Print "Here"; ComboBox1.Value
'    Select Case ComboBox1.Value
'        Case ComboBox1.Value
    With Worksheets(ComboBox1.Value)
        Debug.Print "Active Worksheet";
        Dim InitialArray() As Variant
        Dim i As Integer
        Dim ColCount As Integer
        '    Debug.Print ColCount; RowStart
        Do While IsEmpty(Cells(1, ColCount + 1).Value) = False
            ColCount = ColCount + 1
    '        Debug.Print Cells(RowStart, ColCount)
        Loop
        Debug.Print ColCount; "Cols"
    End With
'    End Select

'    Select Case ComboBox1.Value
        For i = 1 To ColCount
            Cells(1, i).Add
        Next i
'    End Select

End Sub

Private Sub ComboBox2_Change()

End Sub

Private Sub CommandButton1_Click()
    Hide
End Sub

Private Sub CommandButton2_Click()
    ' Hide the Userform and set cancelled to true
    Hide
    m_Cancelled = True
End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()

    ComboBox1.Clear

    'Initialize ComboBox1
    Dim wb As Workbook: Set wb = ThisWorkbook
    Dim wCount As Long: wCount = wb.Worksheets.Count
    Dim wsNames() As String: ReDim wsNames(1 To wCount)

    Dim ws As Worksheet, w As Long

    For Each ws In wb.Worksheets
        If ws.Visible = xlSheetVisible Then
            w = w + 1
            wsNames(w) = ws.Name
        End If
    Next ws

    If w < wCount Then ReDim Preserve wsNames(1 To w)

    ComboBox1.List = wsNames

'    ReDim InitialArray(ActiveWorkbook.Worksheets.Count) As Variant
'    Dim i As Integer
'
'    ComboBox1.Clear
'    For i = 1 To ActiveWorkbook.Worksheets.Count
'        InitialArray(i) = ActiveWorkbook.Sheets(i).Name
'    Next i
'    ComboBox1.List = InitialArray
End Sub

Private Sub UserForm_Activate()

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer _
                                        , CloseMode As Integer)

    ' Prevent the form being unloaded
    If CloseMode = vbFormControlMenu Then Cancel = True

    ' Hide the Userform and set cancelled to true
    Hide
    m_Cancelled = True

End Sub

Function GetComboBox1() As String
    GetComboBox1 = ComboBox1.Value
End Function
</code>```

Body:
below is the code I'm working on to make a UserForm. I'm new to using UserForm and am tryin to populate ComboBox 2 with ComboBox 1 selection. ComboBox 1 holds the name of the worksheets and I'd like ComboBox 2 to update with the column heading names of the selected worksheet. Any help would be greatly appreciated.

Private m_Cancelled As Boolean

Public Property Get Cancelled() As Variant
    Cancelled = m_Cancelled
End Property

Private Sub ComboBox1_Change()
    'Initialize ComboBox2
    Application.EnableEvents = False
    ComboBox2.Clear
    Application.EnableEvents = True

    Debug.Print "Here"; ComboBox1.Value
'    Select Case ComboBox1.Value
'        Case ComboBox1.Value
    With Worksheets(ComboBox1.Value)
        Debug.Print "Active Worksheet";
        Dim InitialArray() As Variant
        Dim i As Integer
        Dim ColCount As Integer
        '    Debug.Print ColCount; RowStart
        Do While IsEmpty(Cells(1, ColCount + 1).Value) = False
            ColCount = ColCount + 1
    '        Debug.Print Cells(RowStart, ColCount)
        Loop
        Debug.Print ColCount; "Cols"
    End With
'    End Select

'    Select Case ComboBox1.Value
        For i = 1 To ColCount
            Cells(1, i).Add
        Next i
'    End Select

End Sub

Private Sub ComboBox2_Change()

End Sub

Private Sub CommandButton1_Click()
    Hide
End Sub

Private Sub CommandButton2_Click()
    ' Hide the Userform and set cancelled to true
    Hide
    m_Cancelled = True
End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()

    ComboBox1.Clear

    'Initialize ComboBox1
    Dim wb As Workbook: Set wb = ThisWorkbook
    Dim wCount As Long: wCount = wb.Worksheets.Count
    Dim wsNames() As String: ReDim wsNames(1 To wCount)

    Dim ws As Worksheet, w As Long

    For Each ws In wb.Worksheets
        If ws.Visible = xlSheetVisible Then
            w = w + 1
            wsNames(w) = ws.Name
        End If
    Next ws

    If w < wCount Then ReDim Preserve wsNames(1 To w)

    ComboBox1.List = wsNames

'    ReDim InitialArray(ActiveWorkbook.Worksheets.Count) As Variant
'    Dim i As Integer
'
'    ComboBox1.Clear
'    For i = 1 To ActiveWorkbook.Worksheets.Count
'        InitialArray(i) = ActiveWorkbook.Sheets(i).Name
'    Next i
'    ComboBox1.List = InitialArray
End Sub

Private Sub UserForm_Activate()

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer _
                                        , CloseMode As Integer)

    ' Prevent the form being unloaded
    If CloseMode = vbFormControlMenu Then Cancel = True

    ' Hide the Userform and set cancelled to true
    Hide
    m_Cancelled = True

End Sub

Function GetComboBox1() As String
    GetComboBox1 = ComboBox1.Value
End Function


问:
How to deal with crashes in the middle of a B+ tree operation?
In between B+ tree operations, the tree is in a valid state, in the sense that the properties of a B+ tree are satisfied. However, during an operation on the B+ tree, those same properties will probably not be satisfied (at least not all of them). So if the process that operates on the B+ tree crashes or is killed, or the computer dies (maybe there is a power outage), when a tree operation is going on and the tree therefore is in an invalid state, how do you get the tree into a valid state again? That is, how do you recover from messing the tree up by only performing part of an operation?

Edit: I wrote this question with B+ trees in mind, but I'm really wondering how to do this for any tree data structure that uses the disk, so an answer of how to do this for B-trees would also be fine since B+ trees and B-trees are so similar.


问:
How to use graph api on outlook add-ins?
According to documentation I created simple authentication in my outlook add-in https://learn.microsoft.com/en-us/graph/tutorials/javascript?tabs=aad&tutorial-step=3
But i get an error: DeviceCodeCredentials is not supported in the browser; when i try to create auth provider in my outlook add-in. Which authentication I should use to successfully create 'graph client instance'? Or better solutions exists?

`

```<code>const graph = require('@microsoft/microsoft-graph-client');
const authProviders =
  require('@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials');
</code>```

```<code>_deviceCodeCredential = new azure.DeviceCodeCredential({
    clientId: settings.clientId,
    tenantId: settings.tenantId,
    userPromptCallback: deviceCodePrompt
  });

  const authProvider = new authProviders.TokenCredentialAuthenticationProvider(
    _deviceCodeCredential, {
      scopes: settings.graphUserScopes
    });

  _userClient = graph.Client.initWithMiddleware({
    authProvider: authProvider
  });
</code>```

`

I also tried other auth methods, but all they didn't work. How I can auth my user in outlook add in? Maybe there are some ways to auth without azure?

Body:
According to documentation I created simple authentication in my outlook add-in https://learn.microsoft.com/en-us/graph/tutorials/javascript?tabs=aad&tutorial-step=3
But i get an error: DeviceCodeCredentials is not supported in the browser; when i try to create auth provider in my outlook add-in. Which authentication I should use to successfully create 'graph client instance'? Or better solutions exists?

`

const graph = require('@microsoft/microsoft-graph-client');
const authProviders =
  require('@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials');

_deviceCodeCredential = new azure.DeviceCodeCredential({
    clientId: settings.clientId,
    tenantId: settings.tenantId,
    userPromptCallback: deviceCodePrompt
  });

  const authProvider = new authProviders.TokenCredentialAuthenticationProvider(
    _deviceCodeCredential, {
      scopes: settings.graphUserScopes
    });

  _userClient = graph.Client.initWithMiddleware({
    authProvider: authProvider
  });

`

I also tried other auth methods, but all they didn't work. How I can auth my user in outlook add in? Maybe there are some ways to auth without azure?


问:
SSIS: Cannot open datafile (path is correct)
I'm trying to generate a csv running a SSIS package.

First, I've created a string variable DATA_PATH (same name as windows system variable). Then, I've set a Process Task which run an echo to a Windows system variable like this:

The output of the command set my variable DATA_PATH correctly.

When I run the package, it throws the error "[Destino de archivo plano 1 [44]] Error: Cannot open the datafile (...)". But, if I hardcode my SSIS variable with the same exact file path as the echo %DATA_PATH% output, the package run correctly, without any error.


问:
On sign_in_with apple call back dynamic link is not working properly in android flutter
I have created a dynamic link that take user back to app when the signing with apple is completed in web view I'm using this package sigin_with_apple. after completion of sign it says you do not have permission to open this page

I have created a dynamic link that take user back to app when the signing with apple is completed in web view I'm using this package sigin_with_apple. after completion of sign it says you do not have permission to open this page


问:
How to back up latest artifact in public folder for the next pipeline in gitlab pipeline
```<code>gradle-check:
  ...
  ...
  rules:
    - *master-and-branch
  after_script:
    - mkdir build/reports/tests/ut/
    - mv build/reports/tests/test/* build/reports/tests/ut/
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit: build/test-results/test/**/TEST-*.xml
    paths:
      - build/reports/tests/ut/

pages:
  stage: pages
  dependencies:
    - gradle-check
    - integration-test
    - perf-test-execute
  script:
    - mkdir -p public
    - mv build/reports/tests/ut/ public/
    - mv build/reports/tests/it/ public/
  artifacts:
    paths:
      - public
    expire_in: 100 yrs
  when: always
  rules:
    - *master-and-branch

integration-test:
  ....
  ....
  rules:
    - *master-and-branch
  after_script:
    - mkdir build/reports/tests/it/
    - mv build/reports/tests/test/* build/reports/tests/it/
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit: build/test-results/test/**/TEST-*.xml
    paths:
      - build/reports/jacocoHtml/
      - build/reports/tests/it/

perf-test-execute:
  ...
  ...
  rules:
    - *only-master
  after_script:
    - mkdir build/reports/tests/pt/
    - mv build/reports/tests/test/* build/reports/tests/pt/
    - mkdir -p public
    - mv build/reports/tests/pt/ public/
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit: build/test-results/test/**/TEST-*.xml
    paths:
      - public
</code>```

I have Unit test and Integration test running in master and feature branches
and performance test only in master branch.
When I run Master branch I'll get all result properly in below URLs.

projectpath/ut/index.html

projectpath/it/index.html

projectpath/pt/index.html

But if I run feature branch performance(projectpath/pt/index.html) result link will give 404.
How to retain this performance report to next pipeline if I'm not running it(i.e., I'm running feature branches)?

Body:
gradle-check:
  ...
  ...
  rules:
    - *master-and-branch
  after_script:
    - mkdir build/reports/tests/ut/
    - mv build/reports/tests/test/* build/reports/tests/ut/
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit: build/test-results/test/**/TEST-*.xml
    paths:
      - build/reports/tests/ut/

pages:
  stage: pages
  dependencies:
    - gradle-check
    - integration-test
    - perf-test-execute
  script:
    - mkdir -p public
    - mv build/reports/tests/ut/ public/
    - mv build/reports/tests/it/ public/
  artifacts:
    paths:
      - public
    expire_in: 100 yrs
  when: always
  rules:
    - *master-and-branch

integration-test:
  ....
  ....
  rules:
    - *master-and-branch
  after_script:
    - mkdir build/reports/tests/it/
    - mv build/reports/tests/test/* build/reports/tests/it/
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit: build/test-results/test/**/TEST-*.xml
    paths:
      - build/reports/jacocoHtml/
      - build/reports/tests/it/

perf-test-execute:
  ...
  ...
  rules:
    - *only-master
  after_script:
    - mkdir build/reports/tests/pt/
    - mv build/reports/tests/test/* build/reports/tests/pt/
    - mkdir -p public
    - mv build/reports/tests/pt/ public/
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit: build/test-results/test/**/TEST-*.xml
    paths:
      - public

I have Unit test and Integration test running in master and feature branches
and performance test only in master branch.
When I run Master branch I'll get all result properly in below URLs.

projectpath/ut/index.html

projectpath/it/index.html

projectpath/pt/index.html

But if I run feature branch performance(projectpath/pt/index.html) result link will give 404.
How to retain this performance report to next pipeline if I'm not running it(i.e., I'm running feature branches)?


问:
Is it possible to access current paste event object in 'pastePreProcess' tinymce callback?
I need to access the paste event object in pastePreProcess callback to get the clipboard content (rtf content in clipboard)

```<code>    paste_preprocess: function (plugin, arguments_) {
       const clipboardContent = getClipboardContent(editor, event);
       const rtfContent = clipboardContent['text/rtf'];
    }
</code>```

Is it possible to get the current paste event in this callback?

Body:
I need to access the paste event object in pastePreProcess callback to get the clipboard content (rtf content in clipboard)

    paste_preprocess: function (plugin, arguments_) {
       const clipboardContent = getClipboardContent(editor, event);
       const rtfContent = clipboardContent['text/rtf'];
    }

Is it possible to get the current paste event in this callback?


问:
How best to update client (local) state as a side-effect of an Apollo cache update
I'm interested in opinions on how to manage global client state (Zustand) invalidation as a result of a socket update which modifies the network state cache (Apollo).

Let's say we have the following state:

Apollo cache (requested from server):

```<code>{ posts: [
  { id: 1, text: 'Hello World!' },
  { id: 2, text: 'I has a bucket!' },
  { id: 3, text: 'Thanks StackOverflow!' }
] }
</code>```

Zustand store (client state):

```<code>{
  selectedPost: 2,
  editMode: true
}
</code>```

In this state, we show a UI which allows editing the contents of post 2. We run into an edge case however, if another user deletes post 2. A socket update will remove that post from our network cache, while our client state still believes it is selected and being edited.

This could result in a strange user experience where the post has disappeared, but they still see the edit UI, and any attempt to save will fail, since the resource no longer exists to be updated on the backend.

The expectation is to set the following client state if the selected feedback is removed:

```<code>{
  selectedPost: null,
  editMode: false,
}
</code>```

The full situation is more complex, and I'd want to show a message to the user, but I feel those details are unimportant to this discussion, so I've minimized the state as much as possible.

I've considered a few options for solving this problem. Each with some pros and cons. Any one of these can work. What I'm interested in is advice from someone familiar with this type of problem, on which solution is most viable long-term.

useEffect

Write a useEffect which listens for posts not including a post with post.id === selectedPost, and updates client state to { selectedPost: null, editMode: false }.

This has the disadvantage that there is an in-between render where the post does not exist, but it is still selected and we still show the edit UI. Meaning we have to be sure our components can handle that invalid state. It could also result in a visual flicker where the user sees this invalid UI briefly before the client state is adjusted.

Side-effect of Apollo cache change

I'm not sure if this is something that can be done.

Write a callback which runs when the Apollo cache changes, but before the resulting render occurs. This callback checks if selectedPost exists in the new cache. If not, it updates the client state. This would not cause the in-between invalid render.

I haven't seen anything on the Apollo docs about this. So I'm not sure if it's possible.

Update client state in the socket handler, at the same time Apollo cache is updated

We have functions that handle each socket event, which make the required modifications to the Apollo cache. We could add the client state checks and updates here. This would avoid the invalid render problem.

The downside is we would have to manually handle every socket event that could result in removing a post. Which would result in duplicated code and room for error if new socket events were introduced.

Does anyone have experience with updating client state as a side-effect of network state like this? Any suggestions on how to handle it elegantly without the invalid in-between render?

Body:
I'm interested in opinions on how to manage global client state (Zustand) invalidation as a result of a socket update which modifies the network state cache (Apollo).

Let's say we have the following state:

Apollo cache (requested from server):

{ posts: [
  { id: 1, text: 'Hello World!' },
  { id: 2, text: 'I has a bucket!' },
  { id: 3, text: 'Thanks StackOverflow!' }
] }

Zustand store (client state):

{
  selectedPost: 2,
  editMode: true
}

In this state, we show a UI which allows editing the contents of post 2. We run into an edge case however, if another user deletes post 2. A socket update will remove that post from our network cache, while our client state still believes it is selected and being edited.

This could result in a strange user experience where the post has disappeared, but they still see the edit UI, and any attempt to save will fail, since the resource no longer exists to be updated on the backend.

The expectation is to set the following client state if the selected feedback is removed:

{
  selectedPost: null,
  editMode: false,
}

The full situation is more complex, and I'd want to show a message to the user, but I feel those details are unimportant to this discussion, so I've minimized the state as much as possible.

I've considered a few options for solving this problem. Each with some pros and cons. Any one of these can work. What I'm interested in is advice from someone familiar with this type of problem, on which solution is most viable long-term.

useEffect

Write a useEffect which listens for posts not including a post with post.id === selectedPost, and updates client state to { selectedPost: null, editMode: false }.

This has the disadvantage that there is an in-between render where the post does not exist, but it is still selected and we still show the edit UI. Meaning we have to be sure our components can handle that invalid state. It could also result in a visual flicker where the user sees this invalid UI briefly before the client state is adjusted.

Side-effect of Apollo cache change

I'm not sure if this is something that can be done.

Write a callback which runs when the Apollo cache changes, but before the resulting render occurs. This callback checks if selectedPost exists in the new cache. If not, it updates the client state. This would not cause the in-between invalid render.

I haven't seen anything on the Apollo docs about this. So I'm not sure if it's possible.

Update client state in the socket handler, at the same time Apollo cache is updated

We have functions that handle each socket event, which make the required modifications to the Apollo cache. We could add the client state checks and updates here. This would avoid the invalid render problem.

The downside is we would have to manually handle every socket event that could result in removing a post. Which would result in duplicated code and room for error if new socket events were introduced.

Does anyone have experience with updating client state as a side-effect of network state like this? Any suggestions on how to handle it elegantly without the invalid in-between render?


问:
Error installing npm dependency in Laravel 8 Sail: Conflicting peer dependency: postcss
I have a laravel 8 project that I need to make changes to. I installed laravel sail to start it but I get an error trying to install npm packages:

```<code> sail npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: laravel-mix@6.0.18
npm ERR! Found: postcss@7.0.35
npm ERR! node_modules/postcss
npm ERR!   postcss@"^7.0.35" from the root project
npm ERR!   postcss@"^7" from @tailwindcss/postcss7-compat@2.0.3
npm ERR!   node_modules/@tailwindcss/postcss7-compat
npm ERR!     @tailwindcss/postcss7-compat@"^2.0.3" from the root project
npm ERR!   38 more (@types/cssnano, autoprefixer, css-declaration-sorter, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer postcss@"^8.1.2" from laravel-mix@6.0.18
npm ERR! node_modules/laravel-mix
npm ERR!   dev laravel-mix@"^6.0.18" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: postcss@8.4.20
npm ERR! node_modules/postcss
npm ERR!   peer postcss@"^8.1.2" from laravel-mix@6.0.18
npm ERR!   node_modules/laravel-mix
npm ERR!     dev laravel-mix@"^6.0.18" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /home/sail/.npm/_logs/2022-12-21T17_56_37_398Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sail/.npm/_logs/2022-12-21T17_56_37_398Z-debug-0.log
</code>```

sail node -v

v18.12.1

sail npm -v

9.2.0

Body:
I have a laravel 8 project that I need to make changes to. I installed laravel sail to start it but I get an error trying to install npm packages:

 sail npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: laravel-mix@6.0.18
npm ERR! Found: postcss@7.0.35
npm ERR! node_modules/postcss
npm ERR!   postcss@"^7.0.35" from the root project
npm ERR!   postcss@"^7" from @tailwindcss/postcss7-compat@2.0.3
npm ERR!   node_modules/@tailwindcss/postcss7-compat
npm ERR!     @tailwindcss/postcss7-compat@"^2.0.3" from the root project
npm ERR!   38 more (@types/cssnano, autoprefixer, css-declaration-sorter, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer postcss@"^8.1.2" from laravel-mix@6.0.18
npm ERR! node_modules/laravel-mix
npm ERR!   dev laravel-mix@"^6.0.18" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: postcss@8.4.20
npm ERR! node_modules/postcss
npm ERR!   peer postcss@"^8.1.2" from laravel-mix@6.0.18
npm ERR!   node_modules/laravel-mix
npm ERR!     dev laravel-mix@"^6.0.18" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /home/sail/.npm/_logs/2022-12-21T17_56_37_398Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sail/.npm/_logs/2022-12-21T17_56_37_398Z-debug-0.log

sail node -v

v18.12.1

sail npm -v

9.2.0


问:
How can I change the style of my developer account page on Google Play?
I see that the page of some developer accounts in google play is different. Apps are listed in my account. But I see some accounts are different. For example, Ketchapp. How can I change the shape of my own page?


问:
common flutter engine for 2 android activities
I have 2 activities which inherit from FlutterActivity(). As I know when we are starting the activity flutterEngine is created. I would like to have common flutterEngine (1) for both activities. The question is how I should attaching/detaching engine and when? Also how should I pop activity and detach it from one activity and attach to other activity?

I would like to achieve effect like which activity is visible then this one flutter engine is attached.


问:
How to add right and left swipes to the RecyclerView?
I have been using the fragments(Java). The list is showing in the RecyclerView but when I swipe left or right, it is not getting detected.

I do not know Kotlin. Need help in Java implementation.

Bible - Chapter view

The expected behavior is to go to the next chapter or previous chapter when I swipe left or right. Each chapter is a List.

I have tried with ViewPager2 but I am unable to understand how to use RecyclerView inside ViewPager2.

```<code>import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.handsoncloud.holybible.R;
import com.handsoncloud.holybible.adapters.RecyclerBibleAdapter;
import com.handsoncloud.holybible.ui.chapter.ChaptersFragment;
import com.handsoncloud.holybible.utils.Books;

public class HomeFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        View rootView = inflater.inflate(R.layout.fragment_home, container, false);

        RecyclerView recyclerView = rootView.findViewById(R.id.recycler_bibleBooks);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setHasFixedSize(true);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());

        RecyclerBibleAdapter recyclerBibleAdapter = new RecyclerBibleAdapter(getContext(), Books.getBooks(), (book, position) -> {
            ChaptersFragment.BOOK_NAME_ENGLISH = Books.booksInEnglish.get(position);
            ChaptersFragment.BOOK_NAME_TELUGU = Books.booksInTelugu.get(position);
        });

        recyclerView.setAdapter(recyclerBibleAdapter);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }
}
</code>```

Body:
I have been using the fragments(Java). The list is showing in the RecyclerView but when I swipe left or right, it is not getting detected.

I do not know Kotlin. Need help in Java implementation.

Bible - Chapter view

The expected behavior is to go to the next chapter or previous chapter when I swipe left or right. Each chapter is a List.

I have tried with ViewPager2 but I am unable to understand how to use RecyclerView inside ViewPager2.

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.handsoncloud.holybible.R;
import com.handsoncloud.holybible.adapters.RecyclerBibleAdapter;
import com.handsoncloud.holybible.ui.chapter.ChaptersFragment;
import com.handsoncloud.holybible.utils.Books;

public class HomeFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);

        View rootView = inflater.inflate(R.layout.fragment_home, container, false);

        RecyclerView recyclerView = rootView.findViewById(R.id.recycler_bibleBooks);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setHasFixedSize(true);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());

        RecyclerBibleAdapter recyclerBibleAdapter = new RecyclerBibleAdapter(getContext(), Books.getBooks(), (book, position) -> {
            ChaptersFragment.BOOK_NAME_ENGLISH = Books.booksInEnglish.get(position);
            ChaptersFragment.BOOK_NAME_TELUGU = Books.booksInTelugu.get(position);
        });

        recyclerView.setAdapter(recyclerBibleAdapter);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }
}


问:
Building a Windows Setup Project gives many Setup files
I did the following steps to create a Windows Setup project:

Create a Windows Forms Application using Visual Studio

Install "Microsoft Visual Studio Installer Projects plugin"

Add a "Setup Project" to the solution

In the "Application Folder", add project output

(Steps 5 and 6 are optional)

By right clicking the Setup project and opening "Properties", select "Prerequisites"

Select "Download prerequisites from the same location as my application"

Build the solution.

After all these steps, I see many files (Setup.exe, Setup.msi, NETFX472 folder) in the Release folder. But I only want one simple self-contained setup file. So, users can run the setup file and install the application easily.

How can I make a simple and self-contained Setup file for my project?

I know it's possible, but I am looking for an easier and more efficient way to do it.

I know I can create another Windows Forms app called Setup which copies the project outputs to user's Program Files directory and copy the output files one-by-one. But I don't think that solution is elegant.

EDIT:
After more tries, I learned that Setup.exe is for installing dependencies (only .NET Framework 4.7.2 for my case) and then running Setup.msi. So, without Setup.msi file, Setup.exe is nothing and vice-versa.

 Also, I want my program should work 100% offline (including setup). So, installer should include offline .NET Framework 4.7.2 installer.

 What I don't want here is Setup.exe to only install dependencies. It should also install my program. So, it should do also whatever Setup.msi file does. Second thing I don't want is dependency installer as separate file (offline .NET Framework 4.7.2 installer in this case). It should also be embedded into Setup.exe.


问:
Boost MPI flags can't be found when installing Repast HPC
Using M1 Mac, I've followed the manual install procedures to install Repast HPC.
I'm trying to run ./install.sh rhpc and the following error persists:

configure: error: cannot not find the flags to link with Boost mpi

The suggested solution says to add the compiler wrappers with the following commands:

```<code>export PATH=$BASE_DIR/MPICH/bin:$PATH
MPI_COMPILER_INVOCATION=$BASE_DIR/MPICH/bin/mpicxx
</code>```

which didn't work as the command mpicxx still couldn't be invoked.

So I tried installing mpich through homebrew, where mpicxx now works outside of the install. However, the error persists.

So I tried installing boost through homebrew and directing the install to the homebrew directory, but the error persists.

So I tried installing open-mpi through homebrew, and mpicxx still works, but the error persists.

Any suggestions? I'm running out of online resources to solve the issue.

Body:
Using M1 Mac, I've followed the manual install procedures to install Repast HPC.
I'm trying to run ./install.sh rhpc and the following error persists:

configure: error: cannot not find the flags to link with Boost mpi

The suggested solution says to add the compiler wrappers with the following commands:

export PATH=$BASE_DIR/MPICH/bin:$PATH
MPI_COMPILER_INVOCATION=$BASE_DIR/MPICH/bin/mpicxx

which didn't work as the command mpicxx still couldn't be invoked.

So I tried installing mpich through homebrew, where mpicxx now works outside of the install. However, the error persists.

So I tried installing boost through homebrew and directing the install to the homebrew directory, but the error persists.

So I tried installing open-mpi through homebrew, and mpicxx still works, but the error persists.

Any suggestions? I'm running out of online resources to solve the issue.


问:
How to fix Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeFormDataType' in TypeScript
I have this TypeScript playground:

```<code>export enum Scope {
  Form = "form",
  Nest = "nest",
}

export type ScopeKeyListType<
  L extends Scope,
  T extends ScopeType<L>,
> = T['parent'] extends ScopeType<infer A extends Scope>
  ? keyof T['data'] & ScopeKeyListType<A, T['parent']>
  : keyof T['data']

export type ScopeNestDataType = {
  index: number;
  nest: {
    foo: string;
    bar: boolean;
  };
};

export type ScopeFormDataType = {
  hello: string;
  world: number;
};

export type ScopeTableType = {
  form: ScopeFormDataType;
  nest: ScopeNestDataType;
};

export type ScopeType<
  A extends Scope,
  B extends unknown = unknown
> = {
  data: ScopeTableType[A];
  like: A;
  parent?: B extends ScopeType<infer T extends Scope, infer Q>
    ? B
    : never
};

export type ScopeValueType<
  L extends Scope,
  T extends ScopeType<L>,
  K extends ScopeKeyListType<L, T>,
> = T['data'] extends { [key in K]: unknown }
  ? T['data'][K]
  : T['parent'] extends ScopeType<infer A extends Scope>
  ? ScopeValueType<
      A,
      T['parent'],
      ScopeKeyListType<A, T['parent']>
    >
  : never

export type ParentScopeType<S> =
  | S
  | (S extends ScopeType<infer X, infer Y>
      ? Y extends ScopeType<infer A, infer B>
        ? ParentScopeType<Y>
        : never
      : never)

export function setPropertyValueOnScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>
>(scope: S, property: K, value: ScopeValueType<L, S, K>): void {
  if (property in scope.data) {
    scope.data[property] = value;
  } else if (scope.parent) {
    setPropertyValueOnScope(scope.parent, property, value);
  } else {
    throw new Error(`Property not defined on scope`);
  }
}

export function getPropertyValueFromScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>,
>(scope: S, path: K): ScopeValueType<L, S, K> | undefined {
  let source: ParentScopeType<S> | undefined = scope

  while (source) {
    if (path in source.data) {
      break
    } else {
      source = source.parent
    }
  }

  if (!source) {
    return
  }

  return source.data[path]
}
</code>```

I am getting 2 errors, one on each function:

```<code>Type 'ScopeValueType<L, S, K>' is not assignable to type 'ScopeTableType[L][K]'.
  Type 'S["data"][K] | (S["parent"] extends ScopeType<infer A extends Scope, unknown> ? ScopeValueType<A, S["parent"], ScopeKeyListType<A, S["parent"]>> : never)' is not assignable to type 'ScopeTableType[L][K]'.
    Type 'S["data"][K]' is not assignable to type 'ScopeTableType[L][K]'.
      Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeTableType[L]'.
        Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeFormDataType & ScopeNestDataType'.
          Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeFormDataType'.(2322)
</code>```

```<code>Type 'ScopeTableType[L][K]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
  Type 'ScopeTableType[L][ScopeKeyListType<L, S>]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
    Type 'ScopeTableType[L][keyof S["data"]] | ScopeTableType[L][keyof S["data"] & ScopeKeyListType<Scope, S["parent"]>]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
      Type 'ScopeTableType[L][keyof S["data"]]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
        Type 'ScopeTableType[L][string] | ScopeTableType[L][number] | ScopeTableType[L][symbol]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
          Type 'ScopeTableType[L][string]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.(2322)
</code>```

I have been stuck on these two errors for a few days, going back and forth between one thing work, the other thing not. This is the minimal state I have created to reproduce the issue in a complex compiler AST generation project. Do you know how to fix this?

Body:
I have this <a href="https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBMAdgVwLZwMoGMJmHAbwCg44AxadAXjgCIAzS2gGhLgDlgBneG2xbjBZEAvkSKhIsODACeeTDjwBpYLIAyASx4AVecAA8bdQhAwkAEy6LcwVqR2nziKzbx68B9QD5W3uDQ6ANoA5GAAhlBIMCEAuk6W1ti2HoaaiPTAUHAAggkuSUrA3mwA-HAA1moQ9HDBIRbhMOFxcABkbsCqGtowqQY5zHWhEVGIMbElpABcldW19Y3NceKS0PByCsl4nDwAIk3hqQGEbOkWoLMoqABGWQDcbAI8s8SkpIwQszxQ6QDmj3ecBukVmNwgEAANsBwohAXARI9EatwOsZPpOhQoKgDs1jjQ3nAABbASGQr5wH7-eEAd2gkIsVzQdygSMeElR0k2+G2wB04Ru0Pxpw+lFmvKxOMOqXhzxg4qKuxguKO+jZKKkGwxvP6bDyoGcrl59jgACF8q5kIgKogIDTECcrTa7YgiP4CWwluEFSkBUL9EEcrF4ZDNFVZjl4aNoqVZuaDYlOv10plso4EwVOkMU1k4ABFKbvcqmtgzOACABuWVE7LWXO1RQAauFIcg+fojKQTBmjUUTemzImdR2fCblBbCrZulpdCOhjpfG6TotDq0e9YCHAglVZHB0nBlLFZk7bfaEWVhg1V7Egoe2LN6tHxmvB5nh54c9l9a-e7ZC+VeWbVt208Ut3kGMCHBGSJojiE0gV5aden6QZLyfCZC1IQsrmAKsoA1NFuTgAAFGDxnfQwMHdNgAB9MFouAAAoMAnJMO0-OAAA1swyXMAE1MKLOA+NYiiDA41CONNQSgXKUixhgMSBMg94cLwlS1KyABKAjpHoK0sBgTQIAdLhgBgYioFsWBZCAtsAHlEF5Ts4G7H9JzwE0WPXNjPFHNhxx8xC1BnPo50wEpvEYrginFIYwCsvAbNmZQhgrFs2x9PA7JAwx1CGDAhmUbwtNmCsIE0CwRT3WpGIS6y5D3UyigAOi9LTqtIGLbDaw4gnqpK5HiGh0uA+ERAQSEzJqpjurwFr0I6wkuvMyyGtsjLgEc3lota9D4sSrI5DSzatPGybpuWmQiSsmly2AO6AFEoCsqBGIAAzWwbd1teALnodJgCqkzKSKd6zrYMQxA5TU4H0xBDOMh0-lWw6bJysgrNQZzjFEvs2G89zfLyxdSECongp6Wc-IKxcorm4A4rgCIYCJFLSs6HL+nyzAiv8OirX+wGqsJaF4C4CBkCgLBGZIsjFKKfoqLgAWXGAAGBCqmgGfEUgaSJTRoVmyXpeAJawM0WqWaJJrKRNmXeuac2gVIG4onCCowIm0lLpUiWpZlk5-dNhb5a9yHdZmxiAEJg5l533iiGApddUhodIJOU7tgPgEd8J+qaIlYlEIA" rel="nofollow noreferrer">TypeScript playground:

export enum Scope {
  Form = "form",
  Nest = "nest",
}

export type ScopeKeyListType<
  L extends Scope,
  T extends ScopeType<L>,
> = T['parent'] extends ScopeType<infer A extends Scope>
  ? keyof T['data'] & ScopeKeyListType
  : keyof T['data']

export type ScopeNestDataType = {
  index: number;
  nest: {
    foo: string;
    bar: boolean;
  };
};

export type ScopeFormDataType = {
  hello: string;
  world: number;
};

export type ScopeTableType = {
  form: ScopeFormDataType;
  nest: ScopeNestDataType;
};

export type ScopeType = {
  data: ScopeTableType[A];
  like: A;
  parent?: B extends ScopeType<infer T extends Scope, infer Q>
    ? B
    : never
};

export type ScopeValueType<
  L extends Scope,
  T extends ScopeType<L>,
  K extends ScopeKeyListType<L, T>,
> = T['data'] extends { [key in K]: unknown }
  ? T['data'][K]
  : T['parent'] extends ScopeType<infer A extends Scope>
  ? ScopeValueType<
      A,
      T['parent'],
      ScopeKeyListType
    >
  : never

export type ParentScopeType<S> =
  | S
  | (S extends ScopeType<infer X, infer Y>
      ? Y extends ScopeType<infer A, infer B>
        ? ParentScopeType<Y>
        : never
      : never)

export function setPropertyValueOnScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>
>(scope: S, property: K, value: ScopeValueType<L, S, K>): void {
  if (property in scope.data) {
    scope.data[property] = value;
  } else if (scope.parent) {
    setPropertyValueOnScope(scope.parent, property, value);
  } else {
    throw new Error(`Property not defined on scope`);
  }
}

export function getPropertyValueFromScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>,
>(scope: S, path: K): ScopeValueType<L, S, K> | undefined {
  let source: ParentScopeType<S> | undefined = scope

  while (source) {
    if (path in source.data) {
      break
    } else {
      source = source.parent
    }
  }

  if (!source) {
    return
  }

  return source.data[path]
}

I am getting 2 errors, one on each function:

Type 'ScopeValueType<L, S, K>' is not assignable to type 'ScopeTableType[L][K]'.
  Type 'S["data"][K] | (S["parent"] extends ScopeType<infer A extends Scope, unknown> ? ScopeValueType<A, S["parent"], ScopeKeyListType> : never)' is not assignable to type 'ScopeTableType[L][K]'.
    Type 'S["data"][K]' is not assignable to type 'ScopeTableType[L][K]'.
      Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeTableType[L]'.
        Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeFormDataType & ScopeNestDataType'.
          Type '{ [key in K]: unknown; } & S["data"]' is not assignable to type 'ScopeFormDataType'.(2322)

Type 'ScopeTableType[L][K]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
  Type 'ScopeTableType[L][ScopeKeyListType<L, S>]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
    Type 'ScopeTableType[L][keyof S["data"]] | ScopeTableType[L][keyof S["data"] & ScopeKeyListType<Scope, S["parent"]>]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
      Type 'ScopeTableType[L][keyof S["data"]]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
        Type 'ScopeTableType[L][string] | ScopeTableType[L][number] | ScopeTableType[L][symbol]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.
          Type 'ScopeTableType[L][string]' is not assignable to type 'ScopeValueType<L, S, K> | undefined'.(2322)

I have been stuck on these two errors for a few days, going back and forth between one thing work, the other thing not. This is the minimal state I have created to reproduce the issue in a complex compiler AST generation project. Do you know how to fix this?


问:
How to I convert bytes to float in big query?
I am working with data stored as a very long base64 encoded string in Big Query and trying to substring out floating point numbers which are stored as IEE754 format. The best I've been able to achieve so far is a hex representation of the floating point number, is there any way to turn the bytes or hex value into a float?

I have been able to get a hex representation of the floating point number as follows,

to_hex(substring(from_base64(my_string),start_pos,length))


问:
Get peak memory usage of process tree
I have a commandline program that launches a bunch of subprocesses (which themselves can launch more subprocesses).  I'd like to somehow determine the peak combined memory usage of all subprocesses in the whole tree.  This is on linux; I don't have source code for the program.

I can run the program from python with subprocess.call(), and I can get the max resident set size with resource.getrusage(RUSAGE_CHILDREN).ru_maxrss.  I think that only returns the value for the program itself, but not its children.  What is the equivalent of getrusage() that applies to the whole process tree recursively?

P.S. man getrusage says this:

For RUSAGE_CHILDREN, this is the resident set size of the largest
child, not the maximum resident set size of the process tree.

So it's not the peak of the first child as I thought, but also not the instantaneous peak of the process tree or the sum of peaks of the children.

Title: Get peak memory usage of process tree


问:
How to fetch data from Strapi in Next js 13?
does anyone know how can i fetch data from my strapi api?

my usual code for fetching data in nextjs 13 is :

```<code>const fetchProducts = async () => {
  const res = await fetch('https://fakestoreapi.com/products');
  const items = await res.json();
  return items;
};
</code>```

but i don't know how to adapt it for strapi... i set up my strapi account following this tutorial (https://www.youtube.com/watch?v=BCkWFblNLKU&t=6791s) but they're using react app and i need it for nextjs 13 without the use of axios or getStaticProps. Can anyone help me?
i've been having trouble learning nextjs cause there are barely any tutorials out there for the beta version ...

Body:
does anyone know how can i fetch data from my strapi api?

my usual code for fetching data in nextjs 13 is :

const fetchProducts = async () => {
  const res = await fetch('https://fakestoreapi.com/products');
  const items = await res.json();
  return items;
};

but i don't know how to adapt it for strapi... i set up my strapi account following this tutorial (https://www.youtube.com/watch?v=BCkWFblNLKU&t=6791s) but they're using react app and i need it for nextjs 13 without the use of axios or getStaticProps. Can anyone help me?
i've been having trouble learning nextjs cause there are barely any tutorials out there for the beta version ...


问:
Multiple Uploads Karate fail with 415
I am trying to Automate API that has multipart upload. I am getting 415.

```<code>Scenario:
  * def Json = {}
  * def multiPartText = read(Test.txt)
  * def multiPartPng = read(Test.png)
  * def multiPartJpg = read(Test.jpg)

When path 'Path'
And multipart field text = multiPartText
And multipart file jpg = { read: 'path/Test.jpg', filename: 'Test.jpg', content-Type: 'image/jpg'}
And header Content-Type = 'multipart/form-data'
And method POST
Then 201
</code>```

this is what I written but I am getting 415.

```<code>Error:
  content-disposition: form data; name= "info"; filename=""
  content-type: text/plain
  content length: 500
  Completed: true
  IsinMemory: true

  Mixed content-disposition: from-data; name="file"; filename="Test.jpg"
  content-type: image/jpg
  content length: 500
  Completed: true
  IsinMemory: false >> Note: Path is correct and jpg in the framework.
</code>```

Any one knows why? or How to solve it?

Title: Multiple Uploads Karate fail with 415

Body:
I am trying to Automate API that has multipart upload. I am getting 415.

Scenario:
  * def Json = {}
  * def multiPartText = read(Test.txt)
  * def multiPartPng = read(Test.png)
  * def multiPartJpg = read(Test.jpg)

When path 'Path'
And multipart field text = multiPartText
And multipart file jpg = { read: 'path/Test.jpg', filename: 'Test.jpg', content-Type: 'image/jpg'}
And header Content-Type = 'multipart/form-data'
And method POST
Then 201

this is what I written but I am getting 415.

Error:
  content-disposition: form data; name= "info"; filename=""
  content-type: text/plain
  content length: 500
  Completed: true
  IsinMemory: true

  Mixed content-disposition: from-data; name="file"; filename="Test.jpg"
  content-type: image/jpg
  content length: 500
  Completed: true
  IsinMemory: false >> Note: Path is correct and jpg in the framework.

Any one knows why? or How to solve it?


问:
VBComponent.SaveAs object doesn't support this property or method
Compiler says than Componente.SaveAs object doesn't support this property or method.
Microsoft Help: https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/saveas-method-vba-add-in-object-model

In C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1\1033\VBOB6.CHM you can see the Applies To lists and it clearly says that SaveAs method applies to VBComponent Object.

¿Can anyone help with this error? Thanks in advance

I´m writing a macro in VBA so that Word can save a standard Module (only code; not a class module) to a path in filesystem.

```<code>   For Each Componente In ThisDocument.VBProject.VBComponents
        If StrComp(Componente.Name, Modulo1Nombre) = 0 Then 'https://learn.microsoft.com/en-us/office/vba/language/reference/visual-basic-add-in-model/properties-visual-basic-add-in-model#name
            MsgBox "Encontrado módulo. Salvando en: " + PATH_BACKUP + Modulo1Nombre + EXTENSION_DE_MODULO
            Componente.SaveAs (PATH_BACKUP + Modulo1Nombre + EXTENSION_DE_MODULO)
            Exit For ' Una vez encontrado salimos
        End If
    Next Componente
</code>```

Body:
Compiler says than Componente.SaveAs object doesn't support this property or method.
Microsoft Help: https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/saveas-method-vba-add-in-object-model

In C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1\1033\VBOB6.CHM you can see the Applies To lists and it clearly says that SaveAs method applies to VBComponent Object.

¿Can anyone help with this error? Thanks in advance

I´m writing a macro in VBA so that Word can save a standard Module (only code; not a class module) to a path in filesystem.

   For Each Componente In ThisDocument.VBProject.VBComponents
        If StrComp(Componente.Name, Modulo1Nombre) = 0 Then 'https://learn.microsoft.com/en-us/office/vba/language/reference/visual-basic-add-in-model/properties-visual-basic-add-in-model#name
            MsgBox "Encontrado módulo. Salvando en: " + PATH_BACKUP + Modulo1Nombre + EXTENSION_DE_MODULO
            Componente.SaveAs (PATH_BACKUP + Modulo1Nombre + EXTENSION_DE_MODULO)
            Exit For ' Una vez encontrado salimos
        End If
    Next Componente


问:
MongoDBCompas import large JSON file
I have problem with importing large JSON file (it's not JSON Array) which is backup of client database(neither BSON file). I tried both ways of import: from MongoDBCompas GUI and from mongoimport tool. Both import run successfully without errors but file has 10 GB in my computer but after import in server show just 1.91 GB storage size.

My question is if it's some restriction for free version which limits size of import? And if is some way to ensure that whole file was imported?

Title: MongoDBCompas import large JSON file


问:
I get a 500 error when executing the DELETE method with ajax, but the SQLquery is still executed, what is the error?
I have a confusing problem when performing a 'DELETE' action with ajax to delete a record from the table, I use a method in the Spring boot controller to do it.
The error is a type 500, which is annoying because it prevents me from performing subsequent actions such as deleting the row of the record in the html table or reloading the page, what I don't understand is why the deletion of the record in the database is still executed, shouldn't it not be executed if there was an error, and if it was executed correctly then where does the error come from?, that's what prevents me from knowing if I'm wrong in the backend method or in the frontend Jquery.

Controller method in spring boot

```<code>@DeleteMapping("/dashboard/delete/{id_usuario}")
public Object deleteCustomer(@PathVariable("id_usuario") int id_usuario){

    System.out.println("Se elimino registro");
    service.Eliminar(id_usuario);
    return null;
}
</code>```

Table with the link to the function to delete

```<code> <tr
     th:each="pers:${Persona}"
     th:id="'row-' + ${pers.usuario.id_usuario}"
 >
    <td th:text="${pers.id_persona}"></td>
    <td th:text="${pers.nom_persona}"></td>
    <td th:text="${pers.ape_persona}"></td>
    <td th:text="${pers.dni_persona}"></td>
    <td th:text="${pers.cel_persona}"></td>

    <td>
        <a
          th:href="@{/dashboard/editar(id_usuario=${pers.usuario.id_usuario})}"
        >
          <i class="bi bi-pen"></i>
        </a>
     </td>

                      <td>
                        <a
                          th:onclick="'deleteRecord(\'' + ${pers.usuario.id_usuario} + '\')'"
                          ><i style="color: red" class="bi bi-trash3"></i
                        ></a>
                      </td>
                    </tr>
</code>```

Function in Ajax

```<code>var url = window.location.origin;
      function deleteRecord(id) {
        Swal.fire({
          title: "¿Estás seguro?",
          text: "No podrás revertir esto!",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Sí, eliminar!",
        }).then((result) => {
          if (result.value) {
            $.ajax({
              url: url + "/dashboard/delete/" + id,
              method: "DELETE",//also try with 'type'
              success: function () {
                //$("#row-" + id).remove(); //optional instruction
                //window.location.reload(); //optional instruction
              },
              error: function (xhr, status, error) {
                console.error(error);
                console.error(status);
                console.error(xhr);
              },
            });
          }
        });
      }
</code>```

Error in Java Console
[THYMELEAF][http-nio-8080-exec-10] Exception processing template "dashboard/delete/8": Error resolving template [dashboard/delete/8], template might not exist or might not be accessible by any of the configured Template Resolvers

Versions I use:
Spring boot 2.7.4
JQuery: 3.5.1
JDK: 11

Body:
I have a confusing problem when performing a 'DELETE' action with ajax to delete a record from the table, I use a method in the Spring boot controller to do it.
The error is a type 500, which is annoying because it prevents me from performing subsequent actions such as deleting the row of the record in the html table or reloading the page, what I don't understand is why the deletion of the record in the database is still executed, shouldn't it not be executed if there was an error, and if it was executed correctly then where does the error come from?, that's what prevents me from knowing if I'm wrong in the backend method or in the frontend Jquery.

Controller method in spring boot

@DeleteMapping("/dashboard/delete/{id_usuario}")
public Object deleteCustomer(@PathVariable("id_usuario") int id_usuario){

    System.out.println("Se elimino registro");
    service.Eliminar(id_usuario);
    return null;
}

Table with the link to the function to delete

Function in Ajax

var url = window.location.origin;
      function deleteRecord(id) {
        Swal.fire({
          title: "¿Estás seguro?",
          text: "No podrás revertir esto!",
          icon: "warning",
          showCancelButton: true,
          confirmButtonColor: "#3085d6",
          cancelButtonColor: "#d33",
          confirmButtonText: "Sí, eliminar!",
        }).then((result) => {
          if (result.value) {
            $.ajax({
              url: url + "/dashboard/delete/" + id,
              method: "DELETE",//also try with 'type'
              success: function () {
                //$("#row-" + id).remove(); //optional instruction
                //window.location.reload(); //optional instruction
              },
              error: function (xhr, status, error) {
                console.error(error);
                console.error(status);
                console.error(xhr);
              },
            });
          }
        });
      }

Error in Java Console
[THYMELEAF][http-nio-8080-exec-10] Exception processing template "dashboard/delete/8": Error resolving template [dashboard/delete/8], template might not exist or might not be accessible by any of the configured Template Resolvers

Versions I use:
Spring boot 2.7.4
JQuery: 3.5.1
JDK: 11


问:
VoiceOver interrupts my description when announcing "invalid data"
I'm trying to work on a simple accessible form. It has a field for the user to input their full name.

<form onsubmit="validate()">

Full name

    <input type="text" id="full-name" required aria-describedby="full-name-error">
    Enter your full name

  <button type="submit">Submit</button>
</form>

```

Something seems to go wrong w/ VoiceOver on iOS with this code when I manually test it. The focus does move to the full name input but VoiceOver's announcement of "Invalid data" interrupts the error message, except sometimes it doesn't and actually works like it's supposed to? It's very strange. It will announce something like Enter yo— Invalid data., so the message is definitely getting interrupted. In other instances, it announces the entire message. I've tried programmatically setting the aria-describedby w/ JS and using aria-live on the em instead but I'm getting the same problem. Not sure if I'm doing something wrong or whether this is peculiar to VO.

Body:
I'm trying to work on a simple accessible form. It has a field for the user to input their full name.

<form onsubmit="validate()">

Full name

    <input type="text" id="full-name" required aria-describedby="full-name-error">
    Enter your full name

  <button type="submit">Submit</button>
</form>

Something seems to go wrong w/ VoiceOver on iOS with this code when I manually test it. The focus does move to the full name input but VoiceOver's announcement of "Invalid data" interrupts the error message, except sometimes it doesn't and actually works like it's supposed to? It's very strange. It will announce something like Enter yo— Invalid data., so the message is definitely getting interrupted. In other instances, it announces the entire message. I've tried programmatically setting the aria-describedby w/ JS and using aria-live on the em instead but I'm getting the same problem. Not sure if I'm doing something wrong or whether this is peculiar to VO.


问:
Plot Confusion Matrix with Two Values per Square
I've been using seaborn.heatmap() to visualize confusion matrices for a while and really enjoy it. However, I want to normalize each square with respect to both the predictions and actual values and plot these values in each square. In other words, in square (x, y) I want the values:

(sum(predicted_class_x == class_y)) / (sum(predicted_class_x))

(sum(predicted_class_x == class_y)) / (sum(class_y))

So down the diagonal each square will have both the precision/recall of each class, and the other squares will give a sense of how the other classes interact. In theory this question is just "How can I display two values per block in a heatmap?", but I wonder if the confusion matrix I'm trying to build is common enough that there is a solution out there pertaining to it?

I have tried looking at different functionalities of matplotlib and seaborn, but can't find anything similar to this.


问:
AJAX Autocomplete: HTML Returned Instead of Data
I have a textbox that I want to autocomplete based on values from a database. Originally I put a method in the code behind for the page on which the text box resides. The result of the autocomplete was HTML code, rather than my database values. I researched the issue and two things came up consistently.

Move the code behind from the page where the textbox resides to its own web service.

Add the ServicePath, using the name of the method.

I did both of these things but now instead of getting HTML in the autocomplete, I don't get anything at all. The autocomplete control doesn't pop up, it's just an ordinary text field.

I am new to ASP.NET, so I'm sure I'm missing something simple that I'm just ignorant about.

How I have my controls set up.

```<code><asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
<asp:TextBox ID="txtBorrower" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
 TargetControlID="txtBorrower"
 ServiceMethod="GetBorrowerName"
 ServicePath="WebServiceGetBorrowerNames.asmx"
 EnableCaching="true"
 MinimumPrefixLength="2"
 CompletionSetCount="1"
 CompletionInterval="10"
 FirstRowSelected="true"
 ></cc1:AutoCompleteExtender>
</code>```

Here's the code for the method.

```<code>using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;

namespace VaultOnline
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class WebServiceGetBorrowerNames : System.Web.Services.WebService
    {

        [System.Web.Script.Services.ScriptMethod]
        [WebMethod]
        public static List<string> GetBorrowerName(string searchname)
        {
            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["Test_Monies_Vault_PRDConnectionString"].ConnectionString;
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = "select [Name] from vw_Active_Borrowers where [Name] like @SearchText + '%' order by [Name]";
                    cmd.Parameters.AddWithValue("@SearchText", searchname);
                    cmd.Connection = conn;
                    conn.Open();
                    List<string> borrowers = new List<string>();
                    using (SqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            borrowers.Add(sdr["Name"].ToString());
                        }
                    }
                    conn.Close();

                    return borrowers;
                }
            }
        }
    }
}
</code>```

Body:
I have a textbox that I want to autocomplete based on values from a database. Originally I put a method in the code behind for the page on which the text box resides. The result of the autocomplete was HTML code, rather than my database values. I researched the issue and two things came up consistently.

Move the code behind from the page where the textbox resides to its own web service.

Add the ServicePath, using the name of the method.

I did both of these things but now instead of getting HTML in the autocomplete, I don't get anything at all. The autocomplete control doesn't pop up, it's just an ordinary text field.

I am new to ASP.NET, so I'm sure I'm missing something simple that I'm just ignorant about.

How I have my controls set up.

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
<asp:TextBox ID="txtBorrower" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
 TargetControlID="txtBorrower"
 ServiceMethod="GetBorrowerName"
 ServicePath="WebServiceGetBorrowerNames.asmx"
 EnableCaching="true"
 MinimumPrefixLength="2"
 CompletionSetCount="1"
 CompletionInterval="10"
 FirstRowSelected="true"
 ></cc1:AutoCompleteExtender>

Here's the code for the method.

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;

namespace VaultOnline
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class WebServiceGetBorrowerNames : System.Web.Services.WebService
    {

        [System.Web.Script.Services.ScriptMethod]
        [WebMethod]
        public static List<string> GetBorrowerName(string searchname)
        {
            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["Test_Monies_Vault_PRDConnectionString"].ConnectionString;
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = "select [Name] from vw_Active_Borrowers where [Name] like @SearchText + '%' order by [Name]";
                    cmd.Parameters.AddWithValue("@SearchText", searchname);
                    cmd.Connection = conn;
                    conn.Open();
                    List<string> borrowers = new List<string>();
                    using (SqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            borrowers.Add(sdr["Name"].ToString());
                        }
                    }
                    conn.Close();

                    return borrowers;
                }
            }
        }
    }
}


问:
Tokne permissions for fetching pull request number in GitHub API
I was trying to get the pull request number based on its SHA and stumbled upon this documentation from Git.

I first created a Git Token (classic) with the repo permissions[2] set and it worked just fine. Later on when trying to apply minimal permissions, I tried at first checking only repo:status, which failed with 404 error. I then added each one of the permissions in the list up until the last one, but all also failed with 404.

I though that checking repo and all items under it would have the same effect, but it appears not to be case.

Question 1: which are the minimal permissions required in a token for achieving the task ?

Question 2: can anyone explain the behavior seen ?

p.s.: the doc says that when checking repo

```<code>Note: In addition to repository related resources, the repo scope
also grants access to manage organization-owned resources including
projects, invitations, team memberships and webhooks. This scope also
grants the ability to manage projects owned by users.
</code>```

I'm not managing any of the objects mentioned in the note, so that still doesn't explain the behavior to me

[1] https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit

[2] https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps

Body:
I was trying to get the pull request number based on its SHA and stumbled upon this documentation from Git.

I first created a Git Token (classic) with the repo permissions[2] set and it worked just fine. Later on when trying to apply minimal permissions, I tried at first checking only repo:status, which failed with 404 error. I then added each one of the permissions in the list up until the last one, but all also failed with 404.

I though that checking repo and all items under it would have the same effect, but it appears not to be case.

Question 1: which are the minimal permissions required in a token for achieving the task ?

Question 2: can anyone explain the behavior seen ?

p.s.: the doc says that when checking repo

Note: In addition to repository related resources, the repo scope
also grants access to manage organization-owned resources including
projects, invitations, team memberships and webhooks. This scope also
grants the ability to manage projects owned by users.

I'm not managing any of the objects mentioned in the note, so that still doesn't explain the behavior to me

[1] https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit

[2] https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps


问:
QSerialPort write() not transmitting data
I have a maddening problem with QSerialPort where write() does not transmit any data out. Below is the class where I am connecting and disconnecting from the serial port (/dev/ttyUSB2).

```<code>bool pcon::com_connect()
{
    c_serialPort.setPortName(c_com_port);
    c_serialPort.setBaudRate(c_baud_rate);
    c_serialPort.setParity(c_parity);
    c_serialPort.setStopBits(c_stop_bits);
    c_serialPort.setFlowControl(c_flow_ctl);

    c_connected_status = c_serialPort.open(QIODevice::ReadWrite);

    return c_connected_status;
}

void pcon::com_disconnect()
{
    c_serialPort.close();
    c_connected_status = false;
}

QString pcon::tx_rx(QString tx)
{
    //0. Build the PCON TX String
    QString toCHKSUM = QString::asprintf("%02X", c_addr) + tx;
    QString FromCHKSUM = chksum(toCHKSUM);

    QString outstring = ":" + toCHKSUM + FromCHKSUM + "\n\r";

    //1. TX the PCON TX String.
    const QByteArray tx_ba = outstring.toUtf8();
    qint64 w_result = c_serialPort.write(tx_ba.data());

    c_rx_ba = c_serialPort.readLine();
    c_rx = QString(c_rx_ba);

    //3. Print out debug information.
    qDebug() << "Class: pcon on " << c_com_port << " Function: tx_rx, TX: " << outstring << " RX: " << c_rx << " Write Result: " << w_result;

    return c_rx;
}
</code>```

Below are the results from the tx_rx() function. Here I am attempting to turn the servo on and off. The servo never responds.

```<code>Class: pcon on  "/dev/ttyUSB2"  Function: tx_rx, TX:  ":01050403FF00F4\n\r"  RX:  ""  Write Result:  17
Class: pcon on  "/dev/ttyUSB2"  Function: tx_rx, TX:  ":010504030000F3\n\r"  RX:  ""  Write Result:  17
</code>```

Qt says the call to write() completed successfully and wrote 17 characters, but no data is written out to the serial port. I have verified that the problem isn't a permission issue or a problem with the device I am trying to talk to it seems if there is a bug in the QSerialPort library in Qt. I can use cutecom to talk to /dev/ttyUSB2 without any issues,

cuteCOM talking to /dev/ttyUSB2 turning servo on/off:

I have tried Qt version 6.2.4 and 6.4.0 with the same results.

Why is write() returning success when no data is transmitted?

Body:
I have a maddening problem with QSerialPort where write() does not transmit any data out. Below is the class where I am connecting and disconnecting from the serial port (/dev/ttyUSB2).

bool pcon::com_connect()
{
    c_serialPort.setPortName(c_com_port);
    c_serialPort.setBaudRate(c_baud_rate);
    c_serialPort.setParity(c_parity);
    c_serialPort.setStopBits(c_stop_bits);
    c_serialPort.setFlowControl(c_flow_ctl);

    c_connected_status = c_serialPort.open(QIODevice::ReadWrite);

    return c_connected_status;
}

void pcon::com_disconnect()
{
    c_serialPort.close();
    c_connected_status = false;
}

QString pcon::tx_rx(QString tx)
{
    //0. Build the PCON TX String
    QString toCHKSUM = QString::asprintf("%02X", c_addr) + tx;
    QString FromCHKSUM = chksum(toCHKSUM);

    QString outstring = ":" + toCHKSUM + FromCHKSUM + "\n\r";

    //1. TX the PCON TX String.
    const QByteArray tx_ba = outstring.toUtf8();
    qint64 w_result = c_serialPort.write(tx_ba.data());

    c_rx_ba = c_serialPort.readLine();
    c_rx = QString(c_rx_ba);

    //3. Print out debug information.
    qDebug() << "Class: pcon on " << c_com_port << " Function: tx_rx, TX: " << outstring << " RX: " << c_rx << " Write Result: " << w_result;

    return c_rx;
}

Below are the results from the tx_rx() function. Here I am attempting to turn the servo on and off. The servo never responds.

Class: pcon on  "/dev/ttyUSB2"  Function: tx_rx, TX:  ":01050403FF00F4\n\r"  RX:  ""  Write Result:  17
Class: pcon on  "/dev/ttyUSB2"  Function: tx_rx, TX:  ":010504030000F3\n\r"  RX:  ""  Write Result:  17

Qt says the call to write() completed successfully and wrote 17 characters, but no data is written out to the serial port. I have verified that the problem isn't a permission issue or a problem with the device I am trying to talk to it seems if there is a bug in the QSerialPort library in Qt. I can use cutecom to talk to /dev/ttyUSB2 without any issues,

cuteCOM talking to /dev/ttyUSB2 turning servo on/off:

I have tried Qt version 6.2.4 and 6.4.0 with the same results.

Why is write() returning success when no data is transmitted?


问:
JPQL case when in order by
I have an enum value in my entity, and I need to save it like string, not ordinal

```<code>@Enumerated(EnumType.STRING)
private Status status;
</code>```

Also I need to sort by this enum value by custom way, not alphabetical. I try to do like this

```<code>@Query("""
            SELECT m
            FROM Movie m
            WHERE ((CAST(:ticketUUID as java.util.UUID) IS NULL) OR (m.ticketUUID = :ticketUUID))
            AND ((CAST(:movieUUID as java.util.UUID) IS NULL) OR (m.movieUUID = :movieUUID))
            ORDER BY CASE
                         WHEN (m.status = 'IN_PROGRESS') THEN 1
                         WHEN (m.status = 'FINISHED') THEN 2
                         ELSE 3 END DESC
           """)

Page<Ticket> findAllByUUid(@Param("ticketUUID") UUID ticketUUID, @Param("movieUUID") UUID movieUUID, Pageable pageable);
</code>```

And in this error in compile JPQL I dont see order clause

```<code>Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: WHEN near line 4, column 15 [ select count(ts) FROM pack.domain.model.Movie m
 WHERE ((CAST(:ticketUUID as java.util.UUID) IS NULL) OR (m.ticketUUID = :ticketUUID))
 AND ((CAST(:movieUUID as java.util.UUID) IS NULL) OR (m.movieUUID = :movieUUID))
              WHEN (m.status = 'IN_PROGRESS') THEN 1
              WHEN (m.status = 'FINISHED') THEN 2
              ELSE 3 END DESC
</code>```

How can I write right case when here?

Title: JPQL case when in order by

Body:
I have an enum value in my entity, and I need to save it like string, not ordinal

@Enumerated(EnumType.STRING)
private Status status;

Also I need to sort by this enum value by custom way, not alphabetical. I try to do like this

@Query("""
            SELECT m
            FROM Movie m
            WHERE ((CAST(:ticketUUID as java.util.UUID) IS NULL) OR (m.ticketUUID = :ticketUUID))
            AND ((CAST(:movieUUID as java.util.UUID) IS NULL) OR (m.movieUUID = :movieUUID))
            ORDER BY CASE
                         WHEN (m.status = 'IN_PROGRESS') THEN 1
                         WHEN (m.status = 'FINISHED') THEN 2
                         ELSE 3 END DESC
           """)

Page<Ticket> findAllByUUid(@Param("ticketUUID") UUID ticketUUID, @Param("movieUUID") UUID movieUUID, Pageable pageable);

And in this error in compile JPQL I dont see order clause

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: WHEN near line 4, column 15 [ select count(ts) FROM pack.domain.model.Movie m
 WHERE ((CAST(:ticketUUID as java.util.UUID) IS NULL) OR (m.ticketUUID = :ticketUUID))
 AND ((CAST(:movieUUID as java.util.UUID) IS NULL) OR (m.movieUUID = :movieUUID))
              WHEN (m.status = 'IN_PROGRESS') THEN 1
              WHEN (m.status = 'FINISHED') THEN 2
              ELSE 3 END DESC

How can I write right case when here?


问:
Download Authorised images link using Retrofit2 in android
I saw similar questions in StackOverflow but this is a little different. I want to download the Authorised image from the server, to download the image I want to use the Authorized token.

Retrofit

```<code>Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("https://example.com/api/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
</code>```

IService

```<code>@GET
Call<ResponseBody> getImage(@Url String url, @Header("Authorization") String token);
</code>```

Calling place

IService service= retrofit.create(IService.class);

```<code>Call<ResponseBody> call = service.getImage(url, "Bearer " + token);

call.enqueue(new Callback<ResponseBody>() {
    @Override
    public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
        Log.d(TAG, "onResponse: ");
    }

    @Override
    public void onFailure(Call<ResponseBody> call, Throwable t) {
        Log.d(TAG, "onFailure: ");
    }
});
</code>```

you can see the above code, How my usecase is different from other cases is, in the retrofit instance class, I provided the Baseurl, but in my case, there is no base URL only an image link is available

I used postman to send the request with the authorized token, and successfully downloaded the image, but here, there is no need for a base URL, if I keep the baseurl as empty, I'm getting an exception.

How to solve this issue, Thank you

Body:
I saw similar questions in StackOverflow but this is a little different. I want to download the Authorised image from the server, to download the image I want to use the Authorized token.

Retrofit

Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("https://example.com/api/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();

IService

@GET
Call<ResponseBody> getImage(@Url String url, @Header("Authorization") String token);

Calling place

IService service= retrofit.create(IService.class);

Call<ResponseBody> call = service.getImage(url, "Bearer " + token);

call.enqueue(new Callback<ResponseBody>() {
    @Override
    public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
        Log.d(TAG, "onResponse: ");
    }

    @Override
    public void onFailure(Call<ResponseBody> call, Throwable t) {
        Log.d(TAG, "onFailure: ");
    }
});

you can see the above code, How my usecase is different from other cases is, in the retrofit instance class, I provided the Baseurl, but in my case, there is no base URL only an image link is available

I used postman to send the request with the authorized token, and successfully downloaded the image, but here, there is no need for a base URL, if I keep the baseurl as empty, I'm getting an exception.

How to solve this issue, Thank you


问:
How to make a Windows authentication to join domains and workgroups
I'm working on a project, developed in ASP.NET Core 3.1 MVC for a company and I need to use a Windows authentication by request.

The client wants the application to enter without a login screen, but still keep the data on the user.

My team and I did that, but when it was put into practice it was observed that the application asked for a username and password for workgroups, unlike the computers that were in the company's domain, which are working perfectly.

Code in StartUp:

```<code>// https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio
services.AddAuthentication(IISDefaults.AuthenticationScheme);

// https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle
services.Configure<IISServerOptions>(options =>
         {
            options.AutomaticAuthentication = true;
            options.AuthenticationDisplayName = null;
            options.AllowSynchronousIO = false;
            options.MaxRequestBodySize = 30000000;
         });
</code>```

launchSettings.json:

```<code>{
    "iisSettings": {
        "windowsAuthentication": true,
        "anonymousAuthentication": true,
        "iisExpress": {
            "applicationUrl": "http://localhost:49316",
            "sslPort": 0
        }
    },
    "profiles": {
        "IIS Express": {
            "commandName": "IISExpress",
            "launchBrowser": true,
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },
        "PortalAidop": {
            "commandName": "IISExpress",
            "launchBrowser": true,
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "applicationUrl": "https://localhost:5003;http://localhost:5002"
        }
    }
}
</code>```

web.config:

```<code><system.web>
    <httpRuntime maxRequestLength="1048576" executionTimeout="300" />
    <authentication mode="Windows"/>
    <identity impersonate="false"/>
    <authorization>
        <allow roles="*" />
    </authorization>

    <roleManager defaultProvider="WindowsProvider" enabled="true"
                 cacheRolesInCookie="false">
        <providers>
            <add name="WindowsProvider"
                 type="System.Web.Security.WindowsTokenRoleProvider" />
        </providers>
    </roleManager>
</system.web>

<!--
<authentication>
    <anonymousAuthentication enabled="false" />
    <windowsAuthentication enabled="true" />
</authentication>
-->
</code>```

Some of the solutions we tested were to create accounts within the Domain but due to security risk this solution was denied. Edit: We try to use [AllowAnonymous] but it fails to get the value of User?.Identity?.Name which is important to do several checks on the site, I imagine that it does not try to get the user's machine name if allowed anonymous.

So I would like to know if anyone knows how to make Windows authentication work both in domains and in workgroups?

Body:
I'm working on a project, developed in ASP.NET Core 3.1 MVC for a company and I need to use a Windows authentication by request.

The client wants the application to enter without a login screen, but still keep the data on the user.

My team and I did that, but when it was put into practice it was observed that the application asked for a username and password for workgroups, unlike the computers that were in the company's domain, which are working perfectly.

Code in StartUp:

// https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio
services.AddAuthentication(IISDefaults.AuthenticationScheme);

// https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle
services.Configure<IISServerOptions>(options =>
         {
            options.AutomaticAuthentication = true;
            options.AuthenticationDisplayName = null;
            options.AllowSynchronousIO = false;
            options.MaxRequestBodySize = 30000000;
         });

launchSettings.json:

{
    "iisSettings": {
        "windowsAuthentication": true,
        "anonymousAuthentication": true,
        "iisExpress": {
            "applicationUrl": "http://localhost:49316",
            "sslPort": 0
        }
    },
    "profiles": {
        "IIS Express": {
            "commandName": "IISExpress",
            "launchBrowser": true,
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },
        "PortalAidop": {
            "commandName": "IISExpress",
            "launchBrowser": true,
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "applicationUrl": "https://localhost:5003;http://localhost:5002"
        }
    }
}

web.config:

<system.web>
    <httpRuntime maxRequestLength="1048576" executionTimeout="300" />
    <authentication mode="Windows"/>
    <identity impersonate="false"/>
    <authorization>
        <allow roles="*" />
    </authorization>

    <roleManager defaultProvider="WindowsProvider" enabled="true"
                 cacheRolesInCookie="false">
        <providers>
            <add name="WindowsProvider"
                 type="System.Web.Security.WindowsTokenRoleProvider" />
        </providers>
    </roleManager>
</system.web>

Some of the solutions we tested were to create accounts within the Domain but due to security risk this solution was denied. Edit: We try to use [AllowAnonymous] but it fails to get the value of User?.Identity?.Name which is important to do several checks on the site, I imagine that it does not try to get the user's machine name if allowed anonymous.

So I would like to know if anyone knows how to make Windows authentication work both in domains and in workgroups?