问:
is there any method in psutil package which can send any type of signal at the termination of any currently running process in my system
```<code>  for process in psutil.process_iter(['pid', 'name', 'username']):

                pro_id = process.info['pid']
                if pro_id not in list_proc:
                    list_proc.append(pro_id)

                print(process.info)
                p = psutil.Process(process.pid)

                p.create_time()
                print(f'Process Started at : {datetime.datetime.fromtimestamp(p.create_time()).strftime("%d-%m-%Y %H:%M:%S")}')

</code>```

iam trying to find the termination time of the currently running process in my system , this method should be continuosly running to check for any additional new processes added to it and give its termination time after it closes or terminated .

Body:
  for process in psutil.process_iter(['pid', 'name', 'username']):

                pro_id = process.info['pid']
                if pro_id not in list_proc:
                    list_proc.append(pro_id)

                print(process.info)
                p = psutil.Process(process.pid)

                p.create_time()
                print(f'Process Started at : {datetime.datetime.fromtimestamp(p.create_time()).strftime("%d-%m-%Y %H:%M:%S")}')

iam trying to find the termination time of the currently running process in my system , this method should be continuosly running to check for any additional new processes added to it and give its termination time after it closes or terminated .


来源: stackexchange

问:
nesting multiple dockerized angular applications under a unique domain name with nginx( with the location block)
I have 3 angular applications that have been dockerized. Using a docker-compose file I would like to run all of them with an nginx server as a reverse proxy. Here is my docker compose file

```<code>*version: '3.9'
services:
  reverse_proxy:
    container_name: nginx_rp_beta
    image: nginx:1.23.3
    restart: always
    volumes:
      - ./nginx_proxy_html:/var/www/html
      - ./nginx_proxy_conf:/etc/nginx/conf.d
    ports:
      - 80:80
      - 443:443

  site01:
    container_name: site01
    image: image1
    ports:
      - 8081:80
  site02:
    container_name: site02
    image: image3
    ports:
      - 8082:80
  site03:
    container_name: site03
    image: image3
    ports:
      - 8083:80*
</code>```

My nginx config file for reverse proxy is this one

```<code>*server {
    listen 80;
    listen 443 ssl;
    server_name dummy.server.cm;
    ssl_certificate /etc/nginx/conf.d/ssl/front/server.crt;
    ssl_certificate_key /etc/nginx/conf.d/ssl/front/server.key;

    location ~* /site03 {
        rewrite ^/site03(.*) $1 break;
        proxy_pass http://site03;
    }

    location ~* /site02 {
        rewrite ^/site02(.*) $1 break;
        proxy_pass http://site02;
    }

    location / {
        proxy_pass http://site01;
    }
}*
</code>```

So that the first site is accessible through dummy.server.cm, site 2 (dummy.server.cm/site02) and site 3 (dummy.server.cm/site03)

But except from the first one(site01) which is OK, all the others try to open but turn infinitely trying to load scripts with an 404 error.
Any suggestion will be greatly appreciated

I added this to each location block in my nginx conf

```<code>proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
</code>```

but all to no avail.
I fixed the problem by having a domain name for each site but this was not what I was asked for

ContentLicense: CC BY-SA 4.0

Body:
I have 3 angular applications that have been dockerized. Using a docker-compose file I would like to run all of them with an nginx server as a reverse proxy. Here is my docker compose file

*version: '3.9'
services:
  reverse_proxy:
    container_name: nginx_rp_beta
    image: nginx:1.23.3
    restart: always
    volumes:
      - ./nginx_proxy_html:/var/www/html
      - ./nginx_proxy_conf:/etc/nginx/conf.d
    ports:
      - 80:80
      - 443:443

  site01:
    container_name: site01
    image: image1
    ports:
      - 8081:80
  site02:
    container_name: site02
    image: image3
    ports:
      - 8082:80
  site03:
    container_name: site03
    image: image3
    ports:
      - 8083:80*

My nginx config file for reverse proxy is this one

*server {
    listen 80;
    listen 443 ssl;
    server_name dummy.server.cm;
    ssl_certificate /etc/nginx/conf.d/ssl/front/server.crt;
    ssl_certificate_key /etc/nginx/conf.d/ssl/front/server.key;

    location ~* /site03 {
        rewrite ^/site03(.*) $1 break;
        proxy_pass http://site03;
    }

    location ~* /site02 {
        rewrite ^/site02(.*) $1 break;
        proxy_pass http://site02;
    }

    location / {
        proxy_pass http://site01;
    }
}*

So that the first site is accessible through dummy.server.cm, site 2 (dummy.server.cm/site02) and site 3 (dummy.server.cm/site03)

But except from the first one(site01) which is OK, all the others try to open but turn infinitely trying to load scripts with an 404 error.
Any suggestion will be greatly appreciated

I added this to each location block in my nginx conf

proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

but all to no avail.
I fixed the problem by having a domain name for each site but this was not what I was asked for


问:
is there a way to achieve Restrictions.sqlRestriction in CriteriaQuery<>
```<code>CriteriaBuilder builder = getSession().getCriteriaBuilder();
CriteriaQuery<Test> query = builder.createQuery(Test.class);
Root<Test> root = query.from(Test.class);
</code>```

Now i came across a situation where i need to add sqlRestriction. Earlier i have used it like this with Criteria API,

```<code>.add(Restrictions.sqlRestriction(
</code>```

But not sure how to do it using CriteriaQuery, I have searched alot about this on internet but no luck...
Anyone knows if it is possible to achieve this or not ?
If possible, please guide me
Thanks

Body:
CriteriaBuilder builder = getSession().getCriteriaBuilder();
CriteriaQuery<Test> query = builder.createQuery(Test.class);
Root<Test> root = query.from(Test.class);

Now i came across a situation where i need to add sqlRestriction. Earlier i have used it like this with Criteria API,

.add(Restrictions.sqlRestriction(

But not sure how to do it using CriteriaQuery, I have searched alot about this on internet but no luck...
Anyone knows if it is possible to achieve this or not ?
If possible, please guide me
Thanks


问:
Problem of distinguishing connections to multiple databases
I'm a beginner in laravel 8, and I'm trying to make the site connect to several databases, in this case there are two at the moment.

To make the multiple connections I used this site: https://themewp.inform.click/fr/comment-utiliser-la-fonctionnalite-de-connexions-a-plusieurs-bases-de-donnees-de-laravel-sur-un-site-web/

I have my first connection called mysql, and the second is called mysql2. But the pages that have to use the first connection still go to the second one. I have specified the connection they should use. So I would like to know how to make them distinguish, or if there is a method to solve this problem.


问:
Is there a built in function in pandas that does the following?
i have two dataframes df1 and df2. they have a column with common values but in df1['comon_values_column'] every value comes up only once while in df2['comon_values_column'] each value can come up more than once. I want to see if i can do the following with a single line and without a loop

```<code>for value in df2['comon_values_column']:
df2['empty_column'].loc[df2['comon_values_column']==value]=df1['other_column'].loc[df1['comon_values_column']==value]
</code>```

i have tried to use merge but because of the size of the dataframe it is very difficult to make sure that it does exactly what i want

Body:
i have two dataframes df1 and df2. they have a column with common values but in df1['comon_values_column'] every value comes up only once while in df2['comon_values_column'] each value can come up more than once. I want to see if i can do the following with a single line and without a loop

for value in df2['comon_values_column']:
df2['empty_column'].loc[df2['comon_values_column']==value]=df1['other_column'].loc[df1['comon_values_column']==value]

i have tried to use merge but because of the size of the dataframe it is very difficult to make sure that it does exactly what i want


问:
How To allow useragnet and block others using htaccess
I want to block all other UserAgent came from outside and access only mine and access it using curl php file

```<code>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1 SV2 SERVERS Chromium)
</code>```

I tried this code to block  others and access only my UserAgent

```<code>RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} != Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1 SV2 SERVERS Chromium)
RewriteRule .* - [F,L]
</code>```

blocked okay
but when I tried to make curl php request

```<code>    $getdetails = "https://domain.php/file.php";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $getdetails);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1 SV2 SERVERS Chromium)');
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_data));
    $content = curl_exec($curl);

    curl_close($curl);
    echo $content;
    echo "<script>window.location.href='./FOLDER';</script>";exit();
</code>```

it's given me forbidden as I'm blocked because UserAgent

Body:
I want to block all other UserAgent came from outside and access only mine and access it using curl php file

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1 SV2 SERVERS Chromium)

I tried this code to block  others and access only my UserAgent

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} != Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1 SV2 SERVERS Chromium)
RewriteRule .* - [F,L]

blocked okay
but when I tried to make curl php request

    $getdetails = "https://domain.php/file.php";
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $getdetails);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1 SV2 SERVERS Chromium)');
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_data));
    $content = curl_exec($curl);

    curl_close($curl);
    echo $content;
    echo "";exit();

it's given me forbidden as I'm blocked because UserAgent


问:
What is multi-bucket impact in Elasticsearch
I have read many blogs forums documentations but i was not getting what is multi_bucket_impact in Elasticsearch ML
I have attached one screenshot of ML job graph also


问:
How to fix dead lock in Entity framework
I got following issue while running below code

```<code>Transaction (Process ID 54) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Entity framework

  string[] to = new string[] { "A", "B" };
            Parallel.ForEach(to, code =>
            {
                DeleteHouses(code);
            });

private static void DeleteHouses(string code)
        {
            using var ctx = new BloggingContext();
            using var trans = ctx.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);
            var todel = ctx.dbsHouses.Where(d => d.Code == code).ToList();
            if (todel != null)
            {
                ctx.dbsHouses.RemoveRange(todel);
                ctx.SaveChanges();//Exception
            }
            trans.Commit();
        }
</code>```

I tried Read Read Uncommitted IsolationLevel and using
dataContext.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");

But none of them working for me

Body:
I got following issue while running below code

Transaction (Process ID 54) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Entity framework

  string[] to = new string[] { "A", "B" };
            Parallel.ForEach(to, code =>
            {
                DeleteHouses(code);
            });

