问:
Search function data entry form
With some help from here i've made a data form, whereby data is put from an input sheet to a data sheet and then the input sheet is emptied again.
Now I want to be able to find the data back in the input sheet when I put the right code.
How do I do this?

This is the script to put data from the input sheet towards the data sheet.

```<code>function Process() {
  const ss = SpreadsheetApp.getActive();
  const dataSheet = ss.getSheetByName('NIEUW Invoerbestand');
  const inputSheet =ss.getSheetByName('Input')
  const idCell = ss.getRangeByName('Barcode');
  const id = idCell.getValue();
  const cellFound = dataSheet.getRange('A:A')
    .createTextFinder(id)
    .matchCase(true)
    .matchEntireCell(true)
    .findNext()
  if (!cellFound) return;
  const fieldRange = inputSheet.getRange('Input!E4:E231');
  const fieldValues = [fieldRange.getValues().flat()];
  dataSheet
    .getRange(cellFound.getRow(), 6)
    .offset(0, 0, fieldValues.length, fieldValues[0].length)
    .setValues(fieldValues);
  fieldRange.clearContent();
  idCell.clearContent();
}

</code>```

I've tried this script, but this gives the error 'forEach is not a function'

```<code>const searchCell = inputSheet.getRange ("B2")
const searchValue = searchCell.getValue()
const data = dataSheet.getRange ("A4:HY").getValues()
const recordsFound = data.filter( r => r[0] == searchValue)
if(recordsFound.lenght === 0) return

fieldRange.forEach ((f,i) => inputSheet.getRange(f).setValue(recordsFound[0][i+6]))
}
</code>```

Title: Search function data entry form

Body:
With some help from here i've made a data form, whereby data is put from an input sheet to a data sheet and then the input sheet is emptied again.
Now I want to be able to find the data back in the input sheet when I put the right code.
How do I do this?

This is the script to put data from the input sheet towards the data sheet.

function Process() {
  const ss = SpreadsheetApp.getActive();
  const dataSheet = ss.getSheetByName('NIEUW Invoerbestand');
  const inputSheet =ss.getSheetByName('Input')
  const idCell = ss.getRangeByName('Barcode');
  const id = idCell.getValue();
  const cellFound = dataSheet.getRange('A:A')
    .createTextFinder(id)
    .matchCase(true)
    .matchEntireCell(true)
    .findNext()
  if (!cellFound) return;
  const fieldRange = inputSheet.getRange('Input!E4:E231');
  const fieldValues = [fieldRange.getValues().flat()];
  dataSheet
    .getRange(cellFound.getRow(), 6)
    .offset(0, 0, fieldValues.length, fieldValues[0].length)
    .setValues(fieldValues);
  fieldRange.clearContent();
  idCell.clearContent();
}

I've tried this script, but this gives the error 'forEach is not a function'

const searchCell = inputSheet.getRange ("B2")
const searchValue = searchCell.getValue()
const data = dataSheet.getRange ("A4:HY").getValues()
const recordsFound = data.filter( r => r[0] == searchValue)
if(recordsFound.lenght === 0) return

fieldRange.forEach ((f,i) => inputSheet.getRange(f).setValue(recordsFound[0][i+6]))
}


来源: stackexchange

问:
TypeError: __init__() got an unexpected keyword argument 'registry'
I'm doing some packages importations on google colab - I was working on these for a time, but then one day this message appeared to me when I tried to import photutils package, a package used by astronomers:

```<code>
TypeError                                 Traceback (most recent call last)
<ipython-input-8-6005ccc011a4> in <module>
      1 try:
----> 2   import photutils
      3   import splusdata

26 frames
TypeError: __init__() got an unexpected keyword argument 'registry'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/astropy/nddata/mixins/ndio.py in __init__(self, instance, cls)
     53
     54     def __init__(self, instance, cls):
---> 55         super().__init__(instance, cls, "read", registry=None)
     56         # uses default global registry
     57

TypeError: __init__() got an unexpected keyword argument 'registry'
</code>```

My importation code is:

```<code>try:
  import photutils
  import splusdata
  import astropy
  from astropy.wcs import WCS
  from astropy import units as u
  from astropy.stats import sigma_clipped_stats
  from astropy.coordinates import SkyCoord
  from astropy.table import Table, vstack, hstack
  from photutils.aperture import aperture_photometry, CircularAperture, CircularAnnulus, SkyCircularAperture, SkyCircularAnnulus
  from photutils.utils import calc_total_error
  import cmastro
except:
  !pip install photutils
  !pip install astropy
  !pip install splusdata
  !pip install cmastro

  import photutils
  import astropy
  from photutils.utils import calc_total_error
  from astropy.wcs import WCS
  from astropy.stats import sigma_clipped_stats
  from astropy import units as u
  from astropy.coordinates import SkyCoord
  from astropy.table import Table, vstack
  from photutils.aperture import aperture_photometry, CircularAperture, CircularAnnulus, SkyCircularAperture, SkyCircularAnnulus
  import cmastro

</code>```

I tried to run my importation code onde day, and It wasn't working anymore.

ContentLicense: CC BY-SA 4.0

Body:
I'm doing some packages importations on google colab - I was working on these for a time, but then one day this message appeared to me when I tried to import photutils package, a package used by astronomers:

TypeError                                 Traceback (most recent call last)
<ipython-input-8-6005ccc011a4> in <module>
      1 try:
----> 2   import photutils
      3   import splusdata

26 frames
TypeError: __init__() got an unexpected keyword argument 'registry'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/astropy/nddata/mixins/ndio.py in __init__(self, instance, cls)
     53
     54     def __init__(self, instance, cls):
---> 55         super().__init__(instance, cls, "read", registry=None)
     56         # uses default global registry
     57

TypeError: __init__() got an unexpected keyword argument 'registry'

My importation code is:

try:
  import photutils
  import splusdata
  import astropy
  from astropy.wcs import WCS
  from astropy import units as u
  from astropy.stats import sigma_clipped_stats
  from astropy.coordinates import SkyCoord
  from astropy.table import Table, vstack, hstack
  from photutils.aperture import aperture_photometry, CircularAperture, CircularAnnulus, SkyCircularAperture, SkyCircularAnnulus
  from photutils.utils import calc_total_error
  import cmastro
except:
  !pip install photutils
  !pip install astropy
  !pip install splusdata
  !pip install cmastro

  import photutils
  import astropy
  from photutils.utils import calc_total_error
  from astropy.wcs import WCS
  from astropy.stats import sigma_clipped_stats
  from astropy import units as u
  from astropy.coordinates import SkyCoord
  from astropy.table import Table, vstack
  from photutils.aperture import aperture_photometry, CircularAperture, CircularAnnulus, SkyCircularAperture, SkyCircularAnnulus
  import cmastro

I tried to run my importation code onde day, and It wasn't working anymore.


问:
How to implement "For Each PivotItem on PivotTable" in my code VBA Macro
I have an issue with implementation function For Each PivotItem In PivotField. But it not works for me with error error 404 object required. I have a field in my pivottable and I want make visible all items that starts with "XYZ"

I`ve tried this but error appears

```<code>PivotTable.PivotFields("Voucher").CurrentPage = _
        "(All)"
    For Each PivotItem In PivotField.PivotItems
        If Left(UCase(PivotItem), 3) = "XYZ" Then
            PivotItem.Visible = False
        End If
    Next
</code>```

Body:
I have an issue with implementation function For Each PivotItem In PivotField. But it not works for me with error error 404 object required. I have a field in my pivottable and I want make visible all items that starts with "XYZ"

I`ve tried this but error appears

PivotTable.PivotFields("Voucher").CurrentPage = _
        "(All)"
    For Each PivotItem In PivotField.PivotItems
        If Left(UCase(PivotItem), 3) = "XYZ" Then
            PivotItem.Visible = False
        End If
    Next


问:
Reading actual decimal value in Hive
While trying to cast hive decimals as string, only the significant value of the decimal is considered in hive. This is leading to md5 (hash value) mis-matches when the data is migrated. I need the actual decimal value (including trailing 0's).

Eg:-
Query - select cast(7.500000 as string)
Result - 7.5

Expected result - 7.500000

Title: Reading actual decimal value in Hive


问:
Rack Mini Profiler fails build in staging and production
I am trying to use ‘rack-mini-profiler’ gem for Ruby on Rails in production or staging, but it keeps failing during the image build

When running the db migration step of the image I get the error: SystemStackError: stack level too deep . When trying to use the solution on the Readme , using gem 'rack-mini-profiler', require: ['prepend_net_http_patch'] in the gemfile. I get an error on the asset precompile step: LoadError: cannot load such file -- prepend_net_http_patch . Do you know what could the error be due to and what should I change in my configuration


问:
Connecting dApps in embedded browser with custom made wallet in react native
What are the APIs that's available to do this, I've only found Wallet Connect that can do this, are there any other that I've missed ?

I've try integrating with Wallet Connect V1 sdk, but encounter a problem

TypeError: null is not an object (evaluating 'RNRandomBytes.seed')

is there any workaround on this ? did I missing something ?

the error triggers right after I imported Wallet Connect V1 sdk

the code :

import { useState, useEffect, useRef } from 'react';
import { StyleSheet, Text, View, Button, TextInput } from 'react-native';
import { WebView } from 'react-native-webview';
import { SafeAreaView } from "react-native-safe-area-context";
import WalletConnect from "@walletconnect/client";

export default function Login({ navigation }) {
return (
        <SafeAreaView style={styles.container}>
            <Text style={{ alignSelf: "center", marginTop: 10 }}>{secret?.address}</Text>
            <View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
                <TextInput style={{ padding: 10, borderWidth: 1, borderRadius: 10, flex: 2, margin: 5 }} placeholder='WC Connection...' onChangeText={(e) => setWc(e)} />
                <View style={{ margin: 5, flex: 1 }}>
                    <Button title='Connect'/>
                </View>
            </View>
            <View style={{ margin: 10 }}>
                <Button title='Generate Wallet' />
            </View>
            <WebView
                source={{ uri: 'https://app.uniswap.org/#/swap' }}
                style={styles.container}
            />
        </SafeAreaView>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1
    },
});
```


问:
Using savage dickey null point hypotheses for arms models
Lets say I have a brms model of y ~ a*b + (1|group) and I'd really like to compare it against an alternative model y ~ a + b + (1|group) (in my example a is time and b is experimental condition).

Using hypothesis I could write:

hypothesis(m1, c("a:b = 0"))

However the Evidence ratio value returned for this point null hypothesis is often weird in that it is very dependent on the priors used. When relatively uninformative priors are used then -- even when a fairly precise and >zero  estimate for a:b is found -- the ER can still be > 1 or > 3. This is because the prior placed so much weight far away from zero.

I realise I could try using the bridgesampling package to calculate a Bayes Factor but have always found this quite slow and cumbersome.  I wonder instead whether it would be reasonable to compare the ERs for these two hypotheses:

a:b = 0 vs a:b > 0

That is, if I calculated  ER(a:b > 0)/ER(a:b = 0) then does this give the a Bayes factor in favour of a non-zero and positive effect, as compared with a zero effect?


问:
Reverse Proxy config for NGINX put at /etc/nginx/config.d is not working
I have an angular application hosted in docker container. Few of the static contents are read from some other server so that the reverse proxy configuration has been put at path /etc/nginx/conf.d/
but the proxy config is not working.

Below is the proxy config

```<code>server {
 location /static/configs/ {
   proxy_pass http://somewebsite.com/static-data/configs
 }
}
</code>```

Lets assume my application url is "http://angularapp.com/"
Now if I access http://angularapp.com/static/configs/json/config.json
then it is giving me HTTP 404 error.

I don't have rights to amend any other files on path /etc/nginx. I can only put conf file at  conf.d and configuration in sites-enabled is already including the /etc/nginx/conf.d/*.conf files.

My application is installed on /opt/app/Web/ path and local resources on the path are accessible.

Body:
I have an angular application hosted in docker container. Few of the static contents are read from some other server so that the reverse proxy configuration has been put at path /etc/nginx/conf.d/
but the proxy config is not working.

Below is the proxy config

server {
 location /static/configs/ {
   proxy_pass http://somewebsite.com/static-data/configs
 }
}

Lets assume my application url is "http://angularapp.com/"
Now if I access http://angularapp.com/static/configs/json/config.json
then it is giving me HTTP 404 error.

I don't have rights to amend any other files on path /etc/nginx. I can only put conf file at  conf.d and configuration in sites-enabled is already including the /etc/nginx/conf.d/*.conf files.

My application is installed on /opt/app/Web/ path and local resources on the path are accessible.


问:
npm run test fails on HTMLAnchorElement is not defined
I get the following error when I run npm run test. I have not changed anything within the files and were installed like this.

```<code>> tundra@5.15.3 test
> mocha --recursive --require @babel/register -r ./test/setup.js ./test

