问:
How to reorder a object after array manipulation with specific order using JS
I have an array

```<code>[{"Name": "MyName","First Name": "ABS","Last Name": "ACS","College": [{"card": {"Name": "card1","Id": "id1"},"Status": "Active","Type": "add","Class": {"Class No": "123"},"Room": {"RoomA": "NULL","RoomB Number": "NULL"}},{"card": {"Name": "card1","Id": "id1"},"Status": "Active","Type": "add","Class": {"Class No": "123"},"Room": {"roomA": "NULL","RoomB Number": "NULL"}}],"Odd Structuring": null,"Accountable Class": "5663"}]
</code>```

Since I need to flat this array, I have written the below logic

```<code>const uniqueKeys = Object.keys(
  arr.reduce((result, obj) => Object.assign(result, obj), {})
);

if (uniqueKeys.includes('College')) {
  arr.map((item) => {
    item.College.map((element, k) => {
      let getKeys = Object.entries(element);
      getKeys.forEach((data) => {
        if (typeof data[1] === 'object') {
          let keys = Object.keys(data[1]);
          keys.forEach((key) => {
            item[`${data[0]} - ${key} ${k + 1}`] = data[1][key];
          });
        } else {
          item[`College - ${data[0]} ${k + 1}`] = data[1];
        }
      });
    });
  });
  arr = arr.map(({ College, ...data }) => ({ ...data }));
  console.log(arr);
}
</code>```

I am getting the result like this

```<code>[{"Accountable Class": "5663","Class - Class No 1": "123","Class - Class No 2": "123","College - Status 1": "Active","College - Status 2": "Active","College - Type 1": "add","College - Type 2": "add","First Name": "ABS","Last Name": "ACS","Name": "MyName","Odd Structuring": null,"Room - RoomA 1": "NULL","Room - RoomB Number 1": "NULL","Room - RoomB Number 2": "NULL","Room - roomA 2": "NULL","card - Id 1": "id1","card - Id 2": "id1","card - Name 1": "card1","card - Name 2": "card1"}]
</code>```

But my expected result order should be

```<code>{"Name" : "MyName","First Name": "ABS","Last Name": "ACS","card Name 1": "card1","card Id 1": "id1","College Status 1": "Active","College Type 1": "add","Class Class No 1": "123","Room RoomA 1": "NULL","Room RoomB Number 1": "NULL","card Name 2": "card1","card Id 2": "id1","College Status 2": "Active","College Type 2": "add","Class Class No 2": "123","Room RoomA 2": "NULL","Room RoomB Number 2": "NULL","Odd Structuring":null,"Accountable Class": '5663'}
</code>```

Can anyone please help me to get the expected result

Body:
I have an array

[{"Name": "MyName","First Name": "ABS","Last Name": "ACS","College": [{"card": {"Name": "card1","Id": "id1"},"Status": "Active","Type": "add","Class": {"Class No": "123"},"Room": {"RoomA": "NULL","RoomB Number": "NULL"}},{"card": {"Name": "card1","Id": "id1"},"Status": "Active","Type": "add","Class": {"Class No": "123"},"Room": {"roomA": "NULL","RoomB Number": "NULL"}}],"Odd Structuring": null,"Accountable Class": "5663"}]

Since I need to flat this array, I have written the below logic

const uniqueKeys = Object.keys(
  arr.reduce((result, obj) => Object.assign(result, obj), {})
);

if (uniqueKeys.includes('College')) {
  arr.map((item) => {
    item.College.map((element, k) => {
      let getKeys = Object.entries(element);
      getKeys.forEach((data) => {
        if (typeof data[1] === 'object') {
          let keys = Object.keys(data[1]);
          keys.forEach((key) => {
            item[`${data[0]} - ${key} ${k + 1}`] = data[1][key];
          });
        } else {
          item[`College - ${data[0]} ${k + 1}`] = data[1];
        }
      });
    });
  });
  arr = arr.map(({ College, ...data }) => ({ ...data }));
  console.log(arr);
}

I am getting the result like this

[{"Accountable Class": "5663","Class - Class No 1": "123","Class - Class No 2": "123","College - Status 1": "Active","College - Status 2": "Active","College - Type 1": "add","College - Type 2": "add","First Name": "ABS","Last Name": "ACS","Name": "MyName","Odd Structuring": null,"Room - RoomA 1": "NULL","Room - RoomB Number 1": "NULL","Room - RoomB Number 2": "NULL","Room - roomA 2": "NULL","card - Id 1": "id1","card - Id 2": "id1","card - Name 1": "card1","card - Name 2": "card1"}]

But my expected result order should be

{"Name" : "MyName","First Name": "ABS","Last Name": "ACS","card Name 1": "card1","card Id 1": "id1","College Status 1": "Active","College Type 1": "add","Class Class No 1": "123","Room RoomA 1": "NULL","Room RoomB Number 1": "NULL","card Name 2": "card1","card Id 2": "id1","College Status 2": "Active","College Type 2": "add","Class Class No 2": "123","Room RoomA 2": "NULL","Room RoomB Number 2": "NULL","Odd Structuring":null,"Accountable Class": '5663'}

Can anyone please help me to get the expected result


来源: stackexchange

问:
Can I apply sorting in Tweetinvi Iterator?
I am currently using this code to get Twitter timeline

```<code>var requestPara = new GetUserTimelineParameters(Shared.UserAccount.UserName)
{
     SinceId = sinceId,
};
timelineIterator = appClient.Timelines.GetUserTimelineIterator(requestPara);

while (!timelineIterator.Completed)
{
     var page = timelineIterator.NextPageAsync().Result;
     tweets.AddRange((IEnumerable<ITweet>)page);
}
</code>```

currently, I am getting tweets in the newest tweet first order I wanted to know if there is a way where I can get older tweets first

ContentLicense: CC BY-SA 4.0

Body:
I am currently using this code to get Twitter timeline

var requestPara = new GetUserTimelineParameters(Shared.UserAccount.UserName)
{
     SinceId = sinceId,
};
timelineIterator = appClient.Timelines.GetUserTimelineIterator(requestPara);

while (!timelineIterator.Completed)
{
     var page = timelineIterator.NextPageAsync().Result;
     tweets.AddRange((IEnumerable<ITweet>)page);
}

currently, I am getting tweets in the newest tweet first order I wanted to know if there is a way where I can get older tweets first


问:
Nginx how to retain the hostname in the uri and perform rewrite
Nginx how to retain the hostname in the uri and perform rewrite

```<code>location /app1/ {
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    rewrite /app1/(.*) /$1 break;
    proxy_pass <**how to pass the incoming request hostname as it is without hardcoding it**>
 }
</code>```

proxy_pass

Body:
Nginx how to retain the hostname in the uri and perform rewrite

location /app1/ {
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    rewrite /app1/(.*) /$1 break;
    proxy_pass <**how to pass the incoming request hostname as it is without hardcoding it**>
 }

proxy_pass


问:
Cypress connectivity with ElasticSearch behaving differently for 'cypress open' and 'cypress run'
Elastic search version is old 7.9 and Cypress is trying to connect via plugins file using the javascript client. Problem overserved is that the code to fetch the data from required index works all good and logging shows the data fetched and printed on the console when test is executed using the cypress open. But same test fails to fetch the data and just lets the test pass without printing any data on console when test is executed using cypress run.

Code to fetch the data:

const result = await client.search({ index: 'product-v2.0', body: {"query": query}, searchType: "query_then_fetch", trackScores: true, size: 2 })

The query object is as following:

```<code>{
 "bool": {
                "must_not": [
                    {
                        "bool": {
                            "filter": [
                                {
                                    "exists": {
                                        "field": "gp"
                                    }
                                }
                            ]
                        }
                    }
                ],
                "filter": [
                    {
                        "term": {
                            "webstatus": "1"
                        }
                    }
                ]
            }
        },
        "_source": [
            "stockcode"
        ]
    }
</code>```

When using cypress open -- Following is the part of the trace logging level for the request being fired:

```<code>-> POST https://elasticsearch.xxxxxxxxxx.net:443/product-v2.0/_search?search_type=query_then_fetch&track_scores=true&size=2
  {
    "query": {
      "bool": {
        "must_not": [
          {
            "bool": {
              "filter": [
                {
                  "exists": {
                    "field": "gp"
                  }
                }
              ]
            }
          }
        ],
        "filter": [
          {
            "term": {
              "webstatus": "1"
            }
          }
        ]
      }
    }
  }
</code>```

That clearly showed that all the search parameters I used are part of the request itself -

POST https://elasticsearch.xxxxxxxxxxxxxx.net:443/product-v2.0/_search?search_type=query_then_fetch&track_scores=true&size=2

My requirement - I need to run it not as ‘cypress open’ - but as ‘cypress run’ process

When I run the same code as cypress run and pass the spec file to be executed - it somehow messes with the query being created and adds and additional ‘query’ to the body of the query instead of placing all the parameters to the request as in case when ‘cypress open’ was used.
Following is the part of the trace logging level for the request being fired via cypress run:

```<code>starting request {
    "method": "POST",
    "path": "/product-v2.0/_search",
    "body": {
      "query": {
        "bool": {
          "must_not": [
            {
              "bool": {
                "filter": [
                  {
                    "exists": {
                      "field": "gp"
                    }
                  }
                ]
              }
            }
          ],
          "filter": [
            {
              "term": {
                "webstatus": "1"
              }
            }
          ]
        }
      }
    },
    "query": {
      "search_type": "query_then_fetch",
      "track_scores": true,
      "size": 2
    }
  }
</code>```

This doesn't fetch any data as well as doens't fail the test and doesn't show much in the logging to convey what happened over there.
Any help to sort this or is there any where else I should raise this issue ?

I have tried using ES JS client for version 8 also but in that case also same observation is seen. Cypress open works but cypress run doesn't.

Body:
Elastic search version is old 7.9 and Cypress is trying to connect via plugins file using the javascript client. Problem overserved is that the code to fetch the data from required index works all good and logging shows the data fetched and printed on the console when test is executed using the cypress open. But same test fails to fetch the data and just lets the test pass without printing any data on console when test is executed using cypress run.

Code to fetch the data:

const result = await client.search({ index: 'product-v2.0', body: {"query": query}, searchType: "query_then_fetch", trackScores: true, size: 2 })

The query object is as following:

{
 "bool": {
                "must_not": [
                    {
                        "bool": {
                            "filter": [
                                {
                                    "exists": {
                                        "field": "gp"
                                    }
                                }
                            ]
                        }
                    }
                ],
                "filter": [
                    {
                        "term": {
                            "webstatus": "1"
                        }
                    }
                ]
            }
        },
        "_source": [
            "stockcode"
        ]
    }

When using cypress open -- Following is the part of the trace logging level for the request being fired:

-> POST https://elasticsearch.xxxxxxxxxx.net:443/product-v2.0/_search?search_type=query_then_fetch&track_scores=true&size=2
  {
    "query": {
      "bool": {
        "must_not": [
          {
            "bool": {
              "filter": [
                {
                  "exists": {
                    "field": "gp"
                  }
                }
              ]
            }
          }
        ],
        "filter": [
          {
            "term": {
              "webstatus": "1"
            }
          }
        ]
      }
    }
  }

That clearly showed that all the search parameters I used are part of the request itself -

POST https://elasticsearch.xxxxxxxxxxxxxx.net:443/product-v2.0/_search?search_type=query_then_fetch&track_scores=true&size=2

My requirement - I need to run it not as ‘cypress open’ - but as ‘cypress run’ process

When I run the same code as cypress run and pass the spec file to be executed - it somehow messes with the query being created and adds and additional ‘query’ to the body of the query instead of placing all the parameters to the request as in case when ‘cypress open’ was used.
Following is the part of the trace logging level for the request being fired via cypress run:

starting request {
    "method": "POST",
    "path": "/product-v2.0/_search",
    "body": {
      "query": {
        "bool": {
          "must_not": [
            {
              "bool": {
                "filter": [
                  {
                    "exists": {
                      "field": "gp"
                    }
                  }
                ]
              }
            }
          ],
          "filter": [
            {
              "term": {
                "webstatus": "1"
              }
            }
          ]
        }
      }
    },
    "query": {
      "search_type": "query_then_fetch",
      "track_scores": true,
      "size": 2
    }
  }

This doesn't fetch any data as well as doens't fail the test and doesn't show much in the logging to convey what happened over there.
Any help to sort this or is there any where else I should raise this issue ?

I have tried using ES JS client for version 8 also but in that case also same observation is seen. Cypress open works but cypress run doesn't.


问:
why the scope manager not let us access the bam outside the function baz
I've been learning js for a while, but when I started practicing on this particular topic in nested scope, generally in scopes topic this question arose in my mind: we are not in a strict mode so in the baz() function we are defining a variable called bam but that not declared inside function baz scope nor in global but the scope manager will create one, my doubt is if the scope manager create scope for bam globally we are accessible inside the function baz then why the error occurs when tried to access that outside the baz scope, then it would be output as undefined but the engine rise an error bam is not defined

i have tried this:

```<code>var foo = 'bar';
console.log("line2", foo);

function bar() {
    console.log("line4", foo);
    var foo = 'baz';
    console.log("line6", foo);
}

function baz(foo) {
    console.log("line10", foo);
    foo = "bam";
    console.log("line12", foo);
    bam = "yay";
    console.log("line14", bam);
}

console.log("line17", bam);
bar();
baz();
console.log("line20", foo);
</code>```

i am expecting:

line2 bar
line4 undefined
line6 baz
line10 undefined
line12 bam
line14 yay
line17 undefined
line20 bar
```
<p>but i am actually getting:</p>
<pre class="lang-none prettyprint-override"><code>console.log("line17",bam);
^

ReferenceError: bam is not defined
</code>```

Body:
I've been learning js for a while, but when I started practicing on this particular topic in nested scope, generally in scopes topic this question arose in my mind: we are not in a strict mode so in the baz() function we are defining a variable called bam but that not declared inside function baz scope nor in global but the scope manager will create one, my doubt is if the scope manager create scope for bam globally we are accessible inside the function baz then why the error occurs when tried to access that outside the baz scope, then it would be output as undefined but the engine rise an error bam is not defined

i have tried this:

var foo = 'bar';
console.log("line2", foo);

function bar() {
    console.log("line4", foo);
    var foo = 'baz';
    console.log("line6", foo);
}

function baz(foo) {
    console.log("line10", foo);
    foo = "bam";
    console.log("line12", foo);
    bam = "yay";
    console.log("line14", bam);
}

console.log("line17", bam);
bar();
baz();
console.log("line20", foo);

i am expecting:

line2 bar
line4 undefined
line6 baz
line10 undefined
line12 bam
line14 yay
line17 undefined
line20 bar

but i am actually getting:

console.log("line17",bam);
^

ReferenceError: bam is not defined


问:
Manipulating Text In Twitter's TextField Using Chrome Extension
I'm trying to create a chrome extension which can insert some custom texts in the twitter textfield (the one we use to write tweets)

The light bulb you see in the left action bar is the button I have to click to add the texts in the textfield. But there is no textarea or any kind of form elements in the html attributes for Twitter. So basically this is just a collection of bunch of nested divs and span attributes for each part of the text.

Also I know it's wrong but I tried adding a new attribute to add text in that field through javascript. It works. But it's not editable or twitter's js doesn't recognize it.

```<code>const textField = document.getElementsByClassName("public-DraftStyleDefault-block public-DraftStyleDefault-ltr")[0];
textField.innerHTML = `<span data-offset-key="7rd5k-0-0"><span data-text="true">Hello World!</span></span>`
</code>```

So how do I manipulate the text in a textfield with no textarea or any relevant attributes through a chrome extension? Need help :(

Body:
I'm trying to create a chrome extension which can insert some custom texts in the twitter textfield (the one we use to write tweets)

The light bulb you see in the left action bar is the button I have to click to add the texts in the textfield. But there is no textarea or any kind of form elements in the html attributes for Twitter. So basically this is just a collection of bunch of nested divs and span attributes for each part of the text.

Also I know it's wrong but I tried adding a new attribute to add text in that field through javascript. It works. But it's not editable or twitter's js doesn't recognize it.

const textField = document.getElementsByClassName("public-DraftStyleDefault-block public-DraftStyleDefault-ltr")[0];
textField.innerHTML = `<span data-offset-key="7rd5k-0-0"><span data-text="true">Hello World!</span></span>`

So how do I manipulate the text in a textfield with no textarea or any relevant attributes through a chrome extension? Need help :(


问:
Error in running SSIS package through SQL Agent jobs
I am running a SSIS package through Sql server agent jobs and I am getting below error, tried many ways to resolve it but nothing did help.

I tried running package in  64 bit and also tried to add the user that is shown in error message but no help.


问:
How would I be able to make a crash minigame with React?
So I am using React in my frontend, have a database and stuff in my app, now I also want to create a crash minigame like some of you have probably seen before where for example there is some multiplier that starts from 1.00x and goes up and randomly crashes. I want multiple people to be able to join this game, put in their currency and keep it updated for every player on that page at the same time.

Does anyone have an idea for how I would be able to achieve this? Doing this with a database is obviously going to be too slow so what can I possibly do? Should I use websockets to do this?


问:
configuration of an JS Object to hold all databases information using environment variables fails
I'm attempting something quite technical. I have a MERN+Firebase project. I want to hold there in an organized manner the information of MongoDB and Firebase.

For that, I do the following:

In my backend folder, I have created a '.env' file with the following information:

```<code>##mongodb

PORT = 8001

MONGO_USER = canIbeuser

MONGO_PW = 111222333

MONGO_DB = issuesReporter

##firebase

API_KEY = APIHEREKEY

AUTH_DOMAIN = AUTHDOMAINHERE

PROJECT_ID =  junoissuereporter

STORAGE_BUCKET = whatevz.appspot.com

MESSAGING_SENDER_ID =  54137922122

APP_ID = 1:541379546105:web:0d04c250fb02a66603cb12

MEASUREMENT_ID = G-YLAAA21ACJ
</code>```

As well as a config.ts file, as well in backend's root folder:

```<code>import dotenv from "dotenv";

interface MongoConfig {
  port: string;
  user: string;
  password: string;
  database: string;
}

interface FirebaseConfig {
  apiKey: string;
  authDomain: string;
  projectId: string;
  storageBucket: string;
  messagingSenderId: string;
  appId: string;
  measurementId: string;
}

interface Config {
  mongoConfig: MongoConfig;
  firebaseConfig: FirebaseConfig;
}

const config: Config = {
  firebaseConfig: {
    apiKey: process.env.API_KEY || "",
    authDomain: process.env.AUTH_DOMAIN || "",
    projectId: process.env.PROJECT_ID || "",
    storageBucket: process.env.STORAGE_BUCKET || "",
    messagingSenderId: process.env.MESSAGING_SENDER_ID || "",
    appId: process.env.APP_ID || "",
    measurementId: process.env.MEASUREMENT_ID || "",
  },
  mongoConfig: {
    port: process.env.PORT || "",
    user: process.env.MONGO_USER || "",
    password: process.env.MONGO_PW || "",
    database: process.env.MONGO_DB || "",
  },
};

export default config;
</code>```

which I use, for example, in my server.ts file:

```<code>import express, { Express, Request, Response } from "express";
import dotenv from "dotenv";
import mongoose from "mongoose";
import cors from "cors";
import config from "./config";

const issueRoutes = require("./routes/issueRoutes");
const usersRoutes = require("./routes/usersRoutes");

dotenv.config();

mongoose.set("strictQuery", false);

const app: Express = express();
const port = config.mongoConfig.port;

const uri: string = `mongodb+srv://${config.mongoConfig.user}:${config.mongoConfig.password}@cluster0.n2k7xvu.mongodb.net/${config.mongoConfig.database}`;
app.use(cors());
app.use(express.json());
app.use(issueRoutes);
app.use(usersRoutes);

mongoose.connect(uri).then(() =>
  app.listen(config.mongoConfig.port, () => {
    console.log(
      `[server]: Server is running at https://localhost:${config.mongoConfig.port}`
    );
  })
);
</code>```

now, I don't know why, but my environment variables are not obtained in my server.ts, which causes the following error:

```<code>MongoParseError: URI contained empty userinfo section
    at new ConnectionString (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongodb-connection-string-url/src/index.ts:163:17)
    at parseOptions (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongodb/src/connection_string.ts:257:15)
    at new MongoClient (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongodb/src/mongo_client.ts:347:34)
    at /Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/connection.js:802:16
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/connection.js:799:19)
    at /Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/index.js:419:10
    at /Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
</code>```

any ideas what can be the issue ?
regards :_)

update:

when I do: console.log("IN SERVER.TS", process.env);     // (in server.ts)
I get all of my environment variables logged.

When I do: console.log("IN SERVER.TS config", config); // (in server.ts)
I get all my environment variables as empty strings.

Body:
I'm attempting something quite technical. I have a MERN+Firebase project. I want to hold there in an organized manner the information of MongoDB and Firebase.

For that, I do the following:

In my backend folder, I have created a '.env' file with the following information:

##mongodb

PORT = 8001

MONGO_USER = canIbeuser

MONGO_PW = 111222333

MONGO_DB = issuesReporter

##firebase

API_KEY = APIHEREKEY

AUTH_DOMAIN = AUTHDOMAINHERE

PROJECT_ID =  junoissuereporter

STORAGE_BUCKET = whatevz.appspot.com

MESSAGING_SENDER_ID =  54137922122

APP_ID = 1:541379546105:web:0d04c250fb02a66603cb12

MEASUREMENT_ID = G-YLAAA21ACJ

As well as a config.ts file, as well in backend's root folder:

import dotenv from "dotenv";

interface MongoConfig {
  port: string;
  user: string;
  password: string;
  database: string;
}

interface FirebaseConfig {
  apiKey: string;
  authDomain: string;
  projectId: string;
  storageBucket: string;
  messagingSenderId: string;
  appId: string;
  measurementId: string;
}

interface Config {
  mongoConfig: MongoConfig;
  firebaseConfig: FirebaseConfig;
}

const config: Config = {
  firebaseConfig: {
    apiKey: process.env.API_KEY || "",
    authDomain: process.env.AUTH_DOMAIN || "",
    projectId: process.env.PROJECT_ID || "",
    storageBucket: process.env.STORAGE_BUCKET || "",
    messagingSenderId: process.env.MESSAGING_SENDER_ID || "",
    appId: process.env.APP_ID || "",
    measurementId: process.env.MEASUREMENT_ID || "",
  },
  mongoConfig: {
    port: process.env.PORT || "",
    user: process.env.MONGO_USER || "",
    password: process.env.MONGO_PW || "",
    database: process.env.MONGO_DB || "",
  },
};

export default config;

which I use, for example, in my server.ts file:

import express, { Express, Request, Response } from "express";
import dotenv from "dotenv";
import mongoose from "mongoose";
import cors from "cors";
import config from "./config";

const issueRoutes = require("./routes/issueRoutes");
const usersRoutes = require("./routes/usersRoutes");

dotenv.config();

mongoose.set("strictQuery", false);

const app: Express = express();
const port = config.mongoConfig.port;

const uri: string = `mongodb+srv://${config.mongoConfig.user}:${config.mongoConfig.password}@cluster0.n2k7xvu.mongodb.net/${config.mongoConfig.database}`;
app.use(cors());
app.use(express.json());
app.use(issueRoutes);
app.use(usersRoutes);

mongoose.connect(uri).then(() =>
  app.listen(config.mongoConfig.port, () => {
    console.log(
      `[server]: Server is running at https://localhost:${config.mongoConfig.port}`
    );
  })
);

now, I don't know why, but my environment variables are not obtained in my server.ts, which causes the following error:

MongoParseError: URI contained empty userinfo section
    at new ConnectionString (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongodb-connection-string-url/src/index.ts:163:17)
    at parseOptions (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongodb/src/connection_string.ts:257:15)
    at new MongoClient (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongodb/src/mongo_client.ts:347:34)
    at /Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/connection.js:802:16
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/connection.js:799:19)
    at /Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/index.js:419:10
    at /Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/Users/dani_l_n/Documents/latest/juno-issues-reporter/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)

