问:
Sftp (paramiko) put method not working (FileNotFoundError: [Errno 2] No such file) but sometimes the file is uploaded anyway
I have a strange behaviour when trying to upload a file into an sftp by using paramiko.

```<code>myHostname = "xxx"
port = 22
myUsername = "yyy"
myPassword = "zzz"
try:
  t = paramiko.Transport((myHostname, port))
  t.connect(username = myUsername, password = myPassword)
  sftp = paramiko.SFTPClient.from_transport(t)
  sftp.put("C:\Users\simeone\Documents\Repository\REC_bbgAIM\f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc","/f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc")
### Comment: you see that as first argument I passed the whole path with \, result does not change if I use / or \\
finally:
  sftp.close()
  t.close()
</code>```

I get the following error:

```<code>Traceback (most recent call last):
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\main.py", line 25, in <module>
    sftp.put("f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc", "/f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc")
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 759, in put
    return self.putfo(fl, remotepath, file_size, callback, confirm)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 720, in putfo
    s = self.stat(remotepath)
        ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 493, in stat
    t, msg = self._request(CMD_STAT, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 822, in _request
    return self._read_response(num)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 874, in _read_response
    self._convert_status(msg)
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 903, in _convert_status
    raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] No such file
</code>```

I checked references:

Upload all files from local folder with specific extension to SFTP server using Paramiko

Paramiko SFTPClient.get fails with "FileNotFoundError: [Errno 2] No such file or directory" referring to the remote file path

The error happens in the put, but the behaviour I get is very strange because sometimes the file is uploaded correctly although I get the error message.

I work on Windows and python 3.11.1
I tried with pysftp as well, but was not working and thought was due to the fact that is no longer maintained.

Body:
I have a strange behaviour when trying to upload a file into an sftp by using paramiko.

myHostname = "xxx"
port = 22
myUsername = "yyy"
myPassword = "zzz"
try:
  t = paramiko.Transport((myHostname, port))
  t.connect(username = myUsername, password = myPassword)
  sftp = paramiko.SFTPClient.from_transport(t)
  sftp.put("C:\Users\simeone\Documents\Repository\REC_bbgAIM\f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc","/f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc")
### Comment: you see that as first argument I passed the whole path with \, result does not change if I use / or \\
finally:
  sftp.close()
  t.close()

I get the following error:

Traceback (most recent call last):
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\main.py", line 25, in <module>
    sftp.put("f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc", "/f6431recupload.csv.TEMPL_BNP_MIL_CASH.inc")
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 759, in put
    return self.putfo(fl, remotepath, file_size, callback, confirm)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 720, in putfo
    s = self.stat(remotepath)
        ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 493, in stat
    t, msg = self._request(CMD_STAT, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 822, in _request
    return self._read_response(num)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 874, in _read_response
    self._convert_status(msg)
  File "C:\Users\simeone\Documents\Repository\REC_bbgAIM\REC_AIM_bbg\Lib\site-packages\paramiko\sftp_client.py", line 903, in _convert_status
    raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] No such file

I checked references:

Upload all files from local folder with specific extension to SFTP server using Paramiko

Paramiko SFTPClient.get fails with "FileNotFoundError: [Errno 2] No such file or directory" referring to the remote file path

The error happens in the put, but the behaviour I get is very strange because sometimes the file is uploaded correctly although I get the error message.

I work on Windows and python 3.11.1
I tried with pysftp as well, but was not working and thought was due to the fact that is no longer maintained.


来源: stackexchange

问:
Why doesn't the text look the same like in the Illustrator design?
So this is the screenshot from the Illustrator design where you can see how I want the text to look like

I am building my own chrome extension (very first), the coding is done I just have to do the styling now. I've made design in Illustrator and trying to do it that way. Right now I'm having issues with the text design. Text doesn't look the same on the extension and in Illustrator even tho it's the same font (Futura Md BT) with same size (16px)

In extension text

I used Futura Medium BT in Illustrator and imported that font into my html in style with

@import url('https://fonts.cdnfonts.com/css/futura-md-bt');

and used it later in

```<code><div class="modal-content">
             <p><span style="font-family:'Futura Md BT', 'sans-serif'; font-size=16px">Prebacite eure u kune i obratno s lakoćom!</span></p>
....and so on
</code>```

Why isn't it the same??

ContentLicense: CC BY-SA 4.0

Body:
So this is the screenshot from the Illustrator design where you can see how I want the text to look like

I am building my own chrome extension (very first), the coding is done I just have to do the styling now. I've made design in Illustrator and trying to do it that way. Right now I'm having issues with the text design. Text doesn't look the same on the extension and in Illustrator even tho it's the same font (Futura Md BT) with same size (16px)

In extension text

I used Futura Medium BT in Illustrator and imported that font into my html in style with

@import url('https://fonts.cdnfonts.com/css/futura-md-bt');

and used it later in

Prebacite eure u kune i obratno s lakoćom!

....and so on

Why isn't it the same??


问:
How to trigger GITLAB pipeline from testrail
Currently we are using Testrail and Gitlab pipeline.
I want to trigger gitlab pipeline from testrail itself. Please let me know

I am still searching for it


问:
Laravel sail installation problem (The specified path could not be found)
I'm trying to install Sail for Laravel by doing :

```<code>composer create-project laravel/laravel myproject
cd myproject
composer require laravel/sail --dev

php artisan sail:install
</code>```

But I'm getting as Output :

Sail scaffolding installed successfully.
The specified path could not be found

Is there anything that I'm doing wrong here?

Body:
I'm trying to install Sail for Laravel by doing :

composer create-project laravel/laravel myproject
cd myproject
composer require laravel/sail --dev

php artisan sail:install

But I'm getting as Output :

Sail scaffolding installed successfully.
The specified path could not be found

Is there anything that I'm doing wrong here?


问:
localhost port not matching with apache port
i'm really new to web development and was trying to explore different projects on github. i downloaded a react "nearby restaurant finder" project and opened it on vs code. then i looked up how to run the project on a localhost and these are the steps i followed:

downloaded xampp and started apache on it. The port number it showed was 80. when i searched localhost:80 on chrome it directed me to the xampp dashboard.

i then transferred the project (which i downloaded from github) folder into the htdocs folder in xampp directory

then i opened a terminal in the project in vscode and ran the command "npm install", then "npm start"