private static void DeleteHouses(string code)
        {
            using var ctx = new BloggingContext();
            using var trans = ctx.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);
            var todel = ctx.dbsHouses.Where(d => d.Code == code).ToList();
            if (todel != null)
            {
                ctx.dbsHouses.RemoveRange(todel);
                ctx.SaveChanges();//Exception
            }
            trans.Commit();
        }

I tried Read Read Uncommitted IsolationLevel and using
dataContext.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");

But none of them working for me


问:
How to pass parameter with path in websocket server in node js
I have setup below socket with the path but i couldn't pass the parameter with the path.
So, can anyone provide any solution that how can i pass it

```<code>const webSocketServer = require('ws');

class WebSocket {
    constructor (server) {
        this.server = server;
        this.socket = new webSocketServer.Server({ server, path: "/ws" });
        //this.socket = new webSocketServer.Server({ server, path: "/ws/:id" });
        // I want like this the commented code above want to pass id after the /ws
        this.connect();
    }
</code>```
```<code>this.socket = new webSocketServer.Server({ server, path: "/ws/:id" });
</code>```

I have tried like this but it didn't work.
Also there is nothing in its documentation.
https://github.com/websockets/ws/blob/master/doc/ws.md

Body:
I have setup below socket with the path but i couldn't pass the parameter with the path.
So, can anyone provide any solution that how can i pass it

const webSocketServer = require('ws');

