问:
cucumber/formatter/legacy_api/ast (LoadError) when updating cucumber
I'm upgrading Ruby from version 2.5.1 to 2.7.2.
So, I'm Upgrading Cucumber from 3.1.2 to the latest version 8.0.0.rc.1
I'm just learning Ruby as I work, so I'm sorry if I ask any question that is too easy for you.

The stack for the error is:

loading content yaml support/data/static_content.yaml
loading environment yaml support/environments/stage.yaml
cannot load such file -- cucumber/formatter/legacy_api/ast (LoadError)
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `require'
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `require'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `load_code_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:145:in `load_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:82:in `block in load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `each'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:274:in `load_step_definitions'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:74:in `run!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/bin/cucumber:9:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `load'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `eval'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `'
[acabista@acabista cucumber]$ ./start_auto.sh
loading content yaml support/data/static_content.yaml
loading environment yaml support/environments/stage.yaml
cannot load such file -- cucumber/formatter/legacy_api/ast (LoadError)
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `require'
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `require'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `load_code_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:145:in `load_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:82:in `block in load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `each'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:274:in `load_step_definitions'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:74:in `run!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/bin/cucumber:9:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `load'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `eval'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `'
```
<p>These are the first 2 lines from the file <code>rerun_file.rb</code> that is throwing the error:</p>
<pre class="lang-rb prettyprint-override"><code>require 'cucumber/formatter/io'
require 'cucumber/formatter/legacy_api/ast'
</code>```

And I just use Ast in two parts of my code:

!(Cucumber::Formatter::LegacyApi::Ast::ScenarioOutline === feature_element)
```
<pre class="lang-rb prettyprint-override"><code>Cucumber::Ast::OutlineTable::ExampleRow === table_row
</code>```

I can't post more of the code because it's proprietary.

I already tried some other things that I found here in stackoverflow but nothing seems to work, and I really want to upgrade Cucumber, so going back to 3.1.2 is not a fix. How can I do that?

Body:
I'm upgrading Ruby from version 2.5.1 to 2.7.2.
So, I'm Upgrading Cucumber from 3.1.2 to the latest version 8.0.0.rc.1
I'm just learning Ruby as I work, so I'm sorry if I ask any question that is too easy for you.

The stack for the error is:

loading content yaml support/data/static_content.yaml
loading environment yaml support/environments/stage.yaml
cannot load such file -- cucumber/formatter/legacy_api/ast (LoadError)
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `require'
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `require'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `load_code_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:145:in `load_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:82:in `block in load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `each'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:274:in `load_step_definitions'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:74:in `run!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/bin/cucumber:9:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `load'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `eval'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `'
[acabista@acabista cucumber]$ ./start_auto.sh
loading content yaml support/data/static_content.yaml
loading environment yaml support/environments/stage.yaml
cannot load such file -- cucumber/formatter/legacy_api/ast (LoadError)
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `require'
/home/acabista/Documents/automations/web-automation/cucumber/support/patches/rerun_file.rb:2:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `require'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb:123:in `load_code_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:145:in `load_file'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:82:in `block in load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `each'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb:81:in `load_files!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:274:in `load_step_definitions'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/runtime.rb:74:in `run!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/lib/cucumber/cli/main.rb:29:in `execute!'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/gems/cucumber-8.0.0/bin/cucumber:9:in `<top (required)>'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `load'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/cucumber:23:in `'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `eval'
/home/acabista/.rvm/gems/ruby-2.7.2@web-automation/bin/ruby_executable_hooks:24:in `'

These are the first 2 lines from the file rerun_file.rb that is throwing the error:

require 'cucumber/formatter/io'
require 'cucumber/formatter/legacy_api/ast'

And I just use Ast in two parts of my code:

!(Cucumber::Formatter::LegacyApi::Ast::ScenarioOutline === feature_element)

Cucumber::Ast::OutlineTable::ExampleRow === table_row

I can't post more of the code because it's proprietary.

I already tried some other things that I found here in stackoverflow but nothing seems to work, and I really want to upgrade Cucumber, so going back to 3.1.2 is not a fix. How can I do that?


来源: stackexchange

问:
Android Studio Electric Eel Preview missing option to enable Live Edit
Android Studio Electric Eel Preview version allows for Live Edits but I don't see an option to turn it on in the settings. I only see an option to turn on Live Edit of Literals in the Live Edit options dialog. I downloaded Eel from this Google page. How can I enable Live Edit?

This should be displayed

But It's missing from my copy of Eel

ContentLicense: CC BY-SA 4.0


问:
Ajax post request don't work with flask route
I'm trying to build  a 'like' button with ajax and flask,but when I try to get the string for the button to decide which button was clicked,my alert always return 'None'.

flask relevant part:

```<code>@bp.route('/<int:id>/post', methods=('GET', 'POST'))
@login_required
def show_post(id):
    my_opinion=request.form.get("opinion")
    my_post=get_post(id,False)
    if request.method == 'POST':
        opi = request.form.get("opinion")
        if opi == 'Like':
           update_like(id,my_post,g.user['id'])
           my_opinion='like'
        elif opi == 'Dislike':
           update_dislike(id,my_post,g.user['id'])
           my_opinion='dislike'

    user_info=g.user['id']
    user_new = get_db().execute(
         'SELECT liked_posts,disliked_posts'
         ' FROM user u'
         ' WHERE id = ?',
         (user_info,)
    ).fetchone()

    return render_template('blog/show.html',post=my_post,user=user_new,my=my_opinion)
</code>```

ajax part:

```<code><script src="https://code.jquery.com/jquery-3.5.1.js"
          integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
          crossorigin="anonymous"></script>
<script type="text/javascript">
    $(document).on('submit','.opin',function(e)
                   {
      e.preventDefault();
      $.ajax({
        type:'POST',
        url:'/1/post?author=josh',
        data:{
          opinion:"check"
        },
        success:function()
        {
            const new_opinion = document.getElementsByClassName("opinion");
            let special = "{{my}}";
            alert(special);
            const cssObj = window.getComputedStyle(new_opinion[0], null);
            let bgColor = cssObj.getPropertyValue("background-color");
            if (bgColor=='rgb(128, 128, 128)'){
                bgColor="linear-gradient(144deg,#AF40FF, #5B42F3 50%,#00DDEB)";
            }
            else{
            bgColor="gray"
            }
            new_opinion[0].style.background=bgColor;
        }
      })
    });
  </script>
</code>```

This part alert 'None':

```<code>let special = "{{my}}";
alert(special);
</code>```

I'm trying to get 'check' string into 'my' template parameter.

Body:
I'm trying to build  a 'like' button with ajax and flask,but when I try to get the string for the button to decide which button was clicked,my alert always return 'None'.

flask relevant part:

@bp.route('/<int:id>/post', methods=('GET', 'POST'))
@login_required
def show_post(id):
    my_opinion=request.form.get("opinion")
    my_post=get_post(id,False)
    if request.method == 'POST':
        opi = request.form.get("opinion")
        if opi == 'Like':
           update_like(id,my_post,g.user['id'])
           my_opinion='like'
        elif opi == 'Dislike':
           update_dislike(id,my_post,g.user['id'])
           my_opinion='dislike'

    user_info=g.user['id']
    user_new = get_db().execute(
         'SELECT liked_posts,disliked_posts'
         ' FROM user u'
         ' WHERE id = ?',
         (user_info,)
    ).fetchone()

    return render_template('blog/show.html',post=my_post,user=user_new,my=my_opinion)

ajax part:

This part alert 'None':

let special = "{{my}}";
alert(special);

I'm trying to get 'check' string into 'my' template parameter.


问:
DevOps Assembly Info task Issues in build pipeline with .Net 6 Solution
All,

I am attempting to add an assembly info taskto a build pipeline for all projects in a .Net 6 solution.

The task is failing for some projects and succeeding with others and terminating with an error the logging for which is as follows

```<code>Setting .Net Core / .Net Standard assembly info...

Processing: D:\A\F5\_work\15\s\MyCompany.Core.Domain.Context\MyCompany.Core.Domain.Context.csproj
Detected file encoding: utf-8
##[error]Error reading file: null

Processing: D:\A\F5\_work\15\s\MyCompany.Identity.Api\MyCompany.Identity.Api.csproj
Detected file encoding: utf-8
Verify file encoding: iso-8859-2

Processing: D:\A\F5\_work\15\s\MyCompany.IdentityServer.Services\MyCompany.Identity.Services.IS4.csproj
Detected file encoding: iso-8859-1
Verify file encoding: iso-8859-1