/home/rudhaya/Documents/gpf-react-ui-2020/node_modules/yargs/yargs.js:1163
      else throw err
           ^

ReferenceError: HTMLAnchorElement is not defined
    at /home/rudhaya/Documents/gpf-react-ui-2020/node_modules/file-saver/src/FileSaver.js:80:20
    at /home/rudhaya/Documents/gpf-react-ui-2020/node_modules/file-saver/dist/FileSaver.min.js:1:106
</code>```

I tried to run all tests and expected to run successfully, as all tests were running successfully before.

Body:
I get the following error when I run npm run test. I have not changed anything within the files and were installed like this.

> tundra@5.15.3 test
> mocha --recursive --require @babel/register -r ./test/setup.js ./test

/home/rudhaya/Documents/gpf-react-ui-2020/node_modules/yargs/yargs.js:1163
      else throw err
           ^

ReferenceError: HTMLAnchorElement is not defined
    at /home/rudhaya/Documents/gpf-react-ui-2020/node_modules/file-saver/src/FileSaver.js:80:20
    at /home/rudhaya/Documents/gpf-react-ui-2020/node_modules/file-saver/dist/FileSaver.min.js:1:106

I tried to run all tests and expected to run successfully, as all tests were running successfully before.


问:
Swagger-codegen3.0.9.jar fails to follow ref paths
The directory tree is:

```<code>ApiClient/main/methods/owners
ApiClient/main/schemas
ApiClient/main/types
</code>```

In my main.yaml file (located in ApiClient/main/main.yaml) I got the following paths:

```<code>    $ref: './methods/owners/actions.yaml'
</code>```

And then in the method /owners/actions.yaml I got another ref for a schema:

```<code>$ref: '../../schemas/specific_actions.yaml'
</code>```

I am trying to generate a api client for it using swagger-codegen3.0.9 generate -i main.yaml -l python

Problem is it fails to find the ../../schemas directory because it always looks from the root directory

The error it raises is:

```<code> Unable to load RELATIVE ref: ../../schemas/specific_actions.yaml path: C:\Users\MunteanuGabriel\Desktop\someDir\ApiClient

</code>```

So the refference flow should be like this

Go to methods dir ./methods/owners then from here go back to main and open schemas dir "../../schemas/", problem is it always looks starting from the root directory which causes to fail finding the schema yaml that i m refferecing to

Body:
The directory tree is:

ApiClient/main/methods/owners
ApiClient/main/schemas
ApiClient/main/types

In my main.yaml file (located in ApiClient/main/main.yaml) I got the following paths:

    $ref: './methods/owners/actions.yaml'

And then in the method /owners/actions.yaml I got another ref for a schema:

$ref: '../../schemas/specific_actions.yaml'

I am trying to generate a api client for it using swagger-codegen3.0.9 generate -i main.yaml -l python

Problem is it fails to find the ../../schemas directory because it always looks from the root directory

The error it raises is:

 Unable to load RELATIVE ref: ../../schemas/specific_actions.yaml path: C:\Users\MunteanuGabriel\Desktop\someDir\ApiClient

So the refference flow should be like this

Go to methods dir ./methods/owners then from here go back to main and open schemas dir "../../schemas/", problem is it always looks starting from the root directory which causes to fail finding the schema yaml that i m refferecing to


问:
Excel to TestLink XML HOW TO
I would like to import test suites/cases from xlsx to Testlink (1.9.14). I tried EX-converter v1.2.1, but it didn' work.

I selected the source excel file and destination xml file in EX-converter, then gave the excel mappings datas.

Retrieving the COM class factory for component with CLSID {xxx...} failed due to the following error: 80040154. Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Did I screw something up? Or is this device no longer working properly?
Or Is there another tool that can easily be used to transform excel to xml so that I can import it to testlink?

Title: Excel to TestLink XML HOW TO


问:
Mongodb: Could the objects in array with $oid be populate?

Has anyone ever used the objects in array with $oid and populate it?

Every class will have different is semester.So I use array to contain some detail of each semester,and have $oid for them.

boards:
{"_id":{"$oid":"63a07ecf6973176c890c8737"},
"classname":"math",
"uniqueData":[
  {"semester":"2022-1","score":2,"_id":{"$oid":"63a07ec77777777777777777"}},
  {"semester":"2022-2","score":2,"_id":{"$oid":"63a07ec88888888888888888"}}
],
}

reviews:
{
"uniqueId":{"$oid":"63a07ec77777777777777777"},
"score": 8
}
```
<hr />
<p>The review will point to certain class.semester. So I hope use populate to display the detail of that semester.</p>
<pre class="lang-js prettyprint-override"><code>schemaReviews.find({}).populate({path: 'uniqueId'})
//I get:
{
"uniqueId":null,
"score": 8
}
//But I need:
{
"uniqueId":
{"semester":"2022-1","score":2,"_id":{"$oid":"63a07ec77777777777777777"}}
,
"score": 8
}

</code>```

How do I got this done?

The models:

//
const schemaBoards = new mongoose.Schema({
classname:string
uniqueData:[{semester:string,score:int}],
})
mongoose.model('boards', schemaBoards)
//
const schemaReviews = new mongoose.Schema({
  uniqueId:  {
    type: mongoose.ObjectId,
    ref: 'boards'
  },
  score: Int
})
mongoose.model('reviews', schemaReviews)
```

Any Idea?

Body:
Has anyone ever used the objects in array with $oid and populate it?

Every class will have different is semester.So I use array to contain some detail of each semester,and have $oid for them.

boards:
{"_id":{"$oid":"63a07ecf6973176c890c8737"},
"classname":"math",
"uniqueData":[
  {"semester":"2022-1","score":2,"_id":{"$oid":"63a07ec77777777777777777"}},
  {"semester":"2022-2","score":2,"_id":{"$oid":"63a07ec88888888888888888"}}
],
}

reviews:
{
"uniqueId":{"$oid":"63a07ec77777777777777777"},
"score": 8
}

The review will point to certain class.semester. So I hope use populate to display the detail of that semester.

schemaReviews.find({}).populate({path: 'uniqueId'})
//I get:
{
"uniqueId":null,
"score": 8
}
//But I need:
{
"uniqueId":
{"semester":"2022-1","score":2,"_id":{"$oid":"63a07ec77777777777777777"}}
,
"score": 8
}

How do I got this done?

The models:

//
const schemaBoards = new mongoose.Schema({
classname:string
uniqueData:[{semester:string,score:int}],
})
mongoose.model('boards', schemaBoards)
//
const schemaReviews = new mongoose.Schema({
  uniqueId:  {
    type: mongoose.ObjectId,
    ref: 'boards'
  },
  score: Int
})
mongoose.model('reviews', schemaReviews)

Any Idea?


问:
Calculate the amount of blocks to store primary index
I have the following question that I cannot get my grip around for an exam and my teacher is unable to give the answer.

The Book relation has three fields: ISBN: char(11), title:char(26) and author: char(22). The data of the Book relation consists of 2574883 records and is organised on an unspanned slotted page array which contains a header (11B) and slot references of 3B each. Furthermore, each slotted page has a capacity of 16KB.

Assume that a primary index on ISBN exists for the Book relation with block anchors of 9 Bytes each and the same underlying unspanned organisation of slotted pages. Insert in the field below the number of blocks that are needed to store the primary index.


问:
FFmpeg-python System can not find the file specified
i am a beginner in python , and have a very noobish question. While using ffmpeg-python with my very very basic script which should just combine an audio and video file, i am stuck with this error: FileNotFoundError: [WinError 2] The system cannot find the file specified

Filnames and Folders do exist.

Do you have any idea why this happened ? Thank you so much

```<code>Traceback (most recent call last):
  File "C:\Users\Ben Catman\PycharmProjects\ffmpeg\main.py", line 6, in <module>
    ffmpeg.output(audio, video, "C:/Youtube/output.mp4").run(overwrite_output=True)
  File "C:\Users\Ben Catman\PycharmProjects\ffmpeg\venv\lib\site-packages\ffmpeg\_run.py", line 313, in run
    process = run_async(
  File "C:\Users\Ben Catman\PycharmProjects\ffmpeg\venv\lib\site-packages\ffmpeg\_run.py", line 284, in run_async
    return subprocess`your text`.Popen(
  File "C:\Users\Ben Catman\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Ben Catman\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
</code>```

Body:
i am a beginner in python , and have a very noobish question. While using ffmpeg-python with my very very basic script which should just combine an audio and video file, i am stuck with this error: FileNotFoundError: [WinError 2] The system cannot find the file specified

Filnames and Folders do exist.

Do you have any idea why this happened ? Thank you so much

