问:
Google Tasks as separate window chromium app
I like to keep Google Tasks open, but it is only offered in the sidebar of heavy website like Gmail, Google Calendar, etc.

Going through the (relatively light) HTML of Google Calendar, gave me this URL, which redirects to a valid standalone Google Tasks: https://tasks.google.com/embed/?origin=https%3A%2F%2Fmail.google.com&hai=3&hc=4%2C1%2C5%2C9&hl=en&forcehl=1&usegapi=1&id=I0_[...]1&_gfid=I0_1659641321701&parent=https%3A%2F%2Fmail.google.com&pfname=&amp[......]m%3D__features__

However, I cannot turn this into a "separate window" app, because it needs the original URL, not the one it redirects to.

Is there a way to manually set the URL of chrome apps?

Screenshot:


来源: stackexchange

问:
When I host the code navigation bar is not showing properly, but when I run it in pycharm it works fine. Is anyone know what is the problem?
this is when I run this code at pycharm

this is when I host the code

ContentLicense: CC BY-SA 4.0


问:
How use files.get in remote helm charts?
I use helm charts from my Nexus. I need include some file to configmap. On a local charts it's working when I include file to helm's dir, but it's not working when I use remote charts. How can I fix it?

my configmap.yaml looks like that now:

```<code>{{ if $.Values.ConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "obj.fullname" . }}
data:
{{- range $.Values.ConfigMap }}
  {{ .fileName }}: |-
{{ $.Files.Get .fileName | indent 4 -}}
{{ end }}
{{ end }}
---
</code>```

I'll need include different files like yaml, json, certifcates and keys, and sometimes some bynaries

Body:
I use helm charts from my Nexus. I need include some file to configmap. On a local charts it's working when I include file to helm's dir, but it's not working when I use remote charts. How can I fix it?

my configmap.yaml looks like that now:

{{ if $.Values.ConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "obj.fullname" . }}
data:
{{- range $.Values.ConfigMap }}
  {{ .fileName }}: |-
{{ $.Files.Get .fileName | indent 4 -}}
{{ end }}
{{ end }}
---

I'll need include different files like yaml, json, certifcates and keys, and sometimes some bynaries


问:
Simulink and Matlab
I just wanted to plot BER curve of FSK modulation using monte carlo(bertool)--theoretical curve against the exact one but i'm getting the following problem:

I was expecting that there would be no errorit shows that index exceeds the  number of array elements. Index of array must not exceed 1

Title: Simulink and Matlab


问:
Poetry: Disabling SSL certification check
I'm trying to disable SSL certification check for self-signed certificate using example mentioned in : https://python-poetry.org/docs/repositories/#certificates

```<code>poetry config certificates.foo.cert false
</code>```

My repository is "private-pypi", so I am using poetry config certificates.private-pypi.cert false

But it seems that the value is getting "false" assigned as a string instead of boolean.

See the difference between the first and the second config, where the second config does not have " in the value.

How do I set it as such is should be assigned as boolean instead?

Body:
I'm trying to disable SSL certification check for self-signed certificate using example mentioned in : https://python-poetry.org/docs/repositories/#certificates

poetry config certificates.foo.cert false

My repository is "private-pypi", so I am using poetry config certificates.private-pypi.cert false

But it seems that the value is getting "false" assigned as a string instead of boolean.

See the difference between the first and the second config, where the second config does not have " in the value.

How do I set it as such is should be assigned as boolean instead?


问:
Port Forwarding on OpenWRT
Tried forwarding HTTP port to my linux desktop running lighttpd but it isn't working. Server is running perfectly, works with nginx also. I can access the page from localhost but not through my public IP.

Firewall-Zone settings:

Zone > Forwardings
Input
Output
Forward

lan > wan
accept
accept
accept

wan > reject
reject
accept
accept

and Port Forwarding Config :

```<code>config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'HTTP'
        option src 'wan'
        option src_dport '80'
        option dest_port '80'
        option dest_ip '192.168.1.100'
</code>```

Also here are the screenshots of current settings. What am I doing wrong?

OpenWRT Firewall-Zone Settings

OpenWRT Port Forwards

Title: Port Forwarding on OpenWRT

Body:
Tried forwarding HTTP port to my linux desktop running lighttpd but it isn't working. Server is running perfectly, works with nginx also. I can access the page from localhost but not through my public IP.

Firewall-Zone settings:

Zone > Forwardings
Input
Output
Forward

lan > wan
accept
accept
accept

wan > reject
reject
accept
accept

and Port Forwarding Config :

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'HTTP'
        option src 'wan'
        option src_dport '80'
        option dest_port '80'
        option dest_ip '192.168.1.100'

Also here are the screenshots of current settings. What am I doing wrong?

OpenWRT Firewall-Zone Settings

OpenWRT Port Forwards


问:
How do I implement Serializable? For storing my data in Session
Hi I have been trying to do session replication between my 2 tomcat clusters...and also I am maintain sticky session...I am currently having a problem that after adding  tag in web.xml and running my application it gives an error like **java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute** and when I referred the tomcat documentation for finding solution it was mentioned that All your session attributes must implement java.io.Serializable

...and I get doubt here all my session attributes must implement serializable means that all the objects I am storing in the session using setattribute must implement serializable interface...that mean if I am doing

```<code>public class MySession {
  String sessionObj1 = "Hello";
  HttpSession session = request.getSession();
  session.setAttribute("New-Session-1", sessionObj1);
}
</code>```

Here sessionObj1 is a String Object and serializable likewise I should set only objects that implements serializable interface

Body:
Hi I have been trying to do session replication between my 2 tomcat clusters...and also I am maintain sticky session...I am currently having a problem that after adding  tag in web.xml and running my application it gives an error like **java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute** and when I referred the tomcat documentation for finding solution it was mentioned that All your session attributes must implement java.io.Serializable

...and I get doubt here all my session attributes must implement serializable means that all the objects I am storing in the session using setattribute must implement serializable interface...that mean if I am doing

public class MySession {
  String sessionObj1 = "Hello";
  HttpSession session = request.getSession();
  session.setAttribute("New-Session-1", sessionObj1);
}

Here sessionObj1 is a String Object and serializable likewise I should set only objects that implements serializable interface


问:
Is std::cout thread safe for single output
Suppose there are several threads, each thread invokes

std::cout << 123;
```

for each statement, it should output 3 characters, '1', '2', and '3'. So does the C++ standard guarantees that the '1' '2' and '3' will not interleave? i.e., the system will not output the following result:
112233

Thanks

Body:
Suppose there are several threads, each thread invokes

std::cout << 123;

for each statement, it should output 3 characters, '1', '2', and '3'. So does the C++ standard guarantees that the '1' '2' and '3' will not interleave? i.e., the system will not output the following result:
112233

Thanks


问:
Starship cross-shell prompt is not working on Mac zsh
I'm using a Mac and followed the instructions to install with homebrew and added eval "$(starship init zsh)" to ~/.zshrc.
However, when I restarted my terminal it still shows the default one.

Here's the content of my .zshrc (added the line at the bottom)

```<code># >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export GOBIN=$GOPATH/bin