ApplicationInsights:CorrelationIdManager [ { Error: connect ETIMEDOUT 52.138.227.130:443
      at Object.exports._errnoException (util.js:1020:11)
      at exports._exceptionWithHostPort (util.js:1043:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
    code: 'ETIMEDOUT',
    errno: 'ETIMEDOUT',
    syscall: 'connect',
    address: '52.138.227.130',
    port: 443 } ]
</code>```

Issue 1: ##[error]Error reading file: null

Based on the fact that

successful processing of a .csproj file is accompanied by a 'Detected file encoding' a 'Verify file encoding'

failed processing of a .csproj file is accompanied by a 'Detected file encoding' only
I'm thinking this could be due to the encoding of the files?

If I inspect each of the processed project files in my solution on my laptop using Notepad++ I can see that MyCompany.Identity.Services.IS4.csproj, which appears to be processed successfully, is UTF-8 but the other two are UTF-8-BOM so there's not consistency there.

However if I look at the corresponding files copied to the build server, the encoding has changed.

The two that succeed are UTF-8 but the one that has the error ##[error]Error reading file: null is UTF-8-BOM.

Firstly, why is the encoding changing between being on my laptop, pushed to Azure Repos Git and then copied to the build server by the pipeline?

Secondly, why doe a file get detected with one encoding but verified as another, as is the case with MyCompany.Identity.Api.csproj

Finally, why is the UTF-8-BOMfile failing and how can I prevent this?

Issue 2: Error: connect ETIMEDOUT

I've no idea where to start with that one so any pointers would be gratefully received.

Thanks in advance

Body:
All,

I am attempting to add an assembly info taskto a build pipeline for all projects in a .Net 6 solution.

The task is failing for some projects and succeeding with others and terminating with an error the logging for which is as follows

Setting .Net Core / .Net Standard assembly info...

Processing: D:\A\F5\_work\15\s\MyCompany.Core.Domain.Context\MyCompany.Core.Domain.Context.csproj
Detected file encoding: utf-8
##[error]Error reading file: null

Processing: D:\A\F5\_work\15\s\MyCompany.Identity.Api\MyCompany.Identity.Api.csproj
Detected file encoding: utf-8
Verify file encoding: iso-8859-2

Processing: D:\A\F5\_work\15\s\MyCompany.IdentityServer.Services\MyCompany.Identity.Services.IS4.csproj
Detected file encoding: iso-8859-1
Verify file encoding: iso-8859-1

ApplicationInsights:CorrelationIdManager [ { Error: connect ETIMEDOUT 52.138.227.130:443
      at Object.exports._errnoException (util.js:1020:11)
      at exports._exceptionWithHostPort (util.js:1043:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
    code: 'ETIMEDOUT',
    errno: 'ETIMEDOUT',
    syscall: 'connect',
    address: '52.138.227.130',
    port: 443 } ]

Issue 1: ##[error]Error reading file: null

Based on the fact that

successful processing of a .csproj file is accompanied by a 'Detected file encoding' a 'Verify file encoding'

failed processing of a .csproj file is accompanied by a 'Detected file encoding' only
I'm thinking this could be due to the encoding of the files?

If I inspect each of the processed project files in my solution on my laptop using Notepad++ I can see that MyCompany.Identity.Services.IS4.csproj, which appears to be processed successfully, is UTF-8 but the other two are UTF-8-BOM so there's not consistency there.

However if I look at the corresponding files copied to the build server, the encoding has changed.

The two that succeed are UTF-8 but the one that has the error ##[error]Error reading file: null is UTF-8-BOM.

Firstly, why is the encoding changing between being on my laptop, pushed to Azure Repos Git and then copied to the build server by the pipeline?

Secondly, why doe a file get detected with one encoding but verified as another, as is the case with MyCompany.Identity.Api.csproj

Finally, why is the UTF-8-BOMfile failing and how can I prevent this?

Issue 2: Error: connect ETIMEDOUT

I've no idea where to start with that one so any pointers would be gratefully received.

Thanks in advance


问:
Elasticsearch aggragation buckets sorting with two fields
I am working on elasticsearch and I hve an Index with following objects :

```<code>{
  merchant_name : text,
  price : number,
  product_name : text
},
</code>```

When I search for some product name, I would like to create aggregation that groupes products by merchant in buckets and sort those buckets by max relevance score, and than if two buckets have same relevance score, look for the one who has the lowest product price.

I have now something Like that to group by merchant max-score, but couldn't add the equivalence case sorting :

```<code>{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "tomato",
            "fuzziness": 1,
            "prefix_length": 5,
            "fields": [
              "product_name", "product_name.keyword"
            ]
          }
        }
      ]
    }
  },
  "aggs": {
    "groupByMerchant": {
      "terms": {
        "field": "merchant_name.keyword",
        "order": {
          "max_score": "desc"
        }
      },
      "aggs": {
        "max_score": {
          "max": {
            "script": "_score"
          }
        }
      }
    }
  }
}
</code>```

Body:
I am working on elasticsearch and I hve an Index with following objects :

{
  merchant_name : text,
  price : number,
  product_name : text
},

When I search for some product name, I would like to create aggregation that groupes products by merchant in buckets and sort those buckets by max relevance score, and than if two buckets have same relevance score, look for the one who has the lowest product price.

I have now something Like that to group by merchant max-score, but couldn't add the equivalence case sorting :

{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "tomato",
            "fuzziness": 1,
            "prefix_length": 5,
            "fields": [
              "product_name", "product_name.keyword"
            ]
          }
        }
      ]
    }
  },
  "aggs": {
    "groupByMerchant": {
      "terms": {
        "field": "merchant_name.keyword",
        "order": {
          "max_score": "desc"
        }
      },
      "aggs": {
        "max_score": {
          "max": {
            "script": "_score"
          }
        }
      }
    }
  }
}


问:
Append records to existing hive table does not write all records
I am trying to append some records to an existing hive external table created from a csv file stored in HDFS. The problem is that only a portion of the dataset is written, can anyone help me?

Here is my code with 2 alternatives:

```<code>if fs.exists(jvm.org.apache.hadoop.fs.Path(analysis_result_path_formatted)):

   analysisFinal.write.format("hive")
                .mode("append")
                .saveAsTable(output_hive_db + "." + hive_table + "_analyzersresult")

    analysisFinal.write
                 .mode("append")
                 .insertInto(output_hive_db + "." + hive_table + "_analyzersresult" ,overwrite=False)
</code>```

I tried both the solutions but they write the same portion of the total records.

Also, here is the code for the original csv file and for the creation of the hive table:

```<code>#Writing to Analysis Result to HDFS
analysisFinal.coalesce(1).write.option("header","true")
             .option("delimiter","\t")
             .csv(hdfs_url + analysis_result_path_formatted)

create_analyzer_query_formatted = CREATE EXTERNAL TABLE IF NOT EXISTS {}.{}_AnalyzersResult (name STRING,entity STRING, value STRING, instance STRING, provenienza_tabella STRING, date STRING, table_name STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE LOCATION '{}' TBLPROPERTIES ("skip.header.line.count"="1")

#Creating external table based on previously written file
spark.sql(create_analyzer_query_formatted)
</code>```

Body:
I am trying to append some records to an existing hive external table created from a csv file stored in HDFS. The problem is that only a portion of the dataset is written, can anyone help me?

Here is my code with 2 alternatives:

if fs.exists(jvm.org.apache.hadoop.fs.Path(analysis_result_path_formatted)):

   analysisFinal.write.format("hive")
                .mode("append")
                .saveAsTable(output_hive_db + "." + hive_table + "_analyzersresult")

    analysisFinal.write
                 .mode("append")
                 .insertInto(output_hive_db + "." + hive_table + "_analyzersresult" ,overwrite=False)

I tried both the solutions but they write the same portion of the total records.

Also, here is the code for the original csv file and for the creation of the hive table:

#Writing to Analysis Result to HDFS
analysisFinal.coalesce(1).write.option("header","true")
             .option("delimiter","\t")
             .csv(hdfs_url + analysis_result_path_formatted)

create_analyzer_query_formatted = CREATE EXTERNAL TABLE IF NOT EXISTS {}.{}_AnalyzersResult (name STRING,entity STRING, value STRING, instance STRING, provenienza_tabella STRING, date STRING, table_name STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE LOCATION '{}' TBLPROPERTIES ("skip.header.line.count"="1")

#Creating external table based on previously written file
spark.sql(create_analyzer_query_formatted)


问:
How run minio on docker-compose + nginx reverse proxy?
I have problem with minio, not started on selected domain - 502 error.

my docker-compose.yml for nginx proxy reverse + le

```<code>services:
    nginx:
        container_name: nginx
        image: nginxproxy/nginx-proxy
        restart: unless-stopped
        ports:
            - 80:80
            - 443:443
        volumes:
            - /var/run/docker.sock:/tmp/docker.sock:ro
            - /var/docker/nginx/html:/usr/share/nginx/html
            - /var/docker/nginx/certs:/etc/nginx/certs
            - /var/docker/nginx/vhost:/etc/nginx/vhost.d
        logging:
            options:
                max-size: "10m"
                max-file: "3"

    letsencrypt-companion:
        container_name: nginx-le
        image: jrcs/letsencrypt-nginx-proxy-companion
        restart: unless-stopped
        volumes_from:
            - nginx
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - /var/docker/nginx/acme:/etc/acme.sh
        environment:
            DEFAULT_EMAIL: mail@mail.com
</code>```

docker-compose.yml for minio

```<code>version: '2'

services:
  minio:
    container_name: minio.domain.com
    command: server /data --console-address ":9001"
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=supersecret
      - MINIO_BROWSER_REDIRECT_URL=https://minio.domain.com
      - MINIO_DOMAIN=minio.domain.com
    image: quay.io/minio/minio:latest
    volumes:
      - minio:/data
    restart: unless-stopped
    expose:
      - "9000"
      - "9001"
    environment:
      VIRTUAL_HOST: minio.domain.com
      LETSENCRYPT_HOST:  minio.domain.com
    networks:
      - proxy

networks:
  proxy:
    external:
      name: nginx_default

volumes:
 minio:
</code>```

logs from docker logs for minio container

```<code>Warning: Default parity set to 0. This can lead to data loss.
WARNING: Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables
MinIO Object Storage Server
Copyright: 2015-2022 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2022-12-12T19-27-27Z (go1.19.4 linux/amd64)

Status:         1 Online, 0 Offline.
API: http://192.168.0.7:9000  http://127.0.0.1:9000
Console: http://192.168.0.7:9001 http://127.0.0.1:9001

Documentation: https://min.io/docs/minio/linux/index.html
</code>```

When I put in docker-compose for minio:

```<code>   ports:
      - '9000:9000'
      - '9001:9001'
</code>```

Minio working, but for all domain on my server.
How I can fix that minio show only on minio.domain.com ?

Body:
I have problem with minio, not started on selected domain - 502 error.

my docker-compose.yml for nginx proxy reverse + le

services:
    nginx:
        container_name: nginx
        image: nginxproxy/nginx-proxy
        restart: unless-stopped
        ports:
            - 80:80
            - 443:443
        volumes:
            - /var/run/docker.sock:/tmp/docker.sock:ro
            - /var/docker/nginx/html:/usr/share/nginx/html
            - /var/docker/nginx/certs:/etc/nginx/certs
            - /var/docker/nginx/vhost:/etc/nginx/vhost.d
        logging:
            options:
                max-size: "10m"
                max-file: "3"

    letsencrypt-companion:
        container_name: nginx-le
        image: jrcs/letsencrypt-nginx-proxy-companion
        restart: unless-stopped
        volumes_from:
            - nginx
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - /var/docker/nginx/acme:/etc/acme.sh
        environment:
            DEFAULT_EMAIL: mail@mail.com

docker-compose.yml for minio

version: '2'

services:
  minio:
    container_name: minio.domain.com
    command: server /data --console-address ":9001"
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=supersecret
      - MINIO_BROWSER_REDIRECT_URL=https://minio.domain.com
      - MINIO_DOMAIN=minio.domain.com
    image: quay.io/minio/minio:latest
    volumes:
      - minio:/data
    restart: unless-stopped
    expose:
      - "9000"
      - "9001"
    environment:
      VIRTUAL_HOST: minio.domain.com
      LETSENCRYPT_HOST:  minio.domain.com
    networks:
      - proxy

networks:
  proxy:
    external:
      name: nginx_default

volumes:
 minio:

logs from docker logs for minio container

Warning: Default parity set to 0. This can lead to data loss.
WARNING: Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables
MinIO Object Storage Server
Copyright: 2015-2022 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2022-12-12T19-27-27Z (go1.19.4 linux/amd64)

Status:         1 Online, 0 Offline.
API: http://192.168.0.7:9000  http://127.0.0.1:9000
Console: http://192.168.0.7:9001 http://127.0.0.1:9001

Documentation: https://min.io/docs/minio/linux/index.html

When I put in docker-compose for minio:

   ports:
      - '9000:9000'
      - '9001:9001'

Minio working, but for all domain on my server.
How I can fix that minio show only on minio.domain.com ?


问:
How to change the font in a calplot plot?
I made a calendar heatmap using calplot. The documentation for calplot is here: https://calplot.readthedocs.io/en/latest/.

I want to change the font of the title and labels, but do not know how to change the label font. I only managed to change the title font. Calplot is built upon matplotlib and it can pass on arguments to matplotlib.

First I exclusively focused on matplotlib and changed its font like this:

```<code>csfont = {'fontname':'Open Sans'}
hfont = {'fontname':'Open Sans'}

plt.title('title',**csfont)
plt.xlabel('xlabel', **hfont)
</code>```

I then looked at the documentation of calplot and noticed the parameter suptitle_kws. I then tried to pass csfont as follows:

```<code>calplot.calplot(..., suptitle_kws=csfont)
</code>```

And this correctly changed the title font. However, I also want to change the other fonts (of the weekdays and the colorbar). I don't know how to do this.

Body:
I made a calendar heatmap using calplot. The documentation for calplot is here: https://calplot.readthedocs.io/en/latest/.

I want to change the font of the title and labels, but do not know how to change the label font. I only managed to change the title font. Calplot is built upon matplotlib and it can pass on arguments to matplotlib.

First I exclusively focused on matplotlib and changed its font like this:

csfont = {'fontname':'Open Sans'}
hfont = {'fontname':'Open Sans'}

plt.title('title',**csfont)
plt.xlabel('xlabel', **hfont)

I then looked at the documentation of calplot and noticed the parameter suptitle_kws. I then tried to pass csfont as follows:

calplot.calplot(..., suptitle_kws=csfont)

And this correctly changed the title font. However, I also want to change the other fonts (of the weekdays and the colorbar). I don't know how to do this.


问:
How to preserve spaces when working with XamlReader.Parse
I'm using this code:

```<code>        /// <summary>
        /// Converts from XAML markup to a WPF FlowDocument.
        /// </summary>
        public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            /* See http://stackoverflow.com/questions/897505/getting-a-flowdocument-from-a-xaml-template-file */

            var flowDocument = new FlowDocument();
            if (value != null)
            {
                var xamlText = (string) value;
                flowDocument = (FlowDocument)XamlReader.Parse(xamlText);
            }

            // Set return value
            return flowDocument;
        }