i think my npm start worked fine because it opened up the localhost tab in chrome, only it showed "localhost refused to connect". also the url showing at the top had "3000" as port number. (http://localhost:3000/)

tried a couple of things (disabled firewall, cleared dns cache) nothing worked

then i figured i should match the port numbers. in the package.json file under scripts i put "start": "SET PORT = 80 && react-scripts start" then did npm start.

It told me the port is already being used (which i don't understand why) and to type yes if i want to run the project on another port instead, i did so.

then it opened a localhost with port number 81 and still the same "localhost refused to connect message"

the i tried changing the port number of apache to 3000 and removing SET PORT = 80 from scripts. this time when i did npm start it led me to localhost with port number 3001 and still the same error

i'm not able to understand where i'm going wrong. what can i do to resolve this problem?


问:
How to use 2 Tumble function in an UNION ALL query in flink
I have 2 different aggregation queries running in BATCH mode in flink

Query 1 : SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cmeLoadData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name

Query 2 : SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cpuUsageData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name

When I am trying to combine the queries like follows : SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cmeLoadData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name UNION ALL SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cpuUsageData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name

I get an error

```<code>Unsupported call: $TUMBLE(TIMESTAMP(3) NOT NULL, INTERVAL SECOND(3) NOT NULL)
If you think this function should be supported, you can create an issue and start a discussion for it.
org.apache.flink.table.planner.codegen.CodeGenException: Unsupported call: $TUMBLE(TIMESTAMP(3) NOT NULL, INTERVAL SECOND(3) NOT NULL)
If you think this function should be supported, you can create an issue and start a discussion for it.
</code>```

Edit : I am using streamTableEnvirnoment to execute the query as follows => streamTableEnvirnoment.sqlQuery(query) and connected to database using JDBC Catalog

Body:
I have 2 different aggregation queries running in BATCH mode in flink

Query 1 : SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cmeLoadData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name

Query 2 : SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cpuUsageData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name

When I am trying to combine the queries like follows : SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cmeLoadData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name UNION ALL SELECT TUMBLE_END(trunc_time, INTERVAL '10' MINUTE) trunc_time, organization_id, cluster_safe_name, max(peak_cpu) AS peak_cpu, avg(average_cpu) AS average_cpu FROM cpuUsageData GROUP BY TUMBLE(trunc_time, INTERVAL '10' MINUTE), organization_id, cluster_safe_name

I get an error

Unsupported call: $TUMBLE(TIMESTAMP(3) NOT NULL, INTERVAL SECOND(3) NOT NULL)
If you think this function should be supported, you can create an issue and start a discussion for it.
org.apache.flink.table.planner.codegen.CodeGenException: Unsupported call: $TUMBLE(TIMESTAMP(3) NOT NULL, INTERVAL SECOND(3) NOT NULL)
If you think this function should be supported, you can create an issue and start a discussion for it.

Edit : I am using streamTableEnvirnoment to execute the query as follows => streamTableEnvirnoment.sqlQuery(query) and connected to database using JDBC Catalog


问:
No connection could be made because the target machine actively refused it error between c# and c in virtual machine
im making a project where i have a communication between a c# windows forms application and a c application in a virtual machine (vmware). when i try to connect between the two i get an error on both sides every time. i have already disabled my firewall and its still not working.

my C# code:

```<code>private void ConnectClient(string server, string message)
        {
            try
            {
                // Create a TcpClient.
                // Note, for this client to work you need to have a TcpServer
                // connected to the same address as specified by the server, port
                // combination.
                Int32 port = 8888;
                TcpClient client = new TcpClient(server, port);

                // Translate the passed message into ASCII and store it as a Byte array.
                Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);

                // Get a client stream for reading and writing.
                //  Stream stream = client.GetStream();

                NetworkStream stream = client.GetStream();

                // Send the message to the connected TcpServer.
                stream.Write(data, 0, data.Length);

                Console.WriteLine("Sent: {0}", message);

                // Receive the TcpServer.response.

                // Buffer to store the response bytes.
                data = new Byte[256];

                // String to store the response ASCII representation.
                String responseData = String.Empty;

                // Read the first batch of the TcpServer response bytes.
                Int32 bytes = stream.Read(data, 0, data.Length);
                responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
                Console.WriteLine("Received: {0}", responseData);

                // Close everything.
                stream.Close();
                client.Close();
            }
            catch (ArgumentNullException e)
            {
                Console.WriteLine("ArgumentNullException: {0}", e);
            }
            catch (SocketException e)
            {
                Console.WriteLine("SocketException: {0}", e);
            }

            Console.WriteLine("\n Press Enter to continue...");
            Console.Read();

        }

private void ConnectBTN_Click(object sender, EventArgs e)
        {
            ConnectClient("192.168.80.128", "test");
        }
</code>```

my C code in Virtual Machine:

```<code>#define PortNumberApp 8888
#define IPadressApp "192.168.137.1"

void checkConnection(int connection_status)
{
 if(connection_status == -1;
 {
  printf("there was an error connecting to the socket\n \n");
 }
 else
 {
  printf("connection succesfull\n \n");
 }
}

int main(int argc, char const *argv[])
{
 int network_socketApp = socket(AF_INET, SOCK_STREAM, 6);

 struct sockaddr_in serverApp_adress;
 serverApp_adress.sin_family = AF_INET;
 serverApp_adress.sin_port = htons(PortNumberApp);
 serverApp_adress.sin_addr.s_addr = inet_addr(IPadressApp);

 int connection_statusApp = connect(network_socketApp, (struct sockaddr *)&serverApp_address, sizeof(serverApp_addres));
 checkConnection(connection_statusApp);

 char message[30];
 while(1)
 {
   if(read(network_socketApp, message, sizeof(message)))
   {
     write(network_socketApp, "OK!", sizeof("OK!"));
     bzero(message, sizeof(message));
     read(network_socketApp, message, sizeof(message));
     printf("Message from App: %s\n", message);
   }
 }
 return 0;
}
</code>```

i turned off my entire firewall which i hoped would fix the problem but this did not solve anything as i still get the same error: "No connection could be made because the target machine actively refused it 192.168.80.128:8888".

Body:
im making a project where i have a communication between a c# windows forms application and a c application in a virtual machine (vmware). when i try to connect between the two i get an error on both sides every time. i have already disabled my firewall and its still not working.

my C# code:

private void ConnectClient(string server, string message)
        {
            try
            {
                // Create a TcpClient.
                // Note, for this client to work you need to have a TcpServer
                // connected to the same address as specified by the server, port
                // combination.
                Int32 port = 8888;
                TcpClient client = new TcpClient(server, port);

                // Translate the passed message into ASCII and store it as a Byte array.
                Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);

                // Get a client stream for reading and writing.
                //  Stream stream = client.GetStream();

                NetworkStream stream = client.GetStream();

                // Send the message to the connected TcpServer.
                stream.Write(data, 0, data.Length);

                Console.WriteLine("Sent: {0}", message);

                // Receive the TcpServer.response.

                // Buffer to store the response bytes.
                data = new Byte[256];

                // String to store the response ASCII representation.
                String responseData = String.Empty;

                // Read the first batch of the TcpServer response bytes.
                Int32 bytes = stream.Read(data, 0, data.Length);
                responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
                Console.WriteLine("Received: {0}", responseData);

                // Close everything.
                stream.Close();
                client.Close();
            }
            catch (ArgumentNullException e)
            {
                Console.WriteLine("ArgumentNullException: {0}", e);
            }
            catch (SocketException e)
            {
                Console.WriteLine("SocketException: {0}", e);
            }

            Console.WriteLine("\n Press Enter to continue...");
            Console.Read();

        }

private void ConnectBTN_Click(object sender, EventArgs e)
        {
            ConnectClient("192.168.80.128", "test");
        }

my C code in Virtual Machine:

#define PortNumberApp 8888
#define IPadressApp "192.168.137.1"

void checkConnection(int connection_status)
{
 if(connection_status == -1;
 {
  printf("there was an error connecting to the socket\n \n");
 }
 else
 {
  printf("connection succesfull\n \n");
 }
}

int main(int argc, char const *argv[])
{
 int network_socketApp = socket(AF_INET, SOCK_STREAM, 6);

 struct sockaddr_in serverApp_adress;
 serverApp_adress.sin_family = AF_INET;
 serverApp_adress.sin_port = htons(PortNumberApp);
 serverApp_adress.sin_addr.s_addr = inet_addr(IPadressApp);

 int connection_statusApp = connect(network_socketApp, (struct sockaddr *)&serverApp_address, sizeof(serverApp_addres));
 checkConnection(connection_statusApp);

 char message[30];
 while(1)
 {
   if(read(network_socketApp, message, sizeof(message)))
   {
     write(network_socketApp, "OK!", sizeof("OK!"));
     bzero(message, sizeof(message));
     read(network_socketApp, message, sizeof(message));
     printf("Message from App: %s\n", message);
   }
 }
 return 0;
}

i turned off my entire firewall which i hoped would fix the problem but this did not solve anything as i still get the same error: "No connection could be made because the target machine actively refused it 192.168.80.128:8888".


问:
ValueError: `tape` is required when a `Tensor` loss is passed. Received: loss=1950770.5, tape=None
I am trying to implement the deconfounder of Wang and Blei (https://colab.research.google.com/github/blei-lab/deconfounder_tutorial/blob/master/deconfounder_tutorial.ipynb). The specified error has occurred in the line "train = optimizer.minimize(-elbo,var_list=[qb, qw, qw2, qz])". I am not sure if the var_list for my minimize()function is correct. I would be very grateful for help, since I unfortunately do not completely understand the code of Wang and Blei. I also tried to use tape=tf.GradientTape() but i didnt work.</p>
```<code>def variational_model(qb_mean, qb_stddv, qw_mean, qw_stddv,
                      qw2_mean, qw2_stddv, qz_mean, qz_stddv):
    qb = ed.Normal(loc=qb_mean, scale=qb_stddv, name="qb")
    qw = ed.Normal(loc=qw_mean, scale=qw_stddv, name="qw")
    qw2 = ed.Normal(loc=qw2_mean, scale=qw2_stddv, name="qw2")
    qz = ed.Normal(loc=qz_mean, scale=qz_stddv, name="qz")
    return qb, qw, qw2, qz

log_q = ed.make_log_joint_fn(variational_model)

def target(b, w, w2, z):
    """Unnormalized target density as a function of the parameters."""
    return log_joint(data_dim=data_dim,
                   latent_dim=latent_dim,
                   num_datapoints=num_datapoints,
                   stddv_datapoints=stddv_datapoints,
                   mask=1-holdout_mask,
                   w=w, z=z, w2=w2, b=b, x=x_train)

def target_q(qb, qw, qw2, qz):
    return log_q(qb_mean=qb_mean, qb_stddv=qb_stddv,
                 qw_mean=qw_mean, qw_stddv=qw_stddv,
                 qw2_mean=qw2_mean, qw2_stddv=qw2_stddv,
                 qz_mean=qz_mean, qz_stddv=qz_stddv,
                 qw=qw, qz=qz, qw2=qw2, qb=qb)

qb_mean = tf.Variable(np.ones([1, data_dim]), dtype=tf.float32)
qw_mean = tf.Variable(np.ones([latent_dim, data_dim]), dtype=tf.float32)
qw2_mean = tf.Variable(np.ones([latent_dim, data_dim]), dtype=tf.float32)
qz_mean = tf.Variable(np.ones([num_datapoints, latent_dim]), dtype=tf.float32)
qb_stddv = tf.nn.softplus(tf.Variable(0 * np.ones([1, data_dim]), dtype=tf.float32))
qw_stddv = tf.nn.softplus(tf.Variable(-4 * np.ones([latent_dim, data_dim]), dtype=tf.float32))
qw2_stddv = tf.nn.softplus(tf.Variable(-4 * np.ones([latent_dim, data_dim]), dtype=tf.float32))
qz_stddv = tf.nn.softplus(tf.Variable(-4 * np.ones([num_datapoints, latent_dim]), dtype=tf.float32))

qb, qw, qw2, qz = variational_model(qb_mean=qb_mean, qb_stddv=qb_stddv,
                                    qw_mean=qw_mean, qw_stddv=qw_stddv,
                                    qw2_mean=qw2_mean, qw2_stddv=qw2_stddv,
                                    qz_mean=qz_mean, qz_stddv=qz_stddv)

energy = target(qb, qw, qw2, qz)
entropy = -target_q(qb, qw, qw2, qz)

elbo = energy + entropy

optimizer = tf.optimizers.Adam(learning_rate = 0.05)
train = optimizer.minimize(-elbo,var_list=[qb, qw, qw2, qz])

init = tf.global_variables_initializer()

t = []

num_epochs = 500

with tf.Session() as sess:
    sess.run(init)

    for i in range(num_epochs):
        sess.run(train)
        if i % 5 == 0:
            t.append(sess.run([elbo]))

        b_mean_inferred = sess.run(qb_mean)
        b_stddv_inferred = sess.run(qb_stddv)
        w_mean_inferred = sess.run(qw_mean)
        w_stddv_inferred = sess.run(qw_stddv)
        w2_mean_inferred = sess.run(qw2_mean)
        w2_stddv_inferred = sess.run(qw2_stddv)
        z_mean_inferred = sess.run(qz_mean)
        z_stddv_inferred = sess.run(qz_stddv)

print("Inferred axes:")
print(w_mean_inferred)
print("Standard Deviation:")
print(w_stddv_inferred)

plt.plot(range(1, num_epochs, 5), t)
plt.show()

def replace_latents(b, w, w2, z):

    def interceptor(rv_constructor, *rv_args, **rv_kwargs):
        """Replaces the priors with actual values to generate samples from."""
        name = rv_kwargs.pop("name")
        if name == "b":
            rv_kwargs["value"] = b
        elif name == "w":
            rv_kwargs["value"] = w
        elif name == "w":
            rv_kwargs["value"] = w2
        elif name == "z":
            rv_kwargs["value"] = z
        return rv_constructor(*rv_args, **rv_kwargs)

    return interceptor`
</code>```

Body:
I am trying to implement the deconfounder of Wang and Blei (https://colab.research.google.com/github/blei-lab/deconfounder_tutorial/blob/master/deconfounder_tutorial.ipynb). The specified error has occurred in the line "train = optimizer.minimize(-elbo,var_list=[qb, qw, qw2, qz])". I am not sure if the var_list for my minimize()function is correct. I would be very grateful for help, since I unfortunately do not completely understand the code of Wang and Blei. I also tried to use tape=tf.GradientTape() but i didnt work.

def variational_model(qb_mean, qb_stddv, qw_mean, qw_stddv,
                      qw2_mean, qw2_stddv, qz_mean, qz_stddv):
    qb = ed.Normal(loc=qb_mean, scale=qb_stddv, name="qb")
    qw = ed.Normal(loc=qw_mean, scale=qw_stddv, name="qw")
    qw2 = ed.Normal(loc=qw2_mean, scale=qw2_stddv, name="qw2")
    qz = ed.Normal(loc=qz_mean, scale=qz_stddv, name="qz")
    return qb, qw, qw2, qz

log_q = ed.make_log_joint_fn(variational_model)

def target(b, w, w2, z):
    """Unnormalized target density as a function of the parameters."""
    return log_joint(data_dim=data_dim,
                   latent_dim=latent_dim,
                   num_datapoints=num_datapoints,
                   stddv_datapoints=stddv_datapoints,
                   mask=1-holdout_mask,
                   w=w, z=z, w2=w2, b=b, x=x_train)

def target_q(qb, qw, qw2, qz):
    return log_q(qb_mean=qb_mean, qb_stddv=qb_stddv,
                 qw_mean=qw_mean, qw_stddv=qw_stddv,
                 qw2_mean=qw2_mean, qw2_stddv=qw2_stddv,
                 qz_mean=qz_mean, qz_stddv=qz_stddv,
                 qw=qw, qz=qz, qw2=qw2, qb=qb)

qb_mean = tf.Variable(np.ones([1, data_dim]), dtype=tf.float32)
qw_mean = tf.Variable(np.ones([latent_dim, data_dim]), dtype=tf.float32)
qw2_mean = tf.Variable(np.ones([latent_dim, data_dim]), dtype=tf.float32)
qz_mean = tf.Variable(np.ones([num_datapoints, latent_dim]), dtype=tf.float32)
qb_stddv = tf.nn.softplus(tf.Variable(0 * np.ones([1, data_dim]), dtype=tf.float32))
qw_stddv = tf.nn.softplus(tf.Variable(-4 * np.ones([latent_dim, data_dim]), dtype=tf.float32))
qw2_stddv = tf.nn.softplus(tf.Variable(-4 * np.ones([latent_dim, data_dim]), dtype=tf.float32))
qz_stddv = tf.nn.softplus(tf.Variable(-4 * np.ones([num_datapoints, latent_dim]), dtype=tf.float32))

qb, qw, qw2, qz = variational_model(qb_mean=qb_mean, qb_stddv=qb_stddv,
                                    qw_mean=qw_mean, qw_stddv=qw_stddv,
                                    qw2_mean=qw2_mean, qw2_stddv=qw2_stddv,
                                    qz_mean=qz_mean, qz_stddv=qz_stddv)

energy = target(qb, qw, qw2, qz)
entropy = -target_q(qb, qw, qw2, qz)

elbo = energy + entropy

optimizer = tf.optimizers.Adam(learning_rate = 0.05)
train = optimizer.minimize(-elbo,var_list=[qb, qw, qw2, qz])

init = tf.global_variables_initializer()

t = []

num_epochs = 500

with tf.Session() as sess:
    sess.run(init)

    for i in range(num_epochs):
        sess.run(train)
        if i % 5 == 0:
            t.append(sess.run([elbo]))

        b_mean_inferred = sess.run(qb_mean)
        b_stddv_inferred = sess.run(qb_stddv)
        w_mean_inferred = sess.run(qw_mean)
        w_stddv_inferred = sess.run(qw_stddv)
        w2_mean_inferred = sess.run(qw2_mean)
        w2_stddv_inferred = sess.run(qw2_stddv)
        z_mean_inferred = sess.run(qz_mean)
        z_stddv_inferred = sess.run(qz_stddv)

print("Inferred axes:")
print(w_mean_inferred)
print("Standard Deviation:")
print(w_stddv_inferred)

plt.plot(range(1, num_epochs, 5), t)
plt.show()

def replace_latents(b, w, w2, z):

    def interceptor(rv_constructor, *rv_args, **rv_kwargs):
        """Replaces the priors with actual values to generate samples from."""
        name = rv_kwargs.pop("name")
        if name == "b":
            rv_kwargs["value"] = b
        elif name == "w":
            rv_kwargs["value"] = w
        elif name == "w":
            rv_kwargs["value"] = w2
        elif name == "z":
            rv_kwargs["value"] = z
        return rv_constructor(*rv_args, **rv_kwargs)

    return interceptor`


问:
SOCKET.IO returns status 400 when used in NGROK
So I am trying to create a NODE JS app that uses socket.io to transfer data from server to client. Locally, the socket connection works fine and it sends messages to the HTML file. When the server is started and NGROK is used to expose the server using NGROK, socket returns a 400 status which is a bad request status

So I've tried to use different devices to connect to the NGROK tunnel but every one of the request returns a 400 status.


问:
Spark Setup: Initialize Hive Metastore

Error: ERROR: permission denied for schema public
Position: 14 (state=42501,code=0)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

When I run this command got permission denied error:

```<code>/opt/hive/lib  $ schematool -dbType postgres -initSchema
</code>```

Title: Spark Setup: Initialize Hive Metastore

Body:
Error: ERROR: permission denied for schema public
Position: 14 (state=42501,code=0)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

When I run this command got permission denied error:

/opt/hive/lib  $ schematool -dbType postgres -initSchema


问:
Maven Problem - Failed to Look for File 501
Relatively unfamiliar with Maven.
Im trying to set up a shared project in my laptop.

I've heard there's apparently a security issue with the Maven Repo, so, in the pom.xml, I added this to the <repositories>

```<code>    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>

</code>```

But, on top of still getting a 501 error, this is what Im seeing:

```<code>Failed to look for file: http://repo.maven.apache.org/maven2/http://repo.maven.apache.org/maven2/org/codehaus/mojo/gwt-maven-plugin/2.4.0/gwt-maven-plugin-2.4.0.pom.
</code>```

Why is it appending to the URL instead of replacing it?

```<code>Failure to transfer org.codehaus.mojo:gwt-maven-plugin:pom:2.4.0 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.mojo:gwt-maven-plugin:pom:2.4.0 from/to central (http://repo.maven.apache.org/maven2): Failed to look for file: http://repo.maven.apache.org/maven2/http://repo.maven.apache.org/maven2/org/codehaus/mojo/gwt-maven-plugin/2.4.0/gwt-maven-plugin-2.4.0.pom.
</code>```

And this is the follow-up message.

Body:
Relatively unfamiliar with Maven.
Im trying to set up a shared project in my laptop.

I've heard there's apparently a security issue with the Maven Repo, so, in the pom.xml, I added this to the <repositories>

    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>

But, on top of still getting a 501 error, this is what Im seeing:

Failed to look for file: http://repo.maven.apache.org/maven2/http://repo.maven.apache.org/maven2/org/codehaus/mojo/gwt-maven-plugin/2.4.0/gwt-maven-plugin-2.4.0.pom.

Why is it appending to the URL instead of replacing it?

Failure to transfer org.codehaus.mojo:gwt-maven-plugin:pom:2.4.0 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.mojo:gwt-maven-plugin:pom:2.4.0 from/to central (http://repo.maven.apache.org/maven2): Failed to look for file: http://repo.maven.apache.org/maven2/http://repo.maven.apache.org/maven2/org/codehaus/mojo/gwt-maven-plugin/2.4.0/gwt-maven-plugin-2.4.0.pom.

And this is the follow-up message.


问:
I get some warnings when i use %llu as format specifier for unsigned long long with printf() function in C
I get some warnings from my IDE (Code:Blocks, Win64) when i use %llu as format specifier for unsigned long long in C with printf().

warning: unknown conversion type character 'l' in format
warning: too many arguments for format
```
<p>But <code>%llu</code> should be the right one for <code>unsigned long long</code>...</p>
```#include <stdio.h>

void fibonacciNumber(int n)
{
    unsigned long long fib1 = 0, fib2 = 1;

    if (n < 1)
        return;

    printf("%lld ", fib1);

    for (int i = 1; i < n; i++) {
        printf("%lld ", fib2);

        unsigned long long nextNum = fib1 + fib2;
        fib1 = fib2;
        fib2 = nextNum;
    }
}

int main()
{
    int numbers, clearBuffer;
    char answer;

    do
    {
        printf("Fibonacci sequence calculator - Enter a number :");
        scanf("%i",&numbers);

        fibonacciNumber(numbers);

        while ((clearBuffer = getchar()) != EOF && clearBuffer != '\n');

        printf("\n\nNew calculation? [y / n]");
        scanf("%c",&answer);

    }while ((answer == 'y') || (answer == 'Y'));

    return 0;
}
```

Body:
I get some warnings from my IDE (Code:Blocks, Win64) when i use %llu as format specifier for unsigned long long in C with printf().

warning: unknown conversion type character 'l' in format
warning: too many arguments for format

But %llu should be the right one for unsigned long long...

#include <stdio.h>

void fibonacciNumber(int n)
{
    unsigned long long fib1 = 0, fib2 = 1;

    if (n < 1)
        return;

    printf("%lld ", fib1);

    for (int i = 1; i < n; i++) {
        printf("%lld ", fib2);

        unsigned long long nextNum = fib1 + fib2;
        fib1 = fib2;
        fib2 = nextNum;
    }
}

int main()
{
    int numbers, clearBuffer;
    char answer;

    do
    {
        printf("Fibonacci sequence calculator - Enter a number :");
        scanf("%i",&numbers);

        fibonacciNumber(numbers);

        while ((clearBuffer = getchar()) != EOF && clearBuffer != '\n');

        printf("\n\nNew calculation? [y / n]");
        scanf("%c",&answer);

    }while ((answer == 'y') || (answer == 'Y'));

    return 0;
}


问:
Quarto not compiling: "file 'filepath' does not exist. problem with GDrive
I am currently exploring and have been using RMarkdown before that for quite some time. Today, working in the office - after working with the file with computer at home yesterday - the qmd file does not compile any more. I get the following message:

```<code>Error in tools::file_path_as_absolute(cwd) :
  file 'G:\My Drive\etc' does not exist
Calls: .main -> execute -> <Anonymous>
Execution halted
</code>```

It appears to be a problem with gdrive. when I save the file elsewhere, it does compile.

I was expecting compilation.

I tried updating all related packages.

Body:
I am currently exploring and have been using RMarkdown before that for quite some time. Today, working in the office - after working with the file with computer at home yesterday - the qmd file does not compile any more. I get the following message:

Error in tools::file_path_as_absolute(cwd) :
  file 'G:\My Drive\etc' does not exist
Calls: .main -> execute -> <Anonymous>
Execution halted

It appears to be a problem with gdrive. when I save the file elsewhere, it does compile.

I was expecting compilation.

I tried updating all related packages.


问:
How make a Rank Math sitemap to listing Dokan stores urls?
Is there any way to add Dokan stores urls to Rank Math sitemap? (for example make a stores-sitemap.xml included Dokan stores urls)

Thanks a lot
Regard

We can add custom urls to Rank Math sitemap by adding following filter to "wp-content/themes/theme-name/rank-math.php". But I need to add stores urls to sitemap dynamically.

```<code><?php
/**
 Filter to add extra URLs to the XML sitemap by type.
 *
 Only runs for the first page, not on all.
 *
 Just replace {$type} with either post or page, in case, if you want the URL to be included in the post or page sitemap respectively.
 *
 @param string $content String content to add, defaults to empty.
 */
add_action( 'rank_math/sitemap/{$type}_content', function() {
return '<url>
<loc>https://rankmath.com/some-custom-url/</loc>
<lastmod>2020-06-10T20:20:20+00:00</lastmod>
</url>';
});
?>
</code>```

Body:
Is there any way to add Dokan stores urls to Rank Math sitemap? (for example make a stores-sitemap.xml included Dokan stores urls)

Thanks a lot
Regard

We can add custom urls to Rank Math sitemap by adding following filter to "wp-content/themes/theme-name/rank-math.php". But I need to add stores urls to sitemap dynamically.

<?php
/**
 Filter to add extra URLs to the XML sitemap by type.
 *
 Only runs for the first page, not on all.
 *
 Just replace {$type} with either post or page, in case, if you want the URL to be included in the post or page sitemap respectively.
 *
 @param string $content String content to add, defaults to empty.
 */
add_action( 'rank_math/sitemap/{$type}_content', function() {
return '<url>
<loc>https://rankmath.com/some-custom-url/</loc>
<lastmod>2020-06-10T20:20:20+00:00</lastmod>
</url>';
});
?>


问:
How to install npm dependencies efficiently for multiple dockerized node.js projects in a monorepo?
I have a monorepo project, containing 10 packages let's say.
Each and every one of these packages has a Dockerfile, with a seprate npm install command. Each npm install command takes about 10 minutes on their own. Building all images takes 10 x 10 minutes, which is unacceptable.

What I came up with so far: Creating a Dockerfile where I copy the whole monorepo at the same time, do an npm install there, which takes only ~15 mins, since there's a lot of common depenendencies. From there I can just use this as the base image for all the other images. The only problem is, that this base image is 5 gigs, which is huge, because it ecapsulates the node_modules folder, which now contains ALL the dependencies from every project.

Copying only necessary folders from node_modules ? Is there a command in npm, that lists all the depdendencies for a package.json file (with all the peer dependendencies etc) so I can filter what I copy from the base image's node_modules folder to the final image (thus reducing size while not downloading common dependencies multiple times)? Maybe an already established tool that can do just that?

Boundling node_modules ?: Another idea I had is to bundle the app, which would only include in the finaly bundle the code the package actaully uses, so using multi-stage builds, the final image could be very small. This is what I'm already using with the frontend of the applicaiton (with Vite or CRA previously) but I have not managed to get it working for node.js. Presumably because pg-native might have some binaries, which can not be bundled. Nevertheless, it would be the BEST solution to bundle everything into a 5mb js file, and install only problematic dependencies afterwards like pg-native. I have not found any tutorial, description about this whatsoever, so I'm not terribly confident this can even be achieved, and I've got no clue ...why?

Ridiculously uneffective answers I've found so far include:

reducing dependencies - its not possible, checked 3 times with depcheck

installing only the prod dependencies - only saves a few mb-s nothing significant

using multi stage builds - it's a good solution to start a fresh image, if you have build artifacts in the "builder" image, but in my case, it does not reduce the node_moduels size, only in the frontend image, because there the node_modules are bundle to a js file, and not necessary during runtime.

using node:x-alpine image - using it already, it saves 500mb, but that's also insignificant compared to the 3-4gigs of node_modules I have to copy around everywhere.

Finally, a little explanation why this is important for me: I'm using Builx with a docker-container driver, which is necessary to take advantage of caching via gha or local caching types set via the --cache-to option. The docker-container driver has a very slow phase, called sending tarball, and it's directly related to image size. Downloading-uploading the cache from GHA-s cache storage is also very much effected by the cache size. So on paper, if we take ~600mb images, instead of ~4000mb images, the whole process could be speed up via 6-7x. That's a huge improvement, not even mentioning how cost effective that would be, since in the cloud everything is billed my seconds of computing power / storage used.

Cheers


问:
What does this Unicode Escape error mean?
When i try to run this code:

```<code>import os

path = "C:\Users\\"
dir_list = os.listdir(path)

print("Files and directories in '", path, "' :")
print(dir_list)

</code>```

I get this error:
(unicode error) 'unicodeescape' coded can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

What does it mean? How can i fix it?

Instead of printing the contents it just gives me this error every time.

Body:
When i try to run this code:

import os

path = "C:\Users\\"
dir_list = os.listdir(path)

print("Files and directories in '", path, "' :")
print(dir_list)

I get this error:
(unicode error) 'unicodeescape' coded can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

What does it mean? How can i fix it?

Instead of printing the contents it just gives me this error every time.


问:
Get npmAuthToken instead of npmAuthIdent from Azure DevOps to use with semantic-release and yarnv3
we probably have a really specific case. We are using

Private NPM registry on Azure DevOps

Yarn v1

Semantic-Release Monorepo (containing multiple packages. I think if it would only be one package, it would be ok)

Everything works fine and as expected, we now want to update to Yarn v3, but this is where the issue arises

semantic-release, per default, uses npm to create releases. It also uses .npmrc, if available to authenticate against the private registry.

However, since yarn v3, the .npmrc is not supported anymore, so it doesn't exist and also, while npm creates the same yarn.lock as yarn v1 it doesn't create the same yarn.lock as yarn v3

So, now we are facing the following issue

When running our pipeline our semantic-release fails, because it is changing the lockfile (we tested this locally, and the lockfile is indeed changed), because semantic-release internally uses npm with a plugin and this plugin which formats the yarn.lock to an outdated format and then fails to deploy multiple packages

To solve this, we found the following library https://github.com/dmeents/semantic-release-yarn/

however, this library requires that we set an NPM_TOKEN so yarn can authenticate with it.  With the npm plugin, it checked for an .npmrc and used this one to authenticate, but since this doens't exist anymore, the new package searches for NPM_TOKEN.

However, I have not found any way how too get NPM_TOKEN from Microsoft Azure DevOps. In the .yarnrc.yml we are using the npmAuthIdent which you can see here has the wrong format

```<code>Defines the authentication credentials to use by default when accessing your registries (equivalent to _auth in the v1). This settings is strongly discouraged in favor of npmAuthToken.
npmAuthIdent: "username:password"

Defines the authentication credentials to use by default when accessing your registries (equivalent to _authToken in the v1). If you're using npmScopes to define multiple registries, the npmRegistries dictionary allows you to override these credentials on a per-registry basis.
npmAuthToken: "ffffffff-ffff-ffff-ffff-ffffffffffff"
</code>```

https://yarnpkg.com/configuration/yarnrc#npmAuthIdent

As I see it, there are 3 possible solutions

Migrate back to yarn v1 (Least preferred solution)

Find out how to get such an npmAuthToken using Azure DevOps (Most preferred solution)

Create our own plugin for semantic-release to suppoort yarn in combination with Azure DevOps

Do you have any idea how to solve this or maybe someone already faced this issue?

Body:
we probably have a really specific case. We are using

Private NPM registry on Azure DevOps

Yarn v1

Semantic-Release Monorepo (containing multiple packages. I think if it would only be one package, it would be ok)

Everything works fine and as expected, we now want to update to Yarn v3, but this is where the issue arises

semantic-release, per default, uses npm to create releases. It also uses .npmrc, if available to authenticate against the private registry.

However, since yarn v3, the .npmrc is not supported anymore, so it doesn't exist and also, while npm creates the same yarn.lock as yarn v1 it doesn't create the same yarn.lock as yarn v3

So, now we are facing the following issue

When running our pipeline our semantic-release fails, because it is changing the lockfile (we tested this locally, and the lockfile is indeed changed), because semantic-release internally uses npm with a plugin and this plugin which formats the yarn.lock to an outdated format and then fails to deploy multiple packages

To solve this, we found the following library https://github.com/dmeents/semantic-release-yarn/

however, this library requires that we set an NPM_TOKEN so yarn can authenticate with it.  With the npm plugin, it checked for an .npmrc and used this one to authenticate, but since this doens't exist anymore, the new package searches for NPM_TOKEN.

However, I have not found any way how too get NPM_TOKEN from Microsoft Azure DevOps. In the .yarnrc.yml we are using the npmAuthIdent which you can see here has the wrong format

Defines the authentication credentials to use by default when accessing your registries (equivalent to _auth in the v1). This settings is strongly discouraged in favor of npmAuthToken.
npmAuthIdent: "username:password"

Defines the authentication credentials to use by default when accessing your registries (equivalent to _authToken in the v1). If you're using npmScopes to define multiple registries, the npmRegistries dictionary allows you to override these credentials on a per-registry basis.
npmAuthToken: "ffffffff-ffff-ffff-ffff-ffffffffffff"

https://yarnpkg.com/configuration/yarnrc#npmAuthIdent

As I see it, there are 3 possible solutions

Migrate back to yarn v1 (Least preferred solution)

Find out how to get such an npmAuthToken using Azure DevOps (Most preferred solution)

Create our own plugin for semantic-release to suppoort yarn in combination with Azure DevOps

Do you have any idea how to solve this or maybe someone already faced this issue?


问:
ATM Admin Panel System in Python
I have set up admin in the bank system and I want to add and remove users, but I can't. How can i do it?</p>
```<code>def adminmenu():
    print("--- Admin Menu ---")
    adminprocess = input(" Please enter a number of the settings operations supported: \n1. Add User\n2. Remove User\n3. Display all Users\n4. Exit Admin Menu\n>>>")
    if adminprocess == "3":
        print()
    if adminprocess == "4":
        return entry()
</code>```

Title: ATM Admin Panel System in Python

Body:
I have set up admin in the bank system and I want to add and remove users, but I can't. How can i do it?

def adminmenu():
    print("--- Admin Menu ---")
    adminprocess = input(" Please enter a number of the settings operations supported: \n1. Add User\n2. Remove User\n3. Display all Users\n4. Exit Admin Menu\n>>>")
    if adminprocess == "3":
        print()
    if adminprocess == "4":
        return entry()


问:
VsCode Extension API to get GitHub repository owner
I'm working on VSCode extension and need to get Github repository owner.

For example, for this repository https://github.com/microsoft/vscode/ Microsoft is repository owner.

Could you please help?

Thanks!


问:
How to do exceptional handling in Flink applications?
Want to implement the exceptional handling for errors and exceptions,how to achieve it? is there any document for this?

I search on this but I haven't find any official documentation for this.


问:
spring-authorization-server 1.0.1 / JPA (MySQL)
I'm trying to develop a spring-authorization-server 1.0.1 with Spring Boot 3 and JPA.
Does anyone have experience with it?

When I try to authenticate I get the error message:

No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken

Here is my AuthorizationServerConfig:

```<code>@Configuration(proxyBeanMethods = false)
public class AuthorizationServerConfig {

    @Autowired
    JpaRegisteredClientRepository jpaRegisteredClientRepository;

    private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationServerConfig.class);

    @Bean
    @Order(Ordered.HIGHEST_PRECEDENCE)
    /**
     * A Spring Security filter chain for the Protocol Endpoints.
     * aus Doku übernommen (1)
     */
    public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) throws Exception {

        OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);
        http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)
                .oidc(Customizer.withDefaults());   // Enable OpenID Connect 1.0
        http
                // Redirect to the login page when not authenticated from the
                // authorization endpoint
                .exceptionHandling((exceptions) -> exceptions
                        .authenticationEntryPoint(
                                new LoginUrlAuthenticationEntryPoint("/login"))
                )
                // Accept access tokens for User Info and/or Client Registration
                .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);

        return http.build();

    }

    @Bean
    @Order(2)
    /**
     * A Spring Security filter chain for authentication.
     */
    public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http)
            throws Exception {
        http
                .authorizeHttpRequests((authorize) -> authorize
                        .anyRequest().authenticated()
                )
                // Form login handles the redirect to the login page from the
                // authorization server filter chain
                .formLogin(Customizer.withDefaults());

        return http.build();
    }

    @Bean
    /**
     * An instance of UserDetailsService for retrieving users to authenticate.
     */
    public UserDetailsService userDetailsService() {
        UserDetails userDetails = User.withDefaultPasswordEncoder()
                .username("utilo")
                .password("utilo")
                .roles("USER")
                .build();

        return new InMemoryUserDetailsManager(userDetails);
    }

    /**
     *  An instance of RegisteredClientRepository for managing clients.
     * in Doku vorhanden (4)
     */
    @Bean
    @Primary
    public RegisteredClientRepository registeredClientRepository() {

        RegisteredClient client = jpaRegisteredClientRepository.findByClientId("utilo-client");
        List<RegisteredClient> registrations = new Vector<RegisteredClient>();
        registrations.add(client);

        InMemoryRegisteredClientRepository inMemoryRegisteredClientRepository
                = new InMemoryRegisteredClientRepository(registrations);
        return inMemoryRegisteredClientRepository;

    }

    /*
     * Generate the private/public key pair for signature of JWT.
     */
    @Bean
    /**
     * An instance of com.nimbusds.jose.jwk.source.JWKSource for signing access tokens.
     */
    public JWKSource<SecurityContext> jwkSource() {
        KeyPair keyPair = generateRsaKey();
        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
        RSAKey rsaKey = new RSAKey.Builder(publicKey)
                .privateKey(privateKey)
                .keyID(UUID.randomUUID().toString())
                .build();
        JWKSet jwkSet = new JWKSet(rsaKey);
        return new ImmutableJWKSet<>(jwkSet);
    }

    /**
     * An instance of java.security.KeyPair with keys generated on startup used to create the JWKSource above.
     */
    private static KeyPair generateRsaKey() {
        KeyPair keyPair;
        try {
            KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
            keyPairGenerator.initialize(2048);
            keyPair = keyPairGenerator.generateKeyPair();
        }
        catch (Exception ex) {
            throw new IllegalStateException(ex);
        }
        return keyPair;
    }

    @Bean
    /**
     *  An instance of JwtDecoder for decoding signed access tokens.
     */
    public JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {
        return OAuth2AuthorizationServerConfiguration.jwtDecoder(jwkSource);
    }

    @Bean
    /**
     * An instance of AuthorizationServerSettings to configure Spring Authorization Server.
     */
    public AuthorizationServerSettings authorizationServerSettings() {
        return AuthorizationServerSettings.builder().build();
    }

    @Bean
    PasswordEncoder passwordEncoder() {
        return PasswordEncoderFactories.createDelegatingPasswordEncoder();
    }

}
</code>```

Please let me know if more problem solving classes are needed.

Body:
I'm trying to develop a spring-authorization-server 1.0.1 with Spring Boot 3 and JPA.
Does anyone have experience with it?

When I try to authenticate I get the error message:

No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken

Here is my AuthorizationServerConfig:

@Configuration(proxyBeanMethods = false)
public class AuthorizationServerConfig {

    @Autowired
    JpaRegisteredClientRepository jpaRegisteredClientRepository;

    private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationServerConfig.class);

    @Bean
    @Order(Ordered.HIGHEST_PRECEDENCE)
    /**
     * A Spring Security filter chain for the Protocol Endpoints.
     * aus Doku übernommen (1)
     */
    public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) throws Exception {

        OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);
        http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)
                .oidc(Customizer.withDefaults());   // Enable OpenID Connect 1.0
        http
                // Redirect to the login page when not authenticated from the
                // authorization endpoint
                .exceptionHandling((exceptions) -> exceptions
                        .authenticationEntryPoint(
                                new LoginUrlAuthenticationEntryPoint("/login"))
                )
                // Accept access tokens for User Info and/or Client Registration
                .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);

        return http.build();

    }

    @Bean
    @Order(2)
    /**
     * A Spring Security filter chain for authentication.
     */
    public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http)
            throws Exception {
        http
                .authorizeHttpRequests((authorize) -> authorize
                        .anyRequest().authenticated()
                )
                // Form login handles the redirect to the login page from the
                // authorization server filter chain
                .formLogin(Customizer.withDefaults());

        return http.build();
    }

    @Bean
    /**
     * An instance of UserDetailsService for retrieving users to authenticate.
     */
    public UserDetailsService userDetailsService() {
        UserDetails userDetails = User.withDefaultPasswordEncoder()
                .username("utilo")
                .password("utilo")
                .roles("USER")
                .build();

        return new InMemoryUserDetailsManager(userDetails);
    }

    /**
     *  An instance of RegisteredClientRepository for managing clients.
     * in Doku vorhanden (4)
     */
    @Bean
    @Primary
    public RegisteredClientRepository registeredClientRepository() {

        RegisteredClient client = jpaRegisteredClientRepository.findByClientId("utilo-client");
        List<RegisteredClient> registrations = new Vector<RegisteredClient>();
        registrations.add(client);

        InMemoryRegisteredClientRepository inMemoryRegisteredClientRepository
                = new InMemoryRegisteredClientRepository(registrations);
        return inMemoryRegisteredClientRepository;

    }

    /*
     * Generate the private/public key pair for signature of JWT.
     */
    @Bean
    /**
     * An instance of com.nimbusds.jose.jwk.source.JWKSource for signing access tokens.
     */
    public JWKSource<SecurityContext> jwkSource() {
        KeyPair keyPair = generateRsaKey();
        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
        RSAKey rsaKey = new RSAKey.Builder(publicKey)
                .privateKey(privateKey)
                .keyID(UUID.randomUUID().toString())
                .build();
        JWKSet jwkSet = new JWKSet(rsaKey);
        return new ImmutableJWKSet<>(jwkSet);
    }

    /**
     * An instance of java.security.KeyPair with keys generated on startup used to create the JWKSource above.
     */
    private static KeyPair generateRsaKey() {
        KeyPair keyPair;
        try {
            KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
            keyPairGenerator.initialize(2048);
            keyPair = keyPairGenerator.generateKeyPair();
        }
        catch (Exception ex) {
            throw new IllegalStateException(ex);
        }
        return keyPair;
    }

    @Bean
    /**
     *  An instance of JwtDecoder for decoding signed access tokens.
     */
    public JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {
        return OAuth2AuthorizationServerConfiguration.jwtDecoder(jwkSource);
    }

    @Bean
    /**
     * An instance of AuthorizationServerSettings to configure Spring Authorization Server.
     */
    public AuthorizationServerSettings authorizationServerSettings() {
        return AuthorizationServerSettings.builder().build();
    }

    @Bean
    PasswordEncoder passwordEncoder() {
        return PasswordEncoderFactories.createDelegatingPasswordEncoder();
    }

}

Please let me know if more problem solving classes are needed.


问:
Proper way to create ISO file of .EXE setup
I have my own created .exe file which I want to boot from BIOS, so I created bootloader which is based on syslinux. Now I want to create ISO file which I can append to my bootloader so I can execute .exe from bootloader. I want help to create proper ISO of my program, which I can run from BIOS.
Thank You.</p>


问:
Google Map React component loses data when placed into divs
I have a working GoogleMapReact component that takes latitude and longitude, and places markers on the map.  The problem I face is I need to style the Marker component and when I place it into DIV  or any other html element, all markes lose their coordinates and are just in vertical row on the map.

Here is the code:

```<code>import React, { useState } from "react";
import GoogleMapReact from "google-map-react";
import getCenter from "geolib/es/getCenter";
import Marker from "../components/Marker";