any ideas what can be the issue ?
regards :_)

update:

when I do: console.log("IN SERVER.TS", process.env);     // (in server.ts)
I get all of my environment variables logged.

When I do: console.log("IN SERVER.TS config", config); // (in server.ts)
I get all my environment variables as empty strings.


问:
Reading data with Custom HID
I want to read from my STM32 card using custom HID over USB to get the C# data transfer rate close to ideal.

I don't have a problem with the codes I wrote on the STM32 side. Data comes in at a very good speed.

However, I have a problem with coding on the C# side. As far as I understand there are no Custom HID functions in internal libraries in C#. I looked at libraries from Nuget and Github. The libraries I'm looking at are either missing or I haven't been able to. Has anyone worked on this before? I'm open to your ideas. Thanks already for your help.

Libraries i tried

LibUsbDotNet

Device.Net/HID.Net/Usb.Net

Reading data with Custom HID in C#

Title: Reading data with Custom HID


问:
How to Remove Abrupt Burrs on Image Edges in Image Processing？
This is a small part of the binary image I captured after a series of OpenCV instructions (the original image has many similar structures).  At present, we have tried morphological opening and closing operations, but the effect is not ideal. The 3 * 3 template can no longer see the image, while the 2 * 2 template is not good. Median filtering and Gaussian filtering have also been tried and failed to achieve the desired effect. I wonder if there is a better way.

What we need to do now is to remove burrs.


问:
How can I center svg-text(inside the clipPath tag) to clip the video?
I need to create a text that video can play inside the area,

here is my code :

```<code><video src="./my-video.mp4"
                    loop mute autoplay style="clip-path:url(#clipText)"></video>
   <svg width="100%" height="100%" viewBox="0 0 479.8 104" version="1.1" xmlns="http://www.w3.org/2000/svg"
                    xmlns:xlink="http://www.w3.org/1999/xlink">
                    <defs>
                        <clipPath id="clipText">
                            <text x="28" y="15" dominant-baseline="central" text-anchor="central">
                                <tspan>FUTURE OF THE
                                    CITY</tspan>
                            </text>
                        </clipPath>
                    </defs>

   </svg>
</code>```

Thanks for any reply.

Body:
I need to create a text that video can play inside the area,

here is my code :

<video src="./my-video.mp4"
                    loop mute autoplay style="clip-path:url(#clipText)"></video>
   <svg width="100%" height="100%" viewBox="0 0 479.8 104" version="1.1" xmlns="http://www.w3.org/2000/svg"
                    xmlns:xlink="http://www.w3.org/1999/xlink">
                    <defs>
                        <clipPath id="clipText">
                            <text x="28" y="15" dominant-baseline="central" text-anchor="central">
                                <tspan>FUTURE OF THE
                                    CITY</tspan>
                            </text>
                        </clipPath>
                    </defs>

   </svg>

Thanks for any reply.