</code>```

My problem is that while basically conversion of raw strings to flow documents works fine, trailing spaces will be removed. I don't want the trailing spaces to be removed. How can I do that?

I tried adding xml tags I found on the Internet to the string (see xml:space="preserve" effect on space between XML attributes?) but it didn't help.

Edit: When I write

```<code>flowDocument = (FlowDocument)XamlReader.Parse("<TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xml:space='preserve'> <Run>" + xamlText + "</Run> </TextBlock>");
</code>```

I get an exception.

Edit: Thanks to andy for the hint - I've now figured out how to implement it, and it works.

```<code>                var xamlText = (string) value;
                var idx = xamlText.IndexOf("<Run");
                if (idx != -1)
                    xamlText = xamlText.Substring(0, idx) + "<TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xml:space='preserve'>" + xamlText.Substring(idx);
                idx = xamlText.IndexOf("</Run");
                if (idx != -1)
                    xamlText = xamlText.Substring(0, idx + 6) + "</TextBlock>" + xamlText.Substring(idx + 6);
                flowDocument = (FlowDocument)XamlReader.Parse(xamlText);
</code>```

Body:
I'm using this code:

        ///
        /// Converts from XAML markup to a WPF FlowDocument.
        ///
        public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            /* See http://stackoverflow.com/questions/897505/getting-a-flowdocument-from-a-xaml-template-file */

            var flowDocument = new FlowDocument();
            if (value != null)
            {
                var xamlText = (string) value;
                flowDocument = (FlowDocument)XamlReader.Parse(xamlText);
            }

            // Set return value
            return flowDocument;
        }

My problem is that while basically conversion of raw strings to flow documents works fine, trailing spaces will be removed. I don't want the trailing spaces to be removed. How can I do that?

I tried adding xml tags I found on the Internet to the string (see xml:space="preserve" effect on space between XML attributes?) but it didn't help.

Edit: When I write

flowDocument = (FlowDocument)XamlReader.Parse("<TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xml:space='preserve'> <Run>" + xamlText + "</Run> </TextBlock>");

I get an exception.

Edit: Thanks to andy for the hint - I've now figured out how to implement it, and it works.

                var xamlText = (string) value;
                var idx = xamlText.IndexOf("<Run");
                if (idx != -1)
                    xamlText = xamlText.Substring(0, idx) + "<TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xml:space='preserve'>" + xamlText.Substring(idx);
                idx = xamlText.IndexOf("</Run");
                if (idx != -1)
                    xamlText = xamlText.Substring(0, idx + 6) + "</TextBlock>" + xamlText.Substring(idx + 6);
                flowDocument = (FlowDocument)XamlReader.Parse(xamlText);


问:
I am trying to add my icons on fontello and installed on my website using this tutorials but it's not shown
I am trying to add my icons on fontello and installed on my website using this tutorials:
https://www.youtube.com/watch?v=7f96tUTLmq4

after finishing all steps I can't see my icon. it's showing " - ". check it here: https://testlivvwebsite.com/

please let me know how I can solve this issue


问:
weblogic classloading problem with custom class loaders
I have been trying to convert a legacy web application to maven.

I have created a war file (contains all dependencies in WEB-INF/lib) and trying to deploy it as war file to weblogic 12c.

I have an issue with Class loading that all classes (including classes in jars) loaded by weblogic.utils.classloaders.ChangeAwareClassLoader

In somewhere in the libraries (these are custom local libraries) there is a code part that trying to cast classloader of a class to our custom class loader. So I'am getting an error like   weblogic.utils.classloaders.ChangeAwareClassLoader can not be cast to xxx.myCustomClassLoader

I have a weblogic.xml file refers that use WEB-INF libraries for application.

```<code><?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
                                      http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">

    <context-root></context-root>

    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>

</weblogic-web-app>
</code>```

Can i make weblogic to use my customclassloader while loading classes?

Body:
I have been trying to convert a legacy web application to maven.

I have created a war file (contains all dependencies in WEB-INF/lib) and trying to deploy it as war file to weblogic 12c.

I have an issue with Class loading that all classes (including classes in jars) loaded by weblogic.utils.classloaders.ChangeAwareClassLoader

In somewhere in the libraries (these are custom local libraries) there is a code part that trying to cast classloader of a class to our custom class loader. So I'am getting an error like   weblogic.utils.classloaders.ChangeAwareClassLoader can not be cast to xxx.myCustomClassLoader

I have a weblogic.xml file refers that use WEB-INF libraries for application.

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
                                      http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">

    <context-root></context-root>

    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>

</weblogic-web-app>

Can i make weblogic to use my customclassloader while loading classes?


问:
golang with imported c lib problems
I use a USB Device wit a single Button and LED inside.

I tested software to change color of the device,
API for the hardware is only implemented in c:
https://github.com/katie-snow/Ultimarc-linux

To run it at golang, the c-code was embedded in go-code (above import "C")
The c-library "libultimarc" of the USB-Button was provided to the sw as static c lib: libultimarc.a
Also the lib for USB is static: libusb-1.0.a
Other libs are dynamic. (see ldd below)

I use Linux and x86_64 computers. Build-host is ubuntu, test Host is debian.

The program compiles and works nice, the color of the USB Device is changing as intended.
But only at the build system.

If I try to run the executable from the compile-host at other x86_64 linux machines (test-host)
it is doing nothing, just waiting without any response.

Golang code with embedded c-code goC-LedButton.go :

```<code>package main
/*
// Everything in comments above the import "C" is C code and will be compiled with GCC.
#cgo LDFLAGS: "/home/user/BUTTON/Ultimarc-linux/src/libs/.libs/libultimarc.a"  "/home/user/BUTTON/libusb-1.0.26/libusb/.libs/libusb-1.0.a" "-ludev" "-ljson-c"
// path of json.h
#cgo CFLAGS: "-I/usr/local/include/json-c/"

#include "Ultimarc-linux/src/libs/ulboard.h"
#include "Ultimarc-linux/src/libs/common.h"
#include "Ultimarc-linux/src/libs/usbbutton.h"
#include "Ultimarc-linux/src/libs/ipacseries.h"

#include <json.h>

int changeColor(char *str) {
    ulboard myboard;
    myboard.type = ulboard_type_usbbutton;
    myboard.version = ulboard_version_null;
    struct json_object *parsed_json_color;
    _Bool ret;
    parsed_json_color = json_tokener_parse(str);
    ret = updateBoardUSBButtonColor(parsed_json_color, &myboard);
    return ret;
}

int toRed(void) {
    _Bool ret;
    char *str = "{ \"red\" : 255,  \"green\" : 0, \"blue\" : 0 }";
    ret = changeColor(str);
    return ret;
}

int toGreen(void) {
    _Bool ret;
    char *str = "{ \"red\" : 0,  \"green\" : 255, \"blue\" : 0 }";
    ret = changeColor(str);
    return ret;
}

int toBlue(void) {
    _Bool ret;
    char *str = "{ \"red\" : 0,  \"green\" : 0, \"blue\" : 255 }";
    ret = changeColor(str);
    return ret;
}
 */
