问:
REST API get multiple records using id
We have the records in the below format :

```<code>[
 {
    id: 1,
    name : 'Chris',
    class : 'x',
    year : 3,
 },
 {
    id: 2,
    name : 'John',
    class : 'y',
    year : 4,
 }
]
</code>```

I want to fetch multiple records based on id with a single api call.

This could be achieved either by passing multiple ids in a get call or using a post call to post the list of ids.

Get call with multiple ids

```<code>GET https://api.com/school/names?id=1,2,3
</code>```

Post with multiple ids

```<code>POST https://api.com/school/names?action=get

request body :
{
  id1: 1,
  id2: 2,
  id3: 3
}
</code>```

We don't have issue with the url length as we will not cross the 2048 characters limit.

I see that many public apis use both of the above approaches, I have a feeling that using a POST call to fetch data is against the REST principle.

Could some one suggest what is the best approach for this scenario and the advantage of the approach compared to the other one.

Title: REST API get multiple records using id

Body:
We have the records in the below format :

[
 {
    id: 1,
    name : 'Chris',
    class : 'x',
    year : 3,
 },
 {
    id: 2,
    name : 'John',
    class : 'y',
    year : 4,
 }
]

I want to fetch multiple records based on id with a single api call.

This could be achieved either by passing multiple ids in a get call or using a post call to post the list of ids.

Get call with multiple ids

GET https://api.com/school/names?id=1,2,3

Post with multiple ids

POST https://api.com/school/names?action=get

request body :
{
  id1: 1,
  id2: 2,
  id3: 3
}

We don't have issue with the url length as we will not cross the 2048 characters limit.

I see that many public apis use both of the above approaches, I have a feeling that using a POST call to fetch data is against the REST principle.

Could some one suggest what is the best approach for this scenario and the advantage of the approach compared to the other one.


来源: stackexchange

问:
Share file from Linux to remote windows machine using python
I want share file from linux to remote windows machine

able to tranfer to local windows machine.

```<code>def createSSHClient(server, port, user, password):
    client = paramiko.SSHClient()
    client.load_system_host_keys()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(server, port, user, password)
    return client

ssh = createSSHClient("xx", 22, "yy", "zz")
scp = SCPClient(ssh.get_transport())
scp.get( r'/opt/test/test.txt', r'D:\Test' )
</code>```

File in linux machine , want to share that to remote windows mahcine using python.

ContentLicense: CC BY-SA 4.0

Body:
I want share file from linux to remote windows machine

able to tranfer to local windows machine.

def createSSHClient(server, port, user, password):
    client = paramiko.SSHClient()
    client.load_system_host_keys()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(server, port, user, password)
    return client

ssh = createSSHClient("xx", 22, "yy", "zz")
scp = SCPClient(ssh.get_transport())
scp.get( r'/opt/test/test.txt', r'D:\Test' )

File in linux machine , want to share that to remote windows mahcine using python.


问:
Traverse a Python AST breadth first
I have a Python AST that I'd like to traverse breadth first. ast.walk appears to do the trick, but from its documentation

ast.walk(node)

Recursively yield all descendant nodes in the tree starting at node (including node itself), in no specified order. This is useful if you only want to modify nodes in place and don’t care about the context.

one might assume that this is merely an implementation detail. Is there a traversal method that guaranteed breadth-first?

Title: Traverse a Python AST breadth first


问:
Docker containers consuming all the inodes of linux machine
I am running out of inodes on my Debian 10 machine
I found the culprits

```<code>~# df -i
Filesystem      Inodes   IUsed  IFree IUse% Mounted on
udev            500578     317 500261    1% /dev
tmpfs           504337     547 503790    1% /run
/dev/sda1      3276800 3090639 186161   95% /
tmpfs           504337       1 504336    1% /dev/shm
tmpfs           504337       3 504334    1% /run/lock
tmpfs           504337      17 504320    1% /sys/fs/cgroup
overlay        3276800 3090639 186161   95% /var/lib/docker/overlay2/c238a2f5bcd5e7e193d572fd4b331510cd2438d113a66e9125f983c929cd8485/merged
overlay        3276800 3090639 186161   95% /var/lib/docker/overlay2/5f3ee0ad57f147f8dba95e1e06ea98fc697c72ff8eaaafa6494faeb8f0742096/merged
tmpfs           504337      11 504326    1% /run/user/10976
tmpfs           504337      11 504326    1% /run/user/10762
shm             504337       1 504336    1% /var/lib/docker/containers/135852b9e95d22ace0cf10b27752a3ad15d1fdfaebcde74f546c26ae4ef01ad8/mounts/shm
shm             504337       1 504336    1% /var/lib/docker/containers/cd9619f7703b1e9fee7c1338379dab5270260d23834b27f278c57500b5e50b5a/mounts/shm
</code>```

docker overlay /var/lib/docker/overlay2/*/merged
Only 2 containers are running.
no dangling images on the machine as well.

```<code>~# docker info
Containers: 2
 Running: 2
 Paused: 0
 Stopped: 0
Images: 19
Server Version: 20.10.18
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
 userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 5.7.0-0.bpo.2-amd64
Operating System: Debian GNU/Linux 10 (buster)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.848GiB
Name: name
ID: SNF2:X4SU:OLKG:ESHV:PX3U:UJGB:MADV:OZ3R:UCZP:KONV:K4ZV:ILL4
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
</code>```

what can I do to reclaim inodes?

PS: Docker version 18.09.0, build 4d60db4

docker system prune and docker image prune does not help either.

Body:
I am running out of inodes on my Debian 10 machine
I found the culprits

~# df -i
Filesystem      Inodes   IUsed  IFree IUse% Mounted on
udev            500578     317 500261    1% /dev
tmpfs           504337     547 503790    1% /run
/dev/sda1      3276800 3090639 186161   95% /
tmpfs           504337       1 504336    1% /dev/shm
tmpfs           504337       3 504334    1% /run/lock
tmpfs           504337      17 504320    1% /sys/fs/cgroup
overlay        3276800 3090639 186161   95% /var/lib/docker/overlay2/c238a2f5bcd5e7e193d572fd4b331510cd2438d113a66e9125f983c929cd8485/merged
overlay        3276800 3090639 186161   95% /var/lib/docker/overlay2/5f3ee0ad57f147f8dba95e1e06ea98fc697c72ff8eaaafa6494faeb8f0742096/merged
tmpfs           504337      11 504326    1% /run/user/10976
tmpfs           504337      11 504326    1% /run/user/10762
shm             504337       1 504336    1% /var/lib/docker/containers/135852b9e95d22ace0cf10b27752a3ad15d1fdfaebcde74f546c26ae4ef01ad8/mounts/shm
shm             504337       1 504336    1% /var/lib/docker/containers/cd9619f7703b1e9fee7c1338379dab5270260d23834b27f278c57500b5e50b5a/mounts/shm

docker overlay /var/lib/docker/overlay2/*/merged
Only 2 containers are running.
no dangling images on the machine as well.

~# docker info
Containers: 2
 Running: 2
 Paused: 0
 Stopped: 0
Images: 19
Server Version: 20.10.18
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
 userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 5.7.0-0.bpo.2-amd64
Operating System: Debian GNU/Linux 10 (buster)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.848GiB
Name: name
ID: SNF2:X4SU:OLKG:ESHV:PX3U:UJGB:MADV:OZ3R:UCZP:KONV:K4ZV:ILL4
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

what can I do to reclaim inodes?

PS: Docker version 18.09.0, build 4d60db4

docker system prune and docker image prune does not help either.


问:
get parent element title using wp_get_nav_menu_items
I need the parent element's title as a variable and also the submenu of it.

Currently  I have:

```<code>function navigation_footer() {
   $menu_name = 'footer_nav';
   if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
      $menu = wp_get_nav_menu_object($locations[$menu_name]);
      $menu_items = wp_get_nav_menu_items($menu->term_id);

      foreach ((array) $menu_items as $key => $menu_item) {
         $title = $menu_item->title;
         $url = $menu_item->url;
         $type = get_post_meta( $item->menu_item_parent, '_menu_item_type', true );
         $title_parent = get_post( $object_id )->post_title;
         $menu_list .= "\t\t\t\t". '<div class="fl-links"><h2>'. $title_parent .'</h2>' ."\n";
         $menu_list .= "\t\t\t\t\t". '<a href="'. $url .'"><p>'. $title .'</p></a></div>' ."\n";
      }
}
   echo $menu_list;
}
</code>```

The variable type gets me the title of a post which was kinda workaround.
Still, it's in a foreach so I'm getting a mess instead of what I actually want.
As I'm a fairly beginner in PHP I am stuck.

Each element in WP is going to be an individual link. The parent is only being used as a placeholder for the title followed by the links.

```<code>[Current output](https://i.stack.imgur.com/xsGRS.png)
[My desired output](https://i.stack.imgur.com/SP14p.png)
[WP Menu Parent/Child](https://i.stack.imgur.com/Z5d8K.png)
</code>```

Body:
I need the parent element's title as a variable and also the submenu of it.

Currently  I have:

function navigation_footer() {
   $menu_name = 'footer_nav';
   if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
      $menu = wp_get_nav_menu_object($locations[$menu_name]);
      $menu_items = wp_get_nav_menu_items($menu->term_id);

      foreach ((array) $menu_items as $key => $menu_item) {
         $title = $menu_item->title;
         $url = $menu_item->url;
         $type = get_post_meta( $item->menu_item_parent, '_menu_item_type', true );
         $title_parent = get_post( $object_id )->post_title;
         $menu_list .= "\t\t\t\t". '

'. $title_parent .'
' ."\n";
         $menu_list .= "\t\t\t\t\t". '
'. $title .'

' ."\n";
      }
}
   echo $menu_list;
}

The variable type gets me the title of a post which was kinda workaround.
Still, it's in a foreach so I'm getting a mess instead of what I actually want.
As I'm a fairly beginner in PHP I am stuck.