问:
Error with Broadcast Receiver which should to work with 13 broadcasts
Error in mainTest(ru.myitschool.lab23.InstrumentedTestLab46):
java.lang.RuntimeException: java.lang.Throwable:      'an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"
Got: view.getText() was "android.intent.action.BATTERY_CHANGED" transformed text was "android.intent.action.BATTERY_CHANGED"
View Details: MaterialTextView{id=2131231135, res-name=status_text, visibility=VISIBLE, width=1080, height=2105, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=android.intent.action.BATTERY_CHANGED, inp...
at androidx.test.espresso.base.ThrowableHandler.handle(ThrowableHandler.java:2)
at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:5)
at ru.myitschool.lab23.DescriptionFailureHandler.handle(InstrumentedTestLab46.kt:244)
at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:5)
at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:12)
at io.github.kakaocup.kakao.delegate.ViewInteractionDelegate.check(ViewInteractionDelegate.kt:26)
at io.github.kakaocup.kakao.text.TextViewAssertions$DefaultImpls.hasText(TextViewAssertions.kt:53)
at io.github.kakaocup.kakao.text.KTextView.hasText(KTextView.kt:18)
at ru.myitschool.lab23.InstrumentedTestLab46$mainTestCheckStep$1.invoke(InstrumentedTestLab46.kt:150)
at ru.myitschool.lab23.InstrumentedTestLab46$mainTestCheckStep$1.invoke(InstrumentedTestLab46.kt:138)
at io.github.kakaocup.kakao.screen.Screen.invoke(Screen.kt:119)
at ru.myitschool.lab23.InstrumentedTestLab46.mainTestCheckStep(InstrumentedTestLab46.kt:138)
at ru.myitschool.lab23.InstrumentedTestLab46.mainTest(InstrumentedTestLab46.kt:128)
... 8 trimmed
Caused by: java.lang.Throwable:      'an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"
Got: view.getText() was "android.intent.action.BATTERY_CHANGED" transformed text was "android.intent.action.BATTERY_CHANGED"
View Details: MaterialTextView{id=2131231135, res-name=status_text, visibility=VISIBLE, width=1080, height=2105, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=android.intent.action.BATTERY_CHANGED, inp...
at ru.myitschool.lab23.DescriptionFailureHandler.handle(InstrumentedTestLab46.kt:234)
... 19 more

MainActivity:

```<code>                 import android.content.BroadcastReceiver;
                 import android.content.Context;
                 import android.content.Intent;
                 import android.content.IntentFilter;
                 import android.net.ConnectivityManager;
                 import android.os.Bundle;
                 import android.widget.TextView;

                 import androidx.annotation.Nullable;
                 import androidx.appcompat.app.AppCompatActivity;

      public class MainActivity extends AppCompatActivity {

     TextView statusText;
      BroadcastReceiver myBroadcastReceiver;

       @Override
        public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

       statusText = findViewById(R.id.status_text);
       myBroadcastReceiver = new MyBroadcastReceiver();

     }

      public BroadcastReceiver makeBroadcastReceiver(){

        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
         filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
         filter.addAction(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
         filter.addAction(Intent.ACTION_APPLICATION_LOCALE_CHANGED);
         filter.addAction(Intent.ACTION_ASSIST);
         filter.addAction(Intent.ACTION_BATTERY_CHANGED);
         filter.addAction(Intent.ACTION_BATTERY_LOW);
         filter.addAction(Intent.ACTION_BATTERY_OKAY);
         filter.addAction(Intent.ACTION_CALL);
         filter.addAction(Intent.ACTION_DATE_CHANGED);
         filter.addAction(Intent.ACTION_DEFAULT);
         filter.addAction(Intent.ACTION_HEADSET_PLUG);
         filter.addAction(Intent.ACTION_LOCALE_CHANGED);
         filter.addAction(Intent.ACTION_TIME_TICK);

        this.registerReceiver(myBroadcastReceiver, filter);

        return myBroadcastReceiver;
       }

       private class MyBroadcastReceiver extends BroadcastReceiver {
       public MyBroadcastReceiver() {
       }

    public void onReceive(Context context, Intent intent) {

     statusText.setText(intent.getAction());

      }
     }
    @Override
    protected void onStop(){

    super.onStop();
    unregisterReceiver(myBroadcastReceiver);
        }

        }
</code>```

I had a task to create a Broadcast Receiver that could receive 13 different broadcasts and output their value to statucText, that is, if we have ACTION_TIME_TICK broadcast, then the text ACTION_TIME_TICK should be set in statusText. Method makeBroadcastReceiver() which return Broadcast Recerver is required by the task.
In our training, most of the information has to be searched for myself, so I even had to work on it for several days, looking for information on how to do it, this is my first time working with Broadcast Receiver.

Body:
Error in mainTest(ru.myitschool.lab23.InstrumentedTestLab46):
java.lang.RuntimeException: java.lang.Throwable:      'an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"
Got: view.getText() was "android.intent.action.BATTERY_CHANGED" transformed text was "android.intent.action.BATTERY_CHANGED"
View Details: MaterialTextView{id=2131231135, res-name=status_text, visibility=VISIBLE, width=1080, height=2105, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=android.intent.action.BATTERY_CHANGED, inp...
at androidx.test.espresso.base.ThrowableHandler.handle(ThrowableHandler.java:2)
at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:5)
at ru.myitschool.lab23.DescriptionFailureHandler.handle(InstrumentedTestLab46.kt:244)
at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:5)
at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:12)
at io.github.kakaocup.kakao.delegate.ViewInteractionDelegate.check(ViewInteractionDelegate.kt:26)
at io.github.kakaocup.kakao.text.TextViewAssertions$DefaultImpls.hasText(TextViewAssertions.kt:53)
at io.github.kakaocup.kakao.text.KTextView.hasText(KTextView.kt:18)
at ru.myitschool.lab23.InstrumentedTestLab46$mainTestCheckStep$1.invoke(InstrumentedTestLab46.kt:150)
at ru.myitschool.lab23.InstrumentedTestLab46$mainTestCheckStep$1.invoke(InstrumentedTestLab46.kt:138)
at io.github.kakaocup.kakao.screen.Screen.invoke(Screen.kt:119)
at ru.myitschool.lab23.InstrumentedTestLab46.mainTestCheckStep(InstrumentedTestLab46.kt:138)
at ru.myitschool.lab23.InstrumentedTestLab46.mainTest(InstrumentedTestLab46.kt:128)
... 8 trimmed
Caused by: java.lang.Throwable:      'an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"' doesn't match the selected view.
Expected: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "ACTION_ASSIST"
Got: view.getText() was "android.intent.action.BATTERY_CHANGED" transformed text was "android.intent.action.BATTERY_CHANGED"
View Details: MaterialTextView{id=2131231135, res-name=status_text, visibility=VISIBLE, width=1080, height=2105, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@YYYYYY, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=android.intent.action.BATTERY_CHANGED, inp...
at ru.myitschool.lab23.DescriptionFailureHandler.handle(InstrumentedTestLab46.kt:234)
... 19 more

MainActivity:

                 import android.content.BroadcastReceiver;
                 import android.content.Context;
                 import android.content.Intent;
                 import android.content.IntentFilter;
                 import android.net.ConnectivityManager;
                 import android.os.Bundle;
                 import android.widget.TextView;

                 import androidx.annotation.Nullable;
                 import androidx.appcompat.app.AppCompatActivity;

      public class MainActivity extends AppCompatActivity {

     TextView statusText;
      BroadcastReceiver myBroadcastReceiver;

       @Override
        public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

       statusText = findViewById(R.id.status_text);
       myBroadcastReceiver = new MyBroadcastReceiver();

     }

      public BroadcastReceiver makeBroadcastReceiver(){

        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
         filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
         filter.addAction(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
         filter.addAction(Intent.ACTION_APPLICATION_LOCALE_CHANGED);
         filter.addAction(Intent.ACTION_ASSIST);
         filter.addAction(Intent.ACTION_BATTERY_CHANGED);
         filter.addAction(Intent.ACTION_BATTERY_LOW);
         filter.addAction(Intent.ACTION_BATTERY_OKAY);
         filter.addAction(Intent.ACTION_CALL);
         filter.addAction(Intent.ACTION_DATE_CHANGED);
         filter.addAction(Intent.ACTION_DEFAULT);
         filter.addAction(Intent.ACTION_HEADSET_PLUG);
         filter.addAction(Intent.ACTION_LOCALE_CHANGED);
         filter.addAction(Intent.ACTION_TIME_TICK);

        this.registerReceiver(myBroadcastReceiver, filter);

        return myBroadcastReceiver;
       }

       private class MyBroadcastReceiver extends BroadcastReceiver {
       public MyBroadcastReceiver() {
       }

    public void onReceive(Context context, Intent intent) {

     statusText.setText(intent.getAction());

      }
     }
    @Override
    protected void onStop(){

    super.onStop();
    unregisterReceiver(myBroadcastReceiver);
        }

        }

I had a task to create a Broadcast Receiver that could receive 13 different broadcasts and output their value to statucText, that is, if we have ACTION_TIME_TICK broadcast, then the text ACTION_TIME_TICK should be set in statusText. Method makeBroadcastReceiver() which return Broadcast Recerver is required by the task.
In our training, most of the information has to be searched for myself, so I even had to work on it for several days, looking for information on how to do it, this is my first time working with Broadcast Receiver.


问:
In NestJs and Vendure application, if I add plugins to vendure-config, it is giving error Nest can't resolve dependencies of the ConfigModule
In NestJs and Vendure application, if I add plugins to vendure-config, If I add any plugins, it's giving error. I tried to add ElasticSearch Plugin as mentioned here in the official documentation.

I'm getting following error when I run the project:

```<code>Nest can't resolve dependencies of the ConfigModule (ConfigService, ?). Please make sure that the argument ModuleRef at index [1] is available in the ConfigModule context.

Potential solutions:
- If ModuleRef is a provider, is it part of the current ConfigModule?
- If ModuleRef is exported from a separate @Module, is that module imported within ConfigModule?
  @Module({
    imports: [ /* the Module containing ModuleRef */ ]
  })

Error: Nest can't resolve dependencies of the ConfigModule (ConfigService, ?). Please make sure that the argument ModuleRef at index [1] is available in the ConfigModule context.
</code>```

I tried to add ElasticsearchPlugin to imports: [ElasticsearchPlugin] in ConfigModule. But still I'm getting the same issue.

Could anyone please help me on this?

Thanks in Advance.

This is what I tried to resolve:

I followed this to integrate the plugin.

Then, after getting the issue, I tried to add imports: [ElasticsearchPlugin] in ConfigModule and AppModule.

Then, the error is still same, So, I tried to add the ElasticsearchPlugin to imports, exports and providers array. Still the same issue.

Body:
In NestJs and Vendure application, if I add plugins to vendure-config, If I add any plugins, it's giving error. I tried to add ElasticSearch Plugin as mentioned here in the official documentation.

I'm getting following error when I run the project:

Nest can't resolve dependencies of the ConfigModule (ConfigService, ?). Please make sure that the argument ModuleRef at index [1] is available in the ConfigModule context.

Potential solutions:
- If ModuleRef is a provider, is it part of the current ConfigModule?
- If ModuleRef is exported from a separate @Module, is that module imported within ConfigModule?
  @Module({
    imports: [ /* the Module containing ModuleRef */ ]
  })

Error: Nest can't resolve dependencies of the ConfigModule (ConfigService, ?). Please make sure that the argument ModuleRef at index [1] is available in the ConfigModule context.

I tried to add ElasticsearchPlugin to imports: [ElasticsearchPlugin] in ConfigModule. But still I'm getting the same issue.

Could anyone please help me on this?

Thanks in Advance.

This is what I tried to resolve:

I followed this to integrate the plugin.

Then, after getting the issue, I tried to add imports: [ElasticsearchPlugin] in ConfigModule and AppModule.

Then, the error is still same, So, I tried to add the ElasticsearchPlugin to imports, exports and providers array. Still the same issue.


问:
Getting error while executing Plsql function
I'm getting error while executing below mentioned query in DB2.

```<code>CREATE OR REPLACE FUNCTION ETLUAT.FUNC_GET_CLAIM_STATUS(IN i_claim_no Varchar(4000))
RETURNS varchar(4000)
BEGIN
  DECLARE tempReasonid  varchar(50);
  DECLARE tempReasontxt varchar(5000);
  DECLARE txtreason     varchar(4000);
  DECLARE tempStatus        varchar(1);
  DECLARE tempUpdateNo      int;
  DECLARE tempOutPut        varchar(2000);
  DECLARE tempCnt           int;
  DECLARE tempPayStatus     int;
  DECLARE tempPayStatusChar varchar(25);
  DECLARE EXIT HANDLER FOR SQLEXCEPTION
  BEGIN
   RETURN 'OTHERS';
  END;
  Select A.TXT_CLAIM_STATUS, a.num_update_no into tempStatus, tempUpdateNo From ETLUAT.PRESTG_GC_CLAIM_INFO A
  where A.Num_Update_No =(Select Max(Num_Update_No) From ETLUAT.PRESTG_GC_CLAIM_INFO G Where G.Num_Claim_No = i_claim_no) and a.num_claim_no = i_claim_no;
  if tempStatus = 'N' then SET tempOutPut = 'Notification';
  elseif tempStatus = 'I' then
            begin
                select count(1) into tempCnt from ETLUAT.PRESTG_GC_CLAIM_INFO where TXT_CLAIM_STATUS = 'I'
                AND NUM_CLAIM_NO = i_claim_no and NUM_UPDATE_NO >(select max(NUM_UPDATE_NO) From ETLUAT.PRESTG_GC_CLAIM_INFO
                where TXT_CLAIM_STATUS = 'N' AND NUM_CLAIM_NO = i_claim_no);
                    if tempCnt = 1 then SET tempOutPut = 'Registration';
                        elseif tempCnt > 1 then SET tempOutPut = 'Processing';
                            else SET tempOutPut = 'Others';
                    end if;
                return tempOutPut;
            END;
  end if;
    return tempOutPut;
END;

</code>```

error:SQL Error [42601]: An unexpected token "END-OF-STATEMENT" was found following "END".  Expected tokens may include:  "JOIN <joined_table>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.9.78

please anyone help me to figure out my mistake.

Body:
I'm getting error while executing below mentioned query in DB2.

CREATE OR REPLACE FUNCTION ETLUAT.FUNC_GET_CLAIM_STATUS(IN i_claim_no Varchar(4000))
RETURNS varchar(4000)
BEGIN
  DECLARE tempReasonid  varchar(50);
  DECLARE tempReasontxt varchar(5000);
  DECLARE txtreason     varchar(4000);
  DECLARE tempStatus        varchar(1);
  DECLARE tempUpdateNo      int;
  DECLARE tempOutPut        varchar(2000);
  DECLARE tempCnt           int;
  DECLARE tempPayStatus     int;
  DECLARE tempPayStatusChar varchar(25);
  DECLARE EXIT HANDLER FOR SQLEXCEPTION
  BEGIN
   RETURN 'OTHERS';
  END;
  Select A.TXT_CLAIM_STATUS, a.num_update_no into tempStatus, tempUpdateNo From ETLUAT.PRESTG_GC_CLAIM_INFO A
  where A.Num_Update_No =(Select Max(Num_Update_No) From ETLUAT.PRESTG_GC_CLAIM_INFO G Where G.Num_Claim_No = i_claim_no) and a.num_claim_no = i_claim_no;
  if tempStatus = 'N' then SET tempOutPut = 'Notification';
  elseif tempStatus = 'I' then
            begin
                select count(1) into tempCnt from ETLUAT.PRESTG_GC_CLAIM_INFO where TXT_CLAIM_STATUS = 'I'
                AND NUM_CLAIM_NO = i_claim_no and NUM_UPDATE_NO >(select max(NUM_UPDATE_NO) From ETLUAT.PRESTG_GC_CLAIM_INFO
                where TXT_CLAIM_STATUS = 'N' AND NUM_CLAIM_NO = i_claim_no);
                    if tempCnt = 1 then SET tempOutPut = 'Registration';
                        elseif tempCnt > 1 then SET tempOutPut = 'Processing';
                            else SET tempOutPut = 'Others';
                    end if;
                return tempOutPut;
            END;
  end if;
    return tempOutPut;
END;

error:SQL Error [42601]: An unexpected token "END-OF-STATEMENT" was found following "END".  Expected tokens may include:  "JOIN <joined_table>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.9.78

please anyone help me to figure out my mistake.


问:
How to get query params after rewrite the URL in nextjs?
am using nextjs rewrite method on next.config.js

am rewriting the URL with country code to without country code, because sometimes the URL has a country code and not for sometimes.

```<code>{

   source: '/:countryCode(\\w{1,2})/:category/:genre',

   destination: `/:category/:genre`,

}
</code>```

after redirecting the URL like this

http://localhost:8000/uk/theatre/broadway/

But it does not have the country code as query params. It has query params as

```<code>{category: theatre, genre:brodway}.
</code>```

But it should be as

```<code>{countrycode:UK,  Category:theatre, genre:brodway}
</code>```

Body:
am using nextjs rewrite method on next.config.js

am rewriting the URL with country code to without country code, because sometimes the URL has a country code and not for sometimes.

{

   source: '/:countryCode(\\w{1,2})/:category/:genre',

   destination: `/:category/:genre`,

}

after redirecting the URL like this

http://localhost:8000/uk/theatre/broadway/

But it does not have the country code as query params. It has query params as

{category: theatre, genre:brodway}.

But it should be as

{countrycode:UK,  Category:theatre, genre:brodway}


问:
Merging watermark using PyPDF2 causes all pages to merge together into one instead of page by page merging
I have a pdf document 'sample_doc1.pdf' and a watermark file (created from word document) 'watermark.pdf'. When i try to merge them in python using PyPDF2, I expect the following results:

However, I keep getting a result where all the pages get merged together (shown below). Note that the PDF still registers as 2 pages (a small white box below is being registered as a "page").

My full code is as follows:

```<code>writer = PyPDF2.PdfFileWriter()

with open(main_file, 'rb') as fileinput:
    pdf_file = PyPDF2.PdfFileReader(fileinput)

    with open('watermark.pdf', 'rb') as filewatermark:
        watermark_pdf = PyPDF2.PdfFileReader(filewatermark)

        for page in range(pdf_file.getNumPages()):
            current_pdf_page = pdf_file.getPage(page)
            first_page_watermark = watermark_pdf.getPage(0)
            first_page_watermark.mergePage(current_pdf_page) # -- (12) : Base layer = first_page_watermark; Top layer = current_pdf_page
            writer.addPage(first_page_watermark) # -- (13)

            with open("output.pdf", 'wb')as file_output:
                writer.write(file_output)
</code>```

However, when I change the order of layers in the code (in line -- (12) and (13) ), I managed to make it better but the watermark appears on top of the text.

Is there something I'm doing wrong?

Body:
I have a pdf document 'sample_doc1.pdf' and a watermark file (created from word document) 'watermark.pdf'. When i try to merge them in python using PyPDF2, I expect the following results:

However, I keep getting a result where all the pages get merged together (shown below). Note that the PDF still registers as 2 pages (a small white box below is being registered as a "page").

My full code is as follows:

writer = PyPDF2.PdfFileWriter()

with open(main_file, 'rb') as fileinput:
    pdf_file = PyPDF2.PdfFileReader(fileinput)

    with open('watermark.pdf', 'rb') as filewatermark:
        watermark_pdf = PyPDF2.PdfFileReader(filewatermark)

        for page in range(pdf_file.getNumPages()):
            current_pdf_page = pdf_file.getPage(page)
            first_page_watermark = watermark_pdf.getPage(0)
            first_page_watermark.mergePage(current_pdf_page) # -- (12) : Base layer = first_page_watermark; Top layer = current_pdf_page
            writer.addPage(first_page_watermark) # -- (13)

            with open("output.pdf", 'wb')as file_output:
                writer.write(file_output)

However, when I change the order of layers in the code (in line -- (12) and (13) ), I managed to make it better but the watermark appears on top of the text.

Is there something I'm doing wrong?


问:
Is it possible merge the main branch (with custom code) with the flutterflow branch?
(Following that guide: Manage Custom Code In GitHub
) it is posible (after from deploy application) merge the main branch with the flutter flow branch to continue building app based in the last changes deployed?

my question is summarized in this diagram edited from flutterflow original.

If possible, could you explain to me how to do it?


问:
Additional config file with Spring boot cloud config
I have a requirement to split application properties into 2. Some viewable from cloud and some hidden and specified by file on a Rancher environment.

When running locally the default config file successfully honors spring.config.import property which points to a different file.

When fetching the configs from cloud it seams the spring.config.import property is completely ignored and the additional file doesn't get loaded or even checked for.

It there a way to achieve this requirement? Even if different from using the spring.config.import property.

I have upgraded from Spring 2.1.7 to 2.7.7 to be able to use the latest application config loading.


问:
Audit trail in fastapi using mysql database,How to call auditlog in FastAPI? but not using trigger in mysql using fastapi if method of auditlog
how to create audit log in fastapi using mysql table .and add users old value and new value with the timing and user name in mysql table.this is my code of create,update,delete user code.and models.py file.</p>


问:
error in axios while using tmdb database for authentication
```<code>useEffect(() => {
  const logInUser = async () => {
    if (token) {
      if (sessionIdFromLocalStorage) {
        console.log(1);
        const { data: userData } = await moviesApi.get(
          `/account?session_id=${sessionIdFromLocalStorage}`
        );
        dispatch(setUser(userData));
      } else {
        console.log(2);
        const sessionId = await createSessionId();

        const { data: userData } = await moviesApi.get(
          `/account?session_id=${sessionId}`
        );

        dispatch(setUser(userData));
      }
    }
  };
  logInUser();
}, [token]);
</code>```

im getting error in tmdb while creting authentication

Body:
useEffect(() => {
  const logInUser = async () => {
    if (token) {
      if (sessionIdFromLocalStorage) {
        console.log(1);
        const { data: userData } = await moviesApi.get(
          `/account?session_id=${sessionIdFromLocalStorage}`
        );
        dispatch(setUser(userData));
      } else {
        console.log(2);
        const sessionId = await createSessionId();

        const { data: userData } = await moviesApi.get(
          `/account?session_id=${sessionId}`
        );

        dispatch(setUser(userData));
      }
    }
  };
  logInUser();
}, [token]);

im getting error in tmdb while creting authentication


问:
Data from previous customer got override or update when I entered new user data using xamarin form-firebase realtime db
First all of, Thank you to you sir, for helping me in my previous post, you can check here. I used his answer which is to use PutAsync so that the document ID will be int.

Since Im too beginner this tech, xamarin form. My problem is when I create another customer, the previous  data in my FIREBASE REALTIME database will get override or updated by the new data I entered.
Please see the visual presentation, this is my problem rm.

And my expected output is when I create another customer data, it will create new record with INT unique ID.
This is my expected output in visual representation.

So this is my codes.

//my customer datamodel

```<code>public class CUSTOMER
    {
        // public int CusID { get; set; }
        public string CusID { get; set; }
        //  public int CusID { get; set; }
        [Required]
        public string CusFirstName { get; set; }
        [Required]
        public string CusLastName { get; set; }
        [Required]

        public string CusMiddleName { get; set; }
        public string CusContactNumber { get; set; }
        [Required]
        public string CusEmail { get; set; }
        [Required]
        public string CusBirthOfDate { get; set; }
        [Required]
        public string CusAddress { get; set; }
        [Required]

        public string CusPassword { get; set; }
        [Required]
        public string CusSecurityQuestion { get; set; }
        [Required]
        public string CusSecurityQuestionAnswer { get; set; }
        [Required]

        public string CusValiIdImage { get; set; }
        [Required]
        public string CusIdType { get; set; }

    }
</code>```

so I have createrepo.cs file which I put my Save to database function
//save function

```<code> public async Task<bool> Save(CUSTOMER customer)
        {

            var token = await authProvider.CreateUserWithEmailAndPasswordAsync(customer.CusEmail, customer.CusPassword);

             await firebaseClient.Child(nameof(CUSTOMER)).Child("4815").PutAsync(JsonConvert.SerializeObject(customer));

            if (!string.IsNullOrEmpty(token.FirebaseToken))
            {
                return true;
            }
            return false;
           // return true;
        }
</code>```

If you want to know more about my problems or post, just feel free to ask in comment and I will try my best to provide more codes.

Body:
First all of, Thank you to you sir, for helping me in my previous post, you can check here. I used his answer which is to use PutAsync so that the document ID will be int.

Since Im too beginner this tech, xamarin form. My problem is when I create another customer, the previous  data in my FIREBASE REALTIME database will get override or updated by the new data I entered.
Please see the visual presentation, this is my problem rm.

And my expected output is when I create another customer data, it will create new record with INT unique ID.
This is my expected output in visual representation.

So this is my codes.

//my customer datamodel

public class CUSTOMER
    {
        // public int CusID { get; set; }
        public string CusID { get; set; }
        //  public int CusID { get; set; }
        [Required]
        public string CusFirstName { get; set; }
        [Required]
        public string CusLastName { get; set; }
        [Required]

        public string CusMiddleName { get; set; }
        public string CusContactNumber { get; set; }
        [Required]
        public string CusEmail { get; set; }
        [Required]
        public string CusBirthOfDate { get; set; }
        [Required]
        public string CusAddress { get; set; }
        [Required]

        public string CusPassword { get; set; }
        [Required]
        public string CusSecurityQuestion { get; set; }
        [Required]
        public string CusSecurityQuestionAnswer { get; set; }
        [Required]

        public string CusValiIdImage { get; set; }
        [Required]
        public string CusIdType { get; set; }

    }

so I have createrepo.cs file which I put my Save to database function
//save function

 public async Task<bool> Save(CUSTOMER customer)
        {

            var token = await authProvider.CreateUserWithEmailAndPasswordAsync(customer.CusEmail, customer.CusPassword);

             await firebaseClient.Child(nameof(CUSTOMER)).Child("4815").PutAsync(JsonConvert.SerializeObject(customer));

            if (!string.IsNullOrEmpty(token.FirebaseToken))
            {
                return true;
            }
            return false;
           // return true;
        }

If you want to know more about my problems or post, just feel free to ask in comment and I will try my best to provide more codes.


问:
Pivot in Mysql(phpmyadmin) on dates without sum or MAX
I want to show my data in this format, data view client,
And my Database structure is in this format, Sql View

EDITED
I want to show my data in this format,

```<code>Name (Father name)  Jan (PKR)   Feb (PKR)   Mar (PKR)   Apr (PKR)
castiel(siddiqui)   20110
Gull(yasal)         20010
</code>```

And my DB structure is

```<code>c_id    name   salary       ds_id   amount      date_time
3       abc     20000       1       20010       2023-01-07
4       abc     20000       2       20010       2023-01-07
5       abc     20000       3       20010       2023-01-07
6       abc     20000       4       20010       2023-01-07
6       abc     20000       5       20011       2023-02-07
</code>```

I created this sql query without join to just check if I can, but no joy

```<code>SELECT courier.name
,MAX(IF(DATE_FORMAT(dis_salary.date_time,'%Y-m')='2023', dis_salary.amount,NULL)) as salary
FROM dis_salary
JOIN courier ON courier.c_id=dis_salary.courier_id
GROUP BY courier.c_id
</code>```

I don't want to show max or sum, and all the dates are variable, so cant hardcode

I want to show each salary given to courier w.r.t month

Also the project is in PHP CodeIgniter, if that helps

output i want

name
month1
month2

abc
20010
20011

Body:
I want to show my data in this format, data view client,
And my Database structure is in this format, Sql View

EDITED
I want to show my data in this format,

Name (Father name)  Jan (PKR)   Feb (PKR)   Mar (PKR)   Apr (PKR)
castiel(siddiqui)   20110
Gull(yasal)         20010

And my DB structure is

c_id    name   salary       ds_id   amount      date_time
3       abc     20000       1       20010       2023-01-07
4       abc     20000       2       20010       2023-01-07
5       abc     20000       3       20010       2023-01-07
6       abc     20000       4       20010       2023-01-07
6       abc     20000       5       20011       2023-02-07

I created this sql query without join to just check if I can, but no joy

SELECT courier.name
,MAX(IF(DATE_FORMAT(dis_salary.date_time,'%Y-m')='2023', dis_salary.amount,NULL)) as salary
FROM dis_salary
JOIN courier ON courier.c_id=dis_salary.courier_id
GROUP BY courier.c_id

I don't want to show max or sum, and all the dates are variable, so cant hardcode

I want to show each salary given to courier w.r.t month

Also the project is in PHP CodeIgniter, if that helps

output i want

name
month1
month2

abc
20010
20011


问:
Strange behavior with accent shortcuts
I found this strange behavior of accent shortcuts on UK keyboard as for some users, Windows is interpreting ie. Ctrl + Alt + Shift + O as Shift + Ó and I haven't found a dependency. Happens on both Windows 10 and 11 and some devices.

Here is the link for testing to see if you can reproduce the issue.

https://jsfiddle.net/5szc0921/4/

Steps to test

Change keyboard layout to UK.

Proceed to the link

click Console (beta) at the bottom right.

click anywhere inside the white box

you should be able to see messages whenever you pressed buttons.

If you pressed the combinations, Ctrl + Alt + Shift + O and Ctrl + Alt + O, it should print specific messages of what keys are being pressed.

I've put 4 different cases.

Found: Ctrl + Alt + Shift + Ó

Found: Ctrl + Alt + ó

Found: Shift + Ó

Found: ó

For those people who having the issue, they cannot reach Case 1 and 2 as whenever they pressed the combination ( Ctrl + Alt + Shift + O & Ctrl + Alt + O ).
It either goes to Case 3 or 4 as the system cannot find Ctrl + Alt.

Any help or suggestion would be much appreciated.

Title: Strange behavior with accent shortcuts


问:
Application run first time after ask location permission but when run on second time it stuck
Need help,
Application run first time accurately with ask permission activity, but on second run it stuck on permission activity view and don't skip the activity and shows only content of the Location Activity,
How can i achieve this?

My scenario:

1st time run- From Splash Screen----->Location Permission Activity--->Main Activity

2nd time rum From Splash Screen----->(App)Main Activity

**
Below is my code in Android Studio Java**

```<code>@Override
protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_location);

    if (ContextCompat.checkSelfPermission(Location.this,

            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
        if (ActivityCompat.shouldShowRequestPermissionRationale(Location.this,
                Manifest.permission.ACCESS_FINE_LOCATION)){
            ActivityCompat.requestPermissions(Location.this,
                    new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);

        }else{
            ActivityCompat.requestPermissions(Location.this,
                    new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
        }
    }

}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
                                       int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    switch (requestCode) {
        case 1: {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                                   if (ContextCompat.checkSelfPermission(Location.this,
                        Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)

                {
                    Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();

                }

            } else {

                Toast.makeText(this, "Permission Denied", Toast.LENGTH_SHORT).show();

            }
            startActivity(new Intent(getApplicationContext(), MainActivity.class));
            finish();

            return;

        }
    }
}

}
</code>```

Body:
Need help,
Application run first time accurately with ask permission activity, but on second run it stuck on permission activity view and don't skip the activity and shows only content of the Location Activity,
How can i achieve this?

My scenario:

1st time run- From Splash Screen----->Location Permission Activity--->Main Activity

2nd time rum From Splash Screen----->(App)Main Activity

**
Below is my code in Android Studio Java**

@Override
protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_location);

    if (ContextCompat.checkSelfPermission(Location.this,

            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
        if (ActivityCompat.shouldShowRequestPermissionRationale(Location.this,
                Manifest.permission.ACCESS_FINE_LOCATION)){
            ActivityCompat.requestPermissions(Location.this,
                    new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);

        }else{
            ActivityCompat.requestPermissions(Location.this,
                    new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
        }
    }

}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
                                       int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    switch (requestCode) {
        case 1: {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                                   if (ContextCompat.checkSelfPermission(Location.this,
                        Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)

                {
                    Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();

                }

            } else {

                Toast.makeText(this, "Permission Denied", Toast.LENGTH_SHORT).show();

            }
            startActivity(new Intent(getApplicationContext(), MainActivity.class));
            finish();

            return;

        }
    }
}

}