function MapMe1({ searchResults }) {

  //transform the search results object into {latitude,longitude} format
  const coordinates = searchResults.map((result) => ({
    longitude: result.long,
    latitude: result.lat,
  }));

  const center = getCenter(coordinates);

  const [viewport, setViewport] = useState({
    width: "600px",
    height: "max-height: 75%",

    center: { lat: center.latitude, lng: center.longitude },

    zoom: 11,
  });

  return (
    <GoogleMapReact
      //mapContainerStyle={containerStyle}

      bootstrapURLKeys={{ key: process.env.google_maps_key }}
      {...viewport}
      onViewportChange={(nextViewport) => setViewport(nextViewport)}
    >
      {searchResults.map((result) => (
      // It works, but if I wrap this in <div> lat and lng no longer available...
        <Marker
          lat={result.lat}
          lng={result.long}
          offsetLeft={-20}
          offsetTop={-10}
          titles={result.title}
        />
      ))}
    </GoogleMapReact>
  );
}

export default MapMe1;

</code>```

I want to style the marker to show a tooltip but for some reason is the Marker component loses all  data. Why is this happening?

Body:
I have a working GoogleMapReact component that takes latitude and longitude, and places markers on the map.  The problem I face is I need to style the Marker component and when I place it into DIV  or any other html element, all markes lose their coordinates and are just in vertical row on the map.

Here is the code:

import React, { useState } from "react";
import GoogleMapReact from "google-map-react";
import getCenter from "geolib/es/getCenter";
import Marker from "../components/Marker";

function MapMe1({ searchResults }) {

  //transform the search results object into {latitude,longitude} format
  const coordinates = searchResults.map((result) => ({
    longitude: result.long,
    latitude: result.lat,
  }));

  const center = getCenter(coordinates);

  const [viewport, setViewport] = useState({
    width: "600px",
    height: "max-height: 75%",

    center: { lat: center.latitude, lng: center.longitude },

    zoom: 11,
  });

  return (
    <GoogleMapReact
      //mapContainerStyle={containerStyle}

      bootstrapURLKeys={{ key: process.env.google_maps_key }}
      {...viewport}
      onViewportChange={(nextViewport) => setViewport(nextViewport)}
    >
      {searchResults.map((result) => (
      // It works, but if I wrap this in
 lat and lng no longer available...
        <Marker
          lat={result.lat}
          lng={result.long}
          offsetLeft={-20}
          offsetTop={-10}
          titles={result.title}
        />
      ))}
    </GoogleMapReact>
  );
}

export default MapMe1;

I want to style the marker to show a tooltip but for some reason is the Marker component loses all  data. Why is this happening?


问:
Facing codeception/codeception error during composer installation
I am trying to install in my project with this terminal command but it gives error.
sudo composer install --ignore-platform-reqs -vvv

How can i solve this error.

Error:
Problem 1 - codeception/codeception[2.0.0-alpha, ..., 2.0.0-RC2] require symfony/yaml ~2.3 -> found symfony/yaml[v2.3.0, ..., 2.8.x-dev] but it conflicts with your root composer.json require (^3.4). - codeception/codeception[2.0.0, ..., 2.1.4] require symfony/yaml ~2.4 -> found symfony/yaml[v2.4.0-BETA1, ..., 2.8.x-dev] but it conflicts with your root composer.json require (^3.4). - codeception/codeception[2.1.7, ..., 2.1.8] require symfony/yaml >=2.5 <3.1 -> found symfony/yaml[v2.5.0-BETA1, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.0.x-dev] but it conflicts with your root composer.json require (^3.4). - codeception/codeception[2.1.9, ..., 2.1.11] require symfony/yaml >=2.5 <3.2 -> found symfony/yaml[v2.5.0-BETA1, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.1.x-dev] but it conflicts with your root composer.json require (^3.4). - codeception/codeception[2.0.0-RC, ..., 2.2.0-RC2] require symfony/yaml >=2.7 <3.1 -> found symfony/yaml[v2.7.0-BETA1, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.0.x-dev] but it conflicts with your root composer.json require (^3.4). - codeception/codeception[2.4.2, ..., 2.5.x-dev] require php >=5.6.0 <8.0 -> your php version (5.5.9; overridden via config.platform, actual: 7.4.33) does not satisfy that requirement. - roave/security-advisories dev-master conflicts with codeception/codeception <3.1.3|>=4,<4.1.22. - Root composer.json requires roave/security-advisories dev-master -> satisfiable by roave/security-advisories[dev-master]. - Root composer.json requires codeception/codeception ^2.0 -> satisfiable by codeception/codeception[2.0.0-alpha, ..., 2.5.x-dev].

I tried this.
sudo composer install --ignore-platform-reqs -vvv


问:
How to programmatically create non-web-application OAuth credential in google cloud project?
Intro:

It is possible to add several types of OAuth credentials to an app (brand) for given project in the google cloud console (gcc) web UI:

Dashboard | APIs & Services | Credentials | OAuth 2.0 Client IDs

+CREATE CREDENTIALS button, OAuth client ID)

followed by a selection of Application type (like web/desktop/iOS/etc...)

It is also possible to create the brand programmatically via the Identity Aware Proxy (IAP) API, method projects.brands.create.
Via that API, it is also possible to create so called IAP Client, which partly corresponds to the mentioned OAuth credential, method projects.brands.identityAwareProxyClients.create. Unfortunately, this results in a credential:

of web application type only,

non-editable (explicitly mentioned in docs, which still might be acceptable),

with no (or unknown) parameters, like e.g. redirect URIs.

First impression of such credential is: it's just useless.

Question:

Is there any API/Method (don't insist on IAP) that would allow replication of the actions available in the gcc web UI? Which means to create OAuth credential of any of the types available and having all the parameters configurable.


问:
Protovis map visualization: US+Canada
I'm trying to make a choropleth map which includes both US states and Canadian provinces on the same map and I'm having some issues dealing with the base map. Protovis comes with a dataset called us_lowres.js but there is no good corresponding Canadian dataset...

I have found this SVG map which I would like to use: http://upload.wikimedia.org/wikipedia/commons/5/55/BlankMap-USA-states-Canada-provinces%2C_HI_closer.svg but I want to color it using Protovis if at all possible.

The question is: how can I use the data in this SVG to create a map that protovis can understand? Protovis has functionality for Geographic scales but this SVG is just in whatever linear coordinate system it was drawn in, not lat/lng.

Any great ideas out there? :)

ContentLicense: CC BY-SA 3.0

Title: Protovis map visualization: US+Canada


问:
Custom iterator and std::sort function
I am working with c++11.I am have working on my custom iterator and i want to test it on std::sort function. Here is my code. i have tried to use (const &) a lot. It seems it didn't work.

main:

```<code>    PFArray<int> obj;
    obj.add(7);
    obj.add(1);
    obj.add(2);
    obj.add(3);
    obj.add(5);
    iterator_y<int> c;
    c =obj.begin();
    sort(obj.begin(),obj.end());
    for(c = obj.begin();c != obj.end();c++)
    {
        cout << *(c);
    }