eval "$(starship init zsh)"
</code>```

Body:
I'm using a Mac and followed the instructions to install with homebrew and added eval "$(starship init zsh)" to ~/.zshrc.
However, when I restarted my terminal it still shows the default one.

Here's the content of my .zshrc (added the line at the bottom)

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export GOBIN=$GOPATH/bin

eval "$(starship init zsh)"


问:
Need to click the View Report button twice to view the SSRS report
When I try to run the report in report viewer first time it will load with default date Parameter. When the default date parameter changed to any other date and to view the report we need to click the button twice.
so my issue is why we need to click the 'view button' twice,  Is it possible to run the report with one click.

I tried to remove the parameters and added again but still no use


问:
How to change color of the sliders in r shiny?
I want to color my last four sliders by using setSliderColor() but it changes first 4 sliders.

I tried use c(7,8,9,10) but no changes happened.

Here is my code:

```<code>fluidRow(
              box(width = 4,
                  title = "Inputs",
                    sliderInput(inputId = "mean",label = "Non-Disease Mean",value = 125,min = 0,max = 500),
                    sliderInput(inputId = "stdev",label = "Non-Disease Standard Deviation",value = 25,min = 0,max = 50),
                    sliderInput(inputId = "mean_2",label = "Disease Mean",value = 200,min = 0,max = 500),
                    sliderInput(inputId = "stdev_2",label = "Disease Standard Deviation",value = 25,min = 0,max = 50)
                  ),
              box(width = 4,
                  title = "Controls",
                    sliderInput("Threshold","Threshold",min = 0,max = 500,value = 150),
                    sliderInput("boundary","Glucose Range",min = 0,max = 500,value = c(0,500))
                  ),
              box(width = 4,
                  title = "Inputs",
                    setSliderColor(c("green","red","red","green",c(1,2,3,4)),

                    sliderInput(inputId = "U[D-A-]",label = "Utility of no Disease with no Action",min = 0,max = 1,value = 1),
                    sliderInput(inputId = "U[D+A-]",label = "Utility of Disease with no Action",min = 0,max = 1,value = 0),
                    sliderInput(inputId = "U[D-A+]",label = "Utility of no Disease with Action",min = 0,max = 1,value = 0),
                    sliderInput(inputId = "U[D+A+]",label = "Utility of Disease with Action",min = 0,max = 1,value = 1)
                 )
              ),
</code>```

Body:
I want to color my last four sliders by using setSliderColor() but it changes first 4 sliders.

I tried use c(7,8,9,10) but no changes happened.

Here is my code:

fluidRow(
              box(width = 4,
                  title = "Inputs",
                    sliderInput(inputId = "mean",label = "Non-Disease Mean",value = 125,min = 0,max = 500),
                    sliderInput(inputId = "stdev",label = "Non-Disease Standard Deviation",value = 25,min = 0,max = 50),
                    sliderInput(inputId = "mean_2",label = "Disease Mean",value = 200,min = 0,max = 500),
                    sliderInput(inputId = "stdev_2",label = "Disease Standard Deviation",value = 25,min = 0,max = 50)
                  ),
              box(width = 4,
                  title = "Controls",
                    sliderInput("Threshold","Threshold",min = 0,max = 500,value = 150),
                    sliderInput("boundary","Glucose Range",min = 0,max = 500,value = c(0,500))
                  ),
              box(width = 4,
                  title = "Inputs",
                    setSliderColor(c("green","red","red","green",c(1,2,3,4)),

                    sliderInput(inputId = "U[D-A-]",label = "Utility of no Disease with no Action",min = 0,max = 1,value = 1),
                    sliderInput(inputId = "U[D+A-]",label = "Utility of Disease with no Action",min = 0,max = 1,value = 0),
                    sliderInput(inputId = "U[D-A+]",label = "Utility of no Disease with Action",min = 0,max = 1,value = 0),
                    sliderInput(inputId = "U[D+A+]",label = "Utility of Disease with Action",min = 0,max = 1,value = 1)
                 )
              ),


问:
Count number of entries per user_id in BigQuery
I have a table consisting of 33 distinct user_id that has a row of data for each day. There should be 31 days (rows) for each user. I want to run a query to confirm this, where the output is a table of unique user_id in column 1 and number of entries in column 2.

I know I can display all rows for each user_id using the following query. But I don't want to do that 33 times just to find out how many entries per user there are in the table.

```<code>SELECT *
FROM table
WHERE user_id = xxxx
</code>```

I'm very new to using SQL and BigQuery. Thank you.

Body:
I have a table consisting of 33 distinct user_id that has a row of data for each day. There should be 31 days (rows) for each user. I want to run a query to confirm this, where the output is a table of unique user_id in column 1 and number of entries in column 2.

I know I can display all rows for each user_id using the following query. But I don't want to do that 33 times just to find out how many entries per user there are in the table.

SELECT *
FROM table
WHERE user_id = xxxx

I'm very new to using SQL and BigQuery. Thank you.


问:
get Object value using Object's key where key is a string
I have one object

```<code>my_object = {"first_name":"Harry", "age":"24", "second_name":"snow"};
</code>```

I can get the first name value using

```<code>console.log(my_object.first_name); //Harry
</code>```

and I am getting Harry . Here everything working fine . But for the below code I am not getting values

```<code>var num_1 = "first_name";

console.log(my_object.num_1); //undefined

console.log(my_object+"."+num_1);  //[object Object].first_name
</code>```

Please help to solve this. Why I am not able to get object values using num_1 . I need to get the object values using num_1.

Body:
I have one object

my_object = {"first_name":"Harry", "age":"24", "second_name":"snow"};

I can get the first name value using

console.log(my_object.first_name); //Harry

and I am getting Harry . Here everything working fine . But for the below code I am not getting values

var num_1 = "first_name";

console.log(my_object.num_1); //undefined

console.log(my_object+"."+num_1);  //[object Object].first_name

Please help to solve this. Why I am not able to get object values using num_1 . I need to get the object values using num_1.


问:
How to add select options to the selection screen of ME55?
I need to add EBKN-SAKTO as a select option in the selection screen of ME55. Need help doing this.

I tried looking for enhancement spots and screen that exists in the program (RM06BF00) related to the selection screen but couldn't find any.


问:
Automating Functional Test
I am a person who works as a SW QA in Korea. I have used Jira Old Version(Local System) to Track issue out and github to manage Site Source. Now i am considering to change Test System. until now, i have had to test all function that was updated in my solution manually!!. so i start wondering how i can automate this. What i want is to test main system and sub system(function) with using program like Postman. So i hope you recommend some programs to test what i want all.

Test Priority is Automation of that below

easy use

Main Source Test

Sub(Function) Source Test

please, i will wait for your answer

I have used Jira Old Version(Local System) to Track issue out and github to manage Site Source. i want to automate all test including black box, UI function.

Title: Automating Functional Test


问:
Unable to attach or mount volumes: unmounted volumes=[code], unattached volumes=[code kube-api-access-fxq69]: timed out waiting for the condition
i have install minikube inorder to integrate Open Integration Hub. i have use kubectl apply -f ./2-IAM to Deploy the OIH Identity and Access Management and its works. in the kubernet dashboard iam showing this error Unable to attach or mount volumes: unmounted volumes=[code], unattached volumes=[code kube-api-access-fxq69]: timed out waiting for the condition.

i have try reinstall minikube,docker and upgraded RAM to 16GB


问:
Google Search Console API Sending Batch Requests in JS
i have a problem with performance of my code. I have to send a lot of requests to Google Search Console API. My code works fine but it takes too long.

I found information that i can send batch requests to API but i don't know how to do it in JavaScript.
https://developers.google.com/webmaster-tools/v1/how-tos/batch

I'm wondering if using batch requests will improve performence of my code and i looking for some information how i can implement batch requests to API in my code.

My code below

```<code>function loadData()
{
    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'https://www.googleapis.com/webmasters/v3/sites/' + siteAdress + '/searchAnalytics/query?key=***');
    xhr.setRequestHeader('Authorization', 'Bearer ' + access_token);

  xhr.send(JSON.stringify
   ({
        "startDate": date1,
        "endDate": date2,
        "dimensions":[
            "QUERY",
            "PAGE"
                ],
        "rowLimit": rowLimit,
        "startRow": startRow
    }));

    xhr.onload = function()
     {
            response = JSON.parse(xhr.responseText);
            for (let i = 0; i < response.rows.length; i++)
            {
                gscData.push([response.rows[i].keys[0], response.rows[i].keys[1], response.rows[i].impressions, response.rows[i].clicks, Math.round(response.rows[i].ctr*100)/100,  Math.round(response.rows[i].position*100)/100]);
                rowNumber++;
            }

            if(response.rows.length == rowLimit)
            {
                startRow += rowLimit;
                loadData();
            }
            else
            {
                alert("Done");
            }
     };
}
</code>```

Body:
i have a problem with performance of my code. I have to send a lot of requests to Google Search Console API. My code works fine but it takes too long.

I found information that i can send batch requests to API but i don't know how to do it in JavaScript.
https://developers.google.com/webmaster-tools/v1/how-tos/batch

I'm wondering if using batch requests will improve performence of my code and i looking for some information how i can implement batch requests to API in my code.

My code below

function loadData()
{
    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'https://www.googleapis.com/webmasters/v3/sites/' + siteAdress + '/searchAnalytics/query?key=***');
    xhr.setRequestHeader('Authorization', 'Bearer ' + access_token);

  xhr.send(JSON.stringify
   ({
        "startDate": date1,
        "endDate": date2,
        "dimensions":[
            "QUERY",
            "PAGE"
                ],
        "rowLimit": rowLimit,
        "startRow": startRow
    }));

    xhr.onload = function()
     {
            response = JSON.parse(xhr.responseText);
            for (let i = 0; i < response.rows.length; i++)
            {
                gscData.push([response.rows[i].keys[0], response.rows[i].keys[1], response.rows[i].impressions, response.rows[i].clicks, Math.round(response.rows[i].ctr*100)/100,  Math.round(response.rows[i].position*100)/100]);
                rowNumber++;
            }

            if(response.rows.length == rowLimit)
            {
                startRow += rowLimit;
                loadData();
            }
            else
            {
                alert("Done");
            }
     };
}


问:
mysql - sum multiple account balance
Currently I am working on a database model for an accounting firm, which they deal with multiple checkbook balance, and it needs to be printed out into one book.

As for now, it is showing the sum of numbers correctly:

```<code>set @nmr = 0;
select
@nmr:=@nmr+1 as "No.",
d.id_transaksi as "ID",
d.tgl_transaksi as "DATE",
e.tipe_transaksi as "TRANSACTION_CODE",
format(d.debit,0,'id_ID') as "DEBIT",
format(d.kredit,0,'id_ID') as "CREDIT",
format(sum(d.debit-d.kredit) over (partition by e.tipe_transaksi = "SS", d.id_anggota order by d.tgl_transaksi rows between unbounded preceding and current row),0,'id_ID') as "BALANCE A",
format(sum(d.debit-d.kredit) over (partition by e.tipe_transaksi = "SW", d.id_anggota order by d.tgl_transaksi rows between unbounded preceding and current row),0,'id_ID') as "BALANCE B"
from history_transaksi d, tipe_transaksi e
where d.id_anggota = 21
and e.tipe_transaksi = d.tipe_transaksi
order by "DATE" asc
</code>```

note : TRANSACTION_CODE "SS" shown as BALANCE A, TRANSACTION_CODE "SW" shown as BALANCE B

the problem is that I need the output shown like this, the BALANCE A will shown zero if user insert BALANCE B, vice versa

Aprreciate all kinds of help. Feel free to correct me if there are any mistake. Thank you

Title: mysql - sum multiple account balance

Body:
Currently I am working on a database model for an accounting firm, which they deal with multiple checkbook balance, and it needs to be printed out into one book.

As for now, it is showing the sum of numbers correctly:

set @nmr = 0;
select
@nmr:=@nmr+1 as "No.",
d.id_transaksi as "ID",
d.tgl_transaksi as "DATE",
e.tipe_transaksi as "TRANSACTION_CODE",
format(d.debit,0,'id_ID') as "DEBIT",
format(d.kredit,0,'id_ID') as "CREDIT",
format(sum(d.debit-d.kredit) over (partition by e.tipe_transaksi = "SS", d.id_anggota order by d.tgl_transaksi rows between unbounded preceding and current row),0,'id_ID') as "BALANCE A",
format(sum(d.debit-d.kredit) over (partition by e.tipe_transaksi = "SW", d.id_anggota order by d.tgl_transaksi rows between unbounded preceding and current row),0,'id_ID') as "BALANCE B"
from history_transaksi d, tipe_transaksi e
where d.id_anggota = 21
and e.tipe_transaksi = d.tipe_transaksi
order by "DATE" asc

note : TRANSACTION_CODE "SS" shown as BALANCE A, TRANSACTION_CODE "SW" shown as BALANCE B

the problem is that I need the output shown like this, the BALANCE A will shown zero if user insert BALANCE B, vice versa

Aprreciate all kinds of help. Feel free to correct me if there are any mistake. Thank you


问:
Automatically read the spring.config.additional-location value in Spring Boot App
I got spring boot app and I am building this app and then creating the jar file out of it.

and then I am executing my jar file with below command

java -Dspring.profiles.active=local -jar rdk-factory-data-deploy-0.1.0-SNAPSHOT.jar --server.port=8080 --ajp.port=0 --spring.datasource.url=jdbc:oracle:thin:@localhost:1521:OraDoc --spring.datasource.username=system --spring.datasource.password=MyPasswd123 --spring.config.additional-location=file:/Users/bharatsuthar/HGW/codebaseDevelopmentRepo1/factory-data-generation-tool/rdk-factory-data-config/ --logging.config=file:/Users/bharatsuthar/HGW/codebaseDevelopmentRepo1/factory-data-generation-tool/rdk-factory-data-config/logback-spring.xml --certFilePath=/Users/bharatsuthar/HGW/codebaseDevelopmentRepo1/factory-data-generation-tool/rdk-factory-data-config/prodcert/

my goal is to read the spring.config.additional-location value in my java code but I am unable to read this value.

I have tried with below code but my code is not working and I am not able to read this path.

```<code>System.getProperty("spring.config.additional-location")
</code>```

I think above way is not right way to read..though I can read the value but I want to read this automatically in spring boot app.

Can someone please help on me on this how can I read spring.config.additional-location this ?

How can I derive this path spring.config.additional-location without using System.getProperty() ?

thank you so much

Body:
I got spring boot app and I am building this app and then creating the jar file out of it.

and then I am executing my jar file with below command

java -Dspring.profiles.active=local -jar rdk-factory-data-deploy-0.1.0-SNAPSHOT.jar --server.port=8080 --ajp.port=0 --spring.datasource.url=jdbc:oracle:thin:@localhost:1521:OraDoc --spring.datasource.username=system --spring.datasource.password=MyPasswd123 --spring.config.additional-location=file:/Users/bharatsuthar/HGW/codebaseDevelopmentRepo1/factory-data-generation-tool/rdk-factory-data-config/ --logging.config=file:/Users/bharatsuthar/HGW/codebaseDevelopmentRepo1/factory-data-generation-tool/rdk-factory-data-config/logback-spring.xml --certFilePath=/Users/bharatsuthar/HGW/codebaseDevelopmentRepo1/factory-data-generation-tool/rdk-factory-data-config/prodcert/

my goal is to read the spring.config.additional-location value in my java code but I am unable to read this value.

I have tried with below code but my code is not working and I am not able to read this path.

System.getProperty("spring.config.additional-location")

I think above way is not right way to read..though I can read the value but I want to read this automatically in spring boot app.

Can someone please help on me on this how can I read spring.config.additional-location this ?

How can I derive this path spring.config.additional-location without using System.getProperty() ?

thank you so much


问:
Is it possile to migrate digital products with attached zip files from one Jumpseller to another one
I want to export my digital products with attached zip files to other jumpseller store,

I tried with csv file but there is no column for digital downloads

Is there any way I can do it


问:
Flutter: one of two streambuilder not loaded
I have two streams fetching from different api.

Stream<List<dynamic>> get getMessage => _messageController.stream;
Stream<List<String>> get getUser => _userController.stream;
```
<p>I'm trying to fetch these data at different state of the application.</p>
<pre class="lang-dart prettyprint-override"><code>  Stream<List<dynamic>> _fetchStream(String roomId) {
    return Stream<List<dynamic>>.fromFuture(ChatService.fetch(roomId));
  }

  Future<List<String>> _fetchUserList(String roomId) async {
    Chatroom roomInfo =
        Chatroom.fromJson(await ChatroomService.getRoomInfo(roomId));
    _users = roomInfo.users;
    return roomInfo.users;
  }