Traceback (most recent call last):
  File "C:\Users\Ben Catman\PycharmProjects\ffmpeg\main.py", line 6, in <module>
    ffmpeg.output(audio, video, "C:/Youtube/output.mp4").run(overwrite_output=True)
  File "C:\Users\Ben Catman\PycharmProjects\ffmpeg\venv\lib\site-packages\ffmpeg\_run.py", line 313, in run
    process = run_async(
  File "C:\Users\Ben Catman\PycharmProjects\ffmpeg\venv\lib\site-packages\ffmpeg\_run.py", line 284, in run_async
    return subprocess`your text`.Popen(
  File "C:\Users\Ben Catman\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Ben Catman\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified


问:
Stacking NN models using tensor flow error when trying to fit model (expects 2 input(s), but it received 1 input tensors)
I am building a BNN network, I have build two separate models (Ensemble Model Tree Picture) which outputs a mean a variance i.e., the model uses a distribution layer. Now I have tried to stack these model using a concat layer (see code), but when trying to fit to my data I get the following error:

ValueError: Layer "model_288" expects 2 input(s), but it received 1 input tensors. Inputs received: [<tf.Tensor 'IteratorGetNext:0' shape=(None, 1) dtype=float32>]

Help

I need to amend the input to have 2 input tensors?

Code

```<code>def define_stacked_model(members):
    # update all layers in all models to not be trainable
    for i in range(len(members)):
        model = members[i]
    for layer in model.layers:
        # make not trainable
        layer.trainable = False
        # rename to avoid 'unique layer name' issue
        layer._name = 'ensemble_' + str(i+1) + '_' + layer.name

        # define multi-headed input
        ensemble_visible_1 = [model.input for model in members]  # inputs

        sample_layer = tfp.layers.DistributionLambda(
            lambda t: tfp.distributions.Normal(
                loc=t[:, 0:1], scale=tf.math.softplus(t[:, 1:2])))

        # concatenate merge output from each model
        ensemble_outputs = [model.output for model in members]  # outputs
        merge = tf.keras.layers.Concatenate()(ensemble_outputs)

        # Add layers
        hidden_1 = Dense(10, activation='sigmoid')(merge)
        hidden_2 = Dense(10, activation='sigmoid')(hidden_1)
        output = Dense(3, activation='sigmoid')(hidden_2)
        output = sample_layer(output)
        model = tf.keras.models.Model(inputs=ensemble_visible_1, outputs=output)

        # plot graph of ensemble
        plot_model(model, show_shapes=True,show_layer_activations=True,
                   expand_nested=False,
                   to_file='model_graph.png')
        # compile
        model.compile(loss=negloglik,
                      optimizer=tf.optimizers.Adam(learning_rate=0.001))
    return model
</code>```

Body:
I am building a BNN network, I have build two separate models (Ensemble Model Tree Picture) which outputs a mean a variance i.e., the model uses a distribution layer. Now I have tried to stack these model using a concat layer (see code), but when trying to fit to my data I get the following error:

ValueError: Layer "model_288" expects 2 input(s), but it received 1 input tensors. Inputs received: [<tf.Tensor 'IteratorGetNext:0' shape=(None, 1) dtype=float32>]

Help

I need to amend the input to have 2 input tensors?

Code

def define_stacked_model(members):
    # update all layers in all models to not be trainable
    for i in range(len(members)):
        model = members[i]
    for layer in model.layers:
        # make not trainable
        layer.trainable = False
        # rename to avoid 'unique layer name' issue
        layer._name = 'ensemble_' + str(i+1) + '_' + layer.name

        # define multi-headed input
        ensemble_visible_1 = [model.input for model in members]  # inputs

        sample_layer = tfp.layers.DistributionLambda(
            lambda t: tfp.distributions.Normal(
                loc=t[:, 0:1], scale=tf.math.softplus(t[:, 1:2])))

        # concatenate merge output from each model
        ensemble_outputs = [model.output for model in members]  # outputs
        merge = tf.keras.layers.Concatenate()(ensemble_outputs)

        # Add layers
        hidden_1 = Dense(10, activation='sigmoid')(merge)
        hidden_2 = Dense(10, activation='sigmoid')(hidden_1)
        output = Dense(3, activation='sigmoid')(hidden_2)
        output = sample_layer(output)
        model = tf.keras.models.Model(inputs=ensemble_visible_1, outputs=output)

        # plot graph of ensemble
        plot_model(model, show_shapes=True,show_layer_activations=True,
                   expand_nested=False,
                   to_file='model_graph.png')
        # compile
        model.compile(loss=negloglik,
                      optimizer=tf.optimizers.Adam(learning_rate=0.001))
    return model


问:
How to display different df in plotly with an menue
I'd like to display an plotly plot with the ability to change / filter the df with an dropdownmenue.

TimeStamp
L001_1
L001_2
L001_3
L002_1
L002_2
L003_1
L003_2

1.1.2023
1
2
2
3
4
4
2

2.1.2023
2
4
5
4
6
4
3

```<code>

df_L001 = df.filter(regex='L001|TimeStamp')
df_L001 = df_L001.set_index('TimeStamp')

df_L002 = df.filter(regex='L002|TimeStamp')
df_L002 = df_L002.set_index('TimeStamp')

df_L003 = df.filter(regex='L003|TimeStamp')
df_L003 = df_L003.set_index('TimeStamp')

x = df['TimeStamp'].unique()

fig = go.Figure()

for col in df_L001.columns[1:]:
    fig.add_trace(go.Scatter(y=df_L001[col], x=df_L001.index, name=col))
for col in df_L002.columns[1:]:
    fig.add_trace(go.Scatter(y=df_L002[col], x=df_L002.index, name=col))
for col in df_L003.columns[1:]:
    fig.add_trace(go.Scatter(y=df_L003[col], x=df_L003.index, name=col))

fig.update_layout(title_text='Load',
                 xaxis_title='Date', yaxis_title='Load')

fig.update_layout(
    updatemenus=[
        dict(active=0,
            buttons=list([
            dict(label="None",
                 method="update",
                 args=[{"visible":[True,True,True]},
                       {"title":"ALL"}]),
            dict(label="L001",
                 method="update",
                 args=[{"visible":[True, False, False]},
                       {"title":"L001"}]),
            dict(label="L002",
                 method="update",
                 args=[{"visible":[False,True,False]},
                       {"title":"L002"}]),
            dict(label="L003",
                 method="update",
                 args=[{"visible":[False,False,True]},
                       {"title":"L003"}]),
        ]),
        )
    ]
)

fig.show()
</code>```

I get it, that the "visible":[False,False,True] is wrong, but I don't find a solution.

Thanks

Body:
I'd like to display an plotly plot with the ability to change / filter the df with an dropdownmenue.

TimeStamp
L001_1
L001_2
L001_3
L002_1
L002_2
L003_1
L003_2

1.1.2023
1
2
2
3
4
4
2

2.1.2023
2
4
5
4
6
4
3

df_L001 = df.filter(regex='L001|TimeStamp')
df_L001 = df_L001.set_index('TimeStamp')

df_L002 = df.filter(regex='L002|TimeStamp')
df_L002 = df_L002.set_index('TimeStamp')

df_L003 = df.filter(regex='L003|TimeStamp')
df_L003 = df_L003.set_index('TimeStamp')

x = df['TimeStamp'].unique()

fig = go.Figure()

for col in df_L001.columns[1:]:
    fig.add_trace(go.Scatter(y=df_L001[col], x=df_L001.index, name=col))
for col in df_L002.columns[1:]:
    fig.add_trace(go.Scatter(y=df_L002[col], x=df_L002.index, name=col))
for col in df_L003.columns[1:]:
    fig.add_trace(go.Scatter(y=df_L003[col], x=df_L003.index, name=col))

fig.update_layout(title_text='Load',
                 xaxis_title='Date', yaxis_title='Load')

fig.update_layout(
    updatemenus=[
        dict(active=0,
            buttons=list([
            dict(label="None",
                 method="update",
                 args=[{"visible":[True,True,True]},
                       {"title":"ALL"}]),
            dict(label="L001",
                 method="update",
                 args=[{"visible":[True, False, False]},
                       {"title":"L001"}]),
            dict(label="L002",
                 method="update",
                 args=[{"visible":[False,True,False]},
                       {"title":"L002"}]),
            dict(label="L003",
                 method="update",
                 args=[{"visible":[False,False,True]},
                       {"title":"L003"}]),
        ]),
        )
    ]
)

fig.show()

I get it, that the "visible":[False,False,True] is wrong, but I don't find a solution.

Thanks


问:
subprocess.CalledProcessError died with <Signals.SIGSEGV: 11>
Excuse me, there is a problem that has troubled me for a long time. I want to run MOTRv2 from GitHub. But it always throws a problem as following:

(motrv2) dcy@ubuntu:~/MOTRv2$ ./tools/train.sh configs/motrv2.args
'my_bash_echo'

python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --meta_arch motr --dataset_file e2e_dance --epoch 5 --with_box_refine --lr_drop 4 --lr 2e-4 --lr_backbone 2e-5 --pretrained mot/r50_deformable_detr_plus_iterative_bbox_refinement-checkpoint.pth --batch_size 1 --sample_mode random_interval --sample_interval 10 --sampler_lengths 5 --merger_dropout 0 --dropout 0 --random_drop 0.1 --fp_ratio 0.3 --query_interaction_layer QIMv2 --query_denoise 0.05 --num_queries 10 --append_crowd --det_db det_db_motrv2.json --use_checkpoint --output_dir .

tee -a output.log
| distributed init (rank 2): env://
| distributed init (rank 1): env://
| distributed init (rank 3): env://
| distributed init (rank 5): env://
| distributed init (rank 0): env://
| distributed init (rank 4): env://
| distributed init (rank 7): env://
| distributed init (rank 6): env://
Traceback (most recent call last):
File "/data1/dcy/anaconda3/envs/motrv2/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/data1/dcy/anaconda3/envs/motrv2/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/data1/dcy/anaconda3/envs/motrv2/lib/python3.7/site-packages/torch/distributed/launch.py", line 260, in
main()
File "/data1/dcy/anaconda3/envs/motrv2/lib/python3.7/site-packages/torch/distributed/launch.py", line 256, in main
cmd=cmd)
subprocess.CalledProcessError: Command '['/data1/dcy/anaconda3/envs/motrv2/bin/python', '-u', 'main.py', '--meta_arch', 'motr', '--dataset_file', 'e2e_dance', '--epoch', '5', '--with_box_refine', '--lr_drop', '4', '--lr', '2e-4', '--lr_backbone', '2e-5', '--pretrained', 'mot/r50_deformable_detr_plus_iterative_bbox_refinement-checkpoint.pth', '--batch_size', '1', '--sample_mode', 'random_interval', '--sample_interval', '10', '--sampler_lengths', '5', '--merger_dropout', '0', '--dropout', '0', '--random_drop', '0.1', '--fp_ratio', '0.3', '--query_interaction_layer', 'QIMv2', '--query_denoise', '0.05', '--num_queries', '10', '--append_crowd', '--det_db', 'det_db_motrv2.json', '--use_checkpoint', '--output_dir', '.']' died with <Signals.SIGSEGV: 11>.

Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.

cleanup

echo 'Packing source code'
Packing source code

rmpyc
++ find -name pycache

rm -rf ./pycache ./datasets/pycache ./models/pycache ./models/ops/functions/pycache ./models/ops/modules/pycache ./models/structures/pycache ./util/pycache
++ find -name '*.pyc'

rm -rf

echo ' ...Done'
...Done

I tried several times to solve this problem but failed.

My environment is Ubuntu-18.04, python=3.7, torch=1.7.1, Cuda=11.1.

How to solve it?


问:
How to set specific cell background color in maatwebsite
I have added excel export functionality using maatwebsite. I want to add background color for specific cell of exported excel based on query condition.

Here are my laravel code:

```<code>class vehicleDetailsExport implements FromCollection, WithHeadings, WithMapping
{
public function __construct($daterange)
{
    $this->daterange = $daterange;
}

public function headings(): array
{
    return ["Insurance company","Broker/IRDA", "Product type", "Product name", "Fuel type", "Permit type", "Customer name", "Customer mobile", "Customer email", "Customer address", "Vehicle number", "Registration number", "Registration date", "Registration expiry date", "Insurance start date", "Insurance expiry date", "Insurance amount", "Fitness expiry date", "MV tax expiry date", "PUCC expiry date", "Finance type", "Finance company", "Permit number", "Permit valid upto date", "Policy number", "Renewal premium", "Engine number", "Chasis number"];
}

public function collection()
{
    $daterange = explode(" - ",$this->daterange);
    $start_date = $daterange[0];
    $end_date = $daterange[1];
    $start_date = Carbon::createFromFormat('d-m-Y', $start_date)->format('Y-m-d');
    $end_date = Carbon::createFromFormat('d-m-Y', $end_date)->format('Y-m-d');

    return $results = DB::table('vehicledetails')
          ->leftjoin('insurance_companies','vehicledetails.insuranceCompany_id','=','insurance_companies.id')
          ->leftjoin('brokers','vehicledetails.broker_id','=','brokers.id')
          ->leftjoin('producttypes','vehicledetails.producttype_id','=','producttypes.id')
          ->leftjoin('procuctnames','vehicledetails.procuctname_id','=','procuctnames.id')
          ->leftjoin('enginetypes','vehicledetails.enginetype_id','=','enginetypes.id')
          ->leftjoin('permittypes','vehicledetails.permittype_id','=','permittypes.id')
          ->leftjoin('financecompanies','vehicledetails.financecompany_id','=','financecompanies.id')
          ->select('vehicledetails.*','insurance_companies.title AS ic_title','brokers.title AS br_title','producttypes.title AS p_title','procuctnames.title AS pn_title','enginetypes.title AS et_title','permittypes.title AS pt_title','financecompanies.title AS fc_title')
          ->Where(function ($query) use ($start_date,$end_date) {
              $query->whereBetween('expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('insurance_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('fitness_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('mv_tax_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('pucc_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('permit_valid_upto_date', [$start_date, $end_date]);
        })
        ->Where('vehicledetails.deleted_at',null)
        ->get();
}

// here you select the row that you want in the file
public function map($row): array{
       $fields = [
        $row->ic_title,
        $row->br_title,
        $row->p_title,
        $row->pn_title,
        $row->et_title,
        $row->pt_title,
        $row->customer_name,
        $row->customer_mobile,
        $row->customer_email,
        $row->customer_address,
        $row->vehicle_number,
        $row->registration_number,
        !empty($row->registration_date) ? Carbon::createFromFormat('Y-m-d', $row->registration_date)->format('d/m/Y') : '',
        !empty($row->expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->expiry_date)->format('d/m/Y') : '',
        !empty($row->insurance_start_date) ? Carbon::createFromFormat('Y-m-d', $row->insurance_start_date)->format('d/m/Y') : '',
        !empty($row->insurance_expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->insurance_expiry_date)->format('d/m/Y') : '',
        $row->insurance_amount,
       !empty($row->fitness_expiry_date) ?  Carbon::createFromFormat('Y-m-d', $row->fitness_expiry_date)->format('d/m/Y') : '',
        !empty($row->mv_tax_expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->mv_tax_expiry_date)->format('d/m/Y') : '',
        !empty($row->pucc_expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->pucc_expiry_date)->format('d/m/Y') : '',
        ($row->finance_type) ? 'Yes' : 'No',
        $row->fc_title,
        $row->permit_number,
        !empty($row->permit_valid_upto_date) ? Carbon::createFromFormat('Y-m-d', $row->permit_valid_upto_date)->format('d/m/Y') : '',
        $row->policy_number,
        $row->renewal_premium,
        $row->engine_number,
        $row->chasis_number,
     ];
    return $fields;
}
</code>```

}

