问:
data and salt arguments required node js
i am testing the authentication for my app and i got this error but could not solve it can you guys help me. Something is wrong with the bcrypt and salt etc but i could not figure out the reason.

I have add my package.json, Server and functions files. I had bcryptjs the old one in here first so i deleted and installed Bcrypt new one but still having a problem

Here is my package.json

```<code>{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^5.1.0",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "jsonwebtoken": "^9.0.0",
    "mongoose": "^6.8.3",
    "nodemon": "^2.0.20"
  }
}
</code>```

Here is the server.js

```<code>const express = require('express')
const app = express()

require('dotenv').config();
app.use(express.json())
const dbConfig = require('./config/dbConfig');
const usersRoute = require("./routes/usersRoute");

app.use('/api/users', usersRoute);
const PORT = process.env.PORT || 5000;

app.listen(PORT, () => console.log(`Server listening on port ${PORT}!`))
</code>```

Here is my UserRoute

```<code>const router = require("express").Router();
const User = require("../models/userModel");
const bcrypt = require('bcrypt');
const jwt = require("jsonwebtoken");

// register user account

router.post("/register", async (req, res) => {
  try {
    // check if user already exists

    let user = await User.findOne({ email: req.body.email });
    if (user) {
      return res.send({
        success: false,
        message: "User already exists",
      });
    }

    // hash password
    const salt = await bcrypt.genSalt(10);
    const hashedPassword = await bcrypt.hash(req.body.password, salt);

    req.body.password = hashedPassword;
    const newUser = new User(req.body);
    await newUser.save();
    res.send({
      message: "User created successfully",
      data: null,
      success: true,
    });
  } catch (error) {
    res.send({
      message: error.message,
      success: false,
    });
  }
});

// login user account

router.post("/login", async (req, res) => {
  try {
    // check if user exists
    let user = await User.findOne({ email: req.body.email });
    if (!user) {
      return res.send({
        success: false,
        message: "User does not exist",
      });
    }

    // check if password is correct
    const validPassword = await bcrypt.compare(
      req.body.password,
      user.password
    );
    if (!validPassword) {
      return res.send({
        success: false,
        message: "Invalid password",
      });
    }

    // check if user is verified
    if (!user.isVerified) {
      return res.send({
        success: false,
        message: "User is not verified yet or has been suspended",
      });
    }

    // generate token
    const token = jwt.sign({ userId: user._id }, process.env.jwt_secret, {
      expiresIn: "1d",
    });
    res.send({
      message: "User logged in successfully",
      data: token,
      success: true,
    });
  } catch (error) {
    res.send({
      message: error.message,
      success: false,
    });
  }
});

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

Body:
i am testing the authentication for my app and i got this error but could not solve it can you guys help me. Something is wrong with the bcrypt and salt etc but i could not figure out the reason.

I have add my package.json, Server and functions files. I had bcryptjs the old one in here first so i deleted and installed Bcrypt new one but still having a problem

Here is my package.json

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^5.1.0",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "jsonwebtoken": "^9.0.0",
    "mongoose": "^6.8.3",
    "nodemon": "^2.0.20"
  }
}

Here is the server.js

const express = require('express')
const app = express()

require('dotenv').config();
app.use(express.json())
const dbConfig = require('./config/dbConfig');
const usersRoute = require("./routes/usersRoute");

app.use('/api/users', usersRoute);
const PORT = process.env.PORT || 5000;

app.listen(PORT, () => console.log(`Server listening on port ${PORT}!`))

Here is my UserRoute

const router = require("express").Router();
const User = require("../models/userModel");
const bcrypt = require('bcrypt');
const jwt = require("jsonwebtoken");

// register user account

router.post("/register", async (req, res) => {
  try {
    // check if user already exists

    let user = await User.findOne({ email: req.body.email });
    if (user) {
      return res.send({
        success: false,
        message: "User already exists",
      });
    }

    // hash password
    const salt = await bcrypt.genSalt(10);
    const hashedPassword = await bcrypt.hash(req.body.password, salt);

    req.body.password = hashedPassword;
    const newUser = new User(req.body);
    await newUser.save();
    res.send({
      message: "User created successfully",
      data: null,
      success: true,
    });
  } catch (error) {
    res.send({
      message: error.message,
      success: false,
    });
  }
});

// login user account

router.post("/login", async (req, res) => {
  try {
    // check if user exists
    let user = await User.findOne({ email: req.body.email });
    if (!user) {
      return res.send({
        success: false,
        message: "User does not exist",
      });
    }

    // check if password is correct
    const validPassword = await bcrypt.compare(
      req.body.password,
      user.password
    );
    if (!validPassword) {
      return res.send({
        success: false,
        message: "Invalid password",
      });
    }

    // check if user is verified
    if (!user.isVerified) {
      return res.send({
        success: false,
        message: "User is not verified yet or has been suspended",
      });
    }

    // generate token
    const token = jwt.sign({ userId: user._id }, process.env.jwt_secret, {
      expiresIn: "1d",
    });
    res.send({
      message: "User logged in successfully",
      data: token,
      success: true,
    });
  } catch (error) {
    res.send({
      message: error.message,
      success: false,
    });
  }
});

module.exports = router;


来源: stackexchange

问:
How to access case-sensitive file in a SSHFS-mapped Linux folder from Visual Studio
My codebase lives in a Ubuntu folder and I mapped it to Windows 11 via SSHFS.

Then I generate some VS solution/project files for the source code.

But when I try to open the solutions in Visual Studio, I saw some Intellisense errors about file access failure.

The path is correct only that it is all capitalized.

I don't know why it is capitalized but it may confuse the Ubuntu.

See below:

I searched a bit such as here. It mentions some fsutil tool but it is meant to tweak the NTFS file system while my mapped folder is a EXT4.

Could anyone shed some light on this?

ContentLicense: CC BY-SA 4.0


问:
:root colors throwing errors in css
I have this CSS which reads and renders fine in VS Code's preview, but when I add it to Hostinger (where I'm hosting the site), I get a plethora of errors and it defaults back to my sites old CSS.

The errors all relate to the colors defined at root, which look correct to me so I'm not sure where I went wrong.

Some of the errors were:

:root Rule is empty

--background-color: rgb(13, 1, 14); Expected RBRACE at line 3, col 5

Any idea why it works in VS Code Preview, but not on my public site?

:root
    {
    --background-color: rgb(13, 1, 14);
    --border-color: rgba(255, 255, 255, 0.13);
}
body {
    background-color: var(--background-color);
    display: flex;
    flex-wrap: wrap;
    height: 100vh;
    margin: 0px;
    overflow: hidden;
  }

  main {

    flex-grow: 1;
  }

  main > article {
    display: grid;
    height: 100vh;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 2fr 1fr;
  }

  main > article > .article-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 3rem 2rem;
  }

 .article-image-section {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
 }

 .article-image-section img {
    flex-shrink: 0;
    min-width: 100%;
    min-height: 100%;
 }

  main > article > .article-description-section,
  main > article > .article-nav-section {
    border-left: 1px solid var(--border-color);
  }

  main > article > .article-title-section,
  main > article > .article-nav-section {
    border-top: 1px solid var(--border-color);
  }

  nav {
    display: flex;
    width: 100%;
    height: 15%;
    border-bottom: 1px solid var(--border-color);
  }

  nav > .nav-section {
    padding: 3rem 2rem;
    display: flex;
    gap: 1rem;
    border-left: 1px solid var(--border-color);
    align-items: center;
    justify-content: center;
  }

  #nav-logo-section {
    justify-content: flex-start;
    flex-basis: calc(100% / 3);
  }

  #nav-logo-section > a > i {
    font-size: 2.5rem;
  }

  #nav-link-section {
    flex-basis: calc(100% / 3);
    gap: 6rem;
  }

  #nav-social-section {
    flex-basis: 1;
    gap: 3rem;
  }
  #nav-contact-section {
    flex-basis: 1;
  }

  * {
    box-sizing: border-box;
  }

  h1, h2, h3, a, p, span {
    font-family: "Rubik", sans-serif;
    font-weight: 400;
    color: white;
  }

  a {
    text-decoration: none;
  }
```

Title: :root colors throwing errors in css


问:
How to access body data before send of XMLHttpRequest
Is there a way to access and modify the body data of a XMLHttpRequest before send? I work in Angular and want to modify the request that a third-party library sends. I change the headers like this:

```<code>beforeSend(e) {
  e.request.setRequestHeader(
    'Authorization',
    'Bearer ' + this.user.tokens.app.accessToken
  );
  e.request.setRequestHeader('tenant-id', this.user.tid);
}
</code>```

Is there any way?

Body:
Is there a way to access and modify the body data of a XMLHttpRequest before send? I work in Angular and want to modify the request that a third-party library sends. I change the headers like this:

beforeSend(e) {
  e.request.setRequestHeader(
    'Authorization',
    'Bearer ' + this.user.tokens.app.accessToken
  );
  e.request.setRequestHeader('tenant-id', this.user.tid);
}

Is there any way?


问:
Match individual records during Batch predictions with VertexAI pipeline
I have a custom model in Vertex AI and a table storing the features for the model along with the record_id.

I am building pipeline component for the batch prediction and facing a critical issue.
When I submit the batch_prediction, I should exclude the record_id for the job but How can I map the record if I don't have the record_id in the result?

from google.cloud import bigquery
from google.cloud import aiplatform

aiplatform.init(project=project_id)
client = bigquery.Client(project=project_id)

query = '''
SELECT * except(record_id) FROM `table`
'''
df = client.query(query).to_dataframe()  # drop the record_id and load it to another table
job = client.load_table_from_dataframe(
    X, "table_wo_id",
)

clf = aiplatform.Model(model_id = 'custom_model')
clf.batch_predict(job_display_name = 'custom model batch prediction',
                 bigquery_source = 'bq://table_wo_id',
                 instances_format = 'bigquery',
                 bigquery_destination_prefix = 'bq://prediction_result_table',
                 predictions_format = 'bigquery',
                 machine_type = 'n1-standard-4',
                 max_replica_count = 1
                 )