</code>```

My screen has streambuilders as

return Scaffold(
      endDrawer: Drawer(
        child: Column(
          children: [
            const DrawerHeader(child: Text('Header')),
            StreamBuilder(
              stream: _streamSocket.getUser,
              builder:
                  (BuildContext context, AsyncSnapshot<List<String>> snapshot) {
                if (!snapshot.hasData) {
                  return const CircularProgressIndicator();
                } else {
                  _streamSocket.users = snapshot.data!;
                  return ListView.builder(
                    itemCount: snapshot.data!.length,
                    itemBuilder: (BuildContext context, int index) {
                      String user = snapshot.data![index];
                      return Text(user);
                    },
                  );
                }
              },
            ),
          ],
        ),
      ),
      body: Stack(
        children: [
          StreamBuilder(
            stream: _streamSocket.getMessage,
            builder:
                (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) {
              if (!snapshot.hasData) {
                return const CircularProgressIndicator();
              } else {
                _streamSocket.messages = snapshot.data!;
                return Positioned(
                  top: 0,
                  bottom: 60,
                  width: size.width,
                  child: ListView.builder(
                    controller: _scrollController,
                    scrollDirection: Axis.vertical,
                    shrinkWrap: true,
                    reverse: true,
                    itemCount: snapshot.data!.length,
                    itemBuilder: (BuildContext context, int index) {
                      Message message = Message.fromJson(
                          snapshot.data![snapshot.data!.length - index - 1]);
                      return MessageItem(
                        message: message,
                        isUserMessage: message.isUserMessage(widget.user),
                      );
                    },
                  ),
                );
              }
            },
          ),
```

The problem is streambuilder which has _streamSocket.getUser not loaded infinitely, while below one works well. Api call itself does not matter. It actually stored in _users properly. Do I missing anything while handling two streams?

Body:
I have two streams fetching from different api.

Stream<List<dynamic>> get getMessage => _messageController.stream;
Stream<List<String>> get getUser => _userController.stream;

I'm trying to fetch these data at different state of the application.

  Stream<List<dynamic>> _fetchStream(String roomId) {
    return Stream<List<dynamic>>.fromFuture(ChatService.fetch(roomId));
  }

  Future<List<String>> _fetchUserList(String roomId) async {
    Chatroom roomInfo =
        Chatroom.fromJson(await ChatroomService.getRoomInfo(roomId));
    _users = roomInfo.users;
    return roomInfo.users;
  }

My screen has streambuilders as

return Scaffold(
      endDrawer: Drawer(
        child: Column(
          children: [
            const DrawerHeader(child: Text('Header')),
            StreamBuilder(
              stream: _streamSocket.getUser,
              builder:
                  (BuildContext context, AsyncSnapshot<List<String>> snapshot) {
                if (!snapshot.hasData) {
                  return const CircularProgressIndicator();
                } else {
                  _streamSocket.users = snapshot.data!;
                  return ListView.builder(
                    itemCount: snapshot.data!.length,
                    itemBuilder: (BuildContext context, int index) {
                      String user = snapshot.data![index];
                      return Text(user);
                    },
                  );
                }
              },
            ),
          ],
        ),
      ),
      body: Stack(
        children: [
          StreamBuilder(
            stream: _streamSocket.getMessage,
            builder:
                (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) {
              if (!snapshot.hasData) {
                return const CircularProgressIndicator();
              } else {
                _streamSocket.messages = snapshot.data!;
                return Positioned(
                  top: 0,
                  bottom: 60,
                  width: size.width,
                  child: ListView.builder(
                    controller: _scrollController,
                    scrollDirection: Axis.vertical,
                    shrinkWrap: true,
                    reverse: true,
                    itemCount: snapshot.data!.length,
                    itemBuilder: (BuildContext context, int index) {
                      Message message = Message.fromJson(
                          snapshot.data![snapshot.data!.length - index - 1]);
                      return MessageItem(
                        message: message,
                        isUserMessage: message.isUserMessage(widget.user),
                      );
                    },
                  ),
                );
              }
            },
          ),

The problem is streambuilder which has _streamSocket.getUser not loaded infinitely, while below one works well. Api call itself does not matter. It actually stored in _users properly. Do I missing anything while handling two streams?


问:
Keras error talking about float but think it is to do with dimension
I am getting an error saying that it is unable to convert numpy float to a tensor. However, from researching online this error message is apparently terrible and may have nothing to do with the data type of the array.

I have a feeling that it is to do the shapes of the data that I am putting in. As you can see from the printed output below one of the shapes is (5801, 20, 13) this is as I am using time series data that has 13 features 20 time periods, and I have 5801 of these samples.

Any suggestion on how I can fix this?

```<code>for feature in features:
    losses = []
    data, target = generate_features()
    data.drop(labels=feature, inplace=True,  axis=1)
    data, target= shape_data(data.values, target.values)
    X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.5)
    y_train, y_test = y_train.astype(int), y_test.astype(int)
    for idx in range(4):

        model = tf.keras.Sequential()
        model.add(tf.keras.layers.LSTM(300, input_shape=(X_test.shape[1], X_test.shape[2])))
        for i in range(3):
            model.add(tf.keras.layers.Dense(300, activation='tanh'))
        model.add(tf.keras.layers.Dense(3, activation='softmax'))
        optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
        model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=[tf.keras.metrics.Precision()])

        early_stop = tf.keras.callbacks.EarlyStopping(monitor=f'precision_{es}' if es else 'precision', patience=5)
        es+=1
        lr_schedule = tf.keras.callbacks.LearningRateScheduler(lambda epoch: 1e-2 - 1e-4*epoch*2)
        print(f'X_train shape: {X_train.shape}, X_train sample: {X_train[0]}')
        print(f'y_train shape: {y_train.shape}, y_train sample: {y_train[0]}')
        print(f'X_test shape: {X_test.shape}, X_test sample: {X_test[0]}')
        print(f'y_test shape: {y_test.shape}, y_test sample: {y_test[0]}')

        model.fit(X_train, y_train, epochs=epochs, batch_size=32, validation_data=(X_test, y_test), callbacks=[early_stop, lr_schedule], verbose=2)
</code>```

The output of the print statement about the data being fitted to the model.

```<code>
X_train shape: (5801, 20, 13), X_train is type: object
y_train shape: (5801, 3), y_train is type: int64
X_test shape: (5802, 20, 13), X_test is type: object
y_test shape: (5802, 3), y_test is type: int64

</code>```

The error message on crash

```<code>ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).

</code>```

Body:
I am getting an error saying that it is unable to convert numpy float to a tensor. However, from researching online this error message is apparently terrible and may have nothing to do with the data type of the array.

I have a feeling that it is to do the shapes of the data that I am putting in. As you can see from the printed output below one of the shapes is (5801, 20, 13) this is as I am using time series data that has 13 features 20 time periods, and I have 5801 of these samples.

Any suggestion on how I can fix this?

for feature in features:
    losses = []
    data, target = generate_features()
    data.drop(labels=feature, inplace=True,  axis=1)
    data, target= shape_data(data.values, target.values)
    X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.5)
    y_train, y_test = y_train.astype(int), y_test.astype(int)
    for idx in range(4):

        model = tf.keras.Sequential()
        model.add(tf.keras.layers.LSTM(300, input_shape=(X_test.shape[1], X_test.shape[2])))
        for i in range(3):
            model.add(tf.keras.layers.Dense(300, activation='tanh'))
        model.add(tf.keras.layers.Dense(3, activation='softmax'))
        optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
        model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=[tf.keras.metrics.Precision()])

        early_stop = tf.keras.callbacks.EarlyStopping(monitor=f'precision_{es}' if es else 'precision', patience=5)
        es+=1
        lr_schedule = tf.keras.callbacks.LearningRateScheduler(lambda epoch: 1e-2 - 1e-4*epoch*2)
        print(f'X_train shape: {X_train.shape}, X_train sample: {X_train[0]}')
        print(f'y_train shape: {y_train.shape}, y_train sample: {y_train[0]}')
        print(f'X_test shape: {X_test.shape}, X_test sample: {X_test[0]}')
        print(f'y_test shape: {y_test.shape}, y_test sample: {y_test[0]}')

        model.fit(X_train, y_train, epochs=epochs, batch_size=32, validation_data=(X_test, y_test), callbacks=[early_stop, lr_schedule], verbose=2)

The output of the print statement about the data being fitted to the model.

X_train shape: (5801, 20, 13), X_train is type: object
y_train shape: (5801, 3), y_train is type: int64
X_test shape: (5802, 20, 13), X_test is type: object
y_test shape: (5802, 3), y_test is type: int64

The error message on crash

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).