I want to add background color for cells.

if: $row->expiry_date is greater than today then background color of that cell only should be red. Otherwise green.

Like this. if: $row->fitness_expiry_date is greater than today then background color of that cell only should be red. Otherwise green.

Body:
I have added excel export functionality using maatwebsite. I want to add background color for specific cell of exported excel based on query condition.

Here are my laravel code:

class vehicleDetailsExport implements FromCollection, WithHeadings, WithMapping
{
public function __construct($daterange)
{
    $this->daterange = $daterange;
}

public function headings(): array
{
    return ["Insurance company","Broker/IRDA", "Product type", "Product name", "Fuel type", "Permit type", "Customer name", "Customer mobile", "Customer email", "Customer address", "Vehicle number", "Registration number", "Registration date", "Registration expiry date", "Insurance start date", "Insurance expiry date", "Insurance amount", "Fitness expiry date", "MV tax expiry date", "PUCC expiry date", "Finance type", "Finance company", "Permit number", "Permit valid upto date", "Policy number", "Renewal premium", "Engine number", "Chasis number"];
}

public function collection()
{
    $daterange = explode(" - ",$this->daterange);
    $start_date = $daterange[0];
    $end_date = $daterange[1];
    $start_date = Carbon::createFromFormat('d-m-Y', $start_date)->format('Y-m-d');
    $end_date = Carbon::createFromFormat('d-m-Y', $end_date)->format('Y-m-d');

    return $results = DB::table('vehicledetails')
          ->leftjoin('insurance_companies','vehicledetails.insuranceCompany_id','=','insurance_companies.id')
          ->leftjoin('brokers','vehicledetails.broker_id','=','brokers.id')
          ->leftjoin('producttypes','vehicledetails.producttype_id','=','producttypes.id')
          ->leftjoin('procuctnames','vehicledetails.procuctname_id','=','procuctnames.id')
          ->leftjoin('enginetypes','vehicledetails.enginetype_id','=','enginetypes.id')
          ->leftjoin('permittypes','vehicledetails.permittype_id','=','permittypes.id')
          ->leftjoin('financecompanies','vehicledetails.financecompany_id','=','financecompanies.id')
          ->select('vehicledetails.*','insurance_companies.title AS ic_title','brokers.title AS br_title','producttypes.title AS p_title','procuctnames.title AS pn_title','enginetypes.title AS et_title','permittypes.title AS pt_title','financecompanies.title AS fc_title')
          ->Where(function ($query) use ($start_date,$end_date) {
              $query->whereBetween('expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('insurance_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('fitness_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('mv_tax_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('pucc_expiry_date', [$start_date, $end_date]);
              $query->orWhereBetween('permit_valid_upto_date', [$start_date, $end_date]);
        })
        ->Where('vehicledetails.deleted_at',null)
        ->get();
}

// here you select the row that you want in the file
public function map($row): array{
       $fields = [
        $row->ic_title,
        $row->br_title,
        $row->p_title,
        $row->pn_title,
        $row->et_title,
        $row->pt_title,
        $row->customer_name,
        $row->customer_mobile,
        $row->customer_email,
        $row->customer_address,
        $row->vehicle_number,
        $row->registration_number,
        !empty($row->registration_date) ? Carbon::createFromFormat('Y-m-d', $row->registration_date)->format('d/m/Y') : '',
        !empty($row->expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->expiry_date)->format('d/m/Y') : '',
        !empty($row->insurance_start_date) ? Carbon::createFromFormat('Y-m-d', $row->insurance_start_date)->format('d/m/Y') : '',
        !empty($row->insurance_expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->insurance_expiry_date)->format('d/m/Y') : '',
        $row->insurance_amount,
       !empty($row->fitness_expiry_date) ?  Carbon::createFromFormat('Y-m-d', $row->fitness_expiry_date)->format('d/m/Y') : '',
        !empty($row->mv_tax_expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->mv_tax_expiry_date)->format('d/m/Y') : '',
        !empty($row->pucc_expiry_date) ? Carbon::createFromFormat('Y-m-d', $row->pucc_expiry_date)->format('d/m/Y') : '',
        ($row->finance_type) ? 'Yes' : 'No',
        $row->fc_title,
        $row->permit_number,
        !empty($row->permit_valid_upto_date) ? Carbon::createFromFormat('Y-m-d', $row->permit_valid_upto_date)->format('d/m/Y') : '',
        $row->policy_number,
        $row->renewal_premium,
        $row->engine_number,
        $row->chasis_number,
     ];
    return $fields;
}

}

I want to add background color for cells.

if: $row->expiry_date is greater than today then background color of that cell only should be red. Otherwise green.

Like this. if: $row->fitness_expiry_date is greater than today then background color of that cell only should be red. Otherwise green.


问:
How to correct handle InvalidPidMappingException
Please tell me how to correctly handle InvalidPidMappingException. What variations are correct - handling the catching of this type of exception in the process processing logic or inside the Kafka error handler?</p>


问:
Fabric.js performance issues or sharing objects
I am working on some kind of seating plan application which looks like this

Generally speaking everything is working, but there are some performance issues with such big plans (which can include up to 3000 seats which can translate to around 3000 Group objects and 12-15k objects (4-5 per group - seat).

I was wondering if there are any tricks that could be used here to improve the performance since a lot of these "seats" look very similar (like 1000 can be of the same color). So I was thinking if some optimization could be done here to for example have some shared cache for these - so all 1000 objects would share same cached object for rendering. Or if there are maybe other things that could be done here.

The biggest problem here seem to be the zooming (very clunky) and moving/panning. Interesingly with bigger zoom the app works better which for me is weird since I would guess that the total canvas dimensions in that scenario will be bigger.
The other problem is definitely the memory consumption which as we found out is so big on Safari that it crashes the browser making the app totally unusable.

Do you guys have any advices what could I look at to maybe make it more responsive and less memory hungry ? I was playing around with pixi.js where there is a concept of textures and with approach of making 1 texture per seat color and re-using these textures the app worked in almost 60fps, the con was unfortunately that it looked blurry and texts were looking badly, but I guess that would be something that could be worked out. What do you think ? Or maybe I should take a look at some other library for such case (recently I was thinking about Leaflet JS) ?


问:
Ansible: create only the certs when they are newer
Ansible role: certificate_management. Creates the needed certs and keys on Cloudera CDP. certs.yml:

```<code>---
- name: Install python3-libselinux
  ansible.builtin.package:
    name: "python3-libselinux"
    state: present

- name: Prepare directories for TLS
  file:
    state: directory
    path: "{{ dir }}"
    mode: 0755
    owner: root
  loop:
    - "{{ base_dir_security }}"
    - "{{ base_dir_security_pki }}"
  loop_control:
    loop_var: dir

- name: Copy file pkcs12 file
  copy:
    src: "{{ lookup('env', 'HOME') }}/.certs/{{ inventory_hostname }}.pfx"
    dest: "{{ base_dir_security_pki }}/{{ inventory_hostname }}.p12"
    mode: '0600'

- name: Verify that PKCS12 file contains a private key and register alias
  shell: "{{ keytool_path }} -list -keystore {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12 -storepass '{{ certificates[inventory_hostname].pkcs12pass }}' | grep PrivateKeyEntry  | awk -F, '{ print $1 }'"
  register: pkcs12aliasentry

- name: Debug pkcs12aliasentry
  debug:
    var: pkcs12aliasentry.stdout

- name: Create Java keystore
  shell:
    cmd: >
      {{ keytool_path }}
      -importkeystore
      -srckeystore {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12
      -srcstorepass '{{ certificates[inventory_hostname].pkcs12pass }}'
      -srckeypass '{{ certificates[inventory_hostname].pkcs12pass }}'
      -srcstoretype PKCS12
      -srcalias {{ pkcs12aliasentry.stdout }}
      -destalias {{ keystore_alias | default(inventory_hostname) }}
      -destkeystore {{ tls_keystore_path }}_tmp
      -deststoretype JKS
      -deststorepass {{ tls_keystore_password }}
      -destkeypass {{ tls_keystore_password }}
    creates: "{{ tls_keystore_path }}_tmp"

- name: Verify that JKS contains a private key
  shell:
    cmd: >
      {{ keytool_path }}
      -list
      -keystore {{ tls_keystore_path }}_tmp
      -storepass {{ tls_keystore_password }} | grep PrivateKeyEntry
  changed_when: False

- name: Move tmp keystore to keystore path
  command: mv {{ tls_keystore_path }}_tmp {{ tls_keystore_path }}

- name: Export private key
  shell:
    cmd: >
      {{ openssl_path }} pkcs12
      -in {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12
      -out {{ tls_key_path }}
      -passin pass:'{{ certificates[inventory_hostname].pkcs12pass }}'
      -passout pass:'{{ tls_key_password }}'
      -nocerts
#    creates: "{{ tls_key_path }}"

- name: Export certificate
  shell:
    cmd: >
      {{ openssl_path }} pkcs12
      -in {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12
      -out "{{ tls_signed_certs_dir }}/{{ inventory_hostname }}.pem"
      -passin pass:'{{ certificates[inventory_hostname].pkcs12pass }}'
      -passout pass:'{{ tls_key_password }}'
      -clcerts
#    creates: "{{ tls_cert_path }}"

- name: Delete temporary PKCS12 keystore
  file:
    path: "{{ base_dir_security_pki }}/{{ inventory_hostname }}.p12"
    state: absent

- name: Write key password to file
  shell:
    cmd: echo -n {{ tls_key_password }} > {{ tls_key_password_file }}
#    creates: "{{ tls_key_password_file }}"

- name: Write unencrypted key
  shell:
    cmd: >
      {{ openssl_path }} rsa
      -in {{ tls_key_path }}
      -passin pass:'{{ tls_key_password }}'
      -out {{ tls_key_path_plaintext }}
#    creates: "{{ tls_key_path_plaintext }}"

- name: Create host agnostic links
  file:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    state: hard
    force: yes
  with_items:
    - { src: "{{ tls_keystore_path }}", dest: "{{ tls_keystore_path_generic }}" }
    - { src: "{{ tls_key_path }}", dest: "{{ tls_key_path_generic }}" }
    - { src: "{{ tls_key_path_plaintext }}", dest: "{{ tls_key_path_plaintext_generic }}" }

- name: Set file permissions
  include_tasks: acls.yml
</code>```

Already commented 4 of the creates, because it wouldn't create all certs/keys needed when already there.
But to prevent unnecessary copy actions we want to have a check to see if the existing ones have the same origin as the to be created ones. Only create files when the source pfx is updated.

Being new to this, where should I look of what can I try?
psck12, rsa & keytool don't have options for a check
Already took a look at Ansible - Looking for files and compare their hash but no clue how to make that work in this yml

Body:
Ansible role: certificate_management. Creates the needed certs and keys on Cloudera CDP. certs.yml:

---
- name: Install python3-libselinux
  ansible.builtin.package:
    name: "python3-libselinux"
    state: present

- name: Prepare directories for TLS
  file:
    state: directory
    path: "{{ dir }}"
    mode: 0755
    owner: root
  loop:
    - "{{ base_dir_security }}"
    - "{{ base_dir_security_pki }}"
  loop_control:
    loop_var: dir

- name: Copy file pkcs12 file
  copy:
    src: "{{ lookup('env', 'HOME') }}/.certs/{{ inventory_hostname }}.pfx"
    dest: "{{ base_dir_security_pki }}/{{ inventory_hostname }}.p12"
    mode: '0600'

- name: Verify that PKCS12 file contains a private key and register alias
  shell: "{{ keytool_path }} -list -keystore {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12 -storepass '{{ certificates[inventory_hostname].pkcs12pass }}' | grep PrivateKeyEntry  | awk -F, '{ print $1 }'"
  register: pkcs12aliasentry

- name: Debug pkcs12aliasentry
  debug:
    var: pkcs12aliasentry.stdout

- name: Create Java keystore
  shell:
    cmd: >
      {{ keytool_path }}
      -importkeystore
      -srckeystore {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12
      -srcstorepass '{{ certificates[inventory_hostname].pkcs12pass }}'
      -srckeypass '{{ certificates[inventory_hostname].pkcs12pass }}'
      -srcstoretype PKCS12
      -srcalias {{ pkcs12aliasentry.stdout }}
      -destalias {{ keystore_alias | default(inventory_hostname) }}
      -destkeystore {{ tls_keystore_path }}_tmp
      -deststoretype JKS
      -deststorepass {{ tls_keystore_password }}
      -destkeypass {{ tls_keystore_password }}
    creates: "{{ tls_keystore_path }}_tmp"

- name: Verify that JKS contains a private key
  shell:
    cmd: >
      {{ keytool_path }}
      -list
      -keystore {{ tls_keystore_path }}_tmp
      -storepass {{ tls_keystore_password }} | grep PrivateKeyEntry
  changed_when: False

- name: Move tmp keystore to keystore path
  command: mv {{ tls_keystore_path }}_tmp {{ tls_keystore_path }}

- name: Export private key
  shell:
    cmd: >
      {{ openssl_path }} pkcs12
      -in {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12
      -out {{ tls_key_path }}
      -passin pass:'{{ certificates[inventory_hostname].pkcs12pass }}'
      -passout pass:'{{ tls_key_password }}'
      -nocerts
#    creates: "{{ tls_key_path }}"

- name: Export certificate
  shell:
    cmd: >
      {{ openssl_path }} pkcs12
      -in {{ base_dir_security_pki }}/{{ inventory_hostname }}.p12
      -out "{{ tls_signed_certs_dir }}/{{ inventory_hostname }}.pem"
      -passin pass:'{{ certificates[inventory_hostname].pkcs12pass }}'
      -passout pass:'{{ tls_key_password }}'
      -clcerts
#    creates: "{{ tls_cert_path }}"

- name: Delete temporary PKCS12 keystore
  file:
    path: "{{ base_dir_security_pki }}/{{ inventory_hostname }}.p12"
    state: absent

- name: Write key password to file
  shell:
    cmd: echo -n {{ tls_key_password }} > {{ tls_key_password_file }}
#    creates: "{{ tls_key_password_file }}"

- name: Write unencrypted key
  shell:
    cmd: >
      {{ openssl_path }} rsa
      -in {{ tls_key_path }}
      -passin pass:'{{ tls_key_password }}'
      -out {{ tls_key_path_plaintext }}
#    creates: "{{ tls_key_path_plaintext }}"

- name: Create host agnostic links
  file:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    state: hard
    force: yes
  with_items:
    - { src: "{{ tls_keystore_path }}", dest: "{{ tls_keystore_path_generic }}" }
    - { src: "{{ tls_key_path }}", dest: "{{ tls_key_path_generic }}" }
    - { src: "{{ tls_key_path_plaintext }}", dest: "{{ tls_key_path_plaintext_generic }}" }

- name: Set file permissions
  include_tasks: acls.yml

Already commented 4 of the creates, because it wouldn't create all certs/keys needed when already there.
But to prevent unnecessary copy actions we want to have a check to see if the existing ones have the same origin as the to be created ones. Only create files when the source pfx is updated.

Being new to this, where should I look of what can I try?
psck12, rsa & keytool don't have options for a check
Already took a look at Ansible - Looking for files and compare their hash but no clue how to make that work in this yml


问:
How can I implement tab completion in a MUI Autocomplete?
I'm using a MUI Autocomplete component. If the user types a substring that matches only one option, I'd like her to be able to hit Tab to automatically fill it in. (Which is kinda what I thought "autocomplete" meant ...)

How can I do that?


问:
How to install metashape module on Python?
I want to install the Metashape module on Python.
So I followed the protocol of the following link:

https://agisoft.freshdesk.com/support/solutions/articles/31000148930-how-to-install-metashape-stand-alone-python-module

The document that downloads automatically is : Metashape-2.0.0-cp35.cp36.cp37.cp38-none-win_amd64.whl

And when I execute the following line :
python3.exe -m pip install Metashape-2.0.0-cp35.cp36.cp37.cp38-none-win_amd64.whl

I obtain :

C:\Users\conta>python3.exe -m pip install Metashape-2.0.0-cp35.cp36.cp37.cp38-none-win_amd64.whl
WARNING: Requirement 'Metashape-2.0.0-cp35.cp36.cp37.cp38-none-win_amd64.whl' looks like a filename, but the file does not exist
ERROR: Metashape-2.0.0-cp35.cp36.cp37.cp38-none-win_amd64.whl is not a supported wheel on this platform.

The protocol is given for Metashape version 1.8.4, but it is version 2.0.0 today.
I tried on python versions 3.8, 3.10 and 3.11 as indicated in the Agisoft protocol, same problem.
I tried on my command executor as well as google colab and spyder, same problem.


问:
Show all siblings from parent category in subcategory (Woocommerce Product Categories)
In the Products Categories widget in Woocommerce, I would like to show all siblings of current parent category.

If the categories are:

Parent Category A

Subcategory 1A

Subcategory 2A

Subcategory 3A

If you click on Category A the same list will show:
Parent Category A

Subcategory 1A

Subcategory 2A

Subcategory 3A

And if you click on Subcategory 2A the same list will show, but with Subcategory 2A in bold

Parent Category A

Subcategory 1A
- Subcategory 2A

Subcategory 3A

```<code>/**
 * @param array $args Widget arguments.
 * @return array
 */
function wc_product_categories_widget_args( $args ) {
    $parent_term = get_term_by( 'name', 'Parent Category 1A', 'product_cat' ); // Replace with parent term name.
    $parent_term_id = $parent_term->term_id;
    $args['parent'] = $parent_term_id;
    return $args;
}
add_filter( 'woocommerce_product_categories_widget_args', 'wc_product_categories_widget_args' );

</code>```

I tested this code in functions.php - and it does what I want for the ONE category you place the parent term name. I´ve tried multiple times to recall "current" parent category that you visit, but it won´t work.

Two things:

The clear problem is that this overwrites everything and show only one parent category (I have two, and maybe it will be more later on - so I need it to recall current parent category)

I also discovered that I want, on the Shop page - to only list parent categories. This overrides every instance of the widget used.

Body:
In the Products Categories widget in Woocommerce, I would like to show all siblings of current parent category.

If the categories are:

Parent Category A

Subcategory 1A

Subcategory 2A

Subcategory 3A

If you click on Category A the same list will show:
Parent Category A

Subcategory 1A

Subcategory 2A

Subcategory 3A

And if you click on Subcategory 2A the same list will show, but with Subcategory 2A in bold

Parent Category A

Subcategory 1A
- Subcategory 2A

Subcategory 3A

/**
 * @param array $args Widget arguments.
 * @return array
 */
function wc_product_categories_widget_args( $args ) {
    $parent_term = get_term_by( 'name', 'Parent Category 1A', 'product_cat' ); // Replace with parent term name.
    $parent_term_id = $parent_term->term_id;
    $args['parent'] = $parent_term_id;
    return $args;
}
add_filter( 'woocommerce_product_categories_widget_args', 'wc_product_categories_widget_args' );

I tested this code in functions.php - and it does what I want for the ONE category you place the parent term name. I´ve tried multiple times to recall "current" parent category that you visit, but it won´t work.

Two things:

The clear problem is that this overwrites everything and show only one parent category (I have two, and maybe it will be more later on - so I need it to recall current parent category)

I also discovered that I want, on the Shop page - to only list parent categories. This overrides every instance of the widget used.


问:
Swift Charts Data Not Matching Visualization
I was exploring the Charts UI that apple has integrated into Xcode and Swift, and it's pretty great - easy to use and straightforward.

That said, I was messing with the code from Demo/tutorial and changing the type of chart values around and noticed that the numbers in the code aren't matching the visual. Specifically when going from a LineMark to AreaMark.

I have a feeling it has something to do with the order of the "Type" that is used to have multiple AreaMarks on one visual and the associated "Values" and it not wanting to 'hide' the AreaMark of data if it were lower than the "Type" before it.

In consideration of using AreaMark vs LineMark, is there any way of working around this so that the AreaMark looks like the the LineMark?

ContentView.swift code below:

```<code>import Charts
import SwiftUI

struct MountPrice: Identifiable {
    var id = UUID()
    var mount: String
    var value: Int
    var type: String
}

struct ContentView: View {
    let data: [MountPrice] = [

        MountPrice(mount: "jan/22", value: 0, type: "B"),
        MountPrice(mount: "feb/22", value: 0, type: "B"),
        MountPrice(mount: "mar/22", value: 0, type: "B"),
        MountPrice(mount: "apr/22", value: 3, type: "B"),
        MountPrice(mount: "may/22", value: 3, type: "B"),
        MountPrice(mount: "jun/22", value: 1, type: "B"),
        MountPrice(mount: "jul/22", value: 0, type: "B"),

        MountPrice(mount: "jan/22", value: 0, type: "A"),
        MountPrice(mount: "feb/22", value: 0, type: "A"),
        MountPrice(mount: "mar/22", value: 2, type: "A"),
        MountPrice(mount: "apr/22", value: 7, type: "A"),
        MountPrice(mount: "may/22", value: 18, type: "A"),
        MountPrice(mount: "jun/22", value: 20, type: "A"),
        MountPrice(mount: "jul/22", value: 0, type: "A"),

        MountPrice(mount: "jan/22", value: 0, type: "C"),
        MountPrice(mount: "feb/22", value: 0, type: "C"),
        MountPrice(mount: "mar/22", value: 2,  type: "C"),
        MountPrice(mount: "apr/22", value: 7,  type: "C"),
        MountPrice(mount: "may/22", value: 9,type: "C"),
        MountPrice(mount: "jun/22", value: 6,type: "C"),
        MountPrice(mount: "jul/22", value: 0, type: "C"),

    ]

    var body: some View {
        List {
            Chart {
                ForEach(data) {

                    AreaMark(
                        x: .value("Mount", $0.mount),
                        y: .value("Value", $0.value)
                    )
                    .foregroundStyle(by: .value("Type", "Series \($0.type)"))

                }
            }
            .frame(height: 250)
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
</code>```

Body:
I was exploring the Charts UI that apple has integrated into Xcode and Swift, and it's pretty great - easy to use and straightforward.

That said, I was messing with the code from Demo/tutorial and changing the type of chart values around and noticed that the numbers in the code aren't matching the visual. Specifically when going from a LineMark to AreaMark.

I have a feeling it has something to do with the order of the "Type" that is used to have multiple AreaMarks on one visual and the associated "Values" and it not wanting to 'hide' the AreaMark of data if it were lower than the "Type" before it.

In consideration of using AreaMark vs LineMark, is there any way of working around this so that the AreaMark looks like the the LineMark?

ContentView.swift code below:

import Charts
import SwiftUI

struct MountPrice: Identifiable {
    var id = UUID()
    var mount: String
    var value: Int
    var type: String
}

struct ContentView: View {
    let data: [MountPrice] = [

        MountPrice(mount: "jan/22", value: 0, type: "B"),
        MountPrice(mount: "feb/22", value: 0, type: "B"),
        MountPrice(mount: "mar/22", value: 0, type: "B"),
        MountPrice(mount: "apr/22", value: 3, type: "B"),
        MountPrice(mount: "may/22", value: 3, type: "B"),
        MountPrice(mount: "jun/22", value: 1, type: "B"),
        MountPrice(mount: "jul/22", value: 0, type: "B"),

        MountPrice(mount: "jan/22", value: 0, type: "A"),
        MountPrice(mount: "feb/22", value: 0, type: "A"),
        MountPrice(mount: "mar/22", value: 2, type: "A"),
        MountPrice(mount: "apr/22", value: 7, type: "A"),
        MountPrice(mount: "may/22", value: 18, type: "A"),
        MountPrice(mount: "jun/22", value: 20, type: "A"),
        MountPrice(mount: "jul/22", value: 0, type: "A"),

        MountPrice(mount: "jan/22", value: 0, type: "C"),
        MountPrice(mount: "feb/22", value: 0, type: "C"),
        MountPrice(mount: "mar/22", value: 2,  type: "C"),
        MountPrice(mount: "apr/22", value: 7,  type: "C"),
        MountPrice(mount: "may/22", value: 9,type: "C"),
        MountPrice(mount: "jun/22", value: 6,type: "C"),
        MountPrice(mount: "jul/22", value: 0, type: "C"),

    ]

    var body: some View {
        List {
            Chart {
                ForEach(data) {

                    AreaMark(
                        x: .value("Mount", $0.mount),
                        y: .value("Value", $0.value)
                    )
                    .foregroundStyle(by: .value("Type", "Series \($0.type)"))

                }
            }
            .frame(height: 250)
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}


问:
Pass values from Helmrelease to Terraform
I have a helm release file test-helm-release.yaml as given below.

```<code>apiVersion: helm.toolkit.gitops.io/v2beta1
kind: HelmRelease
metadata:
  name: "test"
  namespace: "test-system"
spec:
  chart:
    spec:
    chart: "test-environment"
    version: "0.1.10"
  values:
    key1: "value1"
    key1: "value1"
    key1: "value1"
    key1: "value1"
    gitRepository:
      url: https://github.com/test-eng/test.git
    helmRepositories:
      - name: testplatform
        url: https://test-platform/charts
</code>```

While creating the helm release I can pass the values from above helm release to the new release using the below command

```<code>   chart=$(yq '.spec.chart.spec.chart' test-helm-release.yaml)
   version=$(yq '.spec.chart.spec.version' test-helm-release.yaml)
   yq '.spec.values' test-helm-release.yaml | helm upgrade --install --values - --version "$version" --namespace test-system --create-namespace test-platform "helm-repo/$chart"
</code>```

Above code is working perfectly and I'm able to pass the values to the helm release using "yq" command. How I can do the same "yq" function with terraform "helm-release" and git repository data type given below.

```<code>   data "github_repository_file" "test-platform" {
     repository = "test-platform"
     branch     = "test"
    file       = "internal/default/test-helm-release.yaml"
   }

 resource "helm_release" "test-platform" {
 name = "test-platform"

 repository       = "https://test-platform/charts"
 chart            = "test-environment"
 namespace        = "test-system"
 create_namespace = true
 timeout          = 800

 lifecycle {
  ignore_changes = all
}
}
</code>```

Note
I cannot use "set" because i want to fetch the values form test-helm-release.yaml dynamically.Any idea how I could fetch the .spec.values alone using templatefile  functio or a different way?

Body:
I have a helm release file test-helm-release.yaml as given below.

apiVersion: helm.toolkit.gitops.io/v2beta1
kind: HelmRelease
metadata:
  name: "test"
  namespace: "test-system"
spec:
  chart:
    spec:
    chart: "test-environment"
    version: "0.1.10"
  values:
    key1: "value1"
    key1: "value1"
    key1: "value1"
    key1: "value1"
    gitRepository:
      url: https://github.com/test-eng/test.git
    helmRepositories:
      - name: testplatform
        url: https://test-platform/charts

While creating the helm release I can pass the values from above helm release to the new release using the below command

   chart=$(yq '.spec.chart.spec.chart' test-helm-release.yaml)
   version=$(yq '.spec.chart.spec.version' test-helm-release.yaml)
   yq '.spec.values' test-helm-release.yaml | helm upgrade --install --values - --version "$version" --namespace test-system --create-namespace test-platform "helm-repo/$chart"

Above code is working perfectly and I'm able to pass the values to the helm release using "yq" command. How I can do the same "yq" function with terraform "helm-release" and git repository data type given below.

   data "github_repository_file" "test-platform" {
     repository = "test-platform"
     branch     = "test"
    file       = "internal/default/test-helm-release.yaml"
   }

 resource "helm_release" "test-platform" {
 name = "test-platform"

 repository       = "https://test-platform/charts"
 chart            = "test-environment"
 namespace        = "test-system"
 create_namespace = true
 timeout          = 800

 lifecycle {
  ignore_changes = all
}
}

Note
I cannot use "set" because i want to fetch the values form test-helm-release.yaml dynamically.Any idea how I could fetch the .spec.values alone using templatefile  functio or a different way?


问:
MySQL information_schema.statistics table with 0 cardinality
My DB schema of MySql 8.0.19 has a table with indexes on 3 columns of it. Table has around 40,000 rows. Distinct value of those 3 columns are 19k, 5k, 10. Primary key is auto generated id. I was expecting cardinality value of information_schema.statistics for this table to be around these values. But to my wonder, it is set to 0 for all 4 columns.

I debugged to this point as query involving join to this table is taking a lot of time. I strongly doubt that the index is either corrupt or not getting built. It is innodb table.

I have already tried deleting all the data from the table and reinserting but still query is taking time and cardinality is 0.

As compared to other tables, check table table_name command also takes significantly longer for this table.

Can someone give some pointer why indexes are not getting built and cardinality remains 0?
Thanks in advance.


问:
How to convert axios API call to vuex action dispatch?
I'm new with Vue3JS and I am developing a todo list built from several components like that :

I need to retrieve data to display all tasks, TaskInfo component is used to display informations.

I try to convert my local component TaskInfo works well with API call (method async loadTask()) into Vuex store action/mutation, but I didn't quite understand how to process in my case, because in component TaskInfo data are always the same.

I try to load data from current taskId with :

```<code>mounted() {
    this.loadTask(this.taskId);
},
</code>```

But, only last item loaded, with id 26, display data loaded by getTaskinfo computed variable loaded this.$store.state.taskInfo.

Any suggestion to load component data correctly when is mouted ?

TaskInfo.vue

```<code><template>
    <div class="task-container mb-4 ml-2 rounded-lg flex flex-grow flex-col flex-nowrap items-left shadow-test border border-solid border-gray-dark">
        <div class="task--labels flex p-4 border-1 border-solid border-b border-gray-dark">
            <span class="font-light p-2 text-xs bg-gray-dark rounded-lg m-2">   </span>
            <span class="font-light p-2 text-xs bg-gray-dark rounded-lg m-2">label 2</span>
            <div class="font-bold absolute right-1">
                <button
                    v-if="this.taskId"
                    @click="this.$store.dispatch('removeTask', this.taskId)" >
                    <svg width="24px" height="24px" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg" aria-labelledby="removeIconTitle" stroke="#EF5350" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none" color="#000000">
                        <title id="removeIconTitle">Remove</title>
                        <path d="M17,12 L7,12"/>
                        <circle cx="12" cy="12" r="10"/>
                    </svg>
                </button>
            </div>
        </div>
        <div
            class="task--title p-4 title text-m font-normal"
            :class="[ getTaskinfo.finish === true ? 'finished' : '' ]"
        >
            {{ getTaskinfo.title }}
        </div>
        <div class="task-time p-4 text-xs text text-gray1 flex items-center">
            <span class="pt-1"></span>
            <span class="ml-1">11h - 12h</span>
        </div>
    </div>
</template>

<script>
import axios from 'axios';
import { mapActions } from 'vuex'
axios.defaults.baseURL = 'http://localhost:3000';

export default {
    name: 'taskInfo',
    props: ['taskId'],
    data() {
        return {
            error: '',
            taskinfo: []
        };
    },
    mounted() {
        this.loadTask(this.taskId);
    },
    methods: {
        ...mapActions([
            'loadTask' // map `this.incrementBy(this.taskId)` to `this.$store.dispatch('loadTask', this.taskId);`
        ]),
        // Old API call replaced by mapActions, it's works fine.
        async loadTask() {
            try {
                if(!this.taskId) return;
                const taskInfo = await axios.get(`/task/${this.taskId}`);
                if (!taskInfo.data) {
                    console.log('no taskInfo');
                }
                else {
                    this.taskinfo = taskInfo.data;
                }
            } catch (error) {
                console.log('no taskInfo error');
            }
        },
    },
    computed: {
        getTaskinfo() {
            return this.$store.state.taskInfo;
        },
    }
}
</script>
</code>```

Store

```<code>import { createStore } from 'vuex'
import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:3000';

export default createStore( {
    state: {
        taskInfo: [],
        error: '',
    },
    // Mutations have to be synchronous.
    mutations: {
        loadTask(state, taskInfo) {
            state.taskInfo = taskInfo;
        },
        updateError(state, error) {
            state.error = error;
        },
    },
    actions: {
        setError({ commit }, error) {
            commit('updateError', error);
        },
        // LOAD task info.
        async loadTask({ commit }, taskId) {
            try {
                if(!taskId) commit('updateError', 'taskId empty');
                const taskInfo = await axios.get(`/task/${taskId}`);
                if (!taskInfo.data) {
                    commit('updateError','Aucune info sur la tache');
                    // Set an empty task list.
                    commit('loadTask', []);
                }
                else {
                    console.log('task : ' + taskId);
                    commit('loadTask', taskInfo.data);
                }
            } catch (error) {
                commit('updateError', error);
            }
        },
    },

});
</code>```

Body:
I'm new with Vue3JS and I am developing a todo list built from several components like that :

I need to retrieve data to display all tasks, TaskInfo component is used to display informations.

I try to convert my local component TaskInfo works well with API call (method async loadTask()) into Vuex store action/mutation, but I didn't quite understand how to process in my case, because in component TaskInfo data are always the same.

I try to load data from current taskId with :

mounted() {
    this.loadTask(this.taskId);
},

But, only last item loaded, with id 26, display data loaded by getTaskinfo computed variable loaded this.$store.state.taskInfo.

Any suggestion to load component data correctly when is mouted ?

TaskInfo.vue

<template>

            label 2

                <button
                    v-if="this.taskId"
                    @click="this.$store.dispatch('removeTask', this.taskId)" >
                    <svg width="24px" height="24px" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg" aria-labelledby="removeIconTitle" stroke="#EF5350" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none" color="#000000">
                        <title id="removeIconTitle">Remove</title>
                        <path d="M17,12 L7,12"/>
                        <circle cx="12" cy="12" r="10"/>
                    </svg>
                </button>

            {{ getTaskinfo.title }}

            11h - 12h

</template>

Store

import { createStore } from 'vuex'
import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:3000';

export default createStore( {
    state: {
        taskInfo: [],
        error: '',
    },
    // Mutations have to be synchronous.
    mutations: {
        loadTask(state, taskInfo) {
            state.taskInfo = taskInfo;
        },
        updateError(state, error) {
            state.error = error;
        },
    },
    actions: {
        setError({ commit }, error) {
            commit('updateError', error);
        },
        // LOAD task info.
        async loadTask({ commit }, taskId) {
            try {
                if(!taskId) commit('updateError', 'taskId empty');
                const taskInfo = await axios.get(`/task/${taskId}`);
                if (!taskInfo.data) {
                    commit('updateError','Aucune info sur la tache');
                    // Set an empty task list.
                    commit('loadTask', []);
                }
                else {
                    console.log('task : ' + taskId);
                    commit('loadTask', taskInfo.data);
                }
            } catch (error) {
                commit('updateError', error);
            }
        },
    },

});


问:
How to access node-mongodb-native error codes?
I'm using mongodb in my nodejs application. When a MongoServerError is raised inside my application, I would like to run instructions based on the code of the error. For example, I would like to handle the specific NamespaceNotFound error code.

However I could not find a way to import the list of all possible codes. The list https://github.com/mongodb/node-mongodb-native/blob/main/src/error.ts#L36 does not seem to be exposed to the users of the library.

Since the MongoServerError errors raised inside my application expose their code and the codeName, I would assume that those are not internals.

Of course, I would like to avoid duplicating those codes in my application.

Did I miss something ?

I would expect the list of codes from https://github.com/mongodb/node-mongodb-native/blob/main/src/error.ts#L36 to be exposed to the consumers of the library since they are accessible in the MongoServerError error raised inside the nodejs application.

Example

Here's an example of the error I would like to handle :

```<code>MongoServerError: ns not found
    at Connection.onMessage (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/connection.ts:438:20)
    at MessageStream.<anonymous> (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/connection.ts:256:56)
    at MessageStream.emit (node:events:513:28)
    at MessageStream.emit (node:domain:489:12)
    at processIncomingData (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/message_stream.ts:193:14)
    at MessageStream._write (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/message_stream.ts:70:5)
    at writeOrBuffer (node:internal/streams/writable:391:12)
    at _write (node:internal/streams/writable:332:10)
    at MessageStream.Writable.write (node:internal/streams/writable:336:10)
    at Socket.ondata (node:internal/streams/readable:754:22) {
  ok: 0,
  code: 26,
  codeName: 'NamespaceNotFound',
  [Symbol(errorLabels)]: Set(0) {}
}
</code>```

Body:
I'm using mongodb in my nodejs application. When a MongoServerError is raised inside my application, I would like to run instructions based on the code of the error. For example, I would like to handle the specific NamespaceNotFound error code.

However I could not find a way to import the list of all possible codes. The list https://github.com/mongodb/node-mongodb-native/blob/main/src/error.ts#L36 does not seem to be exposed to the users of the library.

Since the MongoServerError errors raised inside my application expose their code and the codeName, I would assume that those are not internals.

Of course, I would like to avoid duplicating those codes in my application.

Did I miss something ?

I would expect the list of codes from https://github.com/mongodb/node-mongodb-native/blob/main/src/error.ts#L36 to be exposed to the consumers of the library since they are accessible in the MongoServerError error raised inside the nodejs application.

Example

Here's an example of the error I would like to handle :

MongoServerError: ns not found
    at Connection.onMessage (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/connection.ts:438:20)
    at MessageStream.<anonymous> (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/connection.ts:256:56)
    at MessageStream.emit (node:events:513:28)
    at MessageStream.emit (node:domain:489:12)
    at processIncomingData (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/message_stream.ts:193:14)
    at MessageStream._write (/home/alex/nodejs-project/node_modules/mongoose/node_modules/mongodb/src/cmap/message_stream.ts:70:5)
    at writeOrBuffer (node:internal/streams/writable:391:12)
    at _write (node:internal/streams/writable:332:10)
    at MessageStream.Writable.write (node:internal/streams/writable:336:10)
    at Socket.ondata (node:internal/streams/readable:754:22) {
  ok: 0,
  code: 26,
  codeName: 'NamespaceNotFound',
  [Symbol(errorLabels)]: Set(0) {}
}


问:
Delete remote git branch
I´ve tried several times to delete my remote ¨search¨ branch and I can´t seem to achieve it. It´s saying that remote ref does not exist.

Here is everything I´ve done:

```<code>angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git branch -a
* web50/projects/2020/x/wiki
  remotes/origin/HEAD -> origin/web50/projects/2020/x/wiki
  remotes/origin/main
  remotes/origin/web50/projects/2020/x/search
  remotes/origin/web50/projects/2020/x/wiki

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git branch -d remotes/origin/web50/projects/2020/x/search
error: branch 'remotes/origin/web50/projects/2020/x/search' not found.

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git push origin --delete remotes/origin/web50/projects/2020/x/search
error: unable to delete 'remotes/origin/web50/projects/2020/x/search': remote ref does not exist
error: failed to push some refs to 'https://github.com/me50/angelybello.git'

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git push origin -d remotes/origin/web50/projects/2020/x/search
error: unable to delete 'remotes/origin/web50/projects/2020/x/search': remote ref does not exist
error: failed to push some refs to 'https://github.com/me50/angelybello.git'

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git push origin --delete web/50/projects/2020/x/search
error: unable to delete 'web/50/projects/2020/x/search': remote ref does not exist
error: failed to push some refs to 'https://github.com/me50/angelybello.git'
</code>```

Title: Delete remote git branch

Body:
I´ve tried several times to delete my remote ¨search¨ branch and I can´t seem to achieve it. It´s saying that remote ref does not exist.

Here is everything I´ve done:

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git branch -a
* web50/projects/2020/x/wiki
  remotes/origin/HEAD -> origin/web50/projects/2020/x/wiki
  remotes/origin/main
  remotes/origin/web50/projects/2020/x/search
  remotes/origin/web50/projects/2020/x/wiki

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git branch -d remotes/origin/web50/projects/2020/x/search
error: branch 'remotes/origin/web50/projects/2020/x/search' not found.

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git push origin --delete remotes/origin/web50/projects/2020/x/search
error: unable to delete 'remotes/origin/web50/projects/2020/x/search': remote ref does not exist
error: failed to push some refs to 'https://github.com/me50/angelybello.git'

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git push origin -d remotes/origin/web50/projects/2020/x/search
error: unable to delete 'remotes/origin/web50/projects/2020/x/search': remote ref does not exist
error: failed to push some refs to 'https://github.com/me50/angelybello.git'

angel@DESKTOP-20K232E MINGW64 ~/angelybello (web50/projects/2020/x/wiki)
$ git push origin --delete web/50/projects/2020/x/search
error: unable to delete 'web/50/projects/2020/x/search': remote ref does not exist
error: failed to push some refs to 'https://github.com/me50/angelybello.git'


问:
changing Google Slide Presenter view timer via javascript by updating div content not working
I want to create a button inside a chrome extension to change the current timer in Google Slide Presenter view.

I tried both changing it via .value & .innerHTML, but they have no effect.
Strangely though when logging each results they are updated.

```<code><div class="punch-viewer-speakernotes-timer-main-container">
<div class="punch-viewer-speakernotes-timer-time-container" style="">
<div class="punch-viewer-speakernotes-timer-time">00:06:16</div></div>
<div class="punch-viewer-speakernotes-timer-button-container">
<div role="button" class="jfk-button jfk-button-standard punch-viewer-speakernotes-timer-button" tabindex="0" title="Pause timer" value="undefined" style="user-select: none; width: 54px;">
<span class="jfk-button-label">Pause</span></div>
<div role="button" class="jfk-button jfk-button-standard punch-viewer-speakernotes-timer-button" tabindex="0" title="Reset timer (R)" value="undefined" style="user-select: none; width: 54px;">
<span class="jfk-button-label">Reset</span></div></div></div>
</code>```

I tried both:

```<code>document.getElementsByClassName("punch-viewer-speakernotes-timer-time").innerHTML = "00:12:34"

document.getElementsByClassName("punch-viewer-speakernotes-timer-time").value = "00:12:34"
</code>```

I can see the value changing inside the div. Is the javascript running the timer using something different / do I need to connect with it somehow in order to change the time, similar to how the reset button sets it back to "00:00:00" and starts counting afresh?

(I searched in dev console sources for any javascript of the timer but couldn't find any)

UPDATE
Realised it needs '[0]' to extract the content.

```<code>console.log(document.getElementsByClassName("punch-viewer-speakernotes-timer-time")[0].innerHTML)
</code>```

However changing the innerHTML only works for a second as the timer doesn't continue from that value onwards

```<code>document.getElementsByClassName("punch-viewer-speakernotes-timer-time")[0].innerHTML = "00:15:11";
</code>```

UPDATE2:

With FF I was able to find 2926244107-viewer_core.js which if I understand correctly has the code for the timer as well as reset button function. Anyone can help please how to trigger it via JS in an extension? Thanks.

Body:
I want to create a button inside a chrome extension to change the current timer in Google Slide Presenter view.

I tried both changing it via .value & .innerHTML, but they have no effect.
Strangely though when logging each results they are updated.

00:06:16

Pause

Reset

I tried both:

document.getElementsByClassName("punch-viewer-speakernotes-timer-time").innerHTML = "00:12:34"

document.getElementsByClassName("punch-viewer-speakernotes-timer-time").value = "00:12:34"

I can see the value changing inside the div. Is the javascript running the timer using something different / do I need to connect with it somehow in order to change the time, similar to how the reset button sets it back to "00:00:00" and starts counting afresh?

(I searched in dev console sources for any javascript of the timer but couldn't find any)

UPDATE
Realised it needs '[0]' to extract the content.

console.log(document.getElementsByClassName("punch-viewer-speakernotes-timer-time")[0].innerHTML)

However changing the innerHTML only works for a second as the timer doesn't continue from that value onwards

document.getElementsByClassName("punch-viewer-speakernotes-timer-time")[0].innerHTML = "00:15:11";

UPDATE2:

With FF I was able to find 2926244107-viewer_core.js which if I understand correctly has the code for the timer as well as reset button function. Anyone can help please how to trigger it via JS in an extension? Thanks.


问:
Extracting nested elements from an XML using Qt C++
I have an XML file with music albums that looks like this:

I want to extract the elements from the XML using Qt C++. Now I know how to extract the Author, or the Genre for example, which would be to get a QDomNodeList of a certain tag, then a QDomNode from that list at a certain index, and then converting that node to an element, and reading its attributes.

What I don't know is how do I extract the Songs? I have tried getting a QDomNodeList with elementsByTagName("Songs") from the root element, which gives me a node list of all the <Songs> in the XML, but then I can't again get a QDomNodeList of the <Song> tag, because it throws a conversion error.


问:
Find divergence point in a branch
I have two branches, A and B that have a lot of merge activity. One acts as a sort of stable development branch and the other is used to add a specific feature (and there will be many like it, all being merged to the stable branch), e.g.:

```<code>
                                  MCA
 A --------------------------------------------
     \    \      /  \       /  \   \
      \    \    /    \     /    \   \
       \    \  /      \   /      \   \
 B --------------------------------------------
</code>```

I want to find the commit at which they diverge, e.g. the commit such that all commits prior to this one are in both branches. This is different from the most recent common ancestor (which is what I am finding when I try to search). For example, in the picture, the point MCA will be the most recent common ancestor of both points. However, they may be commits in B that do not belong to A because B had not been merged into A. Due to the merge, the commits of A will be in B, so assuming there were no extra commits (from edits, other merges, whatever) between MCA and the last merge B to A, then MCA is what I am looking for.

Hopefully that makes sense.

Title: Find divergence point in a branch

Body:
I have two branches, A and B that have a lot of merge activity. One acts as a sort of stable development branch and the other is used to add a specific feature (and there will be many like it, all being merged to the stable branch), e.g.:

                                  MCA
 A --------------------------------------------
     \    \      /  \       /  \   \
      \    \    /    \     /    \   \
       \    \  /      \   /      \   \
 B --------------------------------------------

I want to find the commit at which they diverge, e.g. the commit such that all commits prior to this one are in both branches. This is different from the most recent common ancestor (which is what I am finding when I try to search). For example, in the picture, the point MCA will be the most recent common ancestor of both points. However, they may be commits in B that do not belong to A because B had not been merged into A. Due to the merge, the commits of A will be in B, so assuming there were no extra commits (from edits, other merges, whatever) between MCA and the last merge B to A, then MCA is what I am looking for.

Hopefully that makes sense.


问:
Weird error when trying to generate migration with TypeORM for the first time
I am using TypeORM with nestjs. I tried to run migration:generate to do a migration for the first time (around 30 tables), but I got an weird error.

```<code>Error during migration generation:
QueryFailedError: unsupported: '*' expression in cross-shard query
 at Query.onResult (.../node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:158:37)
    at Query.execute (.../node_modules/mysql2/lib/commands/command.js:36:14)
    at PoolConnection.handlePacket (.../node_modules/mysql2/lib/connection.js:456:32)
    at PacketParser.onPacket (.../node_modules/mysql2/lib/connection.js:85:12)
    at PacketParser.executeStart (.../node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (.../node_modules/mysql2/lib/connection.js:92:25)
    at Socket.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10) {
  query: 'SELECT * FROM (\n' +
    '                SELECT\n' +
    '                    *\n' +
    '                FROM `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` `kcu`\n' +
    '                WHERE\n' +
    "                    `kcu`.`TABLE_SCHEMA` = 'goodturtle-db'\n" +
    '                    AND\n' +
    "                    `kcu`.`TABLE_NAME` = 'AcademicStatus'\n" +
    '             UNION \n' +
    '                SELECT\n' +
    '                    *\n' +
    '                FROM `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` `kcu
(about 2 thousand lines more...)
</code>```

Here are the typeorm versions I am using

```<code>"@nestjs/typeorm": "^9.0.1",
"typeorm": "^0.3.11"
</code>```

I assumed that my entity declaration is correct because the tables are created when I turn on the synchronize flag.

Thanks for your help and please let me know if I have to provide additional information.

Body:
I am using TypeORM with nestjs. I tried to run migration:generate to do a migration for the first time (around 30 tables), but I got an weird error.

Error during migration generation:
QueryFailedError: unsupported: '*' expression in cross-shard query
 at Query.onResult (.../node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:158:37)
    at Query.execute (.../node_modules/mysql2/lib/commands/command.js:36:14)
    at PoolConnection.handlePacket (.../node_modules/mysql2/lib/connection.js:456:32)
    at PacketParser.onPacket (.../node_modules/mysql2/lib/connection.js:85:12)
    at PacketParser.executeStart (.../node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (.../node_modules/mysql2/lib/connection.js:92:25)
    at Socket.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10) {
  query: 'SELECT * FROM (\n' +
    '                SELECT\n' +
    '                    *\n' +
    '                FROM `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` `kcu`\n' +
    '                WHERE\n' +
    "                    `kcu`.`TABLE_SCHEMA` = 'goodturtle-db'\n" +
    '                    AND\n' +
    "                    `kcu`.`TABLE_NAME` = 'AcademicStatus'\n" +
    '             UNION \n' +
    '                SELECT\n' +
    '                    *\n' +
    '                FROM `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` `kcu
(about 2 thousand lines more...)

Here are the typeorm versions I am using

"@nestjs/typeorm": "^9.0.1",
"typeorm": "^0.3.11"

I assumed that my entity declaration is correct because the tables are created when I turn on the synchronize flag.

Thanks for your help and please let me know if I have to provide additional information.


问:
Korean utterances are not well mapping into GeneratePdf from html content
I am generating pdf from this HTML, and for achieving this I am using https://www.nrecosite.com/pdf_generator_net.aspx

This is the HTML

```<code><!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
    <div>
        <p>Remarks</p>
        <p>한국어 발언을 표시하는 테스트입니다</p>
    </div>
</body>
</html>
</code>```

and this the code for generating the pdf:

var pdfBytes = new
NReco.PdfGenerator.HtmlToPdfConverter().GeneratePdf(html);

and the result is this:

how can I generate the pdf with the correct Korean utterances?

Thanks

Body:
I am generating pdf from this HTML, and for achieving this I am using https://www.nrecosite.com/pdf_generator_net.aspx

This is the HTML

<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Remarks

한국어 발언을 표시하는 테스트입니다

and this the code for generating the pdf:

var pdfBytes = new
NReco.PdfGenerator.HtmlToPdfConverter().GeneratePdf(html);

and the result is this:

how can I generate the pdf with the correct Korean utterances?

Thanks


问:
Same component to be used on multiple Nuxt project
I have a project where I will need to deploy multiple Nuxt websites, with each one using the same components. I don't want to have redundancy and having to change 10 times the same component in 10 differents projects.

So, do you have an idea of an ideal architecture and technologies to be used in order to create single Nuxt components that can be re-used within all the differents websites ?

I have read documentation about nuxt-custom-elements, would that be a possibility ? What are the down side, restriction and alternatives to this Module ?

Thanks you a lot for your help.

I am currently doing an analysis and research, I would love to hear from your experience with this kind of projects in order to not go into a wrong direction.


问:
what are the most effective ways to get an output schema when working with connections and custom transformations in AWS Glue Studio
I am new to AWS Glue studio and am finding effective ways to get an output schema at each node. I am creating connections to sources like oracle and redshift. I am using these connections as sources but having hard time to get the output schema in all the nodes. Any help would be very much appreciated.

I came to know that we can create crawlers to get the schema at the first stage. But not sure how we need to proceed in the next stages. Any alternatives would also be helpful.