问:
KeepAlived Web Cluster in GCP
I want to make a redundancy on 2 ReverseProxy with KeepAlived in GCP. KeepAlived works with VirtualIP, i saw that multicast wasn't available on private cloud environement so i configured it with unycast, but it seems that the IP isn't reachable.

Do i have to made a specific things for the IP to be reachable like reserved it ? Or use a "floating IP" like i saw on Google Cloud.

I already try to use it but it doesn't seems to work.

Thank you in advance for your answer.

Victor Ultre

Solve my problem..

Title: KeepAlived Web Cluster in GCP


来源: stackexchange

问:
How to code Arduino used countdown timer (buzzer), 4 pir sensors, and relay? They worked parallel but what I need is work sequentially
How do you program Arduino to do a countdown timer 10 times using a buzzer, then after that, the light will turn on (relay). In addition, 4 PIR sensors will detect movement, if there is movement, the light will turn off for 10 seconds after which the light will turn on again. I already try to code but something feels off because the light is on at the start and the sensor detects when the timer is still running.

Here is the code that I try to code:

```<code>#define relayPin 12
#define pirPin1 8
#define pirPin2 9
#define pirPin3 10
#define pirPin4 11

int val1 = 0,val2 = 0, val3 = 0, val4 = 0 ;
long buzzerFrequency = 1000;
float buzzerDuration = 100;
int startNumber = 9; //countdown starts with this number
int endNumber = 0; //countdown ends with this number
const int buzzerPin = 6;

void setup() {
  // put your setup code here, to run once:
  pinMode(buzzerPin,OUTPUT);
  pinMode(relayPin,OUTPUT);
  pinMode(pirPin1, INPUT);
  pinMode(pirPin2, INPUT);
  pinMode(pirPin3, INPUT);
  pinMode(pirPin4, INPUT);
  Serial.begin(115200);
}

void buzzer(){
     if (startNumber >= endNumber) {
     for (int i = 0; i <= 1; i++){
      tone(buzzerPin,buzzerFrequency,buzzerDuration);
     }
     delay(1000);
     startNumber--;
     }
}

void allPir(){
 val1 = digitalRead(pirPin1);
 val2 = digitalRead(pirPin2);
 val3 = digitalRead(pirPin3);
 val4 = digitalRead(pirPin4);

  if(val1 == HIGH || val2 == HIGH || val3 == HIGH || val4 == HIGH){
    digitalWrite(relayPin, HIGH);
    Serial.println("Movement! delay 10 second");
    Serial.println("Light off");
    delay(10000);
  }else{
    digitalWrite(relayPin, LOW);
    Serial.println("No Movement");
    Serial.println("Light on");
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  buzzer();
  allPir();
}

</code>```

The countdown should have finished first with a buzzer sound, then the light will turn on, then the PIR sensor will check the environment. How to fix it? and what do I need to add?

ContentLicense: CC BY-SA 4.0

Body:
How do you program Arduino to do a countdown timer 10 times using a buzzer, then after that, the light will turn on (relay). In addition, 4 PIR sensors will detect movement, if there is movement, the light will turn off for 10 seconds after which the light will turn on again. I already try to code but something feels off because the light is on at the start and the sensor detects when the timer is still running.

Here is the code that I try to code:

#define relayPin 12
#define pirPin1 8
#define pirPin2 9
#define pirPin3 10
#define pirPin4 11

int val1 = 0,val2 = 0, val3 = 0, val4 = 0 ;
long buzzerFrequency = 1000;
float buzzerDuration = 100;
int startNumber = 9; //countdown starts with this number
int endNumber = 0; //countdown ends with this number
const int buzzerPin = 6;

void setup() {
  // put your setup code here, to run once:
  pinMode(buzzerPin,OUTPUT);
  pinMode(relayPin,OUTPUT);
  pinMode(pirPin1, INPUT);
  pinMode(pirPin2, INPUT);
  pinMode(pirPin3, INPUT);
  pinMode(pirPin4, INPUT);
  Serial.begin(115200);
}

void buzzer(){
     if (startNumber >= endNumber) {
     for (int i = 0; i <= 1; i++){
      tone(buzzerPin,buzzerFrequency,buzzerDuration);
     }
     delay(1000);
     startNumber--;
     }
}

void allPir(){
 val1 = digitalRead(pirPin1);
 val2 = digitalRead(pirPin2);
 val3 = digitalRead(pirPin3);
 val4 = digitalRead(pirPin4);

  if(val1 == HIGH || val2 == HIGH || val3 == HIGH || val4 == HIGH){
    digitalWrite(relayPin, HIGH);
    Serial.println("Movement! delay 10 second");
    Serial.println("Light off");
    delay(10000);
  }else{
    digitalWrite(relayPin, LOW);
    Serial.println("No Movement");
    Serial.println("Light on");
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  buzzer();
  allPir();
}

The countdown should have finished first with a buzzer sound, then the light will turn on, then the PIR sensor will check the environment. How to fix it? and what do I need to add?


问:
CORS redirect issue on a local development environment Laravel and Vue project
I'm having some CORS issues. In my environment I have:

Laravel project running on 127.0.0.1:8000

Vue project running on localhost:8080

This is the configuration of Vue:

```<code>const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:8000',
        changeOrigin: true
      },
      '/sanctum': {
        target: 'http://127.0.0.1:8000',
        changeOrigin: true,
      }
    }
  }
})
</code>```

I'm trying to do the following requests to the Laravel server:

```<code>axios.get('sanctum/csrf-cookie').then(() => {
    axios.post('api/login', {
        email: email,
        password: password
    }).then(response => {
        this.user = response.data.user
        this.token = response.data.token
    })
})
</code>```

In the first request, the XSRF token is being set. The second request to 'api/login', however, is receiving a 302 redirection to 127.0.0.1:8000 (the /api/login route is not being considered).
The Javascript console is showing the following error:
Access to XMLHttpRequest at 'http://127.0.0.1:8000/' (redirected from 'http://localhost:8080/api/login') from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I've tried changing both client and server side configurations but I'm always going back to where I started from.

Some additional details:

if I do the login request directly toward 127.0.0.1:8000/api/login, I receive a CSRF mismatch error from Laravel (so there is not a CORS issue)

this is how the API login route is configured:

Route::post('login', '\App\Http\Controllers\Auth\LoginController@apiLogin');

Body:
I'm having some CORS issues. In my environment I have:

Laravel project running on 127.0.0.1:8000

Vue project running on localhost:8080

This is the configuration of Vue:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:8000',
        changeOrigin: true
      },
      '/sanctum': {
        target: 'http://127.0.0.1:8000',
        changeOrigin: true,
      }
    }
  }
})

I'm trying to do the following requests to the Laravel server:

axios.get('sanctum/csrf-cookie').then(() => {
    axios.post('api/login', {
        email: email,
        password: password
    }).then(response => {
        this.user = response.data.user
        this.token = response.data.token
    })
})

In the first request, the XSRF token is being set. The second request to 'api/login', however, is receiving a 302 redirection to 127.0.0.1:8000 (the /api/login route is not being considered).
The Javascript console is showing the following error:
Access to XMLHttpRequest at 'http://127.0.0.1:8000/' (redirected from 'http://localhost:8080/api/login') from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I've tried changing both client and server side configurations but I'm always going back to where I started from.

Some additional details:

if I do the login request directly toward 127.0.0.1:8000/api/login, I receive a CSRF mismatch error from Laravel (so there is not a CORS issue)

this is how the API login route is configured:

Route::post('login', '\App\Http\Controllers\Auth\LoginController@apiLogin');


问:
Why do we need to override the DefaultMethodSecurityExpressionHandler to set up a CustomPermissionEvualuator?
It's all in the title I am currently trying to set up a CustomPermissionEvualuator for request an external ABAC service with Pre / Post Annotation through hasPermission. In my case the simple addition of the CustomPermissionEvaluator bean in my config class works and it is my PermissionEvualotar that is called during my hasPermission().

however, in many tutorials on the web, they override the

DefaultMethodSecurityExpressionHandler and set manually the CustomPermissionEvaluator, but none of them explain why.

Does somebody have an explain ?

Configuration Class :

```<code>@ConditionalOnClass(name = "org.springframework.security.access.SecurityConfig")
@ConditionalOnProperty(name = "authorization.security.enabled", havingValue = "true", matchIfMissing = true)
@Configuration
public class CustomSecurityConfig {

    @Bean
    @ConfigurationProperties(prefix = "authorization.security")
    public AuthorizationSecurityConfig authorizationSecurityConfigBean() {
        return new AuthorizationSecurityConfig();
    }

    @Bean
    public CustomPermissionEvaluator customPermissionEvaluator(AuthorizationSecurityConfig authorizationSecurityConfig) {
        return new CustomPermissionEvaluator(authorizationSecurityConfig);
    }

}
</code>```

Debug screen

Example of tutorial who override the Handler :
https://www.baeldung.com/spring-security-create-new-custom-security-expression

Thank you in advance,

Body:
It's all in the title I am currently trying to set up a CustomPermissionEvualuator for request an external ABAC service with Pre / Post Annotation through hasPermission. In my case the simple addition of the CustomPermissionEvaluator bean in my config class works and it is my PermissionEvualotar that is called during my hasPermission().

however, in many tutorials on the web, they override the

DefaultMethodSecurityExpressionHandler and set manually the CustomPermissionEvaluator, but none of them explain why.

Does somebody have an explain ?

Configuration Class :

@ConditionalOnClass(name = "org.springframework.security.access.SecurityConfig")
@ConditionalOnProperty(name = "authorization.security.enabled", havingValue = "true", matchIfMissing = true)
@Configuration
public class CustomSecurityConfig {

    @Bean
    @ConfigurationProperties(prefix = "authorization.security")
    public AuthorizationSecurityConfig authorizationSecurityConfigBean() {
        return new AuthorizationSecurityConfig();
    }

    @Bean
    public CustomPermissionEvaluator customPermissionEvaluator(AuthorizationSecurityConfig authorizationSecurityConfig) {
        return new CustomPermissionEvaluator(authorizationSecurityConfig);
    }

}

Debug screen

Example of tutorial who override the Handler :
https://www.baeldung.com/spring-security-create-new-custom-security-expression

Thank you in advance,