import "C"
import "fmt"

func main() {

       c := C.toRed()
       fmt.Println("Changing Color to Red ", c )

       c = C.toGreen()
       fmt.Println("Changing Color to Green ", c )

       c = C.toBlue()
       fmt.Println("Changing Color to Blue ", c )

}
</code>```

Used libraries of binary:

```<code>ldd goC-LedButton
        linux-vdso.so.1 (0x00007ffe9fafa000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007ff9cbd49000)
        libjson-c.so.3 => /lib/x86_64-linux-gnu/libjson-c.so.3 (0x00007ff9cbd3b000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff9cbd18000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff9cbb26000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff9cbd9c000)
</code>```

The lib /lib/x86_64-linux-gnu/libjson-c.so.3 is on both machines installed.

The problem is that the sw is not running on other machines, and I don't understand why.
The behavior is, that at the test-host it is not responding at all after start, but can be stopped with [str]+[c].

I will be very thankful for hints about how to get the sw also running on the test-host.
It's most probable a lib problem?

All the best, Alex

Title: golang with imported c lib problems

Body:
I use a USB Device wit a single Button and LED inside.

I tested software to change color of the device,
API for the hardware is only implemented in c:
https://github.com/katie-snow/Ultimarc-linux

To run it at golang, the c-code was embedded in go-code (above import "C")
The c-library "libultimarc" of the USB-Button was provided to the sw as static c lib: libultimarc.a
Also the lib for USB is static: libusb-1.0.a
Other libs are dynamic. (see ldd below)

I use Linux and x86_64 computers. Build-host is ubuntu, test Host is debian.

The program compiles and works nice, the color of the USB Device is changing as intended.
But only at the build system.

If I try to run the executable from the compile-host at other x86_64 linux machines (test-host)
it is doing nothing, just waiting without any response.

Golang code with embedded c-code goC-LedButton.go :

package main
/*
// Everything in comments above the import "C" is C code and will be compiled with GCC.
#cgo LDFLAGS: "/home/user/BUTTON/Ultimarc-linux/src/libs/.libs/libultimarc.a"  "/home/user/BUTTON/libusb-1.0.26/libusb/.libs/libusb-1.0.a" "-ludev" "-ljson-c"
// path of json.h
#cgo CFLAGS: "-I/usr/local/include/json-c/"

#include "Ultimarc-linux/src/libs/ulboard.h"
#include "Ultimarc-linux/src/libs/common.h"
#include "Ultimarc-linux/src/libs/usbbutton.h"
#include "Ultimarc-linux/src/libs/ipacseries.h"

#include <json.h>

int changeColor(char *str) {
    ulboard myboard;
    myboard.type = ulboard_type_usbbutton;
    myboard.version = ulboard_version_null;
    struct json_object *parsed_json_color;
    _Bool ret;
    parsed_json_color = json_tokener_parse(str);
    ret = updateBoardUSBButtonColor(parsed_json_color, &myboard);
    return ret;
}

int toRed(void) {
    _Bool ret;
    char *str = "{ \"red\" : 255,  \"green\" : 0, \"blue\" : 0 }";
    ret = changeColor(str);
    return ret;
}

int toGreen(void) {
    _Bool ret;
    char *str = "{ \"red\" : 0,  \"green\" : 255, \"blue\" : 0 }";
    ret = changeColor(str);
    return ret;
}

int toBlue(void) {
    _Bool ret;
    char *str = "{ \"red\" : 0,  \"green\" : 0, \"blue\" : 255 }";
    ret = changeColor(str);
    return ret;
}
 */
import "C"
import "fmt"

func main() {

       c := C.toRed()
       fmt.Println("Changing Color to Red ", c )

       c = C.toGreen()
       fmt.Println("Changing Color to Green ", c )

       c = C.toBlue()
       fmt.Println("Changing Color to Blue ", c )

}

Used libraries of binary:

ldd goC-LedButton
        linux-vdso.so.1 (0x00007ffe9fafa000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007ff9cbd49000)
        libjson-c.so.3 => /lib/x86_64-linux-gnu/libjson-c.so.3 (0x00007ff9cbd3b000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff9cbd18000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff9cbb26000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff9cbd9c000)

The lib /lib/x86_64-linux-gnu/libjson-c.so.3 is on both machines installed.

The problem is that the sw is not running on other machines, and I don't understand why.
The behavior is, that at the test-host it is not responding at all after start, but can be stopped with [str]+[c].

I will be very thankful for hints about how to get the sw also running on the test-host.
It's most probable a lib problem?

All the best, Alex


问:
Container docker remains in exited status
Hi I'm building a docker image that starts Mysql, Elasticsearch and application, it completes the build of the image but when I run the container it doesn't start and remains in exited status.

DOCKERFILE:

```<code>FROM ubuntu:20.04
WORKDIR \\wsl.localhost\Ubuntu\home\marco\project\multiple-docker-container\backend
COPY . .
RUN apt update
RUN apt-get update
RUN apt-get install wget -y
RUN apt install apt-transport-https ca-certificates gnupg -y
RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
RUN sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
RUN apt-get update -y
RUN apt-get install elasticsearch -y
RUN apt install mysql-server -y
RUN apt install npm -y
RUN npm install
RUN npm install nodemon
RUN apt install nodejs -y
EXPOSE 3306
EXPOSE 9200
EXPOSE 5000
COPY entrypoint.sh /bin/entrypoint.sh
RUN chmod +x /bin/entrypoint.sh
ENTRYPOINT ["/bin/entrypoint.sh"]
</code>```

ENTRYPOINT.SH

```<code>#!/bin/sh

service elasticsearch start

service elasticsearch enable

service mysql start

npm start
</code>```

I expect at least that it goes up, I would like to understand which is the problem since on WSL ubuntu gives me this problem while on the virtual machine it works

Body:
Hi I'm building a docker image that starts Mysql, Elasticsearch and application, it completes the build of the image but when I run the container it doesn't start and remains in exited status.

DOCKERFILE:

FROM ubuntu:20.04
WORKDIR \\wsl.localhost\Ubuntu\home\marco\project\multiple-docker-container\backend
COPY . .
RUN apt update
RUN apt-get update
RUN apt-get install wget -y
RUN apt install apt-transport-https ca-certificates gnupg -y
RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
RUN sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
RUN apt-get update -y
RUN apt-get install elasticsearch -y
RUN apt install mysql-server -y
RUN apt install npm -y
RUN npm install
RUN npm install nodemon
RUN apt install nodejs -y
EXPOSE 3306
EXPOSE 9200
EXPOSE 5000
COPY entrypoint.sh /bin/entrypoint.sh
RUN chmod +x /bin/entrypoint.sh
ENTRYPOINT ["/bin/entrypoint.sh"]

ENTRYPOINT.SH

#!/bin/sh

service elasticsearch start

service elasticsearch enable

service mysql start

npm start

I expect at least that it goes up, I would like to understand which is the problem since on WSL ubuntu gives me this problem while on the virtual machine it works


问:
Can Glade make a GtkPopoverMenu?
I can add things like a GtkButton to GtkPopoverMenu in Glade, but how to add menu items? Is it possible in Glade, or do I have to do it programmatically?

Generated Glade code

```<code><?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
  <requires lib="gtk+" version="3.24"/>
  <object class="GtkWindow">
    <property name="can-focus">False</property>
    <property name="default-width">440</property>
    <property name="default-height">250</property>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkMenuButton" id="menubutton1">
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="focus-on-click">False</property>
            <property name="receives-default">True</property>
            <property name="halign">end</property>
            <property name="valign">start</property>
            <property name="popover">popovermenu1</property>
            <child>
              <placeholder/>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <placeholder/>
        </child>
        <child>
          <placeholder/>
        </child>
      </object>
    </child>
  </object>
  <object class="GtkPopoverMenu" id="popovermenu1">
    <property name="can-focus">False</property>
    <property name="relative-to">menubutton1</property>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
  </object>
</interface>
</code>```

The thing I am trying to achieve:

Title: Can Glade make a GtkPopoverMenu?

Body:
I can add things like a GtkButton to GtkPopoverMenu in Glade, but how to add menu items? Is it possible in Glade, or do I have to do it programmatically?

Generated Glade code

<?xml version="1.0" encoding="UTF-8"?>

<interface>
  <requires lib="gtk+" version="3.24"/>
  <object class="GtkWindow">
    <property name="can-focus">False</property>
    <property name="default-width">440</property>
    <property name="default-height">250</property>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkMenuButton" id="menubutton1">
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="focus-on-click">False</property>
            <property name="receives-default">True</property>
            <property name="halign">end</property>
            <property name="valign">start</property>
            <property name="popover">popovermenu1</property>
            <child>
              <placeholder/>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">False</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <placeholder/>
        </child>
        <child>
          <placeholder/>
        </child>
      </object>
    </child>
  </object>
  <object class="GtkPopoverMenu" id="popovermenu1">
    <property name="can-focus">False</property>
    <property name="relative-to">menubutton1</property>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
    <child>
      <placeholder/>
    </child>
  </object>
</interface>

The thing I am trying to achieve:


问:
disabled inputs and selects misagligned when creating image via html2canvas
I have a series of labels and disabled inputs.  When I create an image with html2canvas, the inputs are misaligned.

Here is the web page source:

```<code><html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.15.19/dist/css/uikit.min.css" />
    <style type="text/css">
        .ukc-input-disabled {
            cursor: default;
            pointer-events: none;
        }
        .ukc-input-disabled:not([type="checkbox"]) {
            border: 0 none !important;
            background-color: transparent !important;
            background-image: none !important;
            padding: 0 !important;
        }
        .ukc-input-disabled.uk-checkbox {
            background-color: #f8f8f8 !important;
        }
        .ukc-input-disabled.uk-checkbox:checked {
            background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%23999%22%20points%3D%2212%201%205%207.5%202%205%201%205.5%205%2010%2013%201.5%22%20%2F%3E%0A%3C%2Fsvg%3E%0A");
        }
    </style>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.4/html2canvas.min.js"></script>
    <script type="text/javascript">
        jQuery(function () {
            html2canvas(document.getElementById('theform'), {}).then(function (canvas) {
                var img = jQuery('<img>');
                img.attr("src", canvas.toDataURL('image/png'));
                jQuery('body').append(img); //todo
            });

        });
    </script>