</code>```

PFArray.hpp:

```<code>class PFArray
{
    public:
        PFArray();
        void read_sptr();
        int size();
        bool empty();
        void add(const T& eleman);
        iterator_y<T> begin();
        iterator_y<T> end();
        const iterator_y<T> cbegin()const;
        void clear();

    private:
        shared_ptr<T> m_ptr;
        int size_eleman=0;
};

template<class T>
PFArray<T>::PFArray()
{
    m_ptr = nullptr;
    size_eleman = 0;
    cout << "constructer done"<<endl;
}
template<class T>
void PFArray<T>::read_sptr()
{
    size_eleman =5;
    cout << "BB"<<endl;

}
template<class T>
iterator_y<T> PFArray<T>::begin()
{
    return iterator_y<T>(m_ptr);
}
template<class T>
int PFArray<T>::size()
{
    return size_eleman;
}
template<class T>
bool PFArray<T>::empty()
{
    if(m_ptr ==nullptr)
        return true;
    return false;
}
template<class T>
iterator_y<T> PFArray<T>::end()
{
    return iterator_y<T>(m_ptr) + size_eleman ;
}
template<class T>
void PFArray<T>::add(const T& eleman)
{
    auto it = this->begin();
    //m_ptr = shared_ptr<T>(new T [size_eleman+1]);
    //shared_ptr<T> temp = make_shared<T>(size_eleman+1);
    shared_ptr<T> temp =shared_ptr<T>(new T [size_eleman+1]);
    iterator_y<T> it2(temp);
    for(;it != this->end();++it,++it2)
    {
        *(it2) = *(it);
    }
    *(it2) = eleman;
    ++size_eleman;
    m_ptr = temp;
}
template<class T>
const iterator_y<T> PFArray<T>::cbegin()const
{
    const iterator_y<T> temp(m_ptr);
    return temp;
}
template<class T>
void PFArray<T>::clear()
{
    shared_ptr<T> obj;
    m_ptr = obj;
    size_eleman=0;
}
</code>```

and here is the my_iter.cpp:

```<code>class iterator_y
{
    public:
        iterator_y();
        iterator_y(const iterator_y<T> & obj);
        iterator_y(const shared_ptr<T>& x_ptr);
        /*----------------------------------------------------------------------*/
        iterator_y<T> operator + (const int & size_element);
        iterator_y<T> operator - (const int & num);
        iterator_y<T> operator++();
        iterator_y<T> operator++(int);
        iterator_y<T> operator--();
        iterator_y<T> operator--(int);
        bool operator<(const iterator_y<T>& obj);
        iterator_y<T> operator+=(int num);
        iterator_y<T> operator-=(int num);
        /*----------------------------------------------------------------------*/
        bool operator<=(const iterator_y<T>&obj)const;
        bool operator<(const iterator_y<T>&obj)const;
        bool operator>(const iterator_y<T>&obj)const;
        bool operator>=(const iterator_y<T>&obj)const;
        int operator-(const iterator_y<T>&);
        template <class Y> friend iterator_y<Y> operator+(int, const iterator_y<Y>&);
        /*************************************************************************/
        void operator=(const iterator_y<T>&& obj);
        void operator=(const iterator_y<T>& obj);
        bool operator != (const iterator_y<T>& diff);
        bool operator == (const iterator_y<T>& diff);
        /***********************************************/
        T& operator*();
        T& operator[](const int &);
        using   value_type = T;
        using   pointer = T*;
        using   reference = T&;
        using   difference_type = int;
        using   iterator_category = random_access_iterator_tag;
    private:
        T* ptr;
};

