问:
logstash attempting to connect to elasticsearch instead of loki as output
my logstash is running on kubernetes, logstash attempting to connect to elasticsearch instead of loki as output even if i used

XPACK_MONITORING_ENABLED: false in the env.

```<code>logstash.yml: |
    http.host: "0.0.0.0"
    log.level: debug
    xpack.monitoring.enabled: false
    path.config: /usr/share/logstash/pipeline
  logstash.conf: |
     input {
        file{
          path => "/var/log/containers/*.log"
        }
      }
      filter {
         kubernetes {
          source => "path"
          target => "loki"
        }
      }

     output {
      stdout { codec => rubydebug}
      loki {
          url => "http://loki-loki-distributed-distributor.loki-benchmark.svc.cluster.local:3100/loki/api/v1/push"
        }
     }
</code>```

console output

```<code>[2022-12-13T06:31:40,411][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:31:50,775][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2022-12-13T06:32:10,414][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:32:20,910][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2022-12-13T06:32:40,412][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:32:50,998][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2022-12-13T06:33:10,410][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:33:21,328][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
</code>```

kubernetes config

```<code> image: "grafana/logstash-output-loki:1.0.1"
        imagePullPolicy: "IfNotPresent"
        command:
            - '/bin/sh'
            - '-c'
            - 'logstash-plugin install --no-verify logstash-filter-kubernetes && logstash -f /usr/share/logstash/pipeline/logstash.conf'
</code>```

Body:
my logstash is running on kubernetes, logstash attempting to connect to elasticsearch instead of loki as output even if i used

XPACK_MONITORING_ENABLED: false in the env.

logstash.yml: |
    http.host: "0.0.0.0"
    log.level: debug
    xpack.monitoring.enabled: false
    path.config: /usr/share/logstash/pipeline
  logstash.conf: |
     input {
        file{
          path => "/var/log/containers/*.log"
        }
      }
      filter {
         kubernetes {
          source => "path"
          target => "loki"
        }
      }

     output {
      stdout { codec => rubydebug}
      loki {
          url => "http://loki-loki-distributed-distributor.loki-benchmark.svc.cluster.local:3100/loki/api/v1/push"
        }
     }

console output

[2022-12-13T06:31:40,411][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:31:50,775][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2022-12-13T06:32:10,414][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:32:20,910][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2022-12-13T06:32:40,412][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:32:50,998][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2022-12-13T06:33:10,410][ERROR][logstash.licensechecker.licensereader] Unable to retrieve license information from license server {:message=>"No Available connections"}
[2022-12-13T06:33:21,328][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}

kubernetes config

 image: "grafana/logstash-output-loki:1.0.1"
        imagePullPolicy: "IfNotPresent"
        command:
            - '/bin/sh'
            - '-c'
            - 'logstash-plugin install --no-verify logstash-filter-kubernetes && logstash -f /usr/share/logstash/pipeline/logstash.conf'


来源: stackexchange

问:
How to merge / combine multiple PagingData<T> flows?
I have two flows in my ViewModel which are calling an API for the paging data.

private val pager1 =
    Pager(PagingConfig(pageSize = 5)) {
        pagingSourceFactory.create(repository::getLatest)
    }

private val pager2 =
    Pager(PagingConfig(pageSize = 5)) {
        pagingSourceFactory.create(repository::getSaved)
    }
```
<p>I want a third flow which returns me the combined values of both like below:</p>
<pre class="lang-kotlin prettyprint-override"><code>val posts: Flow<PagingData<Key>>
    get() =
        merge(
            pager1.flow.cachedIn(viewModelScope),
            pager2.flow.cachedIn(viewModelScope)
        )
</code>```

This calls the API perfectly (checked in logcat), but the data is only returned for the 2nd flow.

It doesn't return me the data for both the flows. How should I solve this issue?

ContentLicense: CC BY-SA 4.0

Body:
I have two flows in my ViewModel which are calling an API for the paging data.

private val pager1 =
    Pager(PagingConfig(pageSize = 5)) {
        pagingSourceFactory.create(repository::getLatest)
    }

private val pager2 =
    Pager(PagingConfig(pageSize = 5)) {
        pagingSourceFactory.create(repository::getSaved)
    }

I want a third flow which returns me the combined values of both like below:

val posts: Flow<PagingData<Key>>
    get() =
        merge(
            pager1.flow.cachedIn(viewModelScope),
            pager2.flow.cachedIn(viewModelScope)
        )

This calls the API perfectly (checked in logcat), but the data is only returned for the 2nd flow.

It doesn't return me the data for both the flows. How should I solve this issue?


问:
python for android - Django error when deployed on android device
I am currently using Python for android (p4a) to deploy static react files to a Django backend which spawns the server on the android gadget itself - and hosts the web app on a localhost webview.

This is my build.sh I am using to build the application:

```<code>export ANDROIDSDK="/Users/xxx/Library/Android/sdk"
export ANDROIDNDK="/Users/xxx/Library/Android/sdk/ndk/25.1.8937393"
export ANDROIDAPI="30"  # Target API version of your application
export NDKAPI="21"  # Minimum supported API version of your application

p4a apk --private . \
    --package=xyz.ann.test \
    --name "TestAppName" \
    --version 0.1 \
    --bootstrap=webview \
    --requirements=python3,hostpython3,django,asgiref,sqlparse,pytz \
    --permission INTERNET --permission WRITE_EXTERNAL_STORAGE \
    --port=8000 --icon icon.png \
    --arch=armeabi-v7a --arch=arm64-v8a \
</code>```

When I deploy the app on the phone, it currently crashes on start. On running adb logcat, here's the error I see:

```<code>12-13 01:27:57.851 19433 19511 I python  : django.core.exceptions.ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
12-13 01:27:57.851 19433 19511 I python  :     'mysql', 'oracle', 'postgresql'
12-13 01:27:57.851 19433 19511 I python  : Python for android ended.
</code>```

I have tried multiple solutions including downgrading Django, trying different python versions, etc. but have hit a roadblock.

Any help would be awesome!

Body:
I am currently using Python for android (p4a) to deploy static react files to a Django backend which spawns the server on the android gadget itself - and hosts the web app on a localhost webview.

This is my build.sh I am using to build the application:

export ANDROIDSDK="/Users/xxx/Library/Android/sdk"
export ANDROIDNDK="/Users/xxx/Library/Android/sdk/ndk/25.1.8937393"
export ANDROIDAPI="30"  # Target API version of your application
export NDKAPI="21"  # Minimum supported API version of your application

p4a apk --private . \
    --package=xyz.ann.test \
    --name "TestAppName" \
    --version 0.1 \
    --bootstrap=webview \
    --requirements=python3,hostpython3,django,asgiref,sqlparse,pytz \
    --permission INTERNET --permission WRITE_EXTERNAL_STORAGE \
    --port=8000 --icon icon.png \
    --arch=armeabi-v7a --arch=arm64-v8a \

When I deploy the app on the phone, it currently crashes on start. On running adb logcat, here's the error I see:

12-13 01:27:57.851 19433 19511 I python  : django.core.exceptions.ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
12-13 01:27:57.851 19433 19511 I python  :     'mysql', 'oracle', 'postgresql'
12-13 01:27:57.851 19433 19511 I python  : Python for android ended.

I have tried multiple solutions including downgrading Django, trying different python versions, etc. but have hit a roadblock.

Any help would be awesome!


问:
WIX RNN (Navigation) - Bottom tabs not showing for some Android devices
I've created an app in React native, which uses the Wix RNN lib.
I got the bottom tabs working great on iOS and whenever i test it on my real Android device and simulator.

However some users now report that the bottom tabs are not showing for them. What could cause this? I'm not able to reproduce the bug my users tell me about, hence why i'm trying SO.

My current setRoot() looks like this:

```<code>bottomTabs: {
            id: 'BOTTOM_TABS_LAYOUT',
            children: [
              {
                stack: {
                  id: 'HOME_TAB',
                  children: [
                    {
                      component: {
                        id: 'HOME_SCREEN',
                        name: 'HomeScreen'
                      }
                    }
                  ],
                  options: {
                    bottomTab: {
                        text: "Assets",
                        fontSize: 14,
                        fontWeight: '600',
                        icon: require('./Assets/images/tabs/wallet-solidx2.png'),
                        iconInsets: { top: 10 },
                        iconColor: '#646466', //7a7a7d 646466
                        selectedIconColor: '#8E8E91'
                    }
                  }
                }
              },
</code>```

Body:
I've created an app in React native, which uses the Wix RNN lib.
I got the bottom tabs working great on iOS and whenever i test it on my real Android device and simulator.

However some users now report that the bottom tabs are not showing for them. What could cause this? I'm not able to reproduce the bug my users tell me about, hence why i'm trying SO.

My current setRoot() looks like this:

bottomTabs: {
            id: 'BOTTOM_TABS_LAYOUT',
            children: [
              {
                stack: {
                  id: 'HOME_TAB',
                  children: [
                    {
                      component: {
                        id: 'HOME_SCREEN',
                        name: 'HomeScreen'
                      }
                    }
                  ],
                  options: {
                    bottomTab: {
                        text: "Assets",
                        fontSize: 14,
                        fontWeight: '600',
                        icon: require('./Assets/images/tabs/wallet-solidx2.png'),
                        iconInsets: { top: 10 },
                        iconColor: '#646466', //7a7a7d 646466
                        selectedIconColor: '#8E8E91'
                    }
                  }
                }
              },


问:
Count Number of Consecutive Occurrence of values in Table in sql server
I have a teable like

ID    Name

1   A

2   A

3   A

4   B

5   B

6   C

7   C

8   B

9   A

10  C

I want like this frequency count in increment

ID Name Frequency

1   A   1

2   A   2

3   A   3

4   B   1

5   B   2

6   C   1

7   C   2

8   B   3

9   A   4

10  C   3

I need ms sql query to calculate frequency column


问:
using const variable in array throws error in node js
```<code>const a = 'aaaa'
const b = 'bbbb'

[a, b].forEach(s => console.log(s))
</code>```

this throws cannot access to 'b' before initialization

I will appreciate help from community

I was expecting console log like 'aaaa' and 'bbbb'

Body:
const a = 'aaaa'
const b = 'bbbb'

[a, b].forEach(s => console.log(s))

this throws cannot access to 'b' before initialization

I will appreciate help from community

I was expecting console log like 'aaaa' and 'bbbb'


问:
sending email in django
I want to send details of the employee via email according to 'task_employee'

```<code>def meeting_detail_mail(get_task, get_meeting):
    for i in get_task:

        data = {
            "get_task": get_task,
            "title": get_meeting
        }
        html_content = render_to_string(
                'app/meeting_mail.html',
                data
                )
        text_content = strip_tags(html_content)
        email = EmailMultiAlternatives(
                'Minutes of Meeting',text_content, settings.EMAIL_HOST_USER, i['task_employee'].split(","))
        email.attach_alternative(html_content, 'text/html')
        email.send()
</code>```

tried the above code but it sends data to all the participants

```<code>[{'id': 17, 'task_title': 'working on cfo', 'task_employee': 'rajesh.gupta@atmstech.in', 'task_thread_id': 11, 'task_start_date': datetime.datetime(2022, 12, 12, 13, 38, 57, 165301, tzinfo=<UTC>), 'task_due_date': datetime.datetime(2022, 12, 12, 13, 38, tzinfo=<UTC>), 'task_status': 'Pending', 'task_attendance': False}, {'id': 18, 'task_title': 'lunch', 'task_employee': 'shubham.khaire@atmstech.in', 'task_thread_id': 11, 'task_start_date': datetime.datetime(2022, 12, 12, 13, 39, 9, 182983, tzinfo=<UTC>), 'task_due_date': datetime.datetime(2022, 12, 12, 13, 39, tzinfo=<UTC>), 'task_status': 'Pending', 'task_attendance': False}]
</code>```

In the for loop of i I'm getting the above output

Title: sending email in django

Body:
I want to send details of the employee via email according to 'task_employee'

def meeting_detail_mail(get_task, get_meeting):
    for i in get_task:

        data = {
            "get_task": get_task,
            "title": get_meeting
        }
        html_content = render_to_string(
                'app/meeting_mail.html',
                data
                )
        text_content = strip_tags(html_content)
        email = EmailMultiAlternatives(
                'Minutes of Meeting',text_content, settings.EMAIL_HOST_USER, i['task_employee'].split(","))
        email.attach_alternative(html_content, 'text/html')
        email.send()

tried the above code but it sends data to all the participants

[{'id': 17, 'task_title': 'working on cfo', 'task_employee': 'rajesh.gupta@atmstech.in', 'task_thread_id': 11, 'task_start_date': datetime.datetime(2022, 12, 12, 13, 38, 57, 165301, tzinfo=<UTC>), 'task_due_date': datetime.datetime(2022, 12, 12, 13, 38, tzinfo=<UTC>), 'task_status': 'Pending', 'task_attendance': False}, {'id': 18, 'task_title': 'lunch', 'task_employee': 'shubham.khaire@atmstech.in', 'task_thread_id': 11, 'task_start_date': datetime.datetime(2022, 12, 12, 13, 39, 9, 182983, tzinfo=<UTC>), 'task_due_date': datetime.datetime(2022, 12, 12, 13, 39, tzinfo=<UTC>), 'task_status': 'Pending', 'task_attendance': False}]

In the for loop of i I'm getting the above output


问:
Object of type 'System.EventArgs' cannot be converted to type 'Microsoft.AspNetCore.Components.Web.MouseEventArgs'
I added a MudMenu to my Component, when mouseover event or mouseleave event is fired, throws an error

my code is :

```<code><MudMenu FullWidth="true">
                    <ActivatorContent>
                        <MudAvatar Class="mr-2" Image="@photo"></MudAvatar>
                    </ActivatorContent>
                    <ChildContent>
                        <MudMenuItem Icon="@Icons.Material.Filled.Password" Href="ChangePassword">Change Password</MudMenuItem>
                    </ChildContent>
                </MudMenu>
</code>```

`

and the error message is :
`

```<code>System.ArgumentException: Object of type 'System.EventArgs' cannot be converted to type 'Microsoft.AspNetCore.Components.Web.MouseEventArgs'.
   at System.RuntimeType.CheckValue(Object& value, ParameterCopyBackAction& copyBack, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Span`1 copyOfParameters, IntPtr* byrefParameters, Span`1 shouldCopyBack, ReadOnlySpan`1 parameters, RuntimeType[] sigTypes, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[T](MulticastDelegate delegate, T arg)
   at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
</code>```

`
#mudblazor
#blazor-server

I tried to resolve it but there is no documentation for this on the mudblazor website

Body:
I added a MudMenu to my Component, when mouseover event or mouseleave event is fired, throws an error

my code is :

<MudMenu FullWidth="true">
                    <ActivatorContent>
                        <MudAvatar Class="mr-2" Image="@photo"></MudAvatar>
                    </ActivatorContent>
                    <ChildContent>
                        <MudMenuItem Icon="@Icons.Material.Filled.Password" Href="ChangePassword">Change Password</MudMenuItem>
                    </ChildContent>
                </MudMenu>

`

and the error message is :
`

System.ArgumentException: Object of type 'System.EventArgs' cannot be converted to type 'Microsoft.AspNetCore.Components.Web.MouseEventArgs'.
   at System.RuntimeType.CheckValue(Object& value, ParameterCopyBackAction& copyBack, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Span`1 copyOfParameters, IntPtr* byrefParameters, Span`1 shouldCopyBack, ReadOnlySpan`1 parameters, RuntimeType[] sigTypes, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[T](MulticastDelegate delegate, T arg)
   at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)

`
#mudblazor
#blazor-server

I tried to resolve it but there is no documentation for this on the mudblazor website


问:
How to create file with upload with the help of Tus-Extension header
I wanted to make a request using curl POST, that should create file in my site.

```<code>curl -ks -u admin:admin -XPOST https://host.docker.internal:9200/....
-H "Tus-Resumable: 1.0.0"
-H "Upload-Length: 100"
-H "Content-Type: application/offset+octet-stream"
-H "Upload-Metadata: filename dGVzdC50eHQ="
-H "Tus-Extension: creation-with-upload"
-d "upload content"
</code>```

Documentation of tus says -H "Tus-Extension: creation-with-upload"  should create file in site but create file is not visible in my site.

Response

```<code>upload completely sent off: 14 out of 14 bytes
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [130 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< Access-Control-Allow-Headers: Tus-Resumable, Upload-Length, Upload-Metadata, If-Match
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: Tus-Resumable, Location
< Content-Length: 0
< Content-Security-Policy: default-src 'none';
< Date: Tue, 13 Dec 2022 06:18:26 GMT
< Location: https://host.docker/data/{randompattern}
< Tus-Extension: creation,creation-with-upload,checksum,expiration
< Tus-Resumable: 1.0.0
< Upload-Expires: 1670998706
< Upload-Offset: 14
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Robots-Tag: none
< X-Xss-Protection: 1; mode=block

</code>```

Currently, no file is created on my site even response is 201 CreatedI expect to create file in my site which i can access through UI?

Body:
I wanted to make a request using curl POST, that should create file in my site.

curl -ks -u admin:admin -XPOST https://host.docker.internal:9200/....
-H "Tus-Resumable: 1.0.0"
-H "Upload-Length: 100"
-H "Content-Type: application/offset+octet-stream"
-H "Upload-Metadata: filename dGVzdC50eHQ="
-H "Tus-Extension: creation-with-upload"
-d "upload content"

Documentation of tus says -H "Tus-Extension: creation-with-upload"  should create file in site but create file is not visible in my site.

Response

upload completely sent off: 14 out of 14 bytes
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [130 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< Access-Control-Allow-Headers: Tus-Resumable, Upload-Length, Upload-Metadata, If-Match
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: Tus-Resumable, Location
< Content-Length: 0
< Content-Security-Policy: default-src 'none';
< Date: Tue, 13 Dec 2022 06:18:26 GMT
< Location: https://host.docker/data/{randompattern}
< Tus-Extension: creation,creation-with-upload,checksum,expiration
< Tus-Resumable: 1.0.0
< Upload-Expires: 1670998706
< Upload-Offset: 14
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Robots-Tag: none
< X-Xss-Protection: 1; mode=block

Currently, no file is created on my site even response is 201 CreatedI expect to create file in my site which i can access through UI?


问:
How to lock post_delete method of Child model when delete Parent model using CASCADE in django?
models.py

```<code>class Parent(models.Model):
    name = models.CharField(max_length=50)
</code>```
```<code>class Child(models.Model):
    parent = models.ForeignKey(Parent, on_delete=models.CASCADE)
    name = models.CharField(max_length=50)
</code>```

signals.py

```<code>@receiver(signals.post_delete, sender=Parent)
def delete_parent(sender, instance, **kwargs):
    # something
</code>```
```<code>@receiver(signals.post_delete, sender=Child)
def delete_child(sender, instance, **kwargs):
    # something
</code>```

When delete_parent() signal works, delete_child() signal should not work. How to do this?

I tried this,

```<code>@receiver(signals.post_delete, sender=Child)
def delete_child(sender, instance, **kwargs):
    try:
        parent = instance.parent
        # something
    except:
        return
</code>```

But don't work.

Body:
models.py

class Parent(models.Model):
    name = models.CharField(max_length=50)

class Child(models.Model):
    parent = models.ForeignKey(Parent, on_delete=models.CASCADE)
    name = models.CharField(max_length=50)

signals.py

@receiver(signals.post_delete, sender=Parent)
def delete_parent(sender, instance, **kwargs):
    # something

@receiver(signals.post_delete, sender=Child)
def delete_child(sender, instance, **kwargs):
    # something

When delete_parent() signal works, delete_child() signal should not work. How to do this?

I tried this,

@receiver(signals.post_delete, sender=Child)
def delete_child(sender, instance, **kwargs):
    try:
        parent = instance.parent
        # something
    except:
        return

But don't work.


问:
React native pdf to image
So, I want to convert pdf pages into images in react native without compromising quality is there any best solution other than react-native-pdf-thumbnail.</p>

Title: React native pdf to image


问:
Workstation hosted vscode extension not processing message from remote hosted extension
QV https://github.com/microsoft/vscode-remote-release/issues/7736

I have two extensions. One of them is of uiKind workspace and may run locally or remotely depending on the workspace, and the other is of uiKind ui and always runs locally.

The ui extension is responsible for spawning a browser on the user's workstation to load a URI provided by the argument of a command print.launchBrowser that it registers using vscode.commands.registerCommand

The workspace extension uses vscode.commands.executeCommand to invoke print.launchBrowser.

The point of this arrangement is to allow the browser to be launched on the workstation irrespective of whether the extension host is local or remote.

This should work. The following documentation explicitly says it works: https://code.visualstudio.com/api/advanced-topics/remote-extensions#communicating-between-extensions-using-commands

However, when I test it works only when both extensions run on the workstation.

Before anyone tells me to use vscode.env.openExternal(Uri) I am aware of this and am using it to launch the default browser, but this is no use for launching a non-default browser. Many of my users exploit the support for an alternate browser to use Chrome for printing while using a less invasive alternative as their daily drive.

What could cause this to fail? Here's the abovementioned documentation:

Some extensions return APIs as a part of their activation that are intended for use by other extensions (via vscode.extension.getExtension(extensionName).exports). While these will work if all extensions involved are on the same side (either all UI Extensions or all Workspace Extensions), these will not work between UI and Workspace Extensions.

Fortunately, VS Code automatically routes any executed commands to the correct extension regardless of its location. You can freely invoke any command (including those provided by other extensions) without worrying about impacts.

That's not ambiguous.

Since the code for the browser agent is very short I present it in its entirety.

```<code>import * as vscode from 'vscode';
import * as child_process from "child_process";

export function activate(context: vscode.ExtensionContext) {
    context.subscriptions.push(vscode.commands.registerCommand("print.launchBrowser", url => {
        const browserPath = vscode.workspace.getConfiguration("print").browserPath;
        child_process.exec(`${escapePath(browserPath)} ${url}`, (error: child_process.ExecException | null, stdout: string, stderr: string) => {
            if (error || stderr) {
                const err = error ? error.message : stderr;
                if (!err.startsWith("[")) {
                    vscode.window.showErrorMessage(err);
                }
            }
        });
    }));
}

function escapePath(path: string) {
    switch (process.platform) {
        case "win32":
            return path.includes('"') || !path.includes(" ") ? path : `"${path}"`;
        default:
            return path.replace(/ /g, "\\ ");
    }
}
</code>```

Code to call it is straightforward. Any extension containing the following should open a browser window and load the bing.com default page, although if you want to use the agent above you'll need to either supply the print.browserPath setting with a value containing the workstation path to a browser or put in such a path as a literal for testing purposes.

There aren't any tests for things like whether browserPath has a value that resolves to a file. That's all in the calling extension, which is designed to use the agent only when it runs in a remote workspace. The agent is essentially nothing but a platform independent remote procedure call.

```<code>vscode.commands.executeCommand("print.launchBrowser", "https://bing.com");
</code>```

All this has been tested and failed on two separate computers and also with VS Code Insiders 1.75.0, which also resolves the question of whether I have a borked VS Code installation.

Body:
QV https://github.com/microsoft/vscode-remote-release/issues/7736

I have two extensions. One of them is of uiKind workspace and may run locally or remotely depending on the workspace, and the other is of uiKind ui and always runs locally.

The ui extension is responsible for spawning a browser on the user's workstation to load a URI provided by the argument of a command print.launchBrowser that it registers using vscode.commands.registerCommand

The workspace extension uses vscode.commands.executeCommand to invoke print.launchBrowser.

The point of this arrangement is to allow the browser to be launched on the workstation irrespective of whether the extension host is local or remote.

This should work. The following documentation explicitly says it works: https://code.visualstudio.com/api/advanced-topics/remote-extensions#communicating-between-extensions-using-commands

However, when I test it works only when both extensions run on the workstation.

Before anyone tells me to use vscode.env.openExternal(Uri) I am aware of this and am using it to launch the default browser, but this is no use for launching a non-default browser. Many of my users exploit the support for an alternate browser to use Chrome for printing while using a less invasive alternative as their daily drive.

What could cause this to fail? Here's the abovementioned documentation:

Some extensions return APIs as a part of their activation that are intended for use by other extensions (via vscode.extension.getExtension(extensionName).exports). While these will work if all extensions involved are on the same side (either all UI Extensions or all Workspace Extensions), these will not work between UI and Workspace Extensions.

Fortunately, VS Code automatically routes any executed commands to the correct extension regardless of its location. You can freely invoke any command (including those provided by other extensions) without worrying about impacts.

That's not ambiguous.

Since the code for the browser agent is very short I present it in its entirety.

import * as vscode from 'vscode';
import * as child_process from "child_process";

export function activate(context: vscode.ExtensionContext) {
    context.subscriptions.push(vscode.commands.registerCommand("print.launchBrowser", url => {
        const browserPath = vscode.workspace.getConfiguration("print").browserPath;
        child_process.exec(`${escapePath(browserPath)} ${url}`, (error: child_process.ExecException | null, stdout: string, stderr: string) => {
            if (error || stderr) {
                const err = error ? error.message : stderr;
                if (!err.startsWith("[")) {
                    vscode.window.showErrorMessage(err);
                }
            }
        });
    }));
}

function escapePath(path: string) {
    switch (process.platform) {
        case "win32":
            return path.includes('"') || !path.includes(" ") ? path : `"${path}"`;
        default:
            return path.replace(/ /g, "\\ ");
    }
}

Code to call it is straightforward. Any extension containing the following should open a browser window and load the bing.com default page, although if you want to use the agent above you'll need to either supply the print.browserPath setting with a value containing the workstation path to a browser or put in such a path as a literal for testing purposes.

There aren't any tests for things like whether browserPath has a value that resolves to a file. That's all in the calling extension, which is designed to use the agent only when it runs in a remote workspace. The agent is essentially nothing but a platform independent remote procedure call.

vscode.commands.executeCommand("print.launchBrowser", "https://bing.com");

All this has been tested and failed on two separate computers and also with VS Code Insiders 1.75.0, which also resolves the question of whether I have a borked VS Code installation.


问:
Spring WebClient: netrc file content when making http request
Small question regarding Spring Webflux WebClient please.

I have a netrc file at ~/.netrc
The content is something like:

```<code>machine example.com
login abc
password qwerty
</code>```

I use this netrc file in my curl command:

curl --netrc --insecure http://example.com:9876/API/abc

And I am getting the correct response, very happy.

I just need to migrate this curl command into Spring Webflux WebClient.

Therefore, I went to write this, here is what I tried:

```<code>final var webClient     = WebClient.create().mutate().defaultHeader("machine","example.com", "login", "abc", "password", "qwerty").clientConnector(new ReactorClientHttpConnector(HttpClient.create())).build();

final var response = webClient.post().uri("http://example.com:9876/API/abc").retrieve().bodyToMono(String.class).block();
</code>```

Please note I put the content of the netrc file onto the WebClient header.

Unfortunately, I am getting 401 unauthorized.

The content of the netrc file, which I pasted onto the header, is for sure correct.

Therefore, I am having a hard time understanding why is it failing.

What did I do wrong please?

Thank you

Body:
Small question regarding Spring Webflux WebClient please.

I have a netrc file at ~/.netrc
The content is something like:

machine example.com
login abc
password qwerty

I use this netrc file in my curl command:

curl --netrc --insecure http://example.com:9876/API/abc

And I am getting the correct response, very happy.

I just need to migrate this curl command into Spring Webflux WebClient.

Therefore, I went to write this, here is what I tried:

final var webClient     = WebClient.create().mutate().defaultHeader("machine","example.com", "login", "abc", "password", "qwerty").clientConnector(new ReactorClientHttpConnector(HttpClient.create())).build();

final var response = webClient.post().uri("http://example.com:9876/API/abc").retrieve().bodyToMono(String.class).block();

Please note I put the content of the netrc file onto the WebClient header.

Unfortunately, I am getting 401 unauthorized.

The content of the netrc file, which I pasted onto the header, is for sure correct.

Therefore, I am having a hard time understanding why is it failing.

What did I do wrong please?

Thank you


问:
ls command - on progressive chunks in linux - large directory
I have problem of listing files from really big directory.

ls -l *.pdf command is taking lot of time and for every disconnection its starting from first.

i have tried few things

```<code>ls -l /**/*.pdf
</code>```

and

```<code>find ./*.pdf -type d -maxdepth 1 -printf '%f\n' >> files.txt
</code>```

and

```<code>glob.glob(f"{dir}/**/*.pdf", recursive=True)
</code>```

these are taking hours without any acknowledgement of progress.

is there any way to list the files in progressive manner from chunks of directory and to resume from the place its completed in a single directory. So it would be helpful to resume from there even in disconnections than to start from first.

I spent time exploring many blogs, but it didn't help.

displit - may have chance
https://unix.stackexchange.com/a/247353/314903

any small suggestions or leads would highly appreciated.

Body:
I have problem of listing files from really big directory.

ls -l *.pdf command is taking lot of time and for every disconnection its starting from first.

i have tried few things

ls -l /**/*.pdf

and

find ./*.pdf -type d -maxdepth 1 -printf '%f\n' >> files.txt

and

glob.glob(f"{dir}/**/*.pdf", recursive=True)

these are taking hours without any acknowledgement of progress.

is there any way to list the files in progressive manner from chunks of directory and to resume from the place its completed in a single directory. So it would be helpful to resume from there even in disconnections than to start from first.

I spent time exploring many blogs, but it didn't help.

displit - may have chance
https://unix.stackexchange.com/a/247353/314903

any small suggestions or leads would highly appreciated.


问:
Dynamically change the value of greater validation in JOI
I have a default validation schema. but in certain conditions somewhere in let say functions, I need to change the value of "greater" to some certain values. Here is my sample default schema:

```<code>const test= {
  obj: Joi.object().keys({
    amount: Joi.number().integer().required().greater(0),
  }),
};
</code>```

Then I have a certain conditioning in other functions that let say if my condition is true, I will change the value of greater to something else from 0 to let say 1.

example, if 1 === 1 then lets change the greater value to 1

is this possible ?

Body:
I have a default validation schema. but in certain conditions somewhere in let say functions, I need to change the value of "greater" to some certain values. Here is my sample default schema:

const test= {
  obj: Joi.object().keys({
    amount: Joi.number().integer().required().greater(0),
  }),
};

Then I have a certain conditioning in other functions that let say if my condition is true, I will change the value of greater to something else from 0 to let say 1.

example, if 1 === 1 then lets change the greater value to 1

is this possible ?


问:
how to list all youtube videos using google youtube v3 api?
I am trying to write a node.js script to retrieve all youtube videos uploaded on a user's channel. Such as getting the video id, title, description, thumbnail, etc...

I know this would be alot of requests, so if I hit my request limit per minute for example, I'm fine with just setting it to wait/sleep for now perhaps.

So far the script I have will work, and launch, and accept a token to begin the request, but the videos.list line always fails with this error: videos.list err =  GaxiosError: No filter selected. Expected one of: id, myRating, chart

As if it wants an id (of a video/playlist?) when i am trying to just retrieve every video uploaded by a user.

full file script.js

```<code>console.log('1')
const readlineSync = require('readline-sync');
console.log('2')
const {google} = require('googleapis');
console.log('3')

//make google cloud project
//add desktop token for client id
//add youtube v3 api to project library
//create api key, add to project
var YOUTUBE_API_KEY = ''
var YOUR_CLIENT_ID = `

const youtube = google.youtube({
  version: 'v3',
  auth: YOUTUBE_API_KEY
});

// Prompt the user to sign in to Google and get an access token
console.log('Please go to the following URL to sign in to Google:');
console.log(`https://accounts.google.com/o/oauth2/auth?client_id=${YOUR_CLIENT_ID}&response_type=code&scope=https://www.googleapis.com/auth/youtube.readonly&redirect_uri=http://localhost:3000/oauth2callback`);
const accessToken = readlineSync.question('Enter the access token: ');

// Use the access token to make a request to the YouTube API
youtube.videos.list({
  part: 'id,snippet',
  mine: true
}, (err, res) => {
  if (err) {
    console.error('videos.list err = ', err);
    return;
  }
  console.log('got correctly ')

  // Print the IDs and thumbnails of the videos in the user's channel
  for (const video of res.data.items) {
    console.log(`Video ID: ${video.id}`);
    console.log(`Video thumbnail: ${video.snippet.thumbnails.default.url}`);
  }
});
</code>```

Body:
I am trying to write a node.js script to retrieve all youtube videos uploaded on a user's channel. Such as getting the video id, title, description, thumbnail, etc...

I know this would be alot of requests, so if I hit my request limit per minute for example, I'm fine with just setting it to wait/sleep for now perhaps.

So far the script I have will work, and launch, and accept a token to begin the request, but the videos.list line always fails with this error: videos.list err =  GaxiosError: No filter selected. Expected one of: id, myRating, chart

As if it wants an id (of a video/playlist?) when i am trying to just retrieve every video uploaded by a user.

full file script.js

console.log('1')
const readlineSync = require('readline-sync');
console.log('2')
const {google} = require('googleapis');
console.log('3')

//make google cloud project
//add desktop token for client id
//add youtube v3 api to project library
//create api key, add to project
var YOUTUBE_API_KEY = ''
var YOUR_CLIENT_ID = `

const youtube = google.youtube({
  version: 'v3',
  auth: YOUTUBE_API_KEY
});

// Prompt the user to sign in to Google and get an access token
console.log('Please go to the following URL to sign in to Google:');
console.log(`https://accounts.google.com/o/oauth2/auth?client_id=${YOUR_CLIENT_ID}&response_type=code&scope=https://www.googleapis.com/auth/youtube.readonly&redirect_uri=http://localhost:3000/oauth2callback`);
const accessToken = readlineSync.question('Enter the access token: ');

// Use the access token to make a request to the YouTube API
youtube.videos.list({
  part: 'id,snippet',
  mine: true
}, (err, res) => {
  if (err) {
    console.error('videos.list err = ', err);
    return;
  }
  console.log('got correctly ')

  // Print the IDs and thumbnails of the videos in the user's channel
  for (const video of res.data.items) {
    console.log(`Video ID: ${video.id}`);
    console.log(`Video thumbnail: ${video.snippet.thumbnails.default.url}`);
  }
});


问:
Take pictures from fragmento Android
I'm trying to take a picture from a Fragment but Activityresultlauncher won't fire, it works in Activity but I'm using Viewpager/Tablayout.

When I debugged only fire when I cancel the camera.

Please someone can Help me.

Here's my code.

```<code>public class FragmentUsuario extends Fragment {
    FragmentUsuarioBinding dtb;

    ActivityResultLauncher<Intent> launcherVoltAct = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
        if (result.getResultCode() == Activity.RESULT_OK) {

            int rotation = MisFunciones.getImageOrientation(mFotoFile.getAbsolutePath());
            File newImage = MisFunciones.reSaveBitmap(MisFunciones.ruta_fotos + File.separator, MisFunciones.getCode() + ".JPG", rotation, mFotoFile);

          }
    });

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        dtb = FragmentUsuarioBinding.inflate(inflater, container, false);
        return dtb.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        dtb.fotoVoltAct.setOnClickListener(v -> takeFoto());

}

    private void takeFoto() {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        cameraIntent.setPackage("net.sourceforge.opencamera");

        if (cameraIntent.resolveActivity(requireActivity().getPackageManager()) != null) {
            mFotoFile = MisFunciones.crearImageFile();

            Uri uri = FileProvider.getUriForFile(requireContext(), requireActivity().getPackageName() + ".provider", mFotoFile);

            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);

            launcherVoltAct.launch(cameraIntent);
        }
    }
}
</code>```

Title: Take pictures from fragmento Android

Body:
I'm trying to take a picture from a Fragment but Activityresultlauncher won't fire, it works in Activity but I'm using Viewpager/Tablayout.

When I debugged only fire when I cancel the camera.

Please someone can Help me.

Here's my code.

public class FragmentUsuario extends Fragment {
    FragmentUsuarioBinding dtb;

    ActivityResultLauncher<Intent> launcherVoltAct = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
        if (result.getResultCode() == Activity.RESULT_OK) {

            int rotation = MisFunciones.getImageOrientation(mFotoFile.getAbsolutePath());
            File newImage = MisFunciones.reSaveBitmap(MisFunciones.ruta_fotos + File.separator, MisFunciones.getCode() + ".JPG", rotation, mFotoFile);

          }
    });

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        dtb = FragmentUsuarioBinding.inflate(inflater, container, false);
        return dtb.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        dtb.fotoVoltAct.setOnClickListener(v -> takeFoto());

}

    private void takeFoto() {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        cameraIntent.setPackage("net.sourceforge.opencamera");

        if (cameraIntent.resolveActivity(requireActivity().getPackageManager()) != null) {
            mFotoFile = MisFunciones.crearImageFile();

            Uri uri = FileProvider.getUriForFile(requireContext(), requireActivity().getPackageName() + ".provider", mFotoFile);

            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);

            launcherVoltAct.launch(cameraIntent);
        }
    }
}