问:
How to change front camera angle to wide?

(https://i.stack.imgur.com/V060T.jpg)(https://i.stack.imgur.com/tjtgU.jpg)

I wonder what the function of the button at the bottom of the front camera is.

I also changed the deviceType to implement this function, but it didn't change.

Exactly what values should I change for this function to get the result?


问:
Simple proxy cannot assign requested address, followed by 403 from upstream
I'm trying to configure simple proxy using openresty nginx that will pass each request to another server.
What is worth noticing, I don't have control over this upstream and I have only its public hostname, for this example I'll call it example.org.

So my basic setup looked like this:

```<code>server {
    listen 80 default_server;
    listen [::]:80 default_server;

    proxy_http_version 1.1;
    proxy_set_header "Connection" "";

    location /test {
        proxy_pass http://example.org/test;
    }
 }
</code>```

That was working just fine, until it received a bit heavier load (not that heavy, around 10 RPS). Then I started to see a lot of

[crit] 7#7: *62778 connect() to ...:80 failed (99: Cannot assign requested address) while connecting to upstream

I've found workaround for that, which was to use keepalive for that upstream.

So I've added upstream to http section

```<code>upstream backend {
    server example.org;
    keepalive 20;
}
</code>```

And I've changed my location to

```<code>location /test {
    proxy_pass http://backend/test;
}
</code>```

And it stopped working, I started to receive 403 from that upstream

error code: 1003

Response code: 403 (Forbidden); Time: 58ms (58 ms); Content length: 16
bytes (16 B)

Any ideas where to go from here?
Also, what is worth mentioning, Cannot assign requested address error seems very strange to me. I'm running load test and first N requests are failed because of that error and then it starts to work just fine. If I understand correctly, this error means that I'm running out of ports? So why it isn't happening the opposite way, at first it should work and then it should fail. Also, the default range of open ports is 32768 through 61000. After running ss -a | grep TIME-WAIT | wc -l during load tests I saw that only 800~ ports are used, correct me if I'm wrong, there should be plenty more of them to use?

Body:
I'm trying to configure simple proxy using openresty nginx that will pass each request to another server.
What is worth noticing, I don't have control over this upstream and I have only its public hostname, for this example I'll call it example.org.

So my basic setup looked like this:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    proxy_http_version 1.1;
    proxy_set_header "Connection" "";

    location /test {
        proxy_pass http://example.org/test;
    }
 }

That was working just fine, until it received a bit heavier load (not that heavy, around 10 RPS). Then I started to see a lot of

[crit] 7#7: *62778 connect() to ...:80 failed (99: Cannot assign requested address) while connecting to upstream

I've found workaround for that, which was to use keepalive for that upstream.

So I've added upstream to http section

upstream backend {
    server example.org;
    keepalive 20;
}

And I've changed my location to

location /test {
    proxy_pass http://backend/test;
}

And it stopped working, I started to receive 403 from that upstream

error code: 1003

Response code: 403 (Forbidden); Time: 58ms (58 ms); Content length: 16
bytes (16 B)

Any ideas where to go from here?
Also, what is worth mentioning, Cannot assign requested address error seems very strange to me. I'm running load test and first N requests are failed because of that error and then it starts to work just fine. If I understand correctly, this error means that I'm running out of ports? So why it isn't happening the opposite way, at first it should work and then it should fail. Also, the default range of open ports is 32768 through 61000. After running ss -a | grep TIME-WAIT | wc -l during load tests I saw that only 800~ ports are used, correct me if I'm wrong, there should be plenty more of them to use?


问:
Add header script on load in react CSR based on environment
We have some tracking script in our app, and would like to load them only in production.

something like ejs would looks nice

```<code><% if (process.env.NODE_ENV === 'production') { %>
  <script>
    // my GA script
  </script>
<% } %>
</code>```

But looks like this is not available for CSR.

The way I cam with it adding the tag in a hook after initialization of react (so inside a hook), but this delay the script by quite a bit and the script data in GA is incorrect for some tracking.

Is there a way to change the script tag based on environment during build time, without having to add a template per environment ?

Body:
We have some tracking script in our app, and would like to load them only in production.

something like ejs would looks nice

<% if (process.env.NODE_ENV === 'production') { %>

<% } %>

But looks like this is not available for CSR.

The way I cam with it adding the tag in a hook after initialization of react (so inside a hook), but this delay the script by quite a bit and the script data in GA is incorrect for some tracking.

Is there a way to change the script tag based on environment during build time, without having to add a template per environment ?


问:
DevTools failed to load source map, ERR_BLOCKED_BY_CLIENT
DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/scripts/iframe_form_check.map: System error: net::ERR_BLOCKED_BY_CLIENT

i am expecting a error free console, i wanna run js in browser...


问:
How to update one recycler view content from another recycler view item click
I'm new to Android world, and stuck with one issue now. I tried a lot from past 3-4 days, but still couldn't fix the issue. With lots of hope I'm posting this question today here. Looking forward to hear from you.

In same activity, I've two recycler views. One at top (adapter name SubCategoryAdapterTop) and one at below full screen (adapter name SubCategoryAdapter). I'm passing one position (POS) to SubCategoryAdapterTop captured from previous main activity, and passing two positions to SubCategoryAdapter (POS, POS1 -default 1). May be if you look at my codes below, can understand it properly. Now I wish to click on each item on top recycler view and acoordingly want to pass the clicked position as POS1 to SubCategoryAdapter and regenerate/refresh the content of it. Example- if I click 2nd item in top recycler view, then POS1 should be 2 and passed on to SubCategoryAdapter along with earlier POS value and refresh it's content accordingly.

Please help me how to do that. Thanks in advance !

Activity with 2 recycler views:

SubCategoryAdapter Code:

```<code>public class SubCategoryAdapter extends RecyclerView.Adapter<SubCategoryAdapter.MainViewHolder> {
    List<response_model_fetch_subcategory> data;
    Context context;

    public SubCategoryAdapter(List<response_model_fetch_subcategory> data, Context context) {
        this.data = data;
        this.context = context;
    }

    @NonNull
    @Override
    public SubCategoryAdapter.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subcategory_single, parent, false);
        return new MainViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull SubCategoryAdapter.MainViewHolder holder, int position) {
        holder.subCategoryTextView1.setText(data.get(position).getPname());
        holder.subCategoryTextView2.setText(data.get(position).getPbrand());
        holder.subCategoryTextView3.setText(Integer.toString(data.get(position).getPquantity1()));
        holder.subCategoryTextView4.setText(data.get(position).getPunit());
        holder.subCategoryTextView5.setText(String.format("%.2f",Double.valueOf(data.get(position).getPcost1())));
        holder.subCategoryTextView6.setText(String.format("%.2f",Double.valueOf(data.get(position).getPcost1())));
        holder.subCategoryTextView7.setText(Integer.toString(data.get(position).getDiscountamount()));
        Glide.with(holder.subCategoryImageView1.getContext()).load("http://10.0.2.2/localshop/localshopimages/product/"+data.get(position).getPimage1()).into(holder.subCategoryImageView1);

        holder.subCardViewContainer1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, LoginVerifyOTP.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
            }
        });

    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    public class MainViewHolder extends RecyclerView.ViewHolder {
        CardView subCardViewContainer1;
        ImageView subCategoryImageView1;
        TextView subCategoryTextView1, subCategoryTextView2, subCategoryTextView3, subCategoryTextView4, subCategoryTextView5, subCategoryTextView6, subCategoryTextView7;
        Button subCategoryButton1;

        public MainViewHolder(@NonNull View itemView) {
            super(itemView);
            subCardViewContainer1 = itemView.findViewById(R.id.subCardViewContainer1);
            subCategoryImageView1 = itemView.findViewById(R.id.subCategoryImageView1);
            subCategoryButton1 = itemView.findViewById(R.id.subCategoryButton1);
            subCategoryTextView1 = itemView.findViewById(R.id.subCategoryTextView1);
            subCategoryTextView2 = itemView.findViewById(R.id.subCategoryTextView2);
            subCategoryTextView3 = itemView.findViewById(R.id.subCategoryTextView3);
            subCategoryTextView4 = itemView.findViewById(R.id.subCategoryTextView4);
            subCategoryTextView5 = itemView.findViewById(R.id.subCategoryTextView5);
            subCategoryTextView6 = itemView.findViewById(R.id.subCategoryTextView6);
            subCategoryTextView7 = itemView.findViewById(R.id.subCategoryTextView7);
        }
    }
}

</code>```

