问:
How to apply shader to each shapes at their location?
I am playing with SFML and wrote a minimal program that draws a line behind the cursor.

I would like to make this line glow so I wrote a minimal shader that I apply to each line vertex. However, the maximum number of uniforms is about 4096. Instead, I would like to "run" my shader at each vertex position. Is there a better way other than using a global fragment and passing each position as uniforms?

```<code>#include <SFML/Graphics.hpp>
#include <boost/circular_buffer.hpp>
#include <iostream>
int main()
{
    const float winW = 1000;
    const float winH = 1000;
    const int tail_length = 100;
    sf::RenderWindow window(sf::VideoMode(winW, winH), "SFML");

    sf::VertexArray lines(sf::LinesStrip, tail_length);
    boost::circular_buffer<sf::Vector2i> tail(tail_length);

    sf::Clock clk;
    clk.restart();

    sf::Vector2i old_mouse_pos = sf::Vector2i(0, 0);

    // std::fill(tail.begin(), tail.end(), sf::Mouse::getPosition(window));
    sf::Texture tex;
    tex.create(winW, winH);
    sf::Sprite spr(tex);
    sf::Shader shader;
    shader.loadFromFile("glow.glsl", sf::Shader::Fragment);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        shader.setUniform("resolution", sf::Vector2f(40, 40));
        sf::Vector2i mousePos = sf::Mouse::getPosition(window);
        if (old_mouse_pos != mousePos)
            tail.push_back(mousePos);

        old_mouse_pos = sf::Vector2i(mousePos.x, mousePos.y);

        sf::Vector2f v[100];
        for (int i = 0; i < tail.size(); i++)
        {
            v[i] = sf::Vector2f(tail[i].x, tail[i].y- 2* winH / 2);
            lines[i].position = sf::Vector2f(tail[i].x, tail[i].y);
            lines[i].color = sf::Color(255, 0, 0, i * 255 / tail_length);
        }
        shader.setUniformArray("tail", v, tail.size());
        window.clear();
        window.draw(spr, &shader);
        window.draw(lines);
        window.display();
    }
}
</code>```

Here the shader:

```<code>uniform vec2 resolution;
uniform vec2 tail[100];

void main(void) {
    vec2 p = gl_FragCoord.xy / resolution.xy;
    float d = 0.0;
    for (int i = 0; i < 100; i++) {
        vec2 u = tail[i];
        vec2 q;
        q.x = p.x - u.x / resolution.x;
        q.y = p.y + u.y / resolution.y;
        float dist = pow(1.0/length(q) * 0.1, 1.5);
        d += dist;
    }
    vec3 col = d * vec3(1.0, 0.5, 0.25);
    gl_FragColor = vec4(1.0 - exp( -col ), 1.0);
}
</code>```

Body:
I am playing with SFML and wrote a minimal program that draws a line behind the cursor.

I would like to make this line glow so I wrote a minimal shader that I apply to each line vertex. However, the maximum number of uniforms is about 4096. Instead, I would like to "run" my shader at each vertex position. Is there a better way other than using a global fragment and passing each position as uniforms?

#include <SFML/Graphics.hpp>
#include <boost/circular_buffer.hpp>
#include <iostream>
int main()
{
    const float winW = 1000;
    const float winH = 1000;
    const int tail_length = 100;
    sf::RenderWindow window(sf::VideoMode(winW, winH), "SFML");

    sf::VertexArray lines(sf::LinesStrip, tail_length);
    boost::circular_buffer<sf::Vector2i> tail(tail_length);

    sf::Clock clk;
    clk.restart();

    sf::Vector2i old_mouse_pos = sf::Vector2i(0, 0);

    // std::fill(tail.begin(), tail.end(), sf::Mouse::getPosition(window));
    sf::Texture tex;
    tex.create(winW, winH);
    sf::Sprite spr(tex);
    sf::Shader shader;
    shader.loadFromFile("glow.glsl", sf::Shader::Fragment);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        shader.setUniform("resolution", sf::Vector2f(40, 40));
        sf::Vector2i mousePos = sf::Mouse::getPosition(window);
        if (old_mouse_pos != mousePos)
            tail.push_back(mousePos);

        old_mouse_pos = sf::Vector2i(mousePos.x, mousePos.y);

        sf::Vector2f v[100];
        for (int i = 0; i < tail.size(); i++)
        {
            v[i] = sf::Vector2f(tail[i].x, tail[i].y- 2* winH / 2);
            lines[i].position = sf::Vector2f(tail[i].x, tail[i].y);
            lines[i].color = sf::Color(255, 0, 0, i * 255 / tail_length);
        }
        shader.setUniformArray("tail", v, tail.size());
        window.clear();
        window.draw(spr, &shader);
        window.draw(lines);
        window.display();
    }
}

Here the shader:

uniform vec2 resolution;
uniform vec2 tail[100];

void main(void) {
    vec2 p = gl_FragCoord.xy / resolution.xy;
    float d = 0.0;
    for (int i = 0; i < 100; i++) {
        vec2 u = tail[i];
        vec2 q;
        q.x = p.x - u.x / resolution.x;
        q.y = p.y + u.y / resolution.y;
        float dist = pow(1.0/length(q) * 0.1, 1.5);
        d += dist;
    }
    vec3 col = d * vec3(1.0, 0.5, 0.25);
    gl_FragColor = vec4(1.0 - exp( -col ), 1.0);
}


来源: stackexchange

问:
Selenium grid with notes available through WireGuard
So I'm trying to setup an automated build and test flow, with Jenkins and Selenium grid on a central EC2-instance and nodes on physical machines located at my office.

I don't have port forwarding available at my office.

So I was thinking that I could use a VPN (not a proxy) to connect the machines, as though they were on the same network.

So my setup is currently:

The hub (EC2) with Wireguard

java -jar selenium-server-4.7.2.jar hub --host 0.0.0.0 --allow-cors true --bind-host false

A linux-laptop node

java -jar selenium-server-4.7.2.jar node --hub http://<wireguard-hub>:4444 --host <wireguard-ip> --port 5555 --bind-host false

A windows desktop node

java -jar selenium-server-4.7.2.jar node --hub http://<wireguard-hub>:4444 --host <wireguard-ip> --port 5555 --bind-host false

The nodes are able to do a GET-request to the hub and get a proper json response and the hub is able to do the opposite. But the Selenium software get stuck on [NodeServer$1.lambda$start$1] - Sending registration event....

I've tried running all parties with --log-level FINEST, but all I see is that the hub isn't receiving the request. Both from linux and windows.

I've tried running both nodes as hubs too and they are able to connect to themselves, but not each other (through WireGuard).

So can anyone tell me why I can, but at the same time can't, connect my grid?

EDIT (4. jan 2022):

I have now tried running the node on the same EC2-instance with docker as the Webdriver and that doesn't work either.

The node starts, connects to docker and gets stuck at the same spot.

This (in my mind) points to it being an issue with the EC2-instance.

For now I'll be running it in standalone mode, to get the rest of the pipeline working.

ContentLicense: CC BY-SA 4.0


问:
Zero validation accuracy
I try to classificate on traffic signs but 12 labels and 1380 pictures and I want a race car to react on the signs. For example, a stop sign, the car should stop.

It's a common problem but here's my output of the Epoch: "Epoch 10/10
35/35 [==============================] - 5s 136ms/step - loss: nan - accuracy: 0.0000e+00 - val_loss: nan - val_accuracy: 0.0000e+00"

Where's the problem? My optimizer, loss, metrics, shape, images, labels?

I tried to make various models but I dont think model is the problem, but something else.
Model 1: (https://i.stack.imgur.com/c1KDr.png)
Model 2: (https://i.stack.imgur.com/5ks4m.png)

Title: Zero validation accuracy


问:
How to edit existing file with quill editor?
I am using Quill Editor to create a document. I want to edit an existing document with in my application. how do I achieve this. Also how can I give some values initially to the quill controller. Something like this, TextEditingController(text:"example") When the textfield created the "example" text will be inserted to the text field. how can i achieve this with the quill editor. I want to insert a image and some text like name, age, contact number initially.

This is my code:

```<code>import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart';

class Editor extends StatefulWidget {
  const Editor({super.key});

  @override
  State<Editor> createState() => _EditorState();
}

class _EditorState extends State<Editor> {
  QuillController editorController = QuillController.basic();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Column(
        children: [
          const SizedBox(
            height: 50,
          ),
          QuillToolbar.basic(
            controller: editorController,
            toolbarIconAlignment: WrapAlignment.start,
            embedButtons: FlutterQuillEmbeds.buttons(
              onImagePickCallback: (file) async {
                return file.path;
              },
            ),
            iconTheme: QuillIconTheme(
                iconSelectedFillColor: Colors.green,
                iconUnselectedFillColor: Colors.grey.shade300),
          ),
          Expanded(
            child: Padding(
              padding: const EdgeInsets.fromLTRB(15, 15, 15, 0),
              child: QuillEditor.basic(
                  embedBuilders: FlutterQuillEmbeds.builders(),
                  controller: editorController,
                  readOnly: false),
            ),
          ),
        ],
      ),
    );
  }
}
</code>```

Body:
I am using Quill Editor to create a document. I want to edit an existing document with in my application. how do I achieve this. Also how can I give some values initially to the quill controller. Something like this, TextEditingController(text:"example") When the textfield created the "example" text will be inserted to the text field. how can i achieve this with the quill editor. I want to insert a image and some text like name, age, contact number initially.

This is my code:

import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart';

class Editor extends StatefulWidget {
  const Editor({super.key});

  @override
  State<Editor> createState() => _EditorState();
}

class _EditorState extends State<Editor> {
  QuillController editorController = QuillController.basic();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Column(
        children: [
          const SizedBox(
            height: 50,
          ),
          QuillToolbar.basic(
            controller: editorController,
            toolbarIconAlignment: WrapAlignment.start,
            embedButtons: FlutterQuillEmbeds.buttons(
              onImagePickCallback: (file) async {
                return file.path;
              },
            ),
            iconTheme: QuillIconTheme(
                iconSelectedFillColor: Colors.green,
                iconUnselectedFillColor: Colors.grey.shade300),
          ),
          Expanded(
            child: Padding(
              padding: const EdgeInsets.fromLTRB(15, 15, 15, 0),
              child: QuillEditor.basic(
                  embedBuilders: FlutterQuillEmbeds.builders(),
                  controller: editorController,
                  readOnly: false),
            ),
          ),
        ],
      ),
    );
  }
}


问:
Use random number of data for every epoch in pytorch-ligthining
I have big dataset with 25000 image and I want to my model could be select 1000 image randomly for each epoch and for each epoch only 1000 image be select and be train.
How can I do this in pytorch-lightning and in which part can I do this?(LightningDataModule in dataloader, LightningModule for describe model)</p>


问:
mnea GPS, how to decode() code in Python?
I have a code with GPS data but I can't make a nmea deposition from it? Can someone please help me?