问:
Set and comparator
I am trying to understand the behavior of this following piece of code.

```<code>#include <iostream>
#include <string>
#include <set>
using namespace std;

struct cmp {
    bool operator() (int a, int b) const {
        cout<<"This is a-->"<<a<<" "<<endl;
        cout<<"This is b-->"<<b<<" "<<endl;
        return a < b;
    }
};

int main() {
    set<int, cmp> s;

    s.insert(1);
    s.insert(10);
    //s.insert(11);
    //s.insert(100);

    for (int x : s)
        cout << x << ' ';

    return 0;
}
</code>```

The output that I am getting for this is

```<code>This is a-->10
This is b-->1
This is a-->1
This is b-->10
This is a-->10
This is b-->1
1 10
</code>```

I understand what this code does is that it sorts the elements of the set in ascending order but why is the comparator is being called 3 times? And why in the first case a is 10 but in the second case a is 1 and again in the third case it is 10?

And when I modify the code slightly to store the elements in the decreasing order, like below

```<code>#include <iostream>
#include <string>
#include <set>
using namespace std;

struct cmp {
    bool operator() (int a, int b) const {
        cout<<"This is a-->"<<a<<" "<<endl;
        cout<<"This is b-->"<<b<<" "<<endl;
        return a > b;
    }
};

int main() {
    set<int, cmp> s;

    s.insert(1);
    s.insert(10);
    //s.insert(11);
    //s.insert(100);

    for (int x : s)
        cout << x << ' ';

    return 0;
}
</code>```

Then why is the comparator function is being called only twice as seen in the output?

```<code>This is a-->10
This is b-->1
This is a-->10
This is b-->1
10 1
</code>```

It will be of great help if anyone can shed some light on this.

Title: Set and comparator

Body:
I am trying to understand the behavior of this following piece of code.

#include <iostream>
#include <string>
#include <set>
using namespace std;

struct cmp {
    bool operator() (int a, int b) const {
        cout<<"This is a-->"<<a<<" "<<endl;
        cout<<"This is b-->"<<b<<" "<<endl;
        return a < b;
    }
};

int main() {
    set<int, cmp> s;

    s.insert(1);
    s.insert(10);
    //s.insert(11);
    //s.insert(100);

    for (int x : s)
        cout << x << ' ';

    return 0;
}

The output that I am getting for this is

This is a-->10
This is b-->1
This is a-->1
This is b-->10
This is a-->10
This is b-->1
1 10

I understand what this code does is that it sorts the elements of the set in ascending order but why is the comparator is being called 3 times? And why in the first case a is 10 but in the second case a is 1 and again in the third case it is 10?

And when I modify the code slightly to store the elements in the decreasing order, like below

#include <iostream>
#include <string>
#include <set>
using namespace std;

struct cmp {
    bool operator() (int a, int b) const {
        cout<<"This is a-->"<<a<<" "<<endl;
        cout<<"This is b-->"<<b<<" "<<endl;
        return a > b;
    }
};

int main() {
    set<int, cmp> s;

    s.insert(1);
    s.insert(10);
    //s.insert(11);
    //s.insert(100);

    for (int x : s)
        cout << x << ' ';

    return 0;
}

Then why is the comparator function is being called only twice as seen in the output?

This is a-->10
This is b-->1
This is a-->10
This is b-->1
10 1

It will be of great help if anyone can shed some light on this.


问:
AntDesign Menu Condition for user login
I have old code condition for user login in AntDesign Menu

Terminal says version of menu Item is old. Here is some code

```<code> { <Menu onClick={handleClick} selectedKeys={[current]} mode="horizontal">
        {!user && (
          <Menu.Item key="register" icon={<UserAddOutlined />}>
            <Link to="/register">Đăng kí</Link>
          </Menu.Item>
        )}
        {!user && (
          <Menu.Item key="login" icon={<UserOutlined />}>
            <Link to="/login">Đăng nhập</Link>
          </Menu.Item>
        )}
      </Menu> }
</code>```

I want to know how to write it in the newest version. Can anyone give me some information?

Title: AntDesign Menu Condition for user login

Body:
I have old code condition for user login in AntDesign Menu

Terminal says version of menu Item is old. Here is some code

 { <Menu onClick={handleClick} selectedKeys={[current]} mode="horizontal">
        {!user && (
          <Menu.Item key="register" icon={<UserAddOutlined />}>
            <Link to="/register">Đăng kí</Link>
          </Menu.Item>
        )}
        {!user && (
          <Menu.Item key="login" icon={<UserOutlined />}>
            <Link to="/login">Đăng nhập</Link>
          </Menu.Item>
        )}
      </Menu> }

I want to know how to write it in the newest version. Can anyone give me some information?


问:
Getting MaxAttemptsExceedException when uploading file in a Job Queue
I am trying to upload a file to S3 using a job queue, but I keep getting a MaxAttemptsExceedException error. I have tried increasing the number of retries in the job queue, but it doesn't seem to help. It works fine in sync but when I changed it to the Redis queue, it threw an error. Has anyone else encountered this issue and found a solution?

The file size is too small, it takes milliseconds if I run without a queue.

Here is my queue config

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => env('REDIS_QUEUE', 'default'),
            'retry_after' => 90,
            'block_for' => null,
            'after_commit' => false,
        ],