```

like the above example, there is no record_id column in prediction_result_table. There is no way to map the result back to each record

Body:
I have a custom model in Vertex AI and a table storing the features for the model along with the record_id.

I am building pipeline component for the batch prediction and facing a critical issue.
When I submit the batch_prediction, I should exclude the record_id for the job but How can I map the record if I don't have the record_id in the result?

from google.cloud import bigquery
from google.cloud import aiplatform

aiplatform.init(project=project_id)
client = bigquery.Client(project=project_id)

query = '''
SELECT * except(record_id) FROM `table`
'''
df = client.query(query).to_dataframe()  # drop the record_id and load it to another table
job = client.load_table_from_dataframe(
    X, "table_wo_id",
)

clf = aiplatform.Model(model_id = 'custom_model')
clf.batch_predict(job_display_name = 'custom model batch prediction',
                 bigquery_source = 'bq://table_wo_id',
                 instances_format = 'bigquery',
                 bigquery_destination_prefix = 'bq://prediction_result_table',
                 predictions_format = 'bigquery',
                 machine_type = 'n1-standard-4',
                 max_replica_count = 1
                 )

like the above example, there is no record_id column in prediction_result_table. There is no way to map the result back to each record


问:
How to disable Qt5 Webview navigation bar

When I use the Qt Webview example, I want to disbale the navigation bar.

But I don't know how to close it.

Anyone can help me ?

Thank you very much

The Qt Version is : 5.15.8

The Webview Example is Webview Example


问:
Pagination with aggregation in elasticSearch
ElasticSearch version 8.5
I have cron job inside java class which transfer data from one elasticSearch index to another. To fetch data from first index I use aggregation query. After some time I expect to have big amount of data within one request. Can I use some type of pagination together with aggregation so my backend can handle this amount of data. Updates in first index can occur any time so options like search_after not suitable because of consistency.
Request example to get amount of employee in each department
{ "size": 0, "aggs": { "group_by_company_id": { "terms": { "field": "company_id" }, "aggs": { "group_by_department_id": { "terms": { "field": "department_id" }, "aggs": { "group_by_department_name": { "terms": { "field": "department_name" } } } } } } } }

I try to find information in official documentation but did't find info how combine aggregation and pagination


问:
Is there is a way to configure Team Management using Hierarchy in Jira Service Management ITSM projects?
I am trying to make an organogram as show below.

Organogram example

On the basis of above organogram, I can configure users on each level, also I need this concept in Dashboards, reports and even in escalation alerts. I have to configure permissions as well. Low level user should not be transparent to above level user (i.e level 7 person can view details of level 6 but level 6 user can not view details for level 7 user). Same for escalation, if ticket SLA is not met by low level user (eg level 2 User)  than his escalation should be triggered to his lead (eg level 3 user).
Note that I have multiple projects (Clients Onboarded) and users are from my organization not client. These hierarchy will be generic in all projects
I am using Jira Service Management Cloud Platform standard version

I am unable to find any workaround against this building customizable organogram and configure multiple actions on the basis of this. Also I have search for addons on Jira Market Place but unable to find one.


问:
How to prevent UI freeze in plotly angular when loading large data?
When I try to update plotly angular component with 10,000 datapoints for x and y - the UI briefly freezes for 5 seconds and then updates the plot, is there a way to make this process asynchronous - just to show some loaders or spinners?

my graph.component.ts looks something like this

    <plotly-plot
        [data]="plotlyData"
        [layout]="layout"
        [config]="config"
        [useResizeHandler]="true"
        [style]="{position: 'relative', width: '100%', height: '100%'}"
        (hover)="hover($event)"
        (afterPlot)="graphUpdating = false">
    </plotly-plot>

...
```
<p>And the way I update <code>data</code> in <code>my graph.component.ts</code></p>
<pre class="lang-js prettyprint-override"><code>@Input() public set data(value: any[]) {
        this.graphUpdating = true;
        const graphData: Partial<Plotly.Data>[] = [];
        value.forEach(plot => {
            graphData.push({
                x: plot.x,
                y: plot.y,
                name: plot.plotName,
                meta: plot.metaData,
                hovertemplate: plot.hoverTemplate,
                ...
            });
        });
        this.plotlyData = graphData;
}
</code>```

The data comes from a service which changes for every axis selection change (say I select y axis to be foo or bar).

I have tried using setTimeout() for assigning the plotlyData and tried to pass in the data as Observables - which did nothing, sadly :(

I also have tried using PlotlyModule.plotlyjs.restyle() and PlotlyModule.plotlyjs.update() methods to update the data

Body:
When I try to update plotly angular component with 10,000 datapoints for x and y - the UI briefly freezes for 5 seconds and then updates the plot, is there a way to make this process asynchronous - just to show some loaders or spinners?

my graph.component.ts looks something like this

    <plotly-plot
        [data]="plotlyData"
        [layout]="layout"
        [config]="config"
        [useResizeHandler]="true"
        [style]="{position: 'relative', width: '100%', height: '100%'}"
        (hover)="hover($event)"
        (afterPlot)="graphUpdating = false">
    </plotly-plot>

...

And the way I update data in my graph.component.ts

@Input() public set data(value: any[]) {
        this.graphUpdating = true;
        const graphData: Partial<Plotly.Data>[] = [];
        value.forEach(plot => {
            graphData.push({
                x: plot.x,
                y: plot.y,
                name: plot.plotName,
                meta: plot.metaData,
                hovertemplate: plot.hoverTemplate,
                ...
            });
        });
        this.plotlyData = graphData;
}

The data comes from a service which changes for every axis selection change (say I select y axis to be foo or bar).

I have tried using setTimeout() for assigning the plotlyData and tried to pass in the data as Observables - which did nothing, sadly :(

I also have tried using PlotlyModule.plotlyjs.restyle() and PlotlyModule.plotlyjs.update() methods to update the data


问:
which port ffmpeg is using for streaming to a rtmp(or rtmps) server running in a cloud location
I am working with ffmpeg and rtmp camera streaming in a constrained environment.
I have rtmp server running on a cloud (say eg. 11.23.123.13 in port 1935 for rtmp & 4936 for rtmps).
However is there any port on sending end , i should request team to open to avoid blocking the stream sending from device end to rtmp server end(camera streaming end). Only port 443 is open in device where camera connected and ffmpeg commands are running.

It would be helpful if somebody give insights on how network is connecting from ffmpeg encoder to rtmp server

Getting the details how network is connecting from ffmpeg encoder to rtmp server?

Which ports to be open in device end(where camera connecting) to start ffmpeg streaming to rtmp server running on cloud?


问:
How to use db directory in XMLDOM subset type
As i define note.dtd file in note_dtd_path and point it as &note_dtd_path with SYSTEM identifier, i can get the results what i want

SQL>

define note_dtd_path = "/home/oracle21c/SQL/note.dtd";

```<code>declare
    doc dbms_xmldom.DOMDocument;
    dt dbms_xmldom.DOMDOCUMENTTYPE;
    n dbms_xmldom.DOMNode;