template<class T>
iterator_y<T>::iterator_y()
{
    ptr=nullptr;
}
template<class T>
iterator_y<T>::iterator_y(const shared_ptr<T>& x_ptr)
{
    ptr= x_ptr.get();
}
template<class T>
iterator_y<T> iterator_y<T>::operator+(const int& size_element)
{

    iterator_y<T> temp= *this;
    temp.ptr = this->ptr;
    temp.ptr +=size_element;
    return temp;
}
template<class T>
iterator_y<T> iterator_y<T>::operator++()
{
    ++ptr;
    return *(this);
}
template<class T>
bool iterator_y<T>::operator!=(const iterator_y<T>& diff)
{
    if(ptr != diff.ptr)
        return true;
    return false;
}
template<class T>
T& iterator_y<T>::operator*()
{
    return *(ptr);
}

template<class T>
bool iterator_y<T>::operator==(const iterator_y<T> &diff)
{
    if(ptr ==diff.ptr)
        return true;
    return false;
}

template<class T>
iterator_y<T> iterator_y<T>::operator--()
{
    ptr--;
    return (*this);
}
template<class T>
iterator_y<T> iterator_y<T>::operator++(int)
{
    iterator_y<T> temp = *this;
    ptr++;
    return temp;
}
template<class T>
iterator_y<T> iterator_y<T>::operator--(int)
{
    iterator_y<T> temp = *this;
    ptr--;
    return temp;
}
template<class T>
void iterator_y<T>::operator=(const iterator_y<T>& obj)
{
    ptr = obj.ptr;
}
template<class T>
void iterator_y<T>::operator=(const iterator_y<T>&& obj)
{
    ptr = obj.ptr;

}
template<class T>
iterator_y<T>::iterator_y(const iterator_y<T> & obj)
{
    ptr = obj.ptr;
}
template<class T>
iterator_y<T> iterator_y<T>::operator+=(int num)
{
    ptr += num;
    return *(this);
}
template<class T>
iterator_y<T> iterator_y<T>::operator-=(int num)
{
    ptr -=num;
    return *(this);
}
template<class T>
bool iterator_y<T>::operator<(const iterator_y<T>& obj)const
{
    T* temp =obj.ptr;
    if(*ptr<*temp)
        return true;
    return false;
}
template<class T>
bool iterator_y<T>::operator<=(const iterator_y<T>&obj) const
{
    T* temp = obj.ptr;
    if(*ptr<=*temp)
        return true;
    return false;
}
template<class T>
bool iterator_y<T>::operator>(const iterator_y<T>&obj)const
{
    T* temp = obj.ptr;
    if(*ptr>*temp)
        return true;
    return false;
}
template<class T>
bool iterator_y<T>::operator>=(const iterator_y<T>&obj)const
{
    T* temp = obj.ptr;
    if(*ptr>=*temp)
        return true;
    return false;
}
template<class T>
T& iterator_y<T>::operator[](const int &num)
{
    return ptr[num];
}
template<class T>
iterator_y<T> iterator_y<T>::operator-(const int&num)
{
    iterator_y<T> temp= *this;
    temp.ptr = this->ptr;
    temp.ptr -=num;
    return temp;
}
template<class T>
int iterator_y<T>::operator-(const iterator_y<T>& obj)
{
    int count;
    iterator_y<T> temp = *this;
    while(temp.ptr != obj.ptr)
    {
        temp++;
        count;
    }
    return count;
}
template <class Y>
iterator_y<Y> operator+(const int& num , const iterator_y<Y>& obj)
{
    iterator_y<Y> temp= obj;
    temp.ptr = obj.ptr;
    temp.ptr +=num;
    return temp;
}