</head>
<body>
<form id="theform">
    <div class="uk-display-inline-block uk-text-nowrap uk-margin uk-margin-left@s uk-margin-right">
        <label class="uk-text-bold" for="rga_type_select"><span>Type</span>:</label>
        <select name="rga_type" id="rga_type_select" class="uk-select uk-width-small ukc-border ukc-input-disabled">
            <option value="C">Credit</option>
            <option value="E" selected>Rent payment</option>
        </select>
    </div>
    <div class="uk-display-inline-block uk-text-nowrap uk-margin uk-margin-left uk-margin-right">
        <label for="rga_cpo_textinput" class="uk-text-bold">CPO:</label>
        <input name="rga_cpo" id="rga_cpo_textinput" class="uk-input uk-width-small ukc-border ukc-input-disabled" value="test123">
    </div>
    <div class="uk-display-inline-block uk-text-nowrap uk-margin uk-margin-left uk-margin-right">
        <label class="uk-text-bold" for="rga_reason_select"><span>Reason</span>:</label>
        <select name="rga_reason" id="rga_reason_select" class="uk-select uk-width-auto ukc-border ukc-input-disabled">
            <option value="B">Lorem Ipsum</option>
            <option value="C" selected>Hello there</option>
        </select>
    </div>
    <div class="uk-display-inline-block uk-text-nowrap uk-margin uk-margin-left uk-margin-right">
        <label class="uk-text-bold" for="rga_decline_qty_checkbox">Return declined quantity</label>
        <input type="checkbox" name="rga_decline_qty" id="rga_decline_qty_checkbox" class="uk-checkbox ukc-input-disabled">
    </div>
    <div class="uk-margin-top">
        <button type="submit" class="uk-button uk-button-primary" style="display: none;">Select Items</button>
    </div>
</form>
</body>
</html>
</code>```

It displays as:

Notice that, in the image, the disabled inputs are misaligned.

Body:
I have a series of labels and disabled inputs.  When I create an image with html2canvas, the inputs are misaligned.

Here is the web page source:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.15.19/dist/css/uikit.min.css" />

<form id="theform">

        Type:
        <select name="rga_type" id="rga_type_select" class="uk-select uk-width-small ukc-border ukc-input-disabled">
            <option value="C">Credit</option>
            <option value="E" selected>Rent payment</option>
        </select>

        CPO:
        <input name="rga_cpo" id="rga_cpo_textinput" class="uk-input uk-width-small ukc-border ukc-input-disabled" value="test123">

        Reason:
        <select name="rga_reason" id="rga_reason_select" class="uk-select uk-width-auto ukc-border ukc-input-disabled">
            <option value="B">Lorem Ipsum</option>
            <option value="C" selected>Hello there</option>
        </select>

        Return declined quantity
        <input type="checkbox" name="rga_decline_qty" id="rga_decline_qty_checkbox" class="uk-checkbox ukc-input-disabled">

        <button type="submit" class="uk-button uk-button-primary" style="display: none;">Select Items</button>

</form>

It displays as:

Notice that, in the image, the disabled inputs are misaligned.


问:
Is there a way to disable automatic detection of pydantic models in request body?
I have a pydantic model:

```<code>class CreateModelCommand(BaseModel):
    name: Optional[str] = None
    description: Optional[str] = None
</code>```

And I want to send it along two UploadFiles:

```<code>@app.post("/")
async def create_model(
        command: CreateModelCommand,
        binary: UploadFile,
        config: UploadFile,
):
    model = model_service.create_model(command, binary, config)
</code>```

But since command is a pydantic model, FastApi tries to convert the entire body to a dict, as stated here: https://fastapi.tiangolo.com/tutorial/body-multiple-params/#multiple-body-parameters.
This returns a Unprocessable Entity error, since it can't convert the files to dicts. Now I am asking if I can somehow disable this automatic detection or if I am simply using bad practise.

Body:
I have a pydantic model:

class CreateModelCommand(BaseModel):
    name: Optional[str] = None
    description: Optional[str] = None

And I want to send it along two UploadFiles:

@app.post("/")
async def create_model(
        command: CreateModelCommand,
        binary: UploadFile,
        config: UploadFile,
):
    model = model_service.create_model(command, binary, config)

But since command is a pydantic model, FastApi tries to convert the entire body to a dict, as stated here: https://fastapi.tiangolo.com/tutorial/body-multiple-params/#multiple-body-parameters.
This returns a Unprocessable Entity error, since it can't convert the files to dicts. Now I am asking if I can somehow disable this automatic detection or if I am simply using bad practise.


问:
How to read values by foreign key
I'm fairly new to Laravel and React. I have 3 tables called students, users and projects. Each project has 1 student, 1 supervisor and 2 examiners (supervisors and examiners are users) assigned to it. I want to try to fetch the names of the student and user from the respective tables and display them.

My Project.php

```<code>protected $with =['projectStudent', 'projectSupervisor', 'projectExaminer1', 'projectExaminer2'];
public function projectStudent()
{
    return $this->belongsTo('App\Models\Student', 'student_id', 'student_id');
}

public function projectSupervisor()
{
    return $this->belongsTo('App\Models\User', 'supervisor_id', 'id');
}

public function projectExaminer1()
{
    return $this->belongsTo('App\Models\User', 'examiner1_id', 'id');
}

public function projectExaminer2()
{
    return $this->belongsTo('App\Models\User', 'examiner2_id', 'id');
}
</code>```

My ProjectController.php

```<code>public function index()
{
    return ProjectResource::collection(
        Project::query()->with('projectStudent')->orderBy('id', 'desc')->paginate(5)
    );
}
</code>```

My Projects.jsx

```<code>const [projects, setProjects] = useState([]);
const [paginate, setPaginate] = useState(1);
const [loading, setLoading] = useState(false);
const {setNotification} = useStateContext();

useEffect(() => {
    getProjects();
}, [paginate])

const handlePaginate = (direction) => {
    setPaginate(prevPage => prevPage + direction)
}
function classNames(...classes) {
    return classes.filter(Boolean).join(' ')
}
const getProjects = () => {
    setLoading(true);
    axiosClient.get(`/projects?page=${paginate}`)
        .then(({data}) => {
            setLoading(false);
            setProjects(data.data);
        })
        .catch(() => {
            setLoading(false);
        })
}
</code>```

I want to get name of the student and the names of supervisor and examiner but project.projectStudent.name returns undefined.

When I try to console.log(JSON.stringify(data.data, null, 2)) the data, I get

```<code>[

{
    "id": 1,
    "title": "Stock Market Prediction",
    "student_id": "SW0102469",
    "supervisor_id": 18,
    "examiner1_id": 12,
    "examiner2_id": 33
  }
]
</code>```

And this is my projectResource.php

```<code><?php
namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ProjectResource extends JsonResource
{
    public static $wrap = false;
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'title' => $this->title,
            'student_id' => $this->student_id,
            'supervisor_id' => $this->supervisor_id,
            'examiner1_id' => $this->examiner1_id,
            'examiner2_id' => $this->examiner2_id,
//            'start_date' => $this->start_date->format('Y-m-d'),
//            'end_date' => $this->end_date->format('Y-m-d'),
//            'duration' => $this->duration,
//            'status' => $this->status,
        ];
    }
}
</code>```

Title: How to read values by foreign key

Body:
I'm fairly new to Laravel and React. I have 3 tables called students, users and projects. Each project has 1 student, 1 supervisor and 2 examiners (supervisors and examiners are users) assigned to it. I want to try to fetch the names of the student and user from the respective tables and display them.

My Project.php

protected $with =['projectStudent', 'projectSupervisor', 'projectExaminer1', 'projectExaminer2'];
public function projectStudent()
{
    return $this->belongsTo('App\Models\Student', 'student_id', 'student_id');
}

public function projectSupervisor()
{
    return $this->belongsTo('App\Models\User', 'supervisor_id', 'id');
}

public function projectExaminer1()
{
    return $this->belongsTo('App\Models\User', 'examiner1_id', 'id');
}

public function projectExaminer2()
{
    return $this->belongsTo('App\Models\User', 'examiner2_id', 'id');
}

My ProjectController.php

public function index()
{
    return ProjectResource::collection(
        Project::query()->with('projectStudent')->orderBy('id', 'desc')->paginate(5)
    );
}

My Projects.jsx

const [projects, setProjects] = useState([]);
const [paginate, setPaginate] = useState(1);
const [loading, setLoading] = useState(false);
const {setNotification} = useStateContext();

useEffect(() => {
    getProjects();
}, [paginate])

const handlePaginate = (direction) => {
    setPaginate(prevPage => prevPage + direction)
}
function classNames(...classes) {
    return classes.filter(Boolean).join(' ')
}
const getProjects = () => {
    setLoading(true);
    axiosClient.get(`/projects?page=${paginate}`)
        .then(({data}) => {
            setLoading(false);
            setProjects(data.data);
        })
        .catch(() => {
            setLoading(false);
        })
}

I want to get name of the student and the names of supervisor and examiner but project.projectStudent.name returns undefined.

When I try to console.log(JSON.stringify(data.data, null, 2)) the data, I get

[

{
    "id": 1,
    "title": "Stock Market Prediction",
    "student_id": "SW0102469",
    "supervisor_id": 18,
    "examiner1_id": 12,
    "examiner2_id": 33
  }
]

And this is my projectResource.php

<?php
namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ProjectResource extends JsonResource
{
    public static $wrap = false;
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'title' => $this->title,
            'student_id' => $this->student_id,
            'supervisor_id' => $this->supervisor_id,
            'examiner1_id' => $this->examiner1_id,
            'examiner2_id' => $this->examiner2_id,
//            'start_date' => $this->start_date->format('Y-m-d'),
//            'end_date' => $this->end_date->format('Y-m-d'),
//            'duration' => $this->duration,
//            'status' => $this->status,
        ];
    }
}


问:
How to debug the execution of Drools rules to verify the evaluation path used and the rules activated in KIE Server?
How to debug the execution of Drools rules to verify the evaluation path used and the rules activated in the KIE Server?</p>


问:
jQuery get data from JSON file not working as expected
I've been trying to get data from a JSON file. After I submit the request, the result is printed in the console, but then something gets wrong in the code and I can't find the problem:
There are two button in the HTML file. USD (should convert form BGN to USD) and BGN (Should bring back the old price)

HTML:

```<code>            <div class="right">
                <div class="item">
                    <h1>Кръгла чиния с три разделения</h1>
                    <p>52лв - комплект 200бр.</p>
                    <p>Персонална бройка - 0,30лв/бр.</p>
                    <p>Налични бройки: 1000</p>
                    <button class="usd">USD</button>
                    <button class="bgn">BGN</button>
                </div>
            </div>