begin
    doc := dbms_xmldom.newDomDocument('<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "&note_dtd_path">
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body></body>
</note>
');

    dt := dbms_xmldom.getDoctype(doc);
    dbms_output.put_line ('docType name : ' || dbms_xmldom.getname(dt));
    n := dbms_xmldom.makeNode(dt);
    dbms_output.put_line('systemID : ' || dbms_xmldom.getsystemid(dt));
    dbms_xmldom.freeDocument(doc);
end;
/
</code>```

docType name : note
systemID : /home/oracle21c/SQL/note.dtd

PSM completed.

But, as i created directory in SQLPLUS tool and tried to point the file in right direction, it failed.

SQL> create  or replace directory DIR288571 as "/home/oracle21c/SQL";
grant read, write on directory DIR288571 to tibero;

```<code>declare
    doc dbms_xmldom.DOMDocument;
    dt dbms_xmldom.DOMDOCUMENTTYPE;
    n dbms_xmldom.DOMNode;
begin
    doc := dbms_xmldom.newDomDocument('<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "$DIR288571/note.dtd">
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body></body>
</note>
');

    dt := dbms_xmldom.getDoctype(doc);
    dbms_output.put_line ('docType name : ' || dbms_xmldom.getname(dt));
    n := dbms_xmldom.makeNode(dt);
    dbms_output.put_line('systemID : ' || dbms_xmldom.getsystemid(dt));
    dbms_xmldom.freeDocument(doc);
end;
/
</code>```

**declare
*
ERROR at line 1:your text
ORA-31001: Invalid resource handle or path name "/$DIR288571/note.dtd"

ORA-06512: at "XDB.DBMS_XMLDOM", line 4703
ORA-06512: at "XDB.DBMS_XMLDOM", line 4721
ORA-06512: at line 16
**

**
is there any good method that i can get same results like using define options on the top by using create directory option `**

Body:
As i define note.dtd file in note_dtd_path and point it as &note_dtd_path with SYSTEM identifier, i can get the results what i want

SQL>

define note_dtd_path = "/home/oracle21c/SQL/note.dtd";

declare
    doc dbms_xmldom.DOMDocument;
    dt dbms_xmldom.DOMDOCUMENTTYPE;
    n dbms_xmldom.DOMNode;
begin
    doc := dbms_xmldom.newDomDocument('<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "&note_dtd_path">
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>

</note>
');

    dt := dbms_xmldom.getDoctype(doc);
    dbms_output.put_line ('docType name : ' || dbms_xmldom.getname(dt));
    n := dbms_xmldom.makeNode(dt);
    dbms_output.put_line('systemID : ' || dbms_xmldom.getsystemid(dt));
    dbms_xmldom.freeDocument(doc);
end;
/

docType name : note
systemID : /home/oracle21c/SQL/note.dtd

PSM completed.

But, as i created directory in SQLPLUS tool and tried to point the file in right direction, it failed.

SQL> create  or replace directory DIR288571 as "/home/oracle21c/SQL";
grant read, write on directory DIR288571 to tibero;

declare
    doc dbms_xmldom.DOMDocument;
    dt dbms_xmldom.DOMDOCUMENTTYPE;
    n dbms_xmldom.DOMNode;
begin
    doc := dbms_xmldom.newDomDocument('<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "$DIR288571/note.dtd">
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>

</note>
');

    dt := dbms_xmldom.getDoctype(doc);
    dbms_output.put_line ('docType name : ' || dbms_xmldom.getname(dt));
    n := dbms_xmldom.makeNode(dt);
    dbms_output.put_line('systemID : ' || dbms_xmldom.getsystemid(dt));
    dbms_xmldom.freeDocument(doc);
end;
/

**declare
*
ERROR at line 1:your text
ORA-31001: Invalid resource handle or path name "/$DIR288571/note.dtd"

ORA-06512: at "XDB.DBMS_XMLDOM", line 4703
ORA-06512: at "XDB.DBMS_XMLDOM", line 4721
ORA-06512: at line 16
**

**
is there any good method that i can get same results like using define options on the top by using create directory option `**


问:
istio sidecar is not restricting pod connections as desired
I want to see how an istio sidecar may restrict a pod's connections (I am learning istio through its references)
so I am working with the bookinfo example, after installing the example (having a Docker Desktop) - I wrote a simple sidecar resource the restricts the connections of ratings to reviews and details services as following:

```<code>apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
  name: bookinfo-ratings-sidecar
spec:
  workloadSelector:
    labels:
      app: ratings
  egress:
    - hosts:
      - "./details.default.svc.cluster.local"
      - "./reviews.default.svc.cluster.local"
</code>```

when I run the following command istioctl proxy-config clusters ratings-v1-5f9699cfdf-hb2gd I really see that it includes only details.default.svc.cluster.local , reviews.default.svc.cluster.local (from the bookinfo services)
but if I run kubectl exec ratings-v1-5f9699cfdf-hb2gd -- curl -sS productpage:9080 I get an html result i.e. it doesn't refuse the connection with productpage as if the sidecar doesn't exist
What am I missing ?
(p.s this The result of sidecar injection was not what I expected didn't help)

Body:
I want to see how an istio sidecar may restrict a pod's connections (I am learning istio through its references)
so I am working with the bookinfo example, after installing the example (having a Docker Desktop) - I wrote a simple sidecar resource the restricts the connections of ratings to reviews and details services as following:

apiVersion: networking.istio.io/v1beta1
kind: Sidecar
metadata:
  name: bookinfo-ratings-sidecar
spec:
  workloadSelector:
    labels:
      app: ratings
  egress:
    - hosts:
      - "./details.default.svc.cluster.local"
      - "./reviews.default.svc.cluster.local"

when I run the following command istioctl proxy-config clusters ratings-v1-5f9699cfdf-hb2gd I really see that it includes only details.default.svc.cluster.local , reviews.default.svc.cluster.local (from the bookinfo services)
but if I run kubectl exec ratings-v1-5f9699cfdf-hb2gd -- curl -sS productpage:9080 I get an html result i.e. it doesn't refuse the connection with productpage as if the sidecar doesn't exist
What am I missing ?
(p.s this The result of sidecar injection was not what I expected didn't help)


问:
copy a py file path in my project automatically in pycharm
using Pycharm, i want to automatically copy the path of a "py" file in my project in a mouse click to paste it in the imports in another "py" file.
say I have a file named file1 in my project which is in a python package named package1:
I want to automatically copy this:

from package1 import file1

I tried to find it when I click on the file in the project panel but the option is not there


问:
How to add utm tags to a wix form?
I am currently attempting to include UTM tags in a webhook that I am sending from a wix form. However, upon sending the webhook, I am either receiving an empty response or receiving "google.co.il" source. I am expecting specifically Google Ads or email sources.
I have added the code that I am using in an attempt to make this function properly. Any assistance or guidance would be greatly appreciated..</p>
```<code>

export function wixForms1_wixFormSubmitted(event) {
    var obj = {};
    var i = 0;
    for (i=0;i<event.fields.length;i++){
        obj[event.fields[i].id] = event.fields[i].fieldValue;
    }
    //console.log(obj);
    fetch( "https://hook.eu1.make.com/62tsltjotop6iwboufggguuxhhqrjaen", {
    "method": "post",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": JSON.stringify(obj)
    } )
    .then( (httpResponse) => {
        if (httpResponse.ok) {
        return httpResponse.json();
        } else {
        return Promise.reject("Fetch did not succeed");
        }
    } )
    .then( (json) => console.log(json) )
    .catch(err => console.log(err));
}

$w.onReady(function () {
    const query = wixLocation.query;
        if (query) {
            $w('#refbox').value = JSON.stringify(query);
        }
 let params = wixLocation.query
    console.log(params)
    $w('#campaign').value = params.campaign_name
    $w('#source').value = params.utm_source
    });
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

});
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
import {local, session, memory} from 'wix-storage';

let referrer = wixWindow.referrer;
let previousPageURL;

$w.onReady(function () {
 previousPageURL = session.getItem("page");
 session.setItem("page", wixLocation.url);
});

$w.onReady(function () {
    // Write your JavaScript here
    const prvurl = wixLocation.url;
        if (prvurl) {
            $w('#prvurl').value = JSON.stringify(prvurl);

        }

    // To select an element by ID use: $w("#elementID")

    // Click "Preview" to run your code
        const query = wixWindow.referrer;
        if (query) {
            $w('#refbox').value = JSON.stringify(query);

        }

}
);

</code>```

Title: How to add utm tags to a wix form?

Body:
I am currently attempting to include UTM tags in a webhook that I am sending from a wix form. However, upon sending the webhook, I am either receiving an empty response or receiving "google.co.il" source. I am expecting specifically Google Ads or email sources.
I have added the code that I am using in an attempt to make this function properly. Any assistance or guidance would be greatly appreciated..

export function wixForms1_wixFormSubmitted(event) {
    var obj = {};
    var i = 0;
    for (i=0;i<event.fields.length;i++){
        obj[event.fields[i].id] = event.fields[i].fieldValue;
    }
    //console.log(obj);
    fetch( "https://hook.eu1.make.com/62tsltjotop6iwboufggguuxhhqrjaen", {
    "method": "post",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": JSON.stringify(obj)
    } )
    .then( (httpResponse) => {
        if (httpResponse.ok) {
        return httpResponse.json();
        } else {
        return Promise.reject("Fetch did not succeed");
        }
    } )
    .then( (json) => console.log(json) )
    .catch(err => console.log(err));
}

$w.onReady(function () {
    const query = wixLocation.query;
        if (query) {
            $w('#refbox').value = JSON.stringify(query);
        }
 let params = wixLocation.query
    console.log(params)
    $w('#campaign').value = params.campaign_name
    $w('#source').value = params.utm_source
    });
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

});
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
import {local, session, memory} from 'wix-storage';

let referrer = wixWindow.referrer;
let previousPageURL;

$w.onReady(function () {
 previousPageURL = session.getItem("page");
 session.setItem("page", wixLocation.url);
});

$w.onReady(function () {
    // Write your JavaScript here
    const prvurl = wixLocation.url;
        if (prvurl) {
            $w('#prvurl').value = JSON.stringify(prvurl);

        }

    // To select an element by ID use: $w("#elementID")

    // Click "Preview" to run your code
        const query = wixWindow.referrer;
        if (query) {
            $w('#refbox').value = JSON.stringify(query);

        }

}
);


问:
How to host an always-running backend process in .NET core?
I created a backend service using C#. It must be running all the time. When the PC is rebooted, this process must be started immediately. It can be running on a PC, not necessarily a server, although it can be a server.

I created the .NET Framework version, which uses a Windows Service to host this backend service.

Now I am creating the .NET Core version. I am very new to .NET Core. How do I create such an always-running process, just like a Windows Service, in .NET Core?

Or shall I just create a console app that starts this service, and expect whoever uses my app, whether it is to be running on Mac or Linux, to invoke this console app, in whatever way possible, when the computer starts?


问:
how to dowload pdf From html with Scrolling part
```<code>

export default App;
</code>```

I have try the above code to download pdf of complete dive which is scrollable , but i'm getting only visible part

Body:
export default App;

I have try the above code to download pdf of complete dive which is scrollable , but i'm getting only visible part


问:
Why scrollIntoView only work inside of setTimeout?
i want to use scrollIntoView function.

i wrote code like this

```<code>viewRef.current.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest',});
</code>```

but it doesn't work at first click. it start working with the second click.

When I click for the first time, it doesn't seem to work because there's no content. So I thought, There should be a click and a time interval.

So i modified code like this

```<code> setTimeout(
            () =>
                viewRef.current?.scrollIntoView({
                    behavior: 'smooth',
                    block: 'start',
                    inline: 'nearest',
                }),
            10
 );
</code>```

then it works at first click

but i want to know why it works inside of setTimeout??

And, it doesn't work or work occasionally when setTimeout(()=>scrollIntoView, 0 or 1 or ... 5)

why work occasionally when i set time 0 - 5 ?

Body:
i want to use scrollIntoView function.

i wrote code like this

viewRef.current.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest',});

but it doesn't work at first click. it start working with the second click.

When I click for the first time, it doesn't seem to work because there's no content. So I thought, There should be a click and a time interval.

So i modified code like this

 setTimeout(
            () =>
                viewRef.current?.scrollIntoView({
                    behavior: 'smooth',
                    block: 'start',
                    inline: 'nearest',
                }),
            10
 );

then it works at first click

but i want to know why it works inside of setTimeout??

And, it doesn't work or work occasionally when setTimeout(()=>scrollIntoView, 0 or 1 or ... 5)

why work occasionally when i set time 0 - 5 ?


问:
Why SetWindowsPos function return false in Windows 10 and windows 11 last update?
I'm creating an AppBar in .net MAUI, and I want my app to sit at the top of the screen and reduce the working area. The area used by the AppBar shouldn't be covered by any other window.

I'm using the setWindowPos function(from user32.dll) to resize the working area, but it seems to work only on Windows 11 version 21H2. I also checked in Windows 10 versions 21H2, 22H2, and windows 11 version 22H2(+Patched) but setWindowPos returns false in all of them.

What might be the reason for this behavior? and what can I adjust in my code to make it work on other versions as well?

p.s: GetDesktopWindow and SystemParametersInfo are also from user32.dll

```<code>IntPtr desktopWindow = GetDesktopWindow();
var setPos = SetWindowPos(desktopWindow, IntPtr.Zero, 0, _APPBARHEIGHT, 0, 0, (uint)    (SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOZORDER));//in windows 11 v21H2 return true
RECT rect = new RECT();
rect.Left = 0;
rect.Top = _APPBARHEIGHT;
rect.Right = _ScreenWidth;
rect.Bottom = _ScreenHeight - _APPBARHEIGHT;
var sysparam = SystemParametersInfo(0x002F, 0, ref rect, 0x0002);//return true
</code>```

Thanks!

I expected the desktop working area would resize and any maximized window would not run over the AppBar
something like this. It
works as I expected in Windows 11 v21H2.

Body:
I'm creating an AppBar in .net MAUI, and I want my app to sit at the top of the screen and reduce the working area. The area used by the AppBar shouldn't be covered by any other window.

I'm using the setWindowPos function(from user32.dll) to resize the working area, but it seems to work only on Windows 11 version 21H2. I also checked in Windows 10 versions 21H2, 22H2, and windows 11 version 22H2(+Patched) but setWindowPos returns false in all of them.

What might be the reason for this behavior? and what can I adjust in my code to make it work on other versions as well?

p.s: GetDesktopWindow and SystemParametersInfo are also from user32.dll

IntPtr desktopWindow = GetDesktopWindow();
var setPos = SetWindowPos(desktopWindow, IntPtr.Zero, 0, _APPBARHEIGHT, 0, 0, (uint)    (SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOZORDER));//in windows 11 v21H2 return true
RECT rect = new RECT();
rect.Left = 0;
rect.Top = _APPBARHEIGHT;
rect.Right = _ScreenWidth;
rect.Bottom = _ScreenHeight - _APPBARHEIGHT;
var sysparam = SystemParametersInfo(0x002F, 0, ref rect, 0x0002);//return true

Thanks!

I expected the desktop working area would resize and any maximized window would not run over the AppBar
something like this. It
works as I expected in Windows 11 v21H2.


问:
How to integrate and mocking Redshift and S3 locally using redshift-fake-driver
I would like to build redshift and s3 locally, and then use them for tasks that may run from airflow, tools ... to reduce CI/CD code when have to deploy them to dev, also want to avoid conflict about resources, files, ...

Currently can use LocalStack's S3, but for Redshift, jusr looking for solutions but only get combination using redshift-fake-driver along with package JayDeBeApi in python, but it seems not working properly

```<code>import jpype # JPype1==1.4.1
import jaydebeapi # JayDeBeApi==1.2.3
jars = "/Users/trancongminh/Downloads/jars/*"
jpype.startJVM(classpath=jars)
driverName = "jp.ne.opt.redshiftfake.postgres.FakePostgresqlDriver"
print(jpype.JClass(driverName))

# as I spin up a docker container for postgresQL
connectionString = "jdbc:postgresqlredshift://localhost:5432/docker"
uid = "docker"
pwd = "docker"
driverFileName = "/Users/trancongminh/Downloads/jars/redshift-fake-driver_2.12-1.0.15.jar"
conn = jaydebeapi.connect(
    jclassname=driverName,
    url=connectionString,
    driver_args={'user': uid, 'password': pwd},
    jars=driverFileName
)
curs = conn.cursor()
curs.execute("SELECT * FROM pg_catalog.pg_tables limit 10;")
curs.fetchall()

curs.execute("copy db_table_name_v2 from 'http://localhost:4566/events-streaming/traveller/v2/ym_202210/d_04/hm_131901.parquet'  CREDENTIALS 'aws_access_key_id=test;aws_secret_access_key=test' ")

</code>```

But get errors like No such file or directory, or smth like this

```<code>Traceback (most recent call last):
  File "FakeConnection.scala", line 31, in jp.ne.opt.redshiftfake.FakeConnection.prepareStatement
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 531, in execute
    self._prep = self._connection.jconn.prepareStatement(operation)
java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: 'void scala.util.parsing.combinator.Parsers.$init$(scala.util.parsing.combinator.Parsers)'
</code>```

or may be like this:

```<code>Traceback (most recent call last):
  File "FakePreparedStatement.scala", line 138, in jp.ne.opt.redshiftfake.FakePreparedStatement$FakeAsIsPreparedStatement.execute
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 534, in execute
    is_rs = self._prep.execute()
org.postgresql.util.PSQLException: org.postgresql.util.PSQLException: ERROR: could not open file "s3://events-streaming/traveller/v2/ym_202210/d_04/hm_131901.parquet" for reading: No such file or directory
  Hint: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 536, in execute
    _handle_sql_exception()
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 165, in _handle_sql_exception_jpype
    reraise(exc_type, exc_info[1], exc_info[2])
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 57, in reraise
    raise value.with_traceback(tb)
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 534, in execute
    is_rs = self._prep.execute()
jaydebeapi.DatabaseError: org.postgresql.util.PSQLException: ERROR: could not open file "s3://events-streaming/traveller/v2/ym_202210/d_04/hm_131901.parquet" for reading: No such file or directory
  Hint: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy
</code>```

Anyy body has exp with this pattern just help, thanks

Solutions or keywords that helpful for further investigation

Body:
I would like to build redshift and s3 locally, and then use them for tasks that may run from airflow, tools ... to reduce CI/CD code when have to deploy them to dev, also want to avoid conflict about resources, files, ...

Currently can use LocalStack's S3, but for Redshift, jusr looking for solutions but only get combination using redshift-fake-driver along with package JayDeBeApi in python, but it seems not working properly

import jpype # JPype1==1.4.1
import jaydebeapi # JayDeBeApi==1.2.3
jars = "/Users/trancongminh/Downloads/jars/*"
jpype.startJVM(classpath=jars)
driverName = "jp.ne.opt.redshiftfake.postgres.FakePostgresqlDriver"
print(jpype.JClass(driverName))

# as I spin up a docker container for postgresQL
connectionString = "jdbc:postgresqlredshift://localhost:5432/docker"
uid = "docker"
pwd = "docker"
driverFileName = "/Users/trancongminh/Downloads/jars/redshift-fake-driver_2.12-1.0.15.jar"
conn = jaydebeapi.connect(
    jclassname=driverName,
    url=connectionString,
    driver_args={'user': uid, 'password': pwd},
    jars=driverFileName
)
curs = conn.cursor()
curs.execute("SELECT * FROM pg_catalog.pg_tables limit 10;")
curs.fetchall()

curs.execute("copy db_table_name_v2 from 'http://localhost:4566/events-streaming/traveller/v2/ym_202210/d_04/hm_131901.parquet'  CREDENTIALS 'aws_access_key_id=test;aws_secret_access_key=test' ")

But get errors like No such file or directory, or smth like this

Traceback (most recent call last):
  File "FakeConnection.scala", line 31, in jp.ne.opt.redshiftfake.FakeConnection.prepareStatement
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 531, in execute
    self._prep = self._connection.jconn.prepareStatement(operation)
java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: 'void scala.util.parsing.combinator.Parsers.$init$(scala.util.parsing.combinator.Parsers)'

or may be like this:

Traceback (most recent call last):
  File "FakePreparedStatement.scala", line 138, in jp.ne.opt.redshiftfake.FakePreparedStatement$FakeAsIsPreparedStatement.execute
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 534, in execute
    is_rs = self._prep.execute()
org.postgresql.util.PSQLException: org.postgresql.util.PSQLException: ERROR: could not open file "s3://events-streaming/traveller/v2/ym_202210/d_04/hm_131901.parquet" for reading: No such file or directory
  Hint: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 536, in execute
    _handle_sql_exception()
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 165, in _handle_sql_exception_jpype
    reraise(exc_type, exc_info[1], exc_info[2])
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 57, in reraise
    raise value.with_traceback(tb)
  File "/Users/trancongminh/Pelago/pelago-ds-env/lib/python3.9/site-packages/jaydebeapi/__init__.py", line 534, in execute
    is_rs = self._prep.execute()
jaydebeapi.DatabaseError: org.postgresql.util.PSQLException: ERROR: could not open file "s3://events-streaming/traveller/v2/ym_202210/d_04/hm_131901.parquet" for reading: No such file or directory
  Hint: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy

Anyy body has exp with this pattern just help, thanks

Solutions or keywords that helpful for further investigation


问:
Load functions from dll file in Rust and compile to WASM
I'm newbie in Rust, and trying to compile Rust code into WASM:

```<code>use libloading::{Library, Symbol};
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn main() {
    // Load the DLL
    let lib = unsafe { Library::new("file.dll").unwrap() };

    let connect: Symbol<unsafe extern "C" fn(*const std::os::raw::c_char, *const std::os::raw::c_char) -> i32;> =
                 unsafe { lib.get(b"Function\0").unwrap() };
</code>```

But when i run wasm-pack i'm getting the error:

error[E0432]: unresolved imports 'libloading::Library', 'libloading::Symbol'
 --> src\lib.rs:1:18
  |
1 | use libloading::{Library, Symbol};
  |                  ^^^^^^^  ^^^^^^ no 'Symbol' in the root
  |                  |
  |                  no 'Library' in the root

For more information about this error, try 'rustc --explain E0432'`.
error: could not compile 'rust' due to previous error
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute 'cargo build': exited with exit code: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"`
```

If my undestanding is right - libloading can'not complie to WASM.

Does any one know way to comple such Rust code into WASM? Or may be there is any other approach to access functions from dll file in JS (React).

I'm trying:

change 'release' in toml file;

compile in binary file;

Body:
I'm newbie in Rust, and trying to compile Rust code into WASM:

use libloading::{Library, Symbol};
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn main() {
    // Load the DLL
    let lib = unsafe { Library::new("file.dll").unwrap() };

    let connect: Symbol<unsafe extern "C" fn(*const std::os::raw::c_char, *const std::os::raw::c_char) -> i32;> =
                 unsafe { lib.get(b"Function\0").unwrap() };

But when i run wasm-pack i'm getting the error:

error[E0432]: unresolved imports 'libloading::Library', 'libloading::Symbol'
 --> src\lib.rs:1:18
  |
1 | use libloading::{Library, Symbol};
  |                  ^^^^^^^  ^^^^^^ no 'Symbol' in the root
  |                  |
  |                  no 'Library' in the root

For more information about this error, try 'rustc --explain E0432'`.
error: could not compile 'rust' due to previous error
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute 'cargo build': exited with exit code: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"`

If my undestanding is right - libloading can'not complie to WASM.

Does any one know way to comple such Rust code into WASM? Or may be there is any other approach to access functions from dll file in JS (React).

I'm trying:

change 'release' in toml file;

compile in binary file;


问:
Deleting files conditionally in R
I have time series data as follow:

L1_0101_0601_A
L1_0101_0603_A
L1_0101_0605_B
L1_0101_0608_B
L1_0101_0610_C
L1_0101_0612_C
L1_0101_0615_A
L1_0101_0617_A
L1_0101_0619_A
L1_0101_0622_B
L1_0101_0624_B
L1_0101_0626_C
L1_0101_0629_C
L1_0101_0631_A
L1_0101_0633_A
L1_0101_0635_B
L1_0101_0638_B
L1_0101_0640_C
L1_0101_0642_C
L1_0101_0645_A
L1_0101_0647_A
L1_0101_0649_A

and so on.

I want to keep the files conditionally. I want to keep only two continuous files ending A, B and C. In the file list, sometimes, there are three continuous files ending A or B or C. At that time, I want to remove the last file.

In this example, I would like to drop "L1_0101_0619_A" and "L1_0101_0649_A" because it is the third files ending A. I will keep other twos. Like this, there are several files which I would like to remove.

Title: Deleting files conditionally in R


问:
PhpStorm has a problem when referencing to a Type named "Resource"
PHPStorm version: 2022.2.3 (Build #PS-222.4345.15, built on October 5, 2022)

I have following class:

<?php declare(strict_types=1);

namespace App\API\Resources;

final class ConfiguredResourceFinder implements ResourceFinder
{
    /** @var $resources Resource[] */
    private array $resources;

    public function find(string $key): Resource
    {
        foreach ($this->resources as $resource) {
            $resource-> // public method suggestion from type Resource not appearing
        }
    }
}
```
<p>And following interface in the same namespace:</p>
<pre class="lang-php prettyprint-override"><code><?php declare(strict_types=1);

namespace App\API\Resources;

interface Resource
{
    public function getKey(): string;
}
</code>```

When I type $resource->, no method suggestion getKey() is coming.

But when I change the Type, for example to /** @var $resources Foo[] */:

<?php declare(strict_types=1);

namespace App\API\Resources;

interface Foo
{
    public function getKey(): string;
}
```

I receive suggestions:

Any idea why this is not working with the Resource interface? I already invalidated the PhpStorm cache.

Body:
PHPStorm version: 2022.2.3 (Build #PS-222.4345.15, built on October 5, 2022)

I have following class:

<?php declare(strict_types=1);

namespace App\API\Resources;

final class ConfiguredResourceFinder implements ResourceFinder
{
    /** @var $resources Resource[] */
    private array $resources;

    public function find(string $key): Resource
    {
        foreach ($this->resources as $resource) {
            $resource-> // public method suggestion from type Resource not appearing
        }
    }
}

And following interface in the same namespace:

<?php declare(strict_types=1);

namespace App\API\Resources;

interface Resource
{
    public function getKey(): string;
}

When I type $resource->, no method suggestion getKey() is coming.

But when I change the Type, for example to /** @var $resources Foo[] */:

<?php declare(strict_types=1);

namespace App\API\Resources;

interface Foo
{
    public function getKey(): string;
}

I receive suggestions:

Any idea why this is not working with the Resource interface? I already invalidated the PhpStorm cache.


问:
Axios React cors issue on product
my third party axios requests works properly on local mode properly thanks to "http-proxy-middleware", but after i build and deploy it, axios requests gives homepage html as response.

setupProxy.js file

```<code>const { createProxyMiddleware } = require("http-proxy-middleware")
const cors=require("cors")
const express = require('express');
const app = express();
module.exports=app=>{

    app.use(
        createProxyMiddleware("/api",
        {
            target:"third-party-api-url",
            secure:false,
            changeOrigin:true
        })
    )
</code>```

ApiFrontend.jsx file

```<code>const [apiData,setApiData]=useState("")
  var data = JSON.stringify({
    "MERCHANT": "****",
    "MERCHANT_KEY": "*******************************"
  });
var config = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data : data
  };

  useEffect(()=>{
    axios("/api",config)
    .then(function (response) {
      setApiData(response.data);
    })
    .catch(function (error) {
      console.log(error);
    });
  },[])
</code>```

i tried node server with express and use;

```<code>app.use(cors({
  origin: API_URL,
  credentials: true
 }));
</code>```

but it gives the same response

Title: Axios React cors issue on product

Body:
my third party axios requests works properly on local mode properly thanks to "http-proxy-middleware", but after i build and deploy it, axios requests gives homepage html as response.

setupProxy.js file

const { createProxyMiddleware } = require("http-proxy-middleware")
const cors=require("cors")
const express = require('express');
const app = express();
module.exports=app=>{

    app.use(
        createProxyMiddleware("/api",
        {
            target:"third-party-api-url",
            secure:false,
            changeOrigin:true
        })
    )

ApiFrontend.jsx file

const [apiData,setApiData]=useState("")
  var data = JSON.stringify({
    "MERCHANT": "****",
    "MERCHANT_KEY": "*******************************"
  });
var config = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data : data
  };

  useEffect(()=>{
    axios("/api",config)
    .then(function (response) {
      setApiData(response.data);
    })
    .catch(function (error) {
      console.log(error);
    });
  },[])

i tried node server with express and use;

app.use(cors({
  origin: API_URL,
  credentials: true
 }));

but it gives the same response


问:
Why is my recursive function not working when used within a loop?
I have a database that stores how users were referred into the system like so:

```<code>| user_id | referrer_id |
| 3       | 2           |
| 4       | 3           |
| 5       | 3           |
| 6       | 4           |
| 7       | 4           |
| 8       | 5           |
| 9       | 5           |
| 10      | 6           |
| 11      | 10          |
| 12      | 10          |
</code>```

and I would like to display a specific user's network, i.e., the user, the other users which s/he referred directly, and also other users referred by the direct referrals, in an array.

So far, I've been able to create a recursive function

// The actual get_downlines() function
function get_downlines($upline_id) {
    // Init the UsersMatrix model
    $um_model = model('UsersMatrix');
    $um_model->select('user_id')->where('upline_id', $upline_id);
    $downlines_check = $um_model->findAll(5);
    $downlines = [];
    if ( ! empty($downlines_check) ) {
        foreach($downlines_check as $check) {
            $downlines[] = $check->user_id;
        }
    }

    return $downlines;
}

// User to check
$user = 3;

// The initial network array
$network_array['user_network'][0] = [
    'id' => $user,
    'text' => "user-$user"
];

// Get the user's network
function get_network($referrer, $network_array){
    // This function basically runs a SELECT user_id FROM users WHERE referrer_id = $referrer_id
    // and returns the user_ids in an array: get_downlines()
    $downlines = get_downlines($referrer);
    if (count($downlines) > 0){
        // Loop through the downlines
        foreach($downlines as $downline){
            // Update the array
            array_push($network_array['user_network'], [
                'id' => $downline,
                'text' => "user-$downline",
            ]);

            // Check for the downlines of this user and inner levels
            get_network($downline, $network_array);
        }
    }

    // Return the network array
    return $network_array;
}
```
<p>With this, I expect that when I run the <code>get_network(3, $network_array);</code>, I should get an array like so:</p>
<pre class="lang-php prettyprint-override"><code>Array
(
    [user_network] => Array
        (
            [0] => Array
                (
                    [id] => 3
                    [text] => user-3
                ),
            [1] => Array
                (
                    [id] => 4
                    [text] => user-4
                ),
            [2] => Array
                (
                    [id] => 5
                    [text] => user-5
                ),
            [3] => Array
                (
                    [id] => 6
                    [text] => user-6
                ),
            [4] => Array
                (
                    [id] => 7
                    [text] => user-7
                ),
            [5] => Array
                (
                    [id] => 8
                    [text] => user-8
                ),
            [6] => Array
                (
                    [id] => 9
                    [text] => user-9
                ),
            [7] => Array
                (
                    [id] => 10
                    [text] => user-10
                )

        )

)
</code>```

instead, the page dies with a maximum execution time error. But if I use a user ID without an indirect referrer, it works well. E.g user id 10.

Where am I going wrong?

Body:
I have a database that stores how users were referred into the system like so:

| user_id | referrer_id |
| 3       | 2           |
| 4       | 3           |
| 5       | 3           |
| 6       | 4           |
| 7       | 4           |
| 8       | 5           |
| 9       | 5           |
| 10      | 6           |
| 11      | 10          |
| 12      | 10          |

and I would like to display a specific user's network, i.e., the user, the other users which s/he referred directly, and also other users referred by the direct referrals, in an array.

So far, I've been able to create a recursive function

// The actual get_downlines() function
function get_downlines($upline_id) {
    // Init the UsersMatrix model
    $um_model = model('UsersMatrix');
    $um_model->select('user_id')->where('upline_id', $upline_id);
    $downlines_check = $um_model->findAll(5);
    $downlines = [];
    if ( ! empty($downlines_check) ) {
        foreach($downlines_check as $check) {
            $downlines[] = $check->user_id;
        }
    }

    return $downlines;
}

// User to check
$user = 3;

// The initial network array
$network_array['user_network'][0] = [
    'id' => $user,
    'text' => "user-$user"
];

// Get the user's network
function get_network($referrer, $network_array){
    // This function basically runs a SELECT user_id FROM users WHERE referrer_id = $referrer_id
    // and returns the user_ids in an array: get_downlines()
    $downlines = get_downlines($referrer);
    if (count($downlines) > 0){
        // Loop through the downlines
        foreach($downlines as $downline){
            // Update the array
            array_push($network_array['user_network'], [
                'id' => $downline,
                'text' => "user-$downline",
            ]);

            // Check for the downlines of this user and inner levels
            get_network($downline, $network_array);
        }
    }

    // Return the network array
    return $network_array;
}

With this, I expect that when I run the get_network(3, $network_array);, I should get an array like so:

Array
(
    [user_network] => Array
        (
            [0] => Array
                (
                    [id] => 3
                    [text] => user-3
                ),
            [1] => Array
                (
                    [id] => 4
                    [text] => user-4
                ),
            [2] => Array
                (
                    [id] => 5
                    [text] => user-5
                ),
            [3] => Array
                (
                    [id] => 6
                    [text] => user-6
                ),
            [4] => Array
                (
                    [id] => 7
                    [text] => user-7
                ),
            [5] => Array
                (
                    [id] => 8
                    [text] => user-8
                ),
            [6] => Array
                (
                    [id] => 9
                    [text] => user-9
                ),
            [7] => Array
                (
                    [id] => 10
                    [text] => user-10
                )

        )

)

instead, the page dies with a maximum execution time error. But if I use a user ID without an indirect referrer, it works well. E.g user id 10.

Where am I going wrong?


问:
Unable to lint using Solargraph/Rubocop in VSCODE when developping GEM
I am developing a GEM and I want, like for all my other Rails projects, that VSCode works with Solargraph and Rubocop (through Solargraph) for linting and formatting source files.

Project: https://github.com/nerdgeschoss/shimmer

Specific branch (may disappear when merged): https://github.com/nerdgeschoss/shimmer/tree/feature/34_tests_and_devops

I am getting this error (in VSCODE, "Output", "Ruby Language Server"):

```<code>Unable to activate standard-1.20.0, because rubocop-1.43.0 conflicts with rubocop (= 1.40.0)
</code>```

The Rubocop VSCODE plugin is not installed and the Solargraph is, that's what works in other (Rails) projects.

Those dependencies are listed in the .gemspec file of my GEM.

```<code>  spec.add_development_dependency "rake", "~> 13.0"
  spec.add_development_dependency "solargraph"
  spec.add_development_dependency "standard"
  spec.add_development_dependency "rubocop"
  spec.add_development_dependency "rubocop-rails"
  spec.add_development_dependency "rubocop-performance"
  spec.add_development_dependency "rubocop-rake"
</code>```

The only difference I can think of is that it's here in a .gemspec file, while my other projects where that setup works is specifying those dependencies in Gemfile (they are Rails projects).

Rubocop works perfectly well from the command-line.
Solargraph is not configured to "use bundler", since it fails to even load the extension if I switch that configuration to true... and somehow, that's why it works from the command-line (since it's using bundler), but not in VSCode (somehow using what's in the environment).

I am using rbenv for Ruby versions.

I am definitely "holding something wrong" here, but can't figure out what.
Thanks in advance for any help You may offer!

Body:
I am developing a GEM and I want, like for all my other Rails projects, that VSCode works with Solargraph and Rubocop (through Solargraph) for linting and formatting source files.

Project: https://github.com/nerdgeschoss/shimmer

Specific branch (may disappear when merged): https://github.com/nerdgeschoss/shimmer/tree/feature/34_tests_and_devops

I am getting this error (in VSCODE, "Output", "Ruby Language Server"):

Unable to activate standard-1.20.0, because rubocop-1.43.0 conflicts with rubocop (= 1.40.0)

The Rubocop VSCODE plugin is not installed and the Solargraph is, that's what works in other (Rails) projects.

Those dependencies are listed in the .gemspec file of my GEM.

  spec.add_development_dependency "rake", "~> 13.0"
  spec.add_development_dependency "solargraph"
  spec.add_development_dependency "standard"
  spec.add_development_dependency "rubocop"
  spec.add_development_dependency "rubocop-rails"
  spec.add_development_dependency "rubocop-performance"
  spec.add_development_dependency "rubocop-rake"

The only difference I can think of is that it's here in a .gemspec file, while my other projects where that setup works is specifying those dependencies in Gemfile (they are Rails projects).

Rubocop works perfectly well from the command-line.
Solargraph is not configured to "use bundler", since it fails to even load the extension if I switch that configuration to true... and somehow, that's why it works from the command-line (since it's using bundler), but not in VSCode (somehow using what's in the environment).

I am using rbenv for Ruby versions.

I am definitely "holding something wrong" here, but can't figure out what.
Thanks in advance for any help You may offer!


问:
Pretrained yolov5 returns list of tensors instead of yolo objects
I have the following code:

class yolo_mask_model(pl.LightningModule):
    def __init__(self, weight_path = '/home/vitouser/workspace/yolov5/runs/train/exp6/weights/best.pt', beta_parameter=3):
        super(yolo_mask_model, self).__init__()
        self.save_hyperparameters()
        self.pretrained_yolo = torch.hub.load('ultralytics/yolov5', 'custom', path=weight_path) #, 'yolov5s')#
        self.pretrained_yolo.eval()
        self.beta_parameter = beta_parameter

    def forward(self, input):
        yolo_output = self.pretrained_yolo(input)
        print(yolo_output)
        for index,row in yolo_output.pandas().xyxy[0].iloc[::-1].iterrows():
            do something
```
<p>However I get the following error</p>
<p><code>Exception has occurred: AttributeError 'list' object has no attribute 'pandas'</code></p>
<p>upon further inspection <code>yolo_output</code> is a list of the tensors. (I am guessing there are 3 objects in the image)</p>
```for tensor in yolo_output: print(tensor.size())
torch.Size([1, 3, 40, 80, 8])
torch.Size([1, 3, 20, 40, 8])
torch.Size([1, 3, 10, 20, 8])
```
<p>According the the documentation I understand, that the model output should be some kind of yolo object.</p>
<p>if I replace my main</p>
<pre class="lang-py prettyprint-override"><code>__name__ == '__main__':
    mymodel = yolo_mask_model()
    image = Image.open("my_image.jpeg")
    transform = transforms.Compose([transforms.Resize((320,640)),transforms.ToTensor()])
    tensor = transform(image)
    input_tensor = torch.unsqueeze(tensor, 0)
    output = mymodel(input_tensor)
</code>```

with the following code from the documentation the results is as expected.

if __name__ == '__main__':
    imgs = ["my_image.jpeg"]
    mymodel = yolo_mask_model()
    results = mymodel(imgs)
```

Where is my mistake when providing a tensor?

Body:
I have the following code:

class yolo_mask_model(pl.LightningModule):
    def __init__(self, weight_path = '/home/vitouser/workspace/yolov5/runs/train/exp6/weights/best.pt', beta_parameter=3):
        super(yolo_mask_model, self).__init__()
        self.save_hyperparameters()
        self.pretrained_yolo = torch.hub.load('ultralytics/yolov5', 'custom', path=weight_path) #, 'yolov5s')#
        self.pretrained_yolo.eval()
        self.beta_parameter = beta_parameter

    def forward(self, input):
        yolo_output = self.pretrained_yolo(input)
        print(yolo_output)
        for index,row in yolo_output.pandas().xyxy[0].iloc[::-1].iterrows():
            do something

However I get the following error

Exception has occurred: AttributeError 'list' object has no attribute 'pandas'

upon further inspection yolo_output is a list of the tensors. (I am guessing there are 3 objects in the image)

for tensor in yolo_output: print(tensor.size())
torch.Size([1, 3, 40, 80, 8])
torch.Size([1, 3, 20, 40, 8])
torch.Size([1, 3, 10, 20, 8])

According the the documentation I understand, that the model output should be some kind of yolo object.

if I replace my main

__name__ == '__main__':
    mymodel = yolo_mask_model()
    image = Image.open("my_image.jpeg")
    transform = transforms.Compose([transforms.Resize((320,640)),transforms.ToTensor()])
    tensor = transform(image)
    input_tensor = torch.unsqueeze(tensor, 0)
    output = mymodel(input_tensor)

with the following code from the documentation the results is as expected.

if __name__ == '__main__':
    imgs = ["my_image.jpeg"]
    mymodel = yolo_mask_model()
    results = mymodel(imgs)

Where is my mistake when providing a tensor?


问:
How to send a TCP request with payload in Java
We are working for the Camera integration project, we have connected this camera through wifi ( camera act as a server), for interrations camera company provides TCP protocol, I have confused to how to send a request for this. We are trying this in JAVA. Please help us to understand this communication protocols.

Please give a hint or idea to commuction with this device.

We have tried below code and its not worked as expected.

```<code>try {
    // Create a socket to connect to the server
    Socket socket = new Socket("192.168.150.1", 31000);

    // Send the payload
    OutputStream out = socket.getOutputStream();
    out.write(25004);
    out.flush();

    // Receive the payload
    InputStream in = socket.getInputStream();
    byte[] buffer = new byte[1024];
    int bytesRead = in.read(buffer);
    String response = new String(buffer, 0, bytesRead);
    System.out.println("Response from server: " + response);

    // Close the socket
    socket.close();

} catch (IOException e) {
    e.printStackTrace();
}
</code>```

Body:
We are working for the Camera integration project, we have connected this camera through wifi ( camera act as a server), for interrations camera company provides TCP protocol, I have confused to how to send a request for this. We are trying this in JAVA. Please help us to understand this communication protocols.

Please give a hint or idea to commuction with this device.

We have tried below code and its not worked as expected.

try {
    // Create a socket to connect to the server
    Socket socket = new Socket("192.168.150.1", 31000);

    // Send the payload
    OutputStream out = socket.getOutputStream();
    out.write(25004);
    out.flush();

    // Receive the payload
    InputStream in = socket.getInputStream();
    byte[] buffer = new byte[1024];
    int bytesRead = in.read(buffer);
    String response = new String(buffer, 0, bytesRead);
    System.out.println("Response from server: " + response);

    // Close the socket
    socket.close();

} catch (IOException e) {
    e.printStackTrace();
}


问:
Are there any forwarding proxies that holds state in Azure?
I'm wondering if there are any serverless services on Azure that i could use to implement a ratelimit for outgoing requests. The requests will be sent from different workers and a distributed lock doesn't feel like the correct way forward.

One idea was to host a forwarding proxy that manages and limits the rate of outgoing http requests to a specific endpoint, but utilizing something serverless would be preferred.


问:
Renesas RA2 I2C Bootloader firmware update
I would like to have I2C bootloader for Renesas RA2E1. But I need an update via I2C to be supported.
IS anyone aware if Renesas have I2C bootloader? And if not, what would be the other option, is there for example third party I2C bootloader that I can use for RA2E1 and support update via I2C?</p>


问:
How copy first and last column data of 3 pivot tables and put grand total in next columns
step 1 - copy first and last column data of first pivot table and paste it in same sheet (Say A61, B61).

step 2 - Copy first and last column date of second pivot table and past it below data of first table. Grand total column should go to next column (Say A65, C65)

step 3 - Copy first and last column date of third pivot table and past it below data of second table. Grand total column should go to next column (Say A70, D65)

I have written the code half way through

```<code>Sub Pivotcopy()

Dim pt As PivotTable
Dim s1 As Worksheet
Dim Lastrow As Long
Set s1 = Sheets("EDP Defaulter")
Set pt = ActiveSheet.PivotTables("PivotTable6")
With pt.TableRange2
Union(.Columns(1), .Columns(.Columns.Count)).Copy
End With

s1.Range("A61").PasteSpecial Paste:=xlPasteValues
s1.Rows("61:65").EntireRow.Delete

Set pt = ActiveSheet.PivotTables("PivotTable7")
With pt.TableRange2
Union(.Columns(1), .Columns(.Columns.Count)).Copy
End With

Lastrow = s1.Range("A61:A" & Rows.Count).End(xlDown).Row
s1.Range("A" & Lastrow - 1).PasteSpecial Paste:=xlPasteValues
End Sub
</code>```

I need help in pasting the second table data in column C. As the command above copies and place it in column A and B

Body:
step 1 - copy first and last column data of first pivot table and paste it in same sheet (Say A61, B61).

step 2 - Copy first and last column date of second pivot table and past it below data of first table. Grand total column should go to next column (Say A65, C65)

step 3 - Copy first and last column date of third pivot table and past it below data of second table. Grand total column should go to next column (Say A70, D65)

I have written the code half way through

Sub Pivotcopy()

Dim pt As PivotTable
Dim s1 As Worksheet
Dim Lastrow As Long
Set s1 = Sheets("EDP Defaulter")
Set pt = ActiveSheet.PivotTables("PivotTable6")
With pt.TableRange2
Union(.Columns(1), .Columns(.Columns.Count)).Copy
End With

s1.Range("A61").PasteSpecial Paste:=xlPasteValues
s1.Rows("61:65").EntireRow.Delete

Set pt = ActiveSheet.PivotTables("PivotTable7")
With pt.TableRange2
Union(.Columns(1), .Columns(.Columns.Count)).Copy
End With

Lastrow = s1.Range("A61:A" & Rows.Count).End(xlDown).Row
s1.Range("A" & Lastrow - 1).PasteSpecial Paste:=xlPasteValues
End Sub

I need help in pasting the second table data in column C. As the command above copies and place it in column A and B


问:
How to check if variable type is equal to defined type
I have a type that has some properties and I want to check if a variable type is equal to it or not.

```<code>export type ITestType = {
  select: {
    options?: any[];
    multiple?: boolean;
  };
  string: undefined;
  hidden: undefined;
  date: {
    format: string;
    withOriginalDate?: boolean;
  };
};

const test :ITestType['select'] = {}
</code>```

I already tried:

```<code>console.log(typeof test === ITestType['select'])
</code>```

and:

```<code>console.log(test instanceof ITestType['select'])
</code>```

Playground

Body:
I have a type that has some properties and I want to check if a variable type is equal to it or not.

export type ITestType = {
  select: {
    options?: any[];
    multiple?: boolean;
  };
  string: undefined;
  hidden: undefined;
  date: {
    format: string;
    withOriginalDate?: boolean;
  };
};

const test :ITestType['select'] = {}

I already tried:

console.log(typeof test === ITestType['select'])

and:

console.log(test instanceof ITestType['select'])

Playground


问:
Do I need to add single quote to parameters sent from JDBC to SQL Server 2019 database to avoid implicit conversion?
This are the parameters in the program

```<code>st.setString(2, field_ex_2);
st.setString(3, field_ex_3);
st.setString(4, field_ex_4)
</code>```

And this is the way SQL Server received them:

```<code>SELECT * FROM TABLE_ISSUE WHERE branch=347 AND pos = 3 AND "SEQUENCE" = 473
</code>```

The fields are defined as varchar and this select generates an implicit conversion which made the processor rises to 30 % or more.

We solved similar cases changing application and table when possible.

We see that problem is solved just adding single quote to value:

```<code>WHERE branch='347' AND pos = '3' AND "SEQUENCE" = '473'
</code>```

We need to understand why JDBC send parameters as numeric or at least they arrived without single quotes when defined as string.

Body:
This are the parameters in the program

st.setString(2, field_ex_2);
st.setString(3, field_ex_3);
st.setString(4, field_ex_4)

And this is the way SQL Server received them:

SELECT * FROM TABLE_ISSUE WHERE branch=347 AND pos = 3 AND "SEQUENCE" = 473

The fields are defined as varchar and this select generates an implicit conversion which made the processor rises to 30 % or more.

We solved similar cases changing application and table when possible.

We see that problem is solved just adding single quote to value:

WHERE branch='347' AND pos = '3' AND "SEQUENCE" = '473'

We need to understand why JDBC send parameters as numeric or at least they arrived without single quotes when defined as string.


问:
How can I track A/B testing event and show the difference from google analytics 4?
I'm trying to do the A/B testing.
Question: How can I add custom segments to track the specific event? and show the difference between variant A and variant B.
This is the way I have tried, in the end I will choose method 2.Using code.

Using Google Optimize, it is easy to connect GA4, then show the result. Because some of our A/B tests will affect a lot of code, I temporarily cannot use Google Optimize.

Using code,  I use vue-gtag (https://matteo-gabriele.gitbook.io/vue-gtag/) to trigger the event to GA4, the variant will be like A or B. It can successful report to GA. But I was confuse How to add custom segments to track the A/B testing event, and see the difference between variant A and variant B.

Experiment.js

```<code>function createState () {
  return {
    experiments: [
      {
        name: 'checkout-button',
        variants: ['original', 'v2'],
      },
    ],
  }
}

function createActions () {
  return {
    async getVariant ({ state, commit }, options = {}) {
      const { experimentName } = options
      if (!jsCookies.get(`${experimentName}-experiment`)) {
        const experiment = state.experiments.find(
          (data) => data.name === experimentName,
        )
        const variant = experiment.variants[
          Math.floor(Math.random() * experiment.variants.length)
        ]
        commit('experiments', variant)
        jsCookies.set(`${experimentName}-experiment`, variant)
        return variant
      }
      return jsCookies.get(`${experimentName}-experiment`)
    },
  }
}
</code>```

Player.vue

```<code>async mounted () {
  this.variant = await this.$store.dispatch('v2/experiments/getVariant', { experimentName: 'checkout-button-' })
},

methods: {
  clickButton() {
     this.$gtag.event('A/B Testing - experiment01', {
        event_category: 'A/B Testing',
        event_label: `Experiment:${this.variant}`,
     })
  }
}
</code>```

Body:
I'm trying to do the A/B testing.
Question: How can I add custom segments to track the specific event? and show the difference between variant A and variant B.
This is the way I have tried, in the end I will choose method 2.Using code.

Using Google Optimize, it is easy to connect GA4, then show the result. Because some of our A/B tests will affect a lot of code, I temporarily cannot use Google Optimize.

Using code,  I use vue-gtag (https://matteo-gabriele.gitbook.io/vue-gtag/) to trigger the event to GA4, the variant will be like A or B. It can successful report to GA. But I was confuse How to add custom segments to track the A/B testing event, and see the difference between variant A and variant B.

Experiment.js

function createState () {
  return {
    experiments: [
      {
        name: 'checkout-button',
        variants: ['original', 'v2'],
      },
    ],
  }
}

function createActions () {
  return {
    async getVariant ({ state, commit }, options = {}) {
      const { experimentName } = options
      if (!jsCookies.get(`${experimentName}-experiment`)) {
        const experiment = state.experiments.find(
          (data) => data.name === experimentName,
        )
        const variant = experiment.variants[
          Math.floor(Math.random() * experiment.variants.length)
        ]
        commit('experiments', variant)
        jsCookies.set(`${experimentName}-experiment`, variant)
        return variant
      }
      return jsCookies.get(`${experimentName}-experiment`)
    },
  }
}

Player.vue

async mounted () {
  this.variant = await this.$store.dispatch('v2/experiments/getVariant', { experimentName: 'checkout-button-' })
},

methods: {
  clickButton() {
     this.$gtag.event('A/B Testing - experiment01', {
        event_category: 'A/B Testing',
        event_label: `Experiment:${this.variant}`,
     })
  }
}


问:
(Godot) Sprite bounces off Tiles after Walking (Bug?)
My Sprite always jumps a little when walking a straight distance. No hitbox is overlapping and I use move and slide with snap</p>


问:
Error When Uploading Attachments with Directline App Service Extension
We are attempting to upload a xml file using Directline App Service Extension, but getting an error with the message: "Error getting value from 'ReadTimeout' on 'Microsoft.Bot.Streaming.Payloads.PayloadStream'."

We have deployed an Azure bot and have enabled Directline App Service Extension as we want to restrict access to our bot.
We followed the Microsoft Docs https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-directline-extension-net-bot?view=azure-bot-service-4.0 and correctly configured the bot.We are getting an "Error getting value from 'ReadTimeout' on 'Microsoft.Bot.Streaming.Payloads.PayloadStream'." error when we try to upload a config.xml file.
Bot was working fine, but after enabling Directline ASE, we are getting this error.


问:
Ability to display custom popup within another custom popup in froala editor
I am using Froala Editor to edit a HTML document. I was trying to edit the html text by selecting a portion of HTML and then showing a popup on with multiple custom buttons. I have defined a custom froala plugin for the same and I am able to show that plugin popup.

Within the plugin, I have few custom buttons, If I click on those buttons, I want to show another popup on top of the already displayed popup, I implemented the changes, but I am not able to see the second popup.

Appreciate any help on how this can be achieved

I tried defining custom plugin for two different popups and showing one poup inside another popup but it did not display the second popup


问:
Removing parameters outputted in JSON response. How to remove array and only show specific array of fields in Postman?
Removing parameters outputted in JSON response. How to remove the array and only show a specific array of fields in Postman?</p>


问:
Flutter Local Notification package in different isolate
My goal is display a notification by backgound data message, If user click notification then direct to certain screen, But like this issue says currently onDidReceiveNotificationResponse won't fired if FlutterLocalNotificationsPlugin initialized in different isolate more then once, Is there anyway to solve this? Or there have other plugin can solve this issue?


Title: How can I use styled-components to change an element in svg with a specific id?

Body:
I want to give a mouse over effect by region on the map.

I'm using React and styled-components. I want to assign an id to the svg <path> and change only the fill value of the path when the mouse is over.

<path id="areaA-name" fill-rule="evenodd" clip-rule="evenodd" d="M546.173 508.974C549.935 503.186 553.954 497.461 556.675 491.184C557.635 488.979 555.563 485.093 554.212 482.311C551.402 476.514 548.138 470.939 544.368 463.995C542.803 464.938 539.958 466.769 536.988 468.37C535.609 469.108 533.955 469.872 532.47 469.775C515.673 468.752 508.541 473.9 505.011 490.526C503.073 499.665 502.219 509.045 500.049 518.123C499.169 521.822 496.723 527.147 493.896 527.974C487.725 529.77 480.46 529.245 475.889 523.582C470.5 516.887 466.01 509.481 460.63 501.657C454.005 503.924 447.541 501.017 441.138 496.892C436.55 493.931 431.597 493.006 426.146 495.842C421.104 498.474 416.062 496.358 412.149 490.57C409.117 486.08 406.521 481.67 411.945 476.647C419.37 469.757 426.19 462.2 433.562 455.238C440.8 448.41 440.507 440.781 432.015 435.803C426.252 432.424 420.197 429.49 414.115 426.716C410.06 424.867 408.032 422.938 409.695 417.95C411.954 411.202 411.189 404.587 409.873 397.279C408.432 389.321 406.369 382.235 402.626 375.283C402.092 374.287 402.688 371.789 403.595 371.131C404.858 370.224 407.134 369.717 408.584 370.206C418.827 373.638 426.457 368.321 425.728 357.101C425.39 351.864 427.453 348.628 430.53 345.321C437.812 337.506 447.167 333.754 457.438 332.207C462.648 331.424 468.224 330.322 473.204 331.389C484.328 333.771 489.699 328.517 495.567 319.911C501.854 310.691 508.684 300.671 521.444 298.439C522.386 298.27 523.587 295.363 523.365 293.932C523.125 292.349 521.266 291.069 520.323 289.522C519.15 287.601 518.198 285.556 517.158 283.565C519.781 283.076 522.644 281.689 524.965 282.311C527.891 283.094 530.976 285.005 532.942 287.326C539.975 295.639 548.539 298.244 558.622 294.67C565.309 292.296 571.649 288.962 578.176 286.143C584.748 283.307 591.106 281.475 597.508 287.157C599.767 289.166 603.448 289.548 606.436 290.766C610.864 292.58 613.203 291.238 614.377 286.508C615.133 283.476 616.306 278.995 618.44 278.177C623.598 276.212 627.991 279.306 631.565 283.351C637.212 289.744 639.053 297.426 640.262 305.614C641.56 314.398 643.161 323.227 645.624 331.744C652.409 355.225 653.423 378.901 646.273 402.169C639.391 424.574 639.711 447.547 638.155 470.415C637.986 472.86 639.684 475.429 640.511 477.936C642.805 476.585 645.064 475.162 647.402 473.891C652.302 471.224 655.308 467.436 657.211 461.968C657.975 459.772 662.839 459.008 665.836 457.594V461.257C664.609 472.726 663.302 484.187 662.172 495.665C660.856 509.063 659.078 522.195 652.871 534.553C650.381 539.514 647.18 538.029 643.863 538.029C640.582 538.029 638.661 536.411 638.635 532.731C638.599 527.885 635.86 524.133 631.396 523.297C624.478 522.017 617.338 521.421 610.304 521.51C606.018 521.564 597.677 534.491 597.152 540.803C596.032 540.67 594.885 540.697 593.836 540.386C585.53 537.878 577.163 538.332 570.565 543.782C558.027 554.14 546.787 550.139 535.467 542.253C534.338 541.47 533.102 539.648 533.279 538.527C533.466 537.345 535.129 536.091 536.436 535.46C536.436 535.46 539.575 531.788 540.367 528.507" fill="#EAF0FA"/>
<path id="areaB-name" fill...

I tried implementing the following by referring to the codes that assign ids to child elements and change styles in css, but it didn't work.

const StyledIconVirtualMap = styled(IconVirtualMap)`
  #areaA-name > path {
    fill: orange;
  }
`;
// or

const StyledIconVirtualMap = styled(IconVirtualMap)`
  path {
   #areaA-name {
     fill: orange;
   }
  }
`;

const VirtualMap = () => (
  <Layout>


问:
How to resolve this error when deploying an ADF release in DevOps: ##[error]ADFT0010: Wrong path defined in config for object(path)
We have 3 different release environments DEV, UAT, PROD.

I made a small change in a script (just added a comment), just so that I can test the deployment process, as the previous people working on this project have left and I will be taking it over.

I managed to deploy to DEV, but when I try to deploy to UAT and PROD I get the following error:

2023-01-16T12:08:55.5352211Z Config file:   D:\a\r1\a_Azure Data Factory CI\drop\deployment\config-uat.csv

2023-01-16T12:08:55.5519094Z Validation of config file completed.

##[error]ADFT0010: Wrong path defined in config for object(path): pipeline.Cube 15 mins(properties.activities.typeProperties.url)

Do I just need to make a small change in a config file or would I need to get my head around this particular pipeline?

I went into the pipeline within the UAT ADF, but could not see anything that would cause it to fail.

I can manually trigger that particular pipeline in UAT and it works fine.
I have looked at the setting for the activity and it contains the following url: https://northeurope.asazure.windows.net/servers/asvfmmymiuatne/models/mymi/refreshes
The URL looks to be exactly the same url as defined in the config-uat.csv:
https://northeurope.asazure.windows.net/servers/asvfmmymiuatne/models/mymi/refreshes


问:
Append Html Tag into another div from diffrent page in js page
I have a page call js and another page call index now i want to create a popup form field which is created from the js page and all the html elements comes into the div from another random page. on js page i jast want to show the form field . how do i do that?

```<code>    function popupscript(event) {
    let modal = document.createElement("div");
    modal.style.height = "500px";
    modal.style.width = "700px";
    modal.style.backgroundColor = "red";
    modal.style.position = "fixed";
    modal.style.left = "270px";
    modal.style.top = "100px";
    // modal.style.margin.left = "300px";
    let form = "<h1>HI</h1>"

    modal.innerHTML +="<h3>NO:</h3>";
    modal.innerHTML +="<form action='' method='POST'>";
    modal.innerHTML +="<label>";
    modal.innerHTML +="<input type='text' name='name' placeholder='Name' value=''>";
    modal.innerHTML +="</form>";
    body.append(modal);
}
</code>```

i tried this js code and the output is bellowenter image description here

Body:
I have a page call js and another page call index now i want to create a popup form field which is created from the js page and all the html elements comes into the div from another random page. on js page i jast want to show the form field . how do i do that?

    function popupscript(event) {
    let modal = document.createElement("div");
    modal.style.height = "500px";
    modal.style.width = "700px";
    modal.style.backgroundColor = "red";
    modal.style.position = "fixed";
    modal.style.left = "270px";
    modal.style.top = "100px";
    // modal.style.margin.left = "300px";
    let form = "
HI
"

    modal.innerHTML +="
NO:
";
    modal.innerHTML +="<form action='' method='POST'>";
    modal.innerHTML +="";
    modal.innerHTML +="<input type='text' name='name' placeholder='Name' value=''>";
    modal.innerHTML +="</form>";
    body.append(modal);
}

i tried this js code and the output is bellowenter image description here


问:
The handshake is synchronous or asynchronous?
I would like to know if the handshake protocol is synchronous or asynchronous. I heard the is also called the synchronization protocol,but i don't know synchronous or asynchronous.</p>


问:
Antd table reusable column function in typescript
I am creating an admin panel using antd and typescript. I have implemented a table with filter, sort and pagination. Realized if I could make the columns reusable it would reduce the amount of code. New to typescript. I am struggling to make the columns reusable.

Current working implementation for table:

```<code>import type { ColumnsType } from "antd/es/table";

const Department: FC = () =>{
  const columns: ColumnsType<DepartmentDataType> = [
    {
      title: "Department Name",
      dataIndex: "departmentName",
      key: "departmentName",
      sorter: true,
      filterDropdown: ({ setSelectedKeys, confirm }) => {
        return (
          <Input
            placeholder="Department Name"
            onChange={(event) =>
              useDebounce(event.target.value ?? "", setSelectedKeys, confirm)
            }
          />
        );
      },
      filterIcon: () => {
        return <SearchOutlined />;
      },
      render: (text) => <h2>{text}</h2>,
    },
    {
      title: "Action",
      key: "action",
      render: (text, record) => (
        <Space size="middle">
          <IconButton
            title="Edit"
            handleClick={() => handleEdit(record)}
          >
            <EditOutlined />
          </IconButton>
        </Space>
      ),
    },
  ];

return(
        <Table
          columns={columns}
          pagination={{ position: ["bottomRight"] }}
          dataSource={data}
          scroll={{ x: true }}
          bordered={true}
          onChange={(pagination, filters, sorter) =>
            handleTableChange(pagination, filters, sorter)
          }
        />
)
}
</code>```

This code is working. Then I tried to make the column reusable by using a hook. My attempt so far

```<code>import type { ColumnsType } from "antd/es/table";
import { Input } from "antd";
import { SearchOutlined } from "@ant-design/icons";
import { useDebounce } from "./useDebounce.hook";
import DepartmentDataType from "../interfaces/department.interface";

type ColumnProps = {
  key: string;
  label: string;
  sorter?: boolean;
  filter?: boolean;
  actions?: string[];
  bold?: boolean;
};

export const useColumn = (props: ColumnProps[]) => {
  console.log("props", props);
  const columns: ColumnsType<DepartmentDataType> = props.map((prop) => {
    return {
      title: prop.label,
      dataIndex: prop.key,
      key: prop.key,
      sorter: prop.sorter ? true : false,
      filterDropdown: ({ setSelectedKeys, confirm }) => (
        <Input
          placeholder="Department Name"
          onChange={(event) =>
            useDebounce(event.target.value ?? "", setSelectedKeys, confirm)
          }
        />
      ),
      filterIcon: () => {
        return <SearchOutlined />;
      },
      render: (text) => <h2>{text}</h2>,
    };
  });
  return columns;
};
</code>```

Which is throwing a lot of errors for the functions. Not sure how to implement this filterDropdown, filterIcon, render function in columns. What to do here?? And how to make it reusable so that I can use it for other data types??

Department Interface:

```<code>export default interface DepartmentDataType {
  key: string;
  departmentName: string;
}
</code>```

Edit:
I am thinking to call the data like this.

```<code>const sampleData: ColumnsType<DepartmentDataType> = useColumn([
    {
      key: "departName",
      label: "Department Name",
      sorter: true,
      filter: true,
    },
    {
      key: "action",
      label: "Action",
      actions: ["edit", "delete"],
    },
  ]);
</code>```

Body:
I am creating an admin panel using antd and typescript. I have implemented a table with filter, sort and pagination. Realized if I could make the columns reusable it would reduce the amount of code. New to typescript. I am struggling to make the columns reusable.

Current working implementation for table:

import type { ColumnsType } from "antd/es/table";

const Department: FC = () =>{
  const columns: ColumnsType<DepartmentDataType> = [
    {
      title: "Department Name",
      dataIndex: "departmentName",
      key: "departmentName",
      sorter: true,
      filterDropdown: ({ setSelectedKeys, confirm }) => {
        return (
          <Input
            placeholder="Department Name"
            onChange={(event) =>
              useDebounce(event.target.value ?? "", setSelectedKeys, confirm)
            }
          />
        );
      },
      filterIcon: () => {
        return <SearchOutlined />;
      },
      render: (text) =>
{text}
,
    },
    {
      title: "Action",
      key: "action",
      render: (text, record) => (
        <Space size="middle">
          <IconButton
            title="Edit"
            handleClick={() => handleEdit(record)}
          >
            <EditOutlined />
          </IconButton>
        </Space>
      ),
    },
  ];

return(

            handleTableChange(pagination, filters, sorter)
          }
        />
)
}

This code is working. Then I tried to make the column reusable by using a hook. My attempt so far

import type { ColumnsType } from "antd/es/table";
import { Input } from "antd";
import { SearchOutlined } from "@ant-design/icons";
import { useDebounce } from "./useDebounce.hook";
import DepartmentDataType from "../interfaces/department.interface";

type ColumnProps = {
  key: string;
  label: string;
  sorter?: boolean;
  filter?: boolean;
  actions?: string[];
  bold?: boolean;
};

export const useColumn = (props: ColumnProps[]) => {
  console.log("props", props);
  const columns: ColumnsType<DepartmentDataType> = props.map((prop) => {
    return {
      title: prop.label,
      dataIndex: prop.key,
      key: prop.key,
      sorter: prop.sorter ? true : false,
      filterDropdown: ({ setSelectedKeys, confirm }) => (
        <Input
          placeholder="Department Name"
          onChange={(event) =>
            useDebounce(event.target.value ?? "", setSelectedKeys, confirm)
          }
        />
      ),
      filterIcon: () => {
        return <SearchOutlined />;
      },
      render: (text) =>
{text}
,
    };
  });
  return columns;
};

Which is throwing a lot of errors for the functions. Not sure how to implement this filterDropdown, filterIcon, render function in columns. What to do here?? And how to make it reusable so that I can use it for other data types??

Department Interface:

export default interface DepartmentDataType {
  key: string;
  departmentName: string;
}

Edit:
I am thinking to call the data like this.

const sampleData: ColumnsType<DepartmentDataType> = useColumn([
    {
      key: "departName",
      label: "Department Name",
      sorter: true,
      filter: true,
    },
    {
      key: "action",
      label: "Action",
      actions: ["edit", "delete"],
    },
  ]);


问:
StepFunctions and manual approval
I created a Step Function with an Activity in it, when this SF starts it remains Running as it waits for manual approval. Correct.
At this point, I can invoke a lambda function (a worker) that calls the method getActivityTask. The answer to this method is something like this:

```<code>{
   "taskToken": "xyz",
   "input": "<THE INPUT PROVIDED>"
}
</code>```

The taskToken value is useful because I need it to call a sendTaskSuccess or sendTaskFailure to restart or fail the SF execution.

Everything seems clear.

The thing I don't understand is why getActivityTask provide a result only the first time is invoked. I mean: if I have a SF execution blocked for manual approval and if I exec two times the call to getActivityTask, the first time it answers with the payload above, and the second time it is null.

I cannot find any info about this behaviour on the doc.

Title: StepFunctions and manual approval

Body:
I created a Step Function with an Activity in it, when this SF starts it remains Running as it waits for manual approval. Correct.
At this point, I can invoke a lambda function (a worker) that calls the method getActivityTask. The answer to this method is something like this:

{
   "taskToken": "xyz",
   "input": "<THE INPUT PROVIDED>"
}

The taskToken value is useful because I need it to call a sendTaskSuccess or sendTaskFailure to restart or fail the SF execution.

Everything seems clear.

The thing I don't understand is why getActivityTask provide a result only the first time is invoked. I mean: if I have a SF execution blocked for manual approval and if I exec two times the call to getActivityTask, the first time it answers with the payload above, and the second time it is null.

I cannot find any info about this behaviour on the doc.


问:
Flink Completion Exception Couldn't acquire the minimum required resources
Hi I have a flink Job that that every time there's an Exception, it will have after it around 7 additional Exceptions of
java.util.concurrent.CompletionException: org.apache.flink.runtime.jobmanager.schedular.NoResourceAvailableException: Could not acquire the minimum required resources.
For example the timing
5:47:40 - Exception
5:50:40 - NoResourceAvailableException
5:50:47 - NoResourceAvailableException
5:50:56 - NoResourceAvailableException
5:51:10 - NoResourceAvailableException
5:51:31 - NoResourceAvailableException
5:52:04 - NoResourceAvailableException
5:52:57 - NoResourceAvailableException

Only after around 5 min the job runned again.

The environment have 15 taskmanger and 30 taks slots.
And the job run on 28 task slots, we left 2 task slot so on fail the environment will have standby task slots.

As you can see it still doesn't help and the job takes 5 min until it's up again.

The environment run on kubernetes.
My guess is that the pods restart because of the Exception and that the jobmanger waits to the same pod to be restored. But I don't understand why it won't use the standby task slots.

The up time of the job is crucial so every minute count and we try to have minimal downtime.

I tried to change the number of task slots and task manager so it will have more weaker instances. But the job won't run in any diffrent configuration we get backpresure instead.

And adding more standby task slot in the current state is extremely expensive because each pods (task manager) have a lot of resources.

Tnx for anyone that can help.