问:
Is there any way to know in what resolution a game is using?
I have a C# app launching games (different process), but some games are not configured to take full advantage of the monitor resolution (example game configured for 1080p but monitor supports 4K). I know the game process handle, is there any way to know what resolution the process is running on full screen from my C# app?

Note, I am not interested in getting the screen resolution or the game (process) windows size. The windows size may be 4K full screen but the game itself may not be running on 4K and windows (or gx driver) is upscaling to 4K. I want to know what native resolution the game is really running on full screen.

I can't find any info, if this is possible in a generic way.


问:
ZAP API for passive scanning only without crawling
just wanna ask if there is a way to call passive scanning specifically without spidering, as I have the url list and use importurl api to inject urls into zaproxy.

I did examine the api documentation for pscan module seems it does not have api that starts the passive scanning.


问:
Vue 3 Breadcrumb did not work with

<template>
      <breadcrumb :pages="pages"/>

รายชื่อช่าง

Admin

        <router-link to="/staff/add">
          <button type="button" class="inline-flex items-center justify-center rounded-md border border-transparent
          bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2
          focus:ring-indigo-500 focus:ring-offset-2 sm:w-auto">เพิ่มช่าง</button>
        </router-link>

                  ชื่อ
                  แผนก
                  คะแนน

                    Edit

                  {{ technician.name }}
                  {{ technician.role }}
                  {{ technician.score }}

                    <router-link :to="{ name: 'editstaff', params: { id: technician.id }}"
                      class="text-indigo-600 hover:text-indigo-900"
                      >Edit, {{ technician.name }}
                    </router-link>