Each element in WP is going to be an individual link. The parent is only being used as a placeholder for the title followed by the links.

[Current output](https://i.stack.imgur.com/xsGRS.png)
[My desired output](https://i.stack.imgur.com/SP14p.png)
[WP Menu Parent/Child](https://i.stack.imgur.com/Z5d8K.png)


问:
How to detect support for top level await in Javascript?
ECMAScript 2022 introduced await at the top level of a module. In older browser versions (eg Safari 14) it throws a syntax error. I would like to detect support for TLA so I can provide an alternative.

Since this is a syntax feature I tried to eval TLA in a try/catch-block. However this will always throw a syntax error, since await is only valid at the top level, not inside try and eval.


问:
Using discord.js, how would I check if the user has sent a specific message in a specific channel in the last x hours
I am trying to make a discord bot that sends the user a private message if they have not messaged in a specific channel in the last 24 hours - however it does not seem to be executing as expected.

```<code>  // Check if the user has sent any messages in the last 24 hours
   const lastMessage = message.channel.messages.cache.find(msg => msg.author.id === message.author.id);
  if (!lastMessage || lastMessage.createdTimestamp < Date.now() - 24 * 3600 * 1000) {
    // The user has not sent a message in the last 24 hours
    console.log("Passed first hurdle")
</code>```

I tried doing that but it doesn't seem to work - however if I change the < sign to > it just infinitely deletes a message and sends the user one.

Body:
I am trying to make a discord bot that sends the user a private message if they have not messaged in a specific channel in the last 24 hours - however it does not seem to be executing as expected.

  // Check if the user has sent any messages in the last 24 hours
   const lastMessage = message.channel.messages.cache.find(msg => msg.author.id === message.author.id);
  if (!lastMessage || lastMessage.createdTimestamp < Date.now() - 24 * 3600 * 1000) {
    // The user has not sent a message in the last 24 hours
    console.log("Passed first hurdle")

I tried doing that but it doesn't seem to work - however if I change the < sign to > it just infinitely deletes a message and sends the user one.


问:
add data in a dictionary and print it with python
hello all I'm just learning python and i have a problem.
I want to add the results of a network request inside a dictionary in python and then . I want to download the movie title and id of all the movies on a movie site and put it inside a dictionary. Since the dictionary key must be unique, I thought of creating an "original_title" key where I put all the titles of the movies and another "id" key where I put the id of all the movies. This is my code:

```<code>dictionary={}
for i in range(1,36590):
    response1 = requests.get("https://api.themoviedb.org/3/discover/moie?api_key=mykey&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page="+str(i)+"&with_watch_monetization_types=flatrate")
    jsonresponse1=response1.json()
    results=jsonresponse1["results"]
    for result in results:
        dictionary.setdefault("original_title", [])
        dictionary.setdefault("id", [])
        dictionary['original_title'].append(result["original_title"])
        dictionary['id'].append(result["id"])
print(dictionary)
</code>```

why doesn't my code work? How can I print the dictionary, after adding the data downloaded from the website?

Body:
hello all I'm just learning python and i have a problem.
I want to add the results of a network request inside a dictionary in python and then . I want to download the movie title and id of all the movies on a movie site and put it inside a dictionary. Since the dictionary key must be unique, I thought of creating an "original_title" key where I put all the titles of the movies and another "id" key where I put the id of all the movies. This is my code:

dictionary={}
for i in range(1,36590):
    response1 = requests.get("https://api.themoviedb.org/3/discover/moie?api_key=mykey&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page="+str(i)+"&with_watch_monetization_types=flatrate")
    jsonresponse1=response1.json()
    results=jsonresponse1["results"]
    for result in results:
        dictionary.setdefault("original_title", [])
        dictionary.setdefault("id", [])
        dictionary['original_title'].append(result["original_title"])
        dictionary['id'].append(result["id"])
print(dictionary)

why doesn't my code work? How can I print the dictionary, after adding the data downloaded from the website?


问:
Excel Range to DataTable VB.NET
My code below creates a 2D Array from an Excel Range. I then want to 'paste' that array into a DataTable. My code below seems to work fine for creating the DataTable with all the correct Columns and then creating the array from the Excel Range. I'm just having trouble adding the array to the DataTable.

Hoping someone can help me out with this.
Thanks in advance.

```<code>    Public Sub ExcelRangeToDataTable()

        Dim xlApp As Excel.Application
        Dim WB As Excel.Workbook
        Dim WS As Excel.Worksheet
        Dim DataRange As Excel.Range
        Dim LR As Integer

        xlApp = GetObject(, Constants.ExcelApp)
        WB = xlApp.Workbooks("TestWB")
        WS = WB.Sheets("Sheet1")
        LR = WS.Cells(WS.Rows.Count, "A").End(Excel.XlDirection.xlUp).Row
        DataRange = WS.Range("A" & Constants.First_Row & ":Y" & LR)

        Dim DT As DataTable = New DataTable()
        Call CreateDataTable(DT) 'Create the DataTable and all Columns

        Dim excelRows As Object(,) = DataRange.Value 'Create a 2D Array

        'Add the 2D Array to the DataTable
        For i As Integer = 1 To excelRows.GetUpperBound(0)
            DT.Rows.Add()
            For j As Integer = 1 To excelRows.GetUpperBound(1)
                DT.Rows(i).Item(j) = excelRows(i, j)
            Next j
        Next i

    End Sub
</code>```

Title: Excel Range to DataTable VB.NET

Body:
My code below creates a 2D Array from an Excel Range. I then want to 'paste' that array into a DataTable. My code below seems to work fine for creating the DataTable with all the correct Columns and then creating the array from the Excel Range. I'm just having trouble adding the array to the DataTable.

Hoping someone can help me out with this.
Thanks in advance.

    Public Sub ExcelRangeToDataTable()

        Dim xlApp As Excel.Application
        Dim WB As Excel.Workbook
        Dim WS As Excel.Worksheet
        Dim DataRange As Excel.Range
        Dim LR As Integer

        xlApp = GetObject(, Constants.ExcelApp)
        WB = xlApp.Workbooks("TestWB")
        WS = WB.Sheets("Sheet1")
        LR = WS.Cells(WS.Rows.Count, "A").End(Excel.XlDirection.xlUp).Row
        DataRange = WS.Range("A" & Constants.First_Row & ":Y" & LR)

        Dim DT As DataTable = New DataTable()
        Call CreateDataTable(DT) 'Create the DataTable and all Columns

        Dim excelRows As Object(,) = DataRange.Value 'Create a 2D Array

        'Add the 2D Array to the DataTable
        For i As Integer = 1 To excelRows.GetUpperBound(0)
            DT.Rows.Add()
            For j As Integer = 1 To excelRows.GetUpperBound(1)
                DT.Rows(i).Item(j) = excelRows(i, j)
            Next j
        Next i

    End Sub


问:
How can I print the loss value obtained from model.add_loss() function in Tensorflow 2 (with Keras API)?
I have a classification model in Keras API of Tensorflow 2. The model has two losses in the example below, categorical cross entropy and KL-divergence. Categorical cross-entropy is being added while initializing the model and hence it can be printed while training. KL-divergence is being added separately using model.add_loss(). However, it does not display during training. Is there a way to print it while training? The sample code is shown below. Since it is on simulated data, loss value might come to be nan.

```<code>import tensorflow as tf
keras = tf.keras
import keras.backend as K
import numpy as np

def ohc(y):
  y = np.random.randint(4, size=100)
  b = np.zeros((y.size, y.max() + 1))
  b[np.arange(y.size), y] = 1

  return b

xtrain = np.random.rand(100,50)
y = np.random.randint(4, size=100)
y_one_hot = ohc(y)

def my_kld(y_true, y_pred):

  y_pred2 = tf.keras.layers.Lambda(lambda x: x + 0.00001)(y_pred)
  LR = y_true/y_pred2
  logLR = K.log(LR)
  kld = y_true*logLR
  loss = K.mean(kld)
  loss = tf.keras.layers.Lambda(lambda x: x * 0.2)(loss)
  return loss

x_t = keras.layers.Input((50,))
y_t = keras.layers.Input((4,))

x1 = keras.layers.Dense(100, activation = 'relu')(x_t)
x2 = keras.layers.Dense(4, activation = 'softmax')(x1)

model = keras.models.Model([x_t,y_t], x2)
model.add_loss(my_kld(y_t, x2))

optim = keras.optimizers.Nadam(0.00006)

model.compile(loss=['categorical_crossentropy'], optimizer=optim, metrics=['accuracy'])
model.fit(x=[xtrain,y_one_hot], y = y_one_hot, epochs = 100)

</code>```

The code that I have tried has been included in the question in an implementable way. Hwever, there does not seem to be any way to print the loss from model.add_loss().

Body:
I have a classification model in Keras API of Tensorflow 2. The model has two losses in the example below, categorical cross entropy and KL-divergence. Categorical cross-entropy is being added while initializing the model and hence it can be printed while training. KL-divergence is being added separately using model.add_loss(). However, it does not display during training. Is there a way to print it while training? The sample code is shown below. Since it is on simulated data, loss value might come to be nan.

import tensorflow as tf
keras = tf.keras
import keras.backend as K
import numpy as np

def ohc(y):
  y = np.random.randint(4, size=100)
  b = np.zeros((y.size, y.max() + 1))
  b[np.arange(y.size), y] = 1

  return b

xtrain = np.random.rand(100,50)
y = np.random.randint(4, size=100)
y_one_hot = ohc(y)

def my_kld(y_true, y_pred):

  y_pred2 = tf.keras.layers.Lambda(lambda x: x + 0.00001)(y_pred)
  LR = y_true/y_pred2
  logLR = K.log(LR)
  kld = y_true*logLR
  loss = K.mean(kld)
  loss = tf.keras.layers.Lambda(lambda x: x * 0.2)(loss)
  return loss

x_t = keras.layers.Input((50,))
y_t = keras.layers.Input((4,))

x1 = keras.layers.Dense(100, activation = 'relu')(x_t)
x2 = keras.layers.Dense(4, activation = 'softmax')(x1)

model = keras.models.Model([x_t,y_t], x2)
model.add_loss(my_kld(y_t, x2))

optim = keras.optimizers.Nadam(0.00006)

model.compile(loss=['categorical_crossentropy'], optimizer=optim, metrics=['accuracy'])
model.fit(x=[xtrain,y_one_hot], y = y_one_hot, epochs = 100)

The code that I have tried has been included in the question in an implementable way. Hwever, there does not seem to be any way to print the loss from model.add_loss().


问:
How to make and statement on IF trigger SQL?
I have a trigger and I have conditions in it, and I wanted to make something like this, but I can't manage to do it, I tried several things but none of them worked...</p>
```<code>IF NEW.foo = OLD.foo AND NEW.bar = OLD.bar
THEN
...
RETURN NEW
END IF;
END;

CREATE OR REPLACE FUNCTION user_histo() RETURNS trigger AS $$
  BEGIN
                IF      TG_OP = 'INSERT'
                THEN
                        INSERT INTO table (attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7)
                                VALUES (NEW.attribute1, NEW.attribute2, NEW.attribute3, NEW.attribute4, NEW.attribute5, NEW.attribute6, 'INSERT');
                        RETURN NEW;
                ELSIF   TG_OP = 'UPDATE'
                THEN
        IF (OLD.attribute2 = NEW.attribute2 AND  OLD.attribute3 = NEW.attribute3) // this is my problem
        THEN
                        INSERT INTO table (attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7)
                                VALUES (OLD.attribute1, OLD.attribute2, OLD.attribute3, OLD.attribute4, OLD.attribute5, OLD.attribute6, 'UPDATE');
                        INSERT INTO table (attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7)
                                VALUES (NEW.attribute1, NEW.attribute2, NEW.attribute3, NEW.attribute4, NEW.attribute5, NEW.attribute6, 'INSERT');
        RETURN NEW;
        ELSE
        RETURN NULL;
        END IF;
        END IF;
        END;

$$ LANGUAGE 'plpgsql' SECURITY DEFINER;

CREATE TRIGGER trigger_table AFTER INSERT OR UPDATE ON table
        FOR EACH ROW EXECUTE PROCEDURE user_histo();
</code>```

Body:
I have a trigger and I have conditions in it, and I wanted to make something like this, but I can't manage to do it, I tried several things but none of them worked...

IF NEW.foo = OLD.foo AND NEW.bar = OLD.bar
THEN
...
RETURN NEW
END IF;
END;

CREATE OR REPLACE FUNCTION user_histo() RETURNS trigger AS $$
  BEGIN
                IF      TG_OP = 'INSERT'
                THEN
                        INSERT INTO table (attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7)
                                VALUES (NEW.attribute1, NEW.attribute2, NEW.attribute3, NEW.attribute4, NEW.attribute5, NEW.attribute6, 'INSERT');
                        RETURN NEW;
                ELSIF   TG_OP = 'UPDATE'
                THEN
        IF (OLD.attribute2 = NEW.attribute2 AND  OLD.attribute3 = NEW.attribute3) // this is my problem
        THEN
                        INSERT INTO table (attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7)
                                VALUES (OLD.attribute1, OLD.attribute2, OLD.attribute3, OLD.attribute4, OLD.attribute5, OLD.attribute6, 'UPDATE');
                        INSERT INTO table (attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7)
                                VALUES (NEW.attribute1, NEW.attribute2, NEW.attribute3, NEW.attribute4, NEW.attribute5, NEW.attribute6, 'INSERT');
        RETURN NEW;
        ELSE
        RETURN NULL;
        END IF;
        END IF;
        END;

$$ LANGUAGE 'plpgsql' SECURITY DEFINER;

CREATE TRIGGER trigger_table AFTER INSERT OR UPDATE ON table
        FOR EACH ROW EXECUTE PROCEDURE user_histo();


问:
permanently merge and concatenate multiple columns in laravel
I am trying to merge 3 clumns into a single column,

here is the logic:

I have a serial number table with:

number

prefix

separation
I want to merge them into a single column named serial_number in the same table.

in another table of orders I will recover the serial_number in the controller, at store it will update the number + 1 in the table of serial numbers,

I tried to update the number and concatenate the 3 columns in the controller at each recording it works ,
but the problem is that the user can modify the order of the 3 columns in the settings.

is there a method to permanently merge and concatenate the 3 columns without doing it on the order controller so if the user changes the order automatically it will update the column serial_number ,


问:
django rest framework serializer raising invalid errors
```<code>class AdvanceSearchSerializer(serializers.Serializer):
    all_of_these_words = serializers.CharField(allow_null=True, required=False)
    this_exact_phase = serializers.CharField(allow_null=True, required=False)
    any_of_these_words = serializers.CharField(allow_null=True, required=False)

class myclass(viewsets.Viewsets):
    serializer = AdvanceSearchSerializer(data = request.data)
</code>```

it works fine. for now im passing data from post request in postman as form-data but when I change it to raw and wih json format it raising the below errors. show that this field is required even though i have set it to null true.

```<code>  {
        "response": false,
        "return_code": "field_error",
        "result": [],
        "message": {
            "all_of_these_words": [
                "This field may not be blank."
            ],
            "this_exact_phase": [
                "This field may not be blank."
            ],
            "any_of_these_words": [
                "This field may not be blank."
           ]

        }
    }
</code>```

Body:
class AdvanceSearchSerializer(serializers.Serializer):
    all_of_these_words = serializers.CharField(allow_null=True, required=False)
    this_exact_phase = serializers.CharField(allow_null=True, required=False)
    any_of_these_words = serializers.CharField(allow_null=True, required=False)

class myclass(viewsets.Viewsets):
    serializer = AdvanceSearchSerializer(data = request.data)

it works fine. for now im passing data from post request in postman as form-data but when I change it to raw and wih json format it raising the below errors. show that this field is required even though i have set it to null true.

  {
        "response": false,
        "return_code": "field_error",
        "result": [],
        "message": {
            "all_of_these_words": [
                "This field may not be blank."
            ],
            "this_exact_phase": [
                "This field may not be blank."
            ],
            "any_of_these_words": [
                "This field may not be blank."
           ]

        }
    }


问:
primary key type for AWS RDS mysql aurora
I have a specific question on AWS RDS aurora recommendations. Which primary key type the best is for my usecase.

At first I will describe my current situation and after that what my current research results are:

I have a database currently running on an aws rds aurora 2 cluster (mysql 5.7). On that Multi Az Cluster i have a database with multiple tables. Some of these tables are quite large with more than 500Mio rows. On top of this Database runs a spring boot application with multiple instances to read and write data to these tables. At the moment we use UUID's as primary keys. So that primary key handling is easy with the multiple instances and Green-Blue Deployments and so on.
We store them as mentioned in mysql documentation as binary(16) column.

A few days ago I saw a tweet from Vlad Mihalcea referring to this article. Vlad said the following:

Because the B+Tree index needs to rebalance itself in order to maintain its equidistant tree structure, the random key values will cause more index page splits and merges as there is no pre-determined order of filling the tree structure.

And than he mentioned that this fact is even worse for mysql, because the entire table is basically a clustered index. This was a little bit of an alert for me. It raises some questions in my head:

I know that AWS just use the mysql 5.7 dialect for the aurora 2. They reworked the internals of the database as far as I know. So I wonder if a UUID is such a bad idea? If aurora 2 stores the data like mysql. Is there a difference to aurora 3?

Vlad mentioned TSID as alternative. Are there any experience with this datatype on aws aurora mysql clusters?

Did anyone have some experiances on that topic. I try to use the best practices side from the aws documentation. But there were no useful hints for my topic. Maybe I missed something. I'm thankful for any thoughts.


问:
pyrebase auth and kivy signup and login pages
i have been working on a python app using kivy and firebase authentication.. following youtube tutorials really....
i can get it so when the button is pressed on the signup screen and there is a valid email and password .. the user is created in firebase realtime db and it prints the idToken
however, when the user enters an invalid email password the code errors which i have used the Try and Except.. but i cant for the life of me link that Except to my .kv file where i have the label with id:login_message for the error message to be shown on the screen.

by chucking in some random letters into the signup inputs.. i can get it to print invalid
enter image description here

code is below...
what goes under the except in the class MyFirebaseSignup: and in the except: to print the label with id: login_message in the signup.kv file

LoginSignup.py

```<code>import pyrebase
from kivy.core.text import LabelBase
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen,ScreenManager
from kivymd.app import MDApp
from kivy.app import App
import requests
import json

Window.size = (310, 580)

config = {
    "apiKey": "AIzaSyB8f5Py7E60rlCtpAaqXzpmWSgHN9vxfrc",
    "authDomain": "fir-python-demo-39212.firebaseapp.com",
    "databaseURL": "https://fir-python-demo-39212-default-rtdb.firebaseio.com",
    "storageBucket": "fir-python-demo-39212.appspot.com",
}

firebase = pyrebase.initialize_app(config)
auth = firebase.auth()

class MyFirebaseSignup:
    def sign_up(self, username, email, password, login_message=None):
        try:
            user = auth.create_user_with_email_and_password(email, password)
            data = {"email": email, "password": password, "idToken": True}
            info = auth.get_account_info(user["idToken"])
            auth.send_email_verification(user["idToken"])
            password = data.get("password")
            print("Successfully created account")
        except:
            print("Invalid")
            #App.get_running_app().root.ids["signup_screen"].ids["signup_screen"].text = MyLabel ..... doesnt work
            #app..... id: SignUpError  ---- display error message on signin page
            pass

class MyFirebaseLogin():
    def Login(self, email, password):
        try:
            login = auth.sign_in_with_email_and_password(email, password)
            print("Successfully Logged in")
        except:
            print("invalid")
        pass

class MainScreen(Screen):
    pass

class LoginScreen(Screen):
    pass

class SignupScreen(Screen):
    pass

class LoginSignup(MDApp):

    def build(self):
        screen_manager = ScreenManager()
        screen_manager.add_widget(Builder.load_file("main.kv"))
        screen_manager.add_widget(Builder.load_file("signup.kv"))
        screen_manager.add_widget(Builder.load_file("login.kv"))
        self.my_firebasesignup = MyFirebaseSignup()
        self.my_firebaselogin = MyFirebaseLogin()
        return screen_manager

if __name__ == "__main__":
    LoginSignup().run()

</code>```

signup.kv

```<code><SignupScreen>:
MDScreen:
    name: "signup"
    id: signup
    MDFloatLayout:
        MDLabel:
            id: SignUpError
            font_size: "18sp"
            pos_hint: {"center_x":.5,"center_y":.73}
            halign: "center"
            color: (1,0,0,1)
        MDFloatLayout:
            size_hint: .7,.07
            pos_hint: {"center_x":.5,"center_y":.68}
            TextInput:
                id: login_username
                hint_text: "Username"
                size_hint_y: .75
                pos_hint: {"center_x":.43,"center_y":.5}
            MDFloatLayout:
                pos_hint: {"center_x":.45,"center_y":.0}
                size_hint_y: .03
                md_bg_color: rgba(178,178,178,255)
        MDFloatLayout:
            size_hint: .7,.07
            pos_hint: {"center_x":.5,"center_y":.56}
            TextInput:
                id: login_email
                hint_text: "Email"
                size_hint_y: .75
                pos_hint: {"center_x":.43,"center_y":.5}
            MDFloatLayout:
                pos_hint: {"center_x":.45,"center_y":.0}
                size_hint_y: .03
                md_bg_color: rgba(178,178,178,255)
        MDFloatLayout:
            size_hint: .7,.07
            pos_hint: {"center_x":.5,"center_y":.44}
            TextInput:
                id: login_password
                hint_text: "Password"

        Button:
            text: "SIGNUP"
            size_hint: .66, .065
            pos_hint: {"center_x":.5,"center_y":.3}
            background_color: 0,0,0,0
            font_name: "BPoppins"
            canvas.before:
                Color:
                    rgb: rgba(52,0,231,255)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [5]
            on_release:
                print("Sign up", login_email.text, login_password.text)
          app.my_firebasesignup.sign_up(login_username.text,login_email.text,login_password.text)

</code>```

youtube, google, random code

Body:
i have been working on a python app using kivy and firebase authentication.. following youtube tutorials really....
i can get it so when the button is pressed on the signup screen and there is a valid email and password .. the user is created in firebase realtime db and it prints the idToken
however, when the user enters an invalid email password the code errors which i have used the Try and Except.. but i cant for the life of me link that Except to my .kv file where i have the label with id:login_message for the error message to be shown on the screen.

by chucking in some random letters into the signup inputs.. i can get it to print invalid
enter image description here

code is below...
what goes under the except in the class MyFirebaseSignup: and in the except: to print the label with id: login_message in the signup.kv file

LoginSignup.py

import pyrebase
from kivy.core.text import LabelBase
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen,ScreenManager
from kivymd.app import MDApp
from kivy.app import App
import requests
import json

Window.size = (310, 580)

config = {
    "apiKey": "AIzaSyB8f5Py7E60rlCtpAaqXzpmWSgHN9vxfrc",
    "authDomain": "fir-python-demo-39212.firebaseapp.com",
    "databaseURL": "https://fir-python-demo-39212-default-rtdb.firebaseio.com",
    "storageBucket": "fir-python-demo-39212.appspot.com",
}

firebase = pyrebase.initialize_app(config)
auth = firebase.auth()

class MyFirebaseSignup:
    def sign_up(self, username, email, password, login_message=None):
        try:
            user = auth.create_user_with_email_and_password(email, password)
            data = {"email": email, "password": password, "idToken": True}
            info = auth.get_account_info(user["idToken"])
            auth.send_email_verification(user["idToken"])
            password = data.get("password")
            print("Successfully created account")
        except:
            print("Invalid")
            #App.get_running_app().root.ids["signup_screen"].ids["signup_screen"].text = MyLabel ..... doesnt work
            #app..... id: SignUpError  ---- display error message on signin page
            pass

class MyFirebaseLogin():
    def Login(self, email, password):
        try:
            login = auth.sign_in_with_email_and_password(email, password)
            print("Successfully Logged in")
        except:
            print("invalid")
        pass

class MainScreen(Screen):
    pass

class LoginScreen(Screen):
    pass

class SignupScreen(Screen):
    pass

class LoginSignup(MDApp):

    def build(self):
        screen_manager = ScreenManager()
        screen_manager.add_widget(Builder.load_file("main.kv"))
        screen_manager.add_widget(Builder.load_file("signup.kv"))
        screen_manager.add_widget(Builder.load_file("login.kv"))
        self.my_firebasesignup = MyFirebaseSignup()
        self.my_firebaselogin = MyFirebaseLogin()
        return screen_manager

if __name__ == "__main__":
    LoginSignup().run()

signup.kv

<SignupScreen>:
MDScreen:
    name: "signup"
    id: signup
    MDFloatLayout:
        MDLabel:
            id: SignUpError
            font_size: "18sp"
            pos_hint: {"center_x":.5,"center_y":.73}
            halign: "center"
            color: (1,0,0,1)
        MDFloatLayout:
            size_hint: .7,.07
            pos_hint: {"center_x":.5,"center_y":.68}
            TextInput:
                id: login_username
                hint_text: "Username"
                size_hint_y: .75
                pos_hint: {"center_x":.43,"center_y":.5}
            MDFloatLayout:
                pos_hint: {"center_x":.45,"center_y":.0}
                size_hint_y: .03
                md_bg_color: rgba(178,178,178,255)
        MDFloatLayout:
            size_hint: .7,.07
            pos_hint: {"center_x":.5,"center_y":.56}
            TextInput:
                id: login_email
                hint_text: "Email"
                size_hint_y: .75
                pos_hint: {"center_x":.43,"center_y":.5}
            MDFloatLayout:
                pos_hint: {"center_x":.45,"center_y":.0}
                size_hint_y: .03
                md_bg_color: rgba(178,178,178,255)
        MDFloatLayout:
            size_hint: .7,.07
            pos_hint: {"center_x":.5,"center_y":.44}
            TextInput:
                id: login_password
                hint_text: "Password"

        Button:
            text: "SIGNUP"
            size_hint: .66, .065
            pos_hint: {"center_x":.5,"center_y":.3}
            background_color: 0,0,0,0
            font_name: "BPoppins"
            canvas.before:
                Color:
                    rgb: rgba(52,0,231,255)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [5]
            on_release:
                print("Sign up", login_email.text, login_password.text)
          app.my_firebasesignup.sign_up(login_username.text,login_email.text,login_password.text)

youtube, google, random code


问:
Ag-Grid dropdown popup is hidden
I'm trying to load a custom dropdown celleditor component into my Ag-Grid in Vue3. I have reproduced the issue here: https://codesandbox.io/s/ag-grid-vue-3-example-forked-h5z6r5?file=/src/App.vue

The problem is that the options are hidden under the rows.
I have found one cheaty way of fixing this by overriding:

```<code>.ag-row-focus {
    z-index: 999;
}

.ag-grid-cell {
    overflow-y:visible !important;
    overflow-x:visible !important;
    z-index: 999 !important;
}
</code>```

The problem with this approach is that it's completely dependent on ag-row-focus. If a user has a specific row selected and then clicks on the dropdown of another row, say the one above, then the selected row is still another row and therefore, the options are still hidden. There were also other issues, for instance that the dropdown itself with these overflow settings do not respect the cell width and height anymore (especially the height). When the text is larger than intended, it is also when collapsed breaking the height rules for that cell.

Ag-Grid versions used:

```<code>"ag-grid-community": "26.1.0",
"ag-grid-vue3": "26.1.2",
</code>```

Update:

I got most of the behavior now working by adding the css below. Remaining issue is that the text inside the dropdown also overflows and gets too big due to which it goes onto other cells & the height goes further than the row. Expected behavior is probably here that the text gets cut off.

```<code>.ag-grid-cell {
  overflow: visible !important;
  z-index: 10030 !important;
}
.ag-row {
  z-index: 0;
}

.ag-row.ag-row-focus {
  z-index: 1;
}
.ag-root-wrapper,
.ag-root,
.ag-body-viewport,
.ag-body-viewport-wrapper,
.ag-center-cols-clipper {
  overflow: visible !important;
  z-index: 5;
}

.ag-center-cols-viewport {
  overflow: visible !important;
}
</code>```

Updated sandbox:
https://codesandbox.io/s/ag-grid-vue-3-example-forked-nvnhue?file=/src/App.vue

Title: Ag-Grid dropdown popup is hidden

Body:
I'm trying to load a custom dropdown celleditor component into my Ag-Grid in Vue3. I have reproduced the issue here: https://codesandbox.io/s/ag-grid-vue-3-example-forked-h5z6r5?file=/src/App.vue

The problem is that the options are hidden under the rows.
I have found one cheaty way of fixing this by overriding:

.ag-row-focus {
    z-index: 999;
}

.ag-grid-cell {
    overflow-y:visible !important;
    overflow-x:visible !important;
    z-index: 999 !important;
}

The problem with this approach is that it's completely dependent on ag-row-focus. If a user has a specific row selected and then clicks on the dropdown of another row, say the one above, then the selected row is still another row and therefore, the options are still hidden. There were also other issues, for instance that the dropdown itself with these overflow settings do not respect the cell width and height anymore (especially the height). When the text is larger than intended, it is also when collapsed breaking the height rules for that cell.

Ag-Grid versions used:

"ag-grid-community": "26.1.0",
"ag-grid-vue3": "26.1.2",

Update:

I got most of the behavior now working by adding the css below. Remaining issue is that the text inside the dropdown also overflows and gets too big due to which it goes onto other cells & the height goes further than the row. Expected behavior is probably here that the text gets cut off.

.ag-grid-cell {
  overflow: visible !important;
  z-index: 10030 !important;
}
.ag-row {
  z-index: 0;
}

.ag-row.ag-row-focus {
  z-index: 1;
}
.ag-root-wrapper,
.ag-root,
.ag-body-viewport,
.ag-body-viewport-wrapper,
.ag-center-cols-clipper {
  overflow: visible !important;
  z-index: 5;
}

.ag-center-cols-viewport {
  overflow: visible !important;
}

Updated sandbox:
https://codesandbox.io/s/ag-grid-vue-3-example-forked-nvnhue?file=/src/App.vue


问:
Google login not working on bitbucket CI built apk
We are using bitbucket for code hosting. Firebase app distribution for distributing the apk. The application has google login for signing into the app. We have three build types, debug, staging and release. We have updated the google-services.json file from the Firebase project for each type.

We are using automated builds from our bitbucket using a bitbucket-pipelines.yml file which is as follows:

```<code>pipelines:
  pull-requests:
    dev:
      - parallel:
          - step: # step to build Android debug application
              name: Android Debug Application
              caches: # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
                - gradle
              size: 2x # Double resources available for this step.
              script:
                - chmod +x gradlew
                - ./gradlew assembleDebug
              artifacts:
                - app/build/outputs/**        # artifacts are files that are produced by a step https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/
          - step: # step to run unit tests
              name: Unit Tests
              caches:
                - gradle    # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
              script:
                - chmod +x gradlew
                - ./gradlew testDebugUnitTest # test reporting is automatically enabled https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/

  tags:
    release-stage-*: #This tag triggers a pipeline when a tag starting with “release-stage-” is pushed.
      - step:
          name: Deploy To Firebase App Distribution
          deployment: 'Staging'
          caches:
            - gradle
          size: 2x # Double resources available for this step.
          script:
            - export FIREBASE_TOKEN=$FIREBASE_REFRESH_TOKEN
            - echo "$SIGNING_JKS_FILE" | base64 -di > release-keystore.jks
            - chmod +x gradlew
            - ./gradlew --stop
            # Build an unsigned apk and deploy apk to Firebase App Distribution
            - ./gradlew assembleStaging appDistributionUploadStaging
          artifacts:
            - app/build/outputs/apk/staging/app-staging.apk

    release-prod-*: #This tag triggers a pipeline when a tag starting with “release-prod-” is pushed. Also make sure its only created from 'master'
      - step:
          name: Deploy To Google Play
          deployment: 'Production'
          caches:
            - gradle
          size: 2x # Double resources available for this step.
          script:
            - echo "$SIGNING_JKS_FILE" | base64 -di > release-keystore.jks
            - base64 --decode > release-keystore.jks $SIGNING_JKS_FILE
            - chmod +x gradlew
            - ./gradlew --stop
            # Build a signed release aab
            - ./gradlew bundleRelease
          artifacts:
            - app/release/app-release.aab
</code>```

Now the problem is that builds that are built on my local machine for debug/staging have no issues at all. The google login works on those builds and all other features as well.
But as soon as a build is made from the release-stage-<build_number> tag from the pipeline, a build is generated and pushed to firebase app distribution but the build has issues with google login, specifically google login does not work. ApiException 10

Following are the locations that I have put in my google-services.json files at:

app/src/debug/ -> For debug builds

app/src/staging -> For staging builds

app/src/ -> For release builds

I have made the following assumption till now.

Since the CI machine that builds the apk is not fixed, ie. it changes every time the release-stage-* tag is created and pushed, the SHA fingerprint of the generated build is different which does not communicate well with firebase project that is in place causing the google login to not work.

My question is: Is the assumption that I have made, correct?

If yes, how do I overcome this to automate build generation that has working google login on my android app?

If no, what exactly is going wrong here, as I am totally out of ideas at this point.

Body:
We are using bitbucket for code hosting. Firebase app distribution for distributing the apk. The application has google login for signing into the app. We have three build types, debug, staging and release. We have updated the google-services.json file from the Firebase project for each type.

We are using automated builds from our bitbucket using a bitbucket-pipelines.yml file which is as follows:

pipelines:
  pull-requests:
    dev:
      - parallel:
          - step: # step to build Android debug application
              name: Android Debug Application
              caches: # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
                - gradle
              size: 2x # Double resources available for this step.
              script:
                - chmod +x gradlew
                - ./gradlew assembleDebug
              artifacts:
                - app/build/outputs/**        # artifacts are files that are produced by a step https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/
          - step: # step to run unit tests
              name: Unit Tests
              caches:
                - gradle    # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
              script:
                - chmod +x gradlew
                - ./gradlew testDebugUnitTest # test reporting is automatically enabled https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/

  tags:
    release-stage-*: #This tag triggers a pipeline when a tag starting with “release-stage-” is pushed.
      - step:
          name: Deploy To Firebase App Distribution
          deployment: 'Staging'
          caches:
            - gradle
          size: 2x # Double resources available for this step.
          script:
            - export FIREBASE_TOKEN=$FIREBASE_REFRESH_TOKEN
            - echo "$SIGNING_JKS_FILE" | base64 -di > release-keystore.jks
            - chmod +x gradlew
            - ./gradlew --stop
            # Build an unsigned apk and deploy apk to Firebase App Distribution
            - ./gradlew assembleStaging appDistributionUploadStaging
          artifacts:
            - app/build/outputs/apk/staging/app-staging.apk

    release-prod-*: #This tag triggers a pipeline when a tag starting with “release-prod-” is pushed. Also make sure its only created from 'master'
      - step:
          name: Deploy To Google Play
          deployment: 'Production'
          caches:
            - gradle
          size: 2x # Double resources available for this step.
          script:
            - echo "$SIGNING_JKS_FILE" | base64 -di > release-keystore.jks
            - base64 --decode > release-keystore.jks $SIGNING_JKS_FILE
            - chmod +x gradlew
            - ./gradlew --stop
            # Build a signed release aab
            - ./gradlew bundleRelease
          artifacts:
            - app/release/app-release.aab

Now the problem is that builds that are built on my local machine for debug/staging have no issues at all. The google login works on those builds and all other features as well.
But as soon as a build is made from the release-stage-<build_number> tag from the pipeline, a build is generated and pushed to firebase app distribution but the build has issues with google login, specifically google login does not work. ApiException 10

Following are the locations that I have put in my google-services.json files at:

app/src/debug/ -> For debug builds

app/src/staging -> For staging builds

app/src/ -> For release builds

I have made the following assumption till now.

Since the CI machine that builds the apk is not fixed, ie. it changes every time the release-stage-* tag is created and pushed, the SHA fingerprint of the generated build is different which does not communicate well with firebase project that is in place causing the google login to not work.

My question is: Is the assumption that I have made, correct?

If yes, how do I overcome this to automate build generation that has working google login on my android app?

If no, what exactly is going wrong here, as I am totally out of ideas at this point.


问:
How to make mypy skip relative import when there is no parent package
Suppose for some ugly packaging reasons I have a file foo.py that contains:

```<code>try:
    from . import bar
except ImportError:
    import bar
</code>```

Suppose the file structure is such that there is no __init__.py file so an ImportError is expected to be raised and caught. If I run mypy over this code, I receive the following error:

```<code>mypy_eg/foo.py:2: error: No parent module -- cannot perform relative import
Found 1 error in 1 file (errors prevented further checking)
</code>```

However if I change line 2 to from . import bar  # type: ignore, I still get the error.

I expect this comment to skip the error. Indeed, if I try to ignore other errors in the file like this, mypy happily skips them, but just not this one for some reason.

Does anyone have any idea why this is?

Body:
Suppose for some ugly packaging reasons I have a file foo.py that contains:

try:
    from . import bar
except ImportError:
    import bar

Suppose the file structure is such that there is no __init__.py file so an ImportError is expected to be raised and caught. If I run mypy over this code, I receive the following error:

mypy_eg/foo.py:2: error: No parent module -- cannot perform relative import
Found 1 error in 1 file (errors prevented further checking)

However if I change line 2 to from . import bar  # type: ignore, I still get the error.

I expect this comment to skip the error. Indeed, if I try to ignore other errors in the file like this, mypy happily skips them, but just not this one for some reason.

Does anyone have any idea why this is?


问:
Issue with HtmlUnitDriver's frame switch in Java / Issue with switching to a 'srcdoc' based iframe
I have a java program to scrape a web page, using selenium-server-standalone-3.9.1 jar.

I create org.openga.selenium.htmlunit.HtmlUnitDriver to fetch the page which contains 2 iframes inside. JavascriptEnabled is true.

I can access the page and parse ok without issues, but for some reason, switching to those frames, doesn't seem to work.  Here is a snippet of the code.

```<code>driver.switchTo().defaultContent();

//The below line works fine without issues, so I'm assuming switching is succeeding.
//FYI if I give a bogus bad frame name here, it does raise an exception, which indicates that //the driver is recognizing the frame ok

driver.switchTo().frame(driver.findElement(By.id("xyz"))); //no exceptions raised

//Here, driver.getPageSource() here shows no content, just have an empty as follows
//<html>
// <head/>
// <body/>
//</html>
// So, I can't get any actually existing elements inside the iframe at all here..
// i.e. getElements() etc would return nothing..

driver.switchTo().defaultContent();
driver.getPageSource(); //shows the full page ok again..

</code>```

I don't believe it's page loading issue as the full source dump from the driver does show the contents of those embedded iframes source ok. So, I don't think "wait" would help here.
What am I missing here?

Tried to use WebDriverWait to wait for frames to be available etc, no luck.

Body:
I have a java program to scrape a web page, using selenium-server-standalone-3.9.1 jar.

I create org.openga.selenium.htmlunit.HtmlUnitDriver to fetch the page which contains 2 iframes inside. JavascriptEnabled is true.

I can access the page and parse ok without issues, but for some reason, switching to those frames, doesn't seem to work.  Here is a snippet of the code.

driver.switchTo().defaultContent();

//The below line works fine without issues, so I'm assuming switching is succeeding.
//FYI if I give a bogus bad frame name here, it does raise an exception, which indicates that //the driver is recognizing the frame ok

driver.switchTo().frame(driver.findElement(By.id("xyz"))); //no exceptions raised

//Here, driver.getPageSource() here shows no content, just have an empty as follows
//
//
//
//
// So, I can't get any actually existing elements inside the iframe at all here..
// i.e. getElements() etc would return nothing..

driver.switchTo().defaultContent();
driver.getPageSource(); //shows the full page ok again..

I don't believe it's page loading issue as the full source dump from the driver does show the contents of those embedded iframes source ok. So, I don't think "wait" would help here.
What am I missing here?

Tried to use WebDriverWait to wait for frames to be available etc, no luck.


问:
Powershell script throwing error while calling an API using ssl
We have a powershell script which is used to call an API by establishing connection over SSL. The certificates are placed along powershell script to be used by it. And the password is mentioned in an ini file which script reads. It was working fine earlier but suddenly it has started giving below error:

Exception calling "Import" with "3" argument(s): "The specified network password is not correct.
"
At C:\Users\Administrator\Desktop\NewInstallIssue\Download\win\installCDWindows.ps1:70 char:3
+         $cert.Import($CertificatePath, $KeyStore_Password ,'DefaultKeySet')
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CryptographicException

The part of powershell script throwing this error is:

```<code>    $cert= New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
    $CertificatePath = Join-Path -Path $PSScriptRoot -ChildPath 'cdCert.pfx'
    $cert.Import($CertificatePath, $KeyStore_Password ,'DefaultKeySet')
</code>```

$KeyStore_Password contains correct password as I tested what is stored in this variable just before $cert.Import using echo.

Body:
We have a powershell script which is used to call an API by establishing connection over SSL. The certificates are placed along powershell script to be used by it. And the password is mentioned in an ini file which script reads. It was working fine earlier but suddenly it has started giving below error:

Exception calling "Import" with "3" argument(s): "The specified network password is not correct.
"
At C:\Users\Administrator\Desktop\NewInstallIssue\Download\win\installCDWindows.ps1:70 char:3
+         $cert.Import($CertificatePath, $KeyStore_Password ,'DefaultKeySet')
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CryptographicException

The part of powershell script throwing this error is:

    $cert= New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
    $CertificatePath = Join-Path -Path $PSScriptRoot -ChildPath 'cdCert.pfx'
    $cert.Import($CertificatePath, $KeyStore_Password ,'DefaultKeySet')

$KeyStore_Password contains correct password as I tested what is stored in this variable just before $cert.Import using echo.


问:
Using .alt on Macbook for Vue JS
I want effect .alt to remove , from a form input in Vue.js.

```<code><input type="text" v-model="tempSkill" @keyup.alt="addSkill" />
</code>```

@keyup.alt removes the , after an input on Windows but it isn't working for me on Macbook. [@keyup.alt should remove , after skillI want to remove the , after the skills](https://i.stack.imgur.com/Fi7Wt.png)

I added .alt after @keyup.
I also tried other key combinations with Alt but none worked.

When I use .alt, it doesn't work at all.[enter image description here](https://i.stack.imgur.com/xkMFH.png)

Title: Using .alt on Macbook for Vue JS

Body:
I want effect .alt to remove , from a form input in Vue.js.

<input type="text" v-model="tempSkill" @keyup.alt="addSkill" />

@keyup.alt removes the , after an input on Windows but it isn't working for me on Macbook. [@keyup.alt should remove , after skillI want to remove the , after the skills](https://i.stack.imgur.com/Fi7Wt.png)

I added .alt after @keyup.
I also tried other key combinations with Alt but none worked.

When I use .alt, it doesn't work at all.[enter image description here](https://i.stack.imgur.com/xkMFH.png)


问:
Flutter Module Embedded in native IOS displaying white screen when comes to Foreground from Background after long period of time
We are currently facing an issue with Flutter module embedding, specifically in iOS. We are embedding a flutter module into an existing native iOS application application using plugin frameworks in Xcode and Flutter framework with CocoaPods. We are using FlutterAppDelegate by creating a FlutterAppDelegate subclass of AppDelegate and initializing the FlutterEngine. Then we initialize a FlutterViewController using this engine and push it into the navigation controller. Everything is working fine with no issues observed.

The problem

When app stays in the background for a long period of time and then is brought back to the foreground, the flutter view is not visible and only a white screen is displayed. This white screen displays instantly and never restores. The only way to resolve it would be to manually kill the app by dismissing it from the App Switcher.
Good to mention; we tested this many times with test builds and only face the issue sparingly. Also, we haven’t been able to reproduce it in the simulator

What we are tried

We tried to refresh the Flutter view from inside the Flutter code by using a Flutter channel once app comes to the foreground, but this did not prove to be a solution.

We tried to remove the FlutterViewController, remove the Flutter engine and then reinitialize both, just like it is done in a regular app launch, but this did not work either.

We are reaching out to see if anyone can provide us with some lights on how to tackle this issue.
The iOS native app is developed in Objective-C and runs in iOS 13+ devices, we are using Xcode 14.2, Flutter 3.3.10 and Dart 2.18.6


问:
ERROR with open_mfdataset: Resulting object does not have monotonic global indexes along dimension time
I'm trying to merge some number of netCDF-3/CDM files, all of the same size.

File names:

date_2000-01-01.nc
date_2000-02-01.nc
date_2000-03-01.nc
date_2000-04-01.nc
date_2000-05-01.nc
```
<p>I'm using</p>
<pre class="lang-py prettyprint-override"><code>ds = xr.open_mfdataset( directory+ '*_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].nc')
</code>```

and it's working on other datasets, but not on this.

The resulting ERROR is:

File "C:\Python\Python310\lib\site-packages\xarray\core\combine.py", line 655, in _combine_single_variable_hypercube
    raise ValueError(

ValueError: Resulting object does not have monotonic global indexes along dimension time
```

Can anyone help? Thank you!

Body:
I'm trying to merge some number of netCDF-3/CDM files, all of the same size.

File names:

date_2000-01-01.nc
date_2000-02-01.nc
date_2000-03-01.nc
date_2000-04-01.nc
date_2000-05-01.nc

I'm using

ds = xr.open_mfdataset( directory+ '*_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].nc')

and it's working on other datasets, but not on this.

The resulting ERROR is:

File "C:\Python\Python310\lib\site-packages\xarray\core\combine.py", line 655, in _combine_single_variable_hypercube
    raise ValueError(

ValueError: Resulting object does not have monotonic global indexes along dimension time

Can anyone help? Thank you!


问:
AuthHttp Interceptor
Since 2 days I'm unable to get my AuthHttpInterceptor work.

This is my json config :

My Environment :

AppModule :

API Service :

Could you please tell me if I'm missing something ?

Many Thanks

I'm trying to inject the token & claims using the AuthHttpInterceptor (Auth0 SDK / Angular), which is not working unfortunately

Title: AuthHttp Interceptor


问:
Browser connects to mysql database but Qt application can't except localhost
From any ip address and browser mysql database can be connected and operated without any problems. But from my Qt application database can only be accessed when hostname is set to setHostName("localhost") not when ip of the device is entered.

```<code>QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("127.0.0.1");
db.setDatabaseName("customdb");
db.setUserName("mojito");
db.setPassword("J0a1m8");
bool ok = db.open();
</code>```

I get the error:

QSqlQuery::exec: database not open
```

When "127.0.0.1" is replaced with "localhost" connection is established. I checked and inserted relevant data to /etc/hosts but still issue occurs. So I can not type ip address and success with my Qt application code. Any suggestions ?

Body:
From any ip address and browser mysql database can be connected and operated without any problems. But from my Qt application database can only be accessed when hostname is set to setHostName("localhost") not when ip of the device is entered.

QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("127.0.0.1");
db.setDatabaseName("customdb");
db.setUserName("mojito");
db.setPassword("J0a1m8");
bool ok = db.open();

I get the error:

QSqlQuery::exec: database not open

When "127.0.0.1" is replaced with "localhost" connection is established. I checked and inserted relevant data to /etc/hosts but still issue occurs. So I can not type ip address and success with my Qt application code. Any suggestions ?


问:
How to hide certain levels of headings in the PDF ToC converted from Typora
I am using Typora to convert a Markdown file into a PDF.
In this file I used one H1 heading and several H5 and H6 headings.
What I want to achieve is that in the final PDF converted from this markdown file, I want all H5 and H6 headings hidden from the table of content panel on the left side of my PDF viewer.
I tried by adding the following code into the CSS stylesheet and putting a [toc] at the beginning of my markdown file right under the title:

.md-toc-h6 {
  display: none;
}
.md-toc-h5 {
  display: none;
}
```

This attempt failed, not only hiding h5 and h6 headings from my Table of Content, but also wiping them out from the PDF text. I want to hide them in the table of content but keep them in the text.

Can anyone let me know if this is doable and how?

What I want to achieve is that in the final PDF converted from this markdown file, I want all H5 and H6 headings hidden from the table of content panel on the left side of my PDF viewer but kept in the text.

Body:
I am using Typora to convert a Markdown file into a PDF.
In this file I used one H1 heading and several H5 and H6 headings.
What I want to achieve is that in the final PDF converted from this markdown file, I want all H5 and H6 headings hidden from the table of content panel on the left side of my PDF viewer.
I tried by adding the following code into the CSS stylesheet and putting a [toc] at the beginning of my markdown file right under the title:

.md-toc-h6 {
  display: none;
}
.md-toc-h5 {
  display: none;
}

This attempt failed, not only hiding h5 and h6 headings from my Table of Content, but also wiping them out from the PDF text. I want to hide them in the table of content but keep them in the text.

Can anyone let me know if this is doable and how?

What I want to achieve is that in the final PDF converted from this markdown file, I want all H5 and H6 headings hidden from the table of content panel on the left side of my PDF viewer but kept in the text.


问:
Firebase Screen name issue with modal views in iOS 13 and above
In our app we are tracking screen views manually by adding relevant codes in viewWillAppear functions. With iOS 13, with the non fullscreen modals, the viewWillAppear of the parent screen won't get called when the modal is dismissed and hence wrong screen names are reported there after, for events originating from the parent screen.

I have checked the Detecting sheet was dismissed on iOS 13 , but the solution to implement  UIAdaptivePresentationControllerDelegate helps when you manually swipes down.

I then turned off manual tracking and turned on Automatic tracking and surprisingly the screen classes are determined right. Question is how Firebase is figuring that out?

Of-course I can't use auto tracking as we need custom screen names.
I believe this could be a generic issue for whoever using manual screen name tracking and have non full screen modals. Just wanted to check what's the best way to solve this.
Couple of ideas I had was

Make all modals full screen. Not nice for our app

Implement extra delegates in those modals to let the parent know its dismissed. Not sure its a nice way

Setting screen names on each event? Could that be even possible?

If there are any other nicer/ cleaner option let me know.


问:
Python OpenCV waitKeyEx() stops picking up arrow keys after mouse click or tab
I'm writing a camera viewer for a lab setup.  Much of the display control is done using the keyboard, a couple of things need a mouse.  Anyway, even without a mouse event handler, I see the same issue.

To nudge the region of interest I use the arrow keys.  This works - until I click with the mouse anywhere in the image window (or press tab, but I hadn't noticed that until I started reading about these issues).  Other keys are still picked up fine.

The following code demonstrates it:

```<code>import cv2
import numpy as np
cv2.namedWindow("window", flags=cv2.WND_PROP_AUTOSIZE+cv2.WINDOW_GUI_NORMAL)
img=np.zeros((100,100,3), np.uint8)

while True:
    cv2.imshow("window", img)
    key = cv2.waitKeyEx(1) #waitKeyEx returns the ASCII value of the key if there is one, otherwise the key code; 27=Esc.
    # Key codes depend on the backend hence the "or" for arrow keys & F1.  Linux first, Win10 (via VirtualBox) 2nd
    # process keypresses.
    if (key==65361 or key==2424832):#left
        print ('left')
    elif (key==65364 or key==2621440):#down
        print ('down')
    elif (key==65362 or key==2490368):#up
        print ('up')
    elif (key==65363 or key==2555904):#right
        print ('right')
    elif (key == 27):#Esc
        break
    else:
        if key >0:print ("key with ASCII code  %d not understood"%key)
cv2.destroyAllWindows()
</code>```

It will display which key you pressed in the parent terminal window - and stop doing so after clicking - but only for the arrow keys.

This is the image window I get using the above dummy image (note that I'm using XFCE).

And this with the full viewer and a live image from the camera (as the dummy image makes for a very narrow window):

I have rather a lot of key bindings in my real code, but anyway the arrow keys are the most intuitive for the user.  Note that there are no error messages, it's a silent failure. Is there some way to restore arrow key functionality after mouse events?

Output of print(cv2.getBuildInformation()) follows. It appears to be using  QT5 not GTK+ (I expected the latter):

```<code>General configuration for OpenCV 4.6.0 =====================================
  Version control:               unknown

  Platform:
    Timestamp:                   2022-06-07T10:28:59Z
    Host:                        Linux 5.13.0-1025-azure x86_64
    CMake:                       3.22.5
    CMake generator:             Unix Makefiles
    CMake build tool:            /bin/gmake
    Configuration:               Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (16 files):         + SSSE3 SSE4_1
      SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (31 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (5 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                /usr/lib/ccache/compilers/c++  (ver 10.2.1)
    C++ flags (Release):         -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/lib/ccache/compilers/cc
    C flags (Release):           -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib  -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib  -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    ccache:                      YES
    Precompiled headers:         NO
    Extra dependencies:          /lib64/libopenblas.so Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /usr/local/lib/libpng.so /lib64/libz.so dl m pthread rt
    3rdparty dependencies:       libprotobuf ade ittnotify libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc ippiw ippicv

  OpenCV modules:
    To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java python2 ts
    Applications:                -
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:                           QT5
    QT:                          YES (ver 5.15.0 )
      QT OpenGL support:         NO
    GTK+:                        NO
    VTK support:                 NO

  Media I/O:
    ZLib:                        /lib64/libz.so (ver 1.2.7)
    JPEG:                        libjpeg-turbo (ver 2.1.2-62)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         /usr/local/lib/libpng.so (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.2.0)
    JPEG 2000:                   build (ver 2.4.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES
      avcodec:                   YES (58.134.100)
      avformat:                  YES (58.76.100)
      avutil:                    YES (56.70.100)
      swscale:                   YES (5.9.100)
      avresample:                NO
    GStreamer:                   NO
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/iw
    VA:                          NO
    Lapack:                      YES (/lib64/libopenblas.so)
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)

  OpenCL:                        YES (no extra features)
    Include path:                /io/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 /opt/python/cp36-cp36m/bin/python3.6 (ver 3.6.15)
    Libraries:                   libpython3.6m.a (ver 3.6.15)
    numpy:                       /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.13.3)
    install path:                python/cv2/python-3

  Python (for build):            /bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /io/_skbuild/linux-x86_64-3.6/cmake-install
-----------------------------------------------------------------
</code>```

This is using Python 3.8.10 on Ubuntu 20.04 (though it will end up on Windows eventually, hence the alternative keycodes).  OpenCV is 4.6.0.

Body:
I'm writing a camera viewer for a lab setup.  Much of the display control is done using the keyboard, a couple of things need a mouse.  Anyway, even without a mouse event handler, I see the same issue.

To nudge the region of interest I use the arrow keys.  This works - until I click with the mouse anywhere in the image window (or press tab, but I hadn't noticed that until I started reading about these issues).  Other keys are still picked up fine.

The following code demonstrates it:

import cv2
import numpy as np
cv2.namedWindow("window", flags=cv2.WND_PROP_AUTOSIZE+cv2.WINDOW_GUI_NORMAL)
img=np.zeros((100,100,3), np.uint8)

while True:
    cv2.imshow("window", img)
    key = cv2.waitKeyEx(1) #waitKeyEx returns the ASCII value of the key if there is one, otherwise the key code; 27=Esc.
    # Key codes depend on the backend hence the "or" for arrow keys & F1.  Linux first, Win10 (via VirtualBox) 2nd
    # process keypresses.
    if (key==65361 or key==2424832):#left
        print ('left')
    elif (key==65364 or key==2621440):#down
        print ('down')
    elif (key==65362 or key==2490368):#up
        print ('up')
    elif (key==65363 or key==2555904):#right
        print ('right')
    elif (key == 27):#Esc
        break
    else:
        if key >0:print ("key with ASCII code  %d not understood"%key)
cv2.destroyAllWindows()

It will display which key you pressed in the parent terminal window - and stop doing so after clicking - but only for the arrow keys.

This is the image window I get using the above dummy image (note that I'm using XFCE).

And this with the full viewer and a live image from the camera (as the dummy image makes for a very narrow window):

I have rather a lot of key bindings in my real code, but anyway the arrow keys are the most intuitive for the user.  Note that there are no error messages, it's a silent failure. Is there some way to restore arrow key functionality after mouse events?

Output of print(cv2.getBuildInformation()) follows. It appears to be using  QT5 not GTK+ (I expected the latter):

General configuration for OpenCV 4.6.0 =====================================
  Version control:               unknown

  Platform:
    Timestamp:                   2022-06-07T10:28:59Z
    Host:                        Linux 5.13.0-1025-azure x86_64
    CMake:                       3.22.5
    CMake generator:             Unix Makefiles
    CMake build tool:            /bin/gmake
    Configuration:               Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (16 files):         + SSSE3 SSE4_1
      SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (31 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (5 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                /usr/lib/ccache/compilers/c++  (ver 10.2.1)
    C++ flags (Release):         -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/lib/ccache/compilers/cc
    C flags (Release):           -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -Wl,-strip-all   -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib  -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib  -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
    ccache:                      YES
    Precompiled headers:         NO
    Extra dependencies:          /lib64/libopenblas.so Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /usr/local/lib/libpng.so /lib64/libz.so dl m pthread rt
    3rdparty dependencies:       libprotobuf ade ittnotify libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc ippiw ippicv

  OpenCV modules:
    To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java python2 ts
    Applications:                -
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:                           QT5
    QT:                          YES (ver 5.15.0 )
      QT OpenGL support:         NO
    GTK+:                        NO
    VTK support:                 NO

  Media I/O:
    ZLib:                        /lib64/libz.so (ver 1.2.7)
    JPEG:                        libjpeg-turbo (ver 2.1.2-62)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         /usr/local/lib/libpng.so (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.2.0)
    JPEG 2000:                   build (ver 2.4.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES
      avcodec:                   YES (58.134.100)
      avformat:                  YES (58.76.100)
      avutil:                    YES (56.70.100)
      swscale:                   YES (5.9.100)
      avresample:                NO
    GStreamer:                   NO
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/iw
    VA:                          NO
    Lapack:                      YES (/lib64/libopenblas.so)
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)

  OpenCL:                        YES (no extra features)
    Include path:                /io/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 /opt/python/cp36-cp36m/bin/python3.6 (ver 3.6.15)
    Libraries:                   libpython3.6m.a (ver 3.6.15)
    numpy:                       /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.13.3)
    install path:                python/cv2/python-3

  Python (for build):            /bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /io/_skbuild/linux-x86_64-3.6/cmake-install
-----------------------------------------------------------------

This is using Python 3.8.10 on Ubuntu 20.04 (though it will end up on Windows eventually, hence the alternative keycodes).  OpenCV is 4.6.0.


问:
Flutter - convert string to int without losing leading zero
I'd like to convert the clock time (e.g., '05:34') to integer without losing the leading zero (e.g., 0534).

Currently I can convert it to int but it results in (534). I use this code (from this answer):

```<code>int tmpInt = int.parse(tmpString.replaceAll(RegExp(r'[^0-9]'), ''));
</code>```

EDIT: I need to do this as these values will be sent as raw integers to another dump device to display the time.

Body:
I'd like to convert the clock time (e.g., '05:34') to integer without losing the leading zero (e.g., 0534).

Currently I can convert it to int but it results in (534). I use this code (from this answer):

int tmpInt = int.parse(tmpString.replaceAll(RegExp(r'[^0-9]'), ''));

EDIT: I need to do this as these values will be sent as raw integers to another dump device to display the time.


问:
Korg device not detected MIDI on W10
Does anyone have any idea why my Korg Minilogue XD is not detected (on USB) by the Windows 10 MIDI API?

I'm using Pete Brown's Powershell library at https://github.com/Psychlist1972/Windows-10-PowerShell-MIDI.

I've checked and installed the latest Korg driver from their website.

Running list-midi-example.ps1 all I get (as an output) is the Microsoft GS Wavetable Synth.

If I connect an M-Audio dumb controller keyboard this is detected fine. The Korg Librarian also works okay, so no basic comms issue to the Korg.

Any ideas anyone?

Thanks,
Peter

Title: Korg device not detected MIDI on W10


问:
get back history call android with blazor MUI
I start with blazor MUI, i need to create button on call history android to launch app with phone number parameter menu or in my blazor app get back history call to search phone number in my API list.

Is-it possible ?

thanks in advance


问:
Drawing a line on an image using mouse event with OpenCV and how to move the drawn line
Drawing a line on an image using mouse event with OpenCV and how to move the drawn line.
what will the solution be in python and OpenCV?
currently working on microscope image processing in the project.

I am trying to draw a line on an image using a mouse event with OpenCV and I want to move the line on the image.


问:
what is the endpoint querying whether the email is registered to Facebook?
search endpoint not working i guess it is deprecated. How else can I query using the Facebook Graph API? .

https://graph.facebook.com/v15.0/search?q={email}&type=user&fields=id&access_token={API_KEY}


问:
Cloned element in droppable - drop function returns duplicated values of same element. How to fix this?
(https://i.stack.imgur.com/7Ixq0.png)(https://i.stack.imgur.com/7Ixq0.png)

Please check and help.

I need the data of the cloned element only (without duplicating).


问:
VS Code .json file being greyed out
I have been reading about this and, as I understood it, files get greyed out when they are in the gitignore file. But in my example this is not the case, please see screenshots. What does it mean that my rooms.json file is greyed out? Thanks!

Title: VS Code .json file being greyed out


问:
I can't get help on a symbol in allegro common lisp unless i delete the previous help window
When I start Allegro Common Lisp an help windows opens, but when I try to obtain help for a symbol the window does not update. I have to delete the window and ask help on a symbol. This is quite tiring and boring. Does anybody know how to solve this problem ?. Thank you.</p>


问:
CDK Virtual scroll on nested list with two ngFor loops in Angular
I have a nested list with two ngFor loops in my Angular app, and I want to implement virtual scroll so that only the parent element has a scrollbar. How can I implement virtual scroll on this nested list and ensure that the scrollbar is applied only to the parent element?

```<code><mat-autocomplete>
    <ng-container *ngFor="let item of OuterArray">
      <mat-optgroup>
         <span class="d-flex-items-center">
            <mat-icon>group</mat-icon>
            <span>Team</span>
        </span>
       <ng-container *ngFor="let user of item.innerArray">
         <span>User</span>
       </ng-container>
      <mat-optgroup>
    </ng-container>
 </mat-autocomplete>
</code>```

And what are other ways to make this list more performant in case of large dataset.

Body:
I have a nested list with two ngFor loops in my Angular app, and I want to implement virtual scroll so that only the parent element has a scrollbar. How can I implement virtual scroll on this nested list and ensure that the scrollbar is applied only to the parent element?

<mat-autocomplete>
    <ng-container *ngFor="let item of OuterArray">
      <mat-optgroup>

            <mat-icon>group</mat-icon>
            Team

       <ng-container *ngFor="let user of item.innerArray">
         User
       </ng-container>
      <mat-optgroup>
    </ng-container>
 </mat-autocomplete>

And what are other ways to make this list more performant in case of large dataset.


Title: Spatial interpolation using kriging in R

Body:
I have two datasets. The first one shows information about multiple weather phenomena in Brazil measured by weather stations in the country. I also have information regarding the latitude and longitude of these stations, and the weather data is provided by year.

id_estacao  ano precipitacao_total pressao_atm_max pressao_atm_min
1       A001 2016         0.12988728        888.0399        887.5521
2       A002 2016         0.14282787        932.8559        932.3215
3       A003 2016         0.12486339        930.6114        930.0861
4       A009 2016         0.07696277        979.3086        978.7480
5       A010 2016         0.11548640        980.2251        979.6578
6       A011 2016         0.13886103        958.5196        957.9678
  radiacao_global temperatura_max temperatura_min umidade_rel_max
1        1508.024        22.77794        21.34106        65.52186
2        1419.644        24.90139        23.40798        66.28074
3        1460.937        24.00484        22.46128        68.25395
4        1440.643        29.22710        27.79419        61.87001
5        1540.398        27.52555        25.87737        63.64414
6        1471.004        24.95090        23.36305        66.69974
  umidade_rel_min vento_velocidade id_municipio   estacao  latitude
1        59.04111        2.3430377      5300108  Brasilia -15.78944
2        59.56990        1.2416667      5208707   Goiania -16.64284
3        59.71499        1.6017190      5213806 Morrinhos -17.74507
4        55.21366        1.5202973      1721000    Palmas -10.19074
5        57.01889        0.9295148      1716208    Parana -12.61500
6        60.26358        1.7454093      5220405 Sao Simao -18.96914
  longitude
1 -47.92583
2 -49.22022
3 -49.10170
4 -48.30181
5 -47.87194
6 -50.63345

Moreover, I have information about the location of the Brazilian municipalities (cities).

  id_municipio latitude longitude
1      1100015   -11.92    -61.99
2      1100023    -9.91    -63.04
3      1100031   -13.49    -60.54
4      1100049   -11.43    -61.44
5      1100056   -13.18    -60.81
6      1100064   -13.11    -60.54

I want to use interpolation to predict the weather phenomena in these cities using the information provided in the first dataset. I have been working with the package "fields", which uses this function:

# Kriging of the rainfall data by station
      fit = Krig(x,precip[,d])

      # Predict the value on the unit
      pred<-predict(fit,Y)

It basically makes a loop with d-days (in this case, years). precip[,d] is the precipitation variable (in this case, all the weather variables) on day d, and x is the latitude and longitude of the station. This should provide a fit which is the output of krig and Y (the latitude and longitude of the municipalities).

However, I have been struggling to make this function fit my data. I would like to know if someone could help me.


问:
how to add dynamic dropdown for same column in different rows of an AgGridReact?
here the image for reference

as the 'cost center' dropdown is working in same way I want to add another dropdown for 'beneficiary bank account' but the dropdown option will be different for each row.

I tried to do with static option list it's working but for dynamic and different list for every row, I am stuck with it. how should I proceed ?


问:
NodeJS / Axios: How to write a PDF to disk obtained in an HTTP multipart/form-data response?
I'm writing a REST API client that calls an API endpoint to obtain a PDF.

I'm using axios to consume the API:

```<code>const res = await axios({
    method: 'GET',
    url: url,
    headers: {
        'authorization': 'Bearer ' + at,
    },
    proxy: false,
    httpsAgent: httpsAgent
});
console.log(res.data);
</code>```

The response is of type multipart/form-data, in the following way:

content-type: multipart/form-data; boundary=95b77841-292d-4a0b-a689-787fcc0aa889

body:

```<code>--95b77841-292d-4a0b-a689-787fcc0aa889
Content-Disposition: form-data; name="metadata"
Content-Type: application/json

{"documentId":"123"}
--95b77841-292d-4a0b-a689-787fcc0aa889
Content-Disposition: form-data; name="document"; filename="document.pdf"
Content-Type: application/pdf

%PDF-1.4
....
%%EOF

--95b77841-292d-4a0b-a689-787fcc0aa889--
</code>```

How can I save the 2nd part as a valid PDF file to disk?

Body:
I'm writing a REST API client that calls an API endpoint to obtain a PDF.

I'm using axios to consume the API:

const res = await axios({
    method: 'GET',
    url: url,
    headers: {
        'authorization': 'Bearer ' + at,
    },
    proxy: false,
    httpsAgent: httpsAgent
});
console.log(res.data);

The response is of type multipart/form-data, in the following way:

content-type: multipart/form-data; boundary=95b77841-292d-4a0b-a689-787fcc0aa889

body:

--95b77841-292d-4a0b-a689-787fcc0aa889
Content-Disposition: form-data; name="metadata"
Content-Type: application/json

{"documentId":"123"}
--95b77841-292d-4a0b-a689-787fcc0aa889
Content-Disposition: form-data; name="document"; filename="document.pdf"
Content-Type: application/pdf

%PDF-1.4
....
%%EOF

--95b77841-292d-4a0b-a689-787fcc0aa889--

How can I save the 2nd part as a valid PDF file to disk?