问:
How to use ssh-agent with Net:OpenSSH Perl
I got three servers, MyServer (centos7), Jumper and DestinationServer. I need to establish SSH connection from MyServer through Jumper to DestinationServer using Perl script with Net:OpenSSH lib.

on the MyServer i have a private rsa key.
on the Jumper and DestinationServer i have a public rsa key to authorize ssh connection.

on the Jumper i can only use the remote command which is an user@servername to connect to the third server.

with Bash it works really fine, i just enable ssh-agent and add rsa key:

```<code>ssh-agent -s
ssh-add ~/.ssh/id_rsa
ssh -A user@Jumper user@DestinationServer ls -l
</code>```

which results in remote display of the command

But code in Perl:

```<code>#!/user/bin/perl
use Net::OpenSSH

my $ssh = Net::OpenSSH->new($JumperIP, user =>$user, forward_agent => 1);
$ssh-> capture('user@DestinationServer ls -l');
</code>```

returns same error as Bash code with no agent forwarding (-A):

```<code>Permission denied, please try again.
Received disconnect from DestinationServerIP port 22:2 Too many authentication failures for user
Disconnected from DestinationServerIP port 22
</code>```

in the documentation (https://metacpan.org/pod/Net::OpenSSH ) it says only

"forward_agent => 1
Note that Net::OpenSSH will not run ssh-agent for you. This has to be done ahead of time and the environment variable SSH_AUTH_SOCK set pointing to the proper place."

so i got no idea how to attach enabled ssh-agent.

EDIT:
With:

```<code>BEGIN {
  $Net::OpenSSH::debug_fh = $out;
  $Net::OpenSSH::debug = ~0;
}
</code>```

i get that output:

```<code>  # open_ex: ['ssh','-V']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 48 at offset 0
#> 4f 70 65 6e 53 53 48 5f 37 2e 34 70 31 2c 20 4f 70 65 6e 53 53 4c 20 31 2e 30 2e 32 6b 2d 66 69 | OpenSSH_7.4p1, OpenSSL 1.0.2k-fi
#> 70 73 20 20 32 36 20 4a 61 6e 20 32 30 31 37 0a                                                 | ps  26 Jan 2017.
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 48
# leaving _io3()
# _waitpid(14949) => pid: 14949, rc:
# OpenSSH verion is 7.4p1,
# ctl_path: /home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827, ctl_dir: /home/$USER/.libnet-openssh-perl/
# _is_secure_path(dir: /home/$USER/.libnet-openssh-perl, file mode: 16832, file uid: 1084, euid: 1084
# _is_secure_path(dir: /home/$USER, file mode: 16872, file uid: 1084, euid: 1084
# set_error(0 - 0)
# call args: ['ssh','-o','ServerAliveInterval=30','-o','ControlPersist=no','-2MNAx','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# file object not yet found at /home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827, state: waiting_for_mux_socket
# tracer attached, ssh pid: 14950, tracer pid: 14951
# file object found at /home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827
# call args: ['ssh','-O','check','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# open_ex: ['ssh','-O','check','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 28 at offset 0
#> 4d 61 73 74 65 72 20 72 75 6e 6e 69 6e 67 20 28 70 69 64 3d 31 34 39 35 30 29 0d 0a             | Master running (pid=14950)..
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 28
# leaving _io3()
# _waitpid(15022) => pid: 15022, rc:
# call args: ['ssh','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--','$USER@DestinationServer ls -l']
# open_ex: ['ssh','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--','$USER@DestinationServer ls -l']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0

Permission denied, please try again.
Permission denied, please try again.
Received disconnect from $DestinationIP port 22:2: Too many authentication failures for $USER
Disconnected from $DestinationIP port 22

# stdout, bytes read: 0 at offset 0
# leaving _io3()
# _waitpid(15023) => pid: 15023, rc:
# DESTROY(Net::OpenSSH=HASH(0x2832240), pid: 14950)
# killing master
# sending exit control to master
# call args: ['ssh','-O','exit','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# open_ex: ['ssh','-O','exit','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 20 at offset 0
#> 45 78 69 74 20 72 65 71 75 65 73 74 20 73 65 6e 74 2e 0d 0a                                     | Exit request sent...
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 20
# leaving _io3()
# _waitpid(15025) => pid: 15025, rc:
# _kill_master: 14950
# waitpid(master: 14950) => pid: 14950, rc:
</code>```

I'm not sure, but i do not see -A flag of agent forwarding in that debug or maybe I'm thinking wrong, but I use:

```<code>SSH_AUTH_SOCK=/tmp/ssh-numbers/agent.28101; export SSH_AUTH_SOCK;
SSH_AGENT_PID=28102; export SSH_AGENT_PID;
echo Agent pid 28102;
</code>```

to set ENV by Bash shell before starting Perl script.

Body:
I got three servers, MyServer (centos7), Jumper and DestinationServer. I need to establish SSH connection from MyServer through Jumper to DestinationServer using Perl script with Net:OpenSSH lib.

on the MyServer i have a private rsa key.
on the Jumper and DestinationServer i have a public rsa key to authorize ssh connection.

on the Jumper i can only use the remote command which is an user@servername to connect to the third server.

with Bash it works really fine, i just enable ssh-agent and add rsa key:

ssh-agent -s
ssh-add ~/.ssh/id_rsa
ssh -A user@Jumper user@DestinationServer ls -l

which results in remote display of the command

But code in Perl:

#!/user/bin/perl
use Net::OpenSSH

my $ssh = Net::OpenSSH->new($JumperIP, user =>$user, forward_agent => 1);
$ssh-> capture('user@DestinationServer ls -l');

returns same error as Bash code with no agent forwarding (-A):

Permission denied, please try again.
Received disconnect from DestinationServerIP port 22:2 Too many authentication failures for user
Disconnected from DestinationServerIP port 22

in the documentation (https://metacpan.org/pod/Net::OpenSSH ) it says only

"forward_agent => 1
Note that Net::OpenSSH will not run ssh-agent for you. This has to be done ahead of time and the environment variable SSH_AUTH_SOCK set pointing to the proper place."

so i got no idea how to attach enabled ssh-agent.

EDIT:
With:

BEGIN {
  $Net::OpenSSH::debug_fh = $out;
  $Net::OpenSSH::debug = ~0;
}

i get that output:

  # open_ex: ['ssh','-V']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 48 at offset 0
#> 4f 70 65 6e 53 53 48 5f 37 2e 34 70 31 2c 20 4f 70 65 6e 53 53 4c 20 31 2e 30 2e 32 6b 2d 66 69 | OpenSSH_7.4p1, OpenSSL 1.0.2k-fi
#> 70 73 20 20 32 36 20 4a 61 6e 20 32 30 31 37 0a                                                 | ps  26 Jan 2017.
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 48
# leaving _io3()
# _waitpid(14949) => pid: 14949, rc:
# OpenSSH verion is 7.4p1,
# ctl_path: /home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827, ctl_dir: /home/$USER/.libnet-openssh-perl/
# _is_secure_path(dir: /home/$USER/.libnet-openssh-perl, file mode: 16832, file uid: 1084, euid: 1084
# _is_secure_path(dir: /home/$USER, file mode: 16872, file uid: 1084, euid: 1084
# set_error(0 - 0)
# call args: ['ssh','-o','ServerAliveInterval=30','-o','ControlPersist=no','-2MNAx','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# file object not yet found at /home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827, state: waiting_for_mux_socket
# tracer attached, ssh pid: 14950, tracer pid: 14951
# file object found at /home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827
# call args: ['ssh','-O','check','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# open_ex: ['ssh','-O','check','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 28 at offset 0
#> 4d 61 73 74 65 72 20 72 75 6e 6e 69 6e 67 20 28 70 69 64 3d 31 34 39 35 30 29 0d 0a             | Master running (pid=14950)..
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 28
# leaving _io3()
# _waitpid(15022) => pid: 15022, rc:
# call args: ['ssh','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--','$USER@DestinationServer ls -l']
# open_ex: ['ssh','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--','$USER@DestinationServer ls -l']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0

Permission denied, please try again.
Permission denied, please try again.
Received disconnect from $DestinationIP port 22:2: Too many authentication failures for $USER
Disconnected from $DestinationIP port 22

# stdout, bytes read: 0 at offset 0
# leaving _io3()
# _waitpid(15023) => pid: 15023, rc:
# DESTROY(Net::OpenSSH=HASH(0x2832240), pid: 14950)
# killing master
# sending exit control to master
# call args: ['ssh','-O','exit','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# open_ex: ['ssh','-O','exit','-T','-S','/home/$USER/.libnet-openssh-perl/$USER-$IP.-14948-620827','-l','$USER','$IP','--']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 20 at offset 0
#> 45 78 69 74 20 72 65 71 75 65 73 74 20 73 65 6e 74 2e 0d 0a                                     | Exit request sent...
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 20
# leaving _io3()
# _waitpid(15025) => pid: 15025, rc:
# _kill_master: 14950
# waitpid(master: 14950) => pid: 14950, rc:

I'm not sure, but i do not see -A flag of agent forwarding in that debug or maybe I'm thinking wrong, but I use:

SSH_AUTH_SOCK=/tmp/ssh-numbers/agent.28101; export SSH_AUTH_SOCK;
SSH_AGENT_PID=28102; export SSH_AGENT_PID;
echo Agent pid 28102;

to set ENV by Bash shell before starting Perl script.


来源: stackexchange

问:
rollup package splitting / code splitting
I am working on a components library (such as material-ui). I am using rollup for compiling.
For the moment I can generate a single package, and to import a component such as a button, I can do it like that :

```<code>import { Button } from "package-name";
</code>```

Can I modify the rollup configuration to generate a separate package or chunk for each component.
In other word, can I split the big-size package in separate small-size packages (one for each component)
and use them in a way similar to this:

```<code>import { Button } from "package-name/Button";
</code>```

I start looking to the Code Splitting...
But I am wandring if there is a known best practice to have this result?

Is there a specific way to write the rollup.config file ?

ContentLicense: CC BY-SA 4.0

Body:
I am working on a components library (such as material-ui). I am using rollup for compiling.
For the moment I can generate a single package, and to import a component such as a button, I can do it like that :

import { Button } from "package-name";

Can I modify the rollup configuration to generate a separate package or chunk for each component.
In other word, can I split the big-size package in separate small-size packages (one for each component)
and use them in a way similar to this:

import { Button } from "package-name/Button";

I start looking to the Code Splitting...
But I am wandring if there is a known best practice to have this result?

Is there a specific way to write the rollup.config file ?


问:
Run two session of excel with two different PID
I would like to open 2 excel sessions to run macros in parallel.

On some occasion, while executing a macro, I have opened excel normally and it has opened it in a different session and I have been able to execute another macro in parallel. My intention is to force this situation.

Thanks!

Best regards!


问:
Agora Video call disconnecting after few seconds
When I try to connect Video call, It's connecting but after few seconds activity get destroyed.

I am trying to connect my video call but after sometime it get disconnected automatically
and in my Logcat I get error

```<code>2023-01-09 18:47:23.763 11645-12011/E/agora.io: [LVT]: Faile to remove video filter when track is enabled.
2023-01-09 18:47:23.771 11645-12011/E/agora.io: [LATMP]: invalid local_playback_source_.
2023-01-09 18:47:23.771 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.773 11645-12011/ E/agora.io: [LATMP]: invalid local_playback_source_.
2023-01-09 18:47:23.773 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.775 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.775 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.775 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.783 11645-12011/ E/agora.io: [LATP]: local playback has been disabled.
2023-01-09 18:47:23.784 11645-12011/ E/agora.io: [LATP]: local playback has been disabled.
2023-01-09 18:47:23.786 11645-12011/ E/agora.io: [LATP]: local playback has been disabled.
2023-01-09 18:47:23.794 11645-12011/ E/agora.io: [AFC]: failed to find the to be removed audio filter remote_mixed_playback.
2023-01-09 18:47:23.802 11645-12026/ E/agora.io: [CommonUtility] [closeGravityMonitor] mOrientationListener is null!
</code>```

Body:
When I try to connect Video call, It's connecting but after few seconds activity get destroyed.

I am trying to connect my video call but after sometime it get disconnected automatically
and in my Logcat I get error

2023-01-09 18:47:23.763 11645-12011/E/agora.io: [LVT]: Faile to remove video filter when track is enabled.
2023-01-09 18:47:23.771 11645-12011/E/agora.io: [LATMP]: invalid local_playback_source_.
2023-01-09 18:47:23.771 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.773 11645-12011/ E/agora.io: [LATMP]: invalid local_playback_source_.
2023-01-09 18:47:23.773 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.775 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.775 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.775 11645-12011/ E/agora.io: [LATMP]: local playback has been disabled.
2023-01-09 18:47:23.783 11645-12011/ E/agora.io: [LATP]: local playback has been disabled.
2023-01-09 18:47:23.784 11645-12011/ E/agora.io: [LATP]: local playback has been disabled.
2023-01-09 18:47:23.786 11645-12011/ E/agora.io: [LATP]: local playback has been disabled.
2023-01-09 18:47:23.794 11645-12011/ E/agora.io: [AFC]: failed to find the to be removed audio filter remote_mixed_playback.
2023-01-09 18:47:23.802 11645-12026/ E/agora.io: [CommonUtility] [closeGravityMonitor] mOrientationListener is null!


问:
How to correctly integrate R and python in a single jupyter notebook?
I'm currently modelling a dataset and I wanted to use both R and Python in its task. I tried to install rpy2 by pip, but after its instalation when I try to load the extention in a python 3 notebook in Jupyter I have the following error:

```<code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 184: invalid continuation byte
</code>```

I think it mighty be an error doing the instalation although the prompt indicated the success in instalation. Could someone please help me?

Body:
I'm currently modelling a dataset and I wanted to use both R and Python in its task. I tried to install rpy2 by pip, but after its instalation when I try to load the extention in a python 3 notebook in Jupyter I have the following error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 184: invalid continuation byte

I think it mighty be an error doing the instalation although the prompt indicated the success in instalation. Could someone please help me?


问:
Mongodb: 'mongod' command not starting the local server
I have recently downloaded the mongodb ,, and try trying to run the mongod command and it just not running the local server , it throwing error repeatedly,
output screen when I am running the 'mongod' command

I have almost tried all the possible way to solve it , but not getting resolved.
please help if anyone know the solution.


问:
Need to Set Different Path for Asset and CSS, JS, and Fonts in Angular13
We host the Angular 13 Project and the asset is located in the same server but We need to put CSS, JS, and Fonts on another server. In Previously version we use --deploy-url to set the remote path. but In Angular13, Is there any solution in Angular13?

I have checked with --base-href but it will replace the path with all files.


问:
Update Plot Values - stored in a list - Whenever Mouse Event happened
This is my first object-oriented project, thus some parts could be wrote in a better way (advices would be appreciate..  )

I manage do build a code that allows points to be drag verticaly with a mouse event.

Initial values
After dragging points

I am able to retrieve the new coordinates, but only within the DraggablePoint Class.

Now I want the new coordinates from the drag point to be update in a list, in real time.
I mean, whenever the plot change with a mouse event, the list value should be update.

The main issue is that I don't know how to access and retrieve coordinates values outside of the event class

Once again, I am quite new in this object-oriented world
Could someone give me advices ?

Thanks a lot !

The DraggablePoint class is the Following :

```<code># drag.py
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.lines import Line2D
import PySide2.QtCore as QtCore

class DraggablePoint:

    lock = None #  only one can be animated at a time

    def __init__(self, parent, x=0.1, y=0.1, size=0.1):

        global dragx, dragy

        self.parent = parent
        self.point = patches.Ellipse((x, y), size, size , fc='r', alpha=0.5, edgecolor='r')
        self.x = x
        self.y = y
        parent.fig.axes[0].add_patch(self.point)
        self.press = None
        self.background = None
        self.connect()

        # if another point already exist we draw a line
        if self.parent.list_points:
            line_x = [self.parent.list_points[-1].x, self.x]
            line_y = [self.parent.list_points[-1].y, self.y]

            self.line = Line2D(line_x, line_y, color='r', alpha=0.5)
            parent.fig.axes[0].add_line(self.line)

        self.coordinates = []

    def connect(self):

        'connect to all the events we need'

        self.cidpress = self.point.figure.canvas.mpl_connect('button_press_event', self.on_press)
        self.cidrelease = self.point.figure.canvas.mpl_connect('button_release_event', self.on_release)
        self.cidmotion = self.point.figure.canvas.mpl_connect('motion_notify_event', self.on_motion)

    def on_press(self, event):

        if event.inaxes != self.point.axes: return
        if DraggablePoint.lock is not None: return
        contains, attrd = self.point.contains(event)
        if not contains: return
        self.press = (self.point.center), event.xdata, event.ydata
        DraggablePoint.lock = self

        # draw everything but the selected rectangle and store the pixel buffer
        canvas = self.point.figure.canvas
        axes = self.point.axes
        self.point.set_animated(True)

        # TODO also the line of some other points needs to be released
        point_number =  self.parent.list_points.index(self)

        if self == self.parent.list_points[0]:
            self.parent.list_points[1].line.set_animated(True)
        elif self == self.parent.list_points[-1]:
            self.line.set_animated(True)
        else:
            self.line.set_animated(True)
            self.parent.list_points[point_number+1].line.set_animated(True)

        canvas.draw()
        self.background = canvas.copy_from_bbox(self.point.axes.bbox)

        # now redraw just the rectangle
        axes.draw_artist(self.point)

        # and blit just the redrawn area
        canvas.blit(axes.bbox)

    def on_motion(self, event):

        if DraggablePoint.lock is not self:
            return
        if event.inaxes != self.point.axes: return
        self.point.center, xpress, ypress = self.press

        dy = event.ydata - ypress
        self.point.center = (self.point.center[0], self.point.center[1]+dy)

        canvas = self.point.figure.canvas
        axes = self.point.axes
        # restore the background region
        canvas.restore_region(self.background)

        # redraw just the current rectangle
        axes.draw_artist(self.point)

        point_number =  self.parent.list_points.index(self)
        self.x = self.point.center[0]
        self.y = self.point.center[1]

        # We check if the point is A or B
        if self == self.parent.list_points[0]:
            # or we draw the other line of the point
            self.parent.list_points[1].line.set_animated(True)
            axes.draw_artist(self.parent.list_points[1].line)

        elif self == self.parent.list_points[-1]:
            # we draw the line of the point
            axes.draw_artist(self.line)

        else:
            # we draw the line of the point
            axes.draw_artist(self.line)
            #self.parent.list_points[point_number+1].line.set_animated(True)
            axes.draw_artist(self.parent.list_points[point_number+1].line)

        if self == self.parent.list_points[0]:
            # The first point is especial because it has no line
            line_x = [self.x, self.parent.list_points[1].x]
            line_y = [self.y, self.parent.list_points[1].y]
            # this is were the line is updated
            self.parent.list_points[1].line.set_data(line_x, line_y)

        elif self == self.parent.list_points[-1]:
            line_x = [self.parent.list_points[-2].x, self.x]
            line_y = [self.parent.list_points[-2].y, self.y]
            self.line.set_data(line_x, line_y)
        else:
            # The first point is especial because it has no line
            line_x = [self.x, self.parent.list_points[point_number+1].x]
            line_y = [self.y, self.parent.list_points[point_number+1].y]
            # this is were the line is updated
            self.parent.list_points[point_number+1].line.set_data(line_x, line_y)

            line_x = [self.parent.list_points[point_number-1].x, self.x]
            line_y = [self.parent.list_points[point_number-1].y, self.y]
            self.line.set_data(line_x, line_y)

        # blit just the redrawn area
        canvas.blit(axes.bbox)

    def on_release(self, event):

        'on release we reset the press data'
        if DraggablePoint.lock is not self:
            return

        self.press = None
        DraggablePoint.lock = None

        # turn off the rect animation property and reset the background
        self.point.set_animated(False)

        point_number =  self.parent.list_points.index(self)

        if self == self.parent.list_points[0]:
            self.parent.list_points[1].line.set_animated(False)
        elif self == self.parent.list_points[-1]:
            self.line.set_animated(False)
        else:
            self.line.set_animated(False)
            self.parent.list_points[point_number+1].line.set_animated(False)

        self.background = None

        # redraw the full figure
        self.point.figure.canvas.draw()

        self.x = self.point.center[0]
        self.y = self.point.center[1]

        self.coordinates.append([self.x, self.y])

        #print("Access from Class", self.x)
        #print("Access from Class", self.y)
        print("Access from Class", self.coordinates)

    def disconnect(self):

        'disconnect all the stored connection ids'

        self.point.figure.canvas.mpl_disconnect(self.cidpress)
        self.point.figure.canvas.mpl_disconnect(self.cidrelease)
        self.point.figure.canvas.mpl_disconnect(self.cidmotion)
</code>```

The main piece of code :

```<code>import sys
import matplotlib
matplotlib.use("Qt5Agg")
from PyQt5 import QtWidgets, QtGui

from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

import PySide2.QtCore as QtCore

# Personnal modules
from drag import DraggablePoint

class MyGraph(FigureCanvas):

    """A canvas that updates itself every second with a new plot."""

    def __init__(self, parent=None, width=5, height=4, dpi=100):

        PK = [0, 10, 20, 30, 40, 50]
        FE = [251, 252, 248, 250, 251, 253]

        self.fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = self.fig.add_subplot()

        self.axes.grid(True)

        self.axes.set_xlim([0,50])
        self.axes.set_ylim([240,260])

        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)

        FigureCanvas.setSizePolicy(self,
                                   QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # To store the 2 draggable points
        self.list_points = []

        self.show()
        self.plotDraggablePoints(PK, FE)

    def plotDraggablePoints(self, listX, listY, size=1):

        """Plot and define the 2 draggable points of the baseline"""

        n = len(listX)

        for i in range(0,n):
            DragPoint = DraggablePoint(self, listX[i], listY[i], size)
            self.list_points.append(DragPoint)

            #print(" Access from script ", DragPoint.x)
            #print(" Access from script ", DragPoint.y)

        self.updateFigure()

        print(listY)

    def clearFigure(self):

        """Clear the graph"""

        self.axes.clear()
        self.axes.grid(True)
        del(self.list_points[:])
        self.updateFigure()

    def updateFigure(self):

        """Update the graph. Necessary, to call after each plot"""

        self.draw()

if __name__ == '__main__':

    app = QtWidgets.QApplication(sys.argv)
    ex = MyGraph()
    sys.exit(app.exec_())
</code>```

I tried to store the new coordinates in an attributes of the instance DraggablePoint, but didn't manage to get what I want..

Body:
This is my first object-oriented project, thus some parts could be wrote in a better way (advices would be appreciate..  )

I manage do build a code that allows points to be drag verticaly with a mouse event.

Initial values
After dragging points

I am able to retrieve the new coordinates, but only within the DraggablePoint Class.

Now I want the new coordinates from the drag point to be update in a list, in real time.
I mean, whenever the plot change with a mouse event, the list value should be update.

The main issue is that I don't know how to access and retrieve coordinates values outside of the event class

Once again, I am quite new in this object-oriented world
Could someone give me advices ?

Thanks a lot !

The DraggablePoint class is the Following :

# drag.py
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.lines import Line2D
import PySide2.QtCore as QtCore

class DraggablePoint:

    lock = None #  only one can be animated at a time

    def __init__(self, parent, x=0.1, y=0.1, size=0.1):

        global dragx, dragy

        self.parent = parent
        self.point = patches.Ellipse((x, y), size, size , fc='r', alpha=0.5, edgecolor='r')
        self.x = x
        self.y = y
        parent.fig.axes[0].add_patch(self.point)
        self.press = None
        self.background = None
        self.connect()

        # if another point already exist we draw a line
        if self.parent.list_points:
            line_x = [self.parent.list_points[-1].x, self.x]
            line_y = [self.parent.list_points[-1].y, self.y]

            self.line = Line2D(line_x, line_y, color='r', alpha=0.5)
            parent.fig.axes[0].add_line(self.line)

        self.coordinates = []

    def connect(self):

        'connect to all the events we need'

        self.cidpress = self.point.figure.canvas.mpl_connect('button_press_event', self.on_press)
        self.cidrelease = self.point.figure.canvas.mpl_connect('button_release_event', self.on_release)
        self.cidmotion = self.point.figure.canvas.mpl_connect('motion_notify_event', self.on_motion)

    def on_press(self, event):

        if event.inaxes != self.point.axes: return
        if DraggablePoint.lock is not None: return
        contains, attrd = self.point.contains(event)
        if not contains: return
        self.press = (self.point.center), event.xdata, event.ydata
        DraggablePoint.lock = self

        # draw everything but the selected rectangle and store the pixel buffer
        canvas = self.point.figure.canvas
        axes = self.point.axes
        self.point.set_animated(True)

        # TODO also the line of some other points needs to be released
        point_number =  self.parent.list_points.index(self)

        if self == self.parent.list_points[0]:
            self.parent.list_points[1].line.set_animated(True)
        elif self == self.parent.list_points[-1]:
            self.line.set_animated(True)
        else:
            self.line.set_animated(True)
            self.parent.list_points[point_number+1].line.set_animated(True)

        canvas.draw()
        self.background = canvas.copy_from_bbox(self.point.axes.bbox)

        # now redraw just the rectangle
        axes.draw_artist(self.point)

        # and blit just the redrawn area
        canvas.blit(axes.bbox)

    def on_motion(self, event):

        if DraggablePoint.lock is not self:
            return
        if event.inaxes != self.point.axes: return
        self.point.center, xpress, ypress = self.press

        dy = event.ydata - ypress
        self.point.center = (self.point.center[0], self.point.center[1]+dy)

        canvas = self.point.figure.canvas
        axes = self.point.axes
        # restore the background region
        canvas.restore_region(self.background)

        # redraw just the current rectangle
        axes.draw_artist(self.point)

        point_number =  self.parent.list_points.index(self)
        self.x = self.point.center[0]
        self.y = self.point.center[1]

        # We check if the point is A or B
        if self == self.parent.list_points[0]:
            # or we draw the other line of the point
            self.parent.list_points[1].line.set_animated(True)
            axes.draw_artist(self.parent.list_points[1].line)

        elif self == self.parent.list_points[-1]:
            # we draw the line of the point
            axes.draw_artist(self.line)

        else:
            # we draw the line of the point
            axes.draw_artist(self.line)
            #self.parent.list_points[point_number+1].line.set_animated(True)
            axes.draw_artist(self.parent.list_points[point_number+1].line)

        if self == self.parent.list_points[0]:
            # The first point is especial because it has no line
            line_x = [self.x, self.parent.list_points[1].x]
            line_y = [self.y, self.parent.list_points[1].y]
            # this is were the line is updated
            self.parent.list_points[1].line.set_data(line_x, line_y)

        elif self == self.parent.list_points[-1]:
            line_x = [self.parent.list_points[-2].x, self.x]
            line_y = [self.parent.list_points[-2].y, self.y]
            self.line.set_data(line_x, line_y)
        else:
            # The first point is especial because it has no line
            line_x = [self.x, self.parent.list_points[point_number+1].x]
            line_y = [self.y, self.parent.list_points[point_number+1].y]
            # this is were the line is updated
            self.parent.list_points[point_number+1].line.set_data(line_x, line_y)

            line_x = [self.parent.list_points[point_number-1].x, self.x]
            line_y = [self.parent.list_points[point_number-1].y, self.y]
            self.line.set_data(line_x, line_y)

        # blit just the redrawn area
        canvas.blit(axes.bbox)

    def on_release(self, event):

        'on release we reset the press data'
        if DraggablePoint.lock is not self:
            return

        self.press = None
        DraggablePoint.lock = None

        # turn off the rect animation property and reset the background
        self.point.set_animated(False)

        point_number =  self.parent.list_points.index(self)

        if self == self.parent.list_points[0]:
            self.parent.list_points[1].line.set_animated(False)
        elif self == self.parent.list_points[-1]:
            self.line.set_animated(False)
        else:
            self.line.set_animated(False)
            self.parent.list_points[point_number+1].line.set_animated(False)

        self.background = None

        # redraw the full figure
        self.point.figure.canvas.draw()

        self.x = self.point.center[0]
        self.y = self.point.center[1]

        self.coordinates.append([self.x, self.y])

        #print("Access from Class", self.x)
        #print("Access from Class", self.y)
        print("Access from Class", self.coordinates)

    def disconnect(self):

        'disconnect all the stored connection ids'

        self.point.figure.canvas.mpl_disconnect(self.cidpress)
        self.point.figure.canvas.mpl_disconnect(self.cidrelease)
        self.point.figure.canvas.mpl_disconnect(self.cidmotion)

The main piece of code :

import sys
import matplotlib
matplotlib.use("Qt5Agg")
from PyQt5 import QtWidgets, QtGui

from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

import PySide2.QtCore as QtCore

# Personnal modules
from drag import DraggablePoint

class MyGraph(FigureCanvas):

    """A canvas that updates itself every second with a new plot."""

    def __init__(self, parent=None, width=5, height=4, dpi=100):

        PK = [0, 10, 20, 30, 40, 50]
        FE = [251, 252, 248, 250, 251, 253]

        self.fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = self.fig.add_subplot()

        self.axes.grid(True)

        self.axes.set_xlim([0,50])
        self.axes.set_ylim([240,260])

        FigureCanvas.__init__(self, self.fig)
        self.setParent(parent)

        FigureCanvas.setSizePolicy(self,
                                   QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # To store the 2 draggable points
        self.list_points = []

        self.show()
        self.plotDraggablePoints(PK, FE)

    def plotDraggablePoints(self, listX, listY, size=1):

        """Plot and define the 2 draggable points of the baseline"""

        n = len(listX)

        for i in range(0,n):
            DragPoint = DraggablePoint(self, listX[i], listY[i], size)
            self.list_points.append(DragPoint)

            #print(" Access from script ", DragPoint.x)
            #print(" Access from script ", DragPoint.y)

        self.updateFigure()

        print(listY)

    def clearFigure(self):

        """Clear the graph"""

        self.axes.clear()
        self.axes.grid(True)
        del(self.list_points[:])
        self.updateFigure()

    def updateFigure(self):

        """Update the graph. Necessary, to call after each plot"""

        self.draw()

if __name__ == '__main__':

    app = QtWidgets.QApplication(sys.argv)
    ex = MyGraph()
    sys.exit(app.exec_())

I tried to store the new coordinates in an attributes of the instance DraggablePoint, but didn't manage to get what I want..


问:
How to activate mouse on the window?
I have seperate two pyqt5 window. One of them open in screen 1 and another open in second 2 display in my computer.

When I open the both of them, I want to keep mouse click in window2 and it has LineEdit. I need to focus every time in window2. I am using setFocus function but it didnt work. When the use click in window1 I lost the focus on window2 how can I move mouse cursor every time in related QlineEdit ?

Title: How to activate mouse on the window?


问:
React.js setLoggedin is not a function
I would like to know why I keep getting the error message setIsLoggedin is not a function. I'm currently passing down setIsLoggedin as props from App.jsx to Login.jsx component.
When the post request is sent to the backend, I want the setIsLoggedin in to be set as true, and hide the signup component!

App. jsx

function App() {
  const [isLoggedin, setIsLoggedin] = useState(false);

  return (
    <BrowserRouter>

    <Routes>
          <Route path="/" element={<Home />} />

        <Route path="/Login" element={ <Login setIsLoggedin={setIsLoggedin}/> }/>
          <Route path="/SignUp" element={ isLoggedin ? <SignUp/> : null }/>
          <Route path="/Dashboard" element={<Dashboard/> }/>
          <Route path="/Update" element={<Update/>} />
    </Routes>

    </BrowserRouter>
  );
}

export default App;```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script></code>```

Login.jsx

onst Login = ({setIsLoggedin}) => {
    const navigate = useNavigate();
    const [values, setValues] = useState({
        email: "",
        password: "",
    });

    const handleSubmit = async (e) => {
        e.preventDefault();

        localStorage.setItem('token-info', JSON.stringify(values));

        axios.post("http://localhost:4000/signin/auth",values, {
                body: {
                email:'',
                password:''
            },
            })
            .then((res) => {
                if(res){
                    setIsLoggedin(true)
                    navigate('/Dashboard')
                }
            }

            )
            .catch((err) => console.error(err));
    };
    return (

Sign In

            <form onSubmit={handleSubmit}>
                email
                <input type="email"
                name="email"
                onChange={(e) => setValues({ ...values, email: e.target.value })}
                ></input>

                password
                <input type="password"
                 name="password"
                 onChange={(e) => setValues({ ...values, password: e.target.value })}
                ></input>

                <input type="submit" />

Not registered? <NavLink to="/SignUp">Sign up here!</NavLink> | Forgot your password?

            </form>

    )
}

export default Login```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script></code>```

Title: React.js setLoggedin is not a function

Body:
I would like to know why I keep getting the error message setIsLoggedin is not a function. I'm currently passing down setIsLoggedin as props from App.jsx to Login.jsx component.
When the post request is sent to the backend, I want the setIsLoggedin in to be set as true, and hide the signup component!

App. jsx

function App() {
  const [isLoggedin, setIsLoggedin] = useState(false);

  return (
    <BrowserRouter>

    <Routes>
          <Route path="/" element={<Home />} />

        <Route path="/Login" element={ <Login setIsLoggedin={setIsLoggedin}/> }/>
          <Route path="/SignUp" element={ isLoggedin ? <SignUp/> : null }/>
          <Route path="/Dashboard" element={<Dashboard/> }/>
          <Route path="/Update" element={<Update/>} />
    </Routes>

    </BrowserRouter>
  );
}

export default App;

Login.jsx

onst Login = ({setIsLoggedin}) => {
    const navigate = useNavigate();
    const [values, setValues] = useState({
        email: "",
        password: "",
    });

    const handleSubmit = async (e) => {
        e.preventDefault();

        localStorage.setItem('token-info', JSON.stringify(values));

        axios.post("http://localhost:4000/signin/auth",values, {
                body: {
                email:'',
                password:''
            },
            })
            .then((res) => {
                if(res){
                    setIsLoggedin(true)
                    navigate('/Dashboard')
                }
            }

            )
            .catch((err) => console.error(err));
    };
    return (

Sign In

            <form onSubmit={handleSubmit}>
                email
                <input type="email"
                name="email"
                onChange={(e) => setValues({ ...values, email: e.target.value })}
                ></input>

                password
                <input type="password"
                 name="password"
                 onChange={(e) => setValues({ ...values, password: e.target.value })}
                ></input>

                <input type="submit" />

Not registered? <NavLink to="/SignUp">Sign up here!</NavLink> | Forgot your password?

            </form>

    )
}

export default Login


问:
Get Applications List in Windows 10/11 using Rust
I'm trying to get Windows 10 all installed Applications.

In Macos I can use system_profiler command to get installed applications and export it to json file then parse it to Rust, does Windows have any similiar command ?

Thank in advance


问:
Joost with javascript support
I am running Joost with javascript support.

Joost explains the usage here.

However, I am getting below errors

```<code>`Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/bsf/BSFManager
    at net.sf.joost.stx.function.FunctionFactory.getBSFManager(FunctionFactory.java:279)
    at net.sf.joost.stx.function.FunctionFactory.addScript(FunctionFactory.java:309)
    at net.sf.joost.instruction.ScriptFactory$Instance.compile(ScriptFactory.java:195)
    at net.sf.joost.stx.Parser.endElement(Parser.java:419)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1781)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2966)

</code>```

CausedBy

```<code>Caused by: java.lang.ClassNotFoundException: org.apache.bsf.BSFManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

</code>```

I have added the below jars in classpath with command

```<code>export CLASSPATH=${CLASSPATH}:bsf-all-3.1.jar
export CLASSPATH=${CLASSPATH}:rhino-script-engine-1.1.1.jar
export CLASSPATH=${CLASSPATH}:rhino-1.7R5.jar `
</code>```

Title: Joost with javascript support

Body:
I am running Joost with javascript support.

Joost explains the usage here.

However, I am getting below errors

`Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/bsf/BSFManager
    at net.sf.joost.stx.function.FunctionFactory.getBSFManager(FunctionFactory.java:279)
    at net.sf.joost.stx.function.FunctionFactory.addScript(FunctionFactory.java:309)
    at net.sf.joost.instruction.ScriptFactory$Instance.compile(ScriptFactory.java:195)
    at net.sf.joost.stx.Parser.endElement(Parser.java:419)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1781)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2966)

CausedBy

Caused by: java.lang.ClassNotFoundException: org.apache.bsf.BSFManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

I have added the below jars in classpath with command

export CLASSPATH=${CLASSPATH}:bsf-all-3.1.jar
export CLASSPATH=${CLASSPATH}:rhino-script-engine-1.1.1.jar
export CLASSPATH=${CLASSPATH}:rhino-1.7R5.jar `


问:
Reload Animation of Counter Widget Elementor by jQuery
I'm talking abount Counter Widget Elementor
this widget simple count a number with animation
I need to change a number with jQuery and reload animation after click button

```<code>jQuery('#id').on('click', function (event) {
            jQuery("#price").text("39");

            //reload animation counter

             });
</code>```

I expecting that restart animation and count again with my new number

Body:
I'm talking abount Counter Widget Elementor
this widget simple count a number with animation
I need to change a number with jQuery and reload animation after click button

jQuery('#id').on('click', function (event) {
            jQuery("#price").text("39");

            //reload animation counter

             });

I expecting that restart animation and count again with my new number


问:
Video Downloader Needed for Youtube videos
I want to download video from Youtube , anyone suggest me a good video downloader without any lipsing issues

Kindly recomend me some best downloaders for youtube


问:
Closing all but active dropdown which use Chakra UI's useDisclosure hook?
I am using Chakra UI's useDisclosure hook to toggle the dropdown of the nav bar item. The dropdown is toggled on click. I have multiple menu items in the nav bar with dropdowns. I would like to keep only the active dropdown open at a time, but I don't know how to close previous ones?

Here is the full working thing in Codesandbox to see what I have.


问:
Custom aggregated query with spring boot data REST
I'm pretty new to Spring Boot and Spring Data Rest and HATEOAS. I'm able to create a REST API with CRUD capability on an entity (say Device, entity having a few properties, including one called manufacturer), and interact with the API (get/add/update/delete/patch device) "out of the Spring Boot box".

I now want to call an API endpoint to get an aggregated view of the device repository that, in short, returns the result of the query select manufacturer, count(*) from devices group by manufacturer. Is this doable with spring data rest or it needs to be done with JPA? or should I define a specific entity having these two fields (device_manufacturer, count)?

Thanks


问:
How to open custom.php file in WordPress customizer without adding or registering the Page or Post in javascript
I am trying to customize the custom.php file in WordPress customizer. I am able to customize the file using PHP by using this hook template_include

add_filter( 'template_include', function( $return ) {
    if ( isset( $_GET['is_custom_page_active'] ) && true === $_GET['is_custom_page_active'] ) {
        return PLUGIN_DIR_PATH . 'templates/custom.php';
    }
    return $return;
} );
```
<p>the above code is working properly.</p>
<p>Now I need to customize this file using javascript when I click on the registered panel open <strong>custom.php</strong> file</p>
<pre class="lang-js prettyprint-override"><code>api.bind( 'ready', function() {
        wp.customize.panel( 'open-woocommerce-section', function( section ) {
            section.expanded.bind( function( isExpanding ) {
                if ( isExpanding ) {
                    let current_url = wp.customize.previewer.previewUrl();
                    current_url = current_url.includes( locaized_script.woocommerce_templates );
                    if ( ! current_url ) {
                       wp.customize.previewer.previewUrl.set(  locaized_script.woocommerce_templates );
                    }
                } else {
                    wp.customize.previewer.previewUrl.set( locaized_script.home_url );
                }
            } );
        } );
    } );
</code>```

wp_enqueue_script( 'sa-enqueue-scripts', PLUGIN_URL . 'assets/js/custom.js', array( 'jquery', 'customize-preview' ), '1.0', true );
wp_localize_script( 'sa-enqueue-scripts', 'locaized_script', array( 'woocommerce_templates' => PLUGIN_URL . 'templates/custom.php', 'home_url' => home_url( '/' ) ) );
```

But this code is not working.
Please help me to find the solution.

Thank you.

Body:
I am trying to customize the custom.php file in WordPress customizer. I am able to customize the file using PHP by using this hook template_include

add_filter( 'template_include', function( $return ) {
    if ( isset( $_GET['is_custom_page_active'] ) && true === $_GET['is_custom_page_active'] ) {
        return PLUGIN_DIR_PATH . 'templates/custom.php';
    }
    return $return;
} );

the above code is working properly.

Now I need to customize this file using javascript when I click on the registered panel open custom.php file

api.bind( 'ready', function() {
        wp.customize.panel( 'open-woocommerce-section', function( section ) {
            section.expanded.bind( function( isExpanding ) {
                if ( isExpanding ) {
                    let current_url = wp.customize.previewer.previewUrl();
                    current_url = current_url.includes( locaized_script.woocommerce_templates );
                    if ( ! current_url ) {
                       wp.customize.previewer.previewUrl.set(  locaized_script.woocommerce_templates );
                    }
                } else {
                    wp.customize.previewer.previewUrl.set( locaized_script.home_url );
                }
            } );
        } );
    } );

wp_enqueue_script( 'sa-enqueue-scripts', PLUGIN_URL . 'assets/js/custom.js', array( 'jquery', 'customize-preview' ), '1.0', true );
wp_localize_script( 'sa-enqueue-scripts', 'locaized_script', array( 'woocommerce_templates' => PLUGIN_URL . 'templates/custom.php', 'home_url' => home_url( '/' ) ) );

But this code is not working.
Please help me to find the solution.

Thank you.


问:
How do I connect Visio shapes only to the marked positions using Glue?
Below is the code that I used to find the shape with a connector. But I will need the connector to start and end on the marked spot (Mid-Point of side of Rectangle) as displayed on the image.

```<code>// Drop Shape
Visio.Master visioMaster = visioStencil.Masters.get_ItemU(@"Rectangle");
Visio.Shape visioShape = visioPage.Drop(visioMaster, 0.0, 0.0);

Visio.Master visioMaster1 = visioStencil.Masters.get_ItemU(@"Rectangle");
Visio.Shape visioShape1 = visioPage.Drop(visioMaster1, 0.0, 1.0);

// Add a dynamic connector to the page using glue.
Visio.Shape vsoConnectorShape = visioShape.ContainingPage.Drop(app.ConnectorToolDataObject, 0.0, 0.0);

// Set the connector properties, using different arrows, colors, and patterns for many-to-many relationships.

// Connect the starting point.
Visio.Cell cellBeginX = vsoConnectorShape.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXForm1D, (short)Visio.VisCellIndices.vis1DBeginY);
cellBeginX.GlueTo(visioShape.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXFormOut, (short)Visio.VisCellIndices.visXFormPinX));

// Connect the ending point.
Visio.Cell cellEndX = vsoConnectorShape.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXForm1D, (short)Visio.VisCellIndices.vis1DEndY);
cellEndX.GlueTo(visioShape1.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXFormOut, (short)Visio.VisCellIndices.visXFormPinY));
</code>```

I want my line to start from mid point of side of one rectangle and end at mid point of side of another rectangle as i have marked by black bold line on the below snap shot. I  have manually modified the lines in my new second snap shot. I hope my question will be more clear now.

Body:
Below is the code that I used to find the shape with a connector. But I will need the connector to start and end on the marked spot (Mid-Point of side of Rectangle) as displayed on the image.

// Drop Shape
Visio.Master visioMaster = visioStencil.Masters.get_ItemU(@"Rectangle");
Visio.Shape visioShape = visioPage.Drop(visioMaster, 0.0, 0.0);

Visio.Master visioMaster1 = visioStencil.Masters.get_ItemU(@"Rectangle");
Visio.Shape visioShape1 = visioPage.Drop(visioMaster1, 0.0, 1.0);

// Add a dynamic connector to the page using glue.
Visio.Shape vsoConnectorShape = visioShape.ContainingPage.Drop(app.ConnectorToolDataObject, 0.0, 0.0);

// Set the connector properties, using different arrows, colors, and patterns for many-to-many relationships.

// Connect the starting point.
Visio.Cell cellBeginX = vsoConnectorShape.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXForm1D, (short)Visio.VisCellIndices.vis1DBeginY);
cellBeginX.GlueTo(visioShape.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXFormOut, (short)Visio.VisCellIndices.visXFormPinX));

// Connect the ending point.
Visio.Cell cellEndX = vsoConnectorShape.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXForm1D, (short)Visio.VisCellIndices.vis1DEndY);
cellEndX.GlueTo(visioShape1.get_CellsSRC(1, (short)Visio.VisRowIndices.visRowXFormOut, (short)Visio.VisCellIndices.visXFormPinY));

I want my line to start from mid point of side of one rectangle and end at mid point of side of another rectangle as i have marked by black bold line on the below snap shot. I  have manually modified the lines in my new second snap shot. I hope my question will be more clear now.


问:
django related to host mail

Problem is related to host mail address as it cannot be changed and because of fixed host name, the sender’s mail address is not being updated after updating it several times

The problem with SendinBlue is that it does not allow us to use attachments with mail and ignores the attachments every time while sending an email

While using react for frontend, it saved the data from mails and does not send the mail from the backend through API.

def send_mail(request):
# form = emailssForm()
if request.method == 'POST':
name = request.POST.get('name')
email = request.POST.get('email')
message = request.POST.get('message')
subject = request.POST.get('subject')
from_email = request.POST.get('from_email')
# file = request.POST.get('file')

```<code>     template = loader.get_template('contact_form.txt')
     context = {
         'name': name,
         'email': email,
         'message': message,
         'subject': subject,
         'from_email':from_email,
         # 'file' : file,

     }

     message = template.render(context)

     email = EmailMultiAlternatives(
         "Uthara Print", email,message,
         "Compny " + "Uthara Print",
         ['pandayharsh472@gmail.com',email]
     )
     # msg = EmailMultiAlternatives(
     #     subject,message,name,[from_email],

     # )

     email.content_subtype = 'html'
     file = request.FILES['file']
     email.attach(file.name, file.read(), file.content_type)
     email.send()

     messages.success(request, 'Message sent successfully ! I will ansewr you as soon as possibile....')
     return HttpResponseRedirect('/')
</code>```

SETTING.PY.............................................................

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'GMAIL_HOST_USER'
EMAIL_HOST_PASSWORD = 'PASSWORD'

EMAIL_USE_TLS = True
EMAIL_USE_SSL = False`

Title: django related to host mail

Body:
Problem is related to host mail address as it cannot be changed and because of fixed host name, the sender’s mail address is not being updated after updating it several times

The problem with SendinBlue is that it does not allow us to use attachments with mail and ignores the attachments every time while sending an email

While using react for frontend, it saved the data from mails and does not send the mail from the backend through API.

def send_mail(request):
# form = emailssForm()
if request.method == 'POST':
name = request.POST.get('name')
email = request.POST.get('email')
message = request.POST.get('message')
subject = request.POST.get('subject')
from_email = request.POST.get('from_email')
# file = request.POST.get('file')

     template = loader.get_template('contact_form.txt')
     context = {
         'name': name,
         'email': email,
         'message': message,
         'subject': subject,
         'from_email':from_email,
         # 'file' : file,

     }

     message = template.render(context)

     email = EmailMultiAlternatives(
         "Uthara Print", email,message,
         "Compny " + "Uthara Print",
         ['pandayharsh472@gmail.com',email]
     )
     # msg = EmailMultiAlternatives(
     #     subject,message,name,[from_email],

     # )

     email.content_subtype = 'html'
     file = request.FILES['file']
     email.attach(file.name, file.read(), file.content_type)
     email.send()

     messages.success(request, 'Message sent successfully ! I will ansewr you as soon as possibile....')
     return HttpResponseRedirect('/')

SETTING.PY.............................................................

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'GMAIL_HOST_USER'
EMAIL_HOST_PASSWORD = 'PASSWORD'

EMAIL_USE_TLS = True
EMAIL_USE_SSL = False`


问:
I need to transfer dataset from power bi service to elasticsearch through Logstash. it not send any data but create Index in the Elasticsearch
i create REST API for the power bi dataset.
It is my config file to transfer data from the power bi service to elasticsearch :</p>
```<code>input {
http_poller {
    urls => {
      powerbi_data => {
        method => get
        url => "https://api.powerbi.com/../../../dataset_id"
        headers => {
          Authorization => "Bearer tocken_id"
        }
      }
    }
    schedule => { every => "5m" }
  }
}

output {
  elasticsearch {
  hosts => ["http://localhost:9200"]
  index => "powerbi"
  }
}
</code>```

Body:
i create REST API for the power bi dataset.
It is my config file to transfer data from the power bi service to elasticsearch :

input {
http_poller {
    urls => {
      powerbi_data => {
        method => get
        url => "https://api.powerbi.com/../../../dataset_id"
        headers => {
          Authorization => "Bearer tocken_id"
        }
      }
    }
    schedule => { every => "5m" }
  }
}

output {
  elasticsearch {
  hosts => ["http://localhost:9200"]
  index => "powerbi"
  }
}


问:
Break the function map()
I need to map some iterator to parse each value in it, but this mapping should be stopped on any parse error and function contained it should immediately return:

```<code>fn some_tasks(elids: String) -> Result<(), String> {
    let ids: Vec<i32> = elids.split(", ").map(|elid| elid.parse::<i32>()?).collect();
    //  ...
    Ok(())
}
</code>```

This code, of course, doesn't work: compiler thinks that the ? operator should return Err() from closure to map(), not from whole some_tasks():

```<code>|     let ids: Vec<i32> = elids.split(", ").map( |elid| elid.parse::<i32>()? ).collect();
|                                                ------                    ^ cannot use the `?` operator in a closure that returns `i32`
|                                                |
|                                                this function should return `Result` or `Option` to accept `?`

</code>```

Using return operator doesn't help because of similar reasons: compiler thinks it is return from closure to map(), not from whole some_tasks():

```<code>fn some_tasks(elids: String) -> Result<(), String> {
    let ids: Vec<i32> = elids.split(", ").map( |elid| {
        let result = elid.parse::<i32>();
        if let Err(e) = result { return Err(e) }
        result.unwrap()
    } ).collect();    //  ...
    Ok(())
}
</code>```

Of course, I can collect() to Vec<Result<i32, ParseIntError>>, then analyze this vector and return from some_tasks() if it contains any Err(). Or I can add some additional mutable success variable outside of map() and change it from true to false on parsing errors in closure.
But both these methods has the save disadvantage: map() will parse ALL elements of iterator  before it will be possible to handle such an error outside of map() (in my case it's a lot of excess work).

So my question is: is there any way to break the execution of a map() immediately when an error is detected in closure inside of it?

Title: Break the function map()

Body:
I need to map some iterator to parse each value in it, but this mapping should be stopped on any parse error and function contained it should immediately return:

fn some_tasks(elids: String) -> Result<(), String> {
    let ids: Vec<i32> = elids.split(", ").map(|elid| elid.parse::<i32>()?).collect();
    //  ...
    Ok(())
}

This code, of course, doesn't work: compiler thinks that the ? operator should return Err() from closure to map(), not from whole some_tasks():

|     let ids: Vec<i32> = elids.split(", ").map( |elid| elid.parse::<i32>()? ).collect();
|                                                ------                    ^ cannot use the `?` operator in a closure that returns `i32`
|                                                |
|                                                this function should return `Result` or `Option` to accept `?`

Using return operator doesn't help because of similar reasons: compiler thinks it is return from closure to map(), not from whole some_tasks():

fn some_tasks(elids: String) -> Result<(), String> {
    let ids: Vec<i32> = elids.split(", ").map( |elid| {
        let result = elid.parse::<i32>();
        if let Err(e) = result { return Err(e) }
        result.unwrap()
    } ).collect();    //  ...
    Ok(())
}

Of course, I can collect() to Vec<Result<i32, ParseIntError>>, then analyze this vector and return from some_tasks() if it contains any Err(). Or I can add some additional mutable success variable outside of map() and change it from true to false on parsing errors in closure.
But both these methods has the save disadvantage: map() will parse ALL elements of iterator  before it will be possible to handle such an error outside of map() (in my case it's a lot of excess work).

So my question is: is there any way to break the execution of a map() immediately when an error is detected in closure inside of it?


问:
Archiving not works
I've setup the WAL archiving already and when I'm running the following query,
SELECT * FROM pg_stat archiver; The system gives me back this:

Archived count 0, last_archived_wal (empty), last_archived_time (empty), failed_count, 40 (keep growing), last_failed_wal (lot of numbers, always same), and the fail time and stat reset.

The log file:

2023-01-13 00:01:37.846 JST [5456] LOG: archive command failed with exit code 1 2023-01-13 00:01:37.846 JST [5456] DETAIL: The failed archive command was: copy "pg_wal\000000010000002300000063" "C:\server\archivedir\000000010000002300000063" 2023-01-13 00:01:37.848 JST [5456] WARNING: archiving write-ahead log file "000000010000002300000063" failed too many times, will try again later The system cannot find the path specified.

The psql create the files, 16 MB each and also create the .ready files. Bit when I like to check the status ( SELECT * FROM pg_stat_archiver; )

Title: Archiving not works


问:
Nodejs async hooks with next callback not working and crashing nodemon
Nodejs async hooks with run function having next not getting called and it crashing the nodemon

Here is my async local storage (asyncContext.ts)

```<code>import { AsyncLocalStorage } from 'async_hooks';

const asyncContext = new AsyncLocalStorage<Map<string, string>>();
export default asyncContext;
</code>```

Request handler middleware

```<code>import { Response, NextFunction } from 'express';
import { customAlphabet } from 'nanoid/async';
import { Request } from '../../interfaces/Request';
import asyncLocalStorage from '../asyncContext';

export const requestIdHandler = async (req: Request, res: Response, next: NextFunction) => {
  req.id = await customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 20)();
  const store = new Map<string, string>();
  asyncLocalStorage.run(store, () => {
    store.set('requestId', req.id);
    res.setHeader('X-Request-Id', req.id);
    next();
  });
};
</code>```

As soon as the application run and trigger any api getting following error

```<code>[nodemon] app crashed - waiting for file changes before starting...
</code>```

if i will remove the asyncLocalStorage.run function application will working properly.

UPDATE - if runs without nodemon it's working properly
Any help or reference will be very helpful, thanks

Body:
Nodejs async hooks with run function having next not getting called and it crashing the nodemon

Here is my async local storage (asyncContext.ts)

import { AsyncLocalStorage } from 'async_hooks';

const asyncContext = new AsyncLocalStorage<Map<string, string>>();
export default asyncContext;

Request handler middleware

import { Response, NextFunction } from 'express';
import { customAlphabet } from 'nanoid/async';
import { Request } from '../../interfaces/Request';
import asyncLocalStorage from '../asyncContext';

export const requestIdHandler = async (req: Request, res: Response, next: NextFunction) => {
  req.id = await customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 20)();
  const store = new Map<string, string>();
  asyncLocalStorage.run(store, () => {
    store.set('requestId', req.id);
    res.setHeader('X-Request-Id', req.id);
    next();
  });
};

As soon as the application run and trigger any api getting following error

[nodemon] app crashed - waiting for file changes before starting...

if i will remove the asyncLocalStorage.run function application will working properly.

UPDATE - if runs without nodemon it's working properly
Any help or reference will be very helpful, thanks


问:
How to reduce size of python/qml application after using cx_Freeze
I do not why, but my exe version of my python+qml/qtQuick application takes on large size. All package has over 550 MB. (folder PySide6 under lib has 400 MB). I suppose there is a lot of useless items in PySide6 folder - how to eliminate it?
Another think is that on clean windows installation the exe cannot be started:


问:
AnalysisException: Unsupported correlated subquery with grouping and/or aggregation
I want to join two tables in Impala from different databases.

I tried:

```<code>SELECT tl.*, pt.tran_desc_1
FROM dev_trench_m.v_transaction_label  tl
JOIN dev_trench_stg.v_posted_transaction pt
    ON tl.transaction_id = pt.transaction_id
WHERE tl.transaction_id IN
(
SELECT MAX(tl.transaction_id) FROM dev_trench_m.v_transaction_label
WHERE tl.tran_label_code_4 IN
    (
    "FIN0102999" --JPU Hypoteční úvěr - neupřesněno
    ,"FOD0101011" --Lidl
    ,"MON0303001" --Starobní důchod
    ,"NEM0103001" --ČEZ Distribuce, a.s.
    ,"MON0302002" --Rodičovský příspěvek
    )
group by tl.tran_label_code_4
)
limit 5
</code>```

I got:

AnalysisException: Unsupported correlated subquery with grouping
and/or aggregation: SELECT max(tl.transaction_id) FROM
dev_trench_m.v_transaction_label WHERE tl.tran_label_code_4 IN
('FIN0102999', 'FOD0101011', 'MON0303001', 'NEM0103001', 'MON0302002')
GROUP BY tl.tran_label_code_4

Maybe CTE table could help? But I'm not sure at all..

Body:
I want to join two tables in Impala from different databases.

I tried:

SELECT tl.*, pt.tran_desc_1
FROM dev_trench_m.v_transaction_label  tl
JOIN dev_trench_stg.v_posted_transaction pt
    ON tl.transaction_id = pt.transaction_id
WHERE tl.transaction_id IN
(
SELECT MAX(tl.transaction_id) FROM dev_trench_m.v_transaction_label
WHERE tl.tran_label_code_4 IN
    (
    "FIN0102999" --JPU Hypoteční úvěr - neupřesněno
    ,"FOD0101011" --Lidl
    ,"MON0303001" --Starobní důchod
    ,"NEM0103001" --ČEZ Distribuce, a.s.
    ,"MON0302002" --Rodičovský příspěvek
    )
group by tl.tran_label_code_4
)
limit 5

I got:

AnalysisException: Unsupported correlated subquery with grouping
and/or aggregation: SELECT max(tl.transaction_id) FROM
dev_trench_m.v_transaction_label WHERE tl.tran_label_code_4 IN
('FIN0102999', 'FOD0101011', 'MON0303001', 'NEM0103001', 'MON0302002')
GROUP BY tl.tran_label_code_4

Maybe CTE table could help? But I'm not sure at all..


问:
how to dynamically print the individual vectors
I would like to print the vector origin created like origin1, origin2, origin3 to print dynamically. I tried the cat with paste but that does not seem to work. Any suggestion would  help.

origin <- sort(c('USA','Europe','Asia'), decreasing = T)
for (i in 1:length(origin)){
  assign(paste0('origin',i), origin[i], envir = .GlobalEnv)
  cat(paste0('origin',i))
}
```


问:
PDF Print appears completely different on different devices (HTML/CSS)
I'm trying to create a PDF file based on user input on a website. On my local machine, and after deployment everything works great. However, when I asked my friend to test the PDF, it looked completely different and did not seem to use any of the styles that I provided.

The code isn't complicated, I just passed a CSS class that breaks the next elements into the next page (whenever it was necessary):

CSS

```<code>@media print {
  @page {
    size: auto;
    margin: 25mm 0;
  }

  .pageBreakAfter {
    page-break-after: always;
}
}
</code>```

HTML

```<code><div>
   <div>
      first element
   </div>
   <div class='pageBreakAfter'>
      2nd element
   </div>
   <div>
      3rd element
   </div>
</div>
</code>```

My friend and I both have Windows 11 and the newest Chrome. On my machine, the page-break-after css works, but on his it doesn't. How can I fix this?

Body:
I'm trying to create a PDF file based on user input on a website. On my local machine, and after deployment everything works great. However, when I asked my friend to test the PDF, it looked completely different and did not seem to use any of the styles that I provided.

The code isn't complicated, I just passed a CSS class that breaks the next elements into the next page (whenever it was necessary):

CSS

@media print {
  @page {
    size: auto;
    margin: 25mm 0;
  }

  .pageBreakAfter {
    page-break-after: always;
}
}

HTML

      first element

      2nd element

      3rd element

My friend and I both have Windows 11 and the newest Chrome. On my machine, the page-break-after css works, but on his it doesn't. How can I fix this?


问:
I can not install next js using the yarn command
Here is the command

```<code>$ yarn create next-app
</code>```

Installing and error :

```<code>$ yarn create next-app
yarn create v1.22.19
\[1/4\] Resolving packages...
\[2/4\] Fetching packages...
\[3/4\] Linking dependencies...
\[4/4\] Building fresh packages...
success Installed "create-next-app@13.1.1" with binaries:
\- create-next-app
\[########################################################################\] 72/72'C:\\Users\\Md' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\\Users\\Md Mahir\\AppData\\Local\\Yarn\\bin\\create-next-app
Arguments:
Directory: G:\\Nextjs
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
</code>```

Body:
Here is the command

$ yarn create next-app

Installing and error :

$ yarn create next-app
yarn create v1.22.19
\[1/4\] Resolving packages...
\[2/4\] Fetching packages...
\[3/4\] Linking dependencies...
\[4/4\] Building fresh packages...
success Installed "create-next-app@13.1.1" with binaries:
\- create-next-app
\[########################################################################\] 72/72'C:\\Users\\Md' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\\Users\\Md Mahir\\AppData\\Local\\Yarn\\bin\\create-next-app
Arguments:
Directory: G:\\Nextjs
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.