问:
error: concurrency is only available in iOS 15.0.0 or newer
I am getting this error after adding firebase_storage in my flutter application.

Reproduced output

```<code>Swift Compiler Error (Xcode): 'resume(with:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:578:23

Swift Compiler Error (Xcode): 'withCheckedThrowingContinuation(function:_:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:612:23

Swift Compiler Error (Xcode): 'resume(with:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:614:23

Swift Compiler Error (Xcode): 'resume()' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:648:25

Swift Compiler Error (Xcode): 'withCheckedThrowingContinuation(function:_:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:643:23

Uncategorized (Xcode): Command CompileC failed with a nonzero exit code

Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited
</code>```

Body:
I am getting this error after adding firebase_storage in my flutter application.

Reproduced output

Swift Compiler Error (Xcode): 'resume(with:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:578:23

Swift Compiler Error (Xcode): 'withCheckedThrowingContinuation(function:_:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:612:23

Swift Compiler Error (Xcode): 'resume(with:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:614:23

Swift Compiler Error (Xcode): 'resume()' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:648:25

Swift Compiler Error (Xcode): 'withCheckedThrowingContinuation(function:_:)' is only available in iOS 15.0 or newer
/Users/macbookpro/Library/Developer/Xcode/DerivedData/Runner-gtfthnpegbpfxycmzhwiohkbdzgd/SourcePackages/checkouts/firebase-ios-sdk/FirebaseStorage/Sources/StorageReference.swift:643:23