```<code>import serial

class GPS:
    def __init__(self, port, ser):
        self.port = port
        self.ser = ser

        self.get_parseGPS()

    def get_parseGPS(self):
        import time
        #    print "raw:", data #prints raw data
        timer = int(input('Time of work [s]: '))
        start = time.time()
        work = 0
        while work < timer:
            self.data = self.ser.readline()              # ----> result 1
            # self.data = self.data.decode('latin-1')    # ----> result 2
            print(round(work, 1), 's', self.data)

            if self.data[0:6] == "$GPRMC":
                sdata = self.data.split(",")
                if sdata[2] == 'V':
                    print("no satellite data available")
                    return
                print("---Parsing GPRMC---")
                time = sdata[1][0:2] + ":" + sdata[1][2:4] + ":" + sdata[1][4:6]
                lat = self.get_decode(sdata[3])  # latitude
                dirLat = sdata[4]  # latitude direction N/S
                lon = self.get_decode(sdata[5])  # longitute
                dirLon = sdata[6]  # longitude direction E/W
                speed = sdata[7]  # Speed in knots
                trCourse = sdata[8]  # True course
                date = sdata[9][0:2] + "/" + sdata[9][2:4] + "/" + sdata[9][4:6]  # date
                print(f"time {time}, latitude {lat}, {dirLat}, {lon}, longitude {dirLon}, speed {speed}, True Course {trCourse}, Date {date}")

            end = time.time()
            work = end - start

    def get_decode(self, coord):
        # Converts DDDMM.MMMMM > DD deg MM.MMMMM min
        x = coord.split(".")
        head = x[0]
        tail = x[1]
        deg = head[0:-2]
        min = head[-2:]
        return print(deg + " deg " + min + "." + tail + " min")

if __name__=='__main__':
    port = "/dev/serial0"
    ser = serial.Serial(port, baudrate=921600, timeout=0.5)
    gps = GPS(port, ser)
    print(gps.get_parseGPS())
</code>```

--- result 1: (excerpt)

```<code>...
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10L\x02\n'
0.0 s b'3DA\x83\xc3q\xc0\x1cXv\xbe\xa9\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10O\x02\n'
0.0 s b'3DA\x84\xc0q\xc0-{v\xbe\xa5\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10Q\x02\n'
0.0 s b'3DA\x02\xc4q\xc0\xa1\xe3v\xbe\xb2\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10T\x02\n'
0.0 s b'3DA\x0e\xc4q\xc0\xb40w\xbe\xa5\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10V\x02\n'
0.0 s b'3DA\x1d\xc1q\xc0\x19xw\xbe\xb2\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10Y\x02\n'
0.0 s b'3DA6\xc0q\xc0\xda;w\xbe\xac\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.0 s b'3DT\x0c\x0c\x10[\x02\n'
0.0 s b'3DAo\xc0q\xc0\xc0!w\xbe\x89\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10^\x02\n'
0.1 s b'3DA\x91\xc2q\xc0w\x07w\xbeh\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10`\x02\n'
0.1 s b'3DA\xfe\xc4q\xc0\x9d\xebv\xbeZ\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10c\x02\n'
0.1 s b'3DA+\xc6q\xc0\xfe\xe1v\xbea\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10e\x02\n'
0.1 s b'3DA}\xc6q\xc0\xf4\xfbv\xbea\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
...
</code>```

--- result 2: (excerpt)

```<code>0.1 s 3DGô/,§7òËÁ

0.1 s 3DT×

0.1 s 3DA|sÀ¢k¾vÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTÙ

0.1 s 3DAysÀ¥k¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTÜ

0.1 s 3DA$zsÀG¦k¾}ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTÞ

0.1 s 3DA|sÀÈªk¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTá

0.1 s 3DAt{sÀ»Îk¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTã

0.1 s 3DAÊvsÀaík¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTæ

0.1 s 3DAótsÀl¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTè

0.1 s 3DA¡wsÀjl¾¥ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTë

0.1 s 3DAùysÀl¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTí

0.1 s 3DA·~sÀÞl¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTð
</code>```

I don't know how to decode it properly to get this data & and I don't know how to make str(nmea) out of i:
example from the internet

Thank you in advance for your help

Body:
I have a code with GPS data but I can't make a nmea deposition from it? Can someone please help me?

import serial

class GPS:
    def __init__(self, port, ser):
        self.port = port
        self.ser = ser

        self.get_parseGPS()

    def get_parseGPS(self):
        import time
        #    print "raw:", data #prints raw data
        timer = int(input('Time of work [s]: '))
        start = time.time()
        work = 0
        while work < timer:
            self.data = self.ser.readline()              # ----> result 1
            # self.data = self.data.decode('latin-1')    # ----> result 2
            print(round(work, 1), 's', self.data)

            if self.data[0:6] == "$GPRMC":
                sdata = self.data.split(",")
                if sdata[2] == 'V':
                    print("no satellite data available")
                    return
                print("---Parsing GPRMC---")
                time = sdata[1][0:2] + ":" + sdata[1][2:4] + ":" + sdata[1][4:6]
                lat = self.get_decode(sdata[3])  # latitude
                dirLat = sdata[4]  # latitude direction N/S
                lon = self.get_decode(sdata[5])  # longitute
                dirLon = sdata[6]  # longitude direction E/W
                speed = sdata[7]  # Speed in knots
                trCourse = sdata[8]  # True course
                date = sdata[9][0:2] + "/" + sdata[9][2:4] + "/" + sdata[9][4:6]  # date
                print(f"time {time}, latitude {lat}, {dirLat}, {lon}, longitude {dirLon}, speed {speed}, True Course {trCourse}, Date {date}")

            end = time.time()
            work = end - start

    def get_decode(self, coord):
        # Converts DDDMM.MMMMM > DD deg MM.MMMMM min
        x = coord.split(".")
        head = x[0]
        tail = x[1]
        deg = head[0:-2]
        min = head[-2:]
        return print(deg + " deg " + min + "." + tail + " min")

if __name__=='__main__':
    port = "/dev/serial0"
    ser = serial.Serial(port, baudrate=921600, timeout=0.5)
    gps = GPS(port, ser)
    print(gps.get_parseGPS())

--- result 1: (excerpt)

...
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10L\x02\n'
0.0 s b'3DA\x83\xc3q\xc0\x1cXv\xbe\xa9\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10O\x02\n'
0.0 s b'3DA\x84\xc0q\xc0-{v\xbe\xa5\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10Q\x02\n'
0.0 s b'3DA\x02\xc4q\xc0\xa1\xe3v\xbe\xb2\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10T\x02\n'
0.0 s b'3DA\x0e\xc4q\xc0\xb40w\xbe\xa5\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10V\x02\n'
0.0 s b'3DA\x1d\xc1q\xc0\x19xw\xbe\xb2\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c4\xcd\xce\xc1\n'
0.0 s b'3DT\x0c\x0c\x10Y\x02\n'
0.0 s b'3DA6\xc0q\xc0\xda;w\xbe\xac\xb6\xee\xc2\n'
0.0 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.0 s b'3DT\x0c\x0c\x10[\x02\n'
0.0 s b'3DAo\xc0q\xc0\xc0!w\xbe\x89\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10^\x02\n'
0.1 s b'3DA\x91\xc2q\xc0w\x07w\xbeh\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10`\x02\n'
0.1 s b'3DA\xfe\xc4q\xc0\x9d\xebv\xbeZ\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10c\x02\n'
0.1 s b'3DA+\xc6q\xc0\xfe\xe1v\xbea\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
0.1 s b'3DT\x0c\x0c\x10e\x02\n'
0.1 s b'3DA}\xc6q\xc0\xf4\xfbv\xbea\xb6\xee\xc2\n'
0.1 s b'3DG\x8d\xf4/\x1f,\xa7\x8c\x0c\xbb\x1a\xcf\xc1\n'
...

--- result 2: (excerpt)

0.1 s 3DGô/,§7òËÁ

0.1 s 3DT×

0.1 s 3DA|sÀ¢k¾vÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTÙ

0.1 s 3DAysÀ¥k¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTÜ

0.1 s 3DA$zsÀG¦k¾}ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTÞ

0.1 s 3DA|sÀÈªk¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTá

0.1 s 3DAt{sÀ»Îk¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTã

0.1 s 3DAÊvsÀaík¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTæ

0.1 s 3DAótsÀl¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTè

0.1 s 3DA¡wsÀjl¾¥ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTë

0.1 s 3DAùysÀl¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTí

0.1 s 3DA·~sÀÞl¾ÙîÂ

0.1 s 3DGô/,§7òËÁ

0.1 s 3DTð

I don't know how to decode it properly to get this data & and I don't know how to make str(nmea) out of i:
example from the internet

Thank you in advance for your help


问:
How do I export complex json data to excel/google sheet
I am getting the following Json string from Firebase Realtime database.

```<code>{
  'algotable': {
    '-NJ6blqyqu8RgjvdQJyT': {
      'actual': '123',
      'cipher': '39bc62c2ad990f494e0ad2b5715a3f05',
      'decrypted': '123'
    },
    '-NJ6bmsPnb1GNi_jYyPb': {
      'actual': 'abcd',
      'cipher': '39bc62c2ad990f494e0ad2b5715a3f05',
      'decrypted': 'abcd',
    }
  }
}
</code>```

I tried importing json file in micrsoft excel but it shows only two columns without any data i.e. algotable,records

I tried google appscript

```<code>console.log(string1.algotable.getData);
</code>```

but I don't get any output because object inside algotable always changes its name whenever I push an object through android-java as below

```<code> public String writeNewRecordEncrypt(Algotable algotable) {
        DatabaseReference pushref = mDatabase.push();
        pushref.setValue(algotable);
        return pushref.getKey();
    }
</code>```

please help me amend this. thanks in advance

Body:
I am getting the following Json string from Firebase Realtime database.

{
  'algotable': {
    '-NJ6blqyqu8RgjvdQJyT': {
      'actual': '123',
      'cipher': '39bc62c2ad990f494e0ad2b5715a3f05',
      'decrypted': '123'
    },
    '-NJ6bmsPnb1GNi_jYyPb': {
      'actual': 'abcd',
      'cipher': '39bc62c2ad990f494e0ad2b5715a3f05',
      'decrypted': 'abcd',
    }
  }
}

I tried importing json file in micrsoft excel but it shows only two columns without any data i.e. algotable,records

I tried google appscript

console.log(string1.algotable.getData);

but I don't get any output because object inside algotable always changes its name whenever I push an object through android-java as below

 public String writeNewRecordEncrypt(Algotable algotable) {
        DatabaseReference pushref = mDatabase.push();
        pushref.setValue(algotable);
        return pushref.getKey();
    }

please help me amend this. thanks in advance


问:
How to transform multiple files with in sub-directories using XSLT?
For example, there are chapter1 and chapter2 sub-folders inside parent folder, named:"S9ml". In both sub-directories:Chapter1 and Chapter2 has many .htmls. I want to transform all these .html' to remove white-spacing or Strip-white spacing. How do I do it? Please do help on how to run using Oxygen Editor?

```<code><?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="no" />

<xsl:template match="*">
   <xsl:copy>
      <xsl:copy-of select="@*" />
      <xsl:apply-templates />
   </xsl:copy>
</xsl:template>

<xsl:template match="comment()|processing-instruction()">
   <xsl:copy />
</xsl:template>

</xsl:stylesheet>

</code>```

I tried this but in config transform, when I select the ${cfdu} getting, your access is denied.

Body:
For example, there are chapter1 and chapter2 sub-folders inside parent folder, named:"S9ml". In both sub-directories:Chapter1 and Chapter2 has many .htmls. I want to transform all these .html' to remove white-spacing or Strip-white spacing. How do I do it? Please do help on how to run using Oxygen Editor?

<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" indent="no" />

<xsl:template match="*">
   <xsl:copy>
      <xsl:copy-of select="@*" />
      <xsl:apply-templates />
   </xsl:copy>
</xsl:template>

<xsl:template match="comment()|processing-instruction()">
   <xsl:copy />
</xsl:template>

</xsl:stylesheet>

I tried this but in config transform, when I select the ${cfdu} getting, your access is denied.


问:
KLT-Tracker: How to avoid losing detected person on recalibration
Reading from the ground truth, I have an initial bounding box. I then calculate a foreground mask and use cv2.goodFeaturesToTrack to get points I can follow using cv2.calcOpticalFlowPyrLK. I calculate the bounding box by taking the largest possible rectangle going through the out-most points (roughly as described here: # How to efficiently find the bounding box of a collection of points? )

However, every now and then I need to recalculate the goodFeaturesToTrack to avoid the person "losing" all the points over time.

Whenever recalculating, points may land on other people, if they stand within the bounding box of the person to track. They will now be followed, too. Due to that my bounding box fails to be of any use after such a recalculation. What are some methods to avoid such a behavior?

I am looking for resources and general explanations and not specific implementations.

Ideas I had

Take the size of the previous bounding box divided by the current bounding box size into account and ignore if size changes too much.

Take the previous white-fullness of the foreground mask divided by the current white-fullness of the foreground mask into account. Do not re-calculate the bounding box if the foreground mask is too full. Other people are probably crossing the box.

Calculate a general movement vector for the bounding box from the median of all points calculated using optical flow. Alter the bounding box only within some relation to the vector to avoid rapid changes of the bounding box.

Filter the found good features to track points using some additional metric.

In general I am looking for a method that calculates new goodFeaturesToTrack based stronger on the previous goodFeaturesToTrack or the points derived from that using optical flow, I guess.


问:
How to add larger navigation title for macOS like in iOS
htpA here!
I am a newbie of SwiftUI programming and I am just trying to add a navigation title for macOS like in iOS. I tried many things but it didn't seem to be working. I hope anyone would answer it quickly.

Here's my code

```<code>import SwiftUI

struct ContentView: View {
    var body: some View {
        NavigationView {
            List {
                Spacer()
                NavigationLink(destination: LatestEpisodes()) {
                    Menu1()
                }
                .frame(minWidth: 110)
                .frame(maxWidth: 110)
            }
            Text("Content")
        }
        .navigationTitle("Hello!")
        .frame(minWidth: 900)
        .listStyle(SidebarListStyle())
    }
}

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

struct Menu1: View {
    var body: some View {
        VStack {
            Image(systemName: "1.circle.fill")
            Text("Menu1")
        }
        .frame(width: 90, height: 90)
        .padding(10)
    }
}

</code>```

Body:
htpA here!
I am a newbie of SwiftUI programming and I am just trying to add a navigation title for macOS like in iOS. I tried many things but it didn't seem to be working. I hope anyone would answer it quickly.

Here's my code

import SwiftUI

struct ContentView: View {
    var body: some View {
        NavigationView {
            List {
                Spacer()
                NavigationLink(destination: LatestEpisodes()) {
                    Menu1()
                }
                .frame(minWidth: 110)
                .frame(maxWidth: 110)
            }
            Text("Content")
        }
        .navigationTitle("Hello!")
        .frame(minWidth: 900)
        .listStyle(SidebarListStyle())
    }
}

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

struct Menu1: View {
    var body: some View {
        VStack {
            Image(systemName: "1.circle.fill")
            Text("Menu1")
        }
        .frame(width: 90, height: 90)
        .padding(10)
    }
}


问:
How can i refresh header from a OkHttp on a connection
When using OKHTTP with retrofit and interceptor, the connection remains. If I make an inquiry to the same URL, all headers remain and are used for the request. But it is necessary for me to exchange the token. But how can I change the header if you have another request to the server? Or does it make sense to stop all OKHTTP connections?

```<code>
public class RetrofitClient {
    private static Retrofit retrofit = null;

    public static Retrofit getClient(String baseUrl, String token) {
        if (retrofit == null) {

            String auth = "Bearer " + token;
            String cont = "application/json";

            OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder();

            okHttpClient.addInterceptor(chain -> {
                Request request = chain.request().newBuilder()
                        .addHeader("Authorization", auth)
                        .addHeader("Content-Type", cont)
                        .build();
                return chain.proceed(request);
            });

            retrofit = new Retrofit.Builder()
                    .baseUrl(baseUrl)
                    .addConverterFactory(GsonConverterFactory.create())
                    .client(okHttpClient.build())
                    .build();
        }
        return retrofit;
    }

</code>```

How can I update the token in the header in the existing connection to send a new request with the same URL?

How can I end the existing OKHTTP connection to create a new request?

Solution found: I have the line: if (retrofit == null) {
turned off. And it works!

Body:
When using OKHTTP with retrofit and interceptor, the connection remains. If I make an inquiry to the same URL, all headers remain and are used for the request. But it is necessary for me to exchange the token. But how can I change the header if you have another request to the server? Or does it make sense to stop all OKHTTP connections?

public class RetrofitClient {
    private static Retrofit retrofit = null;

    public static Retrofit getClient(String baseUrl, String token) {
        if (retrofit == null) {

            String auth = "Bearer " + token;
            String cont = "application/json";

            OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder();

            okHttpClient.addInterceptor(chain -> {
                Request request = chain.request().newBuilder()
                        .addHeader("Authorization", auth)
                        .addHeader("Content-Type", cont)
                        .build();
                return chain.proceed(request);
            });

            retrofit = new Retrofit.Builder()
                    .baseUrl(baseUrl)
                    .addConverterFactory(GsonConverterFactory.create())
                    .client(okHttpClient.build())
                    .build();
        }
        return retrofit;
    }

How can I update the token in the header in the existing connection to send a new request with the same URL?

How can I end the existing OKHTTP connection to create a new request?

Solution found: I have the line: if (retrofit == null) {
turned off. And it works!


问:
Configure logging in AWS Step Functions Local
I am using AWS Step Functions Local for testing Step Functions on my local machine, but the level of logging has significantly increased the time for my test suite to run. I cannot find any configuration options on the AWS website to control the log level so I have been trying to roll my own with no success.

The logging I am trying to hide looks like this:

```<code>2022-12-15 12:11:36.562: CreateStateMachine => {"requestClientOptions":{"readLimit":131073,"skipAppendUriPath":false},"requestMetricCollector":null,"customRequestHeaders":null,"customQueryParameters":null,"cloneSource":null,"sdkRequestTimeout":null,"sdkClientExecutionTimeout":null,"name":"<MY STEP FUNCTION NAME","definition":"{MY STEP FUNCTION DEFINITION}"...}

2022-12-15 12:11:36.782: [200] CreateStateMachine <= {"sdkResponseMetadata":null,"sdkHttpMetadata":null,"stateMachineArn":"arn:aws:states:eu-west-1:123456789012:stateMachine:MY_STEP_FUNCTION_NAME","creationDate":1671106296763}
</code>```

I downloaded the Zip file containing the Step Functions Local JAR file, extracted the zip file, extracted StepFunctionsLocal.jar, and found there was a log4j.properties file. "Excellent!", I thought, I can provide my own configuration file and it will be great. So I created a Docker image with the following Dockerfile:

```<code>FROM amazoncorretto:11

WORKDIR /jar
COPY . /jar

RUN yum -y install unzip zip && yum -y clean all && rm -rf /var/cache

RUN mkdir -p /jar/extracted
RUN unzip StepFunctionsLocal.zip -d /jar/extracted

ENV SFN_MOCK_CONFIG=""
ENV LAMBDA_ENDPOINT=""
ENV AWS_DEFAULT_REGION=""

EXPOSE 8083

CMD ["java", "-Dlog4j2.configurationFile=file:/jar/log4j.properties", "-jar", "/jar/extracted/StepFunctionsLocal.jar"]
</code>```

With the following log4.properties file which is in the same directory as the Dockerfile:

```<code>
 # console is set to be a ConsoleAppender.
 log4j.appender.console=org.apache.log4j.ConsoleAppender

 # console uses PatternLayout.
 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

 log4j.appender.APPLOG=amazon.platform.logging.PeriodicConcurrentFileAppender
 log4j.appender.APPLOG.layout=amazon.platform.logging.SanitizingPatternLayout
 log4j.appender.APPLOG.File=../logs/application.log

 log4j.appender.APPLOG.DatePattern='.'yyyy-MM-dd-HH
 log4j.appender.APPLOG.layout.ConversionPattern=%p %d{D/HH:mm:ss:SSS} %t %c - %m%n

 # Set root logger level to INFO and its only appender to console.
 log4j.rootLogger=ERROR, APPLOG

 #log4j.logger.com.amazon.coral.reflect=WARN
 #log4j.logger.httpclient.wire=OFF
 # Enable this to see everything that httpclient does.
 #log4j.logger.org.apache.commons.httpclient=WARN
 #log4j.logger.org.springframework=WARN
 #log4j.logger.org.apache=WARN
 #log4j.logger.com.amazonaws.swf.console=ERROR
 #log4j.logger.com.amazonaws.console.auth=ERROR
</code>```

This is the same file I found in the extracted StepFunctionsLocal.jar except all of the lines which configure the log level have been commented out and the root logger level set to ERROR.

I built the image and ran it, but the same logging still appeared. At this point I'm stumped. Am I going about this the right way? Have I missed something obvious?

Body:
I am using AWS Step Functions Local for testing Step Functions on my local machine, but the level of logging has significantly increased the time for my test suite to run. I cannot find any configuration options on the AWS website to control the log level so I have been trying to roll my own with no success.

The logging I am trying to hide looks like this:

2022-12-15 12:11:36.562: CreateStateMachine => {"requestClientOptions":{"readLimit":131073,"skipAppendUriPath":false},"requestMetricCollector":null,"customRequestHeaders":null,"customQueryParameters":null,"cloneSource":null,"sdkRequestTimeout":null,"sdkClientExecutionTimeout":null,"name":"<MY STEP FUNCTION NAME","definition":"{MY STEP FUNCTION DEFINITION}"...}

2022-12-15 12:11:36.782: [200] CreateStateMachine <= {"sdkResponseMetadata":null,"sdkHttpMetadata":null,"stateMachineArn":"arn:aws:states:eu-west-1:123456789012:stateMachine:MY_STEP_FUNCTION_NAME","creationDate":1671106296763}

I downloaded the Zip file containing the Step Functions Local JAR file, extracted the zip file, extracted StepFunctionsLocal.jar, and found there was a log4j.properties file. "Excellent!", I thought, I can provide my own configuration file and it will be great. So I created a Docker image with the following Dockerfile:

FROM amazoncorretto:11

WORKDIR /jar
COPY . /jar

RUN yum -y install unzip zip && yum -y clean all && rm -rf /var/cache

RUN mkdir -p /jar/extracted
RUN unzip StepFunctionsLocal.zip -d /jar/extracted

ENV SFN_MOCK_CONFIG=""
ENV LAMBDA_ENDPOINT=""
ENV AWS_DEFAULT_REGION=""

EXPOSE 8083

CMD ["java", "-Dlog4j2.configurationFile=file:/jar/log4j.properties", "-jar", "/jar/extracted/StepFunctionsLocal.jar"]

With the following log4.properties file which is in the same directory as the Dockerfile:

 # console is set to be a ConsoleAppender.
 log4j.appender.console=org.apache.log4j.ConsoleAppender

 # console uses PatternLayout.
 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

 log4j.appender.APPLOG=amazon.platform.logging.PeriodicConcurrentFileAppender
 log4j.appender.APPLOG.layout=amazon.platform.logging.SanitizingPatternLayout
 log4j.appender.APPLOG.File=../logs/application.log

 log4j.appender.APPLOG.DatePattern='.'yyyy-MM-dd-HH
 log4j.appender.APPLOG.layout.ConversionPattern=%p %d{D/HH:mm:ss:SSS} %t %c - %m%n

 # Set root logger level to INFO and its only appender to console.
 log4j.rootLogger=ERROR, APPLOG

 #log4j.logger.com.amazon.coral.reflect=WARN
 #log4j.logger.httpclient.wire=OFF
 # Enable this to see everything that httpclient does.
 #log4j.logger.org.apache.commons.httpclient=WARN
 #log4j.logger.org.springframework=WARN
 #log4j.logger.org.apache=WARN
 #log4j.logger.com.amazonaws.swf.console=ERROR
 #log4j.logger.com.amazonaws.console.auth=ERROR

This is the same file I found in the extracted StepFunctionsLocal.jar except all of the lines which configure the log level have been commented out and the root logger level set to ERROR.

I built the image and ran it, but the same logging still appeared. At this point I'm stumped. Am I going about this the right way? Have I missed something obvious?


问:
How to correctly type nested and the object indexing?
I have an object which has set properties, one of which is custom that it self has properties that are a subset of the properties of the parent object. See below:

```<code>interface TFruit {
  weight: number;
  color: string;
  shape: 'round' | 'long' | 'oblong'
  custom: TCustom
}

interface TCustom {
  weight?: number;
  color?: string;
}
</code>```

My goal is to create function that gets the value from custom if it’s not undefined otherwise it gets the value from the object. On top of that I want typescript to know the exact type of the returned value depending on the property passed in.

My current attempt is:

```<code>const getProperty = <TProperty extends keyof TCustom>(
  fruit: TFruit,
  property: TProperty
): TFruit['custom'][TProperty] extends undefined ? TFruit[TProperty] : TFruit['custom'][TProperty] => {
  const customProperty = fruit['custom'][property];

  if (customProperty !== undefined) {
    return customProperty;
  }

  return fruit[property];
}
</code>```

Type 'TCustom[TProperty] & {}' is not assignable to type 'TCustom[TProperty] extends undefined ? TFruit[TProperty] : TCustom[TProperty]'.ts(2322)

TLDR; how do I correctly type the function I’ve created, so typescript knows the type of the return value.

Body:
I have an object which has set properties, one of which is custom that it self has properties that are a subset of the properties of the parent object. See below:

interface TFruit {
  weight: number;
  color: string;
  shape: 'round' | 'long' | 'oblong'
  custom: TCustom
}

interface TCustom {
  weight?: number;
  color?: string;
}

My goal is to create function that gets the value from custom if it’s not undefined otherwise it gets the value from the object. On top of that I want typescript to know the exact type of the returned value depending on the property passed in.

My current attempt is:

const getProperty = <TProperty extends keyof TCustom>(
  fruit: TFruit,
  property: TProperty
): TFruit['custom'][TProperty] extends undefined ? TFruit[TProperty] : TFruit['custom'][TProperty] => {
  const customProperty = fruit['custom'][property];

  if (customProperty !== undefined) {
    return customProperty;
  }

  return fruit[property];
}

Type 'TCustom[TProperty] & {}' is not assignable to type 'TCustom[TProperty] extends undefined ? TFruit[TProperty] : TCustom[TProperty]'.ts(2322)

TLDR; how do I correctly type the function I’ve created, so typescript knows the type of the return value.


问:
Keras error on Inter-attention implementation "Invalid argument: required broadcastable shapes"
I want to implement Python code using Keras and Tensorflow to create Model prediction using this paper https://www.semanticscholar.org/paper/Bi-ISCA%3A-Bidirectional-Inter-Sentence-Contextual-in-Nadar/2d9c80dc28094dc55ba5a5e1a9375576c853b3c1

In the paper it said that attention is implemented using dot product and matrix multiplication.

My code is:

```<code>from keras.layers import Bidirectional
from keras.layers import Flatten, LeakyReLU, Input, Lambda, Multiply, Dot
import tensorflow as tf
from keras import regularizers
import keras.backend as K

input_a = Input(shape=(600,),name="text_a")
input_b = Input(shape=(600,),name="text_b")
emb_a = Embedding(len(word_index_a)+1, 300, input_length=max_len, name="embedding_a")(input_a)
emb_b = Embedding(len(word_index_b)+1, 300, input_length=max_len, name="embedding_b")(input_b)

lstm_forward_a = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_forward_a', return_state=True)
lstm_backward_a = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_backward_a', return_state=True, go_backwards=True)

lstm_forward_b = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_forward_b', return_state=True)
lstm_backward_b = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_backward_b', return_state=True, go_backwards=True)

#whole sequence dan final state
forward_layer_a, state_forward_ha, state_forward_ca = lstm_forward_a(emb_a)
backward_layer_a, state_backward_ha, state_backward_ca = lstm_backward_a(emb_a)

forward_layer_b, state_forward_hb, state_forward_cb = lstm_forward_b(emb_b)
backward_layer_b, state_backward_hb, state_backward_cb = lstm_backward_b(emb_b)

bilstm_a, forward_bi_ha, forward_bi_ca, backward_bi_ha, backward_bi_ca = Bidirectional(layer=lstm_forward_a, backward_layer=lstm_backward_a, name="bilstm_a", merge_mode='sum')(emb_a)
bilstm_b, forward_bi_hb, forward_bi_cb, backward_bi_hb, backward_bi_cb = Bidirectional(layer=lstm_forward_b, backward_layer=lstm_backward_b, name="bilstm_b", merge_mode='sum')(emb_b)

att_forward_a = tf.matmul(forward_bi_ca, bilstm_b, transpose_b=True, name='attfa')
att_backward_a = tf.matmul(backward_bi_ca, bilstm_b, transpose_b=True, name='attfa')
att_forward_b = tf.matmul(forward_bi_cb, bilstm_a, transpose_b=True, name='attfa')
att_backward_b = tf.matmul(forward_bi_cb, bilstm_a, transpose_b=True, name='attfa')

hidden_forward_a = att_forward_a*K.transpose(bilstm_b)
hidden_backward_a = att_forward_a*K.transpose(bilstm_b)
hidden_forward_b = att_forward_a*K.transpose(bilstm_a)
hidden_backward_b = att_forward_a*K.transpose(bilstm_a)

#hidden_forward_b = Multiply()(\[att_forward_a,K.transpose(bilstm_b)\])
#hidden_forward_a = tf.expand_dims(hidden_forward_a, axis=1)
#hidden_backward_b = Multiply()(\[att_backward_a,K.transpose(bilstm_b)\])
#hidden_backward_a = tf.expand_dims(hidden_backward_a, axis=1)
#hidden_forward_a = Multiply()(\[att_forward_b,K.transpose(bilstm_a)\])
#hidden_forward_b = tf.expand_dims(hidden_forward_b, axis=1)
#hidden_backward_a = Multiply()(\[att_backward_b,K.transpose(bilstm_a)\])
#hidden_backward_b = tf.expand_dims(hidden_backward_b, axis=1)

lLeaky = LeakyReLU(alpha=0.3)

#2 layer CNN
cnn1 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfa") (hidden_forward_a)
cnn11 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfa1") (cnn1)

cnn2 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dba") (hidden_backward_a)
cnn21 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dba2") (cnn2)

cnn3 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfb") (hidden_forward_b)
cnn31 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfb1") (cnn3)

cnn4 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dbb") (hidden_backward_b)
cnn41 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dbb2") (cnn4)

flat1 = Flatten(name='flat1')(cnn11)
flat2 = Flatten(name='flat2')(cnn21)
flat3 = Flatten(name='flat3')(cnn31)
flat4 = Flatten(name='flat4')(cnn41)

combined = Concatenate(name='concat_model')(\[flat1,flat2,flat3,flat4\])
hasil = Dense(64, activation = 'relu',name="dense-ab64")(combined)
hasil = Dropout(0.2,name="dropout_ab-64") (hasil)
hasil = Dense(32, activation= 'relu',name="dense_ab32")(hasil)
hasil = Dropout(0.2,name="dropout_ab-32") (hasil)
hasil = Dense(1, activation='sigmoid',name="dense_final")(hasil)
model = Model(inputs=\[input_a,input_b\],outputs=hasil, name="model_final")

callback = tf.keras.callbacks.EarlyStopping(monitor='loss', patience=5)
opAdam = tf.keras.optimizers.Adam(learning_rate=0.01)

model.compile(loss='binary_crossentropy', optimizer=opAdam, metrics=METRICS)
model.summary()
</code>```

My model is successfully compiled, but in model.fit it produces error :

```<code>2022-12-15 12:13:30.049121: W tensorflow/core/framework/op_kernel.cc:1680] Invalid argument: required broadcastable shapes

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<timed exec> in <module>

/opt/conda/lib/python3.7/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1182                 _r=1):
   1183               callbacks.on_train_batch_begin(step)
-> 1184               tmp_logs = self.train_function(iterator)
   1185               if data_handler.should_sync:
   1186                 context.async_wait()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
    883
    884       with OptionalXlaContext(self._jit_compile):
--> 885         result = self._call(*args, **kwds)
    886
    887       new_tracing_count = self.experimental_get_tracing_count()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
    948         # Lifting succeeded, so variables are initialized and we can run the
    949         # stateless function.
--> 950         return self._stateless_fn(*args, **kwds)
    951     else:
    952       _, _, _, filtered_flat_args = \

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py in __call__(self, *args, **kwargs)
   3038        filtered_flat_args) = self._maybe_define_function(args, kwargs)
   3039     return graph_function._call_flat(
-> 3040         filtered_flat_args, captured_inputs=graph_function.captured_inputs)  # pylint: disable=protected-access
   3041
   3042   @property

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
   1962       # No tape is watching; skip to running the function.
   1963       return self._build_call_outputs(self._inference_function.call(
-> 1964           ctx, args, cancellation_manager=cancellation_manager))
   1965     forward_backward = self._select_forward_and_backward_functions(
   1966         args,

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py in call(self, ctx, args, cancellation_manager)
    594               inputs=args,
    595               attrs=attrs,
--> 596               ctx=ctx)
    597         else:
    598           outputs = execute.execute_with_cancellation(

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     58     ctx.ensure_initialized()
     59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:
     62     if name is not None:

InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  required broadcastable shapes
     [[node gradient_tape/binary_crossentropy/logistic_loss/mul/Mul (defined at <timed exec>:1) ]]
     [[ConstantFolding/assert_greater_equal_9/Assert/AssertGuard/switch_pred/_182_const_false/_327]]
  (1) Invalid argument:  required broadcastable shapes
     [[node gradient_tape/binary_crossentropy/logistic_loss/mul/Mul (defined at <timed exec>:1) ]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_27904]

Function call stack:
train_function -> train_function
</code>```

I don't know what the problem is.  Could you help me to explained the error? what should I do? What is the correct way to make dot product and multiplication in Keras / Tensorflow? .... I would be very happy if anyone could help me....

I have tried some effort to fix this but I have no idea anymore...

Body:
I want to implement Python code using Keras and Tensorflow to create Model prediction using this paper https://www.semanticscholar.org/paper/Bi-ISCA%3A-Bidirectional-Inter-Sentence-Contextual-in-Nadar/2d9c80dc28094dc55ba5a5e1a9375576c853b3c1

In the paper it said that attention is implemented using dot product and matrix multiplication.

My code is:

from keras.layers import Bidirectional
from keras.layers import Flatten, LeakyReLU, Input, Lambda, Multiply, Dot
import tensorflow as tf
from keras import regularizers
import keras.backend as K

input_a = Input(shape=(600,),name="text_a")
input_b = Input(shape=(600,),name="text_b")
emb_a = Embedding(len(word_index_a)+1, 300, input_length=max_len, name="embedding_a")(input_a)
emb_b = Embedding(len(word_index_b)+1, 300, input_length=max_len, name="embedding_b")(input_b)

lstm_forward_a = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_forward_a', return_state=True)
lstm_backward_a = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_backward_a', return_state=True, go_backwards=True)

lstm_forward_b = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_forward_b', return_state=True)
lstm_backward_b = LSTM(128, return_sequences=True, dropout=0.2, name='lstm_backward_b', return_state=True, go_backwards=True)

#whole sequence dan final state
forward_layer_a, state_forward_ha, state_forward_ca = lstm_forward_a(emb_a)
backward_layer_a, state_backward_ha, state_backward_ca = lstm_backward_a(emb_a)

forward_layer_b, state_forward_hb, state_forward_cb = lstm_forward_b(emb_b)
backward_layer_b, state_backward_hb, state_backward_cb = lstm_backward_b(emb_b)

bilstm_a, forward_bi_ha, forward_bi_ca, backward_bi_ha, backward_bi_ca = Bidirectional(layer=lstm_forward_a, backward_layer=lstm_backward_a, name="bilstm_a", merge_mode='sum')(emb_a)
bilstm_b, forward_bi_hb, forward_bi_cb, backward_bi_hb, backward_bi_cb = Bidirectional(layer=lstm_forward_b, backward_layer=lstm_backward_b, name="bilstm_b", merge_mode='sum')(emb_b)

att_forward_a = tf.matmul(forward_bi_ca, bilstm_b, transpose_b=True, name='attfa')
att_backward_a = tf.matmul(backward_bi_ca, bilstm_b, transpose_b=True, name='attfa')
att_forward_b = tf.matmul(forward_bi_cb, bilstm_a, transpose_b=True, name='attfa')
att_backward_b = tf.matmul(forward_bi_cb, bilstm_a, transpose_b=True, name='attfa')

hidden_forward_a = att_forward_a*K.transpose(bilstm_b)
hidden_backward_a = att_forward_a*K.transpose(bilstm_b)
hidden_forward_b = att_forward_a*K.transpose(bilstm_a)
hidden_backward_b = att_forward_a*K.transpose(bilstm_a)

#hidden_forward_b = Multiply()(\[att_forward_a,K.transpose(bilstm_b)\])
#hidden_forward_a = tf.expand_dims(hidden_forward_a, axis=1)
#hidden_backward_b = Multiply()(\[att_backward_a,K.transpose(bilstm_b)\])
#hidden_backward_a = tf.expand_dims(hidden_backward_a, axis=1)
#hidden_forward_a = Multiply()(\[att_forward_b,K.transpose(bilstm_a)\])
#hidden_forward_b = tf.expand_dims(hidden_forward_b, axis=1)
#hidden_backward_a = Multiply()(\[att_backward_b,K.transpose(bilstm_a)\])
#hidden_backward_b = tf.expand_dims(hidden_backward_b, axis=1)

lLeaky = LeakyReLU(alpha=0.3)

#2 layer CNN
cnn1 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfa") (hidden_forward_a)
cnn11 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfa1") (cnn1)

cnn2 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dba") (hidden_backward_a)
cnn21 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dba2") (cnn2)

cnn3 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfb") (hidden_forward_b)
cnn31 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dfb1") (cnn3)

cnn4 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dbb") (hidden_backward_b)
cnn41 = Conv1D(filters=64, kernel_size=2, padding='same', activation=lLeaky, name="conv1Dbb2") (cnn4)

flat1 = Flatten(name='flat1')(cnn11)
flat2 = Flatten(name='flat2')(cnn21)
flat3 = Flatten(name='flat3')(cnn31)
flat4 = Flatten(name='flat4')(cnn41)

combined = Concatenate(name='concat_model')(\[flat1,flat2,flat3,flat4\])
hasil = Dense(64, activation = 'relu',name="dense-ab64")(combined)
hasil = Dropout(0.2,name="dropout_ab-64") (hasil)
hasil = Dense(32, activation= 'relu',name="dense_ab32")(hasil)
hasil = Dropout(0.2,name="dropout_ab-32") (hasil)
hasil = Dense(1, activation='sigmoid',name="dense_final")(hasil)
model = Model(inputs=\[input_a,input_b\],outputs=hasil, name="model_final")

callback = tf.keras.callbacks.EarlyStopping(monitor='loss', patience=5)
opAdam = tf.keras.optimizers.Adam(learning_rate=0.01)

model.compile(loss='binary_crossentropy', optimizer=opAdam, metrics=METRICS)
model.summary()

My model is successfully compiled, but in model.fit it produces error :

2022-12-15 12:13:30.049121: W tensorflow/core/framework/op_kernel.cc:1680] Invalid argument: required broadcastable shapes

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<timed exec> in <module>

/opt/conda/lib/python3.7/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1182                 _r=1):
   1183               callbacks.on_train_batch_begin(step)
-> 1184               tmp_logs = self.train_function(iterator)
   1185               if data_handler.should_sync:
   1186                 context.async_wait()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
    883
    884       with OptionalXlaContext(self._jit_compile):
--> 885         result = self._call(*args, **kwds)
    886
    887       new_tracing_count = self.experimental_get_tracing_count()

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
    948         # Lifting succeeded, so variables are initialized and we can run the
    949         # stateless function.
--> 950         return self._stateless_fn(*args, **kwds)
    951     else:
    952       _, _, _, filtered_flat_args = \

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py in __call__(self, *args, **kwargs)
   3038        filtered_flat_args) = self._maybe_define_function(args, kwargs)
   3039     return graph_function._call_flat(
-> 3040         filtered_flat_args, captured_inputs=graph_function.captured_inputs)  # pylint: disable=protected-access
   3041
   3042   @property

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
   1962       # No tape is watching; skip to running the function.
   1963       return self._build_call_outputs(self._inference_function.call(
-> 1964           ctx, args, cancellation_manager=cancellation_manager))
   1965     forward_backward = self._select_forward_and_backward_functions(
   1966         args,

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py in call(self, ctx, args, cancellation_manager)
    594               inputs=args,
    595               attrs=attrs,
--> 596               ctx=ctx)
    597         else:
    598           outputs = execute.execute_with_cancellation(

/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     58     ctx.ensure_initialized()
     59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:
     62     if name is not None:

InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  required broadcastable shapes
     [[node gradient_tape/binary_crossentropy/logistic_loss/mul/Mul (defined at <timed exec>:1) ]]
     [[ConstantFolding/assert_greater_equal_9/Assert/AssertGuard/switch_pred/_182_const_false/_327]]
  (1) Invalid argument:  required broadcastable shapes
     [[node gradient_tape/binary_crossentropy/logistic_loss/mul/Mul (defined at <timed exec>:1) ]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_27904]

Function call stack:
train_function -> train_function

I don't know what the problem is.  Could you help me to explained the error? what should I do? What is the correct way to make dot product and multiplication in Keras / Tensorflow? .... I would be very happy if anyone could help me....

I have tried some effort to fix this but I have no idea anymore...


问:
virtual serial port from remote physical serial port
I have a local client host (linux), which runs an application (like minicom) that connects to a serial port.

However, the physical serial port (/dev/ttyUSB0) is present on a remote server host (linux), to which I have ssh access.

For various reasons, I do not want to run the application on the server host through ssh.

Therefore, I am connecting this physical serial port to a local virtual serial port (/dev/ttyNET0) using socat:

```<code>sudo socat "pty,link=/dev/ttyNET0,group-late=dialout,perm-late=666,sane,rawer" \
"exec:'ssh -tt ${remote-host} socat "stdio,sane,rawer" "file:/dev/ttyUSB0,sane,rawer,b115200"',pty,sane,rawer"
</code>```

I am then able to connect to this serial port on my local machine as follows:

```<code>sudo minicom -D "/dev/ttyNET0"
</code>```

Note that there were two calls of socat in the previous command: one on the client side, and one on the server side.

I am wondering if the equivalent of this command can be constructed with a single call of socat. I tried this:

```<code>sudo socat "pty,link=/dev/ttyNET0,group-late=dialout,perm-late=666,sane,rawer" \
"file:'ssh://${remote-host}:/dev/ttyUSB0',sane,rawer,b115200"
</code>```

But it did not work. I have read through the manpage of socat, but I might be missing something.

Body:
I have a local client host (linux), which runs an application (like minicom) that connects to a serial port.

However, the physical serial port (/dev/ttyUSB0) is present on a remote server host (linux), to which I have ssh access.

For various reasons, I do not want to run the application on the server host through ssh.

Therefore, I am connecting this physical serial port to a local virtual serial port (/dev/ttyNET0) using socat:

sudo socat "pty,link=/dev/ttyNET0,group-late=dialout,perm-late=666,sane,rawer" \
"exec:'ssh -tt ${remote-host} socat "stdio,sane,rawer" "file:/dev/ttyUSB0,sane,rawer,b115200"',pty,sane,rawer"

I am then able to connect to this serial port on my local machine as follows:

sudo minicom -D "/dev/ttyNET0"

Note that there were two calls of socat in the previous command: one on the client side, and one on the server side.

I am wondering if the equivalent of this command can be constructed with a single call of socat. I tried this:

sudo socat "pty,link=/dev/ttyNET0,group-late=dialout,perm-late=666,sane,rawer" \
"file:'ssh://${remote-host}:/dev/ttyUSB0',sane,rawer,b115200"

But it did not work. I have read through the manpage of socat, but I might be missing something.


问:
How to keep current checkbox checked state through pagination
I have HTML page which have multiple checkboxes and individually they can be checked. I have checkbox in header of the table and when I click on this checkbox on header then it should select all the checkboxes should get selected, and when I click again on the same checkbox all the checkboxes should get deselected from all pages.

In my original program there are thousands of records, but at a time 10 records are getting display, but when user click on select it should select all thousands record.

I am using ASPNET MVC and JQUERY and HTML   for displaying the data.
I a using @HTML.PagedListPager to display the pagination.

It provides pagination, searching, sorting etc. so at a time I am displaying only 10 records on my current page all the records are selecting on current page.

As mention in the problem I want to select all check-boxes from all the pages.

I need to select all check-boxes from all the checkbox list in a table


问:
Netflix DGS: Throw Exception if DataLoader fails to received data for all objects
I'm using Netflix DGS library in SpringBoot, and I have a parent query that whose schema is something like,

type Parent @connection {
    attr1
    attr2
    ...
    child1: Child
}

type Child {
    childAttr1
    childAttr2
```

Here for a graphql query to fetch first 10 records for Parent, I'm using Data Loader to load all the Child data at once for all the 10 Parents using.

Currently bulk fetch for Child returns a List which may or may not contain values for every Parent object. I want to add a error block which can be attached to the request to notify which Parent object didn't had Child.

Since the Data Loader returns a CompletableFuture, I am not able to interrupt the flow and throw an exception if data is null.

Is there some solution to this problem, or any other way with which it can be handled?

Thanks!

Body:
I'm using Netflix DGS library in SpringBoot, and I have a parent query that whose schema is something like,

type Parent @connection {
    attr1
    attr2
    ...
    child1: Child
}

type Child {
    childAttr1
    childAttr2

Here for a graphql query to fetch first 10 records for Parent, I'm using Data Loader to load all the Child data at once for all the 10 Parents using.

Currently bulk fetch for Child returns a List which may or may not contain values for every Parent object. I want to add a error block which can be attached to the request to notify which Parent object didn't had Child.

Since the Data Loader returns a CompletableFuture, I am not able to interrupt the flow and throw an exception if data is null.

Is there some solution to this problem, or any other way with which it can be handled?

Thanks!


问:
Distributing in-memory linked list
I have a program which is build based on a singly linked list. There are different programs which creates some form of data and this data sent to this linked list module to be added. As long as I've RAM available, program working as intended. Periodically -about every year-, I archive the entire linked list to the disk -due to requirement, I'm archiving all-. So far so good.

What happens if I wanted to add new node to the list whilst RAM is full and I haven't archived and freed the memory on RAM? This might occur when producer count goes up or regardless of producer count, there may be more data created depending or where it's used etc. I couldn't find a clear solution the scale the on-memory linked list. There is a workaround in my head but don't know even if it works so I thought better to ask here.

When the RAM start to get almost full, I would create a new instance
of the linked list program -just another machine on the cloud or new
physical computer on premise, whatever -.

I do have an service discovery module -something like ZooKeeper-, this discovery module will detect the newly created machine and adds to the list.

When first instance is almost in it's limits, it will check if there is an available instance, if there is; it will relay the node to the next instance and it will update its last node's next pointer to something special. If you wanted to traverse the list from start to finish across all the machines every time you come to this special node, it will have the information of the which machine has the next node. Traversal will continue from the next machine that the last node points to.

Since this this not a hash map or something in that nature, I can't just add replicate the service and for example relay the incoming request based on a given key to a particular machine.

Rather than archiving part of the old data and loading that to the RAM and continuing on like that, I thought it would be better to have a last pointer to point to a different machine and continue reading from that machine. My choice for a network call seemed better because this program will be used in a intranet, but still I couldn't find a solid solution on paper.

Is there a such example that I can study on and try to find a better solution? Is this solution feasible?

An example:

```<code>Machine 1:
 1st node : [data:x, *next: 2nd Node address],
 2nd node : [data:123, *next: 3rd Node address],
 ...
 // at this point RAM is almost full
 // receive next instance's ip
 (n-1)th node :  [data:987, *next: nth Node address],
 nth node : [data:x2t, type: LastNodeInMachine, *next: nullptr]

Machine 2:
 1st node == (n+1) node : [data:x, *next: 2nd Node address],
 ... and so on
</code>```

Title: Distributing in-memory linked list

Body:
I have a program which is build based on a singly linked list. There are different programs which creates some form of data and this data sent to this linked list module to be added. As long as I've RAM available, program working as intended. Periodically -about every year-, I archive the entire linked list to the disk -due to requirement, I'm archiving all-. So far so good.

What happens if I wanted to add new node to the list whilst RAM is full and I haven't archived and freed the memory on RAM? This might occur when producer count goes up or regardless of producer count, there may be more data created depending or where it's used etc. I couldn't find a clear solution the scale the on-memory linked list. There is a workaround in my head but don't know even if it works so I thought better to ask here.

When the RAM start to get almost full, I would create a new instance
of the linked list program -just another machine on the cloud or new
physical computer on premise, whatever -.

I do have an service discovery module -something like ZooKeeper-, this discovery module will detect the newly created machine and adds to the list.

When first instance is almost in it's limits, it will check if there is an available instance, if there is; it will relay the node to the next instance and it will update its last node's next pointer to something special. If you wanted to traverse the list from start to finish across all the machines every time you come to this special node, it will have the information of the which machine has the next node. Traversal will continue from the next machine that the last node points to.

Since this this not a hash map or something in that nature, I can't just add replicate the service and for example relay the incoming request based on a given key to a particular machine.

Rather than archiving part of the old data and loading that to the RAM and continuing on like that, I thought it would be better to have a last pointer to point to a different machine and continue reading from that machine. My choice for a network call seemed better because this program will be used in a intranet, but still I couldn't find a solid solution on paper.

Is there a such example that I can study on and try to find a better solution? Is this solution feasible?

An example:

Machine 1:
 1st node : [data:x, *next: 2nd Node address],
 2nd node : [data:123, *next: 3rd Node address],
 ...
 // at this point RAM is almost full
 // receive next instance's ip
 (n-1)th node :  [data:987, *next: nth Node address],
 nth node : [data:x2t, type: LastNodeInMachine, *next: nullptr]

Machine 2:
 1st node == (n+1) node : [data:x, *next: 2nd Node address],
 ... and so on


问:
antd ProForm ProFormList component copyIcon creates row instead of copying the input text
```<code><ProFormList
  name={name}
  initialValue={initialValue}
  creatorButtonProps={{
    creatorButtonText: '',
    style: {
      width: 22,
      height: 22,
      position: 'absolute',
      top: 27,
      right: -30,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      border: '1px solid #056DFA',
      borderRadius: '100%',
    },
  }}
  copyIconProps={{ tooltipText: 'დაკოპირება' }}
  deleteIconProps={{ tooltipText: 'წაშლა' }}
  creatorRecord={creatorRecord}
  min={1}
>
  {children}
</ProFormList>
</code>```

I am using antd. And when clicking copy button which antd ProFormList contains it creates a new row instead copying the input string. Antd has the same exact problem on their website examples (https://procomponents.ant.design/en-US/components/dependency view the first code example)
Does anyone know how to fix this error. Thank you in advance.

Body:
<ProFormList
  name={name}
  initialValue={initialValue}
  creatorButtonProps={{
    creatorButtonText: '',
    style: {
      width: 22,
      height: 22,
      position: 'absolute',
      top: 27,
      right: -30,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      border: '1px solid #056DFA',
      borderRadius: '100%',
    },
  }}
  copyIconProps={{ tooltipText: 'დაკოპირება' }}
  deleteIconProps={{ tooltipText: 'წაშლა' }}
  creatorRecord={creatorRecord}
  min={1}
>
  {children}
</ProFormList>

I am using antd. And when clicking copy button which antd ProFormList contains it creates a new row instead copying the input string. Antd has the same exact problem on their website examples (https://procomponents.ant.design/en-US/components/dependency view the first code example)
Does anyone know how to fix this error. Thank you in advance.


问:
Tremor barchart onclick React ts
I want to be able to click on one of the bars to open a new window, but it seems like the tremor library doesn't have the functionality to have some kind of onclick. Could someone help me with that?

my barchart code

I have tried changing it from a functional component to a class component so I can use this.state, but I did not manage to make it work.

Title: Tremor barchart onclick React ts


问:
AutoMapper - map string to List<T>
I have a "source" class with string property, like

class Source {
  public string JsonItems {get;set;}
}
```
<p>And I want to map JsonItems to "dest" DTO with property Items</p>
<pre class="lang-cs prettyprint-override"><code>class Dest {
  public List<Item> Items {get;}
}
</code>```

Please tell me, is it possible?

Title: AutoMapper - map string to List<T>

Body:
I have a "source" class with string property, like

class Source {
  public string JsonItems {get;set;}
}

And I want to map JsonItems to "dest" DTO with property Items

class Dest {
  public List<Item> Items {get;}
}

Please tell me, is it possible?


问:
Lazy image load and CSS grid are not working together! Help me to find a solution
Hello fellow programmers,

For some time I'm learning front end, and at this moment I'm building mine portfolio. It is going well, but I encountered a problem with CSS grid and lazy load of images.

I'm using Intersection Observer to observe images and to load them from data-src. The problem arise when I come to section with images, only 1st row is loaded, and the other row doesn't get loaded at all, it's seems like it it's invisible to observer.

It looks like this:

Problem with loading

Code for CSS grid that I use is this one:

```<code> display: grid;
  grid-template-columns: repeat(auto-fit, minmax(35rem, 1fr));
</code>```

Code for JS lazy load:

```<code>const lazyImages = document.querySelectorAll("img[data-src]");

const imgCallBack = (entries, observer) => {
  const [entry] = entries;
  if (!entry.isIntersecting) return;

  entry.target.src = entry.target.dataset.src;

  entry.target.addEventListener("load", () => {
    entry.target.classList.remove("blured");
  });

  observer.unobserve(entry.target);
};

const imgOptions = { root: null, threshold: 0, rootMargin: "900px" };

const imgObserver = new IntersectionObserver(imgCallBack, imgOptions);

lazyImages.forEach((img) => imgObserver.observe(img));
</code>```

When I turn off multiple columns, everything work as it should, but then I get to large section that it's not good. It's good for mobile phones, but not for desktop screens.

It looks like this

So, my question is what can I do to make my other row is visible?
Thank you for consideration,
Aleksandar Đ.

Body:
Hello fellow programmers,

For some time I'm learning front end, and at this moment I'm building mine portfolio. It is going well, but I encountered a problem with CSS grid and lazy load of images.

I'm using Intersection Observer to observe images and to load them from data-src. The problem arise when I come to section with images, only 1st row is loaded, and the other row doesn't get loaded at all, it's seems like it it's invisible to observer.

It looks like this:

Problem with loading

Code for CSS grid that I use is this one:

 display: grid;
  grid-template-columns: repeat(auto-fit, minmax(35rem, 1fr));

Code for JS lazy load:

const lazyImages = document.querySelectorAll("img[data-src]");

const imgCallBack = (entries, observer) => {
  const [entry] = entries;
  if (!entry.isIntersecting) return;

  entry.target.src = entry.target.dataset.src;

  entry.target.addEventListener("load", () => {
    entry.target.classList.remove("blured");
  });

  observer.unobserve(entry.target);
};

const imgOptions = { root: null, threshold: 0, rootMargin: "900px" };

const imgObserver = new IntersectionObserver(imgCallBack, imgOptions);

lazyImages.forEach((img) => imgObserver.observe(img));

When I turn off multiple columns, everything work as it should, but then I get to large section that it's not good. It's good for mobile phones, but not for desktop screens.

It looks like this

So, my question is what can I do to make my other row is visible?
Thank you for consideration,
Aleksandar Đ.


问:
Using multiple indexes in a single MongoDB query just like MySQL?
I have a ticket system, each ticket has info like : title, status, time, difficulty, ...
Users can search tickets by 10+ fields freely, and cannot pre-define a compound index because user can filter by anything. Numbers of tickets is 10M+.

Previously I stored them using MySQL, and index on all info fields, MySQL did combine ALL those indexs to search/filter quickly.

Due to require changes, I move to MongoDB. But now, I also index all fields, when I apply filter like above, MongoDB "explain" show that only 1 index is used, and the speed is significantly slower.

Is it because MongoDB is not suitable for "multi filters" operation like this, or am I missing some thing ?

Thanks for any suggestion.

I found that MongoDB have the setting of "Index Intersection", but it's auto and cannot be forced, so it's not an option here.


问:
Google Pay crashes Cordova app, null status and test environment
I am trying to add Google and Apple Pay into my Cordova application. My app is connected to a Magento 2 website via rest api.

First time I have tried with Braintree drop-in but in the end I found that they don't support webview because there is no HTTPS.
Than switched to plugins, found 2-3, tried all but none doesn't allow me to pay with Google.

Currently I am using this plugin cordova-apple-pay-google-pay

When I try to pay the app crashes.

in config.xml I have:

```<code>      <config-file parent="/manifest/application" target="AndroidManifest.xml">
          <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" />
      </config-file>
      <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
          <application android:usesCleartextTraffic="true" />
      </edit-config>
      <preference name="android-compileSdkVersion" value="32" />
      <preference name="scheme" value="http" />
      <preference name="hostname" value="localhost" />
      <preference name="android-compileSdkVersion" value="32" />
      <preference name="GradlePluginKotlinEnabled" value="true" />
      <preference name="GradlePluginGoogleServicesEnabled " value="true" />
      <preference name="AndroidXEnabled" value="true" />
</code>```

and the script for payment looks like that:

```<code>cordova.plugins.ApplePayGooglePay.canMakePayments((available) => {
    if(!available){
        app.dialog.alert('Google Pay not available');
        return
    }
    var request = {
        countryCode: "GB",
        amount: totals.base_grand_total, // 0.01
        currencyCode: totals.quote_currency_code, //GBP
        gateway: 'braintree', https://developers.google.com/pay/api#participating-processors
        merchantId: 'BRAINTREE-ID', // merchant id provided by your processor
        gpMerchantName: 'Name of Cordova App', // will be displayed in transaction info
        gpMerchantId: 'CODE-FROM-GOOGLE-PAY' // obtain it at https://pay.google.com/business/console
    }
    cordova.plugins.ApplePayGooglePay.makePaymentRequest(request, function(data){
        console.log(data);
    }, function(error){
        console.log(error);
    });
});
</code>```

Google Pay returns error: Request Failed - Unexpected developer error, please try again later.

In iPhone simulator (iOS 16) tested successfully.

I know that Google pay requires HTTPS too, so my question is does this two payments still work with Cordova? If YES, than how? what do I miss? Thanks

Body:
I am trying to add Google and Apple Pay into my Cordova application. My app is connected to a Magento 2 website via rest api.

First time I have tried with Braintree drop-in but in the end I found that they don't support webview because there is no HTTPS.
Than switched to plugins, found 2-3, tried all but none doesn't allow me to pay with Google.

Currently I am using this plugin cordova-apple-pay-google-pay

When I try to pay the app crashes.

in config.xml I have:

      <config-file parent="/manifest/application" target="AndroidManifest.xml">
          <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" />
      </config-file>
      <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
          <application android:usesCleartextTraffic="true" />
      </edit-config>
      <preference name="android-compileSdkVersion" value="32" />
      <preference name="scheme" value="http" />
      <preference name="hostname" value="localhost" />
      <preference name="android-compileSdkVersion" value="32" />
      <preference name="GradlePluginKotlinEnabled" value="true" />
      <preference name="GradlePluginGoogleServicesEnabled " value="true" />
      <preference name="AndroidXEnabled" value="true" />

and the script for payment looks like that:

cordova.plugins.ApplePayGooglePay.canMakePayments((available) => {
    if(!available){
        app.dialog.alert('Google Pay not available');
        return
    }
    var request = {
        countryCode: "GB",
        amount: totals.base_grand_total, // 0.01
        currencyCode: totals.quote_currency_code, //GBP
        gateway: 'braintree', https://developers.google.com/pay/api#participating-processors
        merchantId: 'BRAINTREE-ID', // merchant id provided by your processor
        gpMerchantName: 'Name of Cordova App', // will be displayed in transaction info
        gpMerchantId: 'CODE-FROM-GOOGLE-PAY' // obtain it at https://pay.google.com/business/console
    }
    cordova.plugins.ApplePayGooglePay.makePaymentRequest(request, function(data){
        console.log(data);
    }, function(error){
        console.log(error);
    });
});

Google Pay returns error: Request Failed - Unexpected developer error, please try again later.

In iPhone simulator (iOS 16) tested successfully.

I know that Google pay requires HTTPS too, so my question is does this two payments still work with Cordova? If YES, than how? what do I miss? Thanks


问:
Return warning/error message dynamically when input is touched
I have an input component where I pass a hasError prop and display an error message below the input field if the value of input is empty. I have a function where it will validate the entered value then it will return an object, and that function will be pass as a parameter in my custom hook. How can I make my hasError dynamically? Now, when I add a new input element I will add a new key-value pair on the hasError object. How can I prevent that?

```<code>import React from 'react';
import { useInput } from '@/Shared/hooks';

import { Button, FormInput } from '@/Shared/components';

const PersonForm = () => {
  const initialValues = {
    firstName: '',
    lastName: '',
    email: '',
  };

  const initialTouched = {
    firstName: false,
    lastName: false,
    email: false,
  };

  const validateValue = value => {
    return {
      firstName: value.firstName.trim() !== '',
      lastName: value.lastName.trim() !== '',
      email: value.email.trim() !== '' && value.email.includes('@'),
    };
  };

  const {
    value,
    valueIsValid,
    reset,
    hasError,
    onChangeInputHandler,
    onBlurInputHandler,
  } = useInput(initialValues, initialTouched, validateValue);

  let formIsValid = false;

  if (!Object.values(valueIsValid).filter(e => !e).length) {
    formIsValid = true;
  }

  const handleSubmitPerson = e => {
    e.preventDefault();

    if (Object.values(valueIsValid).filter(e => !e).length) return;

    reset();
  };

  return (
    <form onSubmit={handleSubmitPerson}>
      <FormInput
        label="First Name"
        name="firstName"
        id="firstName"
        value={value.firstName}
        onChange={onChangeInputHandler}
        onBlur={onBlurInputHandler}
        isInvalid={hasError.firstName}
        errorMessage="First name must not be empty."
      />
      <FormInput
        label="Last Name"
        name="lastName"
        id="lastName"
        value={value.lastName}
        onChange={onChangeInputHandler}
        onBlur={onBlurInputHandler}
        isInvalid={hasError.lastName}
        errorMessage="Last name must not be empty."
      />
      <FormInput
        label="Email Address"
        name="email"
        id="email"
        value={value.email}
        onChange={onChangeInputHandler}
        onBlur={onBlurInputHandler}
        isInvalid={hasError.email}
        errorMessage="Invalid email address!"
      />
      <div className="mt-6">
        <Button type="submit" disabled={!formIsValid}>
          Submit
        </Button>
      </div>
    </form>
  );
};
</code>```

useInput Hook

```<code>import { useState } from 'react';

const useInput = (initialValues, initialTouched, validateValue) => {
  const [value, setValue] = useState(initialValues);
  const [isTouched, setIsTouched] = useState(initialTouched);

  const valueIsValid = validateValue(value);

  const hasError = {
    firstName: !valueIsValid.firstName && isTouched.firstName,
    lastName: !valueIsValid.lastName && isTouched.lastName,
    email: !valueIsValid.email && isTouched.email,
  };

  const onChangeInputHandler = e => {
    setValue({
      ...value,
      [e.target.name]: e.target.value,
    });
  };

  const onBlurInputHandler = e => {
    setIsTouched({
      ...isTouched,
      [e.target.name]: true,
    });
  };

  const reset = () => {
    setValue({
      ...initialValues,
    });

    setIsTouched({
      ...initialTouched,
    });
  };

  return {
    value,
    valueIsValid,
    hasError,
    reset,
    onChangeInputHandler,
    onBlurInputHandler,
  };
};
</code>```

Body:
I have an input component where I pass a hasError prop and display an error message below the input field if the value of input is empty. I have a function where it will validate the entered value then it will return an object, and that function will be pass as a parameter in my custom hook. How can I make my hasError dynamically? Now, when I add a new input element I will add a new key-value pair on the hasError object. How can I prevent that?

import React from 'react';
import { useInput } from '@/Shared/hooks';

import { Button, FormInput } from '@/Shared/components';

const PersonForm = () => {
  const initialValues = {
    firstName: '',
    lastName: '',
    email: '',
  };

  const initialTouched = {
    firstName: false,
    lastName: false,
    email: false,
  };

  const validateValue = value => {
    return {
      firstName: value.firstName.trim() !== '',
      lastName: value.lastName.trim() !== '',
      email: value.email.trim() !== '' && value.email.includes('@'),
    };
  };

  const {
    value,
    valueIsValid,
    reset,
    hasError,
    onChangeInputHandler,
    onBlurInputHandler,
  } = useInput(initialValues, initialTouched, validateValue);

  let formIsValid = false;

  if (!Object.values(valueIsValid).filter(e => !e).length) {
    formIsValid = true;
  }

  const handleSubmitPerson = e => {
    e.preventDefault();

    if (Object.values(valueIsValid).filter(e => !e).length) return;

    reset();
  };

  return (
    <form onSubmit={handleSubmitPerson}>
      <FormInput
        label="First Name"
        name="firstName"
        id="firstName"
        value={value.firstName}
        onChange={onChangeInputHandler}
        onBlur={onBlurInputHandler}
        isInvalid={hasError.firstName}
        errorMessage="First name must not be empty."
      />
      <FormInput
        label="Last Name"
        name="lastName"
        id="lastName"
        value={value.lastName}
        onChange={onChangeInputHandler}
        onBlur={onBlurInputHandler}
        isInvalid={hasError.lastName}
        errorMessage="Last name must not be empty."
      />
      <FormInput
        label="Email Address"
        name="email"
        id="email"
        value={value.email}
        onChange={onChangeInputHandler}
        onBlur={onBlurInputHandler}
        isInvalid={hasError.email}
        errorMessage="Invalid email address!"
      />

        <Button type="submit" disabled={!formIsValid}>
          Submit
        </Button>

    </form>
  );
};

useInput Hook

import { useState } from 'react';

const useInput = (initialValues, initialTouched, validateValue) => {
  const [value, setValue] = useState(initialValues);
  const [isTouched, setIsTouched] = useState(initialTouched);

  const valueIsValid = validateValue(value);

  const hasError = {
    firstName: !valueIsValid.firstName && isTouched.firstName,
    lastName: !valueIsValid.lastName && isTouched.lastName,
    email: !valueIsValid.email && isTouched.email,
  };

  const onChangeInputHandler = e => {
    setValue({
      ...value,
      [e.target.name]: e.target.value,
    });
  };

  const onBlurInputHandler = e => {
    setIsTouched({
      ...isTouched,
      [e.target.name]: true,
    });
  };

  const reset = () => {
    setValue({
      ...initialValues,
    });

    setIsTouched({
      ...initialTouched,
    });
  };

  return {
    value,
    valueIsValid,
    hasError,
    reset,
    onChangeInputHandler,
    onBlurInputHandler,
  };
};


问:
how do we calculate the number of reads/misses of the cache in this code snippet?
I'm trying to get an understanding of how to calculate the errors in the code, from the link on this page, Example given from text book. I can see where the calculations come from, but as the values are the same (32), I cannot work out how to do the calculation should the value in the two loops differ. Using different sized loops, what would the calculations be please?

`

```<code>for (i = 32; i >= 0; i--) {
    for (j = 128; j >= 0; j--) {
        total_x += grid[i][j].x;
    }
}

for (i = 128; i >= 0; i--) {
    for (j = 32; j >= 0; j--) {
         total_y += grid[i][j].y;
    }
}
</code>```

`
If we had a matrix with 128 rows and 24 columns (instead of the 32 x 32 in the example), using 32-bit integers, and with each memory block able to hold 16 bytes, how do we calculate the number of compulsory misses on the top loop?

Also, if we use a direct-mapped cache holding 256 bytes of data, how would we calculate the number of all the data cache misses when running the top loop?

Finally, if we flip it and use the bottom loop, how does the maths change (if it does) for the points above?

Apologies as this is all new to me and I just want to understand the maths behind it so I can answer the problem, rather than just be given an answer.

Nothing - it's a theoretical question

Body:
I'm trying to get an understanding of how to calculate the errors in the code, from the link on this page, Example given from text book. I can see where the calculations come from, but as the values are the same (32), I cannot work out how to do the calculation should the value in the two loops differ. Using different sized loops, what would the calculations be please?

`

for (i = 32; i >= 0; i--) {
    for (j = 128; j >= 0; j--) {
        total_x += grid[i][j].x;
    }
}

for (i = 128; i >= 0; i--) {
    for (j = 32; j >= 0; j--) {
         total_y += grid[i][j].y;
    }
}

`
If we had a matrix with 128 rows and 24 columns (instead of the 32 x 32 in the example), using 32-bit integers, and with each memory block able to hold 16 bytes, how do we calculate the number of compulsory misses on the top loop?

Also, if we use a direct-mapped cache holding 256 bytes of data, how would we calculate the number of all the data cache misses when running the top loop?

Finally, if we flip it and use the bottom loop, how does the maths change (if it does) for the points above?

Apologies as this is all new to me and I just want to understand the maths behind it so I can answer the problem, rather than just be given an answer.

Nothing - it's a theoretical question


问:
How do I create a custom post type and slug In WordPress?
Actually, I would like to create a custom post type in WordPress for my post, as well as a custom slug for that particular post only.

I know the default permalink settings in WordPress, however, I am having trouble with them because they are being applied to all categories.

But, I only wanted to create a custom slug for my custom template.

Here is an example of how settings are applied using permalinks:

Example: www.abc.com/category/post

In my case, I do not want to apply it to all of my categories, but only to my custom posts.

As an example, I would like to convert my custom post slug

From:

abc.com/custom-post

To:

abc.com/category/custom-post

I tried this WordPress script for custom slugs, but it did not work.

function wporg_custom_post_type() {

    register_post_type('wporg_product',

        array(

            'labels'      => array(

                'name'          => __( 'Products', 'textdomain' ),

                'singular_name' => __( 'Product', 'textdomain' ),

            ),

            'public'      => true,

            'has_archive' => true,

            'rewrite'     => array( 'slug' => 'products' ), // my custom slug

        )

    );

}

add_action('init', 'wporg_custom_post_type');
```


问:
Splitting multiple videos into shorter based on frame count
I can cut the video based on seconds, for example, I can cut the video  from second 0 to second 10 and from second 10 to second 20. But I need to cut the video from frame 0 to frame 250 and from frame 250 to frame 500 because of some error due the counting of second. Does anyone has any idea about this?

Here is the code I use to cut based on seconds:

```<code>required_video_file = "H8.avi"

with open("Z:/temp/Letícia/Videos/teste/times.txt") as f:
    times = f.readlines()

times = [x.strip() for x in times]

for time in times:
    starttime = int(time.split('-')[0])
    endtime = int(time.split("-")[1])
    ffmpeg_extract_subclip(required_video_file, starttime, endtime, targetname=str(times.index(time)+1)+".avi")
</code>```

Body:
I can cut the video based on seconds, for example, I can cut the video  from second 0 to second 10 and from second 10 to second 20. But I need to cut the video from frame 0 to frame 250 and from frame 250 to frame 500 because of some error due the counting of second. Does anyone has any idea about this?

Here is the code I use to cut based on seconds:

required_video_file = "H8.avi"

with open("Z:/temp/Letícia/Videos/teste/times.txt") as f:
    times = f.readlines()

times = [x.strip() for x in times]

for time in times:
    starttime = int(time.split('-')[0])
    endtime = int(time.split("-")[1])
    ffmpeg_extract_subclip(required_video_file, starttime, endtime, targetname=str(times.index(time)+1)+".avi")


问:
Error in ImageCollection$select() Error in py_get_attr_impl(x, name, silent) : OverflowError: Python int too large to convert to C long
I'm trying to apply $select at a imageCollection object in rgee but I face the error when I source my script: Error in py_get_attr_impl(x, name, silent) :
OverflowError: Python int too large to convert to C long

When I run every command individually,line by line, in R studio console no problem happens.

Here is the shapefile used in this example : https://mega.nz/file/RkcDxARZ#9lgwP6-RMGE1DgMZ5eE6YoxI8cmYER6iJflVUzsmGtI

rgee version: rgee 1.1.4
R version: 4.2.1
Operating System: Win 10

If I run this code in R Studio console it executes and finish without problems, when I source the script it does not work.

```<code>

shid<-shapefile("D:/temp/rgee_example/feat1.shp")

ids<-shid$text1

require(rgee)
require(mapview)

ee_Initialize(drive = TRUE)

shp<-ee$FeatureCollection("users/********/feat1")

sentinel2 <- ee$ImageCollection$Dataset$COPERNICUS_S2$
  filterDate("2021-08-01","2021-08-30")$
  filterBounds(shp)

#info<-sentinel2$getInfo()

sentBands<-sentinel2$toBands()

nshp<-shp$filter('text1 == "id1"')
k=1
#for(k in 1:length(ids)){

  #nshp<-shp$filter(paste0("'text1 == " ,'"', ids[k] ,'"', "'"))

  sentBands<-sentBands$clip(nshp)

  info<-sentBands$getInfo()

  b2Sele<-NULL

  for(i in 1:length(info$bands)){

    imId<-info$bands[[i]]$id

    if(length(grep("_B2",imId))==1)b2Sele[length(b2Sele)+1]<-imId

  }

  sentB2 <- sentBands$select(c(b2Sele))

  ee_raster <- ee_as_raster(
    image = sentB2,
    region = nshp$geometry(),
    dsn = paste0("D:/gee/sentinel2/date_stack/sentinel2_B2_",ids[k],".tif"),
    via = "drive"
  )

> source("~/.active-rstudio-document")
── rgee 1.1.4 ─────────────────────────────────────────────────────── earthengine-api 0.1.318 ──
 ✔ user: not_defined
 ✔ Google Drive credentials:  FOUND
 ✔ Initializing Google Earth Engine:  DONE!
 ✔ Earth Engine account: users/*********
────────────────────────────────────────────────────────────────────────────────────────────────
 Error in py_get_attr_impl(x, name, silent) :
OverflowError: Python int too large to convert to C long

</code>```

Body:
I'm trying to apply $select at a imageCollection object in rgee but I face the error when I source my script: Error in py_get_attr_impl(x, name, silent) :
OverflowError: Python int too large to convert to C long

When I run every command individually,line by line, in R studio console no problem happens.

Here is the shapefile used in this example : https://mega.nz/file/RkcDxARZ#9lgwP6-RMGE1DgMZ5eE6YoxI8cmYER6iJflVUzsmGtI

rgee version: rgee 1.1.4
R version: 4.2.1
Operating System: Win 10

If I run this code in R Studio console it executes and finish without problems, when I source the script it does not work.

shid<-shapefile("D:/temp/rgee_example/feat1.shp")

ids<-shid$text1

require(rgee)
require(mapview)

ee_Initialize(drive = TRUE)

shp<-ee$FeatureCollection("users/********/feat1")

sentinel2 <- ee$ImageCollection$Dataset$COPERNICUS_S2$
  filterDate("2021-08-01","2021-08-30")$
  filterBounds(shp)

#info<-sentinel2$getInfo()

sentBands<-sentinel2$toBands()

nshp<-shp$filter('text1 == "id1"')
k=1
#for(k in 1:length(ids)){

  #nshp<-shp$filter(paste0("'text1 == " ,'"', ids[k] ,'"', "'"))

  sentBands<-sentBands$clip(nshp)

  info<-sentBands$getInfo()

  b2Sele<-NULL

  for(i in 1:length(info$bands)){

    imId<-info$bands[[i]]$id

    if(length(grep("_B2",imId))==1)b2Sele[length(b2Sele)+1]<-imId

  }

  sentB2 <- sentBands$select(c(b2Sele))

  ee_raster <- ee_as_raster(
    image = sentB2,
    region = nshp$geometry(),
    dsn = paste0("D:/gee/sentinel2/date_stack/sentinel2_B2_",ids[k],".tif"),
    via = "drive"
  )

> source("~/.active-rstudio-document")
── rgee 1.1.4 ─────────────────────────────────────────────────────── earthengine-api 0.1.318 ──
 ✔ user: not_defined
 ✔ Google Drive credentials:  FOUND
 ✔ Initializing Google Earth Engine:  DONE!
 ✔ Earth Engine account: users/*********
────────────────────────────────────────────────────────────────────────────────────────────────
 Error in py_get_attr_impl(x, name, silent) :
OverflowError: Python int too large to convert to C long


问:
GPO lock screen even when video/radio is playing
We currently have an active GPO that locks users screens after 5 mins, so they have to relogin.
But unfortunately some users started playing 10+ hours youtube videos to bypass this GPO and then leave their PC unlocked for a long period of time.

Is there any way to handle their "bypass solution"?
Like, their screen would lock after 5 mins of mouse inactivity or something, even when the video/radio is playing?

Perhaps I am not using the right key words, but I can't seem to find any solution on Google.
Need to figure out how to recognize that the user is away, even when the YT video is playing.

Thanks in advance!
David