问:
PHP program responses are not sent to SSE
I've started using Server Sent Events technology but I'm having some problems. Before starting my project, I was wondering how to set up a simple SSE connection between the Server and the Client. Here is my code:
JS :

```<code>const eventSource = new EventSource("http://localhost/sse_test.php");
eventSource.onmessage = function( event ) {
    console.log( event.data ) ;
};
</code>```

PHP :

```<code>header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
while ( true ) {
    echo 'data:';
    $messages = time();
    $messages = json_encode( $messages );
    echo $messages;
    echo $a;
    echo "\n\n";
    $a++;
    flush();
    sleep(5);
}
</code>```

My goal in this code is to send every 5s the timestamp, so I start by echo "data:" then the content, and to finish by echo "\n\n" to mean sending my message to the client. But, in the developer console, I was getting something different. Instead of receiving the timestamp every 5s, I was receiving 5 to 10 timestamps with each 5s difference as requested. What is strange is that I receive the right result, but in a packet of several messages. The messages to the Client are not sent one by one. So I tried to see if I could make it work by sending the data one by one, but most of the time the program sends the data at the end of the maximum time that a PHP page can load, which is 120s in my php.ini.

Here we can see that my php file sent data only after 120s when it is supposed to send data every 5s.

And here are the data that I received after the 120s when I would have received them one by one.

I have the impression that the echo "\n\n" is useless because it doesn't do the job of indicating the end of the data and therefore sending it to the client.
Is there a solution? Or am I cursed to keep using HTTP

Body:
I've started using Server Sent Events technology but I'm having some problems. Before starting my project, I was wondering how to set up a simple SSE connection between the Server and the Client. Here is my code:
JS :

const eventSource = new EventSource("http://localhost/sse_test.php");
eventSource.onmessage = function( event ) {
    console.log( event.data ) ;
};

PHP :

header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
while ( true ) {
    echo 'data:';
    $messages = time();
    $messages = json_encode( $messages );
    echo $messages;
    echo $a;
    echo "\n\n";
    $a++;
    flush();
    sleep(5);
}

My goal in this code is to send every 5s the timestamp, so I start by echo "data:" then the content, and to finish by echo "\n\n" to mean sending my message to the client. But, in the developer console, I was getting something different. Instead of receiving the timestamp every 5s, I was receiving 5 to 10 timestamps with each 5s difference as requested. What is strange is that I receive the right result, but in a packet of several messages. The messages to the Client are not sent one by one. So I tried to see if I could make it work by sending the data one by one, but most of the time the program sends the data at the end of the maximum time that a PHP page can load, which is 120s in my php.ini.

Here we can see that my php file sent data only after 120s when it is supposed to send data every 5s.

And here are the data that I received after the 120s when I would have received them one by one.

I have the impression that the echo "\n\n" is useless because it doesn't do the job of indicating the end of the data and therefore sending it to the client.
Is there a solution? Or am I cursed to keep using HTTP


来源: stackexchange

问:
Show tick after order, if value exist in custom field in that order, woocommerce
I have created a custom field inside the order sidebar, which is working perfectly. Now I want if the custom field is not empty in some order. Then tickmark should be displayed on the woocommerce admin order page. If the custom field is empty, then no tick should be displayed. Please also a look at my code used to create custom field inside the order and provide your valuable feedback. Thanks in advance.

add_action( 'add_meta_boxes', 'permission_box' );
function permission_box() {
add_meta_box( 'permission-invoice','Invoice','box_invoice','shop_order','side','core')}
function box_invoice( $post ){
$value4 = get_post_meta( $post->ID, '_invoice_value', true );
$text4 = ! empty( $value4 ) ? esc_attr( $value4 ) : '';
echo '<input type="text" name="invoice_value" id="permission_box" value="' . $text4 . '" />';
echo '<input type="hidden" name="invoice_value_nonce" value="' . wp_create_nonce() . '">';}```

ContentLicense: CC BY-SA 4.0


问:
Twilio setting CallerId for outbound transferred calls
I want to set up a system where if a transferred call is not answered, it is moved back into a queue so that someone else can grab it.  I have the basics of catching the Dial status and then redirecting no-answer calls back to the queue.

My struggle is with the callerId.  For inbound calls, everything works great and the correct inbound callerId shows at every step in the process.

For outbound calls using the Twilio Client, I can only get half way.

Assume:
Business phone number = 555-555-5555

Customer phone number = 222-222-2222

Agent A dials outbound

Sid1: incoming clientAnonymous

Sid2: from: 555-555-5555 to: 222-222-2222

Agent A then transfers to Agent B

```<code><Response>
<Dial callerId="+12222222222" action="/catchNoAnswer"><Client>AgentB</Client>
</Dial>
</Response>
</code>```

Agent B correctly sees the callerId as the customer.

Sid3: from: +12222222222 to:AgentB

If AgentB doesn't answer, I want to put the call back into a queue, but no matter what I try, the queue always shows the "from" number as the business phone number rather than the customer phone number.  With multiple agents, this results in several calls in the queue all showing the business phone number rather than the customer phone numbers that the calls really represent.

I don't want to use a conference to do a warm transfer.

Is there any way to set the callerId to the to number before enqueuing a call?

I have tried dialing a conference with the callerId set, similar to how I dialed the client, and then moving that leg of the call back to the queue, but the callerId didn't stick.

Body:
I want to set up a system where if a transferred call is not answered, it is moved back into a queue so that someone else can grab it.  I have the basics of catching the Dial status and then redirecting no-answer calls back to the queue.

My struggle is with the callerId.  For inbound calls, everything works great and the correct inbound callerId shows at every step in the process.

For outbound calls using the Twilio Client, I can only get half way.

Assume:
Business phone number = 555-555-5555

Customer phone number = 222-222-2222

Agent A dials outbound

Sid1: incoming clientAnonymous

Sid2: from: 555-555-5555 to: 222-222-2222

Agent A then transfers to Agent B

<Response>
<Dial callerId="+12222222222" action="/catchNoAnswer"><Client>AgentB</Client>
</Dial>
</Response>

Agent B correctly sees the callerId as the customer.

Sid3: from: +12222222222 to:AgentB

If AgentB doesn't answer, I want to put the call back into a queue, but no matter what I try, the queue always shows the "from" number as the business phone number rather than the customer phone number.  With multiple agents, this results in several calls in the queue all showing the business phone number rather than the customer phone numbers that the calls really represent.

I don't want to use a conference to do a warm transfer.

Is there any way to set the callerId to the to number before enqueuing a call?

I have tried dialing a conference with the callerId set, similar to how I dialed the client, and then moving that leg of the call back to the queue, but the callerId didn't stick.


问:
How to make my Java SpringBoot application to proxy MQTT Broker WebSocket 8083 port?
Let's suppose we have an Spring Boot application called A. And we have a MQTT Broker that supports MQTT WebSocket Service.

The device used to connect directly to the MQTT Broker's 8083 port to get MQTT WebSocket Service. But now I want the device to connect to the A's 80 port to get the same MQTT WebSocket Service. For example, the device connect to the ws://A_HOST:80/mqtt, it should work the same as it connect to ws://MQTT_BROKER_HOST:8083/mqtt.

My solution is to use the org.springframework.web.reactive.socket.WebSocketHandler in A. When device connect to A, I would use org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient in A to connect to MQTT Broker at the same time. Whatever data the device sends to A, the A should send the same data to the MQTT Broker. And Whatever the data MQTT Broker responses(or sends), the A should send the same data to device. I think the solution can implement my needs.

I am using WebFlux.

I write the code below, but unfortunately it doesn't work:

```<code>public class ReactiveWebSocketHandler implements WebSocketHandler {
  @Override
  public Mono<Void> handle(WebSocketSession serverSession) {
    WebSocketClient client = new ReactorNettyWebSocketClient();
    client.execute(
        URI.create("ws://xxx.0.0.1:8083/mqtt"), // xxx.0.0.1:8083 is the MQTT Broker Address
        new WebSocketHandler() {

          @Override
          public List<String> getSubProtocols() {
            return Collections.singletonList("mqtt");
          }

          @Override
          public Mono<Void> handle(WebSocketSession clientSession) {

            return clientSession.send(serverSession.receive()) // Whatever data the device sends to A, the A should send the same data to the MQTT Broker
                .and(
                    serverSession.send(clientSession.receive())); // Whatever the data MQTT Broker responses(or sends), the A should send the same data to device

          }

        });

    return Mono.empty(); // Since I have written the logic above, I don't know what should I write here
  }

  @Override
  public List<String> getSubProtocols() {
    return Collections.singletonList("mqtt");
  }
}
</code>```

Could you tell me how to write the code that can implements such logic? Thanks!

Body:
Let's suppose we have an Spring Boot application called A. And we have a MQTT Broker that supports MQTT WebSocket Service.

The device used to connect directly to the MQTT Broker's 8083 port to get MQTT WebSocket Service. But now I want the device to connect to the A's 80 port to get the same MQTT WebSocket Service. For example, the device connect to the ws://A_HOST:80/mqtt, it should work the same as it connect to ws://MQTT_BROKER_HOST:8083/mqtt.

My solution is to use the org.springframework.web.reactive.socket.WebSocketHandler in A. When device connect to A, I would use org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient in A to connect to MQTT Broker at the same time. Whatever data the device sends to A, the A should send the same data to the MQTT Broker. And Whatever the data MQTT Broker responses(or sends), the A should send the same data to device. I think the solution can implement my needs.

I am using WebFlux.

I write the code below, but unfortunately it doesn't work:

public class ReactiveWebSocketHandler implements WebSocketHandler {
  @Override
  public Mono<Void> handle(WebSocketSession serverSession) {
    WebSocketClient client = new ReactorNettyWebSocketClient();
    client.execute(
        URI.create("ws://xxx.0.0.1:8083/mqtt"), // xxx.0.0.1:8083 is the MQTT Broker Address
        new WebSocketHandler() {

          @Override
          public List<String> getSubProtocols() {
            return Collections.singletonList("mqtt");
          }

          @Override
          public Mono<Void> handle(WebSocketSession clientSession) {

            return clientSession.send(serverSession.receive()) // Whatever data the device sends to A, the A should send the same data to the MQTT Broker
                .and(
                    serverSession.send(clientSession.receive())); // Whatever the data MQTT Broker responses(or sends), the A should send the same data to device

          }

        });

    return Mono.empty(); // Since I have written the logic above, I don't know what should I write here
  }

  @Override
  public List<String> getSubProtocols() {
    return Collections.singletonList("mqtt");
  }
}

Could you tell me how to write the code that can implements such logic? Thanks!


问:
Flutter tableCalendar no refresh event
I'm using TableCalendar for display event.
I want to fetch data from api when we change month.
On onPageChanged i have a function for add event.

```<code>changeEvent(pageDate) async {
  //TODO : APPEL AJAX FROM DATE
  String data = await rootBundle.loadString('assets/fake/monthCalendar.json');
  var jsonResult = json.decode(data);

  for (var key in jsonResult.keys) {
    final dateSplited = key.split('/');
    var date = DateTime(int.parse(dateSplited[0]),int.parse(dateSplited[1]),int.parse(dateSplited[2]));
    _kEventSource.addAll({
      date:[
        for (var user in jsonResult[key])
          Event(user['user_phone']),
      ]
    });
    kEvents = LinkedHashMap<DateTime, List<Event>>(
      equals: isSameDay,
      hashCode: getHashCode,
    )..addAll(_kEventSource);
  }
}
</code>```

Until then everything is going well.
But no new event is displayed unless I select a date.

Any ideas ?
Is there a setState for this case?
Maybe a widget function to do that?

Title: Flutter tableCalendar no refresh event

Body:
I'm using TableCalendar for display event.
I want to fetch data from api when we change month.
On onPageChanged i have a function for add event.

changeEvent(pageDate) async {
  //TODO : APPEL AJAX FROM DATE
  String data = await rootBundle.loadString('assets/fake/monthCalendar.json');
  var jsonResult = json.decode(data);

  for (var key in jsonResult.keys) {
    final dateSplited = key.split('/');
    var date = DateTime(int.parse(dateSplited[0]),int.parse(dateSplited[1]),int.parse(dateSplited[2]));
    _kEventSource.addAll({
      date:[
        for (var user in jsonResult[key])
          Event(user['user_phone']),
      ]
    });
    kEvents = LinkedHashMap<DateTime, List<Event>>(
      equals: isSameDay,
      hashCode: getHashCode,
    )..addAll(_kEventSource);
  }
}

Until then everything is going well.
But no new event is displayed unless I select a date.

Any ideas ?
Is there a setState for this case?
Maybe a widget function to do that?


问:
DECLARE on spark sql
Can someone give an idea on how would i DECLARE on spark sql coz i am doing a conversion of script from sql to spark sql.

```<code>DECLARE @MINID INT
SELECT @MINID = ISNULL(MIN(ID),3) FROM SAMPLETABLE
</code>```

Thank you!

I have tried something like SET but it did not worked out for me.

Title: DECLARE on spark sql

Body:
Can someone give an idea on how would i DECLARE on spark sql coz i am doing a conversion of script from sql to spark sql.

DECLARE @MINID INT
SELECT @MINID = ISNULL(MIN(ID),3) FROM SAMPLETABLE

Thank you!

I have tried something like SET but it did not worked out for me.


问:
Why I can't convert my text from UTF-8 to ASCII using iconv?
I'm actually have a hard time trying to convert UTF-8 code to ASCII (I'm a beginner).

My input is a text file named text.txt with these words in utf-8 :

```<code>ÃŠtre
Ã‰loignÃ©e
Ã‰loignÃ©
Ã‰glise
</code>```

So I used iconv to convert them to ASCII :

```<code>iconv -f UTF8 -t ASCII texte.txt > text_ascii.txt
</code>```

When using this command I have this error

```<code>iconv: illegal input sequence at position 0
</code>```

So I checked the encoding of the file using

```<code>file -i  text.txt
text.txt: text/plain; charset=utf-8
</code>```

So here I am sure that the encoding it utf-8 but still it's not working ?

Does anyone know the solution for this please ?

Thanks

Body:
I'm actually have a hard time trying to convert UTF-8 code to ASCII (I'm a beginner).

My input is a text file named text.txt with these words in utf-8 :

ÃŠtre
Ã‰loignÃ©e
Ã‰loignÃ©
Ã‰glise

So I used iconv to convert them to ASCII :

iconv -f UTF8 -t ASCII texte.txt > text_ascii.txt

When using this command I have this error

iconv: illegal input sequence at position 0

So I checked the encoding of the file using

file -i  text.txt
text.txt: text/plain; charset=utf-8

So here I am sure that the encoding it utf-8 but still it's not working ?

Does anyone know the solution for this please ?

Thanks


问:
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema
im installing a laravel x vue template (https://pixinvent.com/demo/vuexy-vuejs-admin-dashboard-template/landing/) and while i run npm dev i get this error:

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.- configuration.module.rules[12].rules should be an array:

My webpack.mix.js looks like this:

```<code>const mix = require('laravel-mix')
const path = require('path');