Uncategorized (Xcode): Command CompileC failed with a nonzero exit code

Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited


问:
How to delete item from isarLink?
i want to delete all the items in isarLinks and then add new ones .

the add process is working but the delete it not
i tried .clear() and then save the collection again  but it doesn't work

Title: How to delete item from isarLink?


问:
WPF Error CS0120 - Where to put the required object reference
i have tried to solve this problem on my own, but i cant find a way to do it. I am researching for about 2 hours now and cant find a proper solving thats why i am asking you.

My problem is i get the error message CS0120 (an object reference is required for the non-static field, method, or property) in the following code at:

```<code>Excel.Fill(Lieferantennr);
</code>```

.

```<code>private void txt_Lieferantennummer_TextChanged(object sender, TextChangedEventArgs e)
        {
            Excel.OpenFile();
            string Lieferantennr = txt_Lieferantennummer.Text;
            Excel.Fill(Lieferantennr);
        }
</code>```

The code behind those two methods is:

```<code>public static void OpenFile()
    {
        Excel excel = new Excel(@"X:\Testblatt.xlsx",1);
        for (int i = 1; i < excel.RowCount; i++)
        {
            for (int j = 1; j < excel.ColumnCount; j++)
            {

                TestblattList.Add(new Testblatt { Lieferantennummer = excel.ReadCell(i, 0), Name = excel.ReadCell(i, 1) });

            }
        }
        excel.wb.Close();
    }

    public object Fill(string Lieferantennr)
    {
        var query = TestblattList.Where(x => x.Lieferantennummer == Lieferantennr);
        return query;

    }
</code>```