class WebSocket {
    constructor (server) {
        this.server = server;
        this.socket = new webSocketServer.Server({ server, path: "/ws" });
        //this.socket = new webSocketServer.Server({ server, path: "/ws/:id" });
        // I want like this the commented code above want to pass id after the /ws
        this.connect();
    }

this.socket = new webSocketServer.Server({ server, path: "/ws/:id" });

I have tried like this but it didn't work.
Also there is nothing in its documentation.
https://github.com/websockets/ws/blob/master/doc/ws.md


问:
How can I create an already defined function that I can add code to when defined in the main program?
I'm really struggling on how to word this properly, so I'll use an example. Using the p5.js library, there are two functions called setup() and draw(), each of which you define in your main sketch and add code to. However, the setup function automatically runs once, and the draw function automatically loops after the setup function runs.

On top of this, there are keyPressed() and mousePressed() functions which are used in the same way:
function mouseMoved() { // automatically gets mouse movement }

I want to know how to use this to implement in my own projects. Can anyone offer me a solution?


问:
I installed sanity.io using npm after which my main NextJS app is showing errors when trying to run it on localhost

This is the error I am getting on browser when trying to run my NextJS app which was running fine until I installed sanity.io using npm. There was a new folder created for sanity in my nextjs app which had its own node_modules, I tried going back to when my app was working fine by deleting this sanity folder from my nextjs app. I also tried deleting the node_module folder which originally was present in my next js folder and then ran npm install, however, that does not seem to solve the problem.

Also getting this error in terminal:


问:
How to create a secp256k1 key pair with OpenSSL?
Since the EC_KEY functions are marked deprecated in OpenSSL 3 I tried to do it with EVP_PKEY functions.

Here is my OpenSSL 1.1 code:

```<code>void MainWindowOpenSsl::createKeyPair()
{
    EC_KEY *key_pair_obj = nullptr;;

    BIGNUM *priv_key;

    EC_POINT *pub_key;

    EC_GROUP *secp256k1_group;

    char *priv_key_char;
    char *pub_key_char;
    char *pub_key_char_comp;

    int ret_error;

    // Generate secp256k1 key pair
    key_pair_obj = EC_KEY_new_by_curve_name(NID_secp256k1);
    ret_error    = EC_KEY_generate_key(key_pair_obj);

    // Get private key
    priv_key      = (BIGNUM *)EC_KEY_get0_private_key(key_pair_obj);
    priv_key_char = BN_bn2hex(priv_key);

    // Get public key
    pub_key            = (EC_POINT *)EC_KEY_get0_public_key(key_pair_obj);
    secp256k1_group    = EC_GROUP_new_by_curve_name(NID_secp256k1);
    // Uncompressed
    pub_key_char       = EC_POINT_point2hex(secp256k1_group, pub_key, POINT_CONVERSION_UNCOMPRESSED, nullptr);
    // Compressed
    pub_key_char_comp  = EC_POINT_point2hex(secp256k1_group, pub_key, POINT_CONVERSION_COMPRESSED, nullptr);

    EC_GROUP_free(secp256k1_group);

    qDebug().noquote() << "\n";
    qDebug().noquote() << Q_FUNC_INFO;

    printf("Private key            : %s\n\n", priv_key_char);
    printf("Public key ompressed   : %s\n\n", pub_key_char);
    printf("Public key uncompressed: %s\n", pub_key_char_comp);
    printf("Error code             : %d\n", ret_error);
}
</code>```

With the EVP_PKEY functions I managed to get a private key, but I couldn't figure out how to extract the public key from it. That is how I started:

```<code>void MainWindowOpenSsl::createKeyPairNew()
{
    char *priv_key_char;

    // Private Key
    EVP_PKEY *evp_pkey = EVP_EC_gen("secp256k1");
    BIGNUM *bignum_priv_key = nullptr;
    EVP_PKEY_get_bn_param(evp_pkey, OSSL_PKEY_PARAM_PRIV_KEY, &bignum_priv_key);
    priv_key_char = BN_bn2hex(bignum_priv_key);
    printf("Private key            : %s\n\n", priv_key_char);

    // Extract the compressed and uncompressed public key from the private key
}
</code>```

but then I got stuck.

Thank you very much for your help.

Body:
Since the EC_KEY functions are marked deprecated in OpenSSL 3 I tried to do it with EVP_PKEY functions.

Here is my OpenSSL 1.1 code:

void MainWindowOpenSsl::createKeyPair()
{
    EC_KEY *key_pair_obj = nullptr;;

    BIGNUM *priv_key;

    EC_POINT *pub_key;

    EC_GROUP *secp256k1_group;

    char *priv_key_char;
    char *pub_key_char;
    char *pub_key_char_comp;

    int ret_error;

    // Generate secp256k1 key pair
    key_pair_obj = EC_KEY_new_by_curve_name(NID_secp256k1);
    ret_error    = EC_KEY_generate_key(key_pair_obj);

    // Get private key
    priv_key      = (BIGNUM *)EC_KEY_get0_private_key(key_pair_obj);
    priv_key_char = BN_bn2hex(priv_key);

    // Get public key
    pub_key            = (EC_POINT *)EC_KEY_get0_public_key(key_pair_obj);
    secp256k1_group    = EC_GROUP_new_by_curve_name(NID_secp256k1);
    // Uncompressed
    pub_key_char       = EC_POINT_point2hex(secp256k1_group, pub_key, POINT_CONVERSION_UNCOMPRESSED, nullptr);
    // Compressed
    pub_key_char_comp  = EC_POINT_point2hex(secp256k1_group, pub_key, POINT_CONVERSION_COMPRESSED, nullptr);

    EC_GROUP_free(secp256k1_group);

    qDebug().noquote() << "\n";
    qDebug().noquote() << Q_FUNC_INFO;

    printf("Private key            : %s\n\n", priv_key_char);
    printf("Public key ompressed   : %s\n\n", pub_key_char);
    printf("Public key uncompressed: %s\n", pub_key_char_comp);
    printf("Error code             : %d\n", ret_error);
}

With the EVP_PKEY functions I managed to get a private key, but I couldn't figure out how to extract the public key from it. That is how I started:

void MainWindowOpenSsl::createKeyPairNew()
{
    char *priv_key_char;

    // Private Key
    EVP_PKEY *evp_pkey = EVP_EC_gen("secp256k1");
    BIGNUM *bignum_priv_key = nullptr;
    EVP_PKEY_get_bn_param(evp_pkey, OSSL_PKEY_PARAM_PRIV_KEY, &bignum_priv_key);
    priv_key_char = BN_bn2hex(bignum_priv_key);
    printf("Private key            : %s\n\n", priv_key_char);

    // Extract the compressed and uncompressed public key from the private key
}

but then I got stuck.

Thank you very much for your help.


问:
Express routes alongside socket.io ones
I'm trying to handle regular http requests alongside socket.io.

The app.ts file has some REST Route handles, and error handler for all routes that don't exist.

```<code>app.use("/users", userRouter);
app.use("/products", productRouter);

app.all("*", async (req: Request, res: Response) => {
  throw new NotFoundError("route");
});

</code>```

Suppose I want to add one route (namespace) that will handle the socket.io connections.

With my current implementation I keep getting an error that the route doesn't exist (from the app.all) because express thinks it's a regular http client.

What is the right way to implement regular http requests alongside socket.io ones?

I know that in order to implement namespace I need to use

```<code>const io = new Server(httpServer, { cors: { origin: "*" } });
io.of("/socket").on("connection", () => {
  // Do something
});
</code>```

But localhost::PORT/socket is treated as if it is a regular request

Title: Express routes alongside socket.io ones

Body:
I'm trying to handle regular http requests alongside socket.io.

The app.ts file has some REST Route handles, and error handler for all routes that don't exist.

app.use("/users", userRouter);
app.use("/products", productRouter);

app.all("*", async (req: Request, res: Response) => {
  throw new NotFoundError("route");
});

Suppose I want to add one route (namespace) that will handle the socket.io connections.

With my current implementation I keep getting an error that the route doesn't exist (from the app.all) because express thinks it's a regular http client.

What is the right way to implement regular http requests alongside socket.io ones?

I know that in order to implement namespace I need to use

const io = new Server(httpServer, { cors: { origin: "*" } });
io.of("/socket").on("connection", () => {
  // Do something
});

But localhost::PORT/socket is treated as if it is a regular request


问:
OSError: No wkhtmltopdf executable found: "b'' in heroku
I am trying to download a pdf file using pdfkit on a website deployed on heroku. However, it is showing the error whenever I try to download. I have it running on the local server but it does not run on the heroku server.

I tried using heroku-18 but it didn't work.


问:
How can you use the fetch API to get the HTML source of a page?
I wanted to know how I can use the fetch() function in javascript to return the source of a page from a different origin. I already know that if you want to get the HTML source you do something like this:

```<code>const getData = async () => {
  const res = await fetch('http://example.com')
  const data = await res.text()
  console.log(data)
}
</code>```

When I tried using the above function, I got a cors error. I then tried adding, {mode: 'no-cors'} to the options but, that didn't return any response. I have done some research and found nothing useful. Is it possible to get the source of a website from a cross-origin request? Thanks.

Body:
I wanted to know how I can use the fetch() function in javascript to return the source of a page from a different origin. I already know that if you want to get the HTML source you do something like this:

const getData = async () => {
  const res = await fetch('http://example.com')
  const data = await res.text()
  console.log(data)
}

When I tried using the above function, I got a cors error. I then tried adding, {mode: 'no-cors'} to the options but, that didn't return any response. I have done some research and found nothing useful. Is it possible to get the source of a website from a cross-origin request? Thanks.


问:
Avoid stream staleness even when there are no CDC records in the entire extended retention period
I am trying to find out a way to avoid stream becoming stale.

I have a condition in my task -

```<code>WHEN
  SYSTEM$STREAM_HAS_DATA('schema.stream_name')
</code>```

Although this prevents the task to run unnecessarily, but if there are no CDC records in the entire retention period, my stream is becoming stale.

What would be the best way to prevent staleness of the stream but, at the same time, avoid running the task when there's no data?

I was trying to find a function which return stale_after timestamp and somehow use it in the 'When' clause of the task. We can try to compare, let say, current date and stale_after date and if these matches then we can run the task, regardless of stream having data, which can move offset of the stream forward.

Body:
I am trying to find out a way to avoid stream becoming stale.

I have a condition in my task -

WHEN
  SYSTEM$STREAM_HAS_DATA('schema.stream_name')

Although this prevents the task to run unnecessarily, but if there are no CDC records in the entire retention period, my stream is becoming stale.

What would be the best way to prevent staleness of the stream but, at the same time, avoid running the task when there's no data?

I was trying to find a function which return stale_after timestamp and somehow use it in the 'When' clause of the task. We can try to compare, let say, current date and stale_after date and if these matches then we can run the task, regardless of stream having data, which can move offset of the stream forward.


问:
Null terminating element for ReadFileScatter
The Win32 API ReadFileScatter() takes an array of pointers to page-sized buffers to read a file.

Microsoft's documentation explicitly requires an extra entry in the array for a terminating NULL.

What is this for? There is an nNumberOfBytesToRead parameter to specify the size to be read.

I debug an application and it reads a single page (nNumberOfBytesToRead==0x1000). Array elements points to valid memory, but the array of pointers is not null terminated. Can it cause memory corruption, or something like this?


问:
Command uploadFile not working in Chrome browser
I want to use a command to load a file in my wdio-tests. As the documentation https://webdriver.io/docs/api/browser/uploadFile/ says, this command only works in the Chrome browser. However, when using it, I get an error

```<code>Error: The uploadFile command is not available in Chrome
</code>```

My code:

```<code>utilities.upload_file = (file_name, input_class) ->
  await browser.pause(consts.SHORT_TIMER)
  await browser.executeScript("window.document.getElementsByClassName('" + input_class + "')[0].style.display = 'block'", [])
  file_path = path.join(FILE_PATH, file_name)
  cool_file = await browser.uploadFile(file_path)
  await $('input.' + input_class).then((res) ->
    return res.setValue(cool_file)
  )
</code>```

Please help me

Body:
I want to use a command to load a file in my wdio-tests. As the documentation https://webdriver.io/docs/api/browser/uploadFile/ says, this command only works in the Chrome browser. However, when using it, I get an error

Error: The uploadFile command is not available in Chrome

My code:

utilities.upload_file = (file_name, input_class) ->
  await browser.pause(consts.SHORT_TIMER)
  await browser.executeScript("window.document.getElementsByClassName('" + input_class + "')[0].style.display = 'block'", [])
  file_path = path.join(FILE_PATH, file_name)
  cool_file = await browser.uploadFile(file_path)
  await $('input.' + input_class).then((res) ->
    return res.setValue(cool_file)
  )

Please help me


问:
want to chnage the date format in event-drops d3js
how can i change the month format of date from  January to Jan in d3js event-drops enter image description here

here is the code range paramtere

tried to change the format of date here please help


问:
wordpress polylang bug, edit one post changes other posts too
I'm trying to fix a bug in production, and I'm so desperate.
I'm using WordPress and Polylang plugins and the Redis_object_cache plugin.
the problem is:

When I make new content and translate it when I edit the translated post, the original content is changing too... and when I edit the original post, the translated content will change too.

it's like there are two posts with different IDs and different titles but the same body(content). so if change one the contents, the other will change too.

I have no clue where the problem might be, please if you have had the same issue, or you can guess where the bug might be, share your experience.


问:
Jetpack Compose - how to deal with different screen sizes?
I have started to work with Jetpack Compose, and while there some great features that it provides to us, I still have some doubt on whether this new ui toolkit is more performant and makes more sense than the traditional Android ui toolkit with xmls.

Considering you are building an app and want to support screens of different sizes and pixel densities, with the xml you would create different dimens.xml, for example:

```<code>hdpi/dimens.xml
xxhdpi/dimens.xml
sw720dp/dimens.xml
....
</code>```

Finally, each device would get only the values that apply for its configuration resulting in a smaller bundle to install.

As per Jetpack Compose, the approach to this situation seems to be different. Instead of taking advantage of the Android app bundle feature that would make the final installable file smaller in size, with Compose most the solutions that I have seen tend to differentiate the resources for different screen sizes in @Composable level. Which means the final installable file will hold even the values that the device will not need. The solution is something like this, first you create the class with default values:

class Dimensions

then you extend this to override the resources for different screen sizes or densities

val smallDimensions = Dimensions

val sw360Dimensions = Dimensions

etc.

and to get the values for each size in your @Composable fun you do:

```<code>val configuration = LocalConfiguration.current
val dimensions = if (configuration.screenWidthDp <= 360) smallDimensions else sw360Dimensions
</code>```

Given the cons of this approach, do you think is better to still keep the dimens and other resources in xml file while using compose, and instead of manually figuring out what values the device needs let the Android do it for you?

If we still keep the dimens in xml, we can refer to them as:

```<code>dimensionResource(id = R.dimen.leftMargin)
</code>```

The bundle would be smaller (although not something significant), and yet we are compose friendly.

References:

Jetpack Compose: What is the best way to support all screen sizes?

https://proandroiddev.com/supporting-different-screen-sizes-on-android-with-jetpack-compose-f215c13081bd

https://www.youtube.com/watch?v=NVrFiogpyr8&ab_channel=Stevdza-San

Body:
I have started to work with Jetpack Compose, and while there some great features that it provides to us, I still have some doubt on whether this new ui toolkit is more performant and makes more sense than the traditional Android ui toolkit with xmls.

Considering you are building an app and want to support screens of different sizes and pixel densities, with the xml you would create different dimens.xml, for example:

hdpi/dimens.xml
xxhdpi/dimens.xml
sw720dp/dimens.xml
....

Finally, each device would get only the values that apply for its configuration resulting in a smaller bundle to install.

As per Jetpack Compose, the approach to this situation seems to be different. Instead of taking advantage of the Android app bundle feature that would make the final installable file smaller in size, with Compose most the solutions that I have seen tend to differentiate the resources for different screen sizes in @Composable level. Which means the final installable file will hold even the values that the device will not need. The solution is something like this, first you create the class with default values:

class Dimensions

then you extend this to override the resources for different screen sizes or densities

val smallDimensions = Dimensions

val sw360Dimensions = Dimensions

etc.

and to get the values for each size in your @Composable fun you do:

val configuration = LocalConfiguration.current
val dimensions = if (configuration.screenWidthDp <= 360) smallDimensions else sw360Dimensions

Given the cons of this approach, do you think is better to still keep the dimens and other resources in xml file while using compose, and instead of manually figuring out what values the device needs let the Android do it for you?

If we still keep the dimens in xml, we can refer to them as:

dimensionResource(id = R.dimen.leftMargin)

The bundle would be smaller (although not something significant), and yet we are compose friendly.

References:

Jetpack Compose: What is the best way to support all screen sizes?

https://proandroiddev.com/supporting-different-screen-sizes-on-android-with-jetpack-compose-f215c13081bd

https://www.youtube.com/watch?v=NVrFiogpyr8&ab_channel=Stevdza-San


问:
I have an error when I try to subtract in Kotlin
```<code>val year : Int = spinYear.getSelectedItem() as Int
selDate.text = "$year / $month / $date"
val curTime = LocalDateTime.now()
val curYear : Int = curTime.year
val difYear : Int = curYear - year
ageInMins.text = difYear.toString()
</code>```

The language is Kotlin, and this is a part of my code.

The value year comes from a spinner named spinYear, and I got the selected value as an integer. Ultimately I want to substitute the text ageInMins with the value difYear.

I'm trying to define my difYear by subtracting the two variables: curYear and year, but the app crashes every time.

It seems like both of the variables I'm subtracting are of type Int, so I have no idea what to do with this problem.

If someone could give me an advice it would be great :)

I searched around Google to find information about this, but there was no useful information. I also tried to put .toInt() to the values but it didn't work. I tried every single thing I can think of, but it did not work. So I am seeking help from you guys.

Body:
val year : Int = spinYear.getSelectedItem() as Int
selDate.text = "$year / $month / $date"
val curTime = LocalDateTime.now()
val curYear : Int = curTime.year
val difYear : Int = curYear - year
ageInMins.text = difYear.toString()

The language is Kotlin, and this is a part of my code.

The value year comes from a spinner named spinYear, and I got the selected value as an integer. Ultimately I want to substitute the text ageInMins with the value difYear.

I'm trying to define my difYear by subtracting the two variables: curYear and year, but the app crashes every time.

It seems like both of the variables I'm subtracting are of type Int, so I have no idea what to do with this problem.

If someone could give me an advice it would be great :)

I searched around Google to find information about this, but there was no useful information. I also tried to put .toInt() to the values but it didn't work. I tried every single thing I can think of, but it did not work. So I am seeking help from you guys.


问:
Armeria - Request is waiting for ForkJoinPool.commonPool-worker
Request is not being served and getting timed out.

