问:
how to make a filter with radio button and checkbox
I have to filter a list of clients based on radio buttons and also based on checkboxes how can I make them work together? basically I need to be able to see the following combinations

```<code>ALL
ALL-NATIONALS
ALL-FOREIGN
PROD
PROD-NATIONAL
PROD-FOREIGN
TEST
TESTS-NATIONAL
TESTS-FOREIGN
</code>```

I tried these two ways but it doesn't work

//test 1

$(function() {
  var dom = $('#elenco .cliente');
  $('input[name="test"]').on('change', function(a, b) {
    value1 = this.value;
    console.log(value1)
    $('#elenco .cliente').hide();
    if (value1 == 'All') {
      $('#elenco .cliente').show();
      dom = $('#elenco .cliente');
      $('#sito').val('')
      $('#IP').val('')
    }
    if (value1 == 'PROD') {
      $('#elenco .cliente[value="PROD"]').show();
      dom = $('#elenco .cliente[value="PROD"]');
    }
    if (value1 == 'TEST') {
      $('#elenco .cliente[value="TEST"]').show();
      dom = $('#elenco .cliente[value="TEST"]');
    }
    if ($('#check-naz').is(':checked')) {
      $('.naz').show();
      dom = $('.naz');
    }
    if ($('#check-est').is(':checked')) {
      $('.estero').show();
      dom = $('.estero');
    }
  });
})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="sito" class="find" name="txt" placeholder="CLIENTE" type="text" size=15>
<input id="IP" class="find" name="txt" placeholder="INDIRIZZO IP" type="text" size=15>
<input id='all' class="filter" type="radio" value="All" checked name="test"><label>All</label>
<input id='prod' class="filter" type="radio" value="PROD" name="test"><label>PROD</label>
<input id='test' class="filter" type="radio" value="TEST" name="test"><label>TEST</label>
<input id="check-naz" type="checkbox" class="filter check" value="NAZ" name="test"><label>NAZIONALI</label>
<input id="check-est" type="checkbox" class="filter check" value="EST" name="test"><label>ESTERI</label>
<div id="elenco">
  <div class="cliente naz" value="PROD">
    cliente
    <div class="desc">
      scommettendo prod <br>

    </div>
    <div class="funzioni">
      <span>
                             <span>INDIRIZZI IP</span>
      </span>
      <button type="button" onclick="managerScomP(clienti.get('scommettendo').get('scommettendo prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('scommettendo').get('scommettendo prod').get('reload'), 'resultScommP')" id="r1">reload</button>
      <br>

      <ul>
        <li class="version"><button type="button" onclick="UpVersioneT(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion','upVersionScommP')" class="rs1">UpVersione</button>
          <div class="resultVersion" id="upVersionScommP">Risultato</div>
        </li>
        <li><button type="button" onclick="rilascio(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-scommettendo-P')" class="rs1 rilascio">Rilascio</button>
          <div class="resultVersion" id="rilascio-scommettendo-P">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[0]+'/XPayments/reload','resultScommP0')" class="rs1">10.38.0.21</button>
          <div class="result" id="resultScommP0">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[1]+'/XPayments/reload','resultScommP1')" class="rs1"></button>
          <div class="result" id="resultScommP1">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[2]+'/XPayments/reload','resultScommP2')" class="rs1"></button>
          <div class="result" id="resultScommP2">Risultato</div>
        </li>

      </ul>

    </div>
  </div>
  <div class="cliente estero" value="PROD">
    cliente
    <div class="desc">
      betafrik prod <br>

    </div>
    <div class="funzioni">
      <span>INDIRIZZI IP</span>
      <button type="button" onclick="managerScomP(clienti.get('betafrik').get('betafrik prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('betafrik').get('betafrik prod').get('reload'),'resultBetafrikP')" id="r1">reload</button>
      <br>
      <ul>
        <li class="version"><button type="button" onclick="UpVersioneT(clienti.get('betafrik').get('betafrik prod').get('versione') + '/upgradeVersion','UpVersioneBetafrikP')" class="rs1">UpVersione</button>
          <div class="resultVersion" id="UpVersioneBetafrikP">Risultato</div>
        </li>
        <li><button type="button" onclick="rilascio(clienti.get('betafrik').get('betafrik prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-betafrik-P')" class="rs1 rilascio">Rilascio</button>
          <div class="resultVersion" id="rilascio-betafrik-P">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[0] +'/XPayments/reload','resultBetafrikP0')" class="rs1"></button>
          <div class="result" id="resultBetafr

    ikP0">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[1] +'/XPayments/reload','resultBetafrikP1')" class="rs1"></button>
          <div class="result" id="resultBetafrikP1">Risultato</div>
        </li>
      </ul>

    </div>
  </div>
</div></code>```

// test 2

$(function() {
  var dom = $('#elenco .cliente');
  $('input[name="test"]').on('change', function(a, b) {
    value1 = this.value;
    console.log(value1)
    $('#elenco .cliente').hide();
    if (value1 == 'All') {
      $('#elenco .cliente').show();
      dom = $('#elenco .cliente');
      $('#sito').val('')
      $('#IP').val('')
    }
    if (value1 == 'PROD') {
      $('#elenco .cliente[value="PROD"]').show();
      dom = $('#elenco .cliente[value="PROD"]');
    }
    if (value1 == 'TEST') {
      $('#elenco .cliente[value="TEST"]').show();
      dom = $('#elenco .cliente[value="TEST"]');
    }
    if (value1 == 'NAZ') {
      $('.naz').show();
      dom = $('.naz');
    }
    if (value1 == 'EST') {
      $('.estero').show();
      dom = $('.estero');
    }
  });
})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="sito" class="find" name="txt" placeholder="CLIENTE" type="text" size=15>
<input id="IP" class="find" name="txt" placeholder="INDIRIZZO IP" type="text" size=15>
<input id='all' class="filter" type="radio" value="All" checked name="test"><label>All</label>
<input id='prod' class="filter" type="radio" value="PROD" name="test"><label>PROD</label>
<input id='test' class="filter" type="radio" value="TEST" name="test"><label>TEST</label>
<input id="check-naz" type="checkbox" class="filter check" value="NAZ" name="test"><label>NAZIONALI</label>
<input id="check-est" type="checkbox" class="filter check" value="EST" name="test"><label>ESTERI</label>
<div id="elenco">
  <div class="cliente naz" value="PROD">
    cliente
    <div class="desc">
      scommettendo prod <br>

    </div>
    <div class="funzioni">
      <span>
                             <span>INDIRIZZI IP</span>
      </span>
      <button type="button" onclick="managerScomP(clienti.get('scommettendo').get('scommettendo prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('scommettendo').get('scommettendo prod').get('reload'), 'resultScommP')" id="r1">reload</button>
      <br>

      <ul>
        <li class="version"><button type="button" onclick="UpVersioneT(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion','upVersionScommP')" class="rs1">UpVersione</button>
          <div class="resultVersion" id="upVersionScommP">Risultato</div>
        </li>
        <li><button type="button" onclick="rilascio(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-scommettendo-P')" class="rs1 rilascio">Rilascio</button>
          <div class="resultVersion" id="rilascio-scommettendo-P">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[0]+'/XPayments/reload','resultScommP0')" class="rs1">10.38.0.21</button>
          <div class="result" id="resultScommP0">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[1]+'/XPayments/reload','resultScommP1')" class="rs1"></button>
          <div class="result" id="resultScommP1">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[2]+'/XPayments/reload','resultScommP2')" class="rs1"></button>
          <div class="result" id="resultScommP2">Risultato</div>
        </li>

      </ul>

    </div>
  </div>
  <div class="cliente estero" value="PROD">
    cliente
    <div class="desc">
      betafrik prod <br>

    </div>
    <div class="funzioni">
      <span>INDIRIZZI IP</span>
      <button type="button" onclick="managerScomP(clienti.get('betafrik').get('betafrik prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('betafrik').get('betafrik prod').get('reload'),'resultBetafrikP')" id="r1">reload</button>
      <br>
      <ul>
        <li class="version"><button type="button" onclick="UpVersioneT(clienti.get('betafrik').get('betafrik prod').get('versione') + '/upgradeVersion','UpVersioneBetafrikP')" class="rs1">UpVersione</button>
          <div class="resultVersion" id="UpVersioneBetafrikP">Risultato</div>
        </li>
        <li><button type="button" onclick="rilascio(clienti.get('betafrik').get('betafrik prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-betafrik-P')" class="rs1 rilascio">Rilascio</button>
          <div class="resultVersion" id="rilascio-betafrik-P">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[0] +'/XPayments/reload','resultBetafrikP0')" class="rs1"></button>
          <div class="result" id="resultBetafr

    ikP0">Risultato</div>
        </li>
        <li><button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[1] +'/XPayments/reload','resultBetafrikP1')" class="rs1"></button>
          <div class="result" id="resultBetafrikP1">Risultato</div>
        </li>
      </ul>

    </div>
  </div>
</div></code>```

Body:
I have to filter a list of clients based on radio buttons and also based on checkboxes how can I make them work together? basically I need to be able to see the following combinations

ALL
ALL-NATIONALS
ALL-FOREIGN
PROD
PROD-NATIONAL
PROD-FOREIGN
TEST
TESTS-NATIONAL
TESTS-FOREIGN

I tried these two ways but it doesn't work

//test 1

$(function() {
  var dom = $('#elenco .cliente');
  $('input[name="test"]').on('change', function(a, b) {
    value1 = this.value;
    console.log(value1)
    $('#elenco .cliente').hide();
    if (value1 == 'All') {
      $('#elenco .cliente').show();
      dom = $('#elenco .cliente');
      $('#sito').val('')
      $('#IP').val('')
    }
    if (value1 == 'PROD') {
      $('#elenco .cliente[value="PROD"]').show();
      dom = $('#elenco .cliente[value="PROD"]');
    }
    if (value1 == 'TEST') {
      $('#elenco .cliente[value="TEST"]').show();
      dom = $('#elenco .cliente[value="TEST"]');
    }
    if ($('#check-naz').is(':checked')) {
      $('.naz').show();
      dom = $('.naz');
    }
    if ($('#check-est').is(':checked')) {
      $('.estero').show();
      dom = $('.estero');
    }
  });
})