</code>```

this is compiler error.

```<code>/usr/bin/ld: main.o: in function `void std::__heap_select<iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter>(iterator_y<int>, iterator_y<int>, iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter)':
main.cpp:(.text._ZSt13__heap_selectI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEEvT_S5_S5_T0_[_ZSt13__heap_selectI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEEvT_S5_S5_T0_]+0x86): undefined reference to `iterator_y<int>::operator<(iterator_y<int> const&)'
/usr/bin/ld: main.o: in function `iterator_y<int> std::__unguarded_partition<iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter>(iterator_y<int>, iterator_y<int>, iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter)':
main.cpp:(.text._ZSt21__unguarded_partitionI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEET_S5_S5_S5_T0_[_ZSt21__unguarded_partitionI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEET_S5_S5_S5_T0_]+0xf9): undefined reference to `iterator_y<int>::operator<(iterator_y<int> const&)'
collect2: error: ld returned 1 exit status
make: *** [makefile:6: main] Error 1

</code>```

I have tried use move elements and i tried to use (const &) but it seems it doesn't work.
Edit: i have changed the code i put the implementations into header files. Nothing has changed.

Title: Custom iterator and std::sort function

Body:
I am working with c++11.I am have working on my custom iterator and i want to test it on std::sort function. Here is my code. i have tried to use (const &) a lot. It seems it didn't work.

main:

    PFArray<int> obj;
    obj.add(7);
    obj.add(1);
    obj.add(2);
    obj.add(3);
    obj.add(5);
    iterator_y<int> c;
    c =obj.begin();
    sort(obj.begin(),obj.end());
    for(c = obj.begin();c != obj.end();c++)
    {
        cout << *(c);
    }

PFArray.hpp:

class PFArray
{
    public:
        PFArray();
        void read_sptr();
        int size();
        bool empty();
        void add(const T& eleman);
        iterator_y<T> begin();
        iterator_y<T> end();
        const iterator_y<T> cbegin()const;
        void clear();

    private:
        shared_ptr<T> m_ptr;
        int size_eleman=0;
};

template<class T>
PFArray<T>::PFArray()
{
    m_ptr = nullptr;
    size_eleman = 0;
    cout << "constructer done"<<endl;
}
template<class T>
void PFArray<T>::read_sptr()
{
    size_eleman =5;
    cout << "BB"<<endl;

}
template<class T>
iterator_y<T> PFArray<T>::begin()
{
    return iterator_y<T>(m_ptr);
}
template<class T>
int PFArray<T>::size()
{
    return size_eleman;
}
template<class T>
bool PFArray<T>::empty()
{
    if(m_ptr ==nullptr)
        return true;
    return false;
}
template<class T>
iterator_y<T> PFArray<T>::end()
{
    return iterator_y<T>(m_ptr) + size_eleman ;
}
template<class T>
void PFArray<T>::add(const T& eleman)
{
    auto it = this->begin();
    //m_ptr = shared_ptr<T>(new T [size_eleman+1]);
    //shared_ptr<T> temp = make_shared<T>(size_eleman+1);
    shared_ptr<T> temp =shared_ptr<T>(new T [size_eleman+1]);
    iterator_y<T> it2(temp);
    for(;it != this->end();++it,++it2)
    {
        *(it2) = *(it);
    }
    *(it2) = eleman;
    ++size_eleman;
    m_ptr = temp;
}
template<class T>
const iterator_y<T> PFArray<T>::cbegin()const
{
    const iterator_y<T> temp(m_ptr);
    return temp;
}
template<class T>
void PFArray<T>::clear()
{
    shared_ptr<T> obj;
    m_ptr = obj;
    size_eleman=0;
}

and here is the my_iter.cpp:

class iterator_y
{
    public:
        iterator_y();
        iterator_y(const iterator_y<T> & obj);
        iterator_y(const shared_ptr<T>& x_ptr);
        /*----------------------------------------------------------------------*/
        iterator_y<T> operator + (const int & size_element);
        iterator_y<T> operator - (const int & num);
        iterator_y<T> operator++();
        iterator_y<T> operator++(int);
        iterator_y<T> operator--();
        iterator_y<T> operator--(int);
        bool operator<(const iterator_y<T>& obj);
        iterator_y<T> operator+=(int num);
        iterator_y<T> operator-=(int num);
        /*----------------------------------------------------------------------*/
        bool operator<=(const iterator_y<T>&obj)const;
        bool operator<(const iterator_y<T>&obj)const;
        bool operator>(const iterator_y<T>&obj)const;
        bool operator>=(const iterator_y<T>&obj)const;
        int operator-(const iterator_y<T>&);
        template <class Y> friend iterator_y<Y> operator+(int, const iterator_y<Y>&);
        /*************************************************************************/
        void operator=(const iterator_y<T>&& obj);
        void operator=(const iterator_y<T>& obj);
        bool operator != (const iterator_y<T>& diff);
        bool operator == (const iterator_y<T>& diff);
        /***********************************************/
        T& operator*();
        T& operator[](const int &);
        using   value_type = T;
        using   pointer = T*;
        using   reference = T&;
        using   difference_type = int;
        using   iterator_category = random_access_iterator_tag;
    private:
        T* ptr;
};

template<class T>
iterator_y<T>::iterator_y()
{
    ptr=nullptr;
}
template<class T>
iterator_y<T>::iterator_y(const shared_ptr<T>& x_ptr)
{
    ptr= x_ptr.get();
}
template<class T>
iterator_y<T> iterator_y<T>::operator+(const int& size_element)
{

    iterator_y<T> temp= *this;
    temp.ptr = this->ptr;
    temp.ptr +=size_element;
    return temp;
}
template<class T>
iterator_y<T> iterator_y<T>::operator++()
{
    ++ptr;
    return *(this);
}
template<class T>
bool iterator_y<T>::operator!=(const iterator_y<T>& diff)
{
    if(ptr != diff.ptr)
        return true;
    return false;
}
template<class T>
T& iterator_y<T>::operator*()
{
    return *(ptr);
}

template<class T>
bool iterator_y<T>::operator==(const iterator_y<T> &diff)
{
    if(ptr ==diff.ptr)
        return true;
    return false;
}

template<class T>
iterator_y<T> iterator_y<T>::operator--()
{
    ptr--;
    return (*this);
}
template<class T>
iterator_y<T> iterator_y<T>::operator++(int)
{
    iterator_y<T> temp = *this;
    ptr++;
    return temp;
}
template<class T>
iterator_y<T> iterator_y<T>::operator--(int)
{
    iterator_y<T> temp = *this;
    ptr--;
    return temp;
}
template<class T>
void iterator_y<T>::operator=(const iterator_y<T>& obj)
{
    ptr = obj.ptr;
}
template<class T>
void iterator_y<T>::operator=(const iterator_y<T>&& obj)
{
    ptr = obj.ptr;

}
template<class T>
iterator_y<T>::iterator_y(const iterator_y<T> & obj)
{
    ptr = obj.ptr;
}
template<class T>
iterator_y<T> iterator_y<T>::operator+=(int num)
{
    ptr += num;
    return *(this);
}
template<class T>
iterator_y<T> iterator_y<T>::operator-=(int num)
{
    ptr -=num;
    return *(this);
}
template<class T>
bool iterator_y<T>::operator<(const iterator_y<T>& obj)const
{
    T* temp =obj.ptr;
    if(*ptr<*temp)
        return true;
    return false;
}
template<class T>
bool iterator_y<T>::operator<=(const iterator_y<T>&obj) const
{
    T* temp = obj.ptr;
    if(*ptr<=*temp)
        return true;
    return false;
}
template<class T>
bool iterator_y<T>::operator>(const iterator_y<T>&obj)const
{
    T* temp = obj.ptr;
    if(*ptr>*temp)
        return true;
    return false;
}
template<class T>
bool iterator_y<T>::operator>=(const iterator_y<T>&obj)const
{
    T* temp = obj.ptr;
    if(*ptr>=*temp)
        return true;
    return false;
}
template<class T>
T& iterator_y<T>::operator[](const int &num)
{
    return ptr[num];
}
template<class T>
iterator_y<T> iterator_y<T>::operator-(const int&num)
{
    iterator_y<T> temp= *this;
    temp.ptr = this->ptr;
    temp.ptr -=num;
    return temp;
}
template<class T>
int iterator_y<T>::operator-(const iterator_y<T>& obj)
{
    int count;
    iterator_y<T> temp = *this;
    while(temp.ptr != obj.ptr)
    {
        temp++;
        count;
    }
    return count;
}
template <class Y>
iterator_y<Y> operator+(const int& num , const iterator_y<Y>& obj)
{
    iterator_y<Y> temp= obj;
    temp.ptr = obj.ptr;
    temp.ptr +=num;
    return temp;
}

this is compiler error.

/usr/bin/ld: main.o: in function `void std::__heap_select<iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter>(iterator_y<int>, iterator_y<int>, iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter)':
main.cpp:(.text._ZSt13__heap_selectI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEEvT_S5_S5_T0_[_ZSt13__heap_selectI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEEvT_S5_S5_T0_]+0x86): undefined reference to `iterator_y<int>::operator<(iterator_y<int> const&)'
/usr/bin/ld: main.o: in function `iterator_y<int> std::__unguarded_partition<iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter>(iterator_y<int>, iterator_y<int>, iterator_y<int>, __gnu_cxx::__ops::_Iter_less_iter)':
main.cpp:(.text._ZSt21__unguarded_partitionI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEET_S5_S5_S5_T0_[_ZSt21__unguarded_partitionI10iterator_yIiEN9__gnu_cxx5__ops15_Iter_less_iterEET_S5_S5_S5_T0_]+0xf9): undefined reference to `iterator_y<int>::operator<(iterator_y<int> const&)'
collect2: error: ld returned 1 exit status
make: *** [makefile:6: main] Error 1

I have tried use move elements and i tried to use (const &) but it seems it doesn't work.
Edit: i have changed the code i put the implementations into header files. Nothing has changed.


问:
Is there a way to make a NxM table where each cell has two subcells on the bottom?
How do I make a NxM table where each cell has two rows and its second row has two columns, but by using rowspan or colspan? I want to make something like this:

Here is my attempt.

Artikal.php:

public function get_html()
{
    $html = "";
    $html .= "";

    if (isset($this->sifra) && isset($this->naziv) && isset($this->cena) && isset($this->kolicina)) {
        if ($this->kolicina > 0) {
            $html .= "naziv) . jpg\" width=\"100\">";
            $html .= "
";
            $html .= "{$this->sifra}";
            $html .= "{$this->cena} DIN";
        } else {
            $html .= "";
            $html .= "
";
            $html .= "{$this->sifra}";
            $html .= "{$this->cena} DIN";
        }
    } else {
        $html .= "";
        $html .= "
";
        $html .= "X";
        $html .= "X";
    }

    $html .= "	";
    return $html;
}
```
<p>index.php</p>
<pre class="lang-php prettyprint-override"><code>if (isset($artikli)) {
    for ($i = 0; $i < 6; $i++) {
        echo "<tr>";

        for ($j = 0; $j < 9; $j++)
            echo $artikli[$i * 9 + $j]->get_html();

        echo "</tr>";
    }
}
</code>```

Body:
How do I make a NxM table where each cell has two rows and its second row has two columns, but by using rowspan or colspan? I want to make something like this:

Here is my attempt.

Artikal.php:

public function get_html()
{
    $html = "";
    $html .= "";

    if (isset($this->sifra) && isset($this->naziv) && isset($this->cena) && isset($this->kolicina)) {
        if ($this->kolicina > 0) {
            $html .= "naziv) . jpg\" width=\"100\">";
            $html .= "
";
            $html .= "{$this->sifra}";
            $html .= "{$this->cena} DIN";
        } else {
            $html .= "";
            $html .= "
";
            $html .= "{$this->sifra}";
            $html .= "{$this->cena} DIN";
        }
    } else {
        $html .= "";
        $html .= "
";
        $html .= "X";
        $html .= "X";
    }

    $html .= "	";
    return $html;
}

index.php

if (isset($artikli)) {
    for ($i = 0; $i < 6; $i++) {
        echo "
";

        for ($j = 0; $j < 9; $j++)
            echo $artikli[$i * 9 + $j]->get_html();

        echo "
";
    }
}


问:
Laravel edit records
my problem is when I try to edit one of the records in my KeyController it not only edit record that I want but all the records connected by local_id. Variable $local is only for redirecting to previous page to show all the keys.

I want to change type, quantity and intercom password. id_klucza after request is correct.

```<code>public function potwierdzenie_edycji_kluczy(Request $request,$id_klucza)
{
    $klucze = klucze::where('id_klucza','=', $id_klucza)->first();
    $klucze->typ_klucza = $request->typ_klucza;
    $lokal=$klucze->id_lokalu;
    $klucze->ilosc_kluczy = $request->ilosc_kluczy;
    $klucze->kod_domofon = $request->kod_domofon;

    $klucze->save();
    return redirect('lista_kluczy/'.$lokal);
}
</code>```

Can you tell me what I'm doing wrong and what I can do to edit only one record I want no everything connected to it?

Title: Laravel edit records

Body:
my problem is when I try to edit one of the records in my KeyController it not only edit record that I want but all the records connected by local_id. Variable $local is only for redirecting to previous page to show all the keys.

I want to change type, quantity and intercom password. id_klucza after request is correct.

public function potwierdzenie_edycji_kluczy(Request $request,$id_klucza)
{
    $klucze = klucze::where('id_klucza','=', $id_klucza)->first();
    $klucze->typ_klucza = $request->typ_klucza;
    $lokal=$klucze->id_lokalu;
    $klucze->ilosc_kluczy = $request->ilosc_kluczy;
    $klucze->kod_domofon = $request->kod_domofon;

    $klucze->save();
    return redirect('lista_kluczy/'.$lokal);
}

Can you tell me what I'm doing wrong and what I can do to edit only one record I want no everything connected to it?


问:
number of display swiper items when loading is not correct in vue3 nuxt3 project
I create a base swiper component
I give it a default breakpoint that show 6 item in desktop but while loading,
first show 1 item and then 6 item
this is really bad for cls and screen will change

my packages: package.json

```<code>"devDependencies": {
    "@tailwindcss/typography": "^0.5.8",
    "autoprefixer": "^10.4.13",
    "nuxt": "3.0.0",
    "postcss": "^8.4.20",
    "postcss-extend": "^1.0.5",
    "tailwindcss": "^3.2.4"
  },
  "dependencies": {
    "@heroicons/vue": "^2.0.13",
    "@tailwindcss/aspect-ratio": "^0.4.2",
    "@tailwindcss/line-clamp": "^0.4.2",
    "@vueuse/core": "^9.8.2",
    "daisyui": "^2.46.0",
    "gsap": "^3.11.4",
    "swiper": "^8.4.5",
    "vee-validate": "^4.7.3",
    "yup": "^0.32.11"
  }