Observation is request is reaching to worker thread - 16:19:23.051 [armeria-common-worker-nio-2-2] DEBUG c.l.a.server.logging.LoggingService . But it is not reaching to Fork join thread ForkJoinPool.commonPool-worker-0]. This is happening for random requests.

Armeria version is - 1.14.0.


问:
add/modify blocks value in wagtail streamfield with listblock from shell
I have a page with one StreamField body and a custom block named CardBlock:

```<code>class CardBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    description = blocks.CharBlock()
    ...

class CardListBlock(blocks.StructBlock):
    cards = ListBlock(CardBlock())

class CustomPage(Page):
    ...
    body = StreamField([
        ('card_block', CardBlock()),
        ('card_list', CardListBlock())
    ]),
    ...
</code>```

I need to create a CustomPage programatically with card_list populated.

I tried the solution provided by @gasman. While it works for a normal StructBlock, when having nested ListBlock within a StructBlock, the value is not saved.

I tried the following:

```<code>page = CustomPage()
page.body = [
    ('card_block', {'title': 'foo', 'description': 'bar'}),
    ('card_list', {
        'cards': [{'title': 'foo', 'description': 'bar'}]
    })
]
</code>```

results in AttributeError: 'list' object has no attribute 'bound_blocks'

So, I wrapped the list in ListValue from wagtail.blocks.list_block.

```<code>page.body = [
    ('card_block', {'title': 'foo', 'description': 'bar'}),
    ('card_list', {
        'cards': ListValue([{'title': 'foo', 'description': 'bar'}]))
    }
]
</code>```

It would result in no errors, but when looked into db, the card_list would have an empty list.

I tried using StructValue:

```<code>('card_list', {
    'cards': ListValue([
        StructValue([('title', 'foo'), ('description', "bar")])
    ])
})
</code>```

same result.

So, I tried to use the data result by saving the Page from wagtail admin with no avail.

```<code>('card_list', {
    'cards': ListValue([{
         "type": "item",
         "value": {
             "title": "foo",
             "description": "bar"},
         "id": "uuid"
    }])
})
</code>```

Is there something I am missing out on this?

Body:
I have a page with one StreamField body and a custom block named CardBlock:

class CardBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    description = blocks.CharBlock()
    ...

class CardListBlock(blocks.StructBlock):
    cards = ListBlock(CardBlock())

class CustomPage(Page):
    ...
    body = StreamField([
        ('card_block', CardBlock()),
        ('card_list', CardListBlock())
    ]),
    ...

I need to create a CustomPage programatically with card_list populated.

I tried the solution provided by @gasman. While it works for a normal StructBlock, when having nested ListBlock within a StructBlock, the value is not saved.

I tried the following:

page = CustomPage()
page.body = [
    ('card_block', {'title': 'foo', 'description': 'bar'}),
    ('card_list', {
        'cards': [{'title': 'foo', 'description': 'bar'}]
    })
]

results in AttributeError: 'list' object has no attribute 'bound_blocks'

So, I wrapped the list in ListValue from wagtail.blocks.list_block.

page.body = [
    ('card_block', {'title': 'foo', 'description': 'bar'}),
    ('card_list', {
        'cards': ListValue([{'title': 'foo', 'description': 'bar'}]))
    }
]

It would result in no errors, but when looked into db, the card_list would have an empty list.

I tried using StructValue:

('card_list', {
    'cards': ListValue([
        StructValue([('title', 'foo'), ('description', "bar")])
    ])
})

same result.

So, I tried to use the data result by saving the Page from wagtail admin with no avail.

('card_list', {
    'cards': ListValue([{
         "type": "item",
         "value": {
             "title": "foo",
             "description": "bar"},
         "id": "uuid"
    }])
})

Is there something I am missing out on this?


问:
How to pass filepath with spaces to QtGui.QDesktopServices.openUrl()?
As shown in the documentation for QDesktopServices, I tried using QtCore.QUrl.ParsingMode.TolerantMode to have a file path with URL be used as is (i.e. without having the spaces convert to %20s), but that doesn't seem to work. Is there a problem with my implementation?

>>> from PySide6 import QtGui as qtg
>>> from PySide6 import QtCore as qtc
>>> qtg.QGuiApplication()
<PySide6.QtGui.QGuiApplication(0x22434e0) at 0x7fba08dcbd80>
>>> qtg.QDesktopServices.openUrl(qtc.QUrl("url with spaces", qtc.QUrl.ParsingMode.TolerantMode))
True
>>> xdg-open: file 'url%20with%20spaces' does not exist
```


问:
Saving Pyspark model using model.save("path")
I'm working on Dataiku notebook and I'm trying to save pyspark model from my notebook to dataiku managed folder model.save('/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V23') but getting error:

```<code>model = Pipeline(stages=[
    RegexTokenizer(pattern="", inputCol="word", outputCol="char" ,minTokenLength=1),
    NGram(n=3, inputCol="char", outputCol="ngram"),
    HashingTF(inputCol="ngram", outputCol="vector"),
    IDF(inputCol="vector", outputCol="idf"),
    MinHashLSH(inputCol="idf", outputCol="lsh", numHashTables=3)
]).fit(df_2)

df_2_transf = model.transform(df_2)

model.save('/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V23')
</code>```
```<code>Py4JJavaError: An error occurred while calling o834.save.
: org.apache.spark.SparkException: Job aborted.
    at org.apache.spark.internal.io.SparkHadoopWriter$.write(SparkHadoopWriter.scala:106)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopDataset$1(PairRDDFunctions.scala:1091)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopDataset(PairRDDFunctions.scala:1089)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopFile$4(PairRDDFunctions.scala:1062)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopFile(PairRDDFunctions.scala:1027)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopFile$3(PairRDDFunctions.scala:1009)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopFile(PairRDDFunctions.scala:1008)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopFile$2(PairRDDFunctions.scala:965)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopFile(PairRDDFunctions.scala:963)
    at org.apache.spark.rdd.RDD.$anonfun$saveAsTextFile$2(RDD.scala:1599)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.saveAsTextFile(RDD.scala:1599)
    at org.apache.spark.rdd.RDD.$anonfun$saveAsTextFile$1(RDD.scala:1585)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.saveAsTextFile(RDD.scala:1585)
    at org.apache.spark.ml.util.DefaultParamsWriter$.saveMetadata(ReadWrite.scala:413)
    at org.apache.spark.ml.Pipeline$SharedReadWrite$.$anonfun$saveImpl$1(Pipeline.scala:250)
    at org.apache.spark.ml.Pipeline$SharedReadWrite$.$anonfun$saveImpl$1$adapted(Pipeline.scala:247)
    at org.apache.spark.ml.util.Instrumentation$.$anonfun$instrumented$1(Instrumentation.scala:191)
    at scala.util.Try$.apply(Try.scala:213)
    at org.apache.spark.ml.util.Instrumentation$.instrumented(Instrumentation.scala:191)
    at org.apache.spark.ml.Pipeline$SharedReadWrite$.saveImpl(Pipeline.scala:247)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.saveImpl(Pipeline.scala:346)
    at org.apache.spark.ml.util.MLWriter.save(ReadWrite.scala:168)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.super$save(Pipeline.scala:344)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.$anonfun$save$4(Pipeline.scala:344)
    at org.apache.spark.ml.MLEvents.withSaveInstanceEvent(events.scala:174)
    at org.apache.spark.ml.MLEvents.withSaveInstanceEvent$(events.scala:169)
    at org.apache.spark.ml.util.Instrumentation.withSaveInstanceEvent(Instrumentation.scala:42)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.$anonfun$save$3(Pipeline.scala:344)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.$anonfun$save$3$adapted(Pipeline.scala:344)
    at org.apache.spark.ml.util.Instrumentation$.$anonfun$instrumented$1(Instrumentation.scala:191)
    at scala.util.Try$.apply(Try.scala:213)
    at org.apache.spark.ml.util.Instrumentation$.instrumented(Instrumentation.scala:191)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.save(Pipeline.scala:344)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
    at py4j.Gateway.invoke(Gateway.java:282)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182)
    at py4j.ClientServerConnection.run(ClientServerConnection.java:106)
    at java.lang.Thread.run(Thread.java:750)
Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 9.0 failed 4 times, most recent failure: Lost task 0.3 in stage 9.0 (TID 19) (10.252.1.86 executor 2): java.io.IOException: Mkdirs failed to create file:/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V22/metadata/_temporary/0/_temporary/attempt_202212201117187198772930005281723_0027_m_000000_3 (exists=false, cwd=file:/home/dataiku)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:515)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:500)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1195)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1081)
    at org.apache.hadoop.mapred.TextOutputFormat.getRecordWriter(TextOutputFormat.java:113)
    at org.apache.spark.internal.io.HadoopMapRedWriteConfigUtil.initWriter(SparkHadoopWriter.scala:238)
    at org.apache.spark.internal.io.SparkHadoopWriter$.executeTask(SparkHadoopWriter.scala:126)
    at org.apache.spark.internal.io.SparkHadoopWriter$.$anonfun$write$1(SparkHadoopWriter.scala:88)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)

Driver stacktrace:
    at org.apache.spark.scheduler.DAGScheduler.failJobAndIndependentStages(DAGScheduler.scala:2672)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2(DAGScheduler.scala:2608)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2$adapted(DAGScheduler.scala:2607)
    at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
    at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
    at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:2607)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1(DAGScheduler.scala:1182)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1$adapted(DAGScheduler.scala:1182)
    at scala.Option.foreach(Option.scala:407)
    at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:1182)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:2860)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:2802)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:2791)
    at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:49)
    at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:952)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2228)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2249)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2281)
    at org.apache.spark.internal.io.SparkHadoopWriter$.write(SparkHadoopWriter.scala:83)
    ... 68 more
Caused by: java.io.IOException: Mkdirs failed to create file:/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V22/metadata/_temporary/0/_temporary/attempt_202212201117187198772930005281723_0027_m_000000_3 (exists=false, cwd=file:/home/dataiku)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:515)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:500)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1195)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1081)
    at org.apache.hadoop.mapred.TextOutputFormat.getRecordWriter(TextOutputFormat.java:113)
    at org.apache.spark.internal.io.HadoopMapRedWriteConfigUtil.initWriter(SparkHadoopWriter.scala:238)
    at org.apache.spark.internal.io.SparkHadoopWriter$.executeTask(SparkHadoopWriter.scala:126)
    at org.apache.spark.internal.io.SparkHadoopWriter$.$anonfun$write$1(SparkHadoopWriter.scala:88)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    ... 1 more
</code>```

I tried to change the path and also tried to pickle a simple python dataframe just to check if I can write to that path( and it's working: pickle python dataframe) but can't save pyspark model

Body:
I'm working on Dataiku notebook and I'm trying to save pyspark model from my notebook to dataiku managed folder model.save('/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V23') but getting error:

model = Pipeline(stages=[
    RegexTokenizer(pattern="", inputCol="word", outputCol="char" ,minTokenLength=1),
    NGram(n=3, inputCol="char", outputCol="ngram"),
    HashingTF(inputCol="ngram", outputCol="vector"),
    IDF(inputCol="vector", outputCol="idf"),
    MinHashLSH(inputCol="idf", outputCol="lsh", numHashTables=3)
]).fit(df_2)

df_2_transf = model.transform(df_2)

model.save('/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V23')

Py4JJavaError: An error occurred while calling o834.save.
: org.apache.spark.SparkException: Job aborted.
    at org.apache.spark.internal.io.SparkHadoopWriter$.write(SparkHadoopWriter.scala:106)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopDataset$1(PairRDDFunctions.scala:1091)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopDataset(PairRDDFunctions.scala:1089)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopFile$4(PairRDDFunctions.scala:1062)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopFile(PairRDDFunctions.scala:1027)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopFile$3(PairRDDFunctions.scala:1009)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopFile(PairRDDFunctions.scala:1008)
    at org.apache.spark.rdd.PairRDDFunctions.$anonfun$saveAsHadoopFile$2(PairRDDFunctions.scala:965)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.PairRDDFunctions.saveAsHadoopFile(PairRDDFunctions.scala:963)
    at org.apache.spark.rdd.RDD.$anonfun$saveAsTextFile$2(RDD.scala:1599)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.saveAsTextFile(RDD.scala:1599)
    at org.apache.spark.rdd.RDD.$anonfun$saveAsTextFile$1(RDD.scala:1585)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:406)
    at org.apache.spark.rdd.RDD.saveAsTextFile(RDD.scala:1585)
    at org.apache.spark.ml.util.DefaultParamsWriter$.saveMetadata(ReadWrite.scala:413)
    at org.apache.spark.ml.Pipeline$SharedReadWrite$.$anonfun$saveImpl$1(Pipeline.scala:250)
    at org.apache.spark.ml.Pipeline$SharedReadWrite$.$anonfun$saveImpl$1$adapted(Pipeline.scala:247)
    at org.apache.spark.ml.util.Instrumentation$.$anonfun$instrumented$1(Instrumentation.scala:191)
    at scala.util.Try$.apply(Try.scala:213)
    at org.apache.spark.ml.util.Instrumentation$.instrumented(Instrumentation.scala:191)
    at org.apache.spark.ml.Pipeline$SharedReadWrite$.saveImpl(Pipeline.scala:247)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.saveImpl(Pipeline.scala:346)
    at org.apache.spark.ml.util.MLWriter.save(ReadWrite.scala:168)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.super$save(Pipeline.scala:344)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.$anonfun$save$4(Pipeline.scala:344)
    at org.apache.spark.ml.MLEvents.withSaveInstanceEvent(events.scala:174)
    at org.apache.spark.ml.MLEvents.withSaveInstanceEvent$(events.scala:169)
    at org.apache.spark.ml.util.Instrumentation.withSaveInstanceEvent(Instrumentation.scala:42)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.$anonfun$save$3(Pipeline.scala:344)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.$anonfun$save$3$adapted(Pipeline.scala:344)
    at org.apache.spark.ml.util.Instrumentation$.$anonfun$instrumented$1(Instrumentation.scala:191)
    at scala.util.Try$.apply(Try.scala:213)
    at org.apache.spark.ml.util.Instrumentation$.instrumented(Instrumentation.scala:191)
    at org.apache.spark.ml.PipelineModel$PipelineModelWriter.save(Pipeline.scala:344)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
    at py4j.Gateway.invoke(Gateway.java:282)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182)
    at py4j.ClientServerConnection.run(ClientServerConnection.java:106)
    at java.lang.Thread.run(Thread.java:750)
Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 9.0 failed 4 times, most recent failure: Lost task 0.3 in stage 9.0 (TID 19) (10.252.1.86 executor 2): java.io.IOException: Mkdirs failed to create file:/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V22/metadata/_temporary/0/_temporary/attempt_202212201117187198772930005281723_0027_m_000000_3 (exists=false, cwd=file:/home/dataiku)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:515)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:500)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1195)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1081)
    at org.apache.hadoop.mapred.TextOutputFormat.getRecordWriter(TextOutputFormat.java:113)
    at org.apache.spark.internal.io.HadoopMapRedWriteConfigUtil.initWriter(SparkHadoopWriter.scala:238)
    at org.apache.spark.internal.io.SparkHadoopWriter$.executeTask(SparkHadoopWriter.scala:126)
    at org.apache.spark.internal.io.SparkHadoopWriter$.$anonfun$write$1(SparkHadoopWriter.scala:88)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)

Driver stacktrace:
    at org.apache.spark.scheduler.DAGScheduler.failJobAndIndependentStages(DAGScheduler.scala:2672)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2(DAGScheduler.scala:2608)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$abortStage$2$adapted(DAGScheduler.scala:2607)
    at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
    at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
    at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:2607)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1(DAGScheduler.scala:1182)
    at org.apache.spark.scheduler.DAGScheduler.$anonfun$handleTaskSetFailed$1$adapted(DAGScheduler.scala:1182)
    at scala.Option.foreach(Option.scala:407)
    at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:1182)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:2860)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:2802)
    at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:2791)
    at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:49)
    at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:952)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2228)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2249)
    at org.apache.spark.SparkContext.runJob(SparkContext.scala:2281)
    at org.apache.spark.internal.io.SparkHadoopWriter$.write(SparkHadoopWriter.scala:83)
    ... 68 more
Caused by: java.io.IOException: Mkdirs failed to create file:/opt/dataiku/design/managed_folders/PROJECT_TEST/9KeBcUKy/ML_SAVED_V22/metadata/_temporary/0/_temporary/attempt_202212201117187198772930005281723_0027_m_000000_3 (exists=false, cwd=file:/home/dataiku)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:515)
    at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:500)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1195)
    at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1081)
    at org.apache.hadoop.mapred.TextOutputFormat.getRecordWriter(TextOutputFormat.java:113)
    at org.apache.spark.internal.io.HadoopMapRedWriteConfigUtil.initWriter(SparkHadoopWriter.scala:238)
    at org.apache.spark.internal.io.SparkHadoopWriter$.executeTask(SparkHadoopWriter.scala:126)
    at org.apache.spark.internal.io.SparkHadoopWriter$.$anonfun$write$1(SparkHadoopWriter.scala:88)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
    at org.apache.spark.scheduler.Task.run(Task.scala:136)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:548)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1504)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:551)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    ... 1 more

I tried to change the path and also tried to pickle a simple python dataframe just to check if I can write to that path( and it's working: pickle python dataframe) but can't save pyspark model


问:
Google requires an identifier and Public Key in order to encrypt sensitive payment credentials. For Authorize.net
I am unable to find this Key Pair? Where can i get these keys?

i am unable to find these keys.


问:
How to read multiple ultrasonic sensors at the same time with threads in python?
I am trying to read the distance of 2 or more ultrasonic soundsensors at the same time, but i couldn't figure out on how to do it. I'm trying to make them read live data so almost everything is in a while true: function. I never have gotten threads to get to work across multiple project's, so if you could explain to me on what you did and how it works, I would appreciate it. This is what I have so far:

```<code>from operator import le
from threading import Thread
from rpi_lcd import LCD
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)

TRIG = 0
ECHO = 0
LED_RED = 0
LED_GREEN = 0

def PK_1():
    TRIG = 21
    ECHO = 20
    LED_RED = 26
    LED_GREEN = 19

def PK_2():
    TRIG = 23
    ECHO = 24
    LED_RED = 17
    # LED_YELLOW = 27
    LED_GREEN = 22

lcd = LCD()
GPIO.setwarnings(False)
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
GPIO.setup(LED_GREEN,GPIO.OUT)
GPIO.setup(LED_RED,GPIO.OUT)

try:
    lcd.clear()
    lcd.text("Waiting for ",1)
    lcd.text("sensor to Settle",2)
    while True:
        GPIO.output(TRIG, False)

        time.sleep(2)

        GPIO.output(TRIG, True)
        time.sleep(0.00001)
        GPIO.output(TRIG, False)

        while GPIO.input(ECHO) == 0:
            pulse_start = time.time()

        while GPIO.input(ECHO) == 1:
            pulse_end = time.time()

        pulse_duration = pulse_end - pulse_start

        distance = pulse_duration * 17150
        distance = round(distance, 1)

        if distance >= 4:
            lcd.clear()
            lcd.text("Beschikbaar",1)
            GPIO.output(LED_GREEN, GPIO.HIGH)
            GPIO.output(LED_RED, GPIO.LOW)

        else:
            lcd.clear()
            lcd.text("Bezet",1)
            GPIO.output(LED_GREEN, GPIO.LOW)
            GPIO.output(LED_RED, GPIO.HIGH)

        # lcd.clear()
        # lcd.text("Distance:" + str(distance) + "cm",1)
except KeyboardInterrupt:
    print("Cleaning up!")
    GPIO.cleanup
    # GPIO.output(LED_GREEN,GPIO.LOW)
    # GPIO.output(LED_RED, GPIO.LOW)
    lcd.clear()

</code>```

Edit: This project is a parking sensor, So PK_1 is parking sensor 1 with 1 ultrasonic sensor and a green/red light. If the parking spot is empty it has to be green if it's full it has to be red. Now i'm going to have to do this across multiple parking spots, so that's why i'm going to have to do this. I have tried to put the pin number's into a function so I can run them both at the same time but it didn't work

Body:
I am trying to read the distance of 2 or more ultrasonic soundsensors at the same time, but i couldn't figure out on how to do it. I'm trying to make them read live data so almost everything is in a while true: function. I never have gotten threads to get to work across multiple project's, so if you could explain to me on what you did and how it works, I would appreciate it. This is what I have so far:

from operator import le
from threading import Thread
from rpi_lcd import LCD
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)

TRIG = 0
ECHO = 0
LED_RED = 0
LED_GREEN = 0

def PK_1():
    TRIG = 21
    ECHO = 20
    LED_RED = 26
    LED_GREEN = 19

def PK_2():
    TRIG = 23
    ECHO = 24
    LED_RED = 17
    # LED_YELLOW = 27
    LED_GREEN = 22

lcd = LCD()
GPIO.setwarnings(False)
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
GPIO.setup(LED_GREEN,GPIO.OUT)
GPIO.setup(LED_RED,GPIO.OUT)

try:
    lcd.clear()
    lcd.text("Waiting for ",1)
    lcd.text("sensor to Settle",2)
    while True:
        GPIO.output(TRIG, False)

        time.sleep(2)

        GPIO.output(TRIG, True)
        time.sleep(0.00001)
        GPIO.output(TRIG, False)

        while GPIO.input(ECHO) == 0:
            pulse_start = time.time()

        while GPIO.input(ECHO) == 1:
            pulse_end = time.time()

        pulse_duration = pulse_end - pulse_start

        distance = pulse_duration * 17150
        distance = round(distance, 1)

        if distance >= 4:
            lcd.clear()
            lcd.text("Beschikbaar",1)
            GPIO.output(LED_GREEN, GPIO.HIGH)
            GPIO.output(LED_RED, GPIO.LOW)

        else:
            lcd.clear()
            lcd.text("Bezet",1)
            GPIO.output(LED_GREEN, GPIO.LOW)
            GPIO.output(LED_RED, GPIO.HIGH)

        # lcd.clear()
        # lcd.text("Distance:" + str(distance) + "cm",1)
except KeyboardInterrupt:
    print("Cleaning up!")
    GPIO.cleanup
    # GPIO.output(LED_GREEN,GPIO.LOW)
    # GPIO.output(LED_RED, GPIO.LOW)
    lcd.clear()

Edit: This project is a parking sensor, So PK_1 is parking sensor 1 with 1 ultrasonic sensor and a green/red light. If the parking spot is empty it has to be green if it's full it has to be red. Now i'm going to have to do this across multiple parking spots, so that's why i'm going to have to do this. I have tried to put the pin number's into a function so I can run them both at the same time but it didn't work


问:
Problem running python cProfile in VSCode debug console
I'm trying to setup a good VSCode python environment for debugging including profiling using cProfile in a REPL manner, and I really like the debug widow.

In the VSCode debugger I am able to run/debug the following script:

```<code>import cProfile

cProfile.run("10 + 10")
print("Break here")
</code>```

I am using the Microsoft "Python" extension for debugging and setting the output to "internalConsole" in my "launch.json" and the cProfile output correctly shows up in the debug console window.

However, after hitting a breakpoint set at print("Break here") and manually entering the command cProfile.run("10 + 10") into the debug console window, I get the following error:

```<code>Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.8/cProfile.py", line 16, in run
    return _pyprofile._Utils(Profile).run(statement, filename, sort)
  File "/usr/lib/python3.8/profile.py", line 57, in run
    self._show(prof, filename, sort)
  File "/usr/lib/python3.8/profile.py", line 72, in _show
    prof.print_stats(sort)
  File "/usr/lib/python3.8/cProfile.py", line 42, in print_stats
    pstats.Stats(self).strip_dirs().sort_stats(sort).print_stats()
  File "/usr/lib/python3.8/pstats.py", line 96, in __init__
    self.init(arg)
  File "/usr/lib/python3.8/pstats.py", line 110, in init
    self.load_stats(arg)
  File "/usr/lib/python3.8/pstats.py", line 136, in load_stats
    raise TypeError("Cannot create or construct a %r object from %r"
TypeError: Cannot create or construct a <class 'pstats.Stats'> object from <cProfile.Profile object at 0x7efee11c30a0>
</code>```

I am also able to run  cProfile.run("10 + 10") in a command line python session as well as in the VSCode  terminal ("integratedTerminal").

Any ideas on how to fix this and why the behavior is different for the debug console window?

I tried searching information regarding the mechanisms of the debug window in comparison with terminal window but have not found anything of substance yet.

Body:
I'm trying to setup a good VSCode python environment for debugging including profiling using cProfile in a REPL manner, and I really like the debug widow.

In the VSCode debugger I am able to run/debug the following script:

import cProfile

cProfile.run("10 + 10")
print("Break here")

I am using the Microsoft "Python" extension for debugging and setting the output to "internalConsole" in my "launch.json" and the cProfile output correctly shows up in the debug console window.

However, after hitting a breakpoint set at print("Break here") and manually entering the command cProfile.run("10 + 10") into the debug console window, I get the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.8/cProfile.py", line 16, in run
    return _pyprofile._Utils(Profile).run(statement, filename, sort)
  File "/usr/lib/python3.8/profile.py", line 57, in run
    self._show(prof, filename, sort)
  File "/usr/lib/python3.8/profile.py", line 72, in _show
    prof.print_stats(sort)
  File "/usr/lib/python3.8/cProfile.py", line 42, in print_stats
    pstats.Stats(self).strip_dirs().sort_stats(sort).print_stats()
  File "/usr/lib/python3.8/pstats.py", line 96, in __init__
    self.init(arg)
  File "/usr/lib/python3.8/pstats.py", line 110, in init
    self.load_stats(arg)
  File "/usr/lib/python3.8/pstats.py", line 136, in load_stats
    raise TypeError("Cannot create or construct a %r object from %r"
TypeError: Cannot create or construct a <class 'pstats.Stats'> object from <cProfile.Profile object at 0x7efee11c30a0>

I am also able to run  cProfile.run("10 + 10") in a command line python session as well as in the VSCode  terminal ("integratedTerminal").

Any ideas on how to fix this and why the behavior is different for the debug console window?

I tried searching information regarding the mechanisms of the debug window in comparison with terminal window but have not found anything of substance yet.


问:
PrimeVue dropdown selected value set localstorage
```<code>const items =[];

const dropdownItems = ref(items);
const dropdownItem = ref(null);

onMounted(() => {

  ApiService.getStores().then((data) => {
    data.forEach((value) => {
      items.push({ name: value.shop,value:value.id });
    });
  });
});
</code>```
```<code>
<Dropdown id="state" v-model="dropdownItem" :options="dropdownItems" :filter="true"
            optionLabel="name" optionValue="value"></Dropdown>
            <p>{{ dropdownItem }}</p>
</code>```

i am new in vue js
PrimeVue using here

{{ dropdownItem }}
 this working fine get value of selected drop down data.
but

1) how to set selected valued in localstroge
2)how to first data set default selected

Body:
const items =[];

const dropdownItems = ref(items);
const dropdownItem = ref(null);

onMounted(() => {

  ApiService.getStores().then((data) => {
    data.forEach((value) => {
      items.push({ name: value.shop,value:value.id });
    });
  });
});

<Dropdown id="state" v-model="dropdownItem" :options="dropdownItems" :filter="true"
            optionLabel="name" optionValue="value"></Dropdown>

{{ dropdownItem }}

i am new in vue js
PrimeVue using here

{{ dropdownItem }}
 this working fine get value of selected drop down data.
but

1) how to set selected valued in localstroge
2)how to first data set default selected


问:
How to display the data of a user accessing the web?
When a user accesses the web through the login, the data should appear in a table, instead, the data of all registered users appear.
How can I make it so that it only shows the data of the user who has logged in?

Connection to the database:

```<code><?php

include('../php/.env.php');

class DB {

    public static function conn()
    {
        // conexión a la base de datos
        try {
            $conn = new PDO("mysql:host=" . SERVIDOR . ";dbname=" . BD, USUARIO, PASSWORD);
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $conn;
        } catch (PDOException $e) {
            echo 'HA FALLADO LA CONEXIÓN: ' . $e->getMessage();
        }
    }
}
</code>```

datos.php

```<code><?php

include('./DB.php');

    session_start(); // I've added this and it's working

    $conexion = DB::conn();
    $sentencia = "SELECT * FROM users_data WHERE idUser = :idUser";
    $consulta = $conexion->prepare($sentencia);;
    $consulta->execute(array(':idUser' => $_SESSION['usuario'][0]));

    $json = [];
    while ($row = $consulta->fetch(PDO::FETCH_ASSOC)) {
        $json[] = [
            'idUser' => $row['idUser'],
            'nombre' => $row['nombre'],
            'apellidos' => $row['apellidos'],
            'telefono' => $row['telefono'],
            'direccion' => $row['direccion']
        ];
    }

    $jsonstring = json_encode($json);
    echo $jsonstring;
</code>```

MYSQL
users_data contains: idUser, first name, last name, phone number, address

JAVASCRIPT

```<code>$.ajax({
    type: "GET",
    url: "datos.php", // solicita a datos.php
    success: (response) => {
      let datos = JSON.parse(response);
      let template = "";

      datos.forEach((dato) => {
        // recorre y muestra los datos de los usuarios
        template += `
          <tr>
            <td>${dato.idUser}</td>
            <td>${dato.nombre}</td>
            <td>${dato.apellidos}</td>
            <td>${dato.telefono}</td>
            <td>${dato.direccion}</td>
          </tr>
        `;
      });
      $('#datos').html(template);
    },
  });
</code>```

Body:
When a user accesses the web through the login, the data should appear in a table, instead, the data of all registered users appear.
How can I make it so that it only shows the data of the user who has logged in?

Connection to the database:

<?php

include('../php/.env.php');

class DB {

    public static function conn()
    {
        // conexión a la base de datos
        try {
            $conn = new PDO("mysql:host=" . SERVIDOR . ";dbname=" . BD, USUARIO, PASSWORD);
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $conn;
        } catch (PDOException $e) {
            echo 'HA FALLADO LA CONEXIÓN: ' . $e->getMessage();
        }
    }
}

datos.php

<?php

include('./DB.php');

    session_start(); // I've added this and it's working

    $conexion = DB::conn();
    $sentencia = "SELECT * FROM users_data WHERE idUser = :idUser";
    $consulta = $conexion->prepare($sentencia);;
    $consulta->execute(array(':idUser' => $_SESSION['usuario'][0]));

    $json = [];
    while ($row = $consulta->fetch(PDO::FETCH_ASSOC)) {
        $json[] = [
            'idUser' => $row['idUser'],
            'nombre' => $row['nombre'],
            'apellidos' => $row['apellidos'],
            'telefono' => $row['telefono'],
            'direccion' => $row['direccion']
        ];
    }

    $jsonstring = json_encode($json);
    echo $jsonstring;

MYSQL
users_data contains: idUser, first name, last name, phone number, address

JAVASCRIPT

$.ajax({
    type: "GET",
    url: "datos.php", // solicita a datos.php
    success: (response) => {
      let datos = JSON.parse(response);
      let template = "";

      datos.forEach((dato) => {
        // recorre y muestra los datos de los usuarios
        template += `

            ${dato.idUser}
            ${dato.nombre}
            ${dato.apellidos}
            ${dato.telefono}
            ${dato.direccion}

        `;
      });
      $('#datos').html(template);
    },
  });


问:
Task.Factory doesn't release memory?
I use a Timer this way:

```<code>t = new Timer();
t.Interval = 10000;
t.Elapsed += ElapsedEvent;
</code>```

and that's the ElapsedEvent method:

```<code>private void ElapsedEvent(object sender, ElapsedEventArgs e)
{
    t.Stop();

    try
    {
        var sessions = GetActiveSessions();

        foreach (var session in sessions)
        {
            Task.Factory.StartNew(() => MyProcessTask(session));
        }
    }
    catch (Exception ex)
    {

    }

    t.Start();
}
</code>```

i.e. it will be executed every 10000ms.

But the memory in RAM is increasing, ever, and I need to restart the Windows Service (where this code is executed).

Is the way I use Task.Factory incorrect? Does the memory allocated by thread never be released by Garbage collector this way?

Title: Task.Factory doesn't release memory?

Body:
I use a Timer this way:

t = new Timer();
t.Interval = 10000;
t.Elapsed += ElapsedEvent;

and that's the ElapsedEvent method:

private void ElapsedEvent(object sender, ElapsedEventArgs e)
{
    t.Stop();

    try
    {
        var sessions = GetActiveSessions();

        foreach (var session in sessions)
        {
            Task.Factory.StartNew(() => MyProcessTask(session));
        }
    }
    catch (Exception ex)
    {

    }

    t.Start();
}

i.e. it will be executed every 10000ms.

But the memory in RAM is increasing, ever, and I need to restart the Windows Service (where this code is executed).

Is the way I use Task.Factory incorrect? Does the memory allocated by thread never be released by Garbage collector this way?


问:
lubuntu 22 and intel cause java to crash
when i upgrade my machines to lubuntu 22, my .jar file is getting crashed with java jre1.8.0_151.
What can be cause? I resize file because i cant put it whole in this thread. Please help :)

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007efe8410e4d8, pid=3620, tid=0x00007efe840ff6c0
T H R E A D  ---------------

Current thread (0x00007efe98caf800):  JavaThread "New I/O worker #1" daemon [_thread_in_native, id=3664, stack(0x00007efe84000000,0x00007efe84100000)]

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x00000000000000bb

egister to memory mapping:

RAX=0x00007efe8410e4a0: <offset 0xe4a0> in /tmp/jna-company/jna8917476020149799875.tmp at 0x00007efe84100000
RBX=0x00007efe840fcf20 is pointing into the stack for thread: 0x00007efe98caf800
RCX=0x000000000000003b is an unknown value
RDX=0x00007efe840fcd70 is pointing into the stack for thread: 0x00007efe98caf800
RSP=0x00007efe840fccd0 is pointing into the stack for thread: 0x00007efe98caf800
RBP=0x00007efe840fcd60 is pointing into the stack for thread: 0x00007efe98caf800
RSI=0x00007efe840fcef0 is pointing into the stack for thread: 0x00007efe98caf800
RDI=0x00007efe98ba4a48 is an unknown value
R8 =0x00007efe840fce40 is pointing into the stack for thread: 0x00007efe98caf800
R9 =0x0000000000000002 is an unknown value
R10=0x0000000000000000 is an unknown value
R11=0x000000000000001e is an unknown value
R12=0x000000000000003b is an unknown value
R13=0x0000000000000000 is an unknown value
R14=0x00007efe98baece0 is an unknown value
R15=0x00007efe840fcd28 is pointing into the stack for thread: 0x00007efe98caf800

Stack: [0x00007efe84000000,0x00007efe84100000],  sp=0x00007efe840fccd0,  free space=1011k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [jna8917476020149799875.tmp+0xe4d8]
C  [libffi.so.8+0x77ec]
C  [libffi.so.8+0x8050]


问:
Good or Bad Practice: using static map variable in Spring Boot Kafka Listener
Is it a good practice to use static maps in variables in a Spring Boot Kafka Listener?

here is an example of such code:

```<code>private static Map<String, SomeModel> someMap = new HashMap<>();

...
@KafkaListener(topics = "${kafka.topics}", groupId = "${kafka.group_id}")
public void consume(String message) {
    ...
    if (someMap.get(entity.getNumber()) == null) {
        someMap.put(entity.getNumber(), new SomeModel());
    }
    ...
    SomeModelmodel = someMap.get(dmr.getNumber());
    someMethod();
}

private void someMethod() {
    // Access some Map
    SomeModelmodel model = someMap.get(dmr.getNumber());
    // Do something with model
    model.setTemp(-2);
}

</code>```

Should the static variable not be at least volatile to avoid memory visibility problems like the ones described here?

Or is the usage of mutable static variable simply something that is just an anti-pattern to avoid in these types of listeners, even if the listener is single threaded?

Body:
Is it a good practice to use static maps in variables in a Spring Boot Kafka Listener?

here is an example of such code:

private static Map<String, SomeModel> someMap = new HashMap<>();

...
@KafkaListener(topics = "${kafka.topics}", groupId = "${kafka.group_id}")
public void consume(String message) {
    ...
    if (someMap.get(entity.getNumber()) == null) {
        someMap.put(entity.getNumber(), new SomeModel());
    }
    ...
    SomeModelmodel = someMap.get(dmr.getNumber());
    someMethod();
}

private void someMethod() {
    // Access some Map
    SomeModelmodel model = someMap.get(dmr.getNumber());
    // Do something with model
    model.setTemp(-2);
}

Should the static variable not be at least volatile to avoid memory visibility problems like the ones described here?

Or is the usage of mutable static variable simply something that is just an anti-pattern to avoid in these types of listeners, even if the listener is single threaded?


问:
Pagination Laravel using ajax
** I need to show pagination when show data
this is my controller**
I try to show pagination with laravel but it is not work
How I can solve this proplem ??I try to show pagination with laravel but it is not work
How I can solve this proplem ??

```<code>public function showJobApplicant(Request $request)
{
    $job = Job::findOrFail($request->id);
    $applicants = DB::table('applicant')
        ->select('*')
        ->join('job_app', 'applicant.id', '=', 'job_app.applicant_oid')
        ->where('job_app.job_oid', $request->id)->paginate(2);

    return response()->json([
        'applicants' => $applicants,
    ]);
}
</code>```

and this is javascript part

```<code><script>
    $('#search3').on('keyup', function(){
        $('#form3').submit(false);
        search3();
    });
    search3();
    function search3(){

        var keyword3 = $('#search3').val();
        $.post('{{ route("showJobApplicant") }}',
            {
                _token: $('meta[name="csrf-token"]').attr('content'),
                keyword3:keyword3,
                id: {{$job->id}}
            },
            function(data){
                table_post_row3(data);
            });
    }
    // table row with ajax
    function table_post_row3(res){
        let htmlView = '';
        if(res.applicants.length <= 0){
            htmlView+= `
  <tr>
  <td colspan="9" class="text-center">لا يوجد بيانات لعرضها</td>
  </tr>`;
        }
        var color  = 'primary';
        var status = 'تحت الدراسة';
                <?php $check = false;
                echo $check;
                ?>
        for(let i = 0; i < res.applicants.length; i++){
             var sex = 'أنثى';
            if(res.applicants[i].sex == 101)
                sex = 'ذكر';
            var url = 'showApplicantInfo/'+ res.applicants[i].id_num;
            htmlView += `
  <tr>
     <td>`+ (i+1) +`</td>
     <td>`+res.applicants[i].f_name+' '+res.applicants[i].m_name+ ' '+ res.applicants[i].s_name+' '+res.applicants[i].l_name+`</td>
     <td>`+res.applicants[i].id_num+`</td>
     <td>`+res.applicants[i].bdate.split(" ")[0]+`</td>
     <td>`+sex+`</td>
     <td>`+res.applicants[i].mobile_num+`</td>
  </tr>`;
        }
        $('#applicants').html(htmlView);
    }
</script>
</code>```

and view like this

```<code><div class="col-12 table-responsive" id="kt_apps_projects_2">
    <div class="col-md-6">
        <form id="form3" method="POST">
            <div class="input-group mb-3">
                <input type="text" class="form-control" placeholder="البحث برقم الهوية" id="search3">
                <div class="input-group-prepend">
  <span class="input-group-text" >
  <i class="flaticon-search-1"></i>
  </span>
                </div>
            </div>
        </form>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th scope="col" class="text-success">#</th>
                <th scope="col" class="text-success">الاسم الرباعي</th>
                <th scope="col" class="text-success">رقم الهوية</th>
                <th scope="col" class="text-success">تاريخ الميلاد</th>
                <th scope="col" class="text-success">الجنس</th>
                <th scope="col" class="text-success">رقم الجوال</th>
                <th scope="col" class="text-success">الحالة</th>
                <th scope="col" class="text-success">عرض التفاصيل</th>
            </tr>
            </thead>
            <tbody id="applicants">
            </tbody>
        </table>
    </div>
</div>
</code>```

how can I show pagination, please??

answer me on this problem

Title: Pagination Laravel using ajax

Body:
** I need to show pagination when show data
this is my controller**
I try to show pagination with laravel but it is not work
How I can solve this proplem ??I try to show pagination with laravel but it is not work
How I can solve this proplem ??

public function showJobApplicant(Request $request)
{
    $job = Job::findOrFail($request->id);
    $applicants = DB::table('applicant')
        ->select('*')
        ->join('job_app', 'applicant.id', '=', 'job_app.applicant_oid')
        ->where('job_app.job_oid', $request->id)->paginate(2);

    return response()->json([
        'applicants' => $applicants,
    ]);
}

and this is javascript part

and view like this

        <form id="form3" method="POST">

                <input type="text" class="form-control" placeholder="البحث برقم الهوية" id="search3">

        </form>

                #
                الاسم الرباعي
                رقم الهوية
                تاريخ الميلاد
                الجنس
                رقم الجوال
                الحالة
                عرض التفاصيل

how can I show pagination, please??

answer me on this problem


问:
Moodle oauth2 auth with google - fields mapping
I need to setup an oauth2 authentication system for Moodle. I already configured all the stuff on the Moodle side and the auth works good. I can create a new user without any problem.
But my nightmare is mapping fields on Moodle side, for instance I need to map externalIds field of google to the id field of Moodle but I spent many hours trying this that seems impossibile.

I already tried to configure manual field mapping on Moodle settings (externalIds -> idnumber or  id -> idnumbers) but not working
I'm using this scopes list: openid profile email

After a lot of try with google oauth2 playground I'm asking your help.

Thansk

I already tried to configure manual field mapping on Moodle settings (externalIds -> idnumber or  id -> idnumbers) but not working

I expecting to register a new user account with all the fields that google already sent me plus externalIds


问:
How to install openssl 1.1.1 in ubuntu for ARM cross compilation
I have build script for ARM cross compilation and is running on x86 machine. This script has commands as below.

sudo debootstrap --arch=amd64 --variant=buildd focal /srv/armRoot"

echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" >  /etc/apt/sources.list

echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports focal main universe" >>  /etc/apt/sources.list

echo "deb-src http://archive.ubuntu.com/ubuntu focal main universe" >>  /etc/apt/sources.list

sudo apt-get install -y openssl:armhf

sudo apt-get install -y  libssl-dev:armhf

But these commands are installing openssl 3.0.2-0ubuntu1. But my requirement is openssl 1.1.1 version

What changes are needed in above commands to install 1.1.1 instead of 3.0.2 version of openssl?

Ubuntu version is 20.04(Focal)


问:
ValueError: Shapes (None, None) and (None, 8, 2, 19) are incompatible
I have changed input size many times but i cant find the issue in my mobilenet v1 224.

```<code># MobileNet block
def mobilnet_block (x, filters, strides):

    x = DepthwiseConv2D(kernel_size = 3, strides = strides, padding = 'same')(x)
    x = BatchNormalization()(x)
    x = ReLU()(x)

    x = Conv2D(filters = filters, kernel_size = 1, strides = 1)(x)
    x = BatchNormalization()(x)
    x = ReLU()(x)

    return x
#stem of the model
input = Input(shape = (256,256,3))
x = Conv2D(filters = 32, kernel_size = 3, strides = 2, padding = 'same')(input)
x = BatchNormalization()(x)
x = ReLU()(x)
# main part of the model
x = mobilnet_block(x, filters = 64, strides = 1)
x = mobilnet_block(x, filters = 128, strides = 2)
x = mobilnet_block(x, filters = 128, strides = 1)
x = mobilnet_block(x, filters = 256, strides = 2)
x = mobilnet_block(x, filters = 256, strides = 1)
x = mobilnet_block(x, filters = 512, strides = 2)
for _ in range (5):
     x = mobilnet_block(x, filters = 512, strides = 1)
x = mobilnet_block(x, filters = 1024, strides = 2)
x = mobilnet_block(x, filters = 1024, strides = 1)
x = AvgPool2D (pool_size = 7, strides = 1, data_format='channels_first')(x)
output = Dense (units = 19, activation = 'softmax')(x)
model = Model(inputs=input, outputs=output)
model.summary()
</code>```

i tried to change my input size many times but still cant find the compatibility.

Body:
I have changed input size many times but i cant find the issue in my mobilenet v1 224.

# MobileNet block
def mobilnet_block (x, filters, strides):

    x = DepthwiseConv2D(kernel_size = 3, strides = strides, padding = 'same')(x)
    x = BatchNormalization()(x)
    x = ReLU()(x)

    x = Conv2D(filters = filters, kernel_size = 1, strides = 1)(x)
    x = BatchNormalization()(x)
    x = ReLU()(x)

    return x
#stem of the model
input = Input(shape = (256,256,3))
x = Conv2D(filters = 32, kernel_size = 3, strides = 2, padding = 'same')(input)
x = BatchNormalization()(x)
x = ReLU()(x)
# main part of the model
x = mobilnet_block(x, filters = 64, strides = 1)
x = mobilnet_block(x, filters = 128, strides = 2)
x = mobilnet_block(x, filters = 128, strides = 1)
x = mobilnet_block(x, filters = 256, strides = 2)
x = mobilnet_block(x, filters = 256, strides = 1)
x = mobilnet_block(x, filters = 512, strides = 2)
for _ in range (5):
     x = mobilnet_block(x, filters = 512, strides = 1)
x = mobilnet_block(x, filters = 1024, strides = 2)
x = mobilnet_block(x, filters = 1024, strides = 1)
x = AvgPool2D (pool_size = 7, strides = 1, data_format='channels_first')(x)
output = Dense (units = 19, activation = 'softmax')(x)
model = Model(inputs=input, outputs=output)
model.summary()

i tried to change my input size many times but still cant find the compatibility.


问:
React-router 6 and .Net spa: exclude /api endpoints
i have a .Net spa with react-router. I did need react-router as i have some redirects (ie: after msal authentication, or some authorized routes ) to manage. Problem is, now i'm unable to serve both BE and FE on the same port, as every call to [URL:PORT]/api/myendpoint are now intercepted by react-router.

Is there a way to exclude certain paths from react-router management? For some constrains, i do need a single container to manage the app.

Thank you.


问:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html"
I need help for this error, I saw that I'm the only one having this error but I can solved it. Here is my code :
I try to see the status of servers with NODE-PING, and this error appears.

Any idea?

```<code>import ping from '../../../ping';
var hosts = ['192.168.1.1', 'google.com', 'yahoo.com'];
console.log(hosts);
hosts.forEach(function(host){
    ping.sys.probe(host, function(isAlive){
        var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';
        console.log(msg);
     });
 });
</code>```

Body:
I need help for this error, I saw that I'm the only one having this error but I can solved it. Here is my code :
I try to see the status of servers with NODE-PING, and this error appears.

Any idea?

import ping from '../../../ping';
var hosts = ['192.168.1.1', 'google.com', 'yahoo.com'];
console.log(hosts);
hosts.forEach(function(host){
    ping.sys.probe(host, function(isAlive){
        var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';
        console.log(msg);
     });
 });


问:
Environment variables when hosing Vue 3 VITE in Azure App Service
I have a Vue 3 app (version 3.2.41) using VITE (version 3.2.2) running on Node (version 16.14) where I'm accessing several environment variables in my .env file.

All my environment variables are prefixed "VITE_" as instructed in the docs:

```<code>VITE_TEST=Hello
VITE_OTHER=Goodbye
</code>```

And they are access from "import.meta.env":

```<code>const test = import.meta.env.VITE_TEST;
const other = import.meta.env.VITE_OTHER;
</code>```

I'm hosting by Vue 3 app in Microsoft Azure App Service (Linux). But after relasing the app, the environment values are all blank. They all work fine when running on localhost.

I don't have my ".env" file in Git, it's ignored. So what I have tried is to add these environment variables to the Configuration -> Application Settings, like I would normally do on a .NET 6 web application. But they don't seem to apply at all.

I have tested to prefix my environment variables with "VUE_APP_" like when Vue was not supported by Vite. But those are not accessible.

```<code>const test = import.meta.env.VUE_APP_TEST;
</code>```

I have also tried to access them like before with "process.env.", but that gives a JavaScript error saying that "process" is undefined.

```<code>const test = process.env.VITE_TEST;
</code>```

I don't know if there are stuff to change or add in the "vite.config.js" file or in "src/App.vue". So I'm basically stuck and hoping that someone have seen this before that could guide me in the right direction.

I have also tried hosing in a Windows App Service, but that only produce a "404 - Not Found" when trying to access the site after deployment. And Microsoft recommends using a Linux service for Node projects, so that's what I did.

Note: I am not using a Azure Static Web App here, I'm using an App Service.

Body:
I have a Vue 3 app (version 3.2.41) using VITE (version 3.2.2) running on Node (version 16.14) where I'm accessing several environment variables in my .env file.

All my environment variables are prefixed "VITE_" as instructed in the docs:

VITE_TEST=Hello
VITE_OTHER=Goodbye

And they are access from "import.meta.env":

const test = import.meta.env.VITE_TEST;
const other = import.meta.env.VITE_OTHER;

I'm hosting by Vue 3 app in Microsoft Azure App Service (Linux). But after relasing the app, the environment values are all blank. They all work fine when running on localhost.

I don't have my ".env" file in Git, it's ignored. So what I have tried is to add these environment variables to the Configuration -> Application Settings, like I would normally do on a .NET 6 web application. But they don't seem to apply at all.

I have tested to prefix my environment variables with "VUE_APP_" like when Vue was not supported by Vite. But those are not accessible.

const test = import.meta.env.VUE_APP_TEST;

I have also tried to access them like before with "process.env.", but that gives a JavaScript error saying that "process" is undefined.

const test = process.env.VITE_TEST;

I don't know if there are stuff to change or add in the "vite.config.js" file or in "src/App.vue". So I'm basically stuck and hoping that someone have seen this before that could guide me in the right direction.

I have also tried hosing in a Windows App Service, but that only produce a "404 - Not Found" when trying to access the site after deployment. And Microsoft recommends using a Linux service for Node projects, so that's what I did.

Note: I am not using a Azure Static Web App here, I'm using an App Service.