I just dont know where to put the required object refernce in.

If you need more of the code let me know.

Thanks in advance.

Body:
i have tried to solve this problem on my own, but i cant find a way to do it. I am researching for about 2 hours now and cant find a proper solving thats why i am asking you.

My problem is i get the error message CS0120 (an object reference is required for the non-static field, method, or property) in the following code at:

Excel.Fill(Lieferantennr);

.

private void txt_Lieferantennummer_TextChanged(object sender, TextChangedEventArgs e)
        {
            Excel.OpenFile();
            string Lieferantennr = txt_Lieferantennummer.Text;
            Excel.Fill(Lieferantennr);
        }

The code behind those two methods is:

public static void OpenFile()
    {
        Excel excel = new Excel(@"X:\Testblatt.xlsx",1);
        for (int i = 1; i < excel.RowCount; i++)
        {
            for (int j = 1; j < excel.ColumnCount; j++)
            {

                TestblattList.Add(new Testblatt { Lieferantennummer = excel.ReadCell(i, 0), Name = excel.ReadCell(i, 1) });

            }
        }
        excel.wb.Close();
    }

    public object Fill(string Lieferantennr)
    {
        var query = TestblattList.Where(x => x.Lieferantennummer == Lieferantennr);
        return query;

    }

I just dont know where to put the required object refernce in.

If you need more of the code let me know.

Thanks in advance.


问:
Why does sizeLimit not working in AEM while dragging file from asset?
I'm trying to implement sizeLimit in cq:dialog of component. But sizeLimit is working only while I upload a file. It's not working while I drag a file from asset. Can I apply sizeLimit while dragging file from asset?</p>
```<code><file
                        jcr:primaryType="nt:unstructured"
                        sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
                        sizeLimit="100"
                        autoStart="{Boolean}false"
                        class="cq-droptarget"
                        fileNameParameter="./fileName"
                        fileReferenceParameter="./fileReference"
                        mimeTypes="[image/gif,image/jpeg,image/png,image/webp,image/tiff,image/svg+xml]"
                        multiple="{Boolean}false"
                        name="./file"
                        title="Upload Image Asset"
                        uploadUrl="${suffix.path}"
                        useHTML5="{Boolean}true"/>
</code>```

Body:
I'm trying to implement sizeLimit in cq:dialog of component. But sizeLimit is working only while I upload a file. It's not working while I drag a file from asset. Can I apply sizeLimit while dragging file from asset?

<file
                        jcr:primaryType="nt:unstructured"
                        sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
                        sizeLimit="100"
                        autoStart="{Boolean}false"
                        class="cq-droptarget"
                        fileNameParameter="./fileName"
                        fileReferenceParameter="./fileReference"
                        mimeTypes="[image/gif,image/jpeg,image/png,image/webp,image/tiff,image/svg+xml]"
                        multiple="{Boolean}false"
                        name="./file"
                        title="Upload Image Asset"
                        uploadUrl="${suffix.path}"
                        useHTML5="{Boolean}true"/>


问:
Unable to deploy streamlit : NameError: name 'GridOptionsBuilder' is not defined
I am trying to deploy my streamlit .
I have included the requirements.txt file which includes steamlit-aggrid
as attached here.

error log : error log


问:
Why just looping the last input?
so I wanna make a program to find each sum of the columns of a matrix. In this code first you can input how many matrix you want and the second input is the size of matrix (n x n) and third input is the value of matrix.

The output must be each sum of the columns of matrix

here is the code

```<code>#include <stdio.h>

int main ()
{
    int x, y, z;
    int inp1, inp2;
    int matrix[100][100];
    int matrix2;

    scanf("%d", &inp1);

    for(z = 0; z < inp1; z++){
        scanf("%d", &inp2);
        for(x = 0; x < inp2; x++){
            for(y = 0; y < inp2; y++){
                scanf("%d", &matrix[x][y]);
            }
        }
    }

    for(z = 0; z < inp1; z++){
        printf("Case #%d:", z+1);
        for(x = 0; x < inp2; x++){
            matrix2 = 0;
            for(y = 0; y < inp2; y++){
                matrix2 += matrix[y][x];
                if(y == inp2-1){
                    printf(" %d", matrix2);
                }
            }
        }
        printf("\n");
    }

    return 0;
}
</code>```

here's the input and ouput for that code

```<code>2 //first input (how many matrix)
2 //second input (size of matrix)
1 2 //third input (matrix)
1 2
3
1 1 1
2 2 2
3 4 5
Case #1: 6 7 8
Case #2: 6 7 8
</code>```

for the second output is correct but the first output is wrong.
output for the second one from 1+2+3 = 6, 1+2+4 = 7, 1+2+5 = 8

What I want is the output for the first case is 2 and 4

Title: Why just looping the last input?

Body:
so I wanna make a program to find each sum of the columns of a matrix. In this code first you can input how many matrix you want and the second input is the size of matrix (n x n) and third input is the value of matrix.

The output must be each sum of the columns of matrix

here is the code

#include <stdio.h>

int main ()
{
    int x, y, z;
    int inp1, inp2;
    int matrix[100][100];
    int matrix2;

    scanf("%d", &inp1);

    for(z = 0; z < inp1; z++){
        scanf("%d", &inp2);
        for(x = 0; x < inp2; x++){
            for(y = 0; y < inp2; y++){
                scanf("%d", &matrix[x][y]);
            }
        }
    }

    for(z = 0; z < inp1; z++){
        printf("Case #%d:", z+1);
        for(x = 0; x < inp2; x++){
            matrix2 = 0;
            for(y = 0; y < inp2; y++){
                matrix2 += matrix[y][x];
                if(y == inp2-1){
                    printf(" %d", matrix2);
                }
            }
        }
        printf("\n");
    }

    return 0;
}

here's the input and ouput for that code

2 //first input (how many matrix)
2 //second input (size of matrix)
1 2 //third input (matrix)
1 2
3
1 1 1
2 2 2
3 4 5
Case #1: 6 7 8
Case #2: 6 7 8

for the second output is correct but the first output is wrong.
output for the second one from 1+2+3 = 6, 1+2+4 = 7, 1+2+5 = 8

What I want is the output for the first case is 2 and 4


问:
test qrcode payment using vnpay sandbox
I dont know how to test QR-code payment using VNpay.

I 've read Vnpay docs but not for qr-code. https://sandbox.vnpayment.vn/apis/downloads/ (Vietnamese language only). Its ok with ATM card.

Title: test qrcode payment using vnpay sandbox


问:
HelloWorld WebAssembly compile in shared folder VirtualBox
I'm trying to compile hello world program using emcc tool in the shared folder between host and VM VirtualBox target. When I'm using shared folder in target os I've got the error if I use not shared folder all is fine. Who can tell me why?

Program code:

```<code>#include <stdio.h>

int main() {
    printf("hello, world!\n");
    return 0;
}
</code>```

Command to compile:

```<code>$ emcc ../main.c
</code>```

emcc version:

```<code>$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.28 (f11d6196dd4e8748a726f19895c859b40ff6a4f3)
clang version 16.0.0 (https://github.com/llvm/llvm-project ea4be70cea8509520db8638bb17bcd7b5d8d60ac)
Target: wasm32-unknown-emscripten
Thread model: posix
</code>```

Python version:

```<code>$ python --version
Python 3.8.10
</code>```

Files that are generated:

```<code>-rwxrwx--- 1 root systemd-coredump 13835 dec 13 08:44 a.out.wasm*
-rwxrwx--- 1 root systemd-coredump 13835 dec 13 08:44 a.out.wasm.tmp31770cd*
</code>```

The error I've got:

```<code>Traceback (most recent call last):
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 4309, in <module>
    sys.exit(main(sys.argv))
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 4302, in main
    ret = run(args)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 1319, in run
    phase_post_link(options, state, wasm_target, wasm_target, target)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 3022, in phase_post_link
    phase_emscript(options, in_wasm, wasm_target, memfile)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 3052, in phase_emscript
    emscripten.run(in_wasm, wasm_target, final_js, memfile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 893, in run
    emscript(in_wasm, out_wasm, outfile_js, memfile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 318, in emscript
    metadata = finalize_wasm(in_wasm, out_wasm, memfile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 525, in finalize_wasm
    metadata = get_metadata(infile, outfile, modify_wasm, args)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 451, in get_metadata
    metadata = extract_metadata.extract_metadata(infile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/tools/extract_metadata.py", line 303, in extract_metadata
    with webassembly.Module(filename) as module:
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/tools/webassembly.py", line 192, in __init__
    raise InvalidWasmError(f'{filename} is not a valid wasm file')
tools.webassembly.InvalidWasmError: a.out.wasm is not a valid wasm file
Exception ignored in: <function Module.__del__ at 0x7f45e8756dc0>
Traceback (most recent call last):
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/tools/webassembly.py", line 196, in __del__
    assert not self.buf, '`__exit__` should have already been called, please use context manager'
AssertionError: `__exit__` should have already been called, please use context manager
</code>```

Body:
I'm trying to compile hello world program using emcc tool in the shared folder between host and VM VirtualBox target. When I'm using shared folder in target os I've got the error if I use not shared folder all is fine. Who can tell me why?

Program code:

#include <stdio.h>

int main() {
    printf("hello, world!\n");
    return 0;
}

Command to compile:

$ emcc ../main.c

emcc version:

$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.28 (f11d6196dd4e8748a726f19895c859b40ff6a4f3)
clang version 16.0.0 (https://github.com/llvm/llvm-project ea4be70cea8509520db8638bb17bcd7b5d8d60ac)
Target: wasm32-unknown-emscripten
Thread model: posix

Python version:

$ python --version
Python 3.8.10

Files that are generated:

-rwxrwx--- 1 root systemd-coredump 13835 dec 13 08:44 a.out.wasm*
-rwxrwx--- 1 root systemd-coredump 13835 dec 13 08:44 a.out.wasm.tmp31770cd*

The error I've got:

Traceback (most recent call last):
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 4309, in <module>
    sys.exit(main(sys.argv))
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 4302, in main
    ret = run(args)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 1319, in run
    phase_post_link(options, state, wasm_target, wasm_target, target)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 3022, in phase_post_link
    phase_emscript(options, in_wasm, wasm_target, memfile)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emcc.py", line 3052, in phase_emscript
    emscripten.run(in_wasm, wasm_target, final_js, memfile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 893, in run
    emscript(in_wasm, out_wasm, outfile_js, memfile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 318, in emscript
    metadata = finalize_wasm(in_wasm, out_wasm, memfile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 525, in finalize_wasm
    metadata = get_metadata(infile, outfile, modify_wasm, args)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/emscripten.py", line 451, in get_metadata
    metadata = extract_metadata.extract_metadata(infile)
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/tools/extract_metadata.py", line 303, in extract_metadata
    with webassembly.Module(filename) as module:
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/tools/webassembly.py", line 192, in __init__
    raise InvalidWasmError(f'{filename} is not a valid wasm file')
tools.webassembly.InvalidWasmError: a.out.wasm is not a valid wasm file
Exception ignored in: <function Module.__del__ at 0x7f45e8756dc0>
Traceback (most recent call last):
  File "/home/alex/hdd/repo/emsdk/upstream/emscripten/tools/webassembly.py", line 196, in __del__
    assert not self.buf, '`__exit__` should have already been called, please use context manager'
AssertionError: `__exit__` should have already been called, please use context manager


问:
403, The caller does not have permission, when try to get a test token
I try use get a test token following this instruction https://developers.google.com/identity/protocols/risc#java_3, and I get `

```<code> "code": 403,
        "message": "The caller does not have permission",
        "status": "PERMISSION_DENIED"
</code>```

`

When I register my endpoint, it return 200, so the register is success. I enable risc api for my project, and grant admin role. Is there any other things should I try?

Body:
I try use get a test token following this instruction https://developers.google.com/identity/protocols/risc#java_3, and I get `

 "code": 403,
        "message": "The caller does not have permission",
        "status": "PERMISSION_DENIED"

`

When I register my endpoint, it return 200, so the register is success. I enable risc api for my project, and grant admin role. Is there any other things should I try?


问:
How to plot the frequency chart and world cloud from the frequency list created in Pandas
I have data frame of n-grams frequency which is created by below code. How can create frequency plot and word cloud from the below output.

Code

```<code>from sklearn.feature_extraction.text import CountVectorizer
word_vectorizer = CountVectorizer(ngram_range=(3,3), analyzer='word')
sparse_matrix = word_vectorizer.fit_transform(dfs[dfs.columns[2]])
frequencies = sum(sparse_matrix).toarray()[0]
df =pd.DataFrame(frequencies, index=word_vectorizer.get_feature_names(), columns=['frequency'])
</code>```

Output

```<code>                        frequency
abbott issues deliver     10
abiding govt india        15
ability adapt totally      4
ability case emergencies  35
ability even client       11
ability get things         6
ability grow kn 1         18
</code>```

Body:
I have data frame of n-grams frequency which is created by below code. How can create frequency plot and word cloud from the below output.

Code

from sklearn.feature_extraction.text import CountVectorizer
word_vectorizer = CountVectorizer(ngram_range=(3,3), analyzer='word')
sparse_matrix = word_vectorizer.fit_transform(dfs[dfs.columns[2]])
frequencies = sum(sparse_matrix).toarray()[0]
df =pd.DataFrame(frequencies, index=word_vectorizer.get_feature_names(), columns=['frequency'])

Output

                        frequency
abbott issues deliver     10
abiding govt india        15
ability adapt totally      4
ability case emergencies  35
ability even client       11
ability get things         6
ability grow kn 1         18


问:
how to increase loading percentage in SVG?
I am very new to SVG, I have a SVG already in my theme, it looks like something this.

The SVG Html looks like this

<svg id="SvgjsSvg1099" width="40" height="41" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev" class="apexcharts-svg" xmlns:data="ApexChartsNS" transform="translate(0, 0)" style="background: transparent;">
    <g id="SvgjsG1101" class="apexcharts-inner apexcharts-graphical" transform="translate(0, 0)">
      <defs id="SvgjsDefs1100">
        <clipPath id="gridRectMask1q6mbbep">
          <rect id="SvgjsRect1103" width="46" height="42" x="-3" y="-1" rx="0" ry="0" opacity="1" stroke-width="0" stroke="none" stroke-dasharray="0" fill="#fff"></rect>
        </clipPath>
        <clipPath id="forecastMask1q6mbbep"></clipPath>
        <clipPath id="nonForecastMask1q6mbbep"></clipPath>
        <clipPath id="gridRectMarkerMask1q6mbbep">
          <rect id="SvgjsRect1104" width="44" height="44" x="-2" y="-2" rx="0" ry="0" opacity="1" stroke-width="0" stroke="none" stroke-dasharray="0" fill="#fff"></rect>
        </clipPath>
      </defs>
      <g id="SvgjsG1105" class="apexcharts-radialbar">
        <g id="SvgjsG1106">
          <g id="SvgjsG1107" class="apexcharts-tracks">
            <g id="SvgjsG1108" class="apexcharts-radialbar-track apexcharts-track" rel="1">
              <path id="apexcharts-radialbarTrack-0" d="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 19.99723301461454 4.1463417048796565" fill="none" fill-opacity="1" stroke="rgba(242,242,242,0.85)" stroke-opacity="1" stroke-linecap="butt" stroke-width="2.3658536585365857" stroke-dasharray="0" class="apexcharts-radialbar-area" data:pathOrig="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 19.99723301461454 4.1463417048796565"></path>
            </g>
          </g>
          <g id="SvgjsG1110">
            <g id="SvgjsG1112" class="apexcharts-series apexcharts-radial-series" seriesName="series-1" rel="1" data:realIndex="0">
              <path id="SvgjsPath1113" d="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 14.061114982430661 34.699256230936875" fill="none" fill-opacity="0.85" stroke="rgba(47,179,68,0.85)" stroke-opacity="1" stroke-linecap="butt" stroke-width="2.439024390243903" stroke-dasharray="0" class="apexcharts-radialbar-area apexcharts-radialbar-slice-0" data:angle="202" data:value="56" index="0" j="0" data:pathOrig="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 14.061114982430661 34.699256230936875"></path>
            </g>
            <circle id="SvgjsCircle1111" r="14.670731707317076" cx="20" cy="20" class="apexcharts-radialbar-hollow" fill="transparent"></circle>
          </g>
        </g>
      </g>
      <line id="SvgjsLine1114" x1="0" y1="0" x2="40" y2="0" stroke="#b6b6b6" stroke-dasharray="0" stroke-width="1" stroke-linecap="butt" class="apexcharts-ycrosshairs"></line>
      <line id="SvgjsLine1115" x1="0" y1="0" x2="40" y2="0" stroke-dasharray="0" stroke-width="0" stroke-linecap="butt" class="apexcharts-ycrosshairs-hidden"></line>
    </g>
    <g id="SvgjsG1102" class="apexcharts-annotations"></g>
  </svg>

```

I played around <cicle> tag but I failed to increase the percentage. Currently you can see the loading icon is around 50% I want to make it dynamic.

Can anyone help me out?

Body:
I am very new to SVG, I have a SVG already in my theme, it looks like something this.

The SVG Html looks like this

<svg id="SvgjsSvg1099" width="40" height="41" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev" class="apexcharts-svg" xmlns:data="ApexChartsNS" transform="translate(0, 0)" style="background: transparent;">
    <g id="SvgjsG1101" class="apexcharts-inner apexcharts-graphical" transform="translate(0, 0)">
      <defs id="SvgjsDefs1100">
        <clipPath id="gridRectMask1q6mbbep">
          <rect id="SvgjsRect1103" width="46" height="42" x="-3" y="-1" rx="0" ry="0" opacity="1" stroke-width="0" stroke="none" stroke-dasharray="0" fill="#fff"></rect>
        </clipPath>
        <clipPath id="forecastMask1q6mbbep"></clipPath>
        <clipPath id="nonForecastMask1q6mbbep"></clipPath>
        <clipPath id="gridRectMarkerMask1q6mbbep">
          <rect id="SvgjsRect1104" width="44" height="44" x="-2" y="-2" rx="0" ry="0" opacity="1" stroke-width="0" stroke="none" stroke-dasharray="0" fill="#fff"></rect>
        </clipPath>
      </defs>
      <g id="SvgjsG1105" class="apexcharts-radialbar">
        <g id="SvgjsG1106">
          <g id="SvgjsG1107" class="apexcharts-tracks">
            <g id="SvgjsG1108" class="apexcharts-radialbar-track apexcharts-track" rel="1">
              <path id="apexcharts-radialbarTrack-0" d="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 19.99723301461454 4.1463417048796565" fill="none" fill-opacity="1" stroke="rgba(242,242,242,0.85)" stroke-opacity="1" stroke-linecap="butt" stroke-width="2.3658536585365857" stroke-dasharray="0" class="apexcharts-radialbar-area" data:pathOrig="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 19.99723301461454 4.1463417048796565"></path>
            </g>
          </g>
          <g id="SvgjsG1110">
            <g id="SvgjsG1112" class="apexcharts-series apexcharts-radial-series" seriesName="series-1" rel="1" data:realIndex="0">
              <path id="SvgjsPath1113" d="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 14.061114982430661 34.699256230936875" fill="none" fill-opacity="0.85" stroke="rgba(47,179,68,0.85)" stroke-opacity="1" stroke-linecap="butt" stroke-width="2.439024390243903" stroke-dasharray="0" class="apexcharts-radialbar-area apexcharts-radialbar-slice-0" data:angle="202" data:value="56" index="0" j="0" data:pathOrig="M 20 4.146341463414631 A 15.85365853658537 15.85365853658537 0 1 1 14.061114982430661 34.699256230936875"></path>
            </g>
            <circle id="SvgjsCircle1111" r="14.670731707317076" cx="20" cy="20" class="apexcharts-radialbar-hollow" fill="transparent"></circle>
          </g>
        </g>
      </g>
      <line id="SvgjsLine1114" x1="0" y1="0" x2="40" y2="0" stroke="#b6b6b6" stroke-dasharray="0" stroke-width="1" stroke-linecap="butt" class="apexcharts-ycrosshairs"></line>
      <line id="SvgjsLine1115" x1="0" y1="0" x2="40" y2="0" stroke-dasharray="0" stroke-width="0" stroke-linecap="butt" class="apexcharts-ycrosshairs-hidden"></line>
    </g>
    <g id="SvgjsG1102" class="apexcharts-annotations"></g>
  </svg>

I played around <cicle> tag but I failed to increase the percentage. Currently you can see the loading icon is around 50% I want to make it dynamic.

Can anyone help me out?


问:
How do you provide a terminal in a VSCode web extension?
As far as I can tell, it's supposed to be supported:

If an extension wants to provide a debugger or terminal that also work in the web extension host, a browser entry point needs to be defined.
https://code.visualstudio.com/api/extension-guides/web-extensions#web-extension-enablement

But I have the following code and I get a Not supported error message when I try to run it.

{
  "browser": "./dist/web/extension.js",
  "activationEvents": [
    "onTerminalProfile:my-ext.terminal-profile"
  ],
  "contributes": {
    "terminal": {
      "profiles": [
        {
          "title": "My Terminal",
          "id": "my-ext.terminal-profile"
        }
      ]
    },
  }
}
```
<pre class="lang-js prettyprint-override"><code>context.subscriptions.push(vscode.window.registerTerminalProfileProvider('my-ext.terminal-profile', {
        provideTerminalProfile(token: vscode.CancellationToken): vscode.ProviderResult<vscode.TerminalProfile> {
        return {
            options: {
                name: 'My Terminal',
                shellPath: 'cmd.exe'
            }
        };
    }
}));
</code>```

I get that web extensions are supposed to be a bit more limited and that I probably need to provide a different shellPath, but it clearly states that providing a terminal in a web extension is supposed to be supported (somehow), but I can't find anyone that's done it. What am I missing? And what shell should be used? My custom terminal is for a gamification project and it doesn't matter if the terminal has access to the system, it'd be fine or even preferable with just some manner of Javascript console, I'll just be using the terminal as another way for the user to interact with the gamified aspects of VSCode.

Body:
As far as I can tell, it's supposed to be supported:

If an extension wants to provide a debugger or terminal that also work in the web extension host, a browser entry point needs to be defined.
https://code.visualstudio.com/api/extension-guides/web-extensions#web-extension-enablement

But I have the following code and I get a Not supported error message when I try to run it.

{
  "browser": "./dist/web/extension.js",
  "activationEvents": [
    "onTerminalProfile:my-ext.terminal-profile"
  ],
  "contributes": {
    "terminal": {
      "profiles": [
        {
          "title": "My Terminal",
          "id": "my-ext.terminal-profile"
        }
      ]
    },
  }
}

context.subscriptions.push(vscode.window.registerTerminalProfileProvider('my-ext.terminal-profile', {
        provideTerminalProfile(token: vscode.CancellationToken): vscode.ProviderResult<vscode.TerminalProfile> {
        return {
            options: {
                name: 'My Terminal',
                shellPath: 'cmd.exe'
            }
        };
    }
}));

I get that web extensions are supposed to be a bit more limited and that I probably need to provide a different shellPath, but it clearly states that providing a terminal in a web extension is supposed to be supported (somehow), but I can't find anyone that's done it. What am I missing? And what shell should be used? My custom terminal is for a gamification project and it doesn't matter if the terminal has access to the system, it'd be fine or even preferable with just some manner of Javascript console, I'll just be using the terminal as another way for the user to interact with the gamified aspects of VSCode.


问:
Values of pie chart overlaps
I want to see the values clearly, how can I fix that? How can I locate my values manually?
(values of gray and black colors (0.4) overlaps)

```<code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df=pd.DataFrame({'Fiziki Durum':[173,76,1,1]},index=['Bina İçerisinde','Müstakil','Gezici','Prefabrik'])

labels='Bina İçerisinde','Müstakil','Gezici','Prefabrik'
colors=('#3a88e2','#5c9e1e','#708090','#0e1111')

fig1, ax=plt.subplots()

sizes=[173,76,1,1]
explode = (0.05,0.05,0.05,0.05)

patches, texts, autotexts = ax.pie(sizes, colors=colors, startangle=90,explode=explode,  autopct='%1.1f%%' )

plt.legend(patches, labels, loc='upper center', bbox_to_anchor=(0.5, 0.08), ncol=4, frameon=False)

#draw circle
centre_circle = plt.Circle((0,0),0.70,fc='white')
fig = plt.gcf()
fig.gca().add_artist(centre_circle)

ax.axis('equal')
plt.tight_layout()
plt.show()
</code>```

Title: Values of pie chart overlaps

Body:
I want to see the values clearly, how can I fix that? How can I locate my values manually?
(values of gray and black colors (0.4) overlaps)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df=pd.DataFrame({'Fiziki Durum':[173,76,1,1]},index=['Bina İçerisinde','Müstakil','Gezici','Prefabrik'])

labels='Bina İçerisinde','Müstakil','Gezici','Prefabrik'
colors=('#3a88e2','#5c9e1e','#708090','#0e1111')

fig1, ax=plt.subplots()

sizes=[173,76,1,1]
explode = (0.05,0.05,0.05,0.05)

patches, texts, autotexts = ax.pie(sizes, colors=colors, startangle=90,explode=explode,  autopct='%1.1f%%' )

plt.legend(patches, labels, loc='upper center', bbox_to_anchor=(0.5, 0.08), ncol=4, frameon=False)

#draw circle
centre_circle = plt.Circle((0,0),0.70,fc='white')
fig = plt.gcf()
fig.gca().add_artist(centre_circle)

ax.axis('equal')
plt.tight_layout()
plt.show()


问:
there are curl fetch code 13000 records. while data will insert via wp_post_insert() function but it failed
there are we are fetching data via this api url https://ewsalvage.relationhq.com/jsonfeed4.php it has almost 13000 records. I am using curl for fetching all records whick works perfectly.
but after fetching when i start function wp_insert_post() then it failed to insert products. There are only one record i can see 7-8 times.

```<code>$curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://ewsalvage.relationhq.com/jsonfeed4.php',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'GET',
      CURLOPT_HTTPHEADER => array(
        'Cookie: PHPSESSID=cb345fca1c06be070e6c278c03616b30'
      ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);

    $json = json_decode($response, true);
    $data = $json['items'];

    foreach ($data as $x=>$val ) {
        $itemid = $data[$x]['itemid'];
        $title = $data[$x]['title'];
        $price = $data[$x]['price'];
        $category = $data[$x]['category'];
        $categoryname = $data[$x]['categoryname'];
        $topcategory = $data[$x]['topcategory'];

        $topcategoryname = $data[$x]['topcategoryname'];
        $image = $data[$x]['image'];
        $thumbimage = $data[$x]['thumbimage'];
        $description = $data[$x]['description'];
        $age = $data[$x]['age'];
        $storename = $data[$x]['storename'];
        $location = $data[$x]['location'];
        $quantity = $data[$x]['quantity'];

        $units = $data[$x]['units'];
        $tags = $data[$x]['tags'];
        $extraimages = $data[$x]['extraimages'];
        $extrathumbimages = $data[$x]['extrathumbimages'];

        // Create post object
        // Insert the post into the database
        $post_id = wp_insert_post(array(
          'post_title'    => wp_strip_all_tags( $title ),
          'post_content'  => wp_strip_all_tags( $description ),
          'post_status'   => 'publish',
          'post_author'   => 1,
          'post_category' => array( $category ),
          'post_type' => 'product',
        ));
</code>```

via wp_insert_post() function only one record inseted 7-8 times after it nothing inserted in database. Please suggest me what to do insert 13000 product in woocommerce by given data. Thanks for helping.

Body:
there are we are fetching data via this api url https://ewsalvage.relationhq.com/jsonfeed4.php it has almost 13000 records. I am using curl for fetching all records whick works perfectly.
but after fetching when i start function wp_insert_post() then it failed to insert products. There are only one record i can see 7-8 times.

$curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://ewsalvage.relationhq.com/jsonfeed4.php',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'GET',
      CURLOPT_HTTPHEADER => array(
        'Cookie: PHPSESSID=cb345fca1c06be070e6c278c03616b30'
      ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);

    $json = json_decode($response, true);
    $data = $json['items'];

    foreach ($data as $x=>$val ) {
        $itemid = $data[$x]['itemid'];
        $title = $data[$x]['title'];
        $price = $data[$x]['price'];
        $category = $data[$x]['category'];
        $categoryname = $data[$x]['categoryname'];
        $topcategory = $data[$x]['topcategory'];

        $topcategoryname = $data[$x]['topcategoryname'];
        $image = $data[$x]['image'];
        $thumbimage = $data[$x]['thumbimage'];
        $description = $data[$x]['description'];
        $age = $data[$x]['age'];
        $storename = $data[$x]['storename'];
        $location = $data[$x]['location'];
        $quantity = $data[$x]['quantity'];

        $units = $data[$x]['units'];
        $tags = $data[$x]['tags'];
        $extraimages = $data[$x]['extraimages'];
        $extrathumbimages = $data[$x]['extrathumbimages'];

        // Create post object
        // Insert the post into the database
        $post_id = wp_insert_post(array(
          'post_title'    => wp_strip_all_tags( $title ),
          'post_content'  => wp_strip_all_tags( $description ),
          'post_status'   => 'publish',
          'post_author'   => 1,
          'post_category' => array( $category ),
          'post_type' => 'product',
        ));

via wp_insert_post() function only one record inseted 7-8 times after it nothing inserted in database. Please suggest me what to do insert 13000 product in woocommerce by given data. Thanks for helping.


问:
Socket.io : receive a socket on client side emit from node controller
I got a problem I cant figure out the solution. I got a node/express(server)/React(client) app. I'm trying to emit a socket from a controller and get it back on client side. If I put all the logic on the index.js file of my server it works fine but nothing happen I move the emit in a controller. Here is my code :

index.js (server)

```<code>//All the code before (express, routes etc.)

server = https.createServer(options, app)

const io = require('socket.io')(server, {
    transports:['polling'],
    cors: {
        origin: "https://localhost:3000",
        credentials: true
    }
});

app.use(function(req, res, next) {
    req.io = io;
    next();
  });
  io.on('connection', function(socket) {
    //log.info('socket.io connection made');
    console.log('socket.io connection made');
  });

  // TEST
app.use('/test', require('./routes/controller'));

</code>```

controller.js

```<code>const Test = (req, res) => {
let Socket = (req.io)
console.log('socket call')
  Socket.emit('news', { hello: 'world' });
}
</code>```

And finally my file on client side file.js"

```<code>import React, { useState, useEffect } from 'react';
import socketIOClient from "socket.io-client";
import Axios from 'axios'

const ENDPOINT = "https://localhost:3001";
//I also try my controller url and doesn't work either

function Test() {

  const [response, setResponse] = useState("");

  useEffect(() => {

        const socket = socketIOClient(ENDPOINT);
        console.log(socket)
        socket.on("news", data => {
          setResponse(data);
        });

        return () => socket.disconnect();

  }, []);

  return (
    <>
      <p> Hello {response} </p>
    </>
  )

}

export default Test

</code>```

I know I'm not too far from truth but can't find what I missed.

Thanks

Body:
I got a problem I cant figure out the solution. I got a node/express(server)/React(client) app. I'm trying to emit a socket from a controller and get it back on client side. If I put all the logic on the index.js file of my server it works fine but nothing happen I move the emit in a controller. Here is my code :

index.js (server)

//All the code before (express, routes etc.)

server = https.createServer(options, app)

const io = require('socket.io')(server, {
    transports:['polling'],
    cors: {
        origin: "https://localhost:3000",
        credentials: true
    }
});

app.use(function(req, res, next) {
    req.io = io;
    next();
  });
  io.on('connection', function(socket) {
    //log.info('socket.io connection made');
    console.log('socket.io connection made');
  });

  // TEST
app.use('/test', require('./routes/controller'));

controller.js

const Test = (req, res) => {
let Socket = (req.io)
console.log('socket call')
  Socket.emit('news', { hello: 'world' });
}

And finally my file on client side file.js"

import React, { useState, useEffect } from 'react';
import socketIOClient from "socket.io-client";
import Axios from 'axios'

const ENDPOINT = "https://localhost:3001";
//I also try my controller url and doesn't work either

function Test() {

  const [response, setResponse] = useState("");

  useEffect(() => {

        const socket = socketIOClient(ENDPOINT);
        console.log(socket)
        socket.on("news", data => {
          setResponse(data);
        });

        return () => socket.disconnect();

  }, []);

  return (
    <>

 Hello {response}

    </>
  )

}

export default Test

I know I'm not too far from truth but can't find what I missed.

Thanks


问:
Angular - Can Leaflet measurement tool mute a layer's interactivity?
I'm using Leaflet.Measure for measuring areas and distances and I also have several layers on a map. When you click on a layer, the onclick function is being fired and a popup appears. When I start to measure a new area and click on a map layer, the popup appears again and I cannot measure area further. Is there any possibility to mute layer's interactivity, while I'm using measurement tool?

I tired to import my Angular service class into a measuring plugin to change layer's onclick behaviour, but it didn't work.
Here's a part of Leaflet.Measure plugin code, which I have modified:

```<code>import { MapService} from './app/services/map.service';

L.MeasureAction = L.Handler.extend({

 _onMouseClick: function (event) {
            MapService.enablePopupOpen = false; // if it's set to false, then popup won't open

            //default plugin code
            var latlng = event.latlng || this._map.mouseEventToLatLng(event);
            if (this._lastPoint && latlng.equals(this._lastPoint)) {
                return;
            }
            if (this._trail.points.length > 0) {
                var points = this._trail.points;
                points.push(latlng);
                var length = points.length;
                this._totalDistance += this._getDistance(points[length - 2], points[length - 1]);
                this._addMeasurePoint(latlng);
                //this._addMarker(latlng);
                if (this.options.model !== "area") {
                    this._addLable(latlng, this._getDistanceString(this._totalDistance), "leaflet-measure-lable");
                }
            } else {
                this._totalDistance = 0;
                this._addMeasurePoint(latlng);
                this._addMarker(latlng);
                if (this.options.model !== "area") {
                    this._addLable(latlng, L.Measure.start, "leaflet-measure-lable");
                }
                this._trail.points.push(latlng);
            }
            this._lastPoint = latlng;
            this._startMove = false;
        },

...
})

</code>```

Body:
I'm using Leaflet.Measure for measuring areas and distances and I also have several layers on a map. When you click on a layer, the onclick function is being fired and a popup appears. When I start to measure a new area and click on a map layer, the popup appears again and I cannot measure area further. Is there any possibility to mute layer's interactivity, while I'm using measurement tool?

I tired to import my Angular service class into a measuring plugin to change layer's onclick behaviour, but it didn't work.
Here's a part of Leaflet.Measure plugin code, which I have modified:

import { MapService} from './app/services/map.service';

L.MeasureAction = L.Handler.extend({

 _onMouseClick: function (event) {
            MapService.enablePopupOpen = false; // if it's set to false, then popup won't open

            //default plugin code
            var latlng = event.latlng || this._map.mouseEventToLatLng(event);
            if (this._lastPoint && latlng.equals(this._lastPoint)) {
                return;
            }
            if (this._trail.points.length > 0) {
                var points = this._trail.points;
                points.push(latlng);
                var length = points.length;
                this._totalDistance += this._getDistance(points[length - 2], points[length - 1]);
                this._addMeasurePoint(latlng);
                //this._addMarker(latlng);
                if (this.options.model !== "area") {
                    this._addLable(latlng, this._getDistanceString(this._totalDistance), "leaflet-measure-lable");
                }
            } else {
                this._totalDistance = 0;
                this._addMeasurePoint(latlng);
                this._addMarker(latlng);
                if (this.options.model !== "area") {
                    this._addLable(latlng, L.Measure.start, "leaflet-measure-lable");
                }
                this._trail.points.push(latlng);
            }
            this._lastPoint = latlng;
            this._startMove = false;
        },

...
})


问:
Extract the MSI from exe and cancel the auto start window
I managed to extract the MSI from the .exe using the below command. but after the extraction I am getting another popup window to start the installation. may I know how to cancel this window in automated fashion. currently I am automating the installation via PowerShell

Start-process -FilePath $path -Argumentlist "/s /extract_all:dirpath" -Wait


问:
KSQL Exception: Failed to deserialize buffer
got the below error when sent ksql script to ksqlDB server using rest api in powershell</p>
```<code>Script operation failed
 Error - The remote server returned an error: (500) Internal Server Error.
 Reason - {"@type":"generic_error","error_code":50000,"message":"Failed to deserialize buffer"}
At powershell\Deployment.ps1:187 char:13
+   $result = RunKSQLScript -ksqlScript $ksqlHashTable[$_] -commandSequ ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,RunKSQLScript
</code>```

Body:
got the below error when sent ksql script to ksqlDB server using rest api in powershell

Script operation failed
 Error - The remote server returned an error: (500) Internal Server Error.
 Reason - {"@type":"generic_error","error_code":50000,"message":"Failed to deserialize buffer"}
At powershell\Deployment.ps1:187 char:13
+   $result = RunKSQLScript -ksqlScript $ksqlHashTable[$_] -commandSequ ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,RunKSQLScript


问:
SSRS Report the text close to the line when export PDF
Is there a way to solve the text do not close to the line. thanks


问:
Turbo frame appends response to html tag instead of using target
After successful submit it should reload the page (_top) instead it appends the pages index to the html tag.

application.js

```<code>import "@hotwired/turbo-rails"
</code>```

application.html.erb

```<code><a data-turbo-frame="modal" href="/page/new">New Page</a>
<%= turbo_frame_tag :modal %>
</code>```

pages/new.slim

```<code>= turbo_frame_tag :modal do
  = simple_form_for :page, url: pages_path, data: { turbo_frame: '_top' } do |f|
    = f.input :title
    = f.button :submit
</code>```

pages_controller.rb

```<code>def create
  ...
  redirect_to pages_path
  ...
end
</code>```

Body:
After successful submit it should reload the page (_top) instead it appends the pages index to the html tag.

application.js

import "@hotwired/turbo-rails"

application.html.erb

New Page
<%= turbo_frame_tag :modal %>

pages/new.slim

= turbo_frame_tag :modal do
  = simple_form_for :page, url: pages_path, data: { turbo_frame: '_top' } do |f|
    = f.input :title
    = f.button :submit

pages_controller.rb

def create
  ...
  redirect_to pages_path
  ...
end


问:
Cannot render canvasjs chart after applying spinner on chart placeholder
I have an id in an html page in which I am rendering the canvasjs chart. I also have a dropdown menu, which on changing, re-renders the canvasjs chart. I also have put a bootstrap spinner on the same id where chart will be rendered to inform user that chart will be rendered soon. Below is the code:

```<code> $("#dropapp").change(async function(){
                    $("#donutchart").html(`<div class="spinner-border text-primary" role="status">

</div>`)

                   //Calling API here
                   // Rerendering chart here, takes a couple of seconds
                      console.log("Hello");
                    chart.render();

                  })
                });
</code>```

The problem is that on changing dropdown item, the spinner keeps loading indefinitely and the chart never appears. On removing the spinner, I found that everything is working fine and chart is successfully re-rendered. So it is evident that problem appears only when I put the spinner.

I am unable to figure out the reason for this issue. Please help me to find the cause for this.

Thank You!!

Body:
I have an id in an html page in which I am rendering the canvasjs chart. I also have a dropdown menu, which on changing, re-renders the canvasjs chart. I also have put a bootstrap spinner on the same id where chart will be rendered to inform user that chart will be rendered soon. Below is the code:

 $("#dropapp").change(async function(){
                    $("#donutchart").html(`

`)

                   //Calling API here
                   // Rerendering chart here, takes a couple of seconds
                      console.log("Hello");
                    chart.render();

                  })
                });

The problem is that on changing dropdown item, the spinner keeps loading indefinitely and the chart never appears. On removing the spinner, I found that everything is working fine and chart is successfully re-rendered. So it is evident that problem appears only when I put the spinner.

I am unable to figure out the reason for this issue. Please help me to find the cause for this.

Thank You!!