SubCategoryAdapterTop Code:

```<code>public class SubCategoryAdapterTop extends RecyclerView.Adapter<SubCategoryAdapterTop.MainViewHolder> {
    List<response_model_fetch_subcategoryTop> data1;
    Context context;
    int row_index = 0;

    public SubCategoryAdapterTop(List<response_model_fetch_subcategoryTop> data1, Context context) {
        this.data1 = data1;
        this.context = context;
    }

    @NonNull
    @Override
    public SubCategoryAdapterTop.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subcategory_topsingle, parent, false);
        return new SubCategoryAdapterTop.MainViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull SubCategoryAdapterTop.MainViewHolder holder, @SuppressLint("RecyclerView") int position) {

        holder.subCategoryTextViewTop1.setText(data1.get(position).getSubcategoryname());
        holder.subCardViewContainerTop1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                row_index = position;
                notifyDataSetChanged();
            }
        });

        if (row_index == position) {
            holder.subCardViewContainerTop1.setBackgroundResource(R.drawable.selected_item_bg);
        }
        else
        {
            holder.subCardViewContainerTop1.setBackgroundResource(R.drawable.unselected_item_bg);
        }

    }

    @Override
    public int getItemCount() {
        return data1.size();
    }

    public class MainViewHolder extends RecyclerView.ViewHolder {
        LinearLayoutCompat subCardViewContainerTop1;
        TextView subCategoryTextViewTop1;

        public MainViewHolder(@NonNull View itemView) {
            super(itemView);
            subCardViewContainerTop1 = itemView.findViewById(R.id.subCardViewContainerTop1);
            subCategoryTextViewTop1 = itemView.findViewById(R.id.subCategoryTextViewTop1);
        }
    }
}
</code>```

SubCategoryActivity Code:

```<code>public class SubCategoryActivity extends AppCompatActivity {

    RecyclerView subRecyclerView, subRecyclerViewTop1;
    SubCategoryAdapter adapter;
    SubCategoryAdapterTop adapterTop;
    String pos, pos1;
    Intent intent;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sub_category);

        // recycler view code
        subRecyclerView = findViewById(R.id.subRecyclerView);
        subRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

        subRecyclerViewTop1 = findViewById(R.id.subRecyclerViewTop1);
        subRecyclerViewTop1.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false));

        intent = getIntent();
        pos = intent.getStringExtra("pos");
        Log.d(TAG, "Checking for incoming intent extras: " + pos);
        pos1 = Integer.toString(1);
        Log.d(TAG, "Checking for incoming intent extras1: " + pos1);

        fetchingProduct(pos, pos1);
        fetchingProductTop(pos);

    }

    public void fetchingProduct(String pos, String pos1) {

        Call<List<response_model_fetch_subcategory>> call = apicontroller
                .getInstance()
                .getApi()
                .getSubCategoryData(pos, pos1);

        call.enqueue(new Callback<List<response_model_fetch_subcategory>>() {
            @Override
            public void onResponse(@NonNull Call<List<response_model_fetch_subcategory>> call, @NonNull Response<List<response_model_fetch_subcategory>> response) {

                if (response.isSuccessful()) {
                    if (response.body() != null) {
                        List<response_model_fetch_subcategory> data = response.body();
                        adapter = new SubCategoryAdapter(data, getApplicationContext());
                        subRecyclerView.setAdapter(adapter);
                    }
                }
            }

            @Override
            public void onFailure(@NonNull Call<List<response_model_fetch_subcategory>> call, @NonNull Throwable t) {
                Log.d(TAG, "Last_Error" + t.toString());
                Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_LONG).show();
            }
        });

        Log.d(TAG, "Checking for incoming intent extras_: " + pos);
        Log.d(TAG, "Checking for incoming intent extras_1: " + pos1);

    }

    private void fetchingProductTop(String pos) {
        Call<List<response_model_fetch_subcategoryTop>> call = apicontroller
                .getInstance()
                .getApi()
                .getSubCategoryNames(pos);

        call.enqueue(new Callback<List<response_model_fetch_subcategoryTop>>() {
            @Override
            public void onResponse(@NonNull Call<List<response_model_fetch_subcategoryTop>> call, @NonNull Response<List<response_model_fetch_subcategoryTop>> response) {
                if (response.isSuccessful()) {
                    if (response.body() != null) {
                        List<response_model_fetch_subcategoryTop> data1 = response.body();
                        adapterTop = new SubCategoryAdapterTop(data1, getApplicationContext());
                        subRecyclerViewTop1.setAdapter(adapterTop);
                    }
                }
            }

            @Override
            public void onFailure(@NonNull Call<List<response_model_fetch_subcategoryTop>> call, @NonNull Throwable t) {
                Log.d(TAG, "Last_Error" + t.toString());
                Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_LONG).show();
            }
        });
    }

}
</code>```

apiset coode:

```<code>public interface apiset {

    @FormUrlEncoded
    @POST("login_user.php")
    Call<response_model_login_user> getRegister(
            @Field("mobilenumber") String mobilenumber,
            @Field("area") String area,
            @Field("firstname") String firstname,
            @Field("lastname") String lastname,
            @Field("emailid") String emailid,
            @Field("deliveryaddress") String deliveryaddress
    );

    @GET("fetch_category.php")
    Call<List<response_model_fetch_category>> getData();

    /*
    @GET("fetch_subcategory.php")
    Call<List<response_model_fetch_subcategory>> getSubCategoryData();
    */

    @FormUrlEncoded
    @POST("fetch_subcategory.php")
    Call<List<response_model_fetch_subcategory>> getSubCategoryData(
            @Field("pos") String pos,
            @Field("pos1") String pos1
    );

    @FormUrlEncoded
    @POST("fetch_subcategory_names.php")
    Call<List<response_model_fetch_subcategoryTop>> getSubCategoryNames(
            @Field("pos") String pos
    );
}
</code>```

activity_sub_category.xml code:

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SubCategoryActivity"
    android:background="@color/cardview_light_background"
    android:orientation="vertical">

 <FrameLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/subFrameLayoutTop1"
     android:background="@color/gray_light"
     >

     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/subRecyclerViewTop1"
         android:layout_width="match_parent"
         android:layout_height="match_parent"

         />

 </FrameLayout>

    <FrameLayout
        android:id="@+id/subFrameLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/subRecyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical"
            android:scrollbarStyle="outsideInset"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:scrollbarFadeDuration="@integer/material_motion_duration_short_1"
            />

    </FrameLayout>