</code>```

this my base swiper component: Swiper.vue

```<code><template>
  <swiper :modules="modules" :navigation="!navigationHide" :breakpoints="breakPoints">
    <swiper-slide class="cursor-pointer" v-for="i in 10" :key="i">
      <slot></slot>
    </swiper-slide>
  </swiper>
</template>

<script setup>
// import Swiper core and required modules
import { Navigation, A11y } from "swiper";

// Import Swiper Vue.js components
import { Swiper, SwiperSlide } from "swiper/vue";

// Import Swiper styles
import "swiper/css";
import "swiper/css/navigation";

const modules = [A11y, Navigation]

const props = defineProps({
  breakPoints: {
    type: Object,

    default() {
      return {
        0: {

          slidesPerView: 1.85,
        },
        500: {
          slidesPerView: 2.15,
        },
        600: {
          slidesPerView: 2.75,
        },
        768: {
          slidesPerView: 3.5,
        },
        992: {
          slidesPerView: 4,
        },
        1024: {
          slidesPerView: 4.5,
        },
        1200: {
          slidesPerView: 5,
        },
        1440: {
          slidesOffsetBefore: 12,
          slidesPerView: 6,
        },
        1900: {
          slidesPerView: 7,
        },
      };
    },
  },

  navigationHide: {
    type: Boolean,
    default: false,
  }
});
</script>
</code>```

if I want to descice with image:
enter image description here

I want that eve while loading it should exactly that number item that I entered in breakpoint.
thank you for your attention

Body:
I create a base swiper component
I give it a default breakpoint that show 6 item in desktop but while loading,
first show 1 item and then 6 item
this is really bad for cls and screen will change

my packages: package.json

"devDependencies": {
    "@tailwindcss/typography": "^0.5.8",
    "autoprefixer": "^10.4.13",
    "nuxt": "3.0.0",
    "postcss": "^8.4.20",
    "postcss-extend": "^1.0.5",
    "tailwindcss": "^3.2.4"
  },
  "dependencies": {
    "@heroicons/vue": "^2.0.13",
    "@tailwindcss/aspect-ratio": "^0.4.2",
    "@tailwindcss/line-clamp": "^0.4.2",
    "@vueuse/core": "^9.8.2",
    "daisyui": "^2.46.0",
    "gsap": "^3.11.4",
    "swiper": "^8.4.5",
    "vee-validate": "^4.7.3",
    "yup": "^0.32.11"
  }

this my base swiper component: Swiper.vue

<template>
  <swiper :modules="modules" :navigation="!navigationHide" :breakpoints="breakPoints">
    <swiper-slide class="cursor-pointer" v-for="i in 10" :key="i">
      <slot></slot>
    </swiper-slide>
  </swiper>
</template>

if I want to descice with image:
enter image description here

I want that eve while loading it should exactly that number item that I entered in breakpoint.
thank you for your attention


问:
How do I keep the code clean (independent) from the dependencies like Sequelize or any other ORM?
Here is an example:
I am creating a Family Tree application, where a user can create a new Family, add members, add relationships like couples, children/parent etc.
I am trying to use SOLID principles and keep Entities (Family, Member, Couple Relationship, Ancestry Relationship) independent of the ORM.
If I use Sequelize (mysql) today, but in future I wish to switch to Mongoos(mongodb). How do I inject the dependency so that migration in the future would take minimum changes?</p>


问:
Python get/set port and identify it without communication
I am selecting a random port that all my applications can use to communicate on that changes each time.

s = socket(AF_INET, SOCK_STREAM)
s.bind(('', 0))
addr = s.getsockname()
port = addr[1]
s.close()
```

Now I'm looking for a good way for other scripts to find that port without prior communication in any form (on windows) using windows commands or API calls. Something like registering the port in registry but without requiring administrative privileges. (not that though as explained below). A named service port would be nice but I don't think that exists in windows.

I know I can use a temp file to store it but that seems like a cheap way to do it and will require some clean-up and error checking.

Currently I am using sys.argv and opening the scripts with the args sent but there are cases where the user will open them without args so its not the best solution for me.

I have also tried using netstat -a -o to get all used ports then using the PIDs from that searching though tasklist /fi pid eq ##### to get the name that matches what I'm looking for. However when developing the name is python.exe which can have multiple ports assigned and it also takes a long time to complete so I cannot use that either.

Body:
I am selecting a random port that all my applications can use to communicate on that changes each time.

s = socket(AF_INET, SOCK_STREAM)
s.bind(('', 0))
addr = s.getsockname()
port = addr[1]
s.close()

Now I'm looking for a good way for other scripts to find that port without prior communication in any form (on windows) using windows commands or API calls. Something like registering the port in registry but without requiring administrative privileges. (not that though as explained below). A named service port would be nice but I don't think that exists in windows.

I know I can use a temp file to store it but that seems like a cheap way to do it and will require some clean-up and error checking.

Currently I am using sys.argv and opening the scripts with the args sent but there are cases where the user will open them without args so its not the best solution for me.

I have also tried using netstat -a -o to get all used ports then using the PIDs from that searching though tasklist /fi pid eq ##### to get the name that matches what I'm looking for. However when developing the name is python.exe which can have multiple ports assigned and it also takes a long time to complete so I cannot use that either.


问:
IP allocation for a virtual network gateway in azure by using a dynamic block in terraform
How we can dynamically pass the values to a resource block in terraform through .tfvar files from a core module through a child module.
There are 2 modules 1) core module and 2) calling module

```<code>resource "azurerm_virtual_network_gateway" "this" {
  name                = var.name
  location            = var.location
  resource_group_name = var.rg
  type                = var.type
  sku                 = var.sku

  dynamic "ip_configuration" {
    for_each = var.ip_config
    content {
    name                          = ip_configuration.value.name
    public_ip_address_id          = ip_configuration.value.address_id
    subnet_id                     = ip_configuration.value.subnet_id
    }
  }
}
</code>```
```<code>variable "ip_config" {
  type = map(object({
    name       = string
    address_id = string
    subnet_id  = string
  }))
}
</code>```

calling module code:

```<code>module "vnet_gw" {
source = ""
for_each = var.vnet_gw
  name = each.value.name
  .
  .
  .
  ip_config = {
    ipconfig_name        = each.value.ip_config.ip_name
    public_ip_address_id = each.value.ip_config.addr_id
    subnet_id            = each.value.ip_config.s_id
  }
}
</code>```

variable.tf file for the calling module.

```<code>ip_config = list(object({

  ipconfig_name        = string
  public_ip_address_id = string
  subnet_id            = string

}))
</code>```

The tf var file to pass the values. The Ip section need to add multiple section.

```<code>vnet_gw {
  "vnet1" = {
    name : ""
    rg : ""
    .
    .
    .
  ip_config = {
    "ip_1" : {
      ip_name              = "test1"
      addr_id              = "<id>"
      s_id                 = "<id>"
  },
    "ip_2" : {
       ip_name              = "test2"
       addr_id              = "<id>"
       s_id                 = "<id>"
   }
  }
 }
}
</code>```

How ever getting the below error on execution plan

on main.tf line , in module "vnet_gw":
each.value.ip_config is map of object with 2 elements
This map does not have an element with the key "ip_name"
similar for public address id and subnet_id

Body:
How we can dynamically pass the values to a resource block in terraform through .tfvar files from a core module through a child module.
There are 2 modules 1) core module and 2) calling module

resource "azurerm_virtual_network_gateway" "this" {
  name                = var.name
  location            = var.location
  resource_group_name = var.rg
  type                = var.type
  sku                 = var.sku

  dynamic "ip_configuration" {
    for_each = var.ip_config
    content {
    name                          = ip_configuration.value.name
    public_ip_address_id          = ip_configuration.value.address_id
    subnet_id                     = ip_configuration.value.subnet_id
    }
  }
}

variable "ip_config" {
  type = map(object({
    name       = string
    address_id = string
    subnet_id  = string
  }))
}

calling module code:

module "vnet_gw" {
source = ""
for_each = var.vnet_gw
  name = each.value.name
  .
  .
  .
  ip_config = {
    ipconfig_name        = each.value.ip_config.ip_name
    public_ip_address_id = each.value.ip_config.addr_id
    subnet_id            = each.value.ip_config.s_id
  }
}

variable.tf file for the calling module.

ip_config = list(object({

  ipconfig_name        = string
  public_ip_address_id = string
  subnet_id            = string

}))

The tf var file to pass the values. The Ip section need to add multiple section.

vnet_gw {
  "vnet1" = {
    name : ""
    rg : ""
    .
    .
    .
  ip_config = {
    "ip_1" : {
      ip_name              = "test1"
      addr_id              = "<id>"
      s_id                 = "<id>"
  },
    "ip_2" : {
       ip_name              = "test2"
       addr_id              = "<id>"
       s_id                 = "<id>"
   }
  }
 }
}

How ever getting the below error on execution plan

on main.tf line , in module "vnet_gw":
each.value.ip_config is map of object with 2 elements
This map does not have an element with the key "ip_name"
similar for public address id and subnet_id