<input id="sito" class="find" name="txt" placeholder="CLIENTE" type="text" size=15>
<input id="IP" class="find" name="txt" placeholder="INDIRIZZO IP" type="text" size=15>
<input id='all' class="filter" type="radio" value="All" checked name="test">All
<input id='prod' class="filter" type="radio" value="PROD" name="test">PROD
<input id='test' class="filter" type="radio" value="TEST" name="test">TEST
<input id="check-naz" type="checkbox" class="filter check" value="NAZ" name="test">NAZIONALI
<input id="check-est" type="checkbox" class="filter check" value="EST" name="test">ESTERI

    cliente

      scommettendo prod

                             INDIRIZZI IP

      <button type="button" onclick="managerScomP(clienti.get('scommettendo').get('scommettendo prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('scommettendo').get('scommettendo prod').get('reload'), 'resultScommP')" id="r1">reload</button>

<button type="button" onclick="UpVersioneT(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion','upVersionScommP')" class="rs1">UpVersione</button>

Risultato

<button type="button" onclick="rilascio(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-scommettendo-P')" class="rs1 rilascio">Rilascio</button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[0]+'/XPayments/reload','resultScommP0')" class="rs1">10.38.0.21</button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[1]+'/XPayments/reload','resultScommP1')" class="rs1"></button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[2]+'/XPayments/reload','resultScommP2')" class="rs1"></button>

Risultato

    cliente

      betafrik prod

      INDIRIZZI IP
      <button type="button" onclick="managerScomP(clienti.get('betafrik').get('betafrik prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('betafrik').get('betafrik prod').get('reload'),'resultBetafrikP')" id="r1">reload</button>

<button type="button" onclick="UpVersioneT(clienti.get('betafrik').get('betafrik prod').get('versione') + '/upgradeVersion','UpVersioneBetafrikP')" class="rs1">UpVersione</button>

Risultato

<button type="button" onclick="rilascio(clienti.get('betafrik').get('betafrik prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-betafrik-P')" class="rs1 rilascio">Rilascio</button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[0] +'/XPayments/reload','resultBetafrikP0')" class="rs1"></button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[1] +'/XPayments/reload','resultBetafrikP1')" class="rs1"></button>

Risultato

// test 2

$(function() {
  var dom = $('#elenco .cliente');
  $('input[name="test"]').on('change', function(a, b) {
    value1 = this.value;
    console.log(value1)
    $('#elenco .cliente').hide();
    if (value1 == 'All') {
      $('#elenco .cliente').show();
      dom = $('#elenco .cliente');
      $('#sito').val('')
      $('#IP').val('')
    }
    if (value1 == 'PROD') {
      $('#elenco .cliente[value="PROD"]').show();
      dom = $('#elenco .cliente[value="PROD"]');
    }
    if (value1 == 'TEST') {
      $('#elenco .cliente[value="TEST"]').show();
      dom = $('#elenco .cliente[value="TEST"]');
    }
    if (value1 == 'NAZ') {
      $('.naz').show();
      dom = $('.naz');
    }
    if (value1 == 'EST') {
      $('.estero').show();
      dom = $('.estero');
    }
  });
})

<input id="sito" class="find" name="txt" placeholder="CLIENTE" type="text" size=15>
<input id="IP" class="find" name="txt" placeholder="INDIRIZZO IP" type="text" size=15>
<input id='all' class="filter" type="radio" value="All" checked name="test">All
<input id='prod' class="filter" type="radio" value="PROD" name="test">PROD
<input id='test' class="filter" type="radio" value="TEST" name="test">TEST
<input id="check-naz" type="checkbox" class="filter check" value="NAZ" name="test">NAZIONALI
<input id="check-est" type="checkbox" class="filter check" value="EST" name="test">ESTERI

    cliente

      scommettendo prod

                             INDIRIZZI IP

      <button type="button" onclick="managerScomP(clienti.get('scommettendo').get('scommettendo prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('scommettendo').get('scommettendo prod').get('reload'), 'resultScommP')" id="r1">reload</button>

<button type="button" onclick="UpVersioneT(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion','upVersionScommP')" class="rs1">UpVersione</button>

Risultato

<button type="button" onclick="rilascio(clienti.get('scommettendo').get('scommettendo prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-scommettendo-P')" class="rs1 rilascio">Rilascio</button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[0]+'/XPayments/reload','resultScommP0')" class="rs1">10.38.0.21</button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[1]+'/XPayments/reload','resultScommP1')" class="rs1"></button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('scommettendo').get('scommettendo prod').get('reload')[2]+'/XPayments/reload','resultScommP2')" class="rs1"></button>

Risultato

    cliente

      betafrik prod

      INDIRIZZI IP
      <button type="button" onclick="managerScomP(clienti.get('betafrik').get('betafrik prod').get('manager'))" id="m1">manager</button>
      <button type="button" onclick="reloadmemScommP(clienti.get('betafrik').get('betafrik prod').get('reload'),'resultBetafrikP')" id="r1">reload</button>

<button type="button" onclick="UpVersioneT(clienti.get('betafrik').get('betafrik prod').get('versione') + '/upgradeVersion','UpVersioneBetafrikP')" class="rs1">UpVersione</button>

Risultato

<button type="button" onclick="rilascio(clienti.get('betafrik').get('betafrik prod').get('versione')+'/upgradeVersion?isRelease=1 ','rilascio-betafrik-P')" class="rs1 rilascio">Rilascio</button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[0] +'/XPayments/reload','resultBetafrikP0')" class="rs1"></button>

Risultato

<button type="button" onclick="reloadmem(clienti.get('betafrik').get('betafrik prod').get('reload')[1] +'/XPayments/reload','resultBetafrikP1')" class="rs1"></button>

Risultato


来源: stackexchange

问:
when i use customer decorator in .vue files, the vscode will show the error 'Property assignment expected'
when i use customer decorator in .vue files,
like this

@riskConfirm( 'test', 'test2' ) handleSubmit() {},

the vscode will show the red lines
enter image description here

and when i use vue-tsc , the information  will like this
enter image description here

I have added  the "experimentalDecorators": true,  in tsconfig

what can i  do to fix id?

ContentLicense: CC BY-SA 4.0


问:
Error in training the model DeepPavlov DaNetQA on my own data
I'm a beginner and I'm trying to train model DaNetQA on some data in json format. E.g. one of the entries in the train.json file:

```<code>{"question": "Вднх - это выставочный центр?", "passage": "«Вы́ставочный центр» — станция Московского монорельса.", "label": true}
</code>```

Other files (validation.json and test.json) have the same format.

But get error:

```<code>AttributeError: 'Value' object has no attribute 'names'
</code>```

What should I do to train DaNetQA model on my data?

Thank you in advance.

(P.S. I tried to train other model insults_kaggle_bert by the same way. The training of this model on my data was successful)

Full discription of error:

```<code>WARNING:datasets.builder:Using custom data configuration mydata-e6b49fefee9b8d55
Downloading and preparing dataset json/mydata to /root/.cache/huggingface/datasets/json/mydata-e6b49fefee9b8d55/0.0.0/0f7e3662623656454fcd2b650f34e886a7db4b9104504885bd462096cc7a9f51...
Downloading data files: 100%
3/3 [00:00<00:00, 108.16it/s]
Extracting data files: 100%
3/3 [00:00<00:00, 99.23it/s]
Generating test split:
0/0 [00:00<?, ? examples/s]
Dataset json downloaded and prepared to /root/.cache/huggingface/datasets/json/mydata-e6b49fefee9b8d55/0.0.0/0f7e3662623656454fcd2b650f34e886a7db4b9104504885bd462096cc7a9f51. Subsequent calls will reuse this data.
100%
3/3 [00:00<00:00, 65.13it/s]
2023-01-08 13:10:05.918 ERROR in 'deeppavlov.core.common.params'['params'] at line 108: Exception in <class 'deeppavlov.dataset_iterators.huggingface_dataset_iterator.HuggingFaceDatasetIterator'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/common/params.py", line 102, in from_params
    component = obj(**dict(config_params, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/data/data_learning_iterator.py", line 49, in __init__
    self.train = self.preprocess(data.get('train', []), *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/dataset_iterators/huggingface_dataset_iterator.py", line 56, in preprocess
    lb = data.info.features[label].names[lb]
AttributeError: 'Value' object has no attribute 'names'
ERROR:deeppavlov.core.common.params:Exception in <class 'deeppavlov.dataset_iterators.huggingface_dataset_iterator.HuggingFaceDatasetIterator'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/common/params.py", line 102, in from_params
    component = obj(**dict(config_params, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/data/data_learning_iterator.py", line 49, in __init__
    self.train = self.preprocess(data.get('train', []), *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/dataset_iterators/huggingface_dataset_iterator.py", line 56, in preprocess
    lb = data.info.features[label].names[lb]
AttributeError: 'Value' object has no attribute 'names'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-2f9574126ac3> in <module>
      1
      2
----> 3 model= train_model(model_config)

5 frames
/usr/local/lib/python3.8/dist-packages/deeppavlov/dataset_iterators/huggingface_dataset_iterator.py in preprocess(self, data, features, label, use_label_name, *args, **kwargs)
     54             if use_label_name and lb != -1:
     55                 # -1 label is used if there is no label (test set)
---> 56                 lb = data.info.features[label].names[lb]
     57             dataset += [(feat, lb)]
     58         return dataset

AttributeError: 'Value' object has no attribute 'names'
</code>```

My full code:

```<code>!pip install -q deeppavlov
!pip install transformers
!pip install datasets

from deeppavlov import build_model, configs
from deeppavlov import train_model
from deeppavlov.core.commands.utils import parse_config

model_config = parse_config("russian_superglue_danetqa_rubert")
model_config['dataset_reader']['path'] = "/content/mydata/" # change the folder in model_config  where store my train files
model = train_model(model_config) # traing model on my data
</code>```

Body:
I'm a beginner and I'm trying to train model DaNetQA on some data in json format. E.g. one of the entries in the train.json file:

{"question": "Вднх - это выставочный центр?", "passage": "«Вы́ставочный центр» — станция Московского монорельса.", "label": true}

Other files (validation.json and test.json) have the same format.

But get error:

AttributeError: 'Value' object has no attribute 'names'

What should I do to train DaNetQA model on my data?

Thank you in advance.

(P.S. I tried to train other model insults_kaggle_bert by the same way. The training of this model on my data was successful)

Full discription of error:

WARNING:datasets.builder:Using custom data configuration mydata-e6b49fefee9b8d55
Downloading and preparing dataset json/mydata to /root/.cache/huggingface/datasets/json/mydata-e6b49fefee9b8d55/0.0.0/0f7e3662623656454fcd2b650f34e886a7db4b9104504885bd462096cc7a9f51...
Downloading data files: 100%
3/3 [00:00<00:00, 108.16it/s]
Extracting data files: 100%
3/3 [00:00<00:00, 99.23it/s]
Generating test split:
0/0 [00:00<?, ? examples/s]
Dataset json downloaded and prepared to /root/.cache/huggingface/datasets/json/mydata-e6b49fefee9b8d55/0.0.0/0f7e3662623656454fcd2b650f34e886a7db4b9104504885bd462096cc7a9f51. Subsequent calls will reuse this data.
100%
3/3 [00:00<00:00, 65.13it/s]
2023-01-08 13:10:05.918 ERROR in 'deeppavlov.core.common.params'['params'] at line 108: Exception in <class 'deeppavlov.dataset_iterators.huggingface_dataset_iterator.HuggingFaceDatasetIterator'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/common/params.py", line 102, in from_params
    component = obj(**dict(config_params, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/data/data_learning_iterator.py", line 49, in __init__
    self.train = self.preprocess(data.get('train', []), *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/dataset_iterators/huggingface_dataset_iterator.py", line 56, in preprocess
    lb = data.info.features[label].names[lb]
AttributeError: 'Value' object has no attribute 'names'
ERROR:deeppavlov.core.common.params:Exception in <class 'deeppavlov.dataset_iterators.huggingface_dataset_iterator.HuggingFaceDatasetIterator'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/common/params.py", line 102, in from_params
    component = obj(**dict(config_params, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/core/data/data_learning_iterator.py", line 49, in __init__
    self.train = self.preprocess(data.get('train', []), *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/deeppavlov/dataset_iterators/huggingface_dataset_iterator.py", line 56, in preprocess
    lb = data.info.features[label].names[lb]
AttributeError: 'Value' object has no attribute 'names'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-2f9574126ac3> in <module>
      1
      2
----> 3 model= train_model(model_config)

5 frames
/usr/local/lib/python3.8/dist-packages/deeppavlov/dataset_iterators/huggingface_dataset_iterator.py in preprocess(self, data, features, label, use_label_name, *args, **kwargs)
     54             if use_label_name and lb != -1:
     55                 # -1 label is used if there is no label (test set)
---> 56                 lb = data.info.features[label].names[lb]
     57             dataset += [(feat, lb)]
     58         return dataset

AttributeError: 'Value' object has no attribute 'names'

My full code:

!pip install -q deeppavlov
!pip install transformers
!pip install datasets

from deeppavlov import build_model, configs
from deeppavlov import train_model
from deeppavlov.core.commands.utils import parse_config

model_config = parse_config("russian_superglue_danetqa_rubert")
model_config['dataset_reader']['path'] = "/content/mydata/" # change the folder in model_config  where store my train files
model = train_model(model_config) # traing model on my data


问:
Dealing with database changes during development phase
Let's suppose we have the following scenario:

1 prod database, and one dev database

Each of these dev databases cannot be dropped/scaffolded, and they'll always live on as they are.

Along with that, there are multiple hosted instances of a web application, on different domains.

As an example, let's say we have 4 domains, 1 for production, and 3 for development.

All the 3 dev domains use the same dev database.

If we have 3 teams, and each takes one dev environment, how would we deal with migrations during the development phases?

What if we want to experiment with things on these databases, and we don't want them to count as migrations?

The thing I'm struggling with is how can team X make changes to a DB, but doesn't want to make a migration out of it, and in parallel, team Y makes other changes as well that might meddle with the ones that team 1 (and maybe even team Z) is working on?

The problem is that we can't have local databases (for reasons that we won't be discussing here)

How can we deal with this using flyway? I don't think making migrations and then "undoing" them is an option here, is it ?

Thanks a lot in advance for the help, and I can clarify this further if needed.


问:
when ı run truffle migrate using truffle ı got this error
when ı run truffle migrate ı got this error

Something went wrong while attempting to connect to the network at http://127.0.0.1:8545. Check your network configuration.
CONNECTION ERROR: Couldn't connect to node http://127.0.0.1:8545.

enter image description here

```<code>npm install -g npm
sudo npm install -g ganache-cli --force
rm package-lock.json
sudo npm install -g ganache-cli
</code>```

also ı changed truffle-caonfig.json file

```<code>networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
     },
     test: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*"
    },
</code>```

Body:
when ı run truffle migrate ı got this error

Something went wrong while attempting to connect to the network at http://127.0.0.1:8545. Check your network configuration.
CONNECTION ERROR: Couldn't connect to node http://127.0.0.1:8545.

enter image description here

npm install -g npm
sudo npm install -g ganache-cli --force
rm package-lock.json
sudo npm install -g ganache-cli

also ı changed truffle-caonfig.json file

networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
     },
     test: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*"
    },


问:
Ubuntu 22.04.1 wake up immediatly after suspend
My system is Ubuntu 22.04.1 with Plasma desktop. Every time I click suspend/sleep button, the system goes to sleep and then wake up immediately. I could not find the cause.</p>


问:
Sanity user registration
Please can anyone tell me is it possible to create user registration in sanity?

I created a blog using sanity. Now I want to create a user registration and like system (user can like a post and it will be saved).

How to do it with sanity?

I thought to create a schema for user, and then just add the liked posts to the array.

Title: Sanity user registration


问:
Zebra Scanner simultaneously scanning
I am using Zebra Enterprise Browser and Zebra Android Scanner and the normal scanning process
working fine with EB.Barcode.enable({allDecoders:true})in javascript.
Now my Question is how is it possible to change in the code the mode from
single scan to simultaneously (multiscan)?</p>
```<code>function fnScanEnable() {
     EB.Barcode.enable({allDecoders:true},fnBarcodeScanned);
      document.getElementById('scanData').value
   = "enabled: press HW trigger to capture.";
}
function fnBarcodeScanned(jsonObject) {
  console.log("Barcode Scanned:{" + JSON.stringify(jsonObject) + "}");
  document.getElementById('scanData').value = "barcode: " + jsonObject.data;
}
</code>```

Title: Zebra Scanner simultaneously scanning

Body:
I am using Zebra Enterprise Browser and Zebra Android Scanner and the normal scanning process
working fine with EB.Barcode.enable({allDecoders:true})in javascript.
Now my Question is how is it possible to change in the code the mode from
single scan to simultaneously (multiscan)?

function fnScanEnable() {
     EB.Barcode.enable({allDecoders:true},fnBarcodeScanned);
      document.getElementById('scanData').value
   = "enabled: press HW trigger to capture.";
}
function fnBarcodeScanned(jsonObject) {
  console.log("Barcode Scanned:{" + JSON.stringify(jsonObject) + "}");
  document.getElementById('scanData').value = "barcode: " + jsonObject.data;
}


问:
ModuleNotFoundError: No module named 'mongoengine.django'
I have been having a problem installing the dependencies from the social library.

i have basically to install two dependencies, makemigrations, and migrate them normally.

According to the docummentation, it states I have to run the two commands:

pip install social-auth-app-django

pip install social-auth-app-django-mongoengine

And than add them to the INSTALLED_APPS in the settings.py file.

Add in settings.py 'SOCIAL_AUTH_STORAGE = 'social_django_mongoengine.models.DjangoStorage''

Add in settings.py SOCIAL_AUTH_JSONFIELD_ENABLED = True

than after all these five steps, makemigration and migrate.

I'm executing the command 'docker compose exec web python manage.py makemigration`

i'm also executing the command 'docker compose exec web python manage.py migrate'

And the result is ALWAYS the same.

ModuleNotFoundError: No module named 'mongoengine.django'

The module is not being found! it is as i didn't put `'social_django_mongoengine' in the INSTALLED_APPS, which i certainly did.

Tried to install diffrient versions, install it in docker container, and it didn't work.

What to do?
`

I have tried reinstalling the dependecies, rebuild docker containers, not it's not reading the module.

Requirments.txt

```<code>`asgiref==3.6.0
attrs==22.2.0
backports.zoneinfo==0.2.1
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
cryptography==39.0.0
defusedxml==0.7.1
Django==4.1.4
dnspython==2.2.1
exceptiongroup==1.0.4
idna==3.4
iniconfig==1.1.1
oauthlib==3.2.2
packaging==22.0
pluggy==1.0.0
psycopg2-binary==2.9.5
pycparser==2.21
PyJWT==2.6.0
pymongo==4.3.3
pytest==7.2.0
pytest-django==4.5.2
python3-openid==3.2.0
requests==2.28.1
requests-oauthlib==1.3.1
six==1.16.0
social-auth-app-django==5.0.0
social-auth-app-django-mongoengine==1.0.0
social-auth-core==4.3.0
# social-auth-storage-mongoengine==1.0.0
sqlparse==0.4.3
tomli==2.0.1
urllib3==1.26.13
`
</code>```

Settings.py

```<code>"""
Django settings for core project.

Generated by 'django-admin startproject' using Django 4.1.4.

For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-nnj!8(ylv6ntx&u%#q(27yl)!*p&5hoti!sz*os2oh^6zqe!0l"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['0.0.0.0']

# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",

    # OWN
    "accounts.apps.AccountsConfig",
    "pages.apps.PagesConfig",
    "dashboard.apps.DashboardConfig",

    # Social-auth
    'social_django',
    'social_django_mongoengine',
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "core.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "templates"],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ]
        },
    }
]

WSGI_APPLICATION = "core.wsgi.application"

# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": "postgres",
        "USER": "postgres",
        "PASSWORD": "postgres",
        "HOST": "db",
        "PORT": 5432,
    }
}

# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
    },
    {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
    {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
    {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
]

# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = "/static/"

STATICFILES_DIRS = [
    os.path.join(BASE_DIR / "static"),
    # '/var/www/static/',
]

## Media
MEDIA_URL = '/media/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

# OWN | Telling django we have our own customer user model
AUTH_USER_MODEL = "accounts.CustomUser"

# Redirect logged-in users to homepage
LOGIN_REDIRECT_URL = "pages:homePage"
LOGOUT_REDIRECT_URL = "pages:homePage"

# Social-auth
SOCIAL_AUTH_STORAGE = 'social_django_mongoengine.models.DjangoStorage'

# Social-auth Database
SOCIAL_AUTH_JSONFIELD_ENABLED = True

AUTHENTICATION_BACKENDS = (
    # 'social_core.backends.open_id.OpenIdAuth',
    # 'social_core.backends.google.GoogleOpenId',
    # 'social_core.backends.google.GoogleOAuth2',
    # 'social_core.backends.google.GoogleOAuth',
    # 'social_core.backends.twitter.TwitterOAuth',
    # 'social_core.backends.yahoo.YahooOpenId',
    'django.contrib.auth.backends.ModelBackend',
)
</code>```

Body:
I have been having a problem installing the dependencies from the social library.

i have basically to install two dependencies, makemigrations, and migrate them normally.

According to the docummentation, it states I have to run the two commands:

pip install social-auth-app-django

pip install social-auth-app-django-mongoengine

And than add them to the INSTALLED_APPS in the settings.py file.

Add in settings.py 'SOCIAL_AUTH_STORAGE = 'social_django_mongoengine.models.DjangoStorage''

Add in settings.py SOCIAL_AUTH_JSONFIELD_ENABLED = True

than after all these five steps, makemigration and migrate.

I'm executing the command 'docker compose exec web python manage.py makemigration`

i'm also executing the command 'docker compose exec web python manage.py migrate'

And the result is ALWAYS the same.

ModuleNotFoundError: No module named 'mongoengine.django'

The module is not being found! it is as i didn't put `'social_django_mongoengine' in the INSTALLED_APPS, which i certainly did.

Tried to install diffrient versions, install it in docker container, and it didn't work.

What to do?
`

I have tried reinstalling the dependecies, rebuild docker containers, not it's not reading the module.

Requirments.txt

`asgiref==3.6.0
attrs==22.2.0
backports.zoneinfo==0.2.1
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
cryptography==39.0.0
defusedxml==0.7.1
Django==4.1.4
dnspython==2.2.1
exceptiongroup==1.0.4
idna==3.4
iniconfig==1.1.1
oauthlib==3.2.2
packaging==22.0
pluggy==1.0.0
psycopg2-binary==2.9.5
pycparser==2.21
PyJWT==2.6.0
pymongo==4.3.3
pytest==7.2.0
pytest-django==4.5.2
python3-openid==3.2.0
requests==2.28.1
requests-oauthlib==1.3.1
six==1.16.0
social-auth-app-django==5.0.0
social-auth-app-django-mongoengine==1.0.0
social-auth-core==4.3.0
# social-auth-storage-mongoengine==1.0.0
sqlparse==0.4.3
tomli==2.0.1
urllib3==1.26.13
`

Settings.py

"""
Django settings for core project.

Generated by 'django-admin startproject' using Django 4.1.4.

For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-nnj!8(ylv6ntx&u%#q(27yl)!*p&5hoti!sz*os2oh^6zqe!0l"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['0.0.0.0']

# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",

    # OWN
    "accounts.apps.AccountsConfig",
    "pages.apps.PagesConfig",
    "dashboard.apps.DashboardConfig",

    # Social-auth
    'social_django',
    'social_django_mongoengine',
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "core.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "templates"],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ]
        },
    }
]

WSGI_APPLICATION = "core.wsgi.application"

# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": "postgres",
        "USER": "postgres",
        "PASSWORD": "postgres",
        "HOST": "db",
        "PORT": 5432,
    }
}

# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
    },
    {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
    {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
    {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
]

# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = "/static/"

STATICFILES_DIRS = [
    os.path.join(BASE_DIR / "static"),
    # '/var/www/static/',
]

## Media
MEDIA_URL = '/media/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

# OWN | Telling django we have our own customer user model
AUTH_USER_MODEL = "accounts.CustomUser"

# Redirect logged-in users to homepage
LOGIN_REDIRECT_URL = "pages:homePage"
LOGOUT_REDIRECT_URL = "pages:homePage"

# Social-auth
SOCIAL_AUTH_STORAGE = 'social_django_mongoengine.models.DjangoStorage'

# Social-auth Database
SOCIAL_AUTH_JSONFIELD_ENABLED = True

AUTHENTICATION_BACKENDS = (
    # 'social_core.backends.open_id.OpenIdAuth',
    # 'social_core.backends.google.GoogleOpenId',
    # 'social_core.backends.google.GoogleOAuth2',
    # 'social_core.backends.google.GoogleOAuth',
    # 'social_core.backends.twitter.TwitterOAuth',
    # 'social_core.backends.yahoo.YahooOpenId',
    'django.contrib.auth.backends.ModelBackend',
)


问:
How to make a text animation with javascript
I want to make a couple of texts appear one by one with a javascript interview, i want each word to pop up one after the other and have the texts appear in 4 different lines and would like to know the best way to go about it as a starter with the language. I saw the following code online but would prefer one i can tell what it does clearly (if else statements and the sorts):

```<code>(function animate() {
  str.length > 0 ? el.innerHTML += str.shift() : clearTimeout(running);
  let running = setTimeout(animate, 90);
  // let runnin = setTimeout(animate, 90);
})();
</code>```

I tried working with this to have another text with the same animation but can't seem to get the other to come up only when the first array of words have been completed by doing this to a different function, but it didn't work out like I'd hoped

```<code>(function ani() {
  if(animate()==false){
    str2.length > 0 ? ell.innerHTML += str2.shift() : clearTimeout(runnin);
    let run = setTimeout(ani, 90);
  }

})();
</code>```

Body:
I want to make a couple of texts appear one by one with a javascript interview, i want each word to pop up one after the other and have the texts appear in 4 different lines and would like to know the best way to go about it as a starter with the language. I saw the following code online but would prefer one i can tell what it does clearly (if else statements and the sorts):

(function animate() {
  str.length > 0 ? el.innerHTML += str.shift() : clearTimeout(running);
  let running = setTimeout(animate, 90);
  // let runnin = setTimeout(animate, 90);
})();

I tried working with this to have another text with the same animation but can't seem to get the other to come up only when the first array of words have been completed by doing this to a different function, but it didn't work out like I'd hoped

(function ani() {
  if(animate()==false){
    str2.length > 0 ? ell.innerHTML += str2.shift() : clearTimeout(runnin);
    let run = setTimeout(ani, 90);
  }

})();


问:
Can't change Gradle wrapper version unless the build succeeds
I have a Gradle project that uses the wrapper.  The project does not build because the wrapper currently uses Gradle version 7.  I know the project will build if I downgrade to version 6.

The problem:

When I run ./gradlew wrapper --gradle-version 6.8, I get a build error.  I checked with ./gradlew --version to confirm it's still on 7.  That's ironic.  That's exactly why I want to downgrade to version 6!

How can I downgrade in this situation.


问:
Unrecognized prop on DOM element when passing it into MUI styled component
running into an issue where I'm trying to pass a prop into an MUI styled component but recieving this error when running the test suite.

```<code>Warning: React does not recognize the `charNumber` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `charnumber` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
</code>```

```<code>styled component:

const StyledTextField = styled(TextField)<{ $charNumber: number }>(
  ({ charNumber, theme }) => ({
    borderWidth: '2px',
    ...textAreaStyling(theme as Theme, charNumber),
  })
);
</code>```

When I call this styled component and give it the charNumber prop (a useState that keeps track of maxLength - typed characters ) I get the above error

```<code>where its called:

<Box>
   <StyledTextField
      charNumber={charNumber}
      error={error}
      multiline
      onChange={handleOnChange}
      inputProps={{ ...inputProps }}
      {...props}
    />
  </Box>
</code>```

Any ideas on how to remove this error from occuring inside the test suite?

Body:
running into an issue where I'm trying to pass a prop into an MUI styled component but recieving this error when running the test suite.

Warning: React does not recognize the `charNumber` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `charnumber` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

styled component:

const StyledTextField = styled(TextField)<{ $charNumber: number }>(
  ({ charNumber, theme }) => ({
    borderWidth: '2px',
    ...textAreaStyling(theme as Theme, charNumber),
  })
);

When I call this styled component and give it the charNumber prop (a useState that keeps track of maxLength - typed characters ) I get the above error

where its called:

<Box>


问:
Unable to get the desired animation
I'm trying to zoom in and zoom out animation using css for preloader but unable to get the desired result

```<code>#preloader{
    background: black;
    background-repeat:no-repeat;
    background-size: cover;
    background-position:center;
    width:100%;
    height:100%;
    z-index:20;
    opacity:1;
    position:fixed;
  }
#preloader>section{
    position:absolute;
    height:250px;
    width:300px;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    background:url('/img/cropped-Dark-roads-no-more-300x151-removebg-preview.png');
    background-repeat: no-repeat;
    background-position: center;
}
.preloader-img{
    animation:zoomlight 1s ease-in-out infinite;
}
@keyframes zoomlight{
    0%{
        opacity:0.3;
    }
    50%{
        opacity:1;
        filter:drop-shadow(1em 1em 2em white)
    }
    100%{
    }

}
</code>```

to get a zoom in effect in preloader usuing transform:scale but the effect is not working

Title: Unable to get the desired animation

Body:
I'm trying to zoom in and zoom out animation using css for preloader but unable to get the desired result

#preloader{
    background: black;
    background-repeat:no-repeat;
    background-size: cover;
    background-position:center;
    width:100%;
    height:100%;
    z-index:20;
    opacity:1;
    position:fixed;
  }
#preloader>section{
    position:absolute;
    height:250px;
    width:300px;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    background:url('/img/cropped-Dark-roads-no-more-300x151-removebg-preview.png');
    background-repeat: no-repeat;
    background-position: center;
}
.preloader-img{
    animation:zoomlight 1s ease-in-out infinite;
}
@keyframes zoomlight{
    0%{
        opacity:0.3;
    }
    50%{
        opacity:1;
        filter:drop-shadow(1em 1em 2em white)
    }
    100%{
    }

}

to get a zoom in effect in preloader usuing transform:scale but the effect is not working


问:
How to learn to web scrape/Selenium?
I recently learned how to build ML models using sci-kit learn, tensorflow and keras and I applied my learnings to create a model to predict NBA games. My model ended up doing pretty well, so much so that I'd like to create a self-updating database that scrapes basketball-reference.com/leagues/ regularly to update game data so that anytime I want a prediction for an upcoming NBA game I can have the parameters ready without needing to do anything.

For this to work I need to know how to scrape basketball-reference.com/leagues/ and I thought I might try to use Selenium but it turned out to be more difficult than I realized. Most of my knowledge with programming/compsci is self-taught so I'm not sure where to turn or what to do to learn how to use Selenium.