```


问:
Random Forest Classifier is giving me an array of zeroes
I used VGG16 as feature extractor on a dataset with 9 classes and trained the Random Forest Classifier on the feature vector. I tried to make prediction on the test feature vector but the prediction is an array of zeroes. What am i doing wrong ?

All Zero prediction
Notebook Link

I tried fitting the RandomForestClassifier on test_feature_vector and tried to predict it on part of train_feature_vector and still got all zeroes.


问:
About getting Ast
I am adding my own js library to monaco. I want AST of code typed in editor to validate with my code.Is there any way to get AST from monaco

I need to access AST of code typed from editor

Title: About getting Ast


问:
How to run a collection with specific environment triggered from postman web-hook
I am trying to trigger the postman collection to run when code is deployed successfully through postman web-hook.

So, I created a web-hook as per their documentation Postman API, to run my collection, whenever the latest code is getting deployed on the server. The collection needs to run under specific postman environment. So when, I hit the the web-hook it has started running the collection with no environment, I did a lot of google though but haven't found any way to trigger the collection with specific environment. And the result are also getting added in different workspace even though i have added the workspace id.

Payload:

```<code>{
    "webhook":{
        "name": "Test Webhook",
        "collection": "{{collection id}}",
        "workspace" : "{{workspace id}}"
    }
}
</code>```

I am stuck in this from last few days, so need to find a way as soon as possible.

Body:
I am trying to trigger the postman collection to run when code is deployed successfully through postman web-hook.

So, I created a web-hook as per their documentation Postman API, to run my collection, whenever the latest code is getting deployed on the server. The collection needs to run under specific postman environment. So when, I hit the the web-hook it has started running the collection with no environment, I did a lot of google though but haven't found any way to trigger the collection with specific environment. And the result are also getting added in different workspace even though i have added the workspace id.

Payload:

{
    "webhook":{
        "name": "Test Webhook",
        "collection": "{{collection id}}",
        "workspace" : "{{workspace id}}"
    }
}

I am stuck in this from last few days, so need to find a way as soon as possible.


问:
Problems installing the package blandPower from Github in R Studio
I am trying to install the package blandPower from Github in a R Markdown as follows:

```<code>library(devtools)
install_github("nwisn/blandPower")
library(blandPower)
</code>```

Always getting following error message:

Error: Failed to install 'unknown package' from GitHub:
Timeout was reached: [api.github.com] Connection timed out after 10009 milliseconds

Traceback:

```<code>10.
stop(remote_install_error(remotes[[i]], e))
9.
value[[3L]](cond)
8.
tryCatchOne(expr, names, parentenv, handlers[[1L]])
7.
tryCatchList(expr, classes, parentenv, handlers)
6.
tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
stop(remote_install_error(remotes[[i]], e))
})
5.
install_remotes(remotes, auth_token = auth_token, host = host,
dependencies = dependencies, upgrade = upgrade, force = force,
quiet = quiet, build = build, build_opts = build_opts, build_manual = build_manual,
build_vignettes = build_vignettes, repos = repos, type = type, ...
4.
force(code)
3.
withr::with_path(rtools_path(), code)
2.
pkgbuild::with_build_tools({
ellipsis::check_dots_used(action = getOption("devtools.ellipsis_action",
rlang::warn))
{ ...
1.
install_github("nwisn/blandPower")

</code>```

Also tried with gihubinstall("blandPower") and gh_install_packages("blandPower"), but nothing seems to work. Not sure if maby the firewall could be the problem

Can anyone help?

Body:
I am trying to install the package blandPower from Github in a R Markdown as follows:

library(devtools)
install_github("nwisn/blandPower")
library(blandPower)

Always getting following error message:

Error: Failed to install 'unknown package' from GitHub:
Timeout was reached: [api.github.com] Connection timed out after 10009 milliseconds

Traceback:

10.
stop(remote_install_error(remotes[[i]], e))
9.
value[[3L]](cond)
8.
tryCatchOne(expr, names, parentenv, handlers[[1L]])
7.
tryCatchList(expr, classes, parentenv, handlers)
6.
tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
stop(remote_install_error(remotes[[i]], e))
})
5.
install_remotes(remotes, auth_token = auth_token, host = host,
dependencies = dependencies, upgrade = upgrade, force = force,
quiet = quiet, build = build, build_opts = build_opts, build_manual = build_manual,
build_vignettes = build_vignettes, repos = repos, type = type, ...
4.
force(code)
3.
withr::with_path(rtools_path(), code)
2.
pkgbuild::with_build_tools({
ellipsis::check_dots_used(action = getOption("devtools.ellipsis_action",
rlang::warn))
{ ...
1.
install_github("nwisn/blandPower")

Also tried with gihubinstall("blandPower") and gh_install_packages("blandPower"), but nothing seems to work. Not sure if maby the firewall could be the problem

Can anyone help?


问:
How does PM2 manages the cluster when PM2 run the application in the cluster mode?
I explored that PM2 uses the node cluster module to run the application in cluster,

node cluster module follows two approches to handle the cluster. uses the round-robin approach by default for handling cluster.

Document for how the node cluster module works

In that document they mentions like, The cluster module supports two methods of distributing incoming connections.

The first one (and the default one on all platforms except Windows) is the round-robin approach, where the primary process listens on a port, accepts new connections and distributes them across the workers in a round-robin fashion, with some built-in smarts to avoid overloading a worker process.

In the default approach, it uses the round-robin, then my assumsion is,in PM2 if the first request goes to first instance, then the second request should goes to the next instance that could be the instance 2.

But What I found is, all requests go to an instance till some time, after that time all request go to the next instance. So here what my question is,  I want to know that time duration (How long all requests are going to same instance), How the time duration is managed by PM2?


问:
Hide the selected row in prime react Datatables
I have the below code which i can select the rows for highlight, but if i want to hide the selected rows from the table below is my code

```<code>
const [hideEmployeeDialog, setHideEmployeeDialog] = useState(false);

const leftToolbarTemplate = () => {
    return (
        <React.Fragment>
            <Button label="Show" icon="pi pi-plus" className="p-button-success mr-2" />
            <Button label="Hide" icon="pi pi-minus" className="p-button-success mr-2" onClick = {hideSelectedEmployeeDialogue}/>
            <Button label="Delete" icon="pi pi-trash" className="p-button-danger"/>
        </React.Fragment>
    )
}

const hideSelectedEmployeeDialogue = () => {
    setHideEmployeeDialog(true);
}

const hideEmployeeList = [];
const hideSelectedEmployee = () => {
    for (let i = 0; i < selectedEmployee.length; i++) {
        hideEmployeeList.push(selectedEmployee[i].id);
    }
    // hideEmployeeList gettig all the selected row ids to hide
    // But i need to hide these ids from the table
    setHideEmployeeDialog(false);
}

const deleteMultipleEmployeeDialogFooter = (
<React.Fragment>
    <Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteEmployeeDialog} />
    <Button label="Yes" icon="pi pi-check" className="p-button-text" onClick={deleteMultipleEmployee}/>
</React.Fragment>
);

<Toolbar className="mb-4" left={leftToolbarTemplate}></Toolbar>
<DataTable ref={dt} value={rows} selection={selectedEmployee} onSelectionChange={(e) => {setEmployeeDataId(e.value); setSelectedEmployee(e.value);}}
dataKey="id" globalFilter={globalFilter} responsiveLayout="scroll">
<Column selectionMode="multiple" headerStyle={{ width: '2rem' }} exportable={false}></Column>
<Column header="Action" body={actionBodyTemplate} exportable={false} style={{ minWidth: '2rem' }}></Column>
<Column field="name" header="Name" sortable style={{ minWidth: '2rem' }}></Column>
<Column field="workingTime" header="Working Time" sortable style={{ minWidth: '2rem' }}></Column>
</DataTable>
</div>

<Dialog visible={hideEmployeeDialog} style={{ width: '450px' }} header="Confirm" modal footer={hideEmployeeDialogFooter} onHide={hideDeleteEmployeeDialog}>
    <div className="confirmation-content">
        <i className="pi pi-exclamation-triangle mr-3" style={{ fontSize: '2rem' }} />
        {employee && <span>Are you sure you want to Hide selected employees<b>{employee.name}</b>?</span>}
    </div>
</Dialog>

</code>```

When click on the row the given employees row is highlight into the table

But in same case i want to choose multiple rows and make them as hide from table not delete
Like 1,2,3,4 are my rows then if am select 1,2 then both rows should be view in disable mode

Body:
I have the below code which i can select the rows for highlight, but if i want to hide the selected rows from the table below is my code

const [hideEmployeeDialog, setHideEmployeeDialog] = useState(false);

const leftToolbarTemplate = () => {
    return (
        <React.Fragment>
            <Button label="Show" icon="pi pi-plus" className="p-button-success mr-2" />
            <Button label="Hide" icon="pi pi-minus" className="p-button-success mr-2" onClick = {hideSelectedEmployeeDialogue}/>
            <Button label="Delete" icon="pi pi-trash" className="p-button-danger"/>
        </React.Fragment>
    )
}

const hideSelectedEmployeeDialogue = () => {
    setHideEmployeeDialog(true);
}

const hideEmployeeList = [];
const hideSelectedEmployee = () => {
    for (let i = 0; i < selectedEmployee.length; i++) {
        hideEmployeeList.push(selectedEmployee[i].id);
    }
    // hideEmployeeList gettig all the selected row ids to hide
    // But i need to hide these ids from the table
    setHideEmployeeDialog(false);
}

const deleteMultipleEmployeeDialogFooter = (
<React.Fragment>
    <Button label="No" icon="pi pi-times" className="p-button-text" onClick={hideDeleteEmployeeDialog} />
    <Button label="Yes" icon="pi pi-check" className="p-button-text" onClick={deleteMultipleEmployee}/>
</React.Fragment>
);

<Toolbar className="mb-4" left={leftToolbarTemplate}></Toolbar>
<DataTable ref={dt} value={rows} selection={selectedEmployee} onSelectionChange={(e) => {setEmployeeDataId(e.value); setSelectedEmployee(e.value);}}
dataKey="id" globalFilter={globalFilter} responsiveLayout="scroll">
<Column selectionMode="multiple" headerStyle={{ width: '2rem' }} exportable={false}></Column>
<Column header="Action" body={actionBodyTemplate} exportable={false} style={{ minWidth: '2rem' }}></Column>
<Column field="name" header="Name" sortable style={{ minWidth: '2rem' }}></Column>
<Column field="workingTime" header="Working Time" sortable style={{ minWidth: '2rem' }}></Column>
</DataTable>

<Dialog visible={hideEmployeeDialog} style={{ width: '450px' }} header="Confirm" modal footer={hideEmployeeDialogFooter} onHide={hideDeleteEmployeeDialog}>

        {employee && Are you sure you want to Hide selected employees{employee.name}?}

</Dialog>

When click on the row the given employees row is highlight into the table

But in same case i want to choose multiple rows and make them as hide from table not delete
Like 1,2,3,4 are my rows then if am select 1,2 then both rows should be view in disable mode


问:
AzureDevOps Extension development using Visual Studio Code - Can't Debug anymore - Breakspoints ignored
I'm developing an AzureDevOps Extension with Visual Studio Code.
I'm using the Formula Design System from Microsoft (React, TypeScript).

We are using a vm where AzureDevOps and Visual Studio Code are installed.
So, that we are able to execute and debug the Extension locally.

That worked well, but for the last 2 or 3 months I'm not able to Debug the Code.
Breakpoints are ignored.

At first I thougt that the latest Version from Firefox (auto update is activated)
is responsible for that behavior. Because the Visual Studio Code Extension
"Debugger for Firefox" does not supprt the latest firefox version for debugging.

So i uninstalled firefox and installed an older supported version from Firefox.
But the behavior is the same. Breakpoints are ignored.

Since Yesterday it seems that only Breakspoints in the Frontend (ReactCode) are reached.
Backendcode Breakpoints still ignored.

A littlebit weird is that calls like console.info(), console.warn() are not shown in the console.
And an alert() call does not open the appropriate Messagebox when the Extension calls them.
I dont know if it's because the extension runs through an iframe an Microsoft supresses alert calls from there.

The stated calls are definitely in reachable code, because if its not the whole extension does not work.

The workflow:

starting Firefox with AzureDevOps Tab open

starting Visual Studio Code

executing in Visual Studio Code: npm run start:dev

everthing gets compiled

setting breakpoints

execute firefox from visual studio code für Debugging

the adress line gets some colored stripes that indicats that the prozess is attached.

open extension to reached Breakpoints ... nothing happend.

Versions:
Visual Studio Code - latest
intsalled Extension: Debugger for Firefox - v2.9.8
Firefox - 106.0.5

Does anyone have any idea where the problem could be?


问:
How to add Regular Expression in Javascript?
I have a Requirement for password pattern as below
=> Password Should contain atleast 1 upper case character
=> Password Should contain atleast 1 lower case character
=> Password Should contain atleast 1 number
=> Password Should contain atleast 1 special character !@$&</p>


问:
update issue with image validation in php
I am new to PHP web development and making a simple website for adding products and categories and I am facing an issue with the update CRUD operation for the categories
when I upload an image.

Updating the image when less than 2MB is ok and the old image will be deleted, for the other scenarios when image is more than 2MB or upload different image extension than the allowed ones it's not being validated only the image name gets added to the database, below is my code and appreciate the help

```<code>include("../config/dbconn.php");
if (isset($_POST['update'])) {
    $cat_id = mysqli_real_escape_string($dbconn, $_POST['cat_id']);
    $cat_name = mysqli_real_escape_string($dbconn, $_POST['cat_name']);

    $pervious_cat_name = filter_var($_POST['pervious_cat_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
    $cat_img = $_FILES['cat_img'];

    // checking empty fields
    if (empty($cat_name) || empty($cat_img)) {

        if (empty($cat_name)) {
            echo "<font color='red'>category name field is empty!</font><br/>";
        }

        if (empty($cat_img)) {
            echo "<font color='red'>image field is empty!</font><br/>";
        }
    } else {

        //updating the table
        if ($cat_img['name']) {

            $pervious_cat_path = '../../uploads/' . $pervious_cat_name;

            if ($pervious_cat_path) {
                unlink($pervious_cat_path);
            }

            $cat_img_name = $cat_img['name'];
            $cat_temp_name = $cat_img['tmp_name'];
            $cat_img_destination_path = '../../uploads/' . $cat_img_name;

            $allow_files = ['png', 'jpg', 'jpeg','webp'];
            $extension = explode('.', $cat_img_name);
            $extension = end($extension);

            if (in_array($extension, $allow_files)) {
                if ($cat_img['size'] < 2000000) {
                    move_uploaded_file($cat_temp_name, $cat_img_destination_path);
                } else {
                    $_SESSION['category_update'] = "couldn't update category, image size is too large";
                }
            } else {
                $_SESSION['category_update'] = "couldn't update category, image should be png, jpg, jpeg";
            }
        }

        $cat_img_to_insert = $cat_img_name ?? $pervious_cat_name;

        $query = "UPDATE category SET cat_name='$cat_name', cat_img='$cat_img_to_insert'  WHERE cat_id=$cat_id";
        $result = mysqli_query($dbconn, $query);

        if ($result) {
            //redirecting to the display page. In our case, it is index.php
            header("Location: admin_panel.php");
        }
    }
}
?>
</code>```

below are a couple of images to see the results:
ok uploaded an image less than 2MB and in the allowed extensions.

image bigger than 2MB and in the allowed extensions.

not allowed image extensions:

appreciate the support.

Body:
I am new to PHP web development and making a simple website for adding products and categories and I am facing an issue with the update CRUD operation for the categories
when I upload an image.

Updating the image when less than 2MB is ok and the old image will be deleted, for the other scenarios when image is more than 2MB or upload different image extension than the allowed ones it's not being validated only the image name gets added to the database, below is my code and appreciate the help

include("../config/dbconn.php");
if (isset($_POST['update'])) {
    $cat_id = mysqli_real_escape_string($dbconn, $_POST['cat_id']);
    $cat_name = mysqli_real_escape_string($dbconn, $_POST['cat_name']);

    $pervious_cat_name = filter_var($_POST['pervious_cat_name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
    $cat_img = $_FILES['cat_img'];

    // checking empty fields
    if (empty($cat_name) || empty($cat_img)) {

        if (empty($cat_name)) {
            echo "category name field is empty!
";
        }

        if (empty($cat_img)) {
            echo "image field is empty!
";
        }
    } else {

        //updating the table
        if ($cat_img['name']) {

            $pervious_cat_path = '../../uploads/' . $pervious_cat_name;

            if ($pervious_cat_path) {
                unlink($pervious_cat_path);
            }

            $cat_img_name = $cat_img['name'];
            $cat_temp_name = $cat_img['tmp_name'];
            $cat_img_destination_path = '../../uploads/' . $cat_img_name;

            $allow_files = ['png', 'jpg', 'jpeg','webp'];
            $extension = explode('.', $cat_img_name);
            $extension = end($extension);

            if (in_array($extension, $allow_files)) {
                if ($cat_img['size'] < 2000000) {
                    move_uploaded_file($cat_temp_name, $cat_img_destination_path);
                } else {
                    $_SESSION['category_update'] = "couldn't update category, image size is too large";
                }
            } else {
                $_SESSION['category_update'] = "couldn't update category, image should be png, jpg, jpeg";
            }
        }

        $cat_img_to_insert = $cat_img_name ?? $pervious_cat_name;

        $query = "UPDATE category SET cat_name='$cat_name', cat_img='$cat_img_to_insert'  WHERE cat_id=$cat_id";
        $result = mysqli_query($dbconn, $query);

        if ($result) {
            //redirecting to the display page. In our case, it is index.php
            header("Location: admin_panel.php");
        }
    }
}
?>

below are a couple of images to see the results:
ok uploaded an image less than 2MB and in the allowed extensions.

image bigger than 2MB and in the allowed extensions.

not allowed image extensions:

appreciate the support.


问:
Component dynamic progress bar function does not work
so basically I made a separate progress bar component, it's a dynamic circular bar.
And I placed 2 of them in a dashboard component, the first one works very fine, but the second remains static at 0% and did not call the progress function.
ps: I use Tailwindcss Can you please help me fix that?

Here is the Dashboard component:

```<code>import React, { Component } from 'react'
import { connect } from 'react-redux';
import { getUserInfo } from '../actions/userActions';
import { Link } from 'react-router-dom';
import ProgressBar from './progressBar';

class Dashboard extends Component {

    state = {
        user: {

        }
    }

    componentDidMount(){
        this.props.getUserInfo();
        this.setState({
          user : this.props.currentUser
        })
    }

  render() {

    const { user } = this.state;

    return (
      <div className='w-full h-auto bg-slate-100 p-4'>

        { (user?.isLoggedIn == true) ? <div className='dashboard'>
          <div className='w-full flex h-auto mt-14'>

            <div className='border-2 border-slate-500 relative block text-center w-9/2 md:w-1/5 md:min-w-72 h-56 md:h-72 mr-2 mx-auto rounded-md'>
              <h1 className='balance text-2xl font-medium w-auto mx-auto mt-9 md:mt-20 md:font-semibold'>Personal balance</h1>
              <h1 className="balance text-3xl mt-6">0 $</h1>
            </div>
            <div className='border-2 border-slate-500 relative flex w-9/2 md:w-4/5 h-56 md:h-72 mx-auto rounded-md'>

            </div>

          </div>
          <div className='mt-2 p-2 border-2 border-slate-500 relative flex justify-between w-full h-56 md:h-64 mx-auto rounded-md'>
            <div className='w-28 h-28 md:w-36 md:h-36'>
              <ProgressBar percentage={99} />
            </div>
            <div className='w-28 h-28 md:w-36 md:h-36'>
              <ProgressBar percentage={99} />
            </div>
          </div>

        </div> :

        // NOT LOGGED PAGE

        <div className='w-full h-screen block mt-24'>
          <h1 className="text-xl text-red-500">You are not logged yet</h1>
          <Link to="log-in"> Login here </Link>
        </div>
        }
      </div>
    )
  }
}

const mapUserStateToProps = (state) => {
    return {
        currentUser : state.user.user
    }
}

export default connect(mapUserStateToProps, { getUserInfo })(Dashboard);
</code>```

And here is the ProgressBar component:

```<code>import React, { Component } from 'react'

class ProgressBar extends Component {

  render() {

      let progressContainer = document.querySelector('.progress-container');
      let valueContainer = document.querySelector('.progress-value');
      const speed = 20;
      let progressValue = 0;
      //let progressEndValue = 70;

      function updateElements() {
        valueContainer = document.querySelector('.progress-value');
        progressContainer = document.querySelector('.progress-container');
      }

      const createProgress = setInterval(() => {
        updateElements();
        valueContainer.innerText = `${progressValue} %`
        progressContainer.style.background = `conic-gradient(
          rgb(239 68 68) ${progressValue*3.6}deg,
          black 1deg,
          rgb(251, 202, 202)  1deg
          )`

          if (progressValue == this.props.percentage) {
            clearInterval(createProgress);
          }
          progressValue++;
        }, speed)

    return (
      <div className='progress-container w-full h-full rounded-full flex justify-center items-center'>
        <div className="w-3/4 h-3/4 rounded-full bg-slate-100 flex justify-center items-center">
            <h1 className='progress-value' >0 %</h1>
        </div>
      </div>
    )
  }
}

export default ProgressBar;
</code>```

Body:
so basically I made a separate progress bar component, it's a dynamic circular bar.
And I placed 2 of them in a dashboard component, the first one works very fine, but the second remains static at 0% and did not call the progress function.
ps: I use Tailwindcss Can you please help me fix that?

Here is the Dashboard component:

import React, { Component } from 'react'
import { connect } from 'react-redux';
import { getUserInfo } from '../actions/userActions';
import { Link } from 'react-router-dom';
import ProgressBar from './progressBar';

class Dashboard extends Component {

    state = {
        user: {

        }
    }

    componentDidMount(){
        this.props.getUserInfo();
        this.setState({
          user : this.props.currentUser
        })
    }

  render() {

    const { user } = this.state;

    return (

        { (user?.isLoggedIn == true) ?

Personal balance

0 $

              <ProgressBar percentage={99} />

              <ProgressBar percentage={99} />

 :

        // NOT LOGGED PAGE

You are not logged yet

          <Link to="log-in"> Login here </Link>

        }

    )
  }
}

const mapUserStateToProps = (state) => {
    return {
        currentUser : state.user.user
    }
}

export default connect(mapUserStateToProps, { getUserInfo })(Dashboard);

And here is the ProgressBar component:

import React, { Component } from 'react'

class ProgressBar extends Component {

  render() {

      let progressContainer = document.querySelector('.progress-container');
      let valueContainer = document.querySelector('.progress-value');
      const speed = 20;
      let progressValue = 0;
      //let progressEndValue = 70;

      function updateElements() {
        valueContainer = document.querySelector('.progress-value');
        progressContainer = document.querySelector('.progress-container');
      }

      const createProgress = setInterval(() => {
        updateElements();
        valueContainer.innerText = `${progressValue} %`
        progressContainer.style.background = `conic-gradient(
          rgb(239 68 68) ${progressValue*3.6}deg,
          black 1deg,
          rgb(251, 202, 202)  1deg
          )`

          if (progressValue == this.props.percentage) {
            clearInterval(createProgress);
          }
          progressValue++;
        }, speed)

    return (

0 %

    )
  }
}

export default ProgressBar;


问:
How to perform integration test using maven failsafe with different volume mappings for different testcases
I have a maven project which creates docker image using io.fabric8 maven plugin. I have also docker compose plugin com.dkanejs.maven.plugins.
I have a working integration test in which inside docker compose I have defined the volume mapping and it is working fine. The problem is that I am including another integration test for this and this integration test requires same files but with different content so it shouldn't be in the same folder as in the previous test.

How can I define variable volume mapping as per test cases?

plugins inside pom.xml

```<code><plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.39.1</version>
                <configuration>
                    <images>
                        <image>
                            <name>${IMAGE_NAME}:${IMAGE_TAG}</name>
                            <build>
                                <contextDir>${project.basedir}</contextDir>
                                <args>
                                    <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                                </args>
                            </build>
                        </image>
                    </images>
                    <verbose>true</verbose>
                </configuration>
                <executions>
                    <execution>
                        <id>docker:build</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Create integration test environment -->
            <plugin>
                <groupId>com.dkanejs.maven.plugins</groupId>
                <artifactId>docker-compose-maven-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <composeFile>${project.basedir}/docker-compose.yml</composeFile>
                    <detachedMode>true</detachedMode>
                    <envFile>${project.basedir}/src/test/resources/.env</envFile>
                    <envVars>
                        <IMAGE_TAG>${project.version}</IMAGE_TAG>
                        <IMAGE_NAME>${IMAGE_NAME}</IMAGE_NAME>
                    </envVars>
                </configuration>
                <executions>
                    <execution>
                        <id>docker-compose-up</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>up</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Run integration tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
</code>```

docker-compose service

```<code>service-bridge:
    image: ${IMAGE_NAME}:${IMAGE_TAG}
    container_name: ${CONTAINER_NAME}
    volumes:
      - \user\temp:/usr/share/config
    network_mode: host
</code>```

How can I define variable volume mapping as per test cases?

Body:
I have a maven project which creates docker image using io.fabric8 maven plugin. I have also docker compose plugin com.dkanejs.maven.plugins.
I have a working integration test in which inside docker compose I have defined the volume mapping and it is working fine. The problem is that I am including another integration test for this and this integration test requires same files but with different content so it shouldn't be in the same folder as in the previous test.

How can I define variable volume mapping as per test cases?

plugins inside pom.xml

<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.39.1</version>
                <configuration>
                    <images>
                        <image>
                            <name>${IMAGE_NAME}:${IMAGE_TAG}</name>
                            <build>
                                <contextDir>${project.basedir}</contextDir>
                                <args>
                                    <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                                </args>
                            </build>
                        </image>
                    </images>
                    <verbose>true</verbose>
                </configuration>
                <executions>
                    <execution>
                        <id>docker:build</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.dkanejs.maven.plugins</groupId>
                <artifactId>docker-compose-maven-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <composeFile>${project.basedir}/docker-compose.yml</composeFile>
                    <detachedMode>true</detachedMode>
                    <envFile>${project.basedir}/src/test/resources/.env</envFile>
                    <envVars>
                        <IMAGE_TAG>${project.version}</IMAGE_TAG>
                        <IMAGE_NAME>${IMAGE_NAME}</IMAGE_NAME>
                    </envVars>
                </configuration>
                <executions>
                    <execution>
                        <id>docker-compose-up</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>up</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

docker-compose service

service-bridge:
    image: ${IMAGE_NAME}:${IMAGE_TAG}
    container_name: ${CONTAINER_NAME}
    volumes:
      - \user\temp:/usr/share/config
    network_mode: host

How can I define variable volume mapping as per test cases?


问:
What Solr type fits best the following arbitrary data keys
So we have been using schemaless mode of solr, and now going to production and thinking this might cause problems. One thing seems a problem already (doubtfully), is the very big schema we have.

Data

We have some strongly typed field which are fine, but we have a sub doc we want to index which has the following format:

...({ power_point: 5, word: 10, excel: 2, ... })

so this obviously results to a very big schema.

What would be a type to mitigate this while having good performance. I know that definitely we would lose keys as fields to search with.

I also know about dynamic fields, something like:

<dynamicField name="*_exp" type="int" indexed="true"  stored="true"/>
while inserting the actual data:
...({ power_point_exp: 5, word_exp: 10, excel_exp: 2, ... })

But this also grows schema infinitely.

Is Solr able to simply index something like:

{experiences: { power_point: 5, word: 10, excel: 2, ...}}


问:
Redirect Dynamic URL with Multiple Variables Using Web.Config
[EDIT EDIT] - Is there no-one able to help me - I'm really stuck?

[EDIT] - Anybody able to help?

I'm sorry if this is a simple question but can anyone please tell me how to redirect a dynamic URL with multiple variables using a web.config file?   Our old website is written in php but I'm not sure what type of server it's on - I can't get .htaccess file code to run at all.  At least when editing the web.config file the website throws up a 500 error (so it is seeing my edits).

I need to redirect a dynamic page and point it to a static page on our new Shopify website. I have a list of about 30 variable combinations that will ultimately point to separate 30 static pages on our Shopify website.

I don't really know how to do it but tried this without success:

<rule name="Rule 15" stopProcessing="true">
    <match url="https://www.old-website.com/product-details.php" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
            <add input="{QUERY_STRING}" pattern="id1=123&id2=456" />
        </conditions>
    <action type="Redirect" url="https://www.new-website.com/products/product123456" redirectType="Permanent" />
</rule> ```

Any help will be most welcome.

Thanks

Body:
[EDIT EDIT] - Is there no-one able to help me - I'm really stuck?

[EDIT] - Anybody able to help?

I'm sorry if this is a simple question but can anyone please tell me how to redirect a dynamic URL with multiple variables using a web.config file?   Our old website is written in php but I'm not sure what type of server it's on - I can't get .htaccess file code to run at all.  At least when editing the web.config file the website throws up a 500 error (so it is seeing my edits).

I need to redirect a dynamic page and point it to a static page on our new Shopify website. I have a list of about 30 variable combinations that will ultimately point to separate 30 static pages on our Shopify website.

I don't really know how to do it but tried this without success:

<rule name="Rule 15" stopProcessing="true">
    <match url="https://www.old-website.com/product-details.php" ignoreCase="false" />
        <conditions logicalGrouping="MatchAll">
            <add input="{QUERY_STRING}" pattern="id1=123&id2=456" />
        </conditions>
    <action type="Redirect" url="https://www.new-website.com/products/product123456" redirectType="Permanent" />
</rule>

Any help will be most welcome.

Thanks


问:
Smart contract deployment error in Hyperledger Besu Network
We have setup a network using QBFT consensus protocol having four validator nodes in our network. Now we are trying to deploy one sample smart contract in that network using public_tx script, but we are facing issue at the time of deployment.

```<code>Error: Returned error: Gas price below configured minimum gas price
</code>```

This is the error that we are facing, although we have even tried with the free gas network configuration but even then we are getting this error only.

Can someone please help from the community in resolving this error?

Body:
We have setup a network using QBFT consensus protocol having four validator nodes in our network. Now we are trying to deploy one sample smart contract in that network using public_tx script, but we are facing issue at the time of deployment.

Error: Returned error: Gas price below configured minimum gas price

This is the error that we are facing, although we have even tried with the free gas network configuration but even then we are getting this error only.

Can someone please help from the community in resolving this error?


问:
How to run code from a laravel PWA in background?
I have a laravel project, which I turned into a PWA. I registered a service worker for it, but don't know how to use it to run code from the laravel components.

One of the laravel components sends a HTTP-Request after an interval of time, but as soon I lock the screen or close the PWA it stops running the HTTP-Requests, basically the app doesn't run as soon I leave it.

I tried to look into the options for background processes in PWA, but they all don't sound like what I would like to have as I want the service worker to run laravel functions, but if I unterstand it correctly the service worker can only run javascript?

Thanks in advance for any answers!


问:
Netty socket io and angular not working with onConnect Event
I'm working with netty socket io in spring and angular in the frontend. When testing the backend with Postman, everything works fine. So i want to stream data on Connect to the frontend and display it there.

To do so i got a SocketService like following:

```<code>export class SocketService {

  constructor(private socket: Socket) { }

  onGetAllDashboardData = this.socket.fromEvent<string>('getAllDashboardData');

  getAllDashboardData() {
    this.socket.emit('getAllDashboardData');
  }
}
</code>```

Calling this in my component in the onInit:

```<code>ngOnInit(): void {
    this.socketService.getAllDashboardData();
    this.socketService.onGetAllDashboardData.subscribe((res: any) => {
      this.data = res;
      console.log(this.data);
    }
}
</code>```

Does not get any data.

When testing with Postman, i can just connect to the server and listen to the event 'getAllDashboardData' and get a proper response. (see screenshot) The backend also logs, that the angular client connected.
Postman Screenshot

Body:
I'm working with netty socket io in spring and angular in the frontend. When testing the backend with Postman, everything works fine. So i want to stream data on Connect to the frontend and display it there.

To do so i got a SocketService like following:

export class SocketService {

  constructor(private socket: Socket) { }

  onGetAllDashboardData = this.socket.fromEvent<string>('getAllDashboardData');

  getAllDashboardData() {
    this.socket.emit('getAllDashboardData');
  }
}

Calling this in my component in the onInit:

ngOnInit(): void {
    this.socketService.getAllDashboardData();
    this.socketService.onGetAllDashboardData.subscribe((res: any) => {
      this.data = res;
      console.log(this.data);
    }
}

Does not get any data.

When testing with Postman, i can just connect to the server and listen to the event 'getAllDashboardData' and get a proper response. (see screenshot) The backend also logs, that the angular client connected.
Postman Screenshot


问:
How to check js file with Checkstyle
I try to check line presence in JS files with Checkstyle, but they are ignored</p>
```<code><module name="RegexpMultiline">
        <property name="format" value="TestLine"/>
        <property name="fileExtensions" value="js"/>
        <property name="minimum" value="1"/>
        <property name="maximum" value="1"/>
    </module>
</code>```

Title: How to check js file with Checkstyle

Body:
I try to check line presence in JS files with Checkstyle, but they are ignored

<module name="RegexpMultiline">
        <property name="format" value="TestLine"/>
        <property name="fileExtensions" value="js"/>
        <property name="minimum" value="1"/>
        <property name="maximum" value="1"/>
    </module>


问:
"Cannot Parse Response" error when logging in from certain countries - MongoDB Atlas Device Sync (prev. Realm Sync)
I'm using MongoDB's Atlas Device Sync (until recently it was called Realm Sync) to handle login for my iOS app, coded in Swift.

I am UK based, and the app works fine for users in the UK. However, I recently sent the app to contacts in Eastern Europe (Poland, Belarus, potentially other countries as well. One person also tried logging in using a French VPN apparently) and they've all received the same error when creating an account or logging in with an already created account.

The localised description of this error is "cannot parse response".

Unfortunately I am based in the UK so I can't replicate it on my own device. However, I know that the error when creating an account is being thrown from the below code:

```<code>app.emailPasswordAuth.registerUser(email: email!, password: password!, completion: { [weak self] (error) in
            DispatchQueue.main.async {
                guard error == nil else {
                    self!.signUpFailed(with: error!)
                    return
                }
                self!.signIn(with: self!.email!, and: self!.password!)
            }
        })
</code>```

And I know that the error when logging in to an already created account is being thrown from the below code:

```<code>app.login(credentials: Credentials.emailPassword(email: email, password: password)) { [weak self] (result) in
            DispatchQueue.main.async {
                switch result {
                case .failure(let error):
                    self!.signInFailed(with: error)
                    return
                case .success(let user):
                    self!.continueLoggingIn()
                }
            }
        }

</code>```

I'm at a bit of a loss here. I have no idea why the response can be parsed in the UK but not other countries. I assume it's an issue with Mongo/Realm but I could be wrong. If anyone can shed any light it would be greatly appreciated.

Body:
I'm using MongoDB's Atlas Device Sync (until recently it was called Realm Sync) to handle login for my iOS app, coded in Swift.

I am UK based, and the app works fine for users in the UK. However, I recently sent the app to contacts in Eastern Europe (Poland, Belarus, potentially other countries as well. One person also tried logging in using a French VPN apparently) and they've all received the same error when creating an account or logging in with an already created account.

The localised description of this error is "cannot parse response".

Unfortunately I am based in the UK so I can't replicate it on my own device. However, I know that the error when creating an account is being thrown from the below code:

app.emailPasswordAuth.registerUser(email: email!, password: password!, completion: { [weak self] (error) in
            DispatchQueue.main.async {
                guard error == nil else {
                    self!.signUpFailed(with: error!)
                    return
                }
                self!.signIn(with: self!.email!, and: self!.password!)
            }
        })

And I know that the error when logging in to an already created account is being thrown from the below code:

app.login(credentials: Credentials.emailPassword(email: email, password: password)) { [weak self] (result) in
            DispatchQueue.main.async {
                switch result {
                case .failure(let error):
                    self!.signInFailed(with: error)
                    return
                case .success(let user):
                    self!.continueLoggingIn()
                }
            }
        }

I'm at a bit of a loss here. I have no idea why the response can be parsed in the UK but not other countries. I assume it's an issue with Mongo/Realm but I could be wrong. If anyone can shed any light it would be greatly appreciated.


问:
How to implement config in AbstractHttpConfigurer's *before* local HttpSecurity code
I'm updating an internal library and applications to Spring Boot 3 (which updated to Spring Security 6).

We have common security configuration which I've updated to implement AbstractHttpConfigurer e.g.

```<code>public class WebberWebSecurityConfigurerAdapter
    extends AbstractHttpConfigurer<WebberWebSecurityConfigurerAdapter, HttpSecurity> {

  public void configure(final HttpSecurity http) throws Exception {
     http
      .authorizeHttpRequests()
      .requestMatchers(HEALTH_CHECK_PATH).permitAll()
  }
}
</code>```

The web application then has:

```<code>@Configuration
public class SecurityConfig  {

@Bean
public SecurityFilterChain config(HttpSecurity http) throws Exception {
  http.apply(new WebberWebSecurityConfigurerAdapter());
  http
      .authorizeHttpRequests()
      .requestMatchers("/", "/request-info", "/test").permitAll()
      .anyRequest().authenticated();
  return http.build();
}
</code>```

}

This throws the exception:

```<code>Caused by: java.lang.IllegalStateException: Can't configure requestMatchers after anyRequest
</code>```

Presumably because Spring is trying to configure the .requestMatchers(HEALTH_CHECK_PATH).permitAll() line after the .anyRequest().authenticated(); line, despite it being specified first in the config.

How do I get Spring to configure all the upstream library config first, before applying the custom config from the web application itself?

Body:
I'm updating an internal library and applications to Spring Boot 3 (which updated to Spring Security 6).

We have common security configuration which I've updated to implement AbstractHttpConfigurer e.g.

public class WebberWebSecurityConfigurerAdapter
    extends AbstractHttpConfigurer<WebberWebSecurityConfigurerAdapter, HttpSecurity> {

  public void configure(final HttpSecurity http) throws Exception {
     http
      .authorizeHttpRequests()
      .requestMatchers(HEALTH_CHECK_PATH).permitAll()
  }
}

The web application then has:

@Configuration
public class SecurityConfig  {

@Bean
public SecurityFilterChain config(HttpSecurity http) throws Exception {
  http.apply(new WebberWebSecurityConfigurerAdapter());
  http
      .authorizeHttpRequests()
      .requestMatchers("/", "/request-info", "/test").permitAll()
      .anyRequest().authenticated();
  return http.build();
}

}

This throws the exception:

Caused by: java.lang.IllegalStateException: Can't configure requestMatchers after anyRequest

Presumably because Spring is trying to configure the .requestMatchers(HEALTH_CHECK_PATH).permitAll() line after the .anyRequest().authenticated(); line, despite it being specified first in the config.

How do I get Spring to configure all the upstream library config first, before applying the custom config from the web application itself?


问:
How to make an URL 'clickable' in Excel with Python?
I am writing a script that retrieves URL's from webpages and writes it to an Excel sheet.
It all works, except the part where i want to URL in Excel to be 'clickable'. Now it justs write it as a string.

Any ideas how to easily solves this?

Kind regards!


问:
Django additional fields in TabularInline
I have such structure:

```<code>#admin.py

class OrderProductInline(admin.TabularInline):
    model = OrderProduct
    extra = 0
    template = "admin/edit_inline/tabular_order.html"

@admin.register(Order)
class OrderAdmin(admin.ModelAdmin):
    ...

    inlines = [
        OrderProductInline
    ]

#models.py

class OrderProduct(models.Model):
    ...

    order_id = models.ForeignKey(Order, on_delete=models.CASCADE, blank=False,
                                 null=False)
    to_product = models.ForeignKey(Product, on_delete=models.SET_NULL, blank=False,
                                 null=True, verbose_name=_('Product'))
</code>```

On the attached image I show some custom inputs (red rectangles) for each product item in inline form. This inputs depends on additional queryset based on Foreign Key, but I cant`t find the correct way how to display this fields there.

Body:
I have such structure:

#admin.py

class OrderProductInline(admin.TabularInline):
    model = OrderProduct
    extra = 0
    template = "admin/edit_inline/tabular_order.html"

@admin.register(Order)
class OrderAdmin(admin.ModelAdmin):
    ...

    inlines = [
        OrderProductInline
    ]

#models.py

class OrderProduct(models.Model):
    ...

    order_id = models.ForeignKey(Order, on_delete=models.CASCADE, blank=False,
                                 null=False)
    to_product = models.ForeignKey(Product, on_delete=models.SET_NULL, blank=False,
                                 null=True, verbose_name=_('Product'))

On the attached image I show some custom inputs (red rectangles) for each product item in inline form. This inputs depends on additional queryset based on Foreign Key, but I cant`t find the correct way how to display this fields there.


问:
Gluon Mobile not compiling on WSL2 Ubuntu 20.04
Ive been trying to create an apk file for my gluon project. On windows and for windows, the prroject runs perfectly but when in Ubuntu, the commands mvn -Pandroid gluonfx:runagent will run the project but the project wont compile and build.

the error I get keep getting is:

```<code>[Wed Jan 04 15:32:35 IST 2023][INFO] We will now compile your code for aarch64-linux-android. This may take some time.[Wed Jan 04 15:33:01 IST 2023][INFO] Additional information: Objectfile should be called com.gluonapplication.mobiletrial1.o but we didn't find that under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm[Wed Jan 04 15:33:01 IST 2023][SEVERE] Compiling failed.Check the log files under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/logAnd please check https://docs.gluonhq.com/ for more information.[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time:  45.283 s[INFO] Finished at: 2023-01-04T15:33:01+05:30[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:compile (default-cli) on project mobiletrial1: Compiling failed -> [Help 1]
</code>```

The log file

```<code>[Wed Jan 04 16:48:54 IST 2023][FINE] PB Command for compile: /mnt/c/Java/linux/graalvm-svm-java17-linux-gluon-22.1.0.1-Final/bin/native-image -Djdk.internal.lambda.eagerlyInitialize=false --no-server -H:+SharedLibrary -H:+AddAllCharsets -H:+ReportExceptionStackTraces -H:-DeadlockWatchdogExitOnTimeout -H:DeadlockWatchdogInterval=0 -H:+RemoveSaturatedTypeFlows -H:+ExitAfterRelocatableImageWrite --features=org.graalvm.home.HomeFinderFeature -H:TempDirectory=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/tmp -H:EnableURLProtocols=http,https --initialize-at-build-time=com.gluonhq.charm.glisten.visual.MaterialDesignIcon -H:ReflectionConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/reflectionconfig-aarch64-android.json -H:JNIConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/jniconfig-aarch64-android.json -H:ResourceConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/resourceconfig-aarch64-android.json -H:-SpawnIsolates -Dsvm.targetArch=aarch64 -H:+ForceNoROSectionRelocations --libc=bionic -H:+UseCAPCache -H:CAPCacheDir=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/capcache -H:CompilerBackend=lir -H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com/sun/javafx/scene/control/skin/resources/controls-nt,com.sun.javafx.tk.quantum.QuantumMessagesBundle -Dsvm.platform=org.graalvm.nativeimage.Platform$LINUX_AARCH64 -cp /home/vatsal/.m2/repository/com/gluonhq/substrate/0.0.55/substrate-0.0.55.jar:/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/tmp/classpathJar.jar com.gluonapplication.MobileTrial1
[Wed Jan 04 16:48:54 IST 2023][FINE] Start process compile...
[Wed Jan 04 16:48:54 IST 2023][FINE] Result for compile: 0
[Wed Jan 04 16:48:54 IST 2023][FINE] Logging process [compile] to file: /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/log/process-compile-1672831134641.log
[Wed Jan 04 16:48:54 IST 2023][INFO] Additional information: Objectfile should be called com.gluonapplication.mobiletrial1.o but we didn't find that under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm
[Wed Jan 04 16:48:54 IST 2023][SEVERE] Compiling failed.
Check the log files under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.

</code>```

gluonfx log file

```<code>Process
=======
compile

Command Line
============
/mnt/c/Java/linux/graalvm-svm-java17-linux-gluon-22.1.0.1-Final/bin/native-image -Djdk.internal.lambda.eagerlyInitialize=false --no-server -H:+SharedLibrary -H:+AddAllCharsets -H:+ReportExceptionStackTraces -H:-DeadlockWatchdogExitOnTimeout -H:DeadlockWatchdogInterval=0 -H:+RemoveSaturatedTypeFlows -H:+ExitAfterRelocatableImageWrite --features=org.graalvm.home.HomeFinderFeature --features=com.gluonhq.substrate.feature.GluonFeature -H:TempDirectory=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/tmp -H:EnableURLProtocols=http,https -H:ReflectionConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/reflectionconfig-x86_64-linux.json -H:JNIConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/jniconfig-x86_64-linux.json -H:ResourceConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/resourceconfig-x86_64-linux.json -H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com/sun/javafx/scene/control/skin/resources/controls-nt,com.sun.javafx.tk.quantum.QuantumMessagesBundle -Dsvm.platform=org.graalvm.nativeimage.Platform$LINUX_AMD64 -cp /home/vatsal/.m2/repository/com/gluonhq/substrate/0.0.55/substrate-0.0.55.jar:/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/tmp/classpathJar.jar com.gluonapplication.MobileTrial1

Output
======

Result
======
result: 0
</code>```

I have tried uninstalling and reinstalling ubuntu and wsl and I have tried the same process on Linux and have got the same error.

Body:
Ive been trying to create an apk file for my gluon project. On windows and for windows, the prroject runs perfectly but when in Ubuntu, the commands mvn -Pandroid gluonfx:runagent will run the project but the project wont compile and build.

the error I get keep getting is:

[Wed Jan 04 15:32:35 IST 2023][INFO] We will now compile your code for aarch64-linux-android. This may take some time.[Wed Jan 04 15:33:01 IST 2023][INFO] Additional information: Objectfile should be called com.gluonapplication.mobiletrial1.o but we didn't find that under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm[Wed Jan 04 15:33:01 IST 2023][SEVERE] Compiling failed.Check the log files under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/logAnd please check https://docs.gluonhq.com/ for more information.[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time:  45.283 s[INFO] Finished at: 2023-01-04T15:33:01+05:30[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:compile (default-cli) on project mobiletrial1: Compiling failed -> [Help 1]

The log file

[Wed Jan 04 16:48:54 IST 2023][FINE] PB Command for compile: /mnt/c/Java/linux/graalvm-svm-java17-linux-gluon-22.1.0.1-Final/bin/native-image -Djdk.internal.lambda.eagerlyInitialize=false --no-server -H:+SharedLibrary -H:+AddAllCharsets -H:+ReportExceptionStackTraces -H:-DeadlockWatchdogExitOnTimeout -H:DeadlockWatchdogInterval=0 -H:+RemoveSaturatedTypeFlows -H:+ExitAfterRelocatableImageWrite --features=org.graalvm.home.HomeFinderFeature -H:TempDirectory=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/tmp -H:EnableURLProtocols=http,https --initialize-at-build-time=com.gluonhq.charm.glisten.visual.MaterialDesignIcon -H:ReflectionConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/reflectionconfig-aarch64-android.json -H:JNIConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/jniconfig-aarch64-android.json -H:ResourceConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/resourceconfig-aarch64-android.json -H:-SpawnIsolates -Dsvm.targetArch=aarch64 -H:+ForceNoROSectionRelocations --libc=bionic -H:+UseCAPCache -H:CAPCacheDir=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/capcache -H:CompilerBackend=lir -H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com/sun/javafx/scene/control/skin/resources/controls-nt,com.sun.javafx.tk.quantum.QuantumMessagesBundle -Dsvm.platform=org.graalvm.nativeimage.Platform$LINUX_AARCH64 -cp /home/vatsal/.m2/repository/com/gluonhq/substrate/0.0.55/substrate-0.0.55.jar:/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/tmp/classpathJar.jar com.gluonapplication.MobileTrial1
[Wed Jan 04 16:48:54 IST 2023][FINE] Start process compile...
[Wed Jan 04 16:48:54 IST 2023][FINE] Result for compile: 0
[Wed Jan 04 16:48:54 IST 2023][FINE] Logging process [compile] to file: /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/log/process-compile-1672831134641.log
[Wed Jan 04 16:48:54 IST 2023][INFO] Additional information: Objectfile should be called com.gluonapplication.mobiletrial1.o but we didn't find that under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm
[Wed Jan 04 16:48:54 IST 2023][SEVERE] Compiling failed.
Check the log files under /mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.

gluonfx log file

Process
=======
compile

Command Line
============
/mnt/c/Java/linux/graalvm-svm-java17-linux-gluon-22.1.0.1-Final/bin/native-image -Djdk.internal.lambda.eagerlyInitialize=false --no-server -H:+SharedLibrary -H:+AddAllCharsets -H:+ReportExceptionStackTraces -H:-DeadlockWatchdogExitOnTimeout -H:DeadlockWatchdogInterval=0 -H:+RemoveSaturatedTypeFlows -H:+ExitAfterRelocatableImageWrite --features=org.graalvm.home.HomeFinderFeature --features=com.gluonhq.substrate.feature.GluonFeature -H:TempDirectory=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/tmp -H:EnableURLProtocols=http,https -H:ReflectionConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/reflectionconfig-x86_64-linux.json -H:JNIConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/jniconfig-x86_64-linux.json -H:ResourceConfigurationFiles=/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/resourceconfig-x86_64-linux.json -H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com/sun/javafx/scene/control/skin/resources/controls-nt,com.sun.javafx.tk.quantum.QuantumMessagesBundle -Dsvm.platform=org.graalvm.nativeimage.Platform$LINUX_AMD64 -cp /home/vatsal/.m2/repository/com/gluonhq/substrate/0.0.55/substrate-0.0.55.jar:/mnt/g/Intellij_Projects/MobileTrial1/target/gluonfx/x86_64-linux/gvm/tmp/classpathJar.jar com.gluonapplication.MobileTrial1

Output
======

Result
======
result: 0

I have tried uninstalling and reinstalling ubuntu and wsl and I have tried the same process on Linux and have got the same error.


问:
Google Play Store warn to update firebase-crashlytics in react-native mobile app
I have developed my mobile application in react-native, where I have used @react-native-firebase/crashlytics to track crashes in my application. Everything is working fine.

In my last upload .aab to PlayStore, google warn me to update firebase Crashlytics and they will not support after march.
Here is the message I got from them.

We detected an issue in this version of the Crashlytics Android SDK. We strongly recommend either using v18.2.13 or earlier or upgrading to v18.3.1+. For more info see: https://github.com/firebase/firebase-android-sdk/issues/4223

Starting from March 18, 2023 00:00 (UTC) you won't be able to release new versions which contain this SDK version.

I have used latest @react-native-firebase/crashlytics npm in my project, but still it showing the same sdk in my android project. Check in screenshot.

How to I upgrade Android firebase-crashlytics-SDK ?


问:
React native State update on pressing a button
I am trying to update my full screen on pressing a button. I have tried updating States but is not working for my case. I don't know if its causing for the async function or not.
This is my states:

```<code>    const [bNumber, setBNumber] = React.useState('');
    const [rollNumWeight, setRollNumWeight] = useState([]);
    const [rollNumber, setRollNumber] = useState('');
    const [rollWeight, setRollWeight] = useState('');
</code>```

Bellow is function I am using:

```<code>const saveRoll = async () => {
        try {
            const response = await fetch('someURL', {
              method: 'POST',
              headers: {
                Accept: 'application/json',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                roll_num_weight: rollNumWeight,
                bNumber: bNumber
              })
            });
            const json = await response.json();
            setBNumber('')
            setRollNumber('')
            setRollWeight('')
            setRollNumWeight([])
            AlertButton('Rolls Saved Successfully!')
          } catch (error) {
            console.error(error);
          }
    }
</code>```

I am inputting some data on this stage so my states changes from initial state. Then I am pressing SAVE button

This is the button I am calling my function from:

```<code><TouchableOpacity style={styles.button} onPress={saveRoll}>
            <Text style={styles.buttonText}>Save</Text>
</TouchableOpacity>
</code>```

After Pressing the save button it nothing changes. All the states remain the same.

Bellow is my full render code:

```<code><View style={styles.container}>
          <ScrollView
            showsVerticalScrollIndicator={false}
            showsHorizontalScrollIndicator={false}>
            <View style={styles.app}>
                <View style={styles.col1}>
                        <Text>WORKORDER/BATCHNO</Text>
                        <SelectDropdown
                            data={batches}
                            onSelect={(selectedItem) => {
                                // getData(selectedItem)
                                setBNumber(selectedItem)
                            }}
                            defaultButtonText={'Select Batch NO'}
                            buttonTextAfterSelection={(selectedItem, index) => {
                            return selectedItem;
                            }}
                            rowTextForSelection={(item, index) => {
                            return item;
                            }}
                            buttonStyle={styles.input}
                            buttonTextStyle={styles.dropdown1BtnTxtStyle}
                            renderDropdownIcon={isOpened => {
                            return <FontAwesome name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
                            }}
                            dropdownIconPosition={'right'}
                            dropdownStyle={styles.dropdown1DropdownStyle}
                            rowStyle={styles.dropdown1RowStyle}
                            rowTextStyle={styles.dropdown1RowTxtStyle}
                            selectedRowStyle={styles.dropdown1SelectedRowStyle}
                            search
                            searchInputStyle={styles.dropdown1searchInputStyleStyle}
                            searchPlaceHolder={'Search here'}
                            searchPlaceHolderColor={'darkgrey'}
                            renderSearchInputLeftIcon={() => {
                            return <FontAwesome name={'search'} color={'#444'} size={18} />;
                            }}
                        />
                </View>
                <View pointerEvents="none">

                </View>
                <View style={styles.row}>
                    <View style={styles.col1}>
                        <Text>Roll Number</Text>
                        <TextInput
                        placeholder='Roll Number'
                        keyboardType='numeric'
                        style={styles.input}
                        value={rollNumber}
                        onChangeText={(val) => setRollNumber(val)} />
                    </View>
                    <View style={styles.col1}>
                        <Text>Roll Weight</Text>
                        <TextInput
                        placeholder='Roll Weight'
                        keyboardType='numeric'
                        style={styles.input}
                        value={rollWeight}
                        onChangeText={(val) => setRollWeight(val)} />
                    </View>
                </View>
                <Button title='      Add      ' onPress={addRoll}></Button>
            </View>
            <TouchableOpacity style={styles.button} onPress={saveRoll}>
                <Text style={styles.buttonText}>Save</Text>
            </TouchableOpacity>
            <Table borderStyle={{borderWidth: 2, borderColor: '#c8e1ff'}}>
                <Row data={tableHead} style={styles.head} textStyle={styles.text}/>
                <Rows data={rollNumWeight} textStyle={styles.text}/>
            </Table>
          </ScrollView>
        </View>
    );
</code>```

Body:
I am trying to update my full screen on pressing a button. I have tried updating States but is not working for my case. I don't know if its causing for the async function or not.
This is my states:

    const [bNumber, setBNumber] = React.useState('');
    const [rollNumWeight, setRollNumWeight] = useState([]);
    const [rollNumber, setRollNumber] = useState('');
    const [rollWeight, setRollWeight] = useState('');

Bellow is function I am using:

const saveRoll = async () => {
        try {
            const response = await fetch('someURL', {
              method: 'POST',
              headers: {
                Accept: 'application/json',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                roll_num_weight: rollNumWeight,
                bNumber: bNumber
              })
            });
            const json = await response.json();
            setBNumber('')
            setRollNumber('')
            setRollWeight('')
            setRollNumWeight([])
            AlertButton('Rolls Saved Successfully!')
          } catch (error) {
            console.error(error);
          }
    }

I am inputting some data on this stage so my states changes from initial state. Then I am pressing SAVE button

This is the button I am calling my function from:

<TouchableOpacity style={styles.button} onPress={saveRoll}>
            <Text style={styles.buttonText}>Save</Text>
</TouchableOpacity>

After Pressing the save button it nothing changes. All the states remain the same.

Bellow is my full render code:

<View style={styles.container}>
          <ScrollView
            showsVerticalScrollIndicator={false}
            showsHorizontalScrollIndicator={false}>
            <View style={styles.app}>
                <View style={styles.col1}>
                        <Text>WORKORDER/BATCHNO</Text>
                        <SelectDropdown
                            data={batches}
                            onSelect={(selectedItem) => {
                                // getData(selectedItem)
                                setBNumber(selectedItem)
                            }}
                            defaultButtonText={'Select Batch NO'}
                            buttonTextAfterSelection={(selectedItem, index) => {
                            return selectedItem;
                            }}
                            rowTextForSelection={(item, index) => {
                            return item;
                            }}
                            buttonStyle={styles.input}
                            buttonTextStyle={styles.dropdown1BtnTxtStyle}
                            renderDropdownIcon={isOpened => {
                            return <FontAwesome name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
                            }}
                            dropdownIconPosition={'right'}
                            dropdownStyle={styles.dropdown1DropdownStyle}
                            rowStyle={styles.dropdown1RowStyle}
                            rowTextStyle={styles.dropdown1RowTxtStyle}
                            selectedRowStyle={styles.dropdown1SelectedRowStyle}
                            search
                            searchInputStyle={styles.dropdown1searchInputStyleStyle}
                            searchPlaceHolder={'Search here'}
                            searchPlaceHolderColor={'darkgrey'}
                            renderSearchInputLeftIcon={() => {
                            return <FontAwesome name={'search'} color={'#444'} size={18} />;
                            }}
                        />
                </View>
                <View pointerEvents="none">

                </View>
                <View style={styles.row}>
                    <View style={styles.col1}>
                        <Text>Roll Number</Text>
                        <TextInput
                        placeholder='Roll Number'
                        keyboardType='numeric'
                        style={styles.input}
                        value={rollNumber}
                        onChangeText={(val) => setRollNumber(val)} />
                    </View>
                    <View style={styles.col1}>
                        <Text>Roll Weight</Text>
                        <TextInput
                        placeholder='Roll Weight'
                        keyboardType='numeric'
                        style={styles.input}
                        value={rollWeight}
                        onChangeText={(val) => setRollWeight(val)} />
                    </View>
                </View>
                <Button title='      Add      ' onPress={addRoll}></Button>
            </View>
            <TouchableOpacity style={styles.button} onPress={saveRoll}>
                <Text style={styles.buttonText}>Save</Text>
            </TouchableOpacity>

                <Row data={tableHead} style={styles.head} textStyle={styles.text}/>
                <Rows data={rollNumWeight} textStyle={styles.text}/>

          </ScrollView>
        </View>
    );


问:
Why is my weights-file not working / not found?
I downloaded YOLOv7 from the github-page, trained it on a custom dataset, took the weights and trained it again on a different custom dataset. Both Trainings worked as expected.

Now I want to use the final weights for detection in new videos, but I get an error, when YOLO tries to load the weights (see message below).

Edit: I found the answer to my question. The problem was in the path to my weights there were upper case characters. Turns out that they are converted to lower case and the file could not be found anymore.

Thanks @gspr for pointing me to the right direction.

```<code>Traceback (most recent call last):
  File "detect.py", line 195, in <module>
    detect()
  File "detect.py", line 34, in detect
    model = attempt_load(weights, map_location=device)  # load FP32 model
  File "/home/mahler/yolo/yolov7/models/experimental.py", line 241, in attempt_load
    attempt_download(w)
  File "/home/mahler/yolo/yolov7/utils/google_utils.py", line 31, in attempt_download
    tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]
IndexError: list index out of range
</code>```

Body:
I downloaded YOLOv7 from the github-page, trained it on a custom dataset, took the weights and trained it again on a different custom dataset. Both Trainings worked as expected.

Now I want to use the final weights for detection in new videos, but I get an error, when YOLO tries to load the weights (see message below).

Edit: I found the answer to my question. The problem was in the path to my weights there were upper case characters. Turns out that they are converted to lower case and the file could not be found anymore.

Thanks @gspr for pointing me to the right direction.

Traceback (most recent call last):
  File "detect.py", line 195, in <module>
    detect()
  File "detect.py", line 34, in detect
    model = attempt_load(weights, map_location=device)  # load FP32 model
  File "/home/mahler/yolo/yolov7/models/experimental.py", line 241, in attempt_load
    attempt_download(w)
  File "/home/mahler/yolo/yolov7/utils/google_utils.py", line 31, in attempt_download
    tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]
IndexError: list index out of range


问:
Update/Alternative for ODATA v2 + Breeze.js application for exchanging data between web client and server
What (RESTful) frameworks/libraries/APIs/technologies are 'state of the art' for loading and updating data between a server and a (web)client?

Specifically, the client(s) needs to load data from an extensive domain model with multiple related entities (e.g. orders, customers, products, ...) and be able to push updates back to the server. Clients would be based on javascript/typescript (most likely Angular).

I believe, the approach should support the following key aspects:

the client should have good flexibility regarding what to load, including filters/conditions, which elements (and potentially properties) to include, etc. For example, a typical request/query would be for all pending orders with or without their corresponding customers, line items and corresponding products

I believe the client should so some form of change tracking and be able determine what to push back to the server by itself. For example a user could edit an order by changing the delivery date, payment option, remove some and add new line items and then click 'save'

changes to multiple elements must be pushed back and processed as a single batch/transaction

the server would need to map/translate some requests to a database (currently using NHibernate) and also provide some elements from in-memory data

A legacy application I need to maintain and evolve (or replace) currently uses ODATA v2 with Breeze.js 1.x and I am looking for options.


问:
Search and Get count for tree structured matched object in mongodb
I am new to backend. I am using golang with mongodb. I have collection whose an array named meta is saved as tree structure. I want get count if objectid for which I am searching matches the id inside the meta array of children. I have attached a screenshot for the understanding. I am unable to write query. I want to compare the id with every moduleid inside the meta and child array for all documents and if matches it should return the count of matched results.

I am trying to query mongodb and unable to find that how I can iterate and compare id at every child node. I have found a soloution to apply aggregation pipeline but I am unable to understand this concept.


问:
When i try to read text from image by using tessreact OCR , not giving proper text
sample code

```<code>public static void main(){

    String path =
      "C:\\Users\\test.k\\git\\oarevamp\\automation\\captchimages\\captcha1.png";
    ITesseract image = new Tesseract();
    image.setDatapath("C:\\Users\\test.k\\git\\oarevamp\\automation\\captchimages\\testdata");
    image.setLanguage("eng");
    String str = image.doOCR(new File(path));
    System.out.println(str);
}
</code>```

Output
NN

used image:-

Image used

OS:- Windows
programming language:- java

Note:- Image we are using is a screenshot taken from selenium

Tried

we have tried with jpeg format file, we are getting proper image but for png format getting wrong text

Expectations
Output :- unstednes

Body:
sample code

public static void main(){

    String path =
      "C:\\Users\\test.k\\git\\oarevamp\\automation\\captchimages\\captcha1.png";
    ITesseract image = new Tesseract();
    image.setDatapath("C:\\Users\\test.k\\git\\oarevamp\\automation\\captchimages\\testdata");
    image.setLanguage("eng");
    String str = image.doOCR(new File(path));
    System.out.println(str);
}

Output
NN

used image:-

Image used

OS:- Windows
programming language:- java

Note:- Image we are using is a screenshot taken from selenium

Tried

we have tried with jpeg format file, we are getting proper image but for png format getting wrong text

Expectations
Output :- unstednes


问:
Find all classes that implement a given protocol in XCode4
Is there an easy way in XCode 4, to find all the classes that implement a given protocol?

This looks like a pretty common scenario, but I couldn't find how to do it... The only solution I've found is searching (textual search) for the protocol name in the entire project, but of course the number of results is much grater than what I need.

ContentLicense: CC BY-SA 3.0


问:
how to send data in my sample application?
This is my sample app code:

```<code>public class MainActivity extends CordovaActivity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle extras = getIntent().getExtras();
        if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
            moveTaskToBack(true);
        }
        loadUrl(this.launchUrl);
    }
}
</code>```

Iam looking into another app via put the url and then load to this app.But url not loading.

This is my another testing appp code

```<code>protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Intent exploit = new Intent();
        exploit.setClassName("com.etoro.openbook","com.etoro.openbook.MainActivity");
      String url="https://manithehacker.selfmade.one";
      exploit.putExtra("cdvStartInBackground",url);

        startActivity(exploit);
    }
}

</code>```

anyone tell me how to put the url in this applicstion to view the web page via my test app

how to put the url in my testing application??

Body:
This is my sample app code:

public class MainActivity extends CordovaActivity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle extras = getIntent().getExtras();
        if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
            moveTaskToBack(true);
        }
        loadUrl(this.launchUrl);
    }
}

Iam looking into another app via put the url and then load to this app.But url not loading.

This is my another testing appp code

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Intent exploit = new Intent();
        exploit.setClassName("com.etoro.openbook","com.etoro.openbook.MainActivity");
      String url="https://manithehacker.selfmade.one";
      exploit.putExtra("cdvStartInBackground",url);

        startActivity(exploit);
    }
}

anyone tell me how to put the url in this applicstion to view the web page via my test app

how to put the url in my testing application??