</code>```

JS:

```<code>/*    var bottom;
    $.getJSON('https://www.floatrates.com/daily/bgn.json', function(data) {
    bottom = data.usd.rate;
    // JSON result in `data` variable
});*/
document.addEventListener("DOMContentLoaded", async function () {
  var price;
  var usdRate;
  function getData() {$.getJSON("https://www.floatrates.com/daily/bgn.json", function (data) {
    usdRate = data.usd.rate;
  });};
  await getData();
  console.log(usdRate);

  /*function waitforshit(callback) {
    if (usdRate != "") {
      // call the callback to notify other code
      setTimeout(callback, 1000);
    }
    //waitforshit();
  }*/
  var changeCurrencyToUSD = function() {
    if (
      window.location.href.includes("IT") ||
      window.location.href.includes("EN")
    ) {
      price = parseFloat(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim()
      );
    } else {
      console.log(document.querySelectorAll(".product-flex>.right>.item>p")[0].innerText.match(/^(.*).{20}/i)[1]);
      price = parseFloat(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim()
      );
    }
    var priceRated = price * usdRate;
    //console.log(usdRate);
    // console.log(priceRated);
    priceRated = Math.round((priceRated + Number.EPSILON) * 100) / 100;
    //console.log(priceRated);
    if (
      window.location.href.includes("IT") ||
      window.location.href.includes("EN")
    ) {
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        priceRated
      );
    } else {
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        priceRated
      );
    }
  }
  var changeCurrencyToBGN = function() {
    if (
      window.location.href.includes("IT") ||
      window.location.href.includes("EN")
    ) {
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        price
      );
    } else {
      console.log(document.querySelectorAll(".product-flex>.right>.item>p")[0].innerText.match(/^(.*).{20}/i)[1]);
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        price
      );
    }
  }
  document.getElementsByClassName("usd")[0].addEventListener("click", changeCurrencyToUSD);
  document.getElementsByClassName("bgn")[0].addEventListener("click", changeCurrencyToBGN);
});
</code>```

I've tried everything!

Body:
I've been trying to get data from a JSON file. After I submit the request, the result is printed in the console, but then something gets wrong in the code and I can't find the problem:
There are two button in the HTML file. USD (should convert form BGN to USD) and BGN (Should bring back the old price)

HTML:

Кръгла чиния с три разделения

52лв - комплект 200бр.

Персонална бройка - 0,30лв/бр.

Налични бройки: 1000

                    <button class="usd">USD</button>
                    <button class="bgn">BGN</button>

JS:

/*    var bottom;
    $.getJSON('https://www.floatrates.com/daily/bgn.json', function(data) {
    bottom = data.usd.rate;
    // JSON result in `data` variable
});*/
document.addEventListener("DOMContentLoaded", async function () {
  var price;
  var usdRate;
  function getData() {$.getJSON("https://www.floatrates.com/daily/bgn.json", function (data) {
    usdRate = data.usd.rate;
  });};
  await getData();
  console.log(usdRate);

  /*function waitforshit(callback) {
    if (usdRate != "") {
      // call the callback to notify other code
      setTimeout(callback, 1000);
    }
    //waitforshit();
  }*/
  var changeCurrencyToUSD = function() {
    if (
      window.location.href.includes("IT") ||
      window.location.href.includes("EN")
    ) {
      price = parseFloat(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim()
      );
    } else {
      console.log(document.querySelectorAll(".product-flex>.right>.item>p")[0].innerText.match(/^(.*).{20}/i)[1]);
      price = parseFloat(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim()
      );
    }
    var priceRated = price * usdRate;
    //console.log(usdRate);
    // console.log(priceRated);
    priceRated = Math.round((priceRated + Number.EPSILON) * 100) / 100;
    //console.log(priceRated);
    if (
      window.location.href.includes("IT") ||
      window.location.href.includes("EN")
    ) {
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        priceRated
      );
    } else {
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        priceRated
      );
    }
  }
  var changeCurrencyToBGN = function() {
    if (
      window.location.href.includes("IT") ||
      window.location.href.includes("EN")
    ) {
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        price
      );
    } else {
      console.log(document.querySelectorAll(".product-flex>.right>.item>p")[0].innerText.match(/^(.*).{20}/i)[1]);
      document.body.innerHTML = document.body.innerHTML.replace(
        document
          .querySelectorAll(".product-flex>.right>.item>p")[0]
          .innerText.match(/^(.*).{19}/i)[1]
          .trim(),
        price
      );
    }
  }
  document.getElementsByClassName("usd")[0].addEventListener("click", changeCurrencyToUSD);
  document.getElementsByClassName("bgn")[0].addEventListener("click", changeCurrencyToBGN);
});

I've tried everything!


问:
How do I add annotations in a pdf file
Not sure if this is even possible, but is there a way to add annotations to a PDF file with VBA

I'd like for example be able to find all the strings TRD1245 in the PDF file and add an annotation to it TMP 2547889

The only thing close to what I am looking for was suggested in the following question, but does not seem to work.

Title: How do I add annotations in a pdf file


问:
how to show custom error page in react-admin?
I would like to use custom error page (src/error.js) as described in https://marmelab.com/react-admin/Theming.html#customizing-the-error-page

But my own (src/error.js) error page doesn't show on API server errors.

Sandbox https://codesandbox.io/p/github/lumpov/react-admin/master

Click on error-resource.

How to catch API errors on custom page, instead bottom notifications?

Environment

React-admin version: 4.6.2
React version: 18.2.0


问:
Search filter in expandable List component
I am trying to figure out how to use search filter in an expandable list. In my react app, I have two arrays from our API.

First Array:
It has 2 properties. I will show "categoryName" as the heading of expandable list.

```<code>[
    {id: "11", categoryName: "Fruit"},
    {id: "22", categoryName: "Animals"},
    {id: "33", categoryName: "Cars"}
]
</code>```

Second Array:
"cn" is the item name of our expandable list.
"sc" is the ID of category that it should be match with the "id" of first array. (sc = id)
"se" and "nc" are not in the list but if I search one of them, it will show its "cn".

```<code>[
    {nc: "ODRP0101", se: "XF9", sc: "11", cn: "apple"},
    {nc: "HDRP0102", se: "QG8", sc: "11", cn: "pear"},
    {nc: "MDRP0103", se: "WH7", sc: "11", cn: "orange"},
    {nc: "NDRP0104", se: "EI6", sc: "11", cn: "grapes"},
    {nc: "BDRP0105", se: "RJ5", sc: "11", cn: "lemon"},
    {nc: "VDRP0106", se: "TK4", sc: "22", cn: "horse"},
    {nc: "CDRP0107", se: "YL3", sc: "22", cn: "cat"},
    {nc: "XDRP0108", se: "UM2", sc: "22", cn: "dog"},
    {nc: "ZDRP0109", se: "IN1", sc: "22", cn: "cow"},
    {nc: "ADRP0110", se: "OX0", sc: "22", cn: "hen"},
    {nc: "SDRP0111", se: "ZA1", sc: "33", cn: "opel"},
    {nc: "WDRP0112", se: "CB2", sc: "33", cn: "bmw },
    {nc: "QDRP0113", se: "VC3", sc: "33", cn: "ford"},
    {nc: "RDRP0114", se: "BD4", sc: "33", cn: "audi"},
    {nc: "XDRP0115", se: "NE5", sc: "33", cn: "toyota"}
]
</code>```

The UI is something like below. If the search bar is empty, all the categories are closed.

If I search something, all the categories should be opened.

Now, I need my search bar works with these points:

If I search one of these properties like {nc: "ODRP0101", se: "XF9", sc: "11", cn: "apple"}, it shows the "apple". Of course, if I search 11, it will show 5 items of fruit.

If I search one of the headings like "Fruit" it shows Fruit and its subcategory

My problems are here:
My Solution just search the subcategories not the categories.If I click one of the categories, the other categories will open/close.

I use React 18 and tailwindcss:

```<code>  // Implement Search Query
  const [filteredList, setFilteredList] = useState(getStockHandlerAll);
  const [searchQuery, setSearchQuery] = useState("");
  const [expand, setExpand] = useState(false);

  //Search list of objects
  const handleSearch = (event) => {
    const query = event.target.value;
    setSearchQuery(query);

    query.length === 0 ? setExpand(false) : setExpand(true);

    const searchList = getStockHandlerAll?.filter((item) => {
      console.log('item.sf',item.sf)
      return item.sf.toLowerCase().indexOf(query.toLowerCase()) !== -1;
    });

    setFilteredList(searchList);
  };

return (
  <>
<div className={"m-5"}>
  <h2 className={"my-5"}>افزودن گروهی نماد</h2>
  <div className={"my-5"}>
    <input
      className={"border-[1px] border-[#999] text-[13px] py-2 px-4"}
      type="text"
      name="search"
      placeholder={"جستجو"}
      value={searchQuery}
      onChange={handleSearch}
    />
  </div>

  {filteredList && filteredList?.map((item, index) => (
    <div key={index} className={"flex flex-row "}>
      <div className={`text-[12px] w-full leading-[30px]`}>
        <div onClick={() => setExpand(!expand)}
             className={"flex flex-row cursor-pointer"}>
          <div
            className={"w-[20px] h-[30px] leading-[3px] flex items-center justify-center"}>{expand ? "-" : "+"}</div>
          <div>{item?.SectorName}</div>
        </div>
        {expand && <div className={"mr-[15px]"}>
          <div key={item?.nc}>
            <div className={"flex flex-row items-center cursor-pointer hover:bg-[#eee]"}>
              {item?.sf}
            </div>
          </div>
        </div>}
      </div>
    </div>
  ))}
</div>
  </>
)

</code>```

Body:
I am trying to figure out how to use search filter in an expandable list. In my react app, I have two arrays from our API.

First Array:
It has 2 properties. I will show "categoryName" as the heading of expandable list.

[
    {id: "11", categoryName: "Fruit"},
    {id: "22", categoryName: "Animals"},
    {id: "33", categoryName: "Cars"}
]

Second Array:
"cn" is the item name of our expandable list.
"sc" is the ID of category that it should be match with the "id" of first array. (sc = id)
"se" and "nc" are not in the list but if I search one of them, it will show its "cn".

[
    {nc: "ODRP0101", se: "XF9", sc: "11", cn: "apple"},
    {nc: "HDRP0102", se: "QG8", sc: "11", cn: "pear"},
    {nc: "MDRP0103", se: "WH7", sc: "11", cn: "orange"},
    {nc: "NDRP0104", se: "EI6", sc: "11", cn: "grapes"},
    {nc: "BDRP0105", se: "RJ5", sc: "11", cn: "lemon"},
    {nc: "VDRP0106", se: "TK4", sc: "22", cn: "horse"},
    {nc: "CDRP0107", se: "YL3", sc: "22", cn: "cat"},
    {nc: "XDRP0108", se: "UM2", sc: "22", cn: "dog"},
    {nc: "ZDRP0109", se: "IN1", sc: "22", cn: "cow"},
    {nc: "ADRP0110", se: "OX0", sc: "22", cn: "hen"},
    {nc: "SDRP0111", se: "ZA1", sc: "33", cn: "opel"},
    {nc: "WDRP0112", se: "CB2", sc: "33", cn: "bmw },
    {nc: "QDRP0113", se: "VC3", sc: "33", cn: "ford"},
    {nc: "RDRP0114", se: "BD4", sc: "33", cn: "audi"},
    {nc: "XDRP0115", se: "NE5", sc: "33", cn: "toyota"}
]

The UI is something like below. If the search bar is empty, all the categories are closed.

If I search something, all the categories should be opened.

Now, I need my search bar works with these points:

If I search one of these properties like {nc: "ODRP0101", se: "XF9", sc: "11", cn: "apple"}, it shows the "apple". Of course, if I search 11, it will show 5 items of fruit.

If I search one of the headings like "Fruit" it shows Fruit and its subcategory

My problems are here:
My Solution just search the subcategories not the categories.If I click one of the categories, the other categories will open/close.

I use React 18 and tailwindcss:

  // Implement Search Query
  const [filteredList, setFilteredList] = useState(getStockHandlerAll);
  const [searchQuery, setSearchQuery] = useState("");
  const [expand, setExpand] = useState(false);

  //Search list of objects
  const handleSearch = (event) => {
    const query = event.target.value;
    setSearchQuery(query);

    query.length === 0 ? setExpand(false) : setExpand(true);

    const searchList = getStockHandlerAll?.filter((item) => {
      console.log('item.sf',item.sf)
      return item.sf.toLowerCase().indexOf(query.toLowerCase()) !== -1;
    });

    setFilteredList(searchList);
  };

return (
  <>

افزودن گروهی نماد

    <input
      className={"border-[1px] border-[#999] text-[13px] py-2 px-4"}
      type="text"
      name="search"
      placeholder={"جستجو"}
      value={searchQuery}
      onChange={handleSearch}
    />

  {filteredList && filteredList?.map((item, index) => (

      <div className={`text-[12px] w-full leading-[30px]`}>

 setExpand(!expand)}
             className={"flex flex-row cursor-pointer"}>

{expand ? "-" : "+"}

{item?.SectorName}

        {expand &&

              {item?.sf}

}

  ))}

  </>
)


问:
Is there any way I can retain spaces in redshift while writing from aws glue
I am trying to store space in a varchar column in redshift.

My data comes in a csv format and looks like this,

```<code>"id","first_name","last_name","doj","address"
"A1111","B1111","C1111","D111","E111"
"A2222","B22222",""," ","E22"
"A3333","  ","C333","D333","E3333"
</code>```

I store it in s3 and later read it via spark in a glue job and write to redshift as it is.

My code

```<code>from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.dynamicframe import DynamicFrame
from awsglue.job import Job
from pyspark.sql.types import StringType
import pyspark.sql.functions as f

sc = SparkContext.getOrCreate()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)