Does anyone have any resources they may suggest or maybe some 'pre-requisites' that I should know before I try using Selenium?

I was thinking about checking out a course on Udemy!

Title: How to learn to web scrape/Selenium?


问:
How Authenticate() method get called in AuthenticationProvider class in Spring security?
In spring security, I created my own customAuthenticationprovider. when i call auth.authenticationProvider(customAuthenticationProvider) it should call the authenticate() present inside the customAuthenticationprovider class right. But there is no such flow i am able to figure out where it is calling the authenticate method.
All i want to know how authenticate() method get called. I know it is authenticationProvider which is making call to authenticate but how and where is the code?

```<code> @Override
    protected void configure(AuthenticationManagerBuilder auth) {
        auth.authenticationProvider(customAuthenticationProvider);
    }

</code>```

My

```<code>@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {

    @Autowired
    private UserDetailsService userDetailsService;

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Override
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        String username = authentication.getName();
        String password = String.valueOf(authentication.getCredentials());
        UserDetails ud = userDetailsService.loadUserByUsername(username); // our own userDetailService is being used.
        if (ud != null) {
            if (passwordEncoder.matches(ud.getPassword(), password)) {  // our own passwordEncoder is being used.
                var a = new UsernamePasswordAuthenticationToken(username, password, ud.getAuthorities());
                return a;
            }
        }
        throw new BadCredentialsException("Error!");
    }

    @Override
    public boolean supports(Class<?> authType) {
        return UsernamePasswordAuthenticationToken.class.equals(authType);
    }
}
</code>```

Body:
In spring security, I created my own customAuthenticationprovider. when i call auth.authenticationProvider(customAuthenticationProvider) it should call the authenticate() present inside the customAuthenticationprovider class right. But there is no such flow i am able to figure out where it is calling the authenticate method.
All i want to know how authenticate() method get called. I know it is authenticationProvider which is making call to authenticate but how and where is the code?

 @Override
    protected void configure(AuthenticationManagerBuilder auth) {
        auth.authenticationProvider(customAuthenticationProvider);
    }

My

@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {

    @Autowired
    private UserDetailsService userDetailsService;

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Override
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        String username = authentication.getName();
        String password = String.valueOf(authentication.getCredentials());
        UserDetails ud = userDetailsService.loadUserByUsername(username); // our own userDetailService is being used.
        if (ud != null) {
            if (passwordEncoder.matches(ud.getPassword(), password)) {  // our own passwordEncoder is being used.
                var a = new UsernamePasswordAuthenticationToken(username, password, ud.getAuthorities());
                return a;
            }
        }
        throw new BadCredentialsException("Error!");
    }

    @Override
    public boolean supports(Class<?> authType) {
        return UsernamePasswordAuthenticationToken.class.equals(authType);
    }
}


问:
We have updated the Spring Boot version from 2.7.6 to 3.0.0- While running the Junit tests - One of the test failing with Type definition error.PFB
We have updated the Spring Boot version from 2.7.6 to 3.0.0- While running the Junit tests - One of the test failing with- " "errors": [
{
"message": "Type definition error: [simple type, class ch.qos.logback.core.joran.util.ConfigurationWatchListUtil]",
"code": "000000"
}
]

As a part of updation to 3.0.0 we have rewritten the codes which used javax to jakarta servlet. All the Junit test is cleared except one which fails as above


问:
Why is a generated file (via SourceGenerator) in .NET7-Windows csproj file not included, if a local namespace in xaml file is used?
The .NET7-Windows project with SourceGenerator e.g. MimeTypes is working.
When adding a local namespace to the WPF-UserControl the generated file is not included anymore.
How can I modify the project file, that all generated files are automatically included?

Reproducable Example:

Example.csproj:

```<code><Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net7.0-windows</TargetFramework>
    <LangVersion>10</LangVersion>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <UseWindowsForms>true</UseWindowsForms>
    <UseWPF>true</UseWPF>
    <NoWarn>CA1416</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OutputType>Library</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MimeTypes" Version="2.4.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>
</code>```

UserControl1.xaml:

```<code><UserControl x:Class="Example.UserControl1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            >
   <Grid/>
</UserControl>
</code>```

UserControl1.xaml.cs:

```<code>using System.Windows.Controls;

namespace Example
{
   public partial class UserControl1 : UserControl
   {
       public UserControl1()
       {
           InitializeComponent();
           var x = MimeTypes.GetMimeType("Testfile.exe");
       }
   }
}
</code>```

This is working as expected, but when adding:

```<code>            xmlns:local="clr-namespace:Example"
</code>```

The generated MimeTypes file is not included anymore, which leads to the compiler error CS0103 (The name 'MimeTypes' does not exist in the current context)

Body:
The .NET7-Windows project with SourceGenerator e.g. MimeTypes is working.
When adding a local namespace to the WPF-UserControl the generated file is not included anymore.
How can I modify the project file, that all generated files are automatically included?

Reproducable Example:

Example.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net7.0-windows</TargetFramework>
    <LangVersion>10</LangVersion>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <UseWindowsForms>true</UseWindowsForms>
    <UseWPF>true</UseWPF>
    <NoWarn>CA1416</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OutputType>Library</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MimeTypes" Version="2.4.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>

UserControl1.xaml:

<UserControl x:Class="Example.UserControl1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            >
   <Grid/>
</UserControl>

UserControl1.xaml.cs:

using System.Windows.Controls;

namespace Example
{
   public partial class UserControl1 : UserControl
   {
       public UserControl1()
       {
           InitializeComponent();
           var x = MimeTypes.GetMimeType("Testfile.exe");
       }
   }
}

This is working as expected, but when adding:

            xmlns:local="clr-namespace:Example"

The generated MimeTypes file is not included anymore, which leads to the compiler error CS0103 (The name 'MimeTypes' does not exist in the current context)


问:
How to build a control chart of EWMA in R?
I'm trying to create a function to generate an EWMA graph similar to the one in the image.

I tried using using the library (qcc), but I didn't get the result.I'm new to this and I don't quite understand how the ewma chart works.

The values used μ=100,  σ=1 , k=2.859 and λ=0.2 .

```<code>test <-c(100.23,100.19,102.02,99.59,99.81,99.86,99.6,100.35,99.38,100.83,99.73,98,99.72,101.34,98.77,99.94,99.47,
99.95,100.33,99.57,100.82,100.23,100.68,101.64,100.86,99.28,101.41,100.21,101.85,101.43,103
)
v <- ewma(test,lambda = 0.2, nsigmas = 2.859 ,xlab="x",ylab="EWMA",std.dev = 1,center = 100)
</code>```

Body:
I'm trying to create a function to generate an EWMA graph similar to the one in the image.

I tried using using the library (qcc), but I didn't get the result.I'm new to this and I don't quite understand how the ewma chart works.

The values used μ=100,  σ=1 , k=2.859 and λ=0.2 .

test <-c(100.23,100.19,102.02,99.59,99.81,99.86,99.6,100.35,99.38,100.83,99.73,98,99.72,101.34,98.77,99.94,99.47,
99.95,100.33,99.57,100.82,100.23,100.68,101.64,100.86,99.28,101.41,100.21,101.85,101.43,103
)
v <- ewma(test,lambda = 0.2, nsigmas = 2.859 ,xlab="x",ylab="EWMA",std.dev = 1,center = 100)


问:
How to disable or make less visible the wavy underlines in VS Code?
Strong underscores make it hard for me to focus. A number of solutions are described in this link, but it is outdated. I wanted to try the solution in the link, however, the options described do not appear in VS Code.

Is there an up to date solution?


问:
ELK Dev tools API to create an alert
I want to create an alert rule using ELK dev tools. When I make it in the UI manually, I created like in the image.

I tried with the below code and got the mentioned issue. My elastic version is v 8.4.3.

```<code># POST .monitoring-alerts-7/_create 400
{
  "error": "no handler found for uri [/.monitoring-alerts-7/_create?pretty=true] and
method [POST]"
}
# {  400
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "[request query.method]: Method must be one of, case insensitive
['HEAD', 'GET', 'POST', 'PUT', 'DELETE']. Received '{'."
}
</code>```

Do I need to use a separate API?

Title: ELK Dev tools API to create an alert

Body:
I want to create an alert rule using ELK dev tools. When I make it in the UI manually, I created like in the image.

I tried with the below code and got the mentioned issue. My elastic version is v 8.4.3.

# POST .monitoring-alerts-7/_create 400
{
  "error": "no handler found for uri [/.monitoring-alerts-7/_create?pretty=true] and
method [POST]"
}
# {  400
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "[request query.method]: Method must be one of, case insensitive
['HEAD', 'GET', 'POST', 'PUT', 'DELETE']. Received '{'."
}

Do I need to use a separate API?


问:
Duplicate keys with hbm2ddl since upgrade
We upgraded Hibernate from Version 5.1.16 to 5.6.12 and our schemaexport stopped working because of a duplicate key error.

We have entities that look similar to this:

```<code>@Audited
@MappedSuperclass
public abstract class AEntity {

    @Id
    @TableGenerator(name = "aGen", table = "ID_GEN", pkColumnValue = "A_ID", allocationSize = 100, valueColumnName = "SEQUENCE_NEXT_HI_VALUE")
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "aGen")
    private Long id;
</code>```

and multiple:

```<code>@Audited
@Entity
public class BEntity extends AEntity {
...

@Audited
@Entity
public class CEntity extends AEntity {
...
</code>```

We are using org.hibernate.tool.hbm2ddl.SchemaExport to generate a schema. Since the upgrade the generation fails with a duplicate error because we get multiple inserts for the same generator:

```<code>insert into ID_GEN(sequence_name, SEQUENCE_NEXT_HI_VALUE) values ('A_ID',1)
insert into ID_GEN(sequence_name, SEQUENCE_NEXT_HI_VALUE) values ('A_ID',1)
...
</code>```

We get as much inserts as there are subclasses to AEntity. How can i fix this problem?

Edit: I have a hunch that it could be related to https://hibernate.atlassian.net/browse/HHH-12454, but the release notes states that the changes got reversed.

Body:
We upgraded Hibernate from Version 5.1.16 to 5.6.12 and our schemaexport stopped working because of a duplicate key error.

We have entities that look similar to this:

@Audited
@MappedSuperclass
public abstract class AEntity {

    @Id
    @TableGenerator(name = "aGen", table = "ID_GEN", pkColumnValue = "A_ID", allocationSize = 100, valueColumnName = "SEQUENCE_NEXT_HI_VALUE")
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "aGen")
    private Long id;