</LinearLayout>
</code>```

I tried to implement nested recycler view concept, but it's not working.

Body:
I'm new to Android world, and stuck with one issue now. I tried a lot from past 3-4 days, but still couldn't fix the issue. With lots of hope I'm posting this question today here. Looking forward to hear from you.

In same activity, I've two recycler views. One at top (adapter name SubCategoryAdapterTop) and one at below full screen (adapter name SubCategoryAdapter). I'm passing one position (POS) to SubCategoryAdapterTop captured from previous main activity, and passing two positions to SubCategoryAdapter (POS, POS1 -default 1). May be if you look at my codes below, can understand it properly. Now I wish to click on each item on top recycler view and acoordingly want to pass the clicked position as POS1 to SubCategoryAdapter and regenerate/refresh the content of it. Example- if I click 2nd item in top recycler view, then POS1 should be 2 and passed on to SubCategoryAdapter along with earlier POS value and refresh it's content accordingly.

Please help me how to do that. Thanks in advance !

Activity with 2 recycler views:

SubCategoryAdapter Code:

public class SubCategoryAdapter extends RecyclerView.Adapter<SubCategoryAdapter.MainViewHolder> {
    List<response_model_fetch_subcategory> data;
    Context context;

    public SubCategoryAdapter(List<response_model_fetch_subcategory> data, Context context) {
        this.data = data;
        this.context = context;
    }

    @NonNull
    @Override
    public SubCategoryAdapter.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subcategory_single, parent, false);
        return new MainViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull SubCategoryAdapter.MainViewHolder holder, int position) {
        holder.subCategoryTextView1.setText(data.get(position).getPname());
        holder.subCategoryTextView2.setText(data.get(position).getPbrand());
        holder.subCategoryTextView3.setText(Integer.toString(data.get(position).getPquantity1()));
        holder.subCategoryTextView4.setText(data.get(position).getPunit());
        holder.subCategoryTextView5.setText(String.format("%.2f",Double.valueOf(data.get(position).getPcost1())));
        holder.subCategoryTextView6.setText(String.format("%.2f",Double.valueOf(data.get(position).getPcost1())));
        holder.subCategoryTextView7.setText(Integer.toString(data.get(position).getDiscountamount()));
        Glide.with(holder.subCategoryImageView1.getContext()).load("http://10.0.2.2/localshop/localshopimages/product/"+data.get(position).getPimage1()).into(holder.subCategoryImageView1);

        holder.subCardViewContainer1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, LoginVerifyOTP.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
            }
        });

    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    public class MainViewHolder extends RecyclerView.ViewHolder {
        CardView subCardViewContainer1;
        ImageView subCategoryImageView1;
        TextView subCategoryTextView1, subCategoryTextView2, subCategoryTextView3, subCategoryTextView4, subCategoryTextView5, subCategoryTextView6, subCategoryTextView7;
        Button subCategoryButton1;

        public MainViewHolder(@NonNull View itemView) {
            super(itemView);
            subCardViewContainer1 = itemView.findViewById(R.id.subCardViewContainer1);
            subCategoryImageView1 = itemView.findViewById(R.id.subCategoryImageView1);
            subCategoryButton1 = itemView.findViewById(R.id.subCategoryButton1);
            subCategoryTextView1 = itemView.findViewById(R.id.subCategoryTextView1);
            subCategoryTextView2 = itemView.findViewById(R.id.subCategoryTextView2);
            subCategoryTextView3 = itemView.findViewById(R.id.subCategoryTextView3);
            subCategoryTextView4 = itemView.findViewById(R.id.subCategoryTextView4);
            subCategoryTextView5 = itemView.findViewById(R.id.subCategoryTextView5);
            subCategoryTextView6 = itemView.findViewById(R.id.subCategoryTextView6);
            subCategoryTextView7 = itemView.findViewById(R.id.subCategoryTextView7);
        }
    }
}

SubCategoryAdapterTop Code:

public class SubCategoryAdapterTop extends RecyclerView.Adapter<SubCategoryAdapterTop.MainViewHolder> {
    List<response_model_fetch_subcategoryTop> data1;
    Context context;
    int row_index = 0;

    public SubCategoryAdapterTop(List<response_model_fetch_subcategoryTop> data1, Context context) {
        this.data1 = data1;
        this.context = context;
    }

    @NonNull
    @Override
    public SubCategoryAdapterTop.MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subcategory_topsingle, parent, false);
        return new SubCategoryAdapterTop.MainViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull SubCategoryAdapterTop.MainViewHolder holder, @SuppressLint("RecyclerView") int position) {

        holder.subCategoryTextViewTop1.setText(data1.get(position).getSubcategoryname());
        holder.subCardViewContainerTop1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                row_index = position;
                notifyDataSetChanged();
            }
        });

        if (row_index == position) {
            holder.subCardViewContainerTop1.setBackgroundResource(R.drawable.selected_item_bg);
        }
        else
        {
            holder.subCardViewContainerTop1.setBackgroundResource(R.drawable.unselected_item_bg);
        }

    }

    @Override
    public int getItemCount() {
        return data1.size();
    }

    public class MainViewHolder extends RecyclerView.ViewHolder {
        LinearLayoutCompat subCardViewContainerTop1;
        TextView subCategoryTextViewTop1;

        public MainViewHolder(@NonNull View itemView) {
            super(itemView);
            subCardViewContainerTop1 = itemView.findViewById(R.id.subCardViewContainerTop1);
            subCategoryTextViewTop1 = itemView.findViewById(R.id.subCategoryTextViewTop1);
        }
    }
}

SubCategoryActivity Code:

public class SubCategoryActivity extends AppCompatActivity {

    RecyclerView subRecyclerView, subRecyclerViewTop1;
    SubCategoryAdapter adapter;
    SubCategoryAdapterTop adapterTop;
    String pos, pos1;
    Intent intent;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sub_category);

        // recycler view code
        subRecyclerView = findViewById(R.id.subRecyclerView);
        subRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

        subRecyclerViewTop1 = findViewById(R.id.subRecyclerViewTop1);
        subRecyclerViewTop1.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false));

        intent = getIntent();
        pos = intent.getStringExtra("pos");
        Log.d(TAG, "Checking for incoming intent extras: " + pos);
        pos1 = Integer.toString(1);
        Log.d(TAG, "Checking for incoming intent extras1: " + pos1);

        fetchingProduct(pos, pos1);
        fetchingProductTop(pos);

    }

    public void fetchingProduct(String pos, String pos1) {

        Call<List<response_model_fetch_subcategory>> call = apicontroller
                .getInstance()
                .getApi()
                .getSubCategoryData(pos, pos1);

        call.enqueue(new Callback<List<response_model_fetch_subcategory>>() {
            @Override
            public void onResponse(@NonNull Call<List<response_model_fetch_subcategory>> call, @NonNull Response<List<response_model_fetch_subcategory>> response) {

                if (response.isSuccessful()) {
                    if (response.body() != null) {
                        List<response_model_fetch_subcategory> data = response.body();
                        adapter = new SubCategoryAdapter(data, getApplicationContext());
                        subRecyclerView.setAdapter(adapter);
                    }
                }
            }

            @Override
            public void onFailure(@NonNull Call<List<response_model_fetch_subcategory>> call, @NonNull Throwable t) {
                Log.d(TAG, "Last_Error" + t.toString());
                Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_LONG).show();
            }
        });

        Log.d(TAG, "Checking for incoming intent extras_: " + pos);
        Log.d(TAG, "Checking for incoming intent extras_1: " + pos1);

    }

    private void fetchingProductTop(String pos) {
        Call<List<response_model_fetch_subcategoryTop>> call = apicontroller
                .getInstance()
                .getApi()
                .getSubCategoryNames(pos);

        call.enqueue(new Callback<List<response_model_fetch_subcategoryTop>>() {
            @Override
            public void onResponse(@NonNull Call<List<response_model_fetch_subcategoryTop>> call, @NonNull Response<List<response_model_fetch_subcategoryTop>> response) {
                if (response.isSuccessful()) {
                    if (response.body() != null) {
                        List<response_model_fetch_subcategoryTop> data1 = response.body();
                        adapterTop = new SubCategoryAdapterTop(data1, getApplicationContext());
                        subRecyclerViewTop1.setAdapter(adapterTop);
                    }
                }
            }

            @Override
            public void onFailure(@NonNull Call<List<response_model_fetch_subcategoryTop>> call, @NonNull Throwable t) {
                Log.d(TAG, "Last_Error" + t.toString());
                Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_LONG).show();
            }
        });
    }

}

apiset coode:

public interface apiset {

    @FormUrlEncoded
    @POST("login_user.php")
    Call<response_model_login_user> getRegister(
            @Field("mobilenumber") String mobilenumber,
            @Field("area") String area,
            @Field("firstname") String firstname,
            @Field("lastname") String lastname,
            @Field("emailid") String emailid,
            @Field("deliveryaddress") String deliveryaddress
    );

    @GET("fetch_category.php")
    Call<List<response_model_fetch_category>> getData();

    /*
    @GET("fetch_subcategory.php")
    Call<List<response_model_fetch_subcategory>> getSubCategoryData();
    */

    @FormUrlEncoded
    @POST("fetch_subcategory.php")
    Call<List<response_model_fetch_subcategory>> getSubCategoryData(
            @Field("pos") String pos,
            @Field("pos1") String pos1
    );

    @FormUrlEncoded
    @POST("fetch_subcategory_names.php")
    Call<List<response_model_fetch_subcategoryTop>> getSubCategoryNames(
            @Field("pos") String pos
    );
}

activity_sub_category.xml code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SubCategoryActivity"
    android:background="@color/cardview_light_background"
    android:orientation="vertical">

 <FrameLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/subFrameLayoutTop1"
     android:background="@color/gray_light"
     >

     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/subRecyclerViewTop1"
         android:layout_width="match_parent"
         android:layout_height="match_parent"

         />

 </FrameLayout>

    <FrameLayout
        android:id="@+id/subFrameLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/subRecyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical"
            android:scrollbarStyle="outsideInset"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:scrollbarFadeDuration="@integer/material_motion_duration_short_1"
            />

    </FrameLayout>

</LinearLayout>

I tried to implement nested recycler view concept, but it's not working.


问:
Angular component name same as HTMLelement allowed?
Is it allowed to generated an Angular component that has the same name as an HTML element?
E.g.: I have created an Angular component 'button'. When I create my button template I want to use html button element in but it seems that, instead of referencing html element, it wants to reference itself as element. The strange part is that compilation gives no errors but when I run my app I am getting "This page is having a problem". No further information is available on the page.
This is my template:</p>
```<code><button [ngStyle]="{'background-color': bgcolour}" class="button">{{text}}</button>
</code>```

Body:
Is it allowed to generated an Angular component that has the same name as an HTML element?
E.g.: I have created an Angular component 'button'. When I create my button template I want to use html button element in but it seems that, instead of referencing html element, it wants to reference itself as element. The strange part is that compilation gives no errors but when I run my app I am getting "This page is having a problem". No further information is available on the page.
This is my template:

<button [ngStyle]="{'background-color': bgcolour}" class="button">{{text}}</button>


问:
How to use snap SVG in react with next and TS?

Issue

I am trying to use SnapSVG in my react project, but I cannot get it to run in the first place. Could someone help me with the proper settings? I am not very familiar with webpack so detailed instructions would be very much appreciated.

error

```<code>index.js?46cb:602 Uncaught ReferenceError: window is not defined
at Object.<anonymous> (FILEPATH/node_modules/snapsvg/dist/snap.svg.js:485:3)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.snapsvg (FILEPATH/.next/server/pages/index.js:1291:18)
at

**webpack_require**

(FILEPATH/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./src/components/domain/top-first-view/index.tsx:9:65)
</code>```

import in React components

```<code>import * as Snap from 'snapsvg';
</code>```

package.json

```<code>"dependencies": {
    "next": "^13.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "sanitize.css": "^13.0.0",
    "sass": "^1.56.1"
 },
"devDependencies": {
    "typescript": "^4.8.4",
    "imports-loader": "^4.0.1",
    "snapsvg": "^0.5.1",
    "@types/snapsvg": "^0.5.2",
    "cjs-loader": "^0.1.0",
    ...
},
  "volta": {
    "node": "18.6.0",
    "yarn": "1.22.19"
  }