df = spark.read\
    .format("csv")\
    .option("header", True)\
    .load("s3://bucket/file.csv")

df.show()

redshift_conn = glueContext.extract_jdbc_conf('...')
redshift_connection_options = {
        "url": redshift_conn['url'],
        "user": redshift_conn['user'],
        "password": redshift_conn['password'],
        "database": "...",
        "dbtable": "...",
        "redshiftTmpDir": "..."
    }

finalDF = DynamicFrame.fromDF(df, glueContext, "finalDF")

glueContext.write_dynamic_frame_from_jdbc_conf(
    frame=finalDF, catalog_connection="...", connection_options=redshift_connection_options)

job.commit()
</code>```

When I try to run the above CSV through the script, I get the spaces trimmed in there.

I have tried to run the script in glue 3.0 and 4.0, the result is the same.

Are there any solutions to this case?

Body:
I am trying to store space in a varchar column in redshift.

My data comes in a csv format and looks like this,

"id","first_name","last_name","doj","address"
"A1111","B1111","C1111","D111","E111"
"A2222","B22222",""," ","E22"
"A3333","  ","C333","D333","E3333"

I store it in s3 and later read it via spark in a glue job and write to redshift as it is.

My code

from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.dynamicframe import DynamicFrame
from awsglue.job import Job
from pyspark.sql.types import StringType
import pyspark.sql.functions as f

sc = SparkContext.getOrCreate()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)

df = spark.read\
    .format("csv")\
    .option("header", True)\
    .load("s3://bucket/file.csv")

df.show()

redshift_conn = glueContext.extract_jdbc_conf('...')
redshift_connection_options = {
        "url": redshift_conn['url'],
        "user": redshift_conn['user'],
        "password": redshift_conn['password'],
        "database": "...",
        "dbtable": "...",
        "redshiftTmpDir": "..."
    }

finalDF = DynamicFrame.fromDF(df, glueContext, "finalDF")

glueContext.write_dynamic_frame_from_jdbc_conf(
    frame=finalDF, catalog_connection="...", connection_options=redshift_connection_options)

job.commit()

When I try to run the above CSV through the script, I get the spaces trimmed in there.

I have tried to run the script in glue 3.0 and 4.0, the result is the same.

Are there any solutions to this case?


问:
Reverse SSH tunneling with libssh2 on ESP32 - binding port on remote host fails
I could successfully integrate reverse tunnelling (on a local and remote machine) with use of the libshh2 library in a project build on a macos system, but the same code doesn't run on a MCU (ESP32).

On the ESP32 I can successfully connect over ssh to the server and authenticate. However, after calling the function libssh2_channel_forward_listen_ex the program fails. From debugging I could see that the function _libssh2_transport_read doesn't return any data.

I know that the problem could be also related due to incorrect implementation of the library, but because until this point everything has worked just fine is there any chance that for some reason the server would reject the binding and the problem wouldn't be even on the MCU side?


问:
Azure Form Recognizer - JSON key value output
Json output format is of:

key: abc

Value: 123

Expected format

key: abc value: 123

problem: key and value not coming in same line. its coming line by line

my code as in image

Thanks in advance.

note: the code in image is only to extract json. I haven't provide the code the api call which was successful


问:
Pygame, key event of a key held down isn't detected after another key was pressed
I am coding a snake on pygame. The user can move it freely (not like the original snake).
The problem is that when the user is holding down a key, let's say : DOWN. He then presses LEFT to go diagonal down-left, finally releases LEFT while still holding DOWN : the snake is supposed to go down but he stops moving.

I have printed key events and it is detected, but it is not looping anymore like it is when I am holding a single key.

Here is my event loop :

```<code>running = True
pygame.key.set_repeat(True)
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYUP:
            snake.direction = None
        keys = pygame.key.get_pressed()
        print(keys[pygame.K_DOWN],keys[pygame.K_RIGHT])
        if keys:
            snake.mise_a_jour_position(keys)
            grid.mise_a_jour_grille()

    screen.blit(background, (0, 0))
    grid.draw()
    snake.draw()
    pygame.display.update()
</code>```

Body:
I am coding a snake on pygame. The user can move it freely (not like the original snake).
The problem is that when the user is holding down a key, let's say : DOWN. He then presses LEFT to go diagonal down-left, finally releases LEFT while still holding DOWN : the snake is supposed to go down but he stops moving.

I have printed key events and it is detected, but it is not looping anymore like it is when I am holding a single key.

Here is my event loop :

running = True
pygame.key.set_repeat(True)
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYUP:
            snake.direction = None
        keys = pygame.key.get_pressed()
        print(keys[pygame.K_DOWN],keys[pygame.K_RIGHT])
        if keys:
            snake.mise_a_jour_position(keys)
            grid.mise_a_jour_grille()

    screen.blit(background, (0, 0))
    grid.draw()
    snake.draw()
    pygame.display.update()


问:
How to check if an adapter was set on recyclerview?
binding.setAdapter(myRVAdapter);

Which sets the adapter for recycler view. Know it was already attached I wanna check if the recycler view has an existing adapter that was set not set again myRVAdapter twice because it reset the child items view. Was there a method the return if an adapter was set or null?


问:
The package product 'ComposableArchitecture' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0
Got this error:

The package product 'ComposableArchitecture' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0

My iPad has iOS 15.1.

How can I adjust Package.swift?

// swift-tools-version: 5.7

import PackageDescription

extension Target.Dependency {
    // app features
    static var appAdd: Self { "AppAdd" }
    static var appConfigure: Self { "AppConfigure" }
    static var appDetails: Self { "AppDetails" }
    static var appEnvironment: Self { "AppEnvironment" }
    static var appBuilds: Self { "AppBuilds" }
    static var appLogs: Self { "AppLogs" }
    static var appMetric: Self { "AppMetric" }
    static var appMetrics: Self { "AppMetrics" }
    static var cardView: Self { "CardView" }
    static var sidebar: Self { "Sidebar" }
    static var teamAdd: Self { "TeamAdd" }
    static var teamConfigure: Self { "TeamConfigure" }
    static var teams: Self { "Teams" }
    static var teamViewer: Self { "TeamViewer" }
    static var toolbar: Self { "Toolbar" }

    // dependencies
    static var cloudAPIClient: Self { "CloudAPIClient" }
    static var cloudAPITokenClient: Self { "CloudAPITokenClient" }
    static var httpClient: Self { "HTTPClient" }
    static var keychainClient: Self { "KeychainClient" }

    static var composableArchitecture: Self {
        .product(name: "ComposableArchitecture", package: "swift-composable-architecture")
    }

    static var dependencies: Self {
        .product(name: "Dependencies", package: "swift-composable-architecture")
    }

    static var cloudAPIDTOs: Self {
        .product(name: "CloudAPIDTOs", package: "CloudAPIDTOs")
    }

    static var jwtKit: Self {
        .product(name: "JWTKit", package: "jwt-kit")
    }
}

let package = Package(
    name: "ResponsiveCloud",
    platforms: [
        .macOS(.v13), .iOS(.v13)
    ],
    products: [
        .library(name: "AppFeature", targets: ["AppFeature"]),

        // app features
        .library(name: "AppAdd", targets: ["AppAdd"]),
        .library(name: "AppConfigure", targets: ["AppConfigure"]),
        .library(name: "AppDetails", targets: ["AppDetails"]),
        .library(name: "AppEnvironment", targets: ["AppEnvironment"]),
        .library(name: "AppLogs", targets: ["AppLogs"]),
        .library(name: "AppMetric", targets: ["AppMetric"]),
        .library(name: "AppMetrics", targets: ["AppMetrics"]),
        .library(name: "CardView", targets: ["CardView"]),
        .library(name: "Menu", targets: ["Menu"]),
        .library(name: "Sidebar", targets: ["Sidebar"]),
        .library(name: "TeamAdd", targets: ["TeamAdd"]),
        .library(name: "TeamConfigure", targets: ["TeamConfigure"]),
        .library(name: "Teams", targets: ["Teams"]),
        .library(name: "TeamViewer", targets: ["TeamViewer"]),
        .library(name: "Toolbar", targets: ["Toolbar"]),

        // dependencies
        .library(name: "CloudAPIClient", targets: ["CloudAPIClient"]),
        .library(name: "CloudAPIClientLive", targets: ["CloudAPIClientLive"]),
        .library(name: "CloudAPITokenClient", targets: ["CloudAPITokenClient"]),
        .library(name: "CloudAPITokenClientLive", targets: ["CloudAPITokenClientLive"]),
        .library(name: "HTTPClient", targets: ["HTTPClient"]),
        .library(name: "HTTPClientLive", targets: ["HTTPClientLive"]),
        .library(name: "KeychainClient", targets: ["KeychainClient"]),
        .library(name: "KeychainClientLive", targets: ["KeychainClientLive"]),
    ],
    dependencies: [
        .package(path: "../CloudAPIDTOs"),
        .package(url: "https://github.com/pointfreeco/swift-composable-architecture.git", from: "0.45.0"),
        .package(url: "https://github.com/vapor/jwt-kit", from: "4.7.0"),
    ],
    targets: [
        .target(name: "AppFeature", dependencies: [.composableArchitecture, .teams, .cloudAPIDTOs, .cloudAPITokenClient, .teamViewer, .appDetails, .cloudAPIClient, .appMetrics, .appLogs, .appBuilds, .appEnvironment, .appConfigure, .sidebar, .toolbar]),

        // app features
        .target(name: "AppAdd", dependencies: [.composableArchitecture]),
        .target(name: "AppConfigure", dependencies: [.composableArchitecture]),
        .target(name: "AppDetails", dependencies: [.composableArchitecture, .appMetrics, .appLogs, .appBuilds, .appEnvironment, .appConfigure, .cloudAPIClient, .cardView]),
        .target(name: "AppEnvironment", dependencies: [.composableArchitecture]),
        .target(name: "AppMetric", dependencies: [.composableArchitecture, .cardView]),
        .target(name: "AppBuilds", dependencies: [.composableArchitecture, .cardView]),
        .target(name: "AppMetrics", dependencies: [.composableArchitecture, .appMetric, .cloudAPIDTOs, .cloudAPIClient]),
        .target(name: "AppLogs", dependencies: [.composableArchitecture, .cardView, .cloudAPIClient]),
        .target(name: "CardView"),
        .target(name: "Menu", dependencies: [.composableArchitecture]),
        .target(name: "Sidebar", dependencies: [.composableArchitecture, .appAdd]),
        .target(name: "TeamAdd", dependencies: [.composableArchitecture, .cloudAPIClient, .appAdd]),
        .target(name: "TeamConfigure", dependencies: [.composableArchitecture]),
        .target(name: "Teams", dependencies: [.composableArchitecture, .teamViewer, .teamAdd, .cloudAPIDTOs, .cloudAPIClient, .appDetails, .appAdd, .sidebar, .toolbar    ]),
        .target(name: "TeamViewer", dependencies: [.composableArchitecture, .sidebar, .toolbar, .cloudAPIClient, .appDetails]),
        .target(name: "Toolbar", dependencies: [.composableArchitecture, .teamAdd, .cloudAPITokenClient]),

        // dependencies
        .target(name: "CloudAPIClient", dependencies: [.dependencies, .cloudAPIDTOs]),
        .target(name: "CloudAPIClientLive", dependencies: [.dependencies, .cloudAPIDTOs, .cloudAPITokenClient, .cloudAPIClient, .httpClient]),
        .target(name: "CloudAPITokenClient", dependencies: [.dependencies, .keychainClient, .jwtKit]),
        .target(name: "CloudAPITokenClientLive", dependencies: [.dependencies, .cloudAPITokenClient]),
        .target(name: "HTTPClient", dependencies: [.dependencies]),
        .target(name: "HTTPClientLive", dependencies: [.dependencies, .httpClient]),
        .target(name: "KeychainClient", dependencies: [.dependencies]),
        .target(name: "KeychainClientLive", dependencies: [.dependencies, .keychainClient]),

        // tests
        .testTarget(name: "ResponsiveCloudAppTests", dependencies: ["AppFeature", .cloudAPIClient, "CloudAPIClientLive", .jwtKit]),
    ]
)
```


问:
Failed to verify application authentication data
I am hitting the HTTP link from terraform to get some data. I configured not to verify the client certificate, but I am still getting the same error. Any ideas? How to hit the HTTP URL without certificate verification.

main.tf

```<code>data "http" "example_json" {
  url = "https://ccp.us.jgens.com/AIMWebService/api/Accounts?AppID=ANAPLANInt_DEV&Query=Safe=WIN_Int_DEV;Object=dev01.us.jgens.com"

  method   = "GET"
  insecure = true
  request_headers = {
    content-type = "application/json"
  }
}

output "data_json" {
  value = jsondecode(data.http.example_json.response_body)
}
</code>```

and I am getting response like

```<code>data_json = {
  "ErrorCode" = "CETTAH98S"
  "ErrorMsg" = "Authentication error for App ID [ANAPLANInt_DEV]. Reason: CETTAP122E Failed to verify application authentication data: IP \"10.26.32.21\" is unauthorized"
}
</code>```

Body:
I am hitting the HTTP link from terraform to get some data. I configured not to verify the client certificate, but I am still getting the same error. Any ideas? How to hit the HTTP URL without certificate verification.

main.tf

data "http" "example_json" {
  url = "https://ccp.us.jgens.com/AIMWebService/api/Accounts?AppID=ANAPLANInt_DEV&Query=Safe=WIN_Int_DEV;Object=dev01.us.jgens.com"

  method   = "GET"
  insecure = true
  request_headers = {
    content-type = "application/json"
  }
}

output "data_json" {
  value = jsondecode(data.http.example_json.response_body)
}

and I am getting response like

data_json = {
  "ErrorCode" = "CETTAH98S"
  "ErrorMsg" = "Authentication error for App ID [ANAPLANInt_DEV]. Reason: CETTAP122E Failed to verify application authentication data: IP \"10.26.32.21\" is unauthorized"
}


问:
Certain mails not recieved via POP protocol
I am using a ticketing system where i have  configured an pop.gmail.com setting to fetch mails.

We have 2 ticketing system running parallel to fetch new emails.
Below are the issues we are facing during receiving mails on these 2 systems-

sometime few mail received on  System 1 but does not receive on System 2

sometime few mail received on  System 2 but does not receive on System 1

And sometime all mails properly received on both system.

Below are configuration of Ticketing system(email client)

*. On Ticketing client system incoming mail server configured with following

```<code>pop.gmail.com

Port: 995

SSL/TLS: Enabled
</code>```

On Gmail below setting configured

-> POP Enabled with keep copy of downloaded mail on server
-> IMAP is also enabled at the same time

What could be root cause or any changes i need to do in configuration?

Body:
I am using a ticketing system where i have  configured an pop.gmail.com setting to fetch mails.

We have 2 ticketing system running parallel to fetch new emails.
Below are the issues we are facing during receiving mails on these 2 systems-

sometime few mail received on  System 1 but does not receive on System 2

sometime few mail received on  System 2 but does not receive on System 1

And sometime all mails properly received on both system.

Below are configuration of Ticketing system(email client)

*. On Ticketing client system incoming mail server configured with following

pop.gmail.com

Port: 995

SSL/TLS: Enabled

On Gmail below setting configured

-> POP Enabled with keep copy of downloaded mail on server
-> IMAP is also enabled at the same time

What could be root cause or any changes i need to do in configuration?


问:
Google OAuth Redirect With Query String using gem "omniauth-google-oauth2" possible?
I am using omniauth-google-oauth2 gem, for google sign_in. I have read using state we can access the query parameter, check here

But how do I access it with 'omniauth-google-oauth2' gem

I want to get the value of 'test' after google sign_in is redirected to my application.

```<code>https://hello.com/sample?test=hello
</code>```

Body:
I am using omniauth-google-oauth2 gem, for google sign_in. I have read using state we can access the query parameter, check here

But how do I access it with 'omniauth-google-oauth2' gem

I want to get the value of 'test' after google sign_in is redirected to my application.

https://hello.com/sample?test=hello