</template>
```
<p>This is my BreadCrumb.vue</p>
```<script setup>
import { ChevronRightIcon, HomeIcon } from '@heroicons/vue/20/solid'

</script>
<template>

                <HomeIcon class="h-5 w-5 flex-shrink-0" aria-hidden="true" />
                Home

            <ChevronRightIcon class="h-5 w-5 flex-shrink-0 text-gray-400" aria-hidden="true" />
            {{ page.name }}

</template>
```
<p>Lastly, this is my main Layout (Not sure if this is related too or not</p>
```<script setup>
import { ref } from 'vue'
import { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'
import {
  HomeIcon,
  Bars3Icon,
  FolderIcon,
  UsersIcon,
  XMarkIcon
} from '@heroicons/vue/24/outline'

const authenticated = false;

const navigation = [
  { name: 'home', to: '/', icon: HomeIcon },
  { name: 'enj', to: '/staff', icon: UsersIcon },
  { name: 'proj', to: '/project', icon: FolderIcon },
  { name: 'selectproj', to: '/selectproject', icon: FolderIcon },
  { name: 'validateproj', to: '/validateproject', icon: FolderIcon },
]
const sidebarOpen = ref(false)

</script>
<template>

      <TransitionRoot as="template" :show="sidebarOpen">
        <Dialog as="div" class="relative z-40 md:hidden" @close="sidebarOpen = false">
          <TransitionChild as="template" enter="transition-opacity ease-linear duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="transition-opacity ease-linear duration-300" leave-from="opacity-100" leave-to="opacity-0">

          </TransitionChild>

            <TransitionChild as="template" enter="transition ease-in-out duration-300 transform" enter-from="-translate-x-full" enter-to="translate-x-0" leave="transition ease-in-out duration-300 transform" leave-from="translate-x-0" leave-to="-translate-x-full">
              <DialogPanel class="relative flex w-full max-w-xs flex-1 flex-col bg-gray-800">
                <TransitionChild as="template" enter="ease-in-out duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="ease-in-out duration-300" leave-from="opacity-100" leave-to="opacity-0">

                    <button type="button" class="ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" @click="sidebarOpen = false">
                      Close sidebar
                      <XMarkIcon class="h-6 w-6 text-white" aria-hidden="true" />
                    </button>

                </TransitionChild>

                    <router-link v-for="item in navigation" :key="item.name" :to="item.to" class="['text-gray-300 hover:bg-gray-700 hover:text-white', 'group flex items-center px-2 py-2 text-base font-medium rounded-md']">
                      <component :is="item.icon" :class="[isActive ? 'text-gray-300' : 'text-gray-400 group-hover:text-gray-300', 'mr-4 flex-shrink-0 h-6 w-6']" aria-hidden="true" />
                      {{ item.name }}
                    </router-link>

Tom Cook

View profile

              </DialogPanel>
            </TransitionChild>

        </Dialog>
      </TransitionRoot>

              <RouterLink v-for="item in navigation" :key="item.name" :to="item.to" :class="[item.current ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white', 'group flex items-center px-2 py-2 text-sm font-medium rounded-md']">
                <component :is="item.icon" :class="[item.current ? 'text-gray-300' : 'text-gray-400 group-hover:text-gray-300', 'mr-3 flex-shrink-0 h-6 w-6']" aria-hidden="true" />
                {{ item.name }}
              </RouterLink>

:Username

                  <RouterLink to="/">

Logout

                  </RouterLink>

                <RouterLink to="/signin">

เข้าสู่ระบบ

                  </RouterLink>

          <button type="button" class="-ml-0.5 -mt-0.5 inline-flex h-12 w-12 items-center justify-center rounded-md text-gray-500 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" @click="sidebarOpen = true">
            Open sidebar
            <Bars3Icon class="h-6 w-6" aria-hidden="true" />
          </button>

              <slot>
                <RouterView/>
              </slot>

  </template>

```

Title: Vue 3 Breadcrumb did not work with <Script setup>

Body:
I need your help for my Breadcrumb component.
It did work last time but after I add the Pinia it did not work anymore.
I don't know if this is related to Pinia or not.

This is the screenshot of the project

my_vue_project_screenshot

If you additional detail more than below, please let me know

Thank you all in advance

Also, I'm not sure my Vue project structure is correct or not.

Main layout
|
|- BreadCrumb
|- RouterView

I put BreadCrumb component inside every View pages. Like this (for example)

<template>
      <breadcrumb :pages="pages"/>

รายชื่อช่าง

Admin

        <router-link to="/staff/add">
          <button type="button" class="inline-flex items-center justify-center rounded-md border border-transparent
          bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2
          focus:ring-indigo-500 focus:ring-offset-2 sm:w-auto">เพิ่มช่าง</button>
        </router-link>

                  ชื่อ
                  แผนก
                  คะแนน

                    Edit

                  {{ technician.name }}
                  {{ technician.role }}
                  {{ technician.score }}

                    <router-link :to="{ name: 'editstaff', params: { id: technician.id }}"
                      class="text-indigo-600 hover:text-indigo-900"
                      >Edit, {{ technician.name }}
                    </router-link>

</template>

This is my BreadCrumb.vue

<template>

                <HomeIcon class="h-5 w-5 flex-shrink-0" aria-hidden="true" />
                Home

            <ChevronRightIcon class="h-5 w-5 flex-shrink-0 text-gray-400" aria-hidden="true" />
            {{ page.name }}

</template>

Lastly, this is my main Layout (Not sure if this is related too or not

<template>

      <TransitionRoot as="template" :show="sidebarOpen">
        <Dialog as="div" class="relative z-40 md:hidden" @close="sidebarOpen = false">
          <TransitionChild as="template" enter="transition-opacity ease-linear duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="transition-opacity ease-linear duration-300" leave-from="opacity-100" leave-to="opacity-0">

          </TransitionChild>

            <TransitionChild as="template" enter="transition ease-in-out duration-300 transform" enter-from="-translate-x-full" enter-to="translate-x-0" leave="transition ease-in-out duration-300 transform" leave-from="translate-x-0" leave-to="-translate-x-full">
              <DialogPanel class="relative flex w-full max-w-xs flex-1 flex-col bg-gray-800">
                <TransitionChild as="template" enter="ease-in-out duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="ease-in-out duration-300" leave-from="opacity-100" leave-to="opacity-0">

                    <button type="button" class="ml-1 flex h-10 w-10 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" @click="sidebarOpen = false">
                      Close sidebar
                      <XMarkIcon class="h-6 w-6 text-white" aria-hidden="true" />
                    </button>

                </TransitionChild>

                    <router-link v-for="item in navigation" :key="item.name" :to="item.to" class="['text-gray-300 hover:bg-gray-700 hover:text-white', 'group flex items-center px-2 py-2 text-base font-medium rounded-md']">
                      <component :is="item.icon" :class="[isActive ? 'text-gray-300' : 'text-gray-400 group-hover:text-gray-300', 'mr-4 flex-shrink-0 h-6 w-6']" aria-hidden="true" />
                      {{ item.name }}
                    </router-link>

Tom Cook

View profile

              </DialogPanel>
            </TransitionChild>

        </Dialog>
      </TransitionRoot>

              <RouterLink v-for="item in navigation" :key="item.name" :to="item.to" :class="[item.current ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white', 'group flex items-center px-2 py-2 text-sm font-medium rounded-md']">
                <component :is="item.icon" :class="[item.current ? 'text-gray-300' : 'text-gray-400 group-hover:text-gray-300', 'mr-3 flex-shrink-0 h-6 w-6']" aria-hidden="true" />
                {{ item.name }}
              </RouterLink>

:Username

                  <RouterLink to="/">

Logout

                  </RouterLink>

                <RouterLink to="/signin">

เข้าสู่ระบบ

                  </RouterLink>

          <button type="button" class="-ml-0.5 -mt-0.5 inline-flex h-12 w-12 items-center justify-center rounded-md text-gray-500 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" @click="sidebarOpen = true">
            Open sidebar
            <Bars3Icon class="h-6 w-6" aria-hidden="true" />
          </button>

              <slot>
                <RouterView/>
              </slot>

  </template>


问:
Ant Design table example code gives warning(next.js+ typescript)
package.json

```<code>    "antd": "^5.0.7",
    "next": "13.0.6",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "typescript": "4.9.4"
</code>```

https://ant.design/components/table#using-in-typescript

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

interface User {
  key: number;
  name: string;
}

const columns: ColumnsType<User> = [
  {
    key: 'name',
    title: 'Name',
    dataIndex: 'name',
  },
];

const data: User[] = [
  {
    key: 0,
    name: 'Jack',
  },
];

export default () => (
  <>
    <Table<User> columns={columns} dataSource={data} />
    /* JSX style usage */
    <Table<User> dataSource={data}>
      <Table.Column<User> key="name" title="Name" dataIndex="name" />
    </Table>
  </>
);
</code>```

enter image description here

```<code><Table<User> columns={columns} dataSource={data} />
</code>```

Type User[] is not assignable to type RcTableProps<RecordType>["data"] | undefined

Why am I getting this warning?

The type of data can be known from the generics of the Table tag
dataSource arguments are arrays of the same type so no warning should be given

Body:
package.json

    "antd": "^5.0.7",
    "next": "13.0.6",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "typescript": "4.9.4"

https://ant.design/components/table#using-in-typescript

import { Table } from 'antd';
import type { ColumnsType } from 'antd/es/table';

interface User {
  key: number;
  name: string;
}

const columns: ColumnsType<User> = [
  {
    key: 'name',
    title: 'Name',
    dataIndex: 'name',
  },
];

const data: User[] = [
  {
    key: 0,
    name: 'Jack',
  },
];

export default () => (
  <>
    <Table<User> columns={columns} dataSource={data} />
    /* JSX style usage */
    <Table<User> dataSource={data}>
      <Table.Column<User> key="name" title="Name" dataIndex="name" />

  </>
);

enter image description here

<Table<User> columns={columns} dataSource={data} />

Type User[] is not assignable to type RcTableProps<RecordType>["data"] | undefined

Why am I getting this warning?

The type of data can be known from the generics of the Table tag
dataSource arguments are arrays of the same type so no warning should be given


问:
AirflowException("Task received SIGTERM signal")
I'm running Airflow with Docker swarm on 5 servers. After using 2 months, there are some errors on Dags like this. These errors occurred in dags that using a custom hive operator (similar to the inner function ) and no error occurred before 2 months. (Nothing changed with Dags...)

Also, if I tried to retry dag, sometimes it succeeded and sometimes it failed.

The really weird thing about this issue is that hive job was not failed. After the task was marked as failed in the airflow webserver (Sigterm), the query was complete after 1~10 mins.

As a result, flow is like this.

Task start -> 5~10 mins -> error (sigterm, airflow) -> 1~10 mins -> hive job success (hadoop log)

```<code>[2023-01-09 08:06:07,583] {local_task_job.py:208} WARNING - State of this instance has been externally set to up_for_retry. Terminating instance.
[2023-01-09 08:06:07,588] {process_utils.py:100} INFO - Sending Signals.SIGTERM to GPID 135213
[2023-01-09 08:06:07,588] {taskinstance.py:1236} ERROR - Received SIGTERM. Terminating subprocesses.
[2023-01-09 08:13:42,510] {taskinstance.py:1463} ERROR - Task failed with exception
Traceback (most recent call last):
  File "/opt/airflow/dags/common/operator/hive_q_operator.py", line 81, in execute
    cur.execute(statement)  # hive query custom operator
  File "/home/airflow/.local/lib/python3.8/site-packages/pyhive/hive.py", line 454, in execute
    response = self._connection.client.ExecuteStatement(req)
  File "/home/airflow/.local/lib/python3.8/site-packages/TCLIService/TCLIService.py", line 280, in ExecuteStatement
    return self.recv_ExecuteStatement()
  File "/home/airflow/.local/lib/python3.8/site-packages/TCLIService/TCLIService.py", line 292, in recv_ExecuteStatement
    (fname, mtype, rseqid) = iprot.readMessageBegin()
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py", line 134, in readMessageBegin
    sz = self.readI32()
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py", line 217, in readI32
    buff = self.trans.readAll(4)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/transport/TTransport.py", line 62, in readAll
    chunk = self.read(sz - have)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift_sasl/__init__.py", line 173, in read
    self._read_frame()
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift_sasl/__init__.py", line 177, in _read_frame
    header = self._trans_read_all(4)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift_sasl/__init__.py", line 210, in _trans_read_all
    return read_all(sz)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/transport/TTransport.py", line 62, in readAll
    chunk = self.read(sz - have)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/transport/TSocket.py", line 150, in read
    buff = self.handle.recv(sz)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1238, in signal_handler
    raise AirflowException("Task received SIGTERM signal")
airflow.exceptions.AirflowException: Task received SIGTERM signal

</code>```

I already restarted the airflow server and there was nothing changed.

Here is the failed task's log (flower log)

Is there any helpful guide for me?

Thanks :)