</code>```

what I've tried so far

I have tried using imports-loader as is discussed in this Github thread, but this resulted in a new error.

new error after webpack settings

```<code>Uncaught Error: ENOENT: no such file or directory, open 'FILEPATH/.next/server/pages/index.js'
at Object.openSync (node:fs:594:3)
at Object.readFileSync (node:fs:462:35)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1143:18)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.requirePage (FILEPATH/node_modules/next/dist/server/require.js:88:12)
at <unknown> (FILEPATH/Documents/GitHub/toda-web-art/node_modules/next/dist/server/load-components.js:37:73)
at async Object.loadComponents (FILEPATH/node_modules/next/dist/server/load-components.js:37:26)
</code>```

webpack config in next.config.js

```<code>  webpack(config) {
    config.module.rules.push(
      {
        test: require.resolve('snapsvg'),
        use: 'imports-loader?this=>window,fix=>module.exports=0',
      },
 ...
</code>```

Body:
Issue

I am trying to use SnapSVG in my react project, but I cannot get it to run in the first place. Could someone help me with the proper settings? I am not very familiar with webpack so detailed instructions would be very much appreciated.

error

index.js?46cb:602 Uncaught ReferenceError: window is not defined
at Object.<anonymous> (FILEPATH/node_modules/snapsvg/dist/snap.svg.js:485:3)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.snapsvg (FILEPATH/.next/server/pages/index.js:1291:18)
at

**webpack_require**

(FILEPATH/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///./src/components/domain/top-first-view/index.tsx:9:65)

import in React components

import * as Snap from 'snapsvg';

package.json

"dependencies": {
    "next": "^13.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "sanitize.css": "^13.0.0",
    "sass": "^1.56.1"
 },
"devDependencies": {
    "typescript": "^4.8.4",
    "imports-loader": "^4.0.1",
    "snapsvg": "^0.5.1",
    "@types/snapsvg": "^0.5.2",
    "cjs-loader": "^0.1.0",
    ...
},
  "volta": {
    "node": "18.6.0",
    "yarn": "1.22.19"
  }

what I've tried so far

I have tried using imports-loader as is discussed in this Github thread, but this resulted in a new error.

new error after webpack settings

Uncaught Error: ENOENT: no such file or directory, open 'FILEPATH/.next/server/pages/index.js'
at Object.openSync (node:fs:594:3)
at Object.readFileSync (node:fs:462:35)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1143:18)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.requirePage (FILEPATH/node_modules/next/dist/server/require.js:88:12)
at <unknown> (FILEPATH/Documents/GitHub/toda-web-art/node_modules/next/dist/server/load-components.js:37:73)
at async Object.loadComponents (FILEPATH/node_modules/next/dist/server/load-components.js:37:26)

webpack config in next.config.js

  webpack(config) {
    config.module.rules.push(
      {
        test: require.resolve('snapsvg'),
        use: 'imports-loader?this=>window,fix=>module.exports=0',
      },
 ...


问:
Fill a column with item from a list using For Loop in python
The case is I'm using yfinance library to collect stock timeseries data from Yahoo Finance. I want to append several companies stock data in one dataframe but I want to add a column called "Ticker" to identify the company. I want to fill the column "Ticker" with the items in a list named "tickers".

I have tried the code below, but it returns only one company name which was GOOG in the Ticker column instead of iterating the items in the list

I have tried this code

```<code>tickers = ['AAPL', 'MSFT', 'GOOG']
df = {}
df_stock = pd.DataFrame()
df_stock['Ticker'] = ''
for i in tickers:
    ticker = yf.Ticker(i)
    df[i] = pd.DataFrame(ticker.history(start='2012-01-01', end='2022-12-28', actions= False, rounding= True))
    df_stock = df_stock.append(df[i])
    if i in tickers:
        df_stock['Ticker'] = i
</code>```

It returns only one company name, I want to return all three companies name according to the collected data from Yahoo Finance

Body:
The case is I'm using yfinance library to collect stock timeseries data from Yahoo Finance. I want to append several companies stock data in one dataframe but I want to add a column called "Ticker" to identify the company. I want to fill the column "Ticker" with the items in a list named "tickers".

I have tried the code below, but it returns only one company name which was GOOG in the Ticker column instead of iterating the items in the list

I have tried this code

tickers = ['AAPL', 'MSFT', 'GOOG']
df = {}
df_stock = pd.DataFrame()
df_stock['Ticker'] = ''
for i in tickers:
    ticker = yf.Ticker(i)
    df[i] = pd.DataFrame(ticker.history(start='2012-01-01', end='2022-12-28', actions= False, rounding= True))
    df_stock = df_stock.append(df[i])
    if i in tickers:
        df_stock['Ticker'] = i

It returns only one company name, I want to return all three companies name according to the collected data from Yahoo Finance


问:
Execution failed for task ':app:packageDebug' ... Too many zip entries 236220 (MAX=65535)
I'm executing cordova build -d but keep getting this error at 94% complete:

Here's a screenshot of the MacOs terminal error

Here's a partial transcription of the screenshot:

* What went wrong:
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > Too many zip entries 236220 (MAX=65535)
```

I haven't been able to find any info about this online. Does anyone have any ideas how to resolve?
I tried gradle clean then gradle build, increasing org.gradle.jvmargs size, and updating from gradle 7.6 to 8.

Body:
I'm executing cordova build -d but keep getting this error at 94% complete:

Here's a screenshot of the MacOs terminal error

Here's a partial transcription of the screenshot:

* What went wrong:
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > Too many zip entries 236220 (MAX=65535)

I haven't been able to find any info about this online. Does anyone have any ideas how to resolve?
I tried gradle clean then gradle build, increasing org.gradle.jvmargs size, and updating from gradle 7.6 to 8.


问:
How to Add Comment On Post In WordPress using Rest Api in Android Studio?
i am very new to Android Studio and making app from my WordPress Website , i have done all things except Add comment on posts, i want users can post comment on post from app but the problem is i don't know how to add comment using REST API and Retrofit.

i have added this in function

```<code>add_filter( 'rest_allow_anonymous_comments', '__return_true' );
</code>```

and i found this code on Google for comment using REST API

```<code>https://example.com/wp-json/wp/v2/comments?post=192&author_email=mytestemail@gmail.com&author_name=TestName&content=ThisIsTestContent
</code>```

yes ofcourse it will not work in browser , will it work in App and how can i Implement it ? if not this then is there any other simple solution to post comment using Retrofit and Rest Api ? thanks

i found nothing on internet regarding it , please help

Body:
i am very new to Android Studio and making app from my WordPress Website , i have done all things except Add comment on posts, i want users can post comment on post from app but the problem is i don't know how to add comment using REST API and Retrofit.

i have added this in function

add_filter( 'rest_allow_anonymous_comments', '__return_true' );

and i found this code on Google for comment using REST API

https://example.com/wp-json/wp/v2/comments?post=192&author_email=mytestemail@gmail.com&author_name=TestName&content=ThisIsTestContent

yes ofcourse it will not work in browser , will it work in App and how can i Implement it ? if not this then is there any other simple solution to post comment using Retrofit and Rest Api ? thanks

i found nothing on internet regarding it , please help


问:
How to test component that disappears on window resize?
I have a button which appears on the screen till the window width is 300px and after that, it disappears.

Here is the code:

```<code><button className='Button'>Submit</button>
</code>```

CSS code:

```<code>.Button{
   color: cyan;

   @media( min-width: 300px){
      display: none;
   }

}
</code>```

For testing, I am using react testing library and jest. Please guide me on how to test resize events.

Body:
I have a button which appears on the screen till the window width is 300px and after that, it disappears.

Here is the code:

<button className='Button'>Submit</button>

CSS code:

.Button{
   color: cyan;

   @media( min-width: 300px){
      display: none;
   }

}

For testing, I am using react testing library and jest. Please guide me on how to test resize events.


问:
how to get or set git global config using libgit2sharp
I am learning C# and trying to develop a git client, currently using the library: libgit2sharp,

Now I have a requirement to display and support modification of git global config, such as "user.name" or "user.email".

bug I did not find the corresponding documentation in the official wiki

One more question, I am running the program on a Windows Arm64 device and libgit2sharp doesn't seem to support it, is that true?

Windows Arm64 Error Image:
enter image description here


问:
How to play sound with alert message at the same time in React
So I want to play sound with alert message at the same time. When I put alert function and audio.play() function in one functions and call it in onClik() button, sound is being played after you click  on "ok" button of pop up alert.
So how can I make them to be executed at the same time?
MY code is below:</p>
```<code>_onNextPage() {
        const newPageNum = Math.min(
            this.state.pageNum + 1,
            this.state.content.maxPageNum - 1);

        if (newPageNum === this.state.content.maxPageNum - 1) {
            const audio = new Audio();
            audio.play();
            alert("Last page");

            return;
        }

        this.setState({
            pageNum: newPageNum,
        });

        if (this.isTeacher || this.isPreUser) {
            this._onUpdatePageNumForTeacher(newPageNum);
        }
    }

</code>```

Body:
So I want to play sound with alert message at the same time. When I put alert function and audio.play() function in one functions and call it in onClik() button, sound is being played after you click  on "ok" button of pop up alert.
So how can I make them to be executed at the same time?
MY code is below:

_onNextPage() {
        const newPageNum = Math.min(
            this.state.pageNum + 1,
            this.state.content.maxPageNum - 1);

        if (newPageNum === this.state.content.maxPageNum - 1) {
            const audio = new Audio();
            audio.play();
            alert("Last page");

            return;
        }

        this.setState({
            pageNum: newPageNum,
        });

        if (this.isTeacher || this.isPreUser) {
            this._onUpdatePageNumForTeacher(newPageNum);
        }
    }


问:
How to set the first character background color with match_parent height in TextView?
Here is the TextView that I am working with:

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/txt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:singleLine="true"
        android:text="TextView for test only"
        android:textColor="#fff" />

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

The default text color is white. My goal is to change the color of the first character to black and the background color of the first character to white. This is the code I am currently using:

```<code>TextView txt = (TextView) findViewById(R.id.txt);
SpannableStringBuilder sp = new SpannableStringBuilder(txt.getText());
sp.setSpan(new BackgroundColorSpan(Color.WHITE), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sp.setSpan(new ForegroundColorSpan(Color.BLACK), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
txt.setText(sp);
</code>```

Everything functions as expected, with the exception of the background color of the first character. I need it to take up the full height of the TextView, not just the space between the text.

This is the current result:

And this is the desired outcome: (Created using Figma)

I hope this provides a clear understanding of my issue. Thank you for your help.

Body:
Here is the TextView that I am working with:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/txt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:singleLine="true"
        android:text="TextView for test only"
        android:textColor="#fff" />

</androidx.constraintlayout.widget.ConstraintLayout>

The default text color is white. My goal is to change the color of the first character to black and the background color of the first character to white. This is the code I am currently using:

TextView txt = (TextView) findViewById(R.id.txt);
SpannableStringBuilder sp = new SpannableStringBuilder(txt.getText());
sp.setSpan(new BackgroundColorSpan(Color.WHITE), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sp.setSpan(new ForegroundColorSpan(Color.BLACK), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
txt.setText(sp);

Everything functions as expected, with the exception of the background color of the first character. I need it to take up the full height of the TextView, not just the space between the text.

This is the current result:

And this is the desired outcome: (Created using Figma)

I hope this provides a clear understanding of my issue. Thank you for your help.


问:
how to upload the blob files list to node server using multer
i am currently working on my upload file page and below is the upload function on the client side
and i want the client to check the image first before upload to the server

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Upload Testing</title>
</head>
<body>
    <h1>Upload img</h1>
    <form action="/upload" method="post" enctype="multipart/form-data" id="form"></form>
    <button id="submit" onclick="upload()">Submit</button>

<!-- <script src="main.js"></script> -->
<script>
    function multipleImageUpload() {
    const input = document.createElement("input");
    input.setAttribute("type", "file");
    input.setAttribute("multiple", "multiple");
    const preview = document.createElement("div");
    preview.setAttribute("id", "preview");

    document.body.appendChild(preview);
    input.addEventListener("change", (event) => {
      const files = event.target.files;
      for (let i = 0; i < files.length; i++) {
        const img = document.createElement("img");
        img.setAttribute("src", URL.createObjectURL(files[i]));
        const removeBtn = document.createElement("button");
        removeBtn.innerHTML = "Remove";
        removeBtn.addEventListener("click", () => {
          preview.removeChild(img);
          preview.removeChild(removeBtn);
        });
        preview.appendChild(img);
        preview.appendChild(removeBtn);
      }
    });

    document.getElementById('form').append(input);
  }
  multipleImageUpload()

  function upload(){
    const imgs = preview.querySelectorAll("img");
      const files = [];
      for (let i = 0; i < imgs.length; i++) {
        files.push(imgs[i].src);
      }
      console.log(files);
  //submit
    //   document.getElementById('form').submit()
  }
</script>
</body>
</html>
</code>```

inside the files is blob file link

how to read these array of blob to behave as File

then inlude it inside my form

when i click sumit these blob file must be submitted too in node server

My Server

```<code>var express = require('express');
var router = express.Router();
const multer = require('multer')
const upload = multer({
  dest:'uploads/'
})

const cpUpload = upload.fields([{name:'files'}])

router.get('/', function(req, res, next) {
  res.render('upload/index');
});

router.post('/', cpUpload,(req, res, next)=>{
  console.log(req.files);
})

module.exports = router;
</code>```

i tried converting to files these blob as new File() method but it didnt work because i have to read the blob as file first to add parameter in new File() even if i input it in the File,

i have to put them in the new FormData()

i dont know how that work

when log the form data theres no values

Body:
i am currently working on my upload file page and below is the upload function on the client side
and i want the client to check the image first before upload to the server

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Upload Testing</title>

Upload img

    <form action="/upload" method="post" enctype="multipart/form-data" id="form"></form>
    <button id="submit" onclick="upload()">Submit</button>

inside the files is blob file link

how to read these array of blob to behave as File

then inlude it inside my form

when i click sumit these blob file must be submitted too in node server

My Server

var express = require('express');
var router = express.Router();
const multer = require('multer')
const upload = multer({
  dest:'uploads/'
})

const cpUpload = upload.fields([{name:'files'}])

router.get('/', function(req, res, next) {
  res.render('upload/index');
});

router.post('/', cpUpload,(req, res, next)=>{
  console.log(req.files);
})

module.exports = router;

i tried converting to files these blob as new File() method but it didnt work because i have to read the blob as file first to add parameter in new File() even if i input it in the File,

i have to put them in the new FormData()

i dont know how that work

when log the form data theres no values


问:
what is the difference between writing composables and exporting stuff separately?
We're developing an application on vue3-composition-api.

so we are developing scripts on this concept called composables. We use this composables in different places for reusing stuff instead of rewriting them, The problem is that some parts of the composables are created but not being used and it seems to have an impact on performance. Checkout these three approaches.

useFeatureA.js - FIRST APPROACH (using stateful composables)

```<code>export function useFeatureA() {
  const x = ref(false)
  const y = computed(() => {
    // uses x.value
  })
  const z = computed(() => {
    // uses x.value
  })

  const foo = () => {
    // uses y.value and z.value
    // sets on x.value
  }
  const bar = () => {
    // uses z.value
    // sets on x.value
  }

  return { y, foo, bar }
}
</code>```

useFeatureA.js - SECOND APPROACH (exporting separately and recompute everytime)

```<code>export const getX = () => {
    return ref(false);
}
export const getY = (x) => {
    return computed(() => {
        // uses x.value
    });
}
export const foo = (xValue, yValue) => {
   const z = // using xValue
   // uses yValue and z
   return // something to write on x
}
export const bar = (xValue) => {
    const z = // using xValue
   // uses and z
   return // something to write on x
}
</code>```

ComponentA

```<code><script setup>
    const { getX, getY, foo, bar } = useFeatureA();
    const x = getX();
    const y = getY(x);
    x.value = foo(x.value, y.value);
    x.value = bar(x.value);
</setup>
</code>```

useFeatureA.js - THIRD APPROACH (move state to component)

```<code>export const getX = () => {
    return ref(false);
}
export const getY = (x) => {
    return computed(() => {
        // uses x.value
    });
}
export const getZ = (x) => {
    return computed(() => {
        // uses x.value
    });
}
export const foo = (yValue, zValue) => {
   // uses yValue and zValue
   return // something to write on x
}
export const bar = (zValue) => {
   // uses and z
   return // something to write on x
}
</code>```

ComponentA

```<code><script setup>
    const { getX, getY, foo, bar } = useFeatureA();
    const x = getX();
    const y = getY(x);
    const z = getZ(x);
    x.value = foo(y.value, z.value);
    x.value = bar(z.value);
</setup>
</code>```

we are wondering whether this solution can be efficient or not and what the differences between these two approaches are.

NOTE: We came up with the idea of separating those two functions in two different composables but the problem is that the project is too big and this approach makes way too many composables while foo and bar are very close to each other because of being related to a specific feature. so we guess this approach of separating them on different composables is out of question.

UPDATE: we have this idea that if we need stateful composable, the second approach is a bottleneck since if the components uses the composable, after the component is destroyed, the state remains in memory.

we guess in second approach tree-shaking is more efficient.

Body:
We're developing an application on vue3-composition-api.

so we are developing scripts on this concept called composables. We use this composables in different places for reusing stuff instead of rewriting them, The problem is that some parts of the composables are created but not being used and it seems to have an impact on performance. Checkout these three approaches.

useFeatureA.js - FIRST APPROACH (using stateful composables)

export function useFeatureA() {
  const x = ref(false)
  const y = computed(() => {
    // uses x.value
  })
  const z = computed(() => {
    // uses x.value
  })

  const foo = () => {
    // uses y.value and z.value
    // sets on x.value
  }
  const bar = () => {
    // uses z.value
    // sets on x.value
  }

  return { y, foo, bar }
}

useFeatureA.js - SECOND APPROACH (exporting separately and recompute everytime)

export const getX = () => {
    return ref(false);
}
export const getY = (x) => {
    return computed(() => {
        // uses x.value
    });
}
export const foo = (xValue, yValue) => {
   const z = // using xValue
   // uses yValue and z
   return // something to write on x
}
export const bar = (xValue) => {
    const z = // using xValue
   // uses and z
   return // something to write on x
}

ComponentA


问:
How can I customize Subtotals/grand totals in Matrix visual Power bi using measures DAX
I have a matrix visual containing organisation hierarchy as rows and some custom metrics as columns.the column contains values like 100%,0%,EX. I am facing an issue when adding up these values (using inbuilt power bi Total).The issue is like when there are say 15 entries with 13 - 100%'s ,1 - 0%, 1 - EX the total will be EX.It would be great if anyone can help me with this.

Thanks in advance!

The expectation was 93% as when EX comes I want it to be removed from Numerator as well as the denominator. so the total is like 14/15 and that accounts for 93%

screenshot


问:
How to update Drag and drop Nodes in React-flow Library
When I am click on Input node that time Node drag Successfully drop..

Click on Node open input box and edit the node Name


问:
How to detect which avd is running?
There are more than one avd in my computer.
Some of them are running using background command while others are not.
I would like to check which avds are running.

I learned the commands to show all the avds:
emulator -list-avds
It returns all the avd name (same as the one when I created it).
reference: https://developer.android.com/studio/run/emulator-commandline

I also know the commands to show the runnable devices:
adb devices
It returns the name of the emulator (in the form of "emulator-{port}").
This means that this command is not what I want.
reference: https://developer.android.com/studio/command-line/adb

Would you please kindly help me to figure out which command should I use.

Title: How to detect which avd is running?


问:
Selenium standalone-chrome - how to get a file which is downloaded via javascript on client side?
I'm using selenium/standalone-chrome as docker image on my production server. For access to this server, I'm using https://github.com/php-webdriver/php-webdriver. Everything works fine so far. But how do I get a via javascript generated/downloaded file to my php client? There are many examples out there, but this file part is not included :(</p>


问:
how to prevent to download resources every time when refresh the page in react js app

I want the page download this resources only one time