and multiple:

@Audited
@Entity
public class BEntity extends AEntity {
...

@Audited
@Entity
public class CEntity extends AEntity {
...

We are using org.hibernate.tool.hbm2ddl.SchemaExport to generate a schema. Since the upgrade the generation fails with a duplicate error because we get multiple inserts for the same generator:

insert into ID_GEN(sequence_name, SEQUENCE_NEXT_HI_VALUE) values ('A_ID',1)
insert into ID_GEN(sequence_name, SEQUENCE_NEXT_HI_VALUE) values ('A_ID',1)
...

We get as much inserts as there are subclasses to AEntity. How can i fix this problem?

Edit: I have a hunch that it could be related to https://hibernate.atlassian.net/browse/HHH-12454, but the release notes states that the changes got reversed.


问:
How to get the same image section of a stereo Camera setup using opencv?
I got 2 cameras which are mounted to each other. The left one is a tof-depth camera and the right one is a normal rgb-camera. The resolution of the left camera is 640x480 and of the right one 1280x1024. Every point of the right image is also in the left image. So the left camera has a slighty bigger view than the right one.
Using cv2.stereoCalibrate() I got the following matrices:

M1 - the camera intrinsics matrix of my left camera

M2 - the camera intrinsics matrix of my right camera

D1 - the distortion coefficients of my left camera

D2 - the distortion coefficients of my right camera

R - the rotation matrix

T - the translation vector

I am not sure but I think the rotation matrix and translation vector are from the right to left camera.

I also got "imgL.png" and "imgR.png".
imgL is the depth image of the tof-camera and is already undistorted.
imgR is the rgb image from the normal camera and I got both the distorted (raw, size=1280x1024) and undistorted image (size=1106x870) using:

```<code>newcameramtx, roi = cv2.getOptimalNewCameraMatrix(color_camera_matrix, color_dist, (w,h), 1, (w,h))
dst = cv2.undistort(imgR, color_camera_matrix, color_dist, None, newcameramtx)
</code>```

Now I want to get 2 images with the same image section, both in 640x480, where each point of imgL(x,y) = imgR(x,y).
Is this possible using the opencv functions?
I have tried using the cv2.stereoRectify() function but I dont know how to continue from there on or if thats even the right way.

I have tried doing:

```<code>rectify = cv.stereoRectify(M1, D1, M2, D2, (640,480), R, T, Q=None, alpha=-1, newImageSize=(0,0))
</code>```

and got R1, R2, P1, P2, Q, validPixROI1, validPixROI2
But as I said I dont know how to continue with that or if that is even the right way.

I have also tried using:

```<code>stereo = cv.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(imgL,imgR)
</code>```

But I get an error, because the images doesnt have the same size.

Body:
I got 2 cameras which are mounted to each other. The left one is a tof-depth camera and the right one is a normal rgb-camera. The resolution of the left camera is 640x480 and of the right one 1280x1024. Every point of the right image is also in the left image. So the left camera has a slighty bigger view than the right one.
Using cv2.stereoCalibrate() I got the following matrices:

M1 - the camera intrinsics matrix of my left camera

M2 - the camera intrinsics matrix of my right camera

D1 - the distortion coefficients of my left camera

D2 - the distortion coefficients of my right camera

R - the rotation matrix

T - the translation vector

I am not sure but I think the rotation matrix and translation vector are from the right to left camera.

I also got "imgL.png" and "imgR.png".
imgL is the depth image of the tof-camera and is already undistorted.
imgR is the rgb image from the normal camera and I got both the distorted (raw, size=1280x1024) and undistorted image (size=1106x870) using:

newcameramtx, roi = cv2.getOptimalNewCameraMatrix(color_camera_matrix, color_dist, (w,h), 1, (w,h))
dst = cv2.undistort(imgR, color_camera_matrix, color_dist, None, newcameramtx)

Now I want to get 2 images with the same image section, both in 640x480, where each point of imgL(x,y) = imgR(x,y).
Is this possible using the opencv functions?
I have tried using the cv2.stereoRectify() function but I dont know how to continue from there on or if thats even the right way.

I have tried doing:

rectify = cv.stereoRectify(M1, D1, M2, D2, (640,480), R, T, Q=None, alpha=-1, newImageSize=(0,0))

and got R1, R2, P1, P2, Q, validPixROI1, validPixROI2
But as I said I dont know how to continue with that or if that is even the right way.

I have also tried using:

stereo = cv.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(imgL,imgR)

But I get an error, because the images doesnt have the same size.


问:
Put image in front of other image using picturebox c# windows forms
I want to add one image and two text labels in front of an image to get this result:
Result X folder

I have this code:
Code I have now

And this code, returns every folder from C:\Users\VisualStudio\Documents, like this:
Result of my code

Yes, in my code, I have just the first part, but two more parts are needed:

2 text labels in front of image

1 image in front of main image

For example of location for three news items, put a example number please.

private void mostrarCarpetas(string rutaCarpeta)
{
    string rutaActual = "";
    // Obtenemos la lista de carpetas
    string[] listaCarpetas = Directory.GetDirectories(rutaCarpeta).ToArray();

    // Garantizamos que el panel donde se muestran las cosas está vacío
    flowLayoutPanel1.Controls.Clear();
    flowLayoutPanel1.AutoScroll = true;

    // Definimos variab le de directorioActual
    rutaActual = rutaCarpeta;

    for (int i = 0; i < listaCarpetas.Length - 1; i++)
    {
        bool isHidden = ((File.GetAttributes(listaCarpetas[i]) & FileAttributes.Hidden) == FileAttributes.Hidden);

        if (!isHidden)
        {
            // Get the name of the file from the path
            var startOfName = listaCarpetas[i].LastIndexOf("\\");
            var fileName = listaCarpetas[i].Substring(startOfName + 1, listaCarpetas[i].Length - (startOfName + 1));

            // Show Image for every folder
            PictureBox newButton = new PictureBox();
            string imagenbackground = @"C:/Users/VisualStudio/Documents/pagina_nombre.png";
            newButton.Image = Image.FromFile(imagenbackground);
            newButton.Cursor = Cursors.Hand;
            newButton.Size = new System.Drawing.Size(300, 300);
            newButton.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
            newButton.Anchor = AnchorStyles.None;
            newButton.TabIndex = 2;
            flowLayoutPanel1.Controls.Add(newButton);
        }
    }
}
```


问:
subprocess still needs file after add-data in pyinstaller
I am trying to generate one .exe file with pyinstaller

my python file

```<code>import subprocess
proc=r".\file.exe"

CLI_VERSION=subprocess.check_output([proc, '-v'],shell=True).decode('utf-8').strip()
print (CLI_VERSION)
</code>```

with file.exe being in the same folder as the python file
python myfile.py works just fine and prints the expected output

Now when I try to package that as .exe and include file.exe, subprocess still fails to find the file

pyinstaller.exe --onefile  --add-data ".\file.exe;." .\myfile.py

now take the generated.exe and try to run it:

.\file.exe' is not recognized as an internal or external command,
...
...
... subprocess.CalledProcessError: Command '['.\file.exe', '-v']' returned non-zero exit status 1.

I tried add-binary instead of add-data since this is an exe file but it is still not working. Please note that the file.exe always returns 0, if it is called properly.

I am assuming this has to do with how subprocess works? is there a way to get it to work?

Is there a way to list files included in the .exe package? Judging by the filesize variation, I think the file.exe has been added, but I believe subprocess access the filesystem directly without passing by the files included in .exe package, is that the case?

I tried to do add-data for some files then inside the python file do "dir" (ls equivalent of ls) I don't see the files I included with --add-data in the list

Edit:
I unpackaged the generated .exe using pyinstxtractor.
The outcome is that my file.exe is well included in the same place as the name_of_my_python_file.pyc in the extracted package.

This makes me believe more in my theory: subprocess accesses the filesystem directly and does not read inside the packaged data. Does anyone have the knowledge to confirm and suggest a workaround (if possible)?

Thanks

Body:
I am trying to generate one .exe file with pyinstaller

my python file

import subprocess
proc=r".\file.exe"

CLI_VERSION=subprocess.check_output([proc, '-v'],shell=True).decode('utf-8').strip()
print (CLI_VERSION)

with file.exe being in the same folder as the python file
python myfile.py works just fine and prints the expected output

Now when I try to package that as .exe and include file.exe, subprocess still fails to find the file

pyinstaller.exe --onefile  --add-data ".\file.exe;." .\myfile.py

now take the generated.exe and try to run it:

.\file.exe' is not recognized as an internal or external command,
...
...
... subprocess.CalledProcessError: Command '['.\file.exe', '-v']' returned non-zero exit status 1.

I tried add-binary instead of add-data since this is an exe file but it is still not working. Please note that the file.exe always returns 0, if it is called properly.

I am assuming this has to do with how subprocess works? is there a way to get it to work?

Is there a way to list files included in the .exe package? Judging by the filesize variation, I think the file.exe has been added, but I believe subprocess access the filesystem directly without passing by the files included in .exe package, is that the case?

I tried to do add-data for some files then inside the python file do "dir" (ls equivalent of ls) I don't see the files I included with --add-data in the list

Edit:
I unpackaged the generated .exe using pyinstxtractor.
The outcome is that my file.exe is well included in the same place as the name_of_my_python_file.pyc in the extracted package.

This makes me believe more in my theory: subprocess accesses the filesystem directly and does not read inside the packaged data. Does anyone have the knowledge to confirm and suggest a workaround (if possible)?

Thanks


问:
How to get video scrubbing with mouse cursor movement?
trying to find a way to replicate the functionality of scrubbing a video with mouse movement.  Example of such can be seen here:  https://domo.site/director/andre-stringer

I see this site is using GSAP and Observer but not sure if this is handling the scrubbing. Also using VideoJS but been unable to find specific code or plugin to support this in VideoJS.

Any ideas on approach / scripts would be appreciated!


问:
How to let React select component so extend its parent
I'm using react-select for a drop down menu looking like this

component looks like this :

```<code><table className="w-full text-sm text-center  text-projectlightblack  overflow-hidden  font-poppins my-10 border-t border-t-projectblue border-l border-l-projectblue ">
      <thead className="text-xl bg-projectbackgroundgray   text-projectlightblack font-medium"></thead>
      <tbody className="font-normal text-lg whitespace-pre-line text-start px-[10px] ">
        {data?.rows?.map((row, index) => {
          return (
            <tr
              className="py-[10px] border-b border-b-projectblue border-r border-r-projectblue border-t-0 border-l-0"
              key={index}
            >
              {row?.map((cell, index) => {
                let {
                  value,
                  tailwindClasses,
                  cellType,
                  dataType,
                  address,
                  options,
                } = processCell(cell, cellData) || {};

                if (cellType == "input" && dataType == "list") {
                  return (
                    <td className="w-[300px] h-auto" key={index}>
                      {isLoading || isFetching ? (
                        <InputLoadingIndicator />
                      ) : (
                        <Select
                          options={options}
                          isLoading={isLoading || isFetching}
                          value={value}
                          onChange={(option) => {
                            setQueryKey(option);
                            mutate({
                              addressValue: address,
                              dateValue: option.value,
                            });
                          }}
                          styles={{
                            control: (baseStyles, state) => ({
                              ...baseStyles,
                              borderColor: state.isFocused ? "white" : "white",
                            }),
                          }}
                          menuPlacement="auto"
                        />
                      )}
                    </td>
                  );
                }
</code>```

basically when I extend the dropdown menu and it's bigger than parent component it doesn't work , giving a fixed height to the table tag would fix it but it's a reusable component and that's ruin it , Any other fixes?

Body:
I'm using react-select for a drop down menu looking like this

component looks like this :

        {data?.rows?.map((row, index) => {
          return (

              {row?.map((cell, index) => {
                let {
                  value,
                  tailwindClasses,
                  cellType,
                  dataType,
                  address,
                  options,
                } = processCell(cell, cellData) || {};

                if (cellType == "input" && dataType == "list") {
                  return (

                      {isLoading || isFetching ? (
                        <InputLoadingIndicator />
                      ) : (
                        <Select
                          options={options}
                          isLoading={isLoading || isFetching}
                          value={value}
                          onChange={(option) => {
                            setQueryKey(option);
                            mutate({
                              addressValue: address,
                              dateValue: option.value,
                            });
                          }}
                          styles={{
                            control: (baseStyles, state) => ({
                              ...baseStyles,
                              borderColor: state.isFocused ? "white" : "white",
                            }),
                          }}
                          menuPlacement="auto"
                        />
                      )}

                  );
                }

basically when I extend the dropdown menu and it's bigger than parent component it doesn't work , giving a fixed height to the table tag would fix it but it's a reusable component and that's ruin it , Any other fixes?


问:
NodeJS - Execute code after expiration of database item timestamp
I have a Room entity in database with columns expiryDate and status which can be Active, SoonToExpire and Expired. Now I have such a use case, that when user on UI changes given room state to SoonToExpire I update this column in database and update expiryDate to be 5 minutes in the future.

After this 5 minutes, somehow I need to update state of this room once more to be Expired.

What is the most elegant and efficient way to handle this in NodeJS/Express application in multi pods deployment? I guess setTimeout is not the best option because of a possibility of pod crashing. Maybe some kind of listener?


问:
Access Form : Bind a recordset from sql server
I try to use again a code who whas successful on the past to bind a recordset from sql server to an Access Form.

```<code>Dim serverAddress As String, DB As String, stADO As String
serverAddress = "xxx"
DB = "yyy"
stADO = "Provider=MSOLEDBSQL;Server=" & serverAddress & ";Database=" & DB & ";UID=admin;PWD=password;"

Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
cn.ConnectionString = stADO

cn.Open

rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM Table", cn, adOpenStatic, adLockReadOnly

DoCmd.OpenForm "Form_Name", acFormDS

'sanity check if we have data on the Recordset
Debug.Print rs(2)

Set Forms("Form_Name").Form.Recordset = rs
cn.Close
Set cn = Nothing

</code>```

For sure the recorset is populate as debug.print rs(2) return a value.

When the command : "Set Forms("Form_Name").Form.Recordset = rs" is executed the database crashed and closed.

I have added also error management with on error goto but the DB crash without any message.

Thanks in advance for any help you could provide to resolve this issue.

Alexis

Error management without success
Use alternative connexion string
Test if the recordset is populated

Body:
I try to use again a code who whas successful on the past to bind a recordset from sql server to an Access Form.

Dim serverAddress As String, DB As String, stADO As String
serverAddress = "xxx"
DB = "yyy"
stADO = "Provider=MSOLEDBSQL;Server=" & serverAddress & ";Database=" & DB & ";UID=admin;PWD=password;"

Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
cn.ConnectionString = stADO

cn.Open

rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM Table", cn, adOpenStatic, adLockReadOnly

DoCmd.OpenForm "Form_Name", acFormDS

'sanity check if we have data on the Recordset
Debug.Print rs(2)

Set Forms("Form_Name").Form.Recordset = rs
cn.Close
Set cn = Nothing

For sure the recorset is populate as debug.print rs(2) return a value.

When the command : "Set Forms("Form_Name").Form.Recordset = rs" is executed the database crashed and closed.

I have added also error management with on error goto but the DB crash without any message.

Thanks in advance for any help you could provide to resolve this issue.

Alexis

Error management without success
Use alternative connexion string
Test if the recordset is populated


问:
access permissions for specific users for some pages under tomcat
I was trying to grant access to a project for a specific user only, I saw a way within changing web.xml
The app is accessible also for all RnD users using LDAP, and it's working very well

I'm trying to block TEST project for other users and only valid for 'USER_X' user
but I'm getting forbidden request

```<code>Web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Site</web-resource-name>
<url-pattern>/api/v1/search</url-pattern> <!-- protect search endpoint whitelisted above -->
<url-pattern>/api/v1/suggest/*</url-pattern> <!-- protect suggest endpoint whitelisted above -->
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>RnD</role-name>
</auth-constraint>
</security-constraint>

<security-constraint>
<web-resource-collection>
<web-resource-name>My Repo</web-resource-name>
<url-pattern>/xref/**TEST**/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>developer</role-name>
</auth-constraint>
</security-constraint>

<role>
<description>My Role</description>
<role-name>developer</role-name>
</role>

<user>
<description>My User</description>
<role-name>developer</role-name>
<username>**USER_X**</username>
</user>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>

<security-role>
<role-name>RnD</role-name>
</security-role>

</code>```

By localhost_access_log I can user USER_X is getting 403 for TEST access

`- USER_X [09/Jan/2023:13:03:03 +0200] "GET /source/api/v1/suggest/config HTTP/1.1" 200 376

USER_X [09/Jan/2023:13:03:09 +0200] "GET /source/xref/TEST HTTP/1.1" 403 4525

USER_X [09/Jan/2023:13:15:03 +0200] "GET /source/ HTTP/1.1" 200 141567

USER_X [09/Jan/2023:13:15:04 +0200] "GET /source/api/v1/suggest/config HTTP/1.1" 200 376

USER_X [09/Jan/2023:13:15:14 +0200] "GET /source/xref/TEST HTTP/1.1" 403 4525`

excepting to be accessible for user USER_X

Body:
I was trying to grant access to a project for a specific user only, I saw a way within changing web.xml
The app is accessible also for all RnD users using LDAP, and it's working very well

I'm trying to block TEST project for other users and only valid for 'USER_X' user
but I'm getting forbidden request

Web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Site</web-resource-name>
<url-pattern>/api/v1/search</url-pattern>
<url-pattern>/api/v1/suggest/*</url-pattern>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>RnD</role-name>
</auth-constraint>
</security-constraint>

<security-constraint>
<web-resource-collection>
<web-resource-name>My Repo</web-resource-name>
<url-pattern>/xref/**TEST**/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>developer</role-name>
</auth-constraint>
</security-constraint>

<role>
<description>My Role</description>
<role-name>developer</role-name>
</role>

<user>
<description>My User</description>
<role-name>developer</role-name>
<username>**USER_X**</username>
</user>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>

<security-role>
<role-name>RnD</role-name>
</security-role>

By localhost_access_log I can user USER_X is getting 403 for TEST access

`- USER_X [09/Jan/2023:13:03:03 +0200] "GET /source/api/v1/suggest/config HTTP/1.1" 200 376

USER_X [09/Jan/2023:13:03:09 +0200] "GET /source/xref/TEST HTTP/1.1" 403 4525

USER_X [09/Jan/2023:13:15:03 +0200] "GET /source/ HTTP/1.1" 200 141567

USER_X [09/Jan/2023:13:15:04 +0200] "GET /source/api/v1/suggest/config HTTP/1.1" 200 376

USER_X [09/Jan/2023:13:15:14 +0200] "GET /source/xref/TEST HTTP/1.1" 403 4525`

excepting to be accessible for user USER_X


问:
Second Order ODE using Neural Network
I'm studying numerical methods for ODEs and i'm using machine learning for it.
I'm trying to implement an 2nd order ODE in the code that i'm using to solve a 1st order ODE.
The ODE that i want to solve is: y'' = -10y, where y(0) = 0 and y'(0) = 1.
My question is: I know i need to break the 2nd order ODE in two 1st order ODE, but, how do i do that? I need to change f(x) (Check code bellow)?
How do i implement the 2nd order in the loss function?
The GradientTape need to be changed?

I know it is very basic stuffs, but im really new at machine learning and i'm trying to learn it.

Thanks!

Leo

*Here is the code i'm using at moment for 1st order ODE.

```<code>import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(123)
tf.random.set_seed(123)

#Condições Iniciais
f0 = 1

# Número Infinitesimal
inf_s = np.sqrt(np.finfo(np.float32).eps)

# Parâmetros
learning_rate = 0.01
training_steps = 5000
batch_size = 100
display_step = training_steps/10

# Parâmetros da Rede
n_input = 1
n_hidden_1 = 32
n_hidden_2 = 32
n_output = 1

weights = {
    'h1': tf.Variable(tf.random.normal([n_input, n_hidden_1])),
    'h2': tf.Variable(tf.random.normal([n_hidden_1, n_hidden_2])),
    'out': tf.Variable(tf.random.normal([n_hidden_2, n_output]))
}
biases = {
    'b1': tf.Variable(tf.random.normal([n_hidden_1])),
    'b2': tf.Variable(tf.random.normal([n_hidden_2])),
    'out': tf.Variable(tf.random.normal([n_output]))
}

# Otimizador gradiente descendente
optimizer = tf.optimizers.SGD(learning_rate)

# Criando Modelo
def multilayer_perceptron(x):
    x = np.array([[[x]]], dtype= 'float32')
    # Camada escondida 1 com 32 neuronios
    layer_1 = tf.add(tf.matmul(x, weights['h1']), biases['b1'])
    layer_1 = tf.nn.sigmoid(layer_1) #Relu não funciona melhor?
    # Camada escondida 2 com 32 neuronios
    layer_2 = tf.add(tf.matmul(layer_1, weights['h2']), biases['b2'])
    layer_2 = tf.nn.sigmoid(layer_2) #Relu
    # Camada de saida
    output = tf.matmul(layer_2, weights['out']) + biases['out']
    return output

# Aproximador universal
def g(x):
    return x * multilayer_perceptron(x) + f0
# EDO
def f(x):
    return x-x**2

# Função Custo
def custom_loss():
    summation = []
    for x in np.linspace(0,1,10):
        dNN = (g(x+inf_s)-g(x))/inf_s
        summation.append((dNN - f(x))**2)
    return tf.reduce_sum(tf.abs(summation))

def train_step():
    with tf.GradientTape() as tape:
        loss = custom_loss()
    trainable_variables = list(weights.values()) + list(biases.values())
    gradients = tape.gradient(loss, trainable_variables)
    optimizer.apply_gradients(zip(gradients, trainable_variables))

for i in range(training_steps):
    train_step()
    if i % display_step == 0:
        print("loss: %f " % (custom_loss()))

from matplotlib.pyplot import figure

figure(figsize=(10,10))

# True Solution
def true_solution(x):
    return  (1/6)*(-2*x**3 + 3*x**2 + 6)

X = np.linspace(0, 1, 100)
result = []
for i in X:
  result.append(g(i).numpy()[0][0][0])

S = true_solution(X)

plt.plot(X, S, label="Original Function")
plt.plot(X, result, label="Neural Net Approximation")
plt.legend(loc=2, prop={'size': 20})
plt.show()

</code>```

I'm expecting some answers to my question. It can be books, articles, example of codes or just some thoughts on my question. I tried to implemente the 2nd order in my code but i stuck in the loss function since it need to be different that in the original code. The function f(x) and g(x) are also a big question for me.

Title: Second Order ODE using Neural Network

Body:
I'm studying numerical methods for ODEs and i'm using machine learning for it.
I'm trying to implement an 2nd order ODE in the code that i'm using to solve a 1st order ODE.
The ODE that i want to solve is: y'' = -10y, where y(0) = 0 and y'(0) = 1.
My question is: I know i need to break the 2nd order ODE in two 1st order ODE, but, how do i do that? I need to change f(x) (Check code bellow)?
How do i implement the 2nd order in the loss function?
The GradientTape need to be changed?

I know it is very basic stuffs, but im really new at machine learning and i'm trying to learn it.

Thanks!

Leo

*Here is the code i'm using at moment for 1st order ODE.

import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(123)
tf.random.set_seed(123)

#Condições Iniciais
f0 = 1

# Número Infinitesimal
inf_s = np.sqrt(np.finfo(np.float32).eps)

# Parâmetros
learning_rate = 0.01
training_steps = 5000
batch_size = 100
display_step = training_steps/10

# Parâmetros da Rede
n_input = 1
n_hidden_1 = 32
n_hidden_2 = 32
n_output = 1

weights = {
    'h1': tf.Variable(tf.random.normal([n_input, n_hidden_1])),
    'h2': tf.Variable(tf.random.normal([n_hidden_1, n_hidden_2])),
    'out': tf.Variable(tf.random.normal([n_hidden_2, n_output]))
}
biases = {
    'b1': tf.Variable(tf.random.normal([n_hidden_1])),
    'b2': tf.Variable(tf.random.normal([n_hidden_2])),
    'out': tf.Variable(tf.random.normal([n_output]))
}

# Otimizador gradiente descendente
optimizer = tf.optimizers.SGD(learning_rate)

# Criando Modelo
def multilayer_perceptron(x):
    x = np.array([[[x]]], dtype= 'float32')
    # Camada escondida 1 com 32 neuronios
    layer_1 = tf.add(tf.matmul(x, weights['h1']), biases['b1'])
    layer_1 = tf.nn.sigmoid(layer_1) #Relu não funciona melhor?
    # Camada escondida 2 com 32 neuronios
    layer_2 = tf.add(tf.matmul(layer_1, weights['h2']), biases['b2'])
    layer_2 = tf.nn.sigmoid(layer_2) #Relu
    # Camada de saida
    output = tf.matmul(layer_2, weights['out']) + biases['out']
    return output

# Aproximador universal
def g(x):
    return x * multilayer_perceptron(x) + f0
# EDO
def f(x):
    return x-x**2

# Função Custo
def custom_loss():
    summation = []
    for x in np.linspace(0,1,10):
        dNN = (g(x+inf_s)-g(x))/inf_s
        summation.append((dNN - f(x))**2)
    return tf.reduce_sum(tf.abs(summation))

def train_step():
    with tf.GradientTape() as tape:
        loss = custom_loss()
    trainable_variables = list(weights.values()) + list(biases.values())
    gradients = tape.gradient(loss, trainable_variables)
    optimizer.apply_gradients(zip(gradients, trainable_variables))

for i in range(training_steps):
    train_step()
    if i % display_step == 0:
        print("loss: %f " % (custom_loss()))

from matplotlib.pyplot import figure

figure(figsize=(10,10))

# True Solution
def true_solution(x):
    return  (1/6)*(-2*x**3 + 3*x**2 + 6)

X = np.linspace(0, 1, 100)
result = []
for i in X:
  result.append(g(i).numpy()[0][0][0])

S = true_solution(X)

plt.plot(X, S, label="Original Function")
plt.plot(X, result, label="Neural Net Approximation")
plt.legend(loc=2, prop={'size': 20})
plt.show()

I'm expecting some answers to my question. It can be books, articles, example of codes or just some thoughts on my question. I tried to implemente the 2nd order in my code but i stuck in the loss function since it need to be different that in the original code. The function f(x) and g(x) are also a big question for me.


问:
I have a problem with chaining functions while resizing an image and displaying it in the browser according to the URL params
I'm a total beginner with backend, node and express I'm trying to build an api that resize the image according to the entered params in the URL and render it in the browser using typeScript, so I'm using sharp to resize the image, express to build the local server and fs to read the image.

here is my code:

```<code>import express from "express";
import sharp from "sharp";
const fs = require("fs");

const img = express.Router();

const resizeImage = async function (width: number, height: number) {
try {
await sharp("./imgs/fjord.jpg")
.resize({
width: width,
height: height,
})
.toFile("./imgs/thumbs/fjord-resized.jpg");
} catch (err) {
console.log(err);
}
};

img.get("/", (req, res) => {
const queryData = req.query;
resizeImage(Number(queryData.width), Number(queryData.height)).then(
fs.readFile(
"./imgs/thumbs/fjord-resized.jpg",
(err: string, data: unknown): void => {
if (err) throw err;

        res.writeHead(200, { "content-type": "image/jpg" });
        res.end(data);
      }
    )

);
});

export default img;
</code>```

I tried to chain the resizeImage async function with "then" to make the app resize the Image first then use the fs to acquire the resized image and read it but for some reason it is not working the image get resized and output to the folder but every time I need to restart the server or reload the page to read the new resized image

Body:
I'm a total beginner with backend, node and express I'm trying to build an api that resize the image according to the entered params in the URL and render it in the browser using typeScript, so I'm using sharp to resize the image, express to build the local server and fs to read the image.

here is my code:

import express from "express";
import sharp from "sharp";
const fs = require("fs");

const img = express.Router();

const resizeImage = async function (width: number, height: number) {
try {
await sharp("./imgs/fjord.jpg")
.resize({
width: width,
height: height,
})
.toFile("./imgs/thumbs/fjord-resized.jpg");
} catch (err) {
console.log(err);
}
};

img.get("/", (req, res) => {
const queryData = req.query;
resizeImage(Number(queryData.width), Number(queryData.height)).then(
fs.readFile(
"./imgs/thumbs/fjord-resized.jpg",
(err: string, data: unknown): void => {
if (err) throw err;

        res.writeHead(200, { "content-type": "image/jpg" });
        res.end(data);
      }
    )

);
});

export default img;

I tried to chain the resizeImage async function with "then" to make the app resize the Image first then use the fs to acquire the resized image and read it but for some reason it is not working the image get resized and output to the folder but every time I need to restart the server or reload the page to read the new resized image


问:
PowerShell condition - result length > 0 or something like that
I have a simple one line command that list contents of some remote share

```<code>Get-ChildItem -Path "\\some_path\" -Recurse | Where-Object{ $_.LastWriteTime -lt (Get-Date).AddDays(-1) }
</code>```

I need to send an email in case there are no files in this folder.

So I found code that should send an email:

```<code>if ($Condition) {
    Send-MailMessage -From "sender@example.com" -To "receiver@example.com" -Subject "Condition met" -Body "The condition you specified has been met." -SmtpServer "smtp.example.com"
}
</code>```

However, I'm not sure how should I define this $Condition in case there is nothing in this folder.

Maybe something like this:

```<code>$Condition = Get-ChildItem -Path "\\some_path\" -Recurse | Where-Object{ $_.LastWriteTime -lt (Get-Date).AddDays(-1) } | length>0
</code>```

Thanks.

Body:
I have a simple one line command that list contents of some remote share

Get-ChildItem -Path "\\some_path\" -Recurse | Where-Object{ $_.LastWriteTime -lt (Get-Date).AddDays(-1) }

I need to send an email in case there are no files in this folder.

So I found code that should send an email:

if ($Condition) {
    Send-MailMessage -From "sender@example.com" -To "receiver@example.com" -Subject "Condition met" -Body "The condition you specified has been met." -SmtpServer "smtp.example.com"
}

However, I'm not sure how should I define this $Condition in case there is nothing in this folder.

Maybe something like this:

$Condition = Get-ChildItem -Path "\\some_path\" -Recurse | Where-Object{ $_.LastWriteTime -lt (Get-Date).AddDays(-1) } | length>0

Thanks.


问:
Is it possible to convert my React DOM (animation) into a video or gif?
I'm trying to convert my animations i have created into a gif or video.
The date of the animations (text and picture) comes from the api. There should be a function that allows the user to download the animation as a video. Something like Instagram stories. Is it possible to implement?

I tried to solve this issue using Chat openai. I got the answer like this. I tried to make the same but unsuccessfully chat.openai.com