```<code>Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/executors/celery_executor.py", line 88, in execute_command
    _execute_in_fork(command_to_exec)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/executors/celery_executor.py", line 99, in _execute_in_fork
    raise AirflowException('Celery command failed on host: ' + get_hostname())
airflow.exceptions.AirflowException: Celery command failed on host: 8be4caa25d17
</code>```

Body:
I'm running Airflow with Docker swarm on 5 servers. After using 2 months, there are some errors on Dags like this. These errors occurred in dags that using a custom hive operator (similar to the inner function ) and no error occurred before 2 months. (Nothing changed with Dags...)

Also, if I tried to retry dag, sometimes it succeeded and sometimes it failed.

The really weird thing about this issue is that hive job was not failed. After the task was marked as failed in the airflow webserver (Sigterm), the query was complete after 1~10 mins.

As a result, flow is like this.

Task start -> 5~10 mins -> error (sigterm, airflow) -> 1~10 mins -> hive job success (hadoop log)

[2023-01-09 08:06:07,583] {local_task_job.py:208} WARNING - State of this instance has been externally set to up_for_retry. Terminating instance.
[2023-01-09 08:06:07,588] {process_utils.py:100} INFO - Sending Signals.SIGTERM to GPID 135213
[2023-01-09 08:06:07,588] {taskinstance.py:1236} ERROR - Received SIGTERM. Terminating subprocesses.
[2023-01-09 08:13:42,510] {taskinstance.py:1463} ERROR - Task failed with exception
Traceback (most recent call last):
  File "/opt/airflow/dags/common/operator/hive_q_operator.py", line 81, in execute
    cur.execute(statement)  # hive query custom operator
  File "/home/airflow/.local/lib/python3.8/site-packages/pyhive/hive.py", line 454, in execute
    response = self._connection.client.ExecuteStatement(req)
  File "/home/airflow/.local/lib/python3.8/site-packages/TCLIService/TCLIService.py", line 280, in ExecuteStatement
    return self.recv_ExecuteStatement()
  File "/home/airflow/.local/lib/python3.8/site-packages/TCLIService/TCLIService.py", line 292, in recv_ExecuteStatement
    (fname, mtype, rseqid) = iprot.readMessageBegin()
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py", line 134, in readMessageBegin
    sz = self.readI32()
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py", line 217, in readI32
    buff = self.trans.readAll(4)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/transport/TTransport.py", line 62, in readAll
    chunk = self.read(sz - have)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift_sasl/__init__.py", line 173, in read
    self._read_frame()
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift_sasl/__init__.py", line 177, in _read_frame
    header = self._trans_read_all(4)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift_sasl/__init__.py", line 210, in _trans_read_all
    return read_all(sz)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/transport/TTransport.py", line 62, in readAll
    chunk = self.read(sz - have)
  File "/home/airflow/.local/lib/python3.8/site-packages/thrift/transport/TSocket.py", line 150, in read
    buff = self.handle.recv(sz)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1238, in signal_handler
    raise AirflowException("Task received SIGTERM signal")
airflow.exceptions.AirflowException: Task received SIGTERM signal

I already restarted the airflow server and there was nothing changed.

Here is the failed task's log (flower log)

Is there any helpful guide for me?

Thanks :)

Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/executors/celery_executor.py", line 88, in execute_command
    _execute_in_fork(command_to_exec)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/executors/celery_executor.py", line 99, in _execute_in_fork
    raise AirflowException('Celery command failed on host: ' + get_hostname())
airflow.exceptions.AirflowException: Celery command failed on host: 8be4caa25d17


问:
Universal Print via Microsoft Graph API
I have integrated universal printer in my App(outsystems) using Microsoft graph APIs, it's working as expected except pageRanges, for example I have document containing 5 pages and I want to print 3rd and 4th page only but it is printing all 5 pages every time.

Following is the JSON representation of the request

```<code>{
  "configuration": {
    "quality": "medium",
    "dpi": 600,
    "duplexMode": "oneSided",
    "copies": 1,
    "colorMode": "auto",
    "mediaSize": "A4",
    "collate": true,
    "feedOrientation": "longEdgeFirst",
    "fitPdfToPage": false,
    "inputBin": "tray-1",
    "orientation": "portrait",
    "pageRanges": [
      {
        "start": 3,
        "end": 4
      }
    ],
    "pagesPerSheet": 1,
    "scaling": "none"
  }
}
</code>```

Title: Universal Print via Microsoft Graph API

Body:
I have integrated universal printer in my App(outsystems) using Microsoft graph APIs, it's working as expected except pageRanges, for example I have document containing 5 pages and I want to print 3rd and 4th page only but it is printing all 5 pages every time.

Following is the JSON representation of the request

{
  "configuration": {
    "quality": "medium",
    "dpi": 600,
    "duplexMode": "oneSided",
    "copies": 1,
    "colorMode": "auto",
    "mediaSize": "A4",
    "collate": true,
    "feedOrientation": "longEdgeFirst",
    "fitPdfToPage": false,
    "inputBin": "tray-1",
    "orientation": "portrait",
    "pageRanges": [
      {
        "start": 3,
        "end": 4
      }
    ],
    "pagesPerSheet": 1,
    "scaling": "none"
  }
}


问:
I want to access my item.i64totalcount from one page to another view page & display it into the available license box
[[[enter image description here](https://i.stack.imgur.com/oA63G.png)](https://i.stack.imgur.com/LEm4J.png)](https://i.stack.imgur.com/wteHF.png)

I took the value of item.i64totalcount in trasfer view page by taking the _license object


问:
Vitis HLS: pragma Array Partition doesn't work in the sub-function when I set this pragma outside
I want to unroll the loop "find_col" in the inlined function "find_match". Therefore, I set the pragma array partition on the array "mp_buffer" and "mc_buffer" under the declaration of them (which is outside of "find_match"), and I set them into find_match as arguments. However, there is an II violation because the array is not patitioned. I would like to ask how to solve it, thank you!!

The function find_match (the parallel factor is set to 8 now):

```<code>inline void find_match (
  Feature_Point origin,
  int origin_u_bin,
  int origin_v_bin,
  int origin_col_idx,
  Feature_Point m_buffer[7][4][COL_BIN_FEATURE_MAX],
  int32_t       m_buffer_num[7][4][V_BIN_NUM+1],
  Matching_cand m_matching[U_BIN_NUM][4][COL_BIN_FEATURE_MAX]
) {

  Matching_cand min_cand;
  int16_t  min_cost = 32766;
  int16_t  psum;
  int16_t  psum_03, psum_47, psum_811, psum_1215, psum_1619, psum_2023, psum_2427, psum_2831;
  int16_t  psum_015, psum_1631;
  int32_t u_min,u_max,v_min,v_max;

  u_min = origin.u-SEARCH_RAD_U;
  u_max = origin.u+SEARCH_RAD_U;
  v_min = origin.v-SEARCH_RAD_V;
  v_max = origin.v+SEARCH_RAD_V;

  // bins of interest
  int32_t u_bin_min = max(origin_u_bin-3, 0);
  int32_t u_bin_max = min(origin_u_bin+3, U_BIN_NUM-1);
  int32_t v_bin_min = max(origin_v_bin-3, 0);
  int32_t v_bin_max = min(origin_v_bin+3, V_BIN_NUM-1);
  int32_t bin_class = origin.type;
  int16_t tmp[32];
  #pragma HLS ARRAY_PARTITION variable=tmp dim=1 complete

  // for all bins of interest do
  find_u_bin: for (int u_bin = u_bin_min; u_bin < u_bin_max; u_bin++) {
    int u_bin_buffer = u_bin % 7;
    find_col: for (int col_idx = m_buffer_num[u_bin_buffer][bin_class][v_bin_min]; col_idx < m_buffer_num[u_bin_buffer][bin_class][v_bin_max]; col_idx++) {
      #pragma HLS UNROLL factor=parallel
      Feature_Point target = m_buffer[u_bin_buffer][bin_class][col_idx];
      if (target.u>=u_min && target.u<=u_max && target.v>=v_min && target.v<=v_max) {
        psum = 0;
        calc: for (int i = 0; i < 32; i++) {
          #pragma HLS UNROLL  factor=32
          ap_uint<8> a = origin.d.range((i+1)*8-1, 8*i);
          ap_uint<8> b = target.d.range((i+1)*8-1, 8*i);
          tmp[i] = ABS(a, b);
        }
        // adder tree
...
</code>```

I set the pragma here:

```<code>   Matching_cand mc_matching[U_BIN_NUM][4][COL_BIN_FEATURE_MAX];
   Matching_cand mp_matching[U_BIN_NUM][4][COL_BIN_FEATURE_MAX];
   static int _p_matched_num;

   #pragma HLS ARRAY_PARTITION variable=mc_buffer dim=3 type=cyclic factor=parallel
   #pragma HLS ARRAY_PARTITION variable=mp_buffer dim=3 type=cyclic factor=parallel

   find_match(origin, i, v_buffer_idx, col_idx, mp_buffer, mp_buffer_num, mc_matching);
</code>```

I have tried to set array partition pragma in the "find_match" function, but it take a very long time to do the C synthesys.

Body:
I want to unroll the loop "find_col" in the inlined function "find_match". Therefore, I set the pragma array partition on the array "mp_buffer" and "mc_buffer" under the declaration of them (which is outside of "find_match"), and I set them into find_match as arguments. However, there is an II violation because the array is not patitioned. I would like to ask how to solve it, thank you!!

The function find_match (the parallel factor is set to 8 now):

inline void find_match (
  Feature_Point origin,
  int origin_u_bin,
  int origin_v_bin,
  int origin_col_idx,
  Feature_Point m_buffer[7][4][COL_BIN_FEATURE_MAX],
  int32_t       m_buffer_num[7][4][V_BIN_NUM+1],
  Matching_cand m_matching[U_BIN_NUM][4][COL_BIN_FEATURE_MAX]
) {

  Matching_cand min_cand;
  int16_t  min_cost = 32766;
  int16_t  psum;
  int16_t  psum_03, psum_47, psum_811, psum_1215, psum_1619, psum_2023, psum_2427, psum_2831;
  int16_t  psum_015, psum_1631;
  int32_t u_min,u_max,v_min,v_max;

  u_min = origin.u-SEARCH_RAD_U;
  u_max = origin.u+SEARCH_RAD_U;
  v_min = origin.v-SEARCH_RAD_V;
  v_max = origin.v+SEARCH_RAD_V;

  // bins of interest
  int32_t u_bin_min = max(origin_u_bin-3, 0);
  int32_t u_bin_max = min(origin_u_bin+3, U_BIN_NUM-1);
  int32_t v_bin_min = max(origin_v_bin-3, 0);
  int32_t v_bin_max = min(origin_v_bin+3, V_BIN_NUM-1);
  int32_t bin_class = origin.type;
  int16_t tmp[32];
  #pragma HLS ARRAY_PARTITION variable=tmp dim=1 complete

  // for all bins of interest do
  find_u_bin: for (int u_bin = u_bin_min; u_bin < u_bin_max; u_bin++) {
    int u_bin_buffer = u_bin % 7;
    find_col: for (int col_idx = m_buffer_num[u_bin_buffer][bin_class][v_bin_min]; col_idx < m_buffer_num[u_bin_buffer][bin_class][v_bin_max]; col_idx++) {
      #pragma HLS UNROLL factor=parallel
      Feature_Point target = m_buffer[u_bin_buffer][bin_class][col_idx];
      if (target.u>=u_min && target.u<=u_max && target.v>=v_min && target.v<=v_max) {
        psum = 0;
        calc: for (int i = 0; i < 32; i++) {
          #pragma HLS UNROLL  factor=32
          ap_uint<8> a = origin.d.range((i+1)*8-1, 8*i);
          ap_uint<8> b = target.d.range((i+1)*8-1, 8*i);
          tmp[i] = ABS(a, b);
        }
        // adder tree
...

I set the pragma here:

   Matching_cand mc_matching[U_BIN_NUM][4][COL_BIN_FEATURE_MAX];
   Matching_cand mp_matching[U_BIN_NUM][4][COL_BIN_FEATURE_MAX];
   static int _p_matched_num;

   #pragma HLS ARRAY_PARTITION variable=mc_buffer dim=3 type=cyclic factor=parallel
   #pragma HLS ARRAY_PARTITION variable=mp_buffer dim=3 type=cyclic factor=parallel

   find_match(origin, i, v_buffer_idx, col_idx, mp_buffer, mp_buffer_num, mc_matching);

I have tried to set array partition pragma in the "find_match" function, but it take a very long time to do the C synthesys.