mix
  .js('resources/js/app.js', 'public/js')
  .webpackConfig({
    resolve: {
      alias: {
        '@resources': path.resolve(__dirname, 'resources/'),
        '@': path.resolve(__dirname, 'resources/js/src/'),
        '@themeConfig': path.resolve(__dirname, 'resources/js/themeConfig.js'),
        '@core': path.resolve(__dirname, 'resources/js/src/@core'),
        '@validations': path.resolve(__dirname, 'resources/js/src/@core/utils/validations/validations.js'),
        '@axios': path.resolve(__dirname, 'resources/js/src/libs/axios'),
      },
    },
    module: {

      rules: [
        {
          test: /\.s[ac]ss$/i,
          rules: [
            {
              loader: 'sass-loader',
              options: {
                sassOptions: {
                  includePaths: ['node_modules', 'resources/assets'],
                },
              },
            },
          ],
        },
        {
            enforce: "pre",
          test: /(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/,
          rules: {
            loader: 'file-loader',
            options: {
              name: 'images/[path][name].[ext]',
              context: '../vuexy-vuejs-bootstrap-vue-template/src/assets/images',
              //   context: 'frontend/src/assets/images'
            },
          },
        },
      ],
    },
  })
  .sass('resources/scss/core.scss', 'public/css')
  .options({
    postCss: [require('autoprefixer'), require('postcss-rtl')],
  })
mix.copy('resources/css/loader.css', 'public/css')

 if (mix.inProduction()) {
   mix.version()
   mix.webpackConfig({
     output: {
       publicPath: '/demo/vuexy-vuejs-laravel-admin-template/demo-1/',
       chunkFilename: 'js/chunks/[name].[chunkhash].js'
     }
   })
   mix.setResourceRoot('/demo/vuexy-vuejs-laravel-admin-template/demo-1/')
 }
 */

mix.webpackConfig({
  output: {
    chunkFilename: 'js/chunks/[name].[chunkhash].js',
  },
})

mix.browserSync('http://127.0.0.1:8000/')
</code>```

Body:
im installing a laravel x vue template (https://pixinvent.com/demo/vuexy-vuejs-admin-dashboard-template/landing/) and while i run npm dev i get this error:

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.- configuration.module.rules[12].rules should be an array:

My webpack.mix.js looks like this:

const mix = require('laravel-mix')
const path = require('path');

mix
  .js('resources/js/app.js', 'public/js')
  .webpackConfig({
    resolve: {
      alias: {
        '@resources': path.resolve(__dirname, 'resources/'),
        '@': path.resolve(__dirname, 'resources/js/src/'),
        '@themeConfig': path.resolve(__dirname, 'resources/js/themeConfig.js'),
        '@core': path.resolve(__dirname, 'resources/js/src/@core'),
        '@validations': path.resolve(__dirname, 'resources/js/src/@core/utils/validations/validations.js'),
        '@axios': path.resolve(__dirname, 'resources/js/src/libs/axios'),
      },
    },
    module: {

      rules: [
        {
          test: /\.s[ac]ss$/i,
          rules: [
            {
              loader: 'sass-loader',
              options: {
                sassOptions: {
                  includePaths: ['node_modules', 'resources/assets'],
                },
              },
            },
          ],
        },
        {
            enforce: "pre",
          test: /(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/,
          rules: {
            loader: 'file-loader',
            options: {
              name: 'images/[path][name].[ext]',
              context: '../vuexy-vuejs-bootstrap-vue-template/src/assets/images',
              //   context: 'frontend/src/assets/images'
            },
          },
        },
      ],
    },
  })
  .sass('resources/scss/core.scss', 'public/css')
  .options({
    postCss: [require('autoprefixer'), require('postcss-rtl')],
  })
mix.copy('resources/css/loader.css', 'public/css')

 if (mix.inProduction()) {
   mix.version()
   mix.webpackConfig({
     output: {
       publicPath: '/demo/vuexy-vuejs-laravel-admin-template/demo-1/',
       chunkFilename: 'js/chunks/[name].[chunkhash].js'
     }
   })
   mix.setResourceRoot('/demo/vuexy-vuejs-laravel-admin-template/demo-1/')
 }
 */

mix.webpackConfig({
  output: {
    chunkFilename: 'js/chunks/[name].[chunkhash].js',
  },
})

mix.browserSync('http://127.0.0.1:8000/')


问:
How to get Tabulator rownum formatter to run after adding rows to tableData with reactiveData option?
I am using a Tabulator table with the reactiveData option enabled. When I add rows to the table, the row number column, using the "rownum" formatter, shows "0" for all rows until I click on the sort button in the column header. Then it'll correctly display row numbers. I suspect that it might be something to do with underlying array not triggering the right event to trigger the rownum formatter when a row is updated/added/deleted. How can I get this to show the right row number when the rows are added to the table without requiring the end user to click on the sort button?

The column in question:
{title:"#", field:"rowNumber", formatter:"rownum", visible:true, download:false},

Expected: each row should have the row number in this column.

Result: each row has a "0" in this column until the sort button in the column header is clicked.

Edit: I've determined that each row has a "position" value of 0 prior to clicking the sort button. According to the docs, position is supposed to start at 1. So it seems like position is not being updated correctly somewhere.


问:
typeorm many to many relation order by count
I need to sort results by number of questions. I have a many to many relation with questions. I need to get all the tags which have more questions. The below query returning the output but not sorting it.

```<code>const tags= await this.tagRepo
  .createQueryBuilder('tag')
  .leftJoinAndSelect('tag.questions', 'question')
  .addSelect((qb) => {
    return qb.select('COUNT(item.id)', 'count').from(Question, 'item');
  }, 'questionCount')
  .orderBy('questionCount', 'DESC')
  .getMany();
</code>```

Output

```<code>{
        "name": "Nodejs",
        "questions": [
          {
            "id": 76
          },
          {
            "id": 77
          }
        ]
      },
      {
        "name": "Angular",
        "questions": [
          {
            "id": 76
          }
        ]
      },
      {
        "name": "Amazon Web Services",
        "questions": [
          {
            "id": 76
          },
          {
            "id": 78
          },
          {
            "id": 77
          }
        ]
      }
</code>```

Body:
I need to sort results by number of questions. I have a many to many relation with questions. I need to get all the tags which have more questions. The below query returning the output but not sorting it.

const tags= await this.tagRepo
  .createQueryBuilder('tag')
  .leftJoinAndSelect('tag.questions', 'question')
  .addSelect((qb) => {
    return qb.select('COUNT(item.id)', 'count').from(Question, 'item');
  }, 'questionCount')
  .orderBy('questionCount', 'DESC')
  .getMany();

Output

{
        "name": "Nodejs",
        "questions": [
          {
            "id": 76
          },
          {
            "id": 77
          }
        ]
      },
      {
        "name": "Angular",
        "questions": [
          {
            "id": 76
          }
        ]
      },
      {
        "name": "Amazon Web Services",
        "questions": [
          {
            "id": 76
          },
          {
            "id": 78
          },
          {
            "id": 77
          }
        ]
      }


问:
Rmd file knitr output to different directory?
I have a .Rmd file which generates a html file. I can see the output directory is automatically the directory in which the .Rmd file is located. I would like the html output to be output to a different directory. Either by setting the working directory to the output directory or setting the output directory.

The .Rmd file is run through this command. I already tried specifying the output_dir but nothing changed.

```<code>Rscript -e 'rmarkdown::render(input = "myscript.Rmd", output_dir = "path_to_outputdir", params = list(directory = "path_to_outputdir"))'
</code>```

The Rmd file header is like this

```<code>---
title: "..."
author: "..."
date: "`r Sys.Date()`"
output:
  html_document:
    toc: true
    toc_float: true
  # runtime: shiny
params:
  directory:
    value: x
---

```{r setup, include=FALSE}

# Knitr Options
knitr::opts_chunk$set( #opts_chunk
  echo = FALSE,
    message = FALSE,
    warning = FALSE,
  fig.width = 9,
  fig.height = 6
  root.dir = file.path(params$directory)
)
```
</code>```

Body:
I have a .Rmd file which generates a html file. I can see the output directory is automatically the directory in which the .Rmd file is located. I would like the html output to be output to a different directory. Either by setting the working directory to the output directory or setting the output directory.

The .Rmd file is run through this command. I already tried specifying the output_dir but nothing changed.

Rscript -e 'rmarkdown::render(input = "myscript.Rmd", output_dir = "path_to_outputdir", params = list(directory = "path_to_outputdir"))'

The Rmd file header is like this

---
title: "..."
author: "..."
date: "`r Sys.Date()`"
output:
  html_document:
    toc: true
    toc_float: true
  # runtime: shiny
params:
  directory:
    value: x
---

```{r setup, include=FALSE}

# Knitr Options
knitr::opts_chunk$set( #opts_chunk
  echo = FALSE,
    message = FALSE,
    warning = FALSE,
  fig.width = 9,
  fig.height = 6
  root.dir = file.path(params$directory)
)
```


问:
How can I transform or query JSON data in my Github Workflow?
I am using the octokit/request-action action in my Github Workflow to obtain information about a certain Github Release via its tag name:

- name: Get Release Info
  uses: octokit/request-action@v2.x
  id: release
  with:
    route: GET /repos/{org_repo}/releases/tags/{tag}
```
<p>The response JSON structure contains information about all of the assets attached to the release. I need to use this information to build a list of download URLs for all the release artifacts and pass that into a Python script that builds a discord notification.</p>
<p>Using the Github Workflow YAML, how do I "query" the JSON data (similar to JSONata) to obtain a list of all the <code>browser_download_url</code> values inside the <code>assets</code> array? The data returned looks like this (trimmed):</p>
<pre class="lang-json prettyprint-override"><code>{
  "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
  "id": 1,
  "assets": [
    {
      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
      "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example1.zip",
      "id": 1
    },
    {
      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/2",
      "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example2.zip",
      "id": 2
    }
  ]
}
</code>```

The end result I want is a way to pass the two download URLs above to my script like so (using a separate step in my workflow):

```<code>python discord_notification.py "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example1.zip" "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example2.zip"
</code>```

(Exact syntax can vary; the above snippet is just an example)

It's possible that what I want to do just can't be achieved in the workflow YAML itself. If that's the case, I'd be OK with a solution that involves passing all or part of the response JSON to the Python script and use Python itself to parse the JSON data. I just don't know if Bash adds a layer of complexity that will make passing a multi-line response string as a parameter difficult.

Body:
I am using the octokit/request-action action in my Github Workflow to obtain information about a certain Github Release via its tag name:

- name: Get Release Info
  uses: octokit/request-action@v2.x
  id: release
  with:
    route: GET /repos/{org_repo}/releases/tags/{tag}

The response JSON structure contains information about all of the assets attached to the release. I need to use this information to build a list of download URLs for all the release artifacts and pass that into a Python script that builds a discord notification.

Using the Github Workflow YAML, how do I "query" the JSON data (similar to JSONata) to obtain a list of all the browser_download_url values inside the assets array? The data returned looks like this (trimmed):

{
  "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
  "id": 1,
  "assets": [
    {
      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
      "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example1.zip",
      "id": 1
    },
    {
      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/2",
      "browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example2.zip",
      "id": 2
    }
  ]
}

The end result I want is a way to pass the two download URLs above to my script like so (using a separate step in my workflow):

python discord_notification.py "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example1.zip" "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example2.zip"

(Exact syntax can vary; the above snippet is just an example)

It's possible that what I want to do just can't be achieved in the workflow YAML itself. If that's the case, I'd be OK with a solution that involves passing all or part of the response JSON to the Python script and use Python itself to parse the JSON data. I just don't know if Bash adds a layer of complexity that will make passing a multi-line response string as a parameter difficult.


问:
Module build failed in React
I created a ui component and published it in npm.

npm i @izy-ui/react-floating-button

But after i create a new react project, installed above component.
But react show bellow error message.

```<code>Compiled with problems:X

ERROR in ./node_modules/@izy-ui/react-floating-button/index.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\PCName\Documents\clone\sample\my-app\node_modules\@izy-ui\react-floating-button\index.js: Support for the experimental syntax 'jsx' isn't currently enabled (17:5):

  15 |   }
  16 |   return (
> 17 |     <>
     |     ^
  18 |       <div className={`float-container ${props.direction}`}>
  19 |         <div className="wrapper">
  20 |           <div onClick={handleClick} className={status ? `rotate button-styling-hidden ${props.basecolor} ` : `normal  button-styling-hidden ${props.basecolor}`}>

Add @babel/preset-react (https://github.com/babel/babel/tree/main/packages/babel-preset-react) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx) to the 'plugins' section to enable parsing.
    at instantiate (C:\Users\PCName\Documents\clone\sample\my-app\node_modules\@babel\parser\lib\index.js:67:32)

</code>```

`

What are the errors in created ui component? or what are the suggestions to solve this error

Title: Module build failed in React

Body:
I created a ui component and published it in npm.

npm i @izy-ui/react-floating-button

But after i create a new react project, installed above component.
But react show bellow error message.

Compiled with problems:X

ERROR in ./node_modules/@izy-ui/react-floating-button/index.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\PCName\Documents\clone\sample\my-app\node_modules\@izy-ui\react-floating-button\index.js: Support for the experimental syntax 'jsx' isn't currently enabled (17:5):

  15 |   }
  16 |   return (
> 17 |     <>
     |     ^
  18 |       <div className={`float-container ${props.direction}`}>
  19 |

  20 |           <div onClick={handleClick} className={status ? `rotate button-styling-hidden ${props.basecolor} ` : `normal  button-styling-hidden ${props.basecolor}`}>

Add @babel/preset-react (https://github.com/babel/babel/tree/main/packages/babel-preset-react) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx) to the 'plugins' section to enable parsing.
    at instantiate (C:\Users\PCName\Documents\clone\sample\my-app\node_modules\@babel\parser\lib\index.js:67:32)

`

What are the errors in created ui component? or what are the suggestions to solve this error


问:
Varying fonts of some html elements on dektop mode for different mobile and different browsers
I have set a fixed font-size for the "p" and "h4" elements in my footer but I keep experiencing different font-size while using desktop mode on my mobile. I get the expected result while using firefox, and safari but a weird result while using chrome.

Here is the reference website, link to the website.

Attached below are images to visually illustrate the issue.

Here's the HTML

```<code><div class="container-item details">
     <h2>travelaja</h2>
      <p class="content"> Lorem ipsum dolor sit amet, consectetur adipiscing elit ut aliquam, purus sit amet luctus venenatis, lectus magna fringilla urna, porttitor rhoncus dolor purus non enim praesent elementum facilisisleo, vel.
      </p>
</div>
</code>```
```<code><div class="container-item contact">
   <h3>Contact</h3>
   <h4>Address: Jl.Codelaras No.205A Kediri, Pare AG17</h4>
   ...
</div>
</code>```

and this is the CSS I use to style it.

```<code>footer .container .container-item p.content {
  font-size: 1.6rem;
}

footer .container .contact h4 {
  margin-bottom: 15px;
  font-weight: 400;
  font-size: 1.6rem;
}
</code>```

I reduced the fonts to 1.0rem but it was not looking good on safari and then it was quite normal in chrome.

I also ensured that I have this meta tag,

```<code><meta name="viewport" content="width=device-width, initial-scale=1.0" />
</code>```

Body:
I have set a fixed font-size for the "p" and "h4" elements in my footer but I keep experiencing different font-size while using desktop mode on my mobile. I get the expected result while using firefox, and safari but a weird result while using chrome.

Here is the reference website, link to the website.

Attached below are images to visually illustrate the issue.

Here's the HTML

travelaja

 Lorem ipsum dolor sit amet, consectetur adipiscing elit ut aliquam, purus sit amet luctus venenatis, lectus magna fringilla urna, porttitor rhoncus dolor purus non enim praesent elementum facilisisleo, vel.

Contact

Address: Jl.Codelaras No.205A Kediri, Pare AG17

   ...

and this is the CSS I use to style it.

footer .container .container-item p.content {
  font-size: 1.6rem;
}

footer .container .contact h4 {
  margin-bottom: 15px;
  font-weight: 400;
  font-size: 1.6rem;
}

I reduced the fonts to 1.0rem but it was not looking good on safari and then it was quite normal in chrome.

I also ensured that I have this meta tag,

<meta name="viewport" content="width=device-width, initial-scale=1.0" />


问:
Dash: Get the post request query string parameters inside callback
I have a multi-page dash application.

app.py

pages

page_one.py

page_two.py

In app.py, I have

```<code>@callback(
    Output(component_id="page-content", component_property="children"),
    Input(component_id="url", component_property="pathname"),
)
def display_page(pathname):

    if pathname == "/one":
        return page_one.layout
    elif pathname == "/two":
        return page_two.layout
</code>```

In page_one.py, I have few callbacks.

For eg:
Callback-1

```<code>@callback(
    output=Output("paragraph_id", "children"),
    inputs=Input("button_id", "n_clicks"),
    background=True,
    running=[
        (Output("button_id", "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
        (
            Output("paragraph_id", "style"),
            {"visibility": "hidden"},
            {"visibility": "visible"},
        ),
        (
            Output("progress_bar", "style"),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        ),
    ],
    cancel=Input("cancel_button_id", "n_clicks"),
    progress=[Output("progress_bar", "value"), Output("progress_bar", "max")],
    prevent_initial_call=True,
)
def update_progress_A(set_progress, n_clicks):
 # Here I want to access the post request query string parameters
 some code for- A
</code>```

Callback-2

```<code>@callback(
    output=Output("paragraph_id", "children"),
    inputs=Input("button_id", "n_clicks"),
    background=True,
    running=[
        (Output("button_id", "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
        (
            Output("paragraph_id", "style"),
            {"visibility": "hidden"},
            {"visibility": "visible"},
        ),
        (
            Output("progress_bar", "style"),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        ),
    ],
    cancel=Input("cancel_button_id", "n_clicks"),
    progress=[Output("progress_bar", "value"), Output("progress_bar", "max")],
    prevent_initial_call=True,
)
def update_progress_B(set_progress, n_clicks):
 # Here I want to access the post request query string parameters
 some code for- B
</code>```

Is it possible to get the post request query string parameters inside the callback?

Please suggest.

Updated: 1

I have docker services as below:

redis, postgres, web, celery, nginx

I have implemented demo code from dash website

```<code>@callback(
    output=Output("paragraph_id", "children"),
    inputs=Input("button_id", "n_clicks"),
    background=True,
    running=[
        (Output("button_id", "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
        (
            Output("paragraph_id", "style"),
            {"visibility": "hidden"},
            {"visibility": "visible"},
        ),
        (
            Output("progress_bar", "style"),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        ),
    ],
    cancel=Input("cancel_button_id", "n_clicks"),
    progress=[Output("progress_bar", "value"), Output("progress_bar", "max")],
    prevent_initial_call=True,
)
def update_progress(set_progress, n_clicks):
    total = 5

    # print("INPUTS: ", callback_context.inputs)
    # print("INPUTS: ", callback_context.inputs_list)

    for i in range(total + 1):
        set_progress((str(i), str(total)))
        time.sleep(1)

    return f"Clicked {n_clicks} times"
</code>```

When services are up, I observed following things in terminal:

For celery:

```<code>celery | [tasks]
celery |   . long_callback_d0a7a49bfe3d30bfdd7a43d2a22db75123ff2fa9
</code>```

After button clicking:

```<code>celery | [2022-12-27 20:18:43,090: INFO/MainProcess] Task long_callback_d0a7a49bfe3d30bfdd7a43d2a22db75123ff2fa9[b663bb71-6962-44a3-ae2c-00eb7d8869bf] received
proxy | 172.18.0.1 - - [27/Dec/2022:20:18:44 +0000] "POST /_dash-update-component?cacheKey=6067e37a0e1f0c07b6f9ff0d7ef0b208ae2783ba&job=b663bb71-6962-44a3-ae2c-00eb7d8869bf
celery | [2022-12-27 20:18:49,119: INFO/ForkPoolWorker-2] Task long_callback_d0a7a49bfe3d30bfdd7a43d2a22db75123ff2fa9[b663bb71-6962-44a3-ae2c-00eb7d8869bf] succeeded in 6.027637779999964s: None
</code>```

This is working fine.

I am trying to get/access job parameter inside update_progress()

so that I can use this job parameter to pass in the result.AsyncResult(job) which is celery function inside update_progress() to get status, state of the running task, which I am trying to use to update progress bar.

Usecases:

Upload dataset: I'm using dcc.Upload() and file is getting uploaded successfully. e.g. user uploads data.csv

Create train, test, dev dataset files: I'm using dbc.Button() where user clicks it and all 3 files are getting created successfully [I have used sklearn]. e.g. we get train.csv, test.csv and dev.csv

Model training: I'm using dbc.Button() where user clicks it and model is getting generated and stored successfully. e.g. model.joblib

Body:
I have a multi-page dash application.

app.py

pages

page_one.py

page_two.py

In app.py, I have

@callback(
    Output(component_id="page-content", component_property="children"),
    Input(component_id="url", component_property="pathname"),
)
def display_page(pathname):

    if pathname == "/one":
        return page_one.layout
    elif pathname == "/two":
        return page_two.layout

In page_one.py, I have few callbacks.

For eg:
Callback-1

@callback(
    output=Output("paragraph_id", "children"),
    inputs=Input("button_id", "n_clicks"),
    background=True,
    running=[
        (Output("button_id", "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
        (
            Output("paragraph_id", "style"),
            {"visibility": "hidden"},
            {"visibility": "visible"},
        ),
        (
            Output("progress_bar", "style"),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        ),
    ],
    cancel=Input("cancel_button_id", "n_clicks"),
    progress=[Output("progress_bar", "value"), Output("progress_bar", "max")],
    prevent_initial_call=True,
)
def update_progress_A(set_progress, n_clicks):
 # Here I want to access the post request query string parameters
 some code for- A

Callback-2

@callback(
    output=Output("paragraph_id", "children"),
    inputs=Input("button_id", "n_clicks"),
    background=True,
    running=[
        (Output("button_id", "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
        (
            Output("paragraph_id", "style"),
            {"visibility": "hidden"},
            {"visibility": "visible"},
        ),
        (
            Output("progress_bar", "style"),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        ),
    ],
    cancel=Input("cancel_button_id", "n_clicks"),
    progress=[Output("progress_bar", "value"), Output("progress_bar", "max")],
    prevent_initial_call=True,
)
def update_progress_B(set_progress, n_clicks):
 # Here I want to access the post request query string parameters
 some code for- B

Is it possible to get the post request query string parameters inside the callback?

Please suggest.

Updated: 1

I have docker services as below:

redis, postgres, web, celery, nginx

I have implemented demo code from dash website

@callback(
    output=Output("paragraph_id", "children"),
    inputs=Input("button_id", "n_clicks"),
    background=True,
    running=[
        (Output("button_id", "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
        (
            Output("paragraph_id", "style"),
            {"visibility": "hidden"},
            {"visibility": "visible"},
        ),
        (
            Output("progress_bar", "style"),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        ),
    ],
    cancel=Input("cancel_button_id", "n_clicks"),
    progress=[Output("progress_bar", "value"), Output("progress_bar", "max")],
    prevent_initial_call=True,
)
def update_progress(set_progress, n_clicks):
    total = 5

    # print("INPUTS: ", callback_context.inputs)
    # print("INPUTS: ", callback_context.inputs_list)

    for i in range(total + 1):
        set_progress((str(i), str(total)))
        time.sleep(1)

    return f"Clicked {n_clicks} times"

When services are up, I observed following things in terminal:

For celery:

celery | [tasks]
celery |   . long_callback_d0a7a49bfe3d30bfdd7a43d2a22db75123ff2fa9

After button clicking:

celery | [2022-12-27 20:18:43,090: INFO/MainProcess] Task long_callback_d0a7a49bfe3d30bfdd7a43d2a22db75123ff2fa9[b663bb71-6962-44a3-ae2c-00eb7d8869bf] received
proxy | 172.18.0.1 - - [27/Dec/2022:20:18:44 +0000] "POST /_dash-update-component?cacheKey=6067e37a0e1f0c07b6f9ff0d7ef0b208ae2783ba&job=b663bb71-6962-44a3-ae2c-00eb7d8869bf
celery | [2022-12-27 20:18:49,119: INFO/ForkPoolWorker-2] Task long_callback_d0a7a49bfe3d30bfdd7a43d2a22db75123ff2fa9[b663bb71-6962-44a3-ae2c-00eb7d8869bf] succeeded in 6.027637779999964s: None

This is working fine.

I am trying to get/access job parameter inside update_progress()

so that I can use this job parameter to pass in the result.AsyncResult(job) which is celery function inside update_progress() to get status, state of the running task, which I am trying to use to update progress bar.

Usecases:

Upload dataset: I'm using dcc.Upload() and file is getting uploaded successfully. e.g. user uploads data.csv

Create train, test, dev dataset files: I'm using dbc.Button() where user clicks it and all 3 files are getting created successfully [I have used sklearn]. e.g. we get train.csv, test.csv and dev.csv

Model training: I'm using dbc.Button() where user clicks it and model is getting generated and stored successfully. e.g. model.joblib


问:
net maui form validation
Still learning.
I am trying to do a model validation using CommunityToolkit.Mvvm and I stuck in the styles (min there).

Here is what i tried:

Model:

```<code>public abstract partial class BaseModel : ObservableObject, IDataErrorInfo
{
    private Dictionary<string, string> validationErrors = new Dictionary<string, string>();
    private bool isValid = false;

    protected Dictionary<string, string> ValidationErrors
    {
        get => validationErrors;
        private set => SetProperty(ref validationErrors, value);
    }

    protected bool IsValid
    {
        get => isValid;
        private set => SetProperty(ref isValid, value);
    }

    [RelayCommand]
    protected void Validate()
    {
        var context = new ValidationContext(this);
        var errors = new List<ValidationResult>();

        isValid = Validator.TryValidateObject(this, context, errors, true);
        foreach (var error in errors)
        {
            var columnName = error.MemberNames.First();

            if(!validationErrors.ContainsKey(columnName))
                validationErrors.Add(columnName, error.ErrorMessage);
        }
    }

    // check for general model error
    public string Error { get; private set; } = null;

    // check for property errors
    public string this[string columnName]
    {
        get
        {
            Validate();
            return validationErrors[columnName];
        }
    }
}

public class PlayerModel : BaseModel
{
    public int Id { get; set; }

    [Required]
    [StringLength(255)]
    public string Name { get; set; }

    [StringLength(4096)]
    public string LocalImageLink { get; set; }

    [Required]
    [StringLength(4096)]
    public string WebImageLink { get; set; }

    [Required]
    [StringLength(255)]
    public string Club { get; set; }

    [Required]
    [StringLength(32)]
    public string Birthday { get; set; }

    [Required]
    [StringLength(255)]
    public string BirthPlace { get; set; }

    [Required]
    [Range(0, 100)]
    public int Weight { get; set; }

    [Required]
    [Range(0, 2.5)]
    public double Height { get; set; }

    [Required]
    public string Description { get; set; }

    public string PositionName { get; set; }

    [Required]
    [Range(1, 7)]
    public int PositionId { get; set; }

    public PlayerModel()
    {
    }

    public PlayerModel(int id, string name, string localImageLink, string webImageLink, string club, string birthday, string birthPlace, int weight, double height, string description, string positionName, int positionId)
    {
        Id = id;
        Name = name;
        LocalImageLink = localImageLink;
        WebImageLink = webImageLink;
        Club = club;
        Birthday = birthday;
        BirthPlace = birthPlace;
        Weight = weight;
        Height = height;
        Description = description;
        PositionName = positionName;
        PositionId = positionId;
    }

    public PlayerModel(int id, string name, string localImageLink, string webImageLink, string club, string birthday, string birthPlace, int weight, double height, string description, PositionModel position)
    {
        Id = id;
        Name = name;
        LocalImageLink = localImageLink;
        WebImageLink = webImageLink;
        Club = club;
        Birthday = birthday;
        BirthPlace = birthPlace;
        Weight = weight;
        Height = height;
        Description = description;
        PositionName = position.Name;
        PositionId = position.Id;
    }

    public PlayerModel(PlayerEntity player)
    {
        Id = player.Id;
        Name = player.Name;
        LocalImageLink = player.LocalImageLink;
        WebImageLink = player.WebImageLink;
        Club = player.Club;
        Birthday = player.Birthday;
        BirthPlace = player.BirthPlace;
        Weight = player.Weight;
        Height = player.Height;
        Description = player.Description;
        PositionName = player.Position.Name;
        PositionId = player.Position.Id;
    }

    public PlayerEntity ToEntity()
    {
        return new PlayerEntity
        {
            Id = Id,
            Name = Name,
            LocalImageLink = LocalImageLink,
            WebImageLink = WebImageLink,
            Club = Club,
            Birthday = Birthday,
            BirthPlace = BirthPlace,
            Weight = Weight,
            Height = Height,
            Description = Description,
            Position = new PositionEntity
            {
                Id = PositionId,
                Name = PositionName
            }
        };
    }

    public void ToEntity(PlayerEntity player)
    {
        player.Id = Id;
        player.Name = Name;
        player.LocalImageLink = LocalImageLink;
        player.WebImageLink = WebImageLink;
        player.Club = Club;
        player.Birthday = Birthday;
        player.BirthPlace = BirthPlace;
        player.Weight = Weight;
        player.Height = Height;
        player.Description = Description;

        player.Position.Id = PositionId;
        player.Position.Name = PositionName;
    }
}
</code>```

View:

```<code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiUI.Pages.AddOrUpdatePlayer"
             xmlns:local="clr-namespace:Backend.Models;assembly=Backend.Models"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">

    <ContentPage.BindingContext>
        <local:PlayerModel />
    </ContentPage.BindingContext>

    <ContentPage.ToolbarItems>
        <ToolbarItem IconImageSource="save.svg" Clicked="OnSaveClick"/>
    </ContentPage.ToolbarItems>

    <ScrollView Margin="10">
        <VerticalStackLayout>
            <VerticalStackLayout>
                <Label Text="Name" />
                <Entry x:Name="name" Text="{Binding Name, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing">
                    <Entry.Behaviors>
                        <toolkit:EventToCommandBehavior
                                EventName="TextChanged"
                                Command="{Binding Validate}" />
                    </Entry.Behaviors>
                </Entry>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Position" />
                <Picker x:Name="position" Title="Select..."
                        ItemDisplayBinding="{Binding Name}"
                        SelectedItem="{Binding PositionId, Mode=TwoWay}" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Club" />
                <Entry x:Name="club" Text="{Binding Club, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Birthday" />
                <DatePicker  x:Name="birthday" Date="{Binding Birthday, Mode=TwoWay}" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Birth place" />
                <Entry x:Name="birthplace" Text="{Binding BirthPlace, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Weight" />
                <Entry x:Name="weight" Text="{Binding Weight, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" Keyboard="Numeric"/>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Height" />
                <Entry x:Name="height" Text="{Binding Height, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" Keyboard="Numeric"/>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Image link" />
                <Entry x:Name="webImageLink" Text="{Binding WebImageLink, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing"/>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">
                <Label Text="Description" />
                <Editor x:Name="description" Text="{Binding Description, Mode=TwoWay}"
                        AutoSize="TextChanges"/>
            </VerticalStackLayout>
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>
</code>```

View code behind:

```<code>[QueryProperty(nameof(Player), "player")]
public partial class AddOrUpdatePlayer : ContentPage
{
    private PlayerModel player;
    public PlayerModel Player
    {
        get => player;
        set
        {
            player = value;
            OnPropertyChanged();
        }
    }

    private readonly IPositionClient positionClient;
    private readonly IPlayerClient playerClient;

    private delegate Task Action();
    private Action asyncAction;

    public AddOrUpdatePlayer(IPositionClient positionClient, IPlayerClient playerClient)
    {
        InitializeComponent();
        SetUpControls();
        SetTitle();
        SetActionPointer();

        this.positionClient = positionClient;
        this.playerClient = playerClient;
    }

    protected async override void OnAppearing()
    {
        BindingContext = player;
        await SetUpPositionPicker();
    }

    private void SetUpControls()
    {
        birthday.MinimumDate = new DateTime(1900, 1, 1);
        birthday.MaximumDate = DateTime.Now.Date;
    }

    private async Task SetUpPositionPicker()
    {
        position.ItemsSource = await this.positionClient.GetAllAsync();
    }

    private void SetTitle()
    {
        Title = this.player is null ?
                "Add new player" :
                 $"Update {player.Name}";
    }

    private void SetActionPointer()
    {
        asyncAction = this.player is null ?
                      AddNewPlayer :
                      UpdatePlayer;
    }

    private async Task AddNewPlayer()
    {
        var player = BindingContext as PlayerModel;

        await playerClient.CreateAsync(player);

        await Shell.Current.GoToAsync(PageRoutes.HomePage, true);
    }

    private async Task UpdatePlayer()
    { }

    private async void OnSaveClick(object sender, EventArgs e)
    {
        await asyncAction();
    }
}
</code>```

Global style:

```<code><?xml version="1.0" encoding="UTF-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">

    <Entry.Style>
        <OnPlatform x:TypeArguments="Style">
            <On Platform="iOS, Android" Value="{StaticResource EntryStyle}" />
            <On Platform="WinUI" Value="{StaticResource WinUIEntryStyle}" />
        </OnPlatform>
    </Entry.Style>
    <Entry.Behaviors>
        <mct:EventToCommandBehavior
        EventName="TextChanged"
        Command="{Binding Validate}" />
    </Entry.Behaviors>
    <Entry.Triggers>
        <DataTrigger
        TargetType="Entry"
        Binding="{Binding UserName.IsValid}"
        Value="False">
            <Setter Property="BackgroundColor" Value="{StaticResource ErrorColor}" />
        </DataTrigger>
    </Entry.Triggers>

</ResourceDictionary>
</code>```

I need to change the Entry.Triggers DataTrigger Binding property to adapt to my solution if it's possible.
My another problem is that when the button is clicked to save the BindingContext is null, no data is banded to the model in the AddNewPlayer() function.

Title: net maui form validation

Body:
Still learning.
I am trying to do a model validation using CommunityToolkit.Mvvm and I stuck in the styles (min there).

Here is what i tried:

Model:

public abstract partial class BaseModel : ObservableObject, IDataErrorInfo
{
    private Dictionary<string, string> validationErrors = new Dictionary<string, string>();
    private bool isValid = false;

    protected Dictionary<string, string> ValidationErrors
    {
        get => validationErrors;
        private set => SetProperty(ref validationErrors, value);
    }

    protected bool IsValid
    {
        get => isValid;
        private set => SetProperty(ref isValid, value);
    }

    [RelayCommand]
    protected void Validate()
    {
        var context = new ValidationContext(this);
        var errors = new List<ValidationResult>();

        isValid = Validator.TryValidateObject(this, context, errors, true);
        foreach (var error in errors)
        {
            var columnName = error.MemberNames.First();

            if(!validationErrors.ContainsKey(columnName))
                validationErrors.Add(columnName, error.ErrorMessage);
        }
    }

    // check for general model error
    public string Error { get; private set; } = null;

    // check for property errors
    public string this[string columnName]
    {
        get
        {
            Validate();
            return validationErrors[columnName];
        }
    }
}

public class PlayerModel : BaseModel
{
    public int Id { get; set; }

    [Required]
    [StringLength(255)]
    public string Name { get; set; }

    [StringLength(4096)]
    public string LocalImageLink { get; set; }

    [Required]
    [StringLength(4096)]
    public string WebImageLink { get; set; }

    [Required]
    [StringLength(255)]
    public string Club { get; set; }

    [Required]
    [StringLength(32)]
    public string Birthday { get; set; }

    [Required]
    [StringLength(255)]
    public string BirthPlace { get; set; }

    [Required]
    [Range(0, 100)]
    public int Weight { get; set; }

    [Required]
    [Range(0, 2.5)]
    public double Height { get; set; }

    [Required]
    public string Description { get; set; }

    public string PositionName { get; set; }

    [Required]
    [Range(1, 7)]
    public int PositionId { get; set; }

    public PlayerModel()
    {
    }

    public PlayerModel(int id, string name, string localImageLink, string webImageLink, string club, string birthday, string birthPlace, int weight, double height, string description, string positionName, int positionId)
    {
        Id = id;
        Name = name;
        LocalImageLink = localImageLink;
        WebImageLink = webImageLink;
        Club = club;
        Birthday = birthday;
        BirthPlace = birthPlace;
        Weight = weight;
        Height = height;
        Description = description;
        PositionName = positionName;
        PositionId = positionId;
    }

    public PlayerModel(int id, string name, string localImageLink, string webImageLink, string club, string birthday, string birthPlace, int weight, double height, string description, PositionModel position)
    {
        Id = id;
        Name = name;
        LocalImageLink = localImageLink;
        WebImageLink = webImageLink;
        Club = club;
        Birthday = birthday;
        BirthPlace = birthPlace;
        Weight = weight;
        Height = height;
        Description = description;
        PositionName = position.Name;
        PositionId = position.Id;
    }

    public PlayerModel(PlayerEntity player)
    {
        Id = player.Id;
        Name = player.Name;
        LocalImageLink = player.LocalImageLink;
        WebImageLink = player.WebImageLink;
        Club = player.Club;
        Birthday = player.Birthday;
        BirthPlace = player.BirthPlace;
        Weight = player.Weight;
        Height = player.Height;
        Description = player.Description;
        PositionName = player.Position.Name;
        PositionId = player.Position.Id;
    }

    public PlayerEntity ToEntity()
    {
        return new PlayerEntity
        {
            Id = Id,
            Name = Name,
            LocalImageLink = LocalImageLink,
            WebImageLink = WebImageLink,
            Club = Club,
            Birthday = Birthday,
            BirthPlace = BirthPlace,
            Weight = Weight,
            Height = Height,
            Description = Description,
            Position = new PositionEntity
            {
                Id = PositionId,
                Name = PositionName
            }
        };
    }

    public void ToEntity(PlayerEntity player)
    {
        player.Id = Id;
        player.Name = Name;
        player.LocalImageLink = LocalImageLink;
        player.WebImageLink = WebImageLink;
        player.Club = Club;
        player.Birthday = Birthday;
        player.BirthPlace = BirthPlace;
        player.Weight = Weight;
        player.Height = Height;
        player.Description = Description;

        player.Position.Id = PositionId;
        player.Position.Name = PositionName;
    }
}

View:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiUI.Pages.AddOrUpdatePlayer"
             xmlns:local="clr-namespace:Backend.Models;assembly=Backend.Models"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">

    <ContentPage.BindingContext>
        <local:PlayerModel />
    </ContentPage.BindingContext>

    <ContentPage.ToolbarItems>
        <ToolbarItem IconImageSource="save.svg" Clicked="OnSaveClick"/>
    </ContentPage.ToolbarItems>

    <ScrollView Margin="10">
        <VerticalStackLayout>
            <VerticalStackLayout>

                <Entry x:Name="name" Text="{Binding Name, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing">
                    <Entry.Behaviors>
                        <toolkit:EventToCommandBehavior
                                EventName="TextChanged"
                                Command="{Binding Validate}" />
                    </Entry.Behaviors>
                </Entry>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Picker x:Name="position" Title="Select..."
                        ItemDisplayBinding="{Binding Name}"
                        SelectedItem="{Binding PositionId, Mode=TwoWay}" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Entry x:Name="club" Text="{Binding Club, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <DatePicker  x:Name="birthday" Date="{Binding Birthday, Mode=TwoWay}" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Entry x:Name="birthplace" Text="{Binding BirthPlace, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" />
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Entry x:Name="weight" Text="{Binding Weight, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" Keyboard="Numeric"/>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Entry x:Name="height" Text="{Binding Height, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing" Keyboard="Numeric"/>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Entry x:Name="webImageLink" Text="{Binding WebImageLink, Mode=TwoWay}"
                       ClearButtonVisibility="WhileEditing"/>
            </VerticalStackLayout>
            <VerticalStackLayout Margin="0,10">

                <Editor x:Name="description" Text="{Binding Description, Mode=TwoWay}"
                        AutoSize="TextChanges"/>
            </VerticalStackLayout>
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>

View code behind:

[QueryProperty(nameof(Player), "player")]
public partial class AddOrUpdatePlayer : ContentPage
{
    private PlayerModel player;
    public PlayerModel Player
    {
        get => player;
        set
        {
            player = value;
            OnPropertyChanged();
        }
    }

    private readonly IPositionClient positionClient;
    private readonly IPlayerClient playerClient;

    private delegate Task Action();
    private Action asyncAction;

    public AddOrUpdatePlayer(IPositionClient positionClient, IPlayerClient playerClient)
    {
        InitializeComponent();
        SetUpControls();
        SetTitle();
        SetActionPointer();

        this.positionClient = positionClient;
        this.playerClient = playerClient;
    }

    protected async override void OnAppearing()
    {
        BindingContext = player;
        await SetUpPositionPicker();
    }

    private void SetUpControls()
    {
        birthday.MinimumDate = new DateTime(1900, 1, 1);
        birthday.MaximumDate = DateTime.Now.Date;
    }

    private async Task SetUpPositionPicker()
    {
        position.ItemsSource = await this.positionClient.GetAllAsync();
    }

    private void SetTitle()
    {
        Title = this.player is null ?
                "Add new player" :
                 $"Update {player.Name}";
    }

    private void SetActionPointer()
    {
        asyncAction = this.player is null ?
                      AddNewPlayer :
                      UpdatePlayer;
    }

    private async Task AddNewPlayer()
    {
        var player = BindingContext as PlayerModel;

        await playerClient.CreateAsync(player);

        await Shell.Current.GoToAsync(PageRoutes.HomePage, true);
    }

    private async Task UpdatePlayer()
    { }

    private async void OnSaveClick(object sender, EventArgs e)
    {
        await asyncAction();
    }
}

Global style:

<?xml version="1.0" encoding="UTF-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">

    <Entry.Style>
        <OnPlatform x:TypeArguments="Style">
            <On Platform="iOS, Android" Value="{StaticResource EntryStyle}" />
            <On Platform="WinUI" Value="{StaticResource WinUIEntryStyle}" />
        </OnPlatform>
    </Entry.Style>
    <Entry.Behaviors>
        <mct:EventToCommandBehavior
        EventName="TextChanged"
        Command="{Binding Validate}" />
    </Entry.Behaviors>
    <Entry.Triggers>
        <DataTrigger
        TargetType="Entry"
        Binding="{Binding UserName.IsValid}"
        Value="False">
            <Setter Property="BackgroundColor" Value="{StaticResource ErrorColor}" />
        </DataTrigger>
    </Entry.Triggers>

</ResourceDictionary>

I need to change the Entry.Triggers DataTrigger Binding property to adapt to my solution if it's possible.
My another problem is that when the button is clicked to save the BindingContext is null, no data is banded to the model in the AddNewPlayer() function.


问:
Is it possible to do an animated border in react-native without third-party library?
I'm trying to get an animated border radius for a 'validating' state.
One approach is to use a background gradient color, block out the 'box' with a pseudoElement, and rotate the background image on loop. ie: https://codepen.io/Chester/pen/QPoyjN

since react-native Stylesheets doesn't support pseudoelements; i'm trying to figure out how to get the same effect. Seems if i just set a borderradius and animate it, i'll get blinking/strobing top-left-right-bottom borders instead of a 'moving around the border' effect.
also backgroundImage style doesn't work, so can't set background to linear gradient...

```<code>backgroundImage:
      'linear-gradient(#399953, #399953), linear-gradient(#fbb300, #fbb300), linear-gradient(#d53e33, #d53e33), linear-gradient(#377af5, #377af5)',
</code>```

any ideas?

tried this codepen

and some pointers from this article

I will try a version of setting a background image like this and putting my content right in front and smaller by ${borderWidth * 2}px

Body:
I'm trying to get an animated border radius for a 'validating' state.
One approach is to use a background gradient color, block out the 'box' with a pseudoElement, and rotate the background image on loop. ie: https://codepen.io/Chester/pen/QPoyjN

since react-native Stylesheets doesn't support pseudoelements; i'm trying to figure out how to get the same effect. Seems if i just set a borderradius and animate it, i'll get blinking/strobing top-left-right-bottom borders instead of a 'moving around the border' effect.
also backgroundImage style doesn't work, so can't set background to linear gradient...

backgroundImage:
      'linear-gradient(#399953, #399953), linear-gradient(#fbb300, #fbb300), linear-gradient(#d53e33, #d53e33), linear-gradient(#377af5, #377af5)',

any ideas?

tried this codepen

and some pointers from this article

I will try a version of setting a background image like this and putting my content right in front and smaller by ${borderWidth * 2}px


问:
Copy environment tag from ebs to existing Snaphots
I have EBS Snapshots, we added a new tag called environment  to all EBS volumes. Old snap shots created from that do not have this tag. Is there anyway using boto3 to copy these tags from the respective EBS volume & add them to snaphosts ? Thanks</p>


问:
USEMAP help needed - code not working as expected
I am building the stite at https://simard57.synology.me/LHVCResortMap/LHVCResortMap%20Simple.php#ResortMap and the USEMAP I am trying to code does not seem to be working. The snippet is

```<code>            <div class="Resort">
                <h1 id="ResortMap">Resort Map</h1>
                <img src="High Res/Resort-Map Blue Labeled 10-6-22.jpg" alt="Full Map of the Resort" width="100%" height="auto" usemap="#ResortMap">
                <map name="ResortMap">
                <!-- Villa -->
                    <area alt="Royal Villas" title="Royal Villas" href="#RoyalVillas" coords="757,1112,81" shape="circle">
                    <area alt="Crown Villas North" title="Crown Villas" href="#CrownVillas" coords="1037,575,84" shape="circle">
                    <area alt="Crown Villas South" title="Crown Villas" href="#CrownVillas" coords="1377,1080,81" shape="circle">
                    <area alt="Cliff Villas" title="Cliff Villas" href="#CliffVillas" coords="991,312,72" shape="circle">
                    <area alt="Villa Park Villas" title="Villa Park Villas" href="#VillaParkVillas" coords="1395,1606,75" shape="circle">
                    <area alt="Royal Lake Village" title="Royal Lake Village" href="#RoyalLake" coords="1754,1760,85" shape="circle">
                    <area alt="Overflow Villas" title="Overflow Villas" href="#OverflowVillas" coords="46,1048,127,1262" shape="rect">
                <!-- Apartments -->
                    <area alt="Sunrise Suites" title="Sunrise Suites" href="#ResortInfo" coords="526,1175,90" shape="circle">
                    <area alt="Presidential Suites" title="Presidential Suites" href="#ResortInfo" coords="214,1325 375,1146 453,1233 295,1401 295,1401 " shape="polygon">
                    <area alt="Royal Suites" title="Royal Suites" href="#ResortInfo" coords="875,716,999,863" shape="rect">
                    <area alt="Residence Suites" title="Residence Suites" href="#ResortInfo" coords="693,1311 910,1220 933,1346 739,1409 733,1377 736,1412 " shape="polygon">
                    <area alt="Crowne Suites" title="Crowne Suites" href="#ResortInfo" coords="554,1389,84" shape="circle">
                <!-- Hotels -->
                    <area alt="Tropical Hotel" title="Tropical Hotel" href="#ResortInfo" coords="719,809,87" shape="circle">
                    <area alt="Cofresi Palm Beach Spa and Resort" title="Cofresi Palm Beach Spa and Resort" href="#ResortInfo" coords="300,936,90" shape="circle">
                </map>
            </div>

</code>```

the clickable areas used to work until I swapped out the map image for one that was higher resolution. I recreated the AREA coordinates using https://www.imagemap.org/

Body:
I am building the stite at https://simard57.synology.me/LHVCResortMap/LHVCResortMap%20Simple.php#ResortMap and the USEMAP I am trying to code does not seem to be working. The snippet is

Resort Map

                <map name="ResortMap">

                    <area alt="Royal Villas" title="Royal Villas" href="#RoyalVillas" coords="757,1112,81" shape="circle">
                    <area alt="Crown Villas North" title="Crown Villas" href="#CrownVillas" coords="1037,575,84" shape="circle">
                    <area alt="Crown Villas South" title="Crown Villas" href="#CrownVillas" coords="1377,1080,81" shape="circle">
                    <area alt="Cliff Villas" title="Cliff Villas" href="#CliffVillas" coords="991,312,72" shape="circle">
                    <area alt="Villa Park Villas" title="Villa Park Villas" href="#VillaParkVillas" coords="1395,1606,75" shape="circle">
                    <area alt="Royal Lake Village" title="Royal Lake Village" href="#RoyalLake" coords="1754,1760,85" shape="circle">
                    <area alt="Overflow Villas" title="Overflow Villas" href="#OverflowVillas" coords="46,1048,127,1262" shape="rect">

                    <area alt="Sunrise Suites" title="Sunrise Suites" href="#ResortInfo" coords="526,1175,90" shape="circle">
                    <area alt="Presidential Suites" title="Presidential Suites" href="#ResortInfo" coords="214,1325 375,1146 453,1233 295,1401 295,1401 " shape="polygon">
                    <area alt="Royal Suites" title="Royal Suites" href="#ResortInfo" coords="875,716,999,863" shape="rect">
                    <area alt="Residence Suites" title="Residence Suites" href="#ResortInfo" coords="693,1311 910,1220 933,1346 739,1409 733,1377 736,1412 " shape="polygon">
                    <area alt="Crowne Suites" title="Crowne Suites" href="#ResortInfo" coords="554,1389,84" shape="circle">

                    <area alt="Tropical Hotel" title="Tropical Hotel" href="#ResortInfo" coords="719,809,87" shape="circle">
                    <area alt="Cofresi Palm Beach Spa and Resort" title="Cofresi Palm Beach Spa and Resort" href="#ResortInfo" coords="300,936,90" shape="circle">
                </map>

the clickable areas used to work until I swapped out the map image for one that was higher resolution. I recreated the AREA coordinates using https://www.imagemap.org/


问:
What is the best solution to load the correct gpio mapping for atmega328p in ghidra
All the tutorials I found use the default AVR8 default 16 litle gcc configuration when importing the binary.
After importing the file with this configuration the gpio register mapping is completely messed up.

What is the best solution to load the correct gpio mapping for atmega328p in ghidra ?

In the scripts managers we can find CreateAVR8GDTArchiveScript but when I run the script ghidra asks for a location for the output and then errors out because it does not find the avr headers

Where does ghidra look for the avr headers when CreateAVR8GDTArchiveScript is ran ?


问:
Adding Images to animations in plotly (R)
I am trying to create an animation where an image has to move together with the dot that you can see in this image:

I have a dataset about Formula 1 and I want to show the image of the car instead of the dot in the image.

Here you have a summary of my dataset:

And the code of the graph:

```<code>prep = data[data$year == 2021,] %>% split(.$date) %>% accumulate(., ~bind_rows(.x,.y))%>%
  bind_rows(.id = "frame")

prep2 = data[data$year == 2021,] %>% split(.$date) %>%
  bind_rows(.id = "frame")

prep%>%
  plot_ly(x = ~name, y = ~points, color = ~factor(name)) %>%
  add_lines(frame =  ~as.Date(frame, format = '%Y-%m-%d'))%>%
  add_markers(data = prep2, frame =  ~as.Date(frame, format = '%Y-%m-%d'))%>%
layout(yaxis = list(title = 'Puntos'),showlegend = FALSE,xaxis = list(title = 'Fecha de la carrera',range = c(as.Date(min(data$date[data$year == 2021]), format="%d/%m/%Y"),as.Date(max(data$date[data$year == 2021]), format="%d/%m/%Y"))))%>%
animation_slider(currentvalue = list(prefix = "Carrera "))
</code>```

Body:
I am trying to create an animation where an image has to move together with the dot that you can see in this image:

I have a dataset about Formula 1 and I want to show the image of the car instead of the dot in the image.

Here you have a summary of my dataset:

And the code of the graph:

prep = data[data$year == 2021,] %>% split(.$date) %>% accumulate(., ~bind_rows(.x,.y))%>%
  bind_rows(.id = "frame")

prep2 = data[data$year == 2021,] %>% split(.$date) %>%
  bind_rows(.id = "frame")

prep%>%
  plot_ly(x = ~name, y = ~points, color = ~factor(name)) %>%
  add_lines(frame =  ~as.Date(frame, format = '%Y-%m-%d'))%>%
  add_markers(data = prep2, frame =  ~as.Date(frame, format = '%Y-%m-%d'))%>%
layout(yaxis = list(title = 'Puntos'),showlegend = FALSE,xaxis = list(title = 'Fecha de la carrera',range = c(as.Date(min(data$date[data$year == 2021]), format="%d/%m/%Y"),as.Date(max(data$date[data$year == 2021]), format="%d/%m/%Y"))))%>%
animation_slider(currentvalue = list(prefix = "Carrera "))


问:
Grok pattern: Extract pattern name from Grok pattern json result for GrayLog
I am new to grok syntax and terms, but by using GrayLog and field extracting I encountered with problem to extract a necessary value in results for my extractor. I need to extract specific fiel from service result.

Service result has such syntax:

```<code>{"field1":123, "field2":a, "field3":u1b1}
</code>```

I need to extract "field2" value as a new field x.

My Grok pattern looks like this:

```<code>"field2":%{WORD:X}
</code>```

As a result I get almoust the result I need, but with additional value:

```<code>{
"PatternName": "\"field2\":a",
"X": "a"
}
</code>```

In Graylog result extraction looks like this:

```<code>PatternName
"field2":a
</code>```

How to get rid of the first row of my pattern ("PatternName": ""field2":a")?

Thank you!

Body:
I am new to grok syntax and terms, but by using GrayLog and field extracting I encountered with problem to extract a necessary value in results for my extractor. I need to extract specific fiel from service result.

Service result has such syntax:

{"field1":123, "field2":a, "field3":u1b1}

I need to extract "field2" value as a new field x.

My Grok pattern looks like this:

"field2":%{WORD:X}

As a result I get almoust the result I need, but with additional value:

{
"PatternName": "\"field2\":a",
"X": "a"
}

In Graylog result extraction looks like this:

PatternName
"field2":a

How to get rid of the first row of my pattern ("PatternName": ""field2":a")?

Thank you!


问:
Difference assertions and expectations in PEST (PHP)
I am starting to use PEST in my Laravel-project. I started to read the documentation and saw that both assert and expect exists but I see no real explanation on their difference.

Can someone please tell me the difference and when to use what?


问:
pymc how do i add dims to gaussian mixture model
I am struggling with the below issue.  Suppose I have a gaussian mixture (3 components) but I want to do have individual weights per group (two groups in the below - so i would expect w to be of shape (2,3).  How do I achieve this?

Tried with coords and with NormalMixture, and different variations of shape?  Pymc 4.3 but also tried with pymc 5.x.

data=[45,56,78,99,45,64]
groups=[0,1,1,0,1,0]
with pm.Model() as model:
    mu = pm.Normal('mu', mu=50,sigma=10, shape=(3,))
    components = pm.Normal.dist(mu=mu, shape=(3,))
    w = pm.Dirichlet('w', a=np.array([1, 1,1]))  # two mixture component weights.
    like = pm.Mixture('like', w=w, comp_dists=components, observed=data)
    trace=pm.sample()
```


问:
How to set postfix serverA sending mails for post postfix serverB, serverC
I want to use postfix at my serverB (fictive ip: 1.2.3.4) and postfix at my serverC (fictive ip: 5.6.7.8) to send all its outgoing mails via my postfix at my serverA (fictive ip: 120.230.140.150), so that serverA is the one sending those mails to the world. Note that serverA, serverB en serverC are NOT in the same (local) network. Is it possible? And if so, what do I need to do to make it work as described?

KevinX


问:
What is the time complexity of findOne and updateOne by _id in MongoDB?
Since _id is the primary key of a MongoDB collection, does it work the same as a key in HashMap where finding a key-value pair has a time complexity of O(1)?

For example, if I do

```<code>db.collection.findOne({"_id": id})
</code>```

or

```<code>db.collection.updateOne({"_id": id}, {$set : {field: data}});
</code>```

in a collection that contains one million records, does the operation have a time complexity of O(1) and finding the collection requires an instant time?

Body:
Since _id is the primary key of a MongoDB collection, does it work the same as a key in HashMap where finding a key-value pair has a time complexity of O(1)?

For example, if I do

db.collection.findOne({"_id": id})

or

db.collection.updateOne({"_id": id}, {$set : {field: data}});

in a collection that contains one million records, does the operation have a time complexity of O(1) and finding the collection requires an instant time?


问:
JMapper XML Map to a single value
I'm looking how to handle a Map<String,String> map; to get a key value from it. For example in dozer :

```<code><a map-get-method="get" key="valueFromTheMap">map</a>

</code>```

Thank you

ManyToOne? https://github.com/jmapper-framework/jmapper-core/wiki/Many-To-One

Title: JMapper XML Map to a single value

Body:
I'm looking how to handle a Map<String,String> map; to get a key value from it. For example in dozer :

map

Thank you

ManyToOne? https://github.com/jmapper-framework/jmapper-core/wiki/Many-To-One


问:
why my submit form not working on mobile phone?
I use laravel 9 and i have a registration form and submit button for some reason doesn't work in mobile phone only, but its working fine in desktop. Any idea what wrong? Thankyou!

Html (blade):

```<code><form action="{{ route('jokibukti') }}" method="POST">
               @csrf
 <td width="25%">{{ $item->keterangan }} <input type="text"
  id="ketbaru" name="keteranganbaru" class="form-control"
         placeholder="Masukan Bonus Disini!"></td>
 {{-- <td width="7%"><a class="btn btn-primary btn-sm" onclick=''>Selesai</a> --}}
    <td width="25%">
     <input type="hidden" name="id" value="{{ $item->id }}">
             <label class="">
               <span class="sr-only">Pilih Gambar</span>

               <input type="file" name="image" class="" />
    @error('image')
               <span class="text-red-600 text-sm">{{ $message }}</span>
    @enderror
               </label>
     <button type="submit" value="submit"  class="btn btn-primary btn-sm">Submit</button>
 </form>

</code>```

Route :

```<code>  Route::post('/joki/bukti', [ControllerJoki::class, 'buktiselesai'])->name('jokibukti');

</code>```

Controller :

```<code> public function buktiselesai(Request $request)
    {
        // @dd($request->image);
        $this->validate($request, [
            'image' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048',
        ]);

        $ketbaru = $request->keteranganbaru;
        $ketlamauser = Jokiongoing::where('id', $request->id)->first();
        $ketlama = $ketlamauser->keterangan;
        if ($ketlama != "") {
            $keterangan = $ketlama . " & " . $ketbaru;
        } else {
            $keterangan = $ketbaru;
        }
        // $image_path = $request->file('image')->store('buktijoki', 'public');
        $imageName = time() . '.' . $request->image->extension();

        $request->image->move(public_path('buktijoki'), $imageName);

        $data = Jokiongoing::where('id', $request->id)->update([
            'bukti' => $imageName,
            'keterangan' => $keterangan,
            'acc' => '1',
        ]);

        if ($data) {
            return redirect()->route('jokiaktif')->with(['success' => 'Bukti Berhasil disimpan']);
        } else {
            return redirect()->route('jokiaktif')->with(['error' => 'Bukti Gagal Disimpan']);
        }
    }
</code>```
```<code>    <script>
        var tap = true;
        document.addEventListener('touchstart', function(e) {
            tap = true;
        });
        document.addEventListener('touchmove', function(e) {
            tap = false;
        });
        document.addEventListener('touchend', function(e) {
            if (tap) {
                //users tapped the screen
            }
        });
    </script>
</code>```

Trying adding this script from someone in the stackoverflow, but get nothing as result.

Im try to add onClick to the button

```<code><button onClick = "testsubmit()" value="submit"  class="btn btn-primary btn-sm">Submit</button>
</code>```
```<code>    <script>
        function testsubmit() {
          alert("masuk");
        }
        </script>
</code>```

and its work fine, what happen to type="submit" ?

Body:
I use laravel 9 and i have a registration form and submit button for some reason doesn't work in mobile phone only, but its working fine in desktop. Any idea what wrong? Thankyou!

Html (blade):

<form action="{{ route('jokibukti') }}" method="POST">
               @csrf
 {{ $item->keterangan }} <input type="text"
  id="ketbaru" name="keteranganbaru" class="form-control"
         placeholder="Masukan Bonus Disini!">
 {{-- Selesai --}}

     <input type="hidden" name="id" value="{{ $item->id }}">

               Pilih Gambar

               <input type="file" name="image" class="" />
    @error('image')
               {{ $message }}
    @enderror

     <button type="submit" value="submit"  class="btn btn-primary btn-sm">Submit</button>
 </form>

Route :

  Route::post('/joki/bukti', [ControllerJoki::class, 'buktiselesai'])->name('jokibukti');

Controller :

 public function buktiselesai(Request $request)
    {
        // @dd($request->image);
        $this->validate($request, [
            'image' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048',
        ]);

        $ketbaru = $request->keteranganbaru;
        $ketlamauser = Jokiongoing::where('id', $request->id)->first();
        $ketlama = $ketlamauser->keterangan;
        if ($ketlama != "") {
            $keterangan = $ketlama . " & " . $ketbaru;
        } else {
            $keterangan = $ketbaru;
        }
        // $image_path = $request->file('image')->store('buktijoki', 'public');
        $imageName = time() . '.' . $request->image->extension();

        $request->image->move(public_path('buktijoki'), $imageName);

        $data = Jokiongoing::where('id', $request->id)->update([
            'bukti' => $imageName,
            'keterangan' => $keterangan,
            'acc' => '1',
        ]);

        if ($data) {
            return redirect()->route('jokiaktif')->with(['success' => 'Bukti Berhasil disimpan']);
        } else {
            return redirect()->route('jokiaktif')->with(['error' => 'Bukti Gagal Disimpan']);
        }
    }

Trying adding this script from someone in the stackoverflow, but get nothing as result.

Im try to add onClick to the button

<button onClick = "testsubmit()" value="submit"  class="btn btn-primary btn-sm">Submit</button>

and its work fine, what happen to type="submit" ?


问:
Sets Not Showing "In" Function Tableau Public
When trying to create a set using tableau public, I create the parameter with no problem but when I try to create the set, not only does it create the set in the dimension category instead of a separate sets category for some reason, it doesn't show an "In" option in the filter, only an "Out". Also yes I know you are supposed to have the set in the "Filters" section, but I was just trying other stuff to see if I could get it to work.

I have tried everything I can think of however I cannot get the "In" option to appear in the sets filter. I have also tried googling my problem and cannot find a single instance of someone experience the same problem that I am now. If anyone could provide some assistance as to why this may be that would be great.


问:
Powershell Downloadstring giving timeout - can I set timeout or use a different method?
I have two urls that trigger a webservice. I need to schedule triggering these as tasks. So this is how I scheduled the first one.

```<code>$url="https://dd.com/dd/RunScheduledTask.aspx?Action=executespecificscheduledmacro&Macro=fetch"
(New-Object System.Net.WebClient).DownloadString("$url");
</code>```

The above works. I tried invoke-webrequest but it doesn't seem to actually trigger the webservce.

I need to trigger a second web service by going to a different url. Using the method above I get

```<code>Exception calling "DownloadString" with "1" argument(s): "The operation has timed out"
</code>```

The second url looks like

https://dd.com/dd/RunScheduledTask.aspx?Action=executespecificscheduledmacro&Macro=import

Is there a way to set the timeout / expose the timeout or another method I can use?

I just need to load the url and it runs a webservice. It doesn't load a page or anything. Obviously wanting to run in background.

Body:
I have two urls that trigger a webservice. I need to schedule triggering these as tasks. So this is how I scheduled the first one.

$url="https://dd.com/dd/RunScheduledTask.aspx?Action=executespecificscheduledmacro&Macro=fetch"
(New-Object System.Net.WebClient).DownloadString("$url");

The above works. I tried invoke-webrequest but it doesn't seem to actually trigger the webservce.

I need to trigger a second web service by going to a different url. Using the method above I get

Exception calling "DownloadString" with "1" argument(s): "The operation has timed out"

The second url looks like

https://dd.com/dd/RunScheduledTask.aspx?Action=executespecificscheduledmacro&Macro=import

Is there a way to set the timeout / expose the timeout or another method I can use?

I just need to load the url and it runs a webservice. It doesn't load a page or anything. Obviously wanting to run in background.