问:
Problem in Client and Server Architecture. Exception in thread appears

I wrote this code in java based on sockets and thread pool. The server code runs on its own but when I run the client code after running the server, an exception on the server appears. What could be causing this?

```<code>
Below  is the server class which conatains threads for each new client

package java_40;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
//Server Implementation
/**
 *
 * @author Abdullah
 */
public class Server implements Runnable {

private ArrayList<ConnectionHandler> connections;
private ServerSocket server;
private boolean done;
private ExecutorService pool;

public Server (){
    connections = new ArrayList<>();
    done = false;

}
    @Override
    public void run() {
        try {

            while(!done){
            server = new ServerSocket(9999);
            pool = Executors.newCachedThreadPool();

            Socket client = server.accept();
            ConnectionHandler handler = new ConnectionHandler(client);
            connections.add(handler);
            pool.execute(handler);
            }

        } catch (IOException ex) {
           shutdown();
        }
    }

    public void broadcast(String message){
        for(ConnectionHandler ch :connections){
            if(ch !=null){
                ch.sendMessage(message);
            }
        }
    }

    public void shutdown(){
        try{
        done=true;

        if(!server.isClosed()){
            server.close();
        }
        for(ConnectionHandler ch : connections){
            ch.shutdown();
        }
        }catch(IOException e){
//           ignore
        }
    }

    class ConnectionHandler implements Runnable{        //handles individual client connection

        private final Socket client;
        private BufferedReader in;
        private PrintWriter out;
        private  String nickname;

        public ConnectionHandler(Socket client){
          this.client = client;
        }

        @Override
        public void run() {

            if(client != null){
            try{
                out = new PrintWriter(client.getOutputStream(), true);
                in = new BufferedReader(new InputStreamReader(client.getInputStream()));
                out.println("Enter nickname");
                nickname =in.readLine();

                System.out.println(nickname+" connected");
                broadcast(nickname + " has joined the chat");
                String message;

                while((message = in.readLine()) !=null){
                    if (message.startsWith("/nick"))
                    {
//                         TODO: handle nickname
                        String[] messageSplit = message.split(" ", 2);

                        if(messageSplit.length == 2){

                            broadcast(nickname + " renamed themselves to " + messageSplit[1]);
                            System.out.println(nickname + " renamed themselves to " + messageSplit[1]);
                            nickname = messageSplit[1];
                            out.println("Successfully changed nickname to " + nickname);

                        }else{
                            out.println("No nickname provided");
                        }
                    }
                    else if(message.startsWith("/quit")){

                        broadcast(nickname + " has left the chat");
//                        shutdown();
                }
                    else{
                        broadcast(nickname + ": " + message);
                    }
                }

            } catch(IOException e){
                if(this.in != null && this.out !=  null){
                  shutdown();
                }
            }
         }
        }

        public void sendMessage(String message){
           out.println(message);
        }

        public void shutdown(){
            try{

            in.close();
            out.close();
            if(!client.isClosed()){
                client.close();

            }
            }catch(IOException e){
                // ignore
            }
        }

    }

    public static void main(String[] args) {
        // TODO code application logic here

        Server server =new Server();
        server.run();
    }
}

</code>```

below is the client class in which client has been implemented. A great number of clients can connect to the server through cmd.

```<code>/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package java_40;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class client implements Runnable{

    private Socket client;
    private BufferedReader in;
    private PrintWriter out;
    private boolean done;
    @Override
    public void run() {

        try{
            Socket client = new Socket("127.0.0.1",9999); // if you want to connect to someone elses server replace the ip with their ip as of now this our own ip
            out = new PrintWriter(client.getOutputStream(),true);
            in = new BufferedReader(new InputStreamReader(client.getInputStream()));

            InputHandler inHandler = new InputHandler();
            Thread t = new Thread(inHandler);
            t.start();

            String inMessage;

            while((inMessage = in.readLine()) != null )
            {
                System.out.println(inMessage);
            }

        }catch(IOException e){
           // shutdown();
        }
    }
    private void shutdown(){
        done =true;
        try{
            in.close();
            out.close();

            if(!client.isClosed()){
            client.close();
        }
        }catch(IOException e){
            // ignore
        }
    }

     class InputHandler implements Runnable{

        @Override
        public void run() {
            try{
                BufferedReader inReader = new BufferedReader(new InputStreamReader(System.in));
                while(!done){
                    String message = inReader.readLine();
                    if(message.equals("/quits")){
                        inReader.close();
                        shutdown();

                    }else{
                        out.println(message);
                    }
                }
            }catch(IOException e){
               // shutdown();
            }
        }

     }
     public static void main(String[] args) {

        client c = new client();
        c.run();
    }
}

</code>```

Body:
I wrote this code in java based on sockets and thread pool. The server code runs on its own but when I run the client code after running the server, an exception on the server appears. What could be causing this?

Below  is the server class which conatains threads for each new client

package java_40;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
//Server Implementation
/**
 *
 * @author Abdullah
 */
public class Server implements Runnable {

private ArrayList<ConnectionHandler> connections;
private ServerSocket server;
private boolean done;
private ExecutorService pool;

public Server (){
    connections = new ArrayList<>();
    done = false;

}
    @Override
    public void run() {
        try {

            while(!done){
            server = new ServerSocket(9999);
            pool = Executors.newCachedThreadPool();

            Socket client = server.accept();
            ConnectionHandler handler = new ConnectionHandler(client);
            connections.add(handler);
            pool.execute(handler);
            }

        } catch (IOException ex) {
           shutdown();
        }
    }

    public void broadcast(String message){
        for(ConnectionHandler ch :connections){
            if(ch !=null){
                ch.sendMessage(message);
            }
        }
    }

    public void shutdown(){
        try{
        done=true;

        if(!server.isClosed()){
            server.close();
        }
        for(ConnectionHandler ch : connections){
            ch.shutdown();
        }
        }catch(IOException e){
//           ignore
        }
    }

    class ConnectionHandler implements Runnable{        //handles individual client connection

        private final Socket client;
        private BufferedReader in;
        private PrintWriter out;
        private  String nickname;

        public ConnectionHandler(Socket client){
          this.client = client;
        }

        @Override
        public void run() {

            if(client != null){
            try{
                out = new PrintWriter(client.getOutputStream(), true);
                in = new BufferedReader(new InputStreamReader(client.getInputStream()));
                out.println("Enter nickname");
                nickname =in.readLine();

                System.out.println(nickname+" connected");
                broadcast(nickname + " has joined the chat");
                String message;

                while((message = in.readLine()) !=null){
                    if (message.startsWith("/nick"))
                    {
//                         TODO: handle nickname
                        String[] messageSplit = message.split(" ", 2);

                        if(messageSplit.length == 2){

                            broadcast(nickname + " renamed themselves to " + messageSplit[1]);
                            System.out.println(nickname + " renamed themselves to " + messageSplit[1]);
                            nickname = messageSplit[1];
                            out.println("Successfully changed nickname to " + nickname);

                        }else{
                            out.println("No nickname provided");
                        }
                    }
                    else if(message.startsWith("/quit")){

                        broadcast(nickname + " has left the chat");
//                        shutdown();
                }
                    else{
                        broadcast(nickname + ": " + message);
                    }
                }

            } catch(IOException e){
                if(this.in != null && this.out !=  null){
                  shutdown();
                }
            }
         }
        }

        public void sendMessage(String message){
           out.println(message);
        }

        public void shutdown(){
            try{

            in.close();
            out.close();
            if(!client.isClosed()){
                client.close();

            }
            }catch(IOException e){
                // ignore
            }
        }

    }

    public static void main(String[] args) {
        // TODO code application logic here

        Server server =new Server();
        server.run();
    }
}

below is the client class in which client has been implemented. A great number of clients can connect to the server through cmd.

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package java_40;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class client implements Runnable{

    private Socket client;
    private BufferedReader in;
    private PrintWriter out;
    private boolean done;
    @Override
    public void run() {

        try{
            Socket client = new Socket("127.0.0.1",9999); // if you want to connect to someone elses server replace the ip with their ip as of now this our own ip
            out = new PrintWriter(client.getOutputStream(),true);
            in = new BufferedReader(new InputStreamReader(client.getInputStream()));

            InputHandler inHandler = new InputHandler();
            Thread t = new Thread(inHandler);
            t.start();

            String inMessage;

            while((inMessage = in.readLine()) != null )
            {
                System.out.println(inMessage);
            }

        }catch(IOException e){
           // shutdown();
        }
    }
    private void shutdown(){
        done =true;
        try{
            in.close();
            out.close();

            if(!client.isClosed()){
            client.close();
        }
        }catch(IOException e){
            // ignore
        }
    }

     class InputHandler implements Runnable{

        @Override
        public void run() {
            try{
                BufferedReader inReader = new BufferedReader(new InputStreamReader(System.in));
                while(!done){
                    String message = inReader.readLine();
                    if(message.equals("/quits")){
                        inReader.close();
                        shutdown();

                    }else{
                        out.println(message);
                    }
                }
            }catch(IOException e){
               // shutdown();
            }
        }

     }
     public static void main(String[] args) {

        client c = new client();
        c.run();
    }
}


来源: stackexchange

问:
How do you uninstall a service worker from the server?
I have an app where users can interact on multiple devices (laptop, cellphone, etc.)
They can opt into notifications. So when a user gets a targeted notification, the server will look through all the devices they have registered and push notifications to the subscribed devices.
If a user no longer wishes to get notifications, the device and corresponding subscription object is removed.

I want to also uninstall the service worker. Currently the options are:

Do this manually through devtools UI (not ideal)

iterate through navigator.serviceWorker.getRegistrations() and uninstall each serviceWorker.

However these are not sufficient. Say the user is on the laptop and wants to disable notifications to their phone. What happens then? Is there a way to disable a service worker from a subscription object, potentially from the server?

ContentLicense: CC BY-SA 4.0


问:
Proxy error: Could not proxy request /api/products from localhost:3000 to http://localhost:5000/
```<code>import express from 'express';
import bcrypt from 'bcryptjs';
import expressAsyncHandler from 'express-async-handler';
import User from '../models/userModel.js';
import { generateToken } from '../utils.js';

const userRouter = express.Router();

userRouter.post(
  '/cart/signin',
  expressAsyncHandler(async (req, res) => {
    const user = await User.findOne({ email: req.body.email });
    if (user) {
      if (bcrypt.compareSync(req.body.password, user.password)) {
        res.send({
          _id: user._id,
          name: user.name,
          email: user.email,
          isAdmin: user.isAdmin,
          token: generateToken(user),
        });
        return;
      }
    }
    res.status(401).send({ message: 'Invalid email or password' });
  })
);

export default userRouter;
</code>```

this is happening in the advanced rest client to test the data is reaching the server

x-powered-by:
Express
content-type:
application/json; charset=utf-8
content-length:
39
etag:
W/"27-Mm37A2ls1bgL0/D8e3MSpDLbow8"
connection:
keep-alive
keep-alive:
timeout=5

{
"message": "Invalid email or password"
}

```<code></code>```

Body:
import express from 'express';
import bcrypt from 'bcryptjs';
import expressAsyncHandler from 'express-async-handler';
import User from '../models/userModel.js';
import { generateToken } from '../utils.js';

const userRouter = express.Router();

userRouter.post(
  '/cart/signin',
  expressAsyncHandler(async (req, res) => {
    const user = await User.findOne({ email: req.body.email });
    if (user) {
      if (bcrypt.compareSync(req.body.password, user.password)) {
        res.send({
          _id: user._id,
          name: user.name,
          email: user.email,
          isAdmin: user.isAdmin,
          token: generateToken(user),
        });
        return;
      }
    }
    res.status(401).send({ message: 'Invalid email or password' });
  })
);

export default userRouter;

this is happening in the advanced rest client to test the data is reaching the server

x-powered-by:
Express
content-type:
application/json; charset=utf-8
content-length:
39
etag:
W/"27-Mm37A2ls1bgL0/D8e3MSpDLbow8"
connection:
keep-alive
keep-alive:
timeout=5

{
"message": "Invalid email or password"
}


问:
how to get the call back of update_one in mongodb using django?
I'm trying to update some values to a document in a collection using

dbconn.collectionName.update_one(
          {'_id': ObjectId('6396c654efd251498ea4ebbc')},
          {'$addToSet': {
                  'updateHistory': {
                        "key":"Text",
                        "key":"date"
                        "key":ObjectId("633456783er5t672342134")
              }
            }
          },
          {'$set': {
                "key":"Text",
                "key":ObjectId("633456783er5t672342134")
             }
          }
)
```

so what I'm trying to achieve is to acknowledge whether the document updated or not by getting the callback of update_one()
if it's updated i need to do certain actions depending on that, how's that possible?

Body:
I'm trying to update some values to a document in a collection using

dbconn.collectionName.update_one(
          {'_id': ObjectId('6396c654efd251498ea4ebbc')},
          {'$addToSet': {
                  'updateHistory': {
                        "key":"Text",
                        "key":"date"
                        "key":ObjectId("633456783er5t672342134")
              }
            }
          },
          {'$set': {
                "key":"Text",
                "key":ObjectId("633456783er5t672342134")
             }
          }
)

so what I'm trying to achieve is to acknowledge whether the document updated or not by getting the callback of update_one()
if it's updated i need to do certain actions depending on that, how's that possible?


问:
Convert string to string[] in Angular Reactive Form for use in PrimeNG MultiSelect
I am using PrimeNG Multiselect and it expect a array, but my REST use a string with commas.

How I can convert/transform the data directly?

I found use a directive that extend from ControlValueAccessor, but I get this error

More than one custom value accessor matches form control with unspecified name attribute

And I think a my directive not working with component input, only for native inputs:

import {Directive, ElementRef, forwardRef, HostListener, Renderer2} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from "@angular/forms";

@Directive({
  selector: '[string2array]',
  standalone: true,
  providers: [
    {
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(() =>String2ArrayDirective),
      multi: true
    }
  ]
})
export class String2ArrayDirective implements ControlValueAccessor {

  @HostListener('input', ['$event.target.value']) onInput = (array?: string[]) => {
    const string = array ? array.join(","): null;
    this.onChange(string);
  }
  onChange: any = () => {};

  @HostListener('blur', []) onTouched = () => { };
  constructor(
    private renderer: Renderer2,
    private elementRef: ElementRef
  ) {
  }

  writeValue(string?: string): void {
    const array = string ? string.split(",") : null;
    this.renderer.setProperty(this.elementRef.nativeElement, 'value', array);
  }

  registerOnChange(fn: (_: any) => void): void {
    this.onChange = fn;
  }

  registerOnTouched(fn: () => void): void {
    this.onTouched = fn;
  }

  setDisabledState(isDisabled: boolean): void {
    this.renderer.setProperty(this.elementRef.nativeElement, 'disabled', isDisabled);
  }

}

```


问:
ZeeBe: Failed to send activated jobs to client (only for one job type)
I have test stand.

Java app with:

io.camunda:spring-zeebe-starter:8.1.12

io.camunda:zeebe-client-java:8.1.5

Docker containers

camunda/zeebe:8.1.5

elasticsearch:7.17.0

And it works very good! But some time later only one job type can’t start handler

Java client log:

```<code>io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: Time out between gateway and broker: Request ProtocolRequest{id=32953, subject=command-api-1, sender=0.0.0.0:26502, payload=byte[]{length=1157, hash=-1568037875}} to 0.0.0.0:26501 timed out in PT10S
    at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.49.1.jar!/:1.49.1]
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:487) ~[grpc-stub-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
</code>```

Сamunda/zeebe output log:

```<code>2022-12-21 12:26:17.028 [ActivateJobsHandler] [Broker-0-zb-actors-1] DEBUG
      io.camunda.zeebe.gateway - Failed to send 2 activated jobs for type admin-module-get-custom-message-task-z (with job keys: [2251799930062329, 2251799930062332]) to client, because: Failed to send activated jobs to client
2022-12-21 12:26:22.160 [] [grpc-default-worker-ELG-5-1] WARN
      io.grpc.netty.NettyServerHandler - Stream Error
io.netty.handler.codec.http2.Http2Exception$StreamException: Stream closed before write could take place
    at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:173) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$FlowState.cancel(DefaultHttp2RemoteFlowController.java:481) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$1.onStreamClosed(DefaultHttp2RemoteFlowController.java:105) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection.notifyClosed(DefaultHttp2Connection.java:357) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$ActiveStreams.removeFromActiveStreams(DefaultHttp2Connection.java:1007) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$ActiveStreams.deactivate(DefaultHttp2Connection.java:963) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultStream.close(DefaultHttp2Connection.java:515) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultStream.close(DefaultHttp2Connection.java:521) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.closeStream(Http2ConnectionHandler.java:628) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onRstStreamRead(DefaultHttp2ConnectionDecoder.java:444) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onRstStreamRead(Http2InboundFrameLogger.java:80) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readRstStreamFrame(DefaultHttp2FrameReader.java:509) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:259) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:173) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
</code>```

Also I started getting periodic background log

Java client background log:

```<code>2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
</code>```

This fail is actual only for one job type.
Others jobs work correctly.
Also this job works correctly when camunda/zeebe and elasticsearch starts without old data.

I renamed the job type and it helped.
But I am very worried about the case.
The broker just doesn’t run a handler with the specified job name and I can’t get any details. It looks like the broker has a black list.

How can I get more info about why job can't start?

Thank you!

Body:
I have test stand.

Java app with:

io.camunda:spring-zeebe-starter:8.1.12

io.camunda:zeebe-client-java:8.1.5

Docker containers

camunda/zeebe:8.1.5

elasticsearch:7.17.0

And it works very good! But some time later only one job type can’t start handler

Java client log:

io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: Time out between gateway and broker: Request ProtocolRequest{id=32953, subject=command-api-1, sender=0.0.0.0:26502, payload=byte[]{length=1157, hash=-1568037875}} to 0.0.0.0:26501 timed out in PT10S
    at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.49.1.jar!/:1.49.1]
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:487) ~[grpc-stub-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.49.1.jar!/:1.49.1]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

Сamunda/zeebe output log:

2022-12-21 12:26:17.028 [ActivateJobsHandler] [Broker-0-zb-actors-1] DEBUG
      io.camunda.zeebe.gateway - Failed to send 2 activated jobs for type admin-module-get-custom-message-task-z (with job keys: [2251799930062329, 2251799930062332]) to client, because: Failed to send activated jobs to client
2022-12-21 12:26:22.160 [] [grpc-default-worker-ELG-5-1] WARN
      io.grpc.netty.NettyServerHandler - Stream Error
io.netty.handler.codec.http2.Http2Exception$StreamException: Stream closed before write could take place
    at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:173) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$FlowState.cancel(DefaultHttp2RemoteFlowController.java:481) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$1.onStreamClosed(DefaultHttp2RemoteFlowController.java:105) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection.notifyClosed(DefaultHttp2Connection.java:357) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$ActiveStreams.removeFromActiveStreams(DefaultHttp2Connection.java:1007) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$ActiveStreams.deactivate(DefaultHttp2Connection.java:963) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultStream.close(DefaultHttp2Connection.java:515) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2Connection$DefaultStream.close(DefaultHttp2Connection.java:521) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.closeStream(Http2ConnectionHandler.java:628) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onRstStreamRead(DefaultHttp2ConnectionDecoder.java:444) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onRstStreamRead(Http2InboundFrameLogger.java:80) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readRstStreamFrame(DefaultHttp2FrameReader.java:509) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:259) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:173) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453) ~[netty-codec-http2-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]

Also I started getting periodic background log

Java client background log:

2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream
2022-12-21 12:23:28.964  INFO 7 --- [-worker-ELG-1-2] io.grpc.internal.AbstractClientStream    : Received data on closed stream

This fail is actual only for one job type.
Others jobs work correctly.
Also this job works correctly when camunda/zeebe and elasticsearch starts without old data.

I renamed the job type and it helped.
But I am very worried about the case.
The broker just doesn’t run a handler with the specified job name and I can’t get any details. It looks like the broker has a black list.

How can I get more info about why job can't start?

Thank you!


问:
I can't add data to the list in flutter bloc. When i add the data, it does not work
i want to add hashtags to the list in state, but i can't add value to list using Bloc Flutter

When i add the data to the list in file bloc, it doesn't work.

Here i send the event by onPressed method.

```<code>TextButton(
  style: TextButton.styleFrom(
    textStyle: Theme.of(context).textTheme.labelLarge,
  ),
  child: Text(
    'Save',
    style: Theme.of(context).textTheme.subtitle2?.copyWith(
        fontSize: 15, color: colorBlue, letterSpacing: 1),
  ),
  onPressed: () {
    var hashtag;
    setState(() {
      hashtag  = _hashtagController.value.text;
    });
    print(hashtag);
    if (_hashtagController.value.text.isNotEmpty) {
        context
            .read<DealsBloc>()
            .add(AddHashtag(hashtag: _hashtagController.value.text));
        Navigator.of(context).pop();
    }
  },
),
</code>```

Event File

Here i describe the event "Add Hashtag".

```<code>part of 'deals_bloc.dart';

abstract class DealsEvent extends Equatable {

  const DealsEvent();

  @override
  List<Object> get props => [];
}

class AddHashtag extends DealsEvent {

  final String hashtag;

  const AddHashtag({
    required this.hashtag
});

  @override
  List<Object> get props => [ hashtag ];
}
</code>```

State File

```<code>part of 'deals_bloc.dart';

class DealsState extends Equatable {
  final List<String> hashtags;
  final List<Deal> deals;
  final List<String> imagePaths;

  const DealsState({
    this.deals = const <Deal>[],
    this.imagePaths = const <String>[],
    this.hashtags = const <String>['Add a new hashtag']
  });

  @override
  List<Object?> get props => [hashtags, deals, imagePaths];

  Map<String, dynamic> toMap() {
    return {
      'hashtags': this.hashtags,
      'deals': this.deals,
      'imagePaths': this.imagePaths,
    };
  }

  factory DealsState.fromMap(Map<String, dynamic> map) {
    return DealsState(
      hashtags: map['hashtags'] as List<String>,
      deals: map['deals'] as List<Deal>,
      imagePaths: map['imagePaths'] as List<String>,
    );
  }

}
</code>```

Bloc File

```<code>import 'package:equatable/equatable.dart';
import 'package:trade_stat/blocs/bloc_exports.dart';

part 'deals_event.dart';
part 'deals_state.dart';

class DealsBloc extends HydratedBloc<DealsEvent, DealsState> {
  final DealsRepository dealsRepository;

  DealsBloc({required this.dealsRepository}) : super(const DealsState()) {
    on<AddHashtag>(_onAddHashtag);
  }

void _onAddHashtag(AddHashtag event, Emitter<DealsState> emit) {
    final state = this.state;
    List<String> hashtags  = List.from(state.hashtags);
    hashtags.add(event.hashtag);
    emit(DealsState(hashtags: hashtags));
    print(state.hashtags);
  }

  @override
  DealsState? fromJson(Map<String, dynamic> json) {
    return DealsState.fromMap(json);
  }

  @override
  Map<String, dynamic>? toJson(DealsState state) {
    return state.toMap();
  }

}
</code>```

What i get as a result

```<code>I/flutter (11934): trend
I/flutter (11934): [Add a new hashtag]
</code>```

Value was not added to the list.
The list remains the same.

Body:
i want to add hashtags to the list in state, but i can't add value to list using Bloc Flutter

When i add the data to the list in file bloc, it doesn't work.

Here i send the event by onPressed method.

TextButton(
  style: TextButton.styleFrom(
    textStyle: Theme.of(context).textTheme.labelLarge,
  ),
  child: Text(
    'Save',
    style: Theme.of(context).textTheme.subtitle2?.copyWith(
        fontSize: 15, color: colorBlue, letterSpacing: 1),
  ),
  onPressed: () {
    var hashtag;
    setState(() {
      hashtag  = _hashtagController.value.text;
    });
    print(hashtag);
    if (_hashtagController.value.text.isNotEmpty) {
        context
            .read<DealsBloc>()
            .add(AddHashtag(hashtag: _hashtagController.value.text));
        Navigator.of(context).pop();
    }
  },
),

Event File

Here i describe the event "Add Hashtag".

part of 'deals_bloc.dart';

abstract class DealsEvent extends Equatable {

  const DealsEvent();

  @override
  List<Object> get props => [];
}

class AddHashtag extends DealsEvent {

  final String hashtag;

  const AddHashtag({
    required this.hashtag
});

  @override
  List<Object> get props => [ hashtag ];
}

State File

part of 'deals_bloc.dart';

class DealsState extends Equatable {
  final List<String> hashtags;
  final List<Deal> deals;
  final List<String> imagePaths;

  const DealsState({
    this.deals = const <Deal>[],
    this.imagePaths = const <String>[],
    this.hashtags = const <String>['Add a new hashtag']
  });

  @override
  List<Object?> get props => [hashtags, deals, imagePaths];

  Map<String, dynamic> toMap() {
    return {
      'hashtags': this.hashtags,
      'deals': this.deals,
      'imagePaths': this.imagePaths,
    };
  }

  factory DealsState.fromMap(Map<String, dynamic> map) {
    return DealsState(
      hashtags: map['hashtags'] as List<String>,
      deals: map['deals'] as List<Deal>,
      imagePaths: map['imagePaths'] as List<String>,
    );
  }

}

Bloc File

import 'package:equatable/equatable.dart';
import 'package:trade_stat/blocs/bloc_exports.dart';

part 'deals_event.dart';
part 'deals_state.dart';

class DealsBloc extends HydratedBloc<DealsEvent, DealsState> {
  final DealsRepository dealsRepository;

  DealsBloc({required this.dealsRepository}) : super(const DealsState()) {
    on<AddHashtag>(_onAddHashtag);
  }

void _onAddHashtag(AddHashtag event, Emitter<DealsState> emit) {
    final state = this.state;
    List<String> hashtags  = List.from(state.hashtags);
    hashtags.add(event.hashtag);
    emit(DealsState(hashtags: hashtags));
    print(state.hashtags);
  }

  @override
  DealsState? fromJson(Map<String, dynamic> json) {
    return DealsState.fromMap(json);
  }

  @override
  Map<String, dynamic>? toJson(DealsState state) {
    return state.toMap();
  }

}

What i get as a result

I/flutter (11934): trend
I/flutter (11934): [Add a new hashtag]

Value was not added to the list.
The list remains the same.


问:
Grafana Table visualization
am trying to create a table visualization for my apis in grafana dashboard.  my metrics in prometheus looks like below

```<code>my_metric{instance="lh",job="job",apiname="a1"} 1
my_metric{instance="lh",job="job",apiname="a2"} 2
my_metric_sum{instance="lh",job="job",apiname="a2"} 2
my_metric_count{instance="lh",job="job",apiname="a2"} 2
</code>```

i want to calculate the average response time and display in table like below

```<code>-------------
APIName | Response Time
--------------------------
a1      | 2
a2      | 3
--------------------------
</code>```

please let me know how i can do this using table visualizations?

using transaformations, am able to display the metric labels and its values, but how do i display the value of the fourmula for each api without any hard coding...

Thanks in advance.

Title: Grafana Table visualization

Body:
am trying to create a table visualization for my apis in grafana dashboard.  my metrics in prometheus looks like below

my_metric{instance="lh",job="job",apiname="a1"} 1
my_metric{instance="lh",job="job",apiname="a2"} 2
my_metric_sum{instance="lh",job="job",apiname="a2"} 2
my_metric_count{instance="lh",job="job",apiname="a2"} 2

i want to calculate the average response time and display in table like below

-------------
APIName | Response Time
--------------------------
a1      | 2
a2      | 3
--------------------------

please let me know how i can do this using table visualizations?

using transaformations, am able to display the metric labels and its values, but how do i display the value of the fourmula for each api without any hard coding...

Thanks in advance.


问:
How to display data in textview automatically when i have finished inputting the ID field?
so i have edittext & textview. edittext for NIK & textview for NAMA. the concept is when I have finished typing the NIK field, then at that moment the name data (NAMA) appears in the textview automatically based on database. I still confused how to do it properly.

Database Structure

NIK
NAMA

96296
Farrasta

94878
Alfian

Edit Text

```<code>etNik.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        String data = etNik.getText().toString();
        if (data == NikKry){
            getNama();
        }
    }

    @Override
    public void afterTextChanged(Editable s) {

    }
});
</code>```

Function for get NAMA

```<code>private void getNama(){
    APIRequestData armNama = RetroMaster.konekRetrofit().create(APIRequestData.class);
    Call<List<DataMaster>> tampilNama = armNama.ardGetNama(NikKry);

    tampilNama.enqueue(new Callback<List<DataMaster>>() {
        @Override
        public void onResponse(Call<List<DataMaster>> call, Response<List<DataMaster>> response) {
            if (response.isSuccessful()) {
                tvNama.setText(response.body().get(0).getNAMA());
            }
        }
        @Override
        public void onFailure(Call<List<DataMaster>> call, Throwable t) {
            Toast.makeText(TambahActivity.this, "Gagal "+t.getMessage(), Toast.LENGTH_SHORT).show();
        }
    });
}
</code>```

Body:
so i have edittext & textview. edittext for NIK & textview for NAMA. the concept is when I have finished typing the NIK field, then at that moment the name data (NAMA) appears in the textview automatically based on database. I still confused how to do it properly.

Database Structure

NIK
NAMA

96296
Farrasta

94878
Alfian

Edit Text

etNik.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        String data = etNik.getText().toString();
        if (data == NikKry){
            getNama();
        }
    }

    @Override
    public void afterTextChanged(Editable s) {

    }
});

Function for get NAMA

private void getNama(){
    APIRequestData armNama = RetroMaster.konekRetrofit().create(APIRequestData.class);
    Call<List<DataMaster>> tampilNama = armNama.ardGetNama(NikKry);

    tampilNama.enqueue(new Callback<List<DataMaster>>() {
        @Override
        public void onResponse(Call<List<DataMaster>> call, Response<List<DataMaster>> response) {
            if (response.isSuccessful()) {
                tvNama.setText(response.body().get(0).getNAMA());
            }
        }
        @Override
        public void onFailure(Call<List<DataMaster>> call, Throwable t) {
            Toast.makeText(TambahActivity.this, "Gagal "+t.getMessage(), Toast.LENGTH_SHORT).show();
        }
    });
}


问:
Microsoft ACE OLEDB connection creating filter like use "Excel.Application"
Can I make filter in created excel?

This is the standard connection string e.g. I create file Excel and save to disk

```<code>ConnectionString= "
|Provider=Microsoft.ACE.OLEDB.12.0;
|Data Source="+NameExcel+";
|Extended Properties=""Excel 12.0;HDR=Yes;IMEX=0;""";

Connection = new COMObject("ADODB.Connection");
Connection.Open(ConnectionString);

Command = new COMObject("ADODB.Command");
Command.ActiveConnection = Connection;
Command.CommandType = 1;

TablName= "Mane1";
Command.CommandText = "CREATE TABLE ["+NameTabl+"] ([Vagon] int, [Date op] date,
[Operation] char(255), [Date NSP] date)";
Command.Execute();
</code>```

but I'd like to set filter on head My table
I have used "Excel.Application" I can do it used it:

```<code>Region = Excel.ActiveSheet.Range(Excel.ActiveSheet.Cells(1,1),Excel.ActiveSheet.Cells(1,CountColumn);
</code>```

But I'm reaquared to use Microsoft.ACE.OLEDB.12.0 without "Excel.Application"

Body:
Can I make filter in created excel?

This is the standard connection string e.g. I create file Excel and save to disk

ConnectionString= "
|Provider=Microsoft.ACE.OLEDB.12.0;
|Data Source="+NameExcel+";
|Extended Properties=""Excel 12.0;HDR=Yes;IMEX=0;""";

Connection = new COMObject("ADODB.Connection");
Connection.Open(ConnectionString);

Command = new COMObject("ADODB.Command");
Command.ActiveConnection = Connection;
Command.CommandType = 1;

TablName= "Mane1";
Command.CommandText = "CREATE TABLE ["+NameTabl+"] ([Vagon] int, [Date op] date,
[Operation] char(255), [Date NSP] date)";
Command.Execute();

but I'd like to set filter on head My table
I have used "Excel.Application" I can do it used it:

Region = Excel.ActiveSheet.Range(Excel.ActiveSheet.Cells(1,1),Excel.ActiveSheet.Cells(1,CountColumn);

But I'm reaquared to use Microsoft.ACE.OLEDB.12.0 without "Excel.Application"


问:
Concatenating Entire Row to Get Checksum of the Data Returns Error
I'm trying to concatenate an entire row of data to get their checksum output in AWS Redshift external tables to insert them in another external table.

Here's a sample of my code (I have much more columns around 24):

```<code>INSERT  INTO EXTERNAL_TABLE_4
SELECT  DISTINCT
        A.CD,
        B.TITLE,
        C.COUNTRY,
        A.CREATE_DT,
        CAST(CHECKSUM(
            COALESCE(CAST(A.CD AS VARCHAR(50)), '0') ||
            COALESCE(B.TITLE, '0') ||
            COALESCE(C.COUNTRY, '0') ||
            COALESCE(CAST(A.CREATE_DT AS VARCHAR(50)), '0')
        ) AS VARCHAR(256))
FROM    EXTERNAL_TABLE_1 A
        LEFT JOIN  EXTERNAL_TABLE_2    B   ON B.CD = A.CD
        LEFT JOIN  EXTERNAL_TABLE_3    C   ON C.CD = A.CD;
</code>```

This format returns the following error on DBeaver:

```<code>SQL Error [42725]: ERROR: function checksum(text) is not unique
  Hint: Could not choose a best candidate function. You may need to add explicit type casts.
</code>```

And returns the following error on Athena:

```<code>TYPE_MISMATCH: line 31:9: Cannot cast varbinary to varchar(256)
</code>```

The objective is to get a unique identifier for each row of data that can be compared on each data load to know if the record was changed.

I tried concatenating the rows using the concatenation operator.
The concatenation operator requires that all data types are identical, so I cast the non-string data types.
The concatenation operator also nullifies the whole row in case one of the values is null, so I used coalesce. And I cast the checksum to be able to insert it in the table (I need to cast it to integer or varchar).

Body:
I'm trying to concatenate an entire row of data to get their checksum output in AWS Redshift external tables to insert them in another external table.

Here's a sample of my code (I have much more columns around 24):

INSERT  INTO EXTERNAL_TABLE_4
SELECT  DISTINCT
        A.CD,
        B.TITLE,
        C.COUNTRY,
        A.CREATE_DT,
        CAST(CHECKSUM(
            COALESCE(CAST(A.CD AS VARCHAR(50)), '0') ||
            COALESCE(B.TITLE, '0') ||
            COALESCE(C.COUNTRY, '0') ||
            COALESCE(CAST(A.CREATE_DT AS VARCHAR(50)), '0')
        ) AS VARCHAR(256))
FROM    EXTERNAL_TABLE_1 A
        LEFT JOIN  EXTERNAL_TABLE_2    B   ON B.CD = A.CD
        LEFT JOIN  EXTERNAL_TABLE_3    C   ON C.CD = A.CD;

This format returns the following error on DBeaver:

SQL Error [42725]: ERROR: function checksum(text) is not unique
  Hint: Could not choose a best candidate function. You may need to add explicit type casts.

And returns the following error on Athena:

TYPE_MISMATCH: line 31:9: Cannot cast varbinary to varchar(256)

The objective is to get a unique identifier for each row of data that can be compared on each data load to know if the record was changed.

I tried concatenating the rows using the concatenation operator.
The concatenation operator requires that all data types are identical, so I cast the non-string data types.
The concatenation operator also nullifies the whole row in case one of the values is null, so I used coalesce. And I cast the checksum to be able to insert it in the table (I need to cast it to integer or varchar).


问:
problem Error executing "PutObject" on AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target host name
enter image description here
Facing this issue while uploading image on live server. Php laravel digital oeacan issue

Tried to changed env and cleared the cache.


问:
xarray .where() function is too slow over datasets
I am using .where() function to select time and certain criteria in xarray dataset.

```<code>import numpy as np
import xarray as xr

ds1 = xr.open_dataset('COD.nc')
ds2 = xr.open_dataset('CDNC.nc')
ds3 = xr.open_dataset('LWP.nc')
ds4 = xr.open_dataset('CTT.nc')
ds5 = xr.open_dataset('CTP.nc')
ds6 = xr.open_dataset('CER.nc')

ds11 = ds1.where((ds1.time == ds2.time))
ds22 = ds2.where((ds2.time == ds11.time))
ds33 = ds3.where((ds3.time == ds2.time))
ds44 = ds4.where((ds4.time == ds2.time))
ds55 = ds5.where((ds5.time == ds2.time))
ds66 = ds6.where((ds6.time == ds2.time))

COD = ds11.Cloud_Optical_Thickness
CDNC= ds22.Cloud_Droplet_Concentration
LWP = ds33.Cloud_Water_Path
CTT = ds44.Cloud_Top_Temperature
CTP = ds55.Cloud_Top_Pressure
CER = ds66.Cloud_Effective_Radius

cod  = COD.where((CTT >= 273.0) & (CTP > 680.0) & (CER > 4) & (COD > 4))
lwp  = LWP.where((CTT >= 273.0) & (CTP > 680.0) & (CER > 4) & (COD > 4))
cdnc = CDNC.where((CTT >= 273.0) & (CTP > 680.0) & (CER > 4) & (COD > 4))
</code>```

but its too slow....even for small dataset......
Dimension of my each dataset is (time: 7555, lat= 35, lon=71). Its running for more than two hours....
is there any way to fasten the performance?  Thanks!!

Body:
I am using .where() function to select time and certain criteria in xarray dataset.

import numpy as np
import xarray as xr

ds1 = xr.open_dataset('COD.nc')
ds2 = xr.open_dataset('CDNC.nc')
ds3 = xr.open_dataset('LWP.nc')
ds4 = xr.open_dataset('CTT.nc')
ds5 = xr.open_dataset('CTP.nc')
ds6 = xr.open_dataset('CER.nc')

ds11 = ds1.where((ds1.time == ds2.time))
ds22 = ds2.where((ds2.time == ds11.time))
ds33 = ds3.where((ds3.time == ds2.time))
ds44 = ds4.where((ds4.time == ds2.time))
ds55 = ds5.where((ds5.time == ds2.time))
ds66 = ds6.where((ds6.time == ds2.time))

COD = ds11.Cloud_Optical_Thickness
CDNC= ds22.Cloud_Droplet_Concentration
LWP = ds33.Cloud_Water_Path
CTT = ds44.Cloud_Top_Temperature
CTP = ds55.Cloud_Top_Pressure
CER = ds66.Cloud_Effective_Radius

cod  = COD.where((CTT >= 273.0) & (CTP > 680.0) & (CER > 4) & (COD > 4))
lwp  = LWP.where((CTT >= 273.0) & (CTP > 680.0) & (CER > 4) & (COD > 4))
cdnc = CDNC.where((CTT >= 273.0) & (CTP > 680.0) & (CER > 4) & (COD > 4))

but its too slow....even for small dataset......
Dimension of my each dataset is (time: 7555, lat= 35, lon=71). Its running for more than two hours....
is there any way to fasten the performance?  Thanks!!


问:
How to import `java sun tools` as a normal gradle dependency?
I need to use compiler tree api in my custom annotation processor logic . the compiler tree api belongs to sun tools.jar . i was thinking it could be import as a simple normal gradle dependency like import group: 'com.sun', name: 'tools', version: '1.8' , But it's not working .

I've searched many tech blogs , it seems like the common solution is compile file("${System.properties['java.home']}/../lib/tools.jar") , apparently it's lake of compatibility。 is there any better solution to solve this ？


问:
RRule: Use of Frequency brakes code giving Uncaught TypeError: (0 , tslib__WEBPACK_IMPORTED_MODULE_1__.__extends) is not a function
We are using RRule in angular-calendar for resolving recurring meetings. We have recently updated to angular 13 from angular 9.. The rrule was working fine with angular 9 but starts breaking in angular 13.. it compiles fine but gives error Uncaught TypeError: (0 , tslib__WEBPACK_IMPORTED_MODULE_1__.__extends) is not a function.

```<code>import { Frequency } from 'rrule';

 Frequency = Frequency;

 this.recurForm = this.fb.group({
      startTime: this.startTime,
      endTime: this.endTime,
      duration: this.duration,
      frequency: [Frequency.DAILY],
      onWeekday: this.fb.array(
        [false, false, false, false, false, false, false].map(val => this.fb.control(val))
      ),
      onMonthday: this.onMonthday,
      title: this.shortDesc,
      comments: this.comments
    })
</code>```

this is my package.json

```<code>{
  "name": "vcrt-ui",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "build:single-spa:vcrt-ui": "ng build vcrt-ui --configuration production",
    "serve:single-spa:vcrt-ui": "ng s --project vcrt-ui --disable-host-check --port 4200 --live-reload false"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.0.0-next.0",
    "@angular/cdk": "^13.3.9",
    "@angular/common": "~13.0.0-next.0",
    "@angular/compiler": "~13.0.0-next.0",
    "@angular/core": "~13.0.0-next.0",
    "@angular/forms": "~13.0.0-next.0",
    "@angular/material": "^13.3.9",
    "@angular/platform-browser": "~13.0.0-next.0",
    "@angular/platform-browser-dynamic": "~13.0.0-next.0",
    "@angular/router": "~13.0.0-next.0",
    "angular-calendar": "^0.29.0",
    "core-js": "^3.27.0",
    "date-fns": "^2.29.3",
    "file-saver": "^2.0.5",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.40",
    "ng-multiselect-dropdown": "^0.3.9",
    "rrule": "^2.6.4",
    "rxjs": "^6.5.5",
    "single-spa": ">=4.0.0",
    "single-spa-angular": "^6.3.1",
    "sweetalert2": "^11.6.16",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "13.1.0",
    "@angular-devkit/build-angular": "~13.0.0",
    "@angular/cli": "~13.0.0",
    "@angular/compiler-cli": "~13.0.0-next.0",
    "@types/jasmine": "~3.10.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~3.10.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "style-loader": "^3.3.1",
    "typescript": "~4.4.3"
  }
}
</code>```

Body:
We are using RRule in angular-calendar for resolving recurring meetings. We have recently updated to angular 13 from angular 9.. The rrule was working fine with angular 9 but starts breaking in angular 13.. it compiles fine but gives error Uncaught TypeError: (0 , tslib__WEBPACK_IMPORTED_MODULE_1__.__extends) is not a function.

import { Frequency } from 'rrule';

 Frequency = Frequency;

 this.recurForm = this.fb.group({
      startTime: this.startTime,
      endTime: this.endTime,
      duration: this.duration,
      frequency: [Frequency.DAILY],
      onWeekday: this.fb.array(
        [false, false, false, false, false, false, false].map(val => this.fb.control(val))
      ),
      onMonthday: this.onMonthday,
      title: this.shortDesc,
      comments: this.comments
    })

this is my package.json

{
  "name": "vcrt-ui",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "build:single-spa:vcrt-ui": "ng build vcrt-ui --configuration production",
    "serve:single-spa:vcrt-ui": "ng s --project vcrt-ui --disable-host-check --port 4200 --live-reload false"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.0.0-next.0",
    "@angular/cdk": "^13.3.9",
    "@angular/common": "~13.0.0-next.0",
    "@angular/compiler": "~13.0.0-next.0",
    "@angular/core": "~13.0.0-next.0",
    "@angular/forms": "~13.0.0-next.0",
    "@angular/material": "^13.3.9",
    "@angular/platform-browser": "~13.0.0-next.0",
    "@angular/platform-browser-dynamic": "~13.0.0-next.0",
    "@angular/router": "~13.0.0-next.0",
    "angular-calendar": "^0.29.0",
    "core-js": "^3.27.0",
    "date-fns": "^2.29.3",
    "file-saver": "^2.0.5",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.40",
    "ng-multiselect-dropdown": "^0.3.9",
    "rrule": "^2.6.4",
    "rxjs": "^6.5.5",
    "single-spa": ">=4.0.0",
    "single-spa-angular": "^6.3.1",
    "sweetalert2": "^11.6.16",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "13.1.0",
    "@angular-devkit/build-angular": "~13.0.0",
    "@angular/cli": "~13.0.0",
    "@angular/compiler-cli": "~13.0.0-next.0",
    "@types/jasmine": "~3.10.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~3.10.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "style-loader": "^3.3.1",
    "typescript": "~4.4.3"
  }
}


问:
PDF text is rendering upside down in react-pdf
I am using react-pdf [version 4.1.0] in react based application to display the PDF documents as SVG by setting render mode to SVG.

```<code><Document id="some-id" renderMode="svg" file="some-url" className="document-pdf">
</code>```

Currently, the issue I am facing is that for some of the PDFs, the text is getting upside down. As we can see in the below attached image that the text is not clear or distorted.

On changing render mode from SVG to Canvas it's working fine but as per requirement I have to use SVG only.

I am using following versions of the below packages:

```<code>react: 16.12.0
react-dom: 16.12.0
react-pdf: 4.1.0
typescript: 3.7.2
</code>```

Any suggestions or help will be appreciated.

Body:
I am using react-pdf [version 4.1.0] in react based application to display the PDF documents as SVG by setting render mode to SVG.

<Document id="some-id" renderMode="svg" file="some-url" className="document-pdf">

Currently, the issue I am facing is that for some of the PDFs, the text is getting upside down. As we can see in the below attached image that the text is not clear or distorted.

On changing render mode from SVG to Canvas it's working fine but as per requirement I have to use SVG only.

I am using following versions of the below packages:

react: 16.12.0
react-dom: 16.12.0
react-pdf: 4.1.0
typescript: 3.7.2

Any suggestions or help will be appreciated.


问:
How to select multiple dates in React FullCalendar
I want to make multiple selection as in the picture and want to remove selection when I click to a selected date. How can I achieve this?

desired output

I couldn't find any resource about this topic.


问:
How can I reduce coupling between Mongoengine model's method and other utility class
In the code below, User.permissions property uses GroupPermissions directly, increasing coupling between those classes (note: those classes live in separate modules in real life)

Can someone recommend a pattern to reduce this coupling? Should I even be bothered by it in this case?

```<code>from enum import Enum

from mongoengine import Document, StringField, EmailField, EnumField

class GroupType(Enum):
    normal_user = 'normal_user'
    super_user = 'super_user'
    market_officer = 'market_officer'
    support = 'support'

class UserPermission(Enum):
    CAN_PULL_EVENTS = 'can_pull_events'

GROUP_PERMISSIONS: dict[GroupType, list[UserPermission]] = {
    GroupType.market_officer: [UserPermission.CAN_PULL_EVENTS],
}

class GroupPermissions:

    @staticmethod
    def as_list(group_type: GroupType) -> list[str]:
        try:
            permissions = GROUP_PERMISSIONS[group_type]
        except KeyError:
            return []
        else:
            return [p.value for p in permissions]

class User(Document):
    pid = StringField(required=True, primary_key=True)
    email = EmailField(required=True)
    role = EnumField(GroupType)

    @property
    def super_user(self):
        return self.role in [GroupType.market_officer, GroupType.super_user, GroupType.support]

    @property
    def permissions(self) -> list[str]:
        return GroupPermissions.as_list(self.role)
</code>```

Body:
In the code below, User.permissions property uses GroupPermissions directly, increasing coupling between those classes (note: those classes live in separate modules in real life)

Can someone recommend a pattern to reduce this coupling? Should I even be bothered by it in this case?

from enum import Enum

from mongoengine import Document, StringField, EmailField, EnumField

class GroupType(Enum):
    normal_user = 'normal_user'
    super_user = 'super_user'
    market_officer = 'market_officer'
    support = 'support'

class UserPermission(Enum):
    CAN_PULL_EVENTS = 'can_pull_events'

GROUP_PERMISSIONS: dict[GroupType, list[UserPermission]] = {
    GroupType.market_officer: [UserPermission.CAN_PULL_EVENTS],
}

class GroupPermissions:

    @staticmethod
    def as_list(group_type: GroupType) -> list[str]:
        try:
            permissions = GROUP_PERMISSIONS[group_type]
        except KeyError:
            return []
        else:
            return [p.value for p in permissions]

class User(Document):
    pid = StringField(required=True, primary_key=True)
    email = EmailField(required=True)
    role = EnumField(GroupType)

    @property
    def super_user(self):
        return self.role in [GroupType.market_officer, GroupType.super_user, GroupType.support]

    @property
    def permissions(self) -> list[str]:
        return GroupPermissions.as_list(self.role)


问:
java.lang.RuntimeException: java.io.FileNotFoundException: when creating file from URL(works in debug mode)
I'm trying to convert URL to file and save it to the folder.

```<code>public void saveFileToStorage(String url, Long timestamp, Integer deviceId) {
    String folder = "D:\\Work\\S3\\" + deviceId;
    File directory = new File(folder);
    File file = new File(folder, timestamp + ".jpg");
    if (!directory.exists()) {
        directory.mkdir();
    }
    try {
        URL link = new URL(url);
        HttpURLConnection connection = (HttpURLConnection) link.openConnection();
        BufferedImage image = ImageIO.read(connection.getInputStream());
        ImageIO.write(image, "jpg", file);
        connection.disconnect();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
</code>```

But this code works fine only in debug mode, when I start a program, most of the time it will throw - "java.lang.RuntimeException: java.io.FileNotFoundException" I tried to read image from URL only by using ImageIO.read and without HttpURLConnection, but it will always throw - "Can't get input stream from URL!"(in debug mode still works). Is there a way to fix this? Thank you

UPD: Solved!
The problems was in url from which file uploads with delay, and because program works fast, it didn't have time to download file and threw FileNotFoundException. For now I added Thread.slepp(1000) and it works.

Body:
I'm trying to convert URL to file and save it to the folder.

public void saveFileToStorage(String url, Long timestamp, Integer deviceId) {
    String folder = "D:\\Work\\S3\\" + deviceId;
    File directory = new File(folder);
    File file = new File(folder, timestamp + ".jpg");
    if (!directory.exists()) {
        directory.mkdir();
    }
    try {
        URL link = new URL(url);
        HttpURLConnection connection = (HttpURLConnection) link.openConnection();
        BufferedImage image = ImageIO.read(connection.getInputStream());
        ImageIO.write(image, "jpg", file);
        connection.disconnect();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

But this code works fine only in debug mode, when I start a program, most of the time it will throw - "java.lang.RuntimeException: java.io.FileNotFoundException" I tried to read image from URL only by using ImageIO.read and without HttpURLConnection, but it will always throw - "Can't get input stream from URL!"(in debug mode still works). Is there a way to fix this? Thank you

UPD: Solved!
The problems was in url from which file uploads with delay, and because program works fast, it didn't have time to download file and threw FileNotFoundException. For now I added Thread.slepp(1000) and it works.


问:
/tmp/snappy-1.0.5-libsnappyjava.so: /tmp/snappy-1.0.5-libsnappyjava.so: failed to map segment from shared object: Operation not permitted
In my organization, we have a 2 cluster setup for apigee 4.19.01.

In one of the components  i.e the management server, there is a service edge-management-server which has gone dead after the node went for patch schedule reboot.

When we tried to restart the service a error happen and  I had this error logs in /tmp/snappy-1.0.5-libsnappyjava.so:

```<code>""java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:322)
        at org.xerial.snappy.SnappyLoader.load(SnappyLoader.java:229)
        at org.xerial.snappy.Snappy.<clinit>(Snappy.java:48)
        at com.datastax.driver.core.FrameCompressor$SnappyCompressor.<init>(FrameCompressor.java:55)
        at com.datastax.driver.core.FrameCompressor$SnappyCompressor.<clinit>(FrameCompressor.java:41)
        at com.datastax.driver.core.ProtocolOptions$Compression.<clinit>(ProtocolOptions.java:30)
        at com.datastax.driver.core.Cluster$Builder.<init>(Cluster.java:573)
        at com.datastax.driver.core.Cluster.builder(Cluster.java:197)
        at com.apigee.datastore.pooling.CqlDriverConnectionPool.createSession(CqlDriverConnectionPool.java:126)
        at com.apigee.datastore.pooling.CqlDriverConnectionPool.<init>(CqlDriverConnectionPool.java:37)
        at com.apigee.datastore.DataStoreServiceImpl.createInstance(DataStoreServiceImpl.java:182)
        at com.apigee.zones.datastore.IdentityZonesDataStore.init(IdentityZonesDataStore.java:167)
        at com.apigee.registration.events.BasicDispatcher.registerListener(BasicDispatcher.java:189)
        at com.apigee.registration.ServerRegistrationServiceImpl.register(ServerRegistrationServiceImpl.java:644)
        at com.apigee.registration.ServerRegistrationServiceImpl.register(ServerRegistrationServiceImpl.java:629)
        at com.apigee.zones.datastore.IdentityZonesDataStore.init(IdentityZonesDataStore.java:91)
        at com.apigee.zones.datastore.DataStoreFactory.init(DataStoreFactory.java:53)
        at com.apigee.zones.service.IdentityZoneServiceImpl.start(IdentityZoneServiceImpl.java:50)
        at com.apigee.kernel.service.deployment.ServiceDeployer.startService(ServiceDeployer.java:168)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:71)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deployDependantServices(ServiceDeployer.java:356)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deployDependantServices(ServiceDeployer.java:356)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deployDependantServices(ServiceDeployer.java:356)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
        at com.apigee.kernel.module.deployment.ModuleDeployer.deploy(ModuleDeployer.java:58)
        at com.apigee.kernel.MicroKernel.deployAll(MicroKernel.java:190)
        at com.apigee.kernel.MicroKernel.start(MicroKernel.java:151)
        at com.apigee.kernel.MicroKernel.start(MicroKernel.java:146)
        at com.apigee.kernel.MicroKernel.main(MicroKernel.java:95)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/snappy-1.0.5-libsnappyjava.so: /tmp/snappy-1.0.5-libsnappyjava.so: failed to map segment from shared object: Operation not permitted
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
        at java.lang.Runtime.load0(Runtime.java:810)
        at java.lang.System.load(System.java:1088)
        at org.xerial.snappy.SnappyNativeLoader.load(SnappyNativeLoader.java:39)""
</code>```

The /tmp partition by default has noexec permission set in fstab and I set it to exec and remount the partition.

After that only thing that changed is the invocation exception did not come but still after the creation of the snappy file in /tmp the edge-management service goes dead.

I observed that when I delete the snappy file from /tmp and restart the edge-management service, the service looks ok but once the time the snappy file (snappy-1.0.5-libsnappyjava.so)is created in the /tmp then it goes dead again.

The Java version running is 1.8.0_292

I want to know if there is a mechanism where in I could change the creation path of this snappy file so that it doesnt get created in /tmp and stops the edge management process.
Or any other resolution to this issue?

This problem currently is in the staging management server but in next month the production edge management is up for patch schedule reboot too so dont want that this problem should occur there.

Would be really helpful if anyone could help on this.

The /tmp partition by default has noexec permission set in fstab and I set it to exec and remount the partition.
After that only thing that changed is the invocation exception did not come but still after the creation of the snappy file in /tmp the edge-management service goes dead.
I observed that when I delete the snappy file from /tmp and restart the edge-management service, the service looks ok but once the time the snappy file (snappy-1.0.5-libsnappyjava.so)is created in the /tmp then it goes dead again.

Body:
In my organization, we have a 2 cluster setup for apigee 4.19.01.

In one of the components  i.e the management server, there is a service edge-management-server which has gone dead after the node went for patch schedule reboot.

When we tried to restart the service a error happen and  I had this error logs in /tmp/snappy-1.0.5-libsnappyjava.so:

""java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:322)
        at org.xerial.snappy.SnappyLoader.load(SnappyLoader.java:229)
        at org.xerial.snappy.Snappy.<clinit>(Snappy.java:48)
        at com.datastax.driver.core.FrameCompressor$SnappyCompressor.<init>(FrameCompressor.java:55)
        at com.datastax.driver.core.FrameCompressor$SnappyCompressor.<clinit>(FrameCompressor.java:41)
        at com.datastax.driver.core.ProtocolOptions$Compression.<clinit>(ProtocolOptions.java:30)
        at com.datastax.driver.core.Cluster$Builder.<init>(Cluster.java:573)
        at com.datastax.driver.core.Cluster.builder(Cluster.java:197)
        at com.apigee.datastore.pooling.CqlDriverConnectionPool.createSession(CqlDriverConnectionPool.java:126)
        at com.apigee.datastore.pooling.CqlDriverConnectionPool.<init>(CqlDriverConnectionPool.java:37)
        at com.apigee.datastore.DataStoreServiceImpl.createInstance(DataStoreServiceImpl.java:182)
        at com.apigee.zones.datastore.IdentityZonesDataStore.init(IdentityZonesDataStore.java:167)
        at com.apigee.registration.events.BasicDispatcher.registerListener(BasicDispatcher.java:189)
        at com.apigee.registration.ServerRegistrationServiceImpl.register(ServerRegistrationServiceImpl.java:644)
        at com.apigee.registration.ServerRegistrationServiceImpl.register(ServerRegistrationServiceImpl.java:629)
        at com.apigee.zones.datastore.IdentityZonesDataStore.init(IdentityZonesDataStore.java:91)
        at com.apigee.zones.datastore.DataStoreFactory.init(DataStoreFactory.java:53)
        at com.apigee.zones.service.IdentityZoneServiceImpl.start(IdentityZoneServiceImpl.java:50)
        at com.apigee.kernel.service.deployment.ServiceDeployer.startService(ServiceDeployer.java:168)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:71)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deployDependantServices(ServiceDeployer.java:356)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deployDependantServices(ServiceDeployer.java:356)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deployDependantServices(ServiceDeployer.java:356)
        at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
        at com.apigee.kernel.module.deployment.ModuleDeployer.deploy(ModuleDeployer.java:58)
        at com.apigee.kernel.MicroKernel.deployAll(MicroKernel.java:190)
        at com.apigee.kernel.MicroKernel.start(MicroKernel.java:151)
        at com.apigee.kernel.MicroKernel.start(MicroKernel.java:146)
        at com.apigee.kernel.MicroKernel.main(MicroKernel.java:95)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/snappy-1.0.5-libsnappyjava.so: /tmp/snappy-1.0.5-libsnappyjava.so: failed to map segment from shared object: Operation not permitted
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
        at java.lang.Runtime.load0(Runtime.java:810)
        at java.lang.System.load(System.java:1088)
        at org.xerial.snappy.SnappyNativeLoader.load(SnappyNativeLoader.java:39)""

The /tmp partition by default has noexec permission set in fstab and I set it to exec and remount the partition.

After that only thing that changed is the invocation exception did not come but still after the creation of the snappy file in /tmp the edge-management service goes dead.

I observed that when I delete the snappy file from /tmp and restart the edge-management service, the service looks ok but once the time the snappy file (snappy-1.0.5-libsnappyjava.so)is created in the /tmp then it goes dead again.

The Java version running is 1.8.0_292

I want to know if there is a mechanism where in I could change the creation path of this snappy file so that it doesnt get created in /tmp and stops the edge management process.
Or any other resolution to this issue?

This problem currently is in the staging management server but in next month the production edge management is up for patch schedule reboot too so dont want that this problem should occur there.

Would be really helpful if anyone could help on this.

The /tmp partition by default has noexec permission set in fstab and I set it to exec and remount the partition.
After that only thing that changed is the invocation exception did not come but still after the creation of the snappy file in /tmp the edge-management service goes dead.
I observed that when I delete the snappy file from /tmp and restart the edge-management service, the service looks ok but once the time the snappy file (snappy-1.0.5-libsnappyjava.so)is created in the /tmp then it goes dead again.


问:
Creating charts comparing multiple worksheets
So I have created worksheets for each month of the year and one extra worksheet as the dashboard where the charts would be.

In the dashboard ws, there would be a drop-down list of the months of the year for 'from' and 'to'.

I want to be able to compare data in the different month's worksheets by selecting using the dropdown list.

Furthermore, I need help to get a range of worksheets

Example if my startmth is Sep and my endmth is Nov, how can get the range of worksheets from sep to nov

This is my code right now. There is an object required error on set starts

```<code>    Sub comparet1()

    Dim wb As Workbook
    Dim startws As Integer
    Dim endws As Integer
    Dim startmth As String
    Dim endmth As String

    Set wb = Workbooks("IR_Report-COMPARE")

    startmth = wb.Sheets("Dashboard").Range("B3")
    endmth = wb.Sheets("Dashboard").Range("E3")

    MsgBox startmth & endmth

    Set startws = wb.Sheets(startmth).Index
    Set endws = wb.Sheets(endmth).Index

    Dim ch As Chart
    Dim tgt As Range
    Dim rng1, rng2, rng3 As Range
    Dim Lr1, Lr2, Lr3 As Integer

    Lr1 = wb.Sheets(startws).Range("A1").End(xlDown).Offset(-1, 0).Row
    Lr3 = wb.Sheets(endws).Range("A1").End(xlDown).Offset(-1, 0).Row

    Set rng1 = wb.Sheets(startws).Range("C1:E" & Lr1)
    Set rng3 = wb.Sheets(endws).Range("C1:E" & Lr3)
    Set tgt = Union(rng1, rng3)

    Set ch = wb.Sheets("Dashboard").Shapes.AddChart2(Width:=600, Height:=450, Left:=Range("L2").Left, Top:=Range("L2").Top).Chart

With ch
    .SetSourceData Source:=tgt
    .ChartTitle.Text = "Create and Close Records"
    .SetElement msoElementDataLabelOutSideEnd
    .SetElement (msoElementLegendBottom)
End With

End Sub
</code>```

Body:
So I have created worksheets for each month of the year and one extra worksheet as the dashboard where the charts would be.

In the dashboard ws, there would be a drop-down list of the months of the year for 'from' and 'to'.

I want to be able to compare data in the different month's worksheets by selecting using the dropdown list.

Furthermore, I need help to get a range of worksheets

Example if my startmth is Sep and my endmth is Nov, how can get the range of worksheets from sep to nov

This is my code right now. There is an object required error on set starts

    Sub comparet1()

    Dim wb As Workbook
    Dim startws As Integer
    Dim endws As Integer
    Dim startmth As String
    Dim endmth As String

    Set wb = Workbooks("IR_Report-COMPARE")

    startmth = wb.Sheets("Dashboard").Range("B3")
    endmth = wb.Sheets("Dashboard").Range("E3")

    MsgBox startmth & endmth

    Set startws = wb.Sheets(startmth).Index
    Set endws = wb.Sheets(endmth).Index

    Dim ch As Chart
    Dim tgt As Range
    Dim rng1, rng2, rng3 As Range
    Dim Lr1, Lr2, Lr3 As Integer

    Lr1 = wb.Sheets(startws).Range("A1").End(xlDown).Offset(-1, 0).Row
    Lr3 = wb.Sheets(endws).Range("A1").End(xlDown).Offset(-1, 0).Row

    Set rng1 = wb.Sheets(startws).Range("C1:E" & Lr1)
    Set rng3 = wb.Sheets(endws).Range("C1:E" & Lr3)
    Set tgt = Union(rng1, rng3)

    Set ch = wb.Sheets("Dashboard").Shapes.AddChart2(Width:=600, Height:=450, Left:=Range("L2").Left, Top:=Range("L2").Top).Chart

With ch
    .SetSourceData Source:=tgt
    .ChartTitle.Text = "Create and Close Records"
    .SetElement msoElementDataLabelOutSideEnd
    .SetElement (msoElementLegendBottom)
End With

End Sub


问:
SUM all data in the same date and group data in certain range
Let's say I have a dataframe

```<code>df = {
'Date': ['1-8','1-8','1-8','2-8','2-8','2-8'],
'Value1': [9,12,7,8,15,16],
'Value2': [1,3,2,4,2,3]}
</code>```

I want to sum Value2 in 2 groups, based on Value1(1-10,11-20) and date
and create a new dataframe
with 3 columns
Date,1-10,11-20.

I also want the range be extendable
like 1-10,11-20,21-30.....>100
so i am thinking of something like

```<code>for i in range(0, 100, 10)
</code>```

but no idea how to put the date condition

so that the final result is like:

```<code>new_df = {
'Date': ['1-8','2-8'],
'1-10': [3,4],
'11-12':[3,5]}
</code>```

Body:
Let's say I have a dataframe

df = {
'Date': ['1-8','1-8','1-8','2-8','2-8','2-8'],
'Value1': [9,12,7,8,15,16],
'Value2': [1,3,2,4,2,3]}

I want to sum Value2 in 2 groups, based on Value1(1-10,11-20) and date
and create a new dataframe
with 3 columns
Date,1-10,11-20.

I also want the range be extendable
like 1-10,11-20,21-30.....>100
so i am thinking of something like

for i in range(0, 100, 10)

but no idea how to put the date condition

so that the final result is like:

new_df = {
'Date': ['1-8','2-8'],
'1-10': [3,4],
'11-12':[3,5]}


问:
Error while getting native targets for android: No valid Android Emulator home found
root@ubuntu:/home/tesema/moodleapp# npm run prod:android

moodlemobile@4.1.0 prod:android /home/tesema/moodleapp
NODE_ENV=production ionic cordova run android --prod

[ERROR] Error while getting native targets for android: No valid Android Emulator home found.

```<code>    This error occurred while using native-run. You can try running this command with --no-native-run, which will
    revert to using Cordova.
</code>```

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moodlemobile@4.1.0 prod:android: NODE_ENV=production ionic cordova run android --prod
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moodlemobile@4.1.0 prod:android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-12-29T06_59_24_442Z-debug.log

I ma trining to build android APk file by using command npm run prod:android and shows the following error` but it will comply successfully using command npm start. Is there any one has the solution for the above error. how can I generate apk file for android studio

Body:
root@ubuntu:/home/tesema/moodleapp# npm run prod:android

moodlemobile@4.1.0 prod:android /home/tesema/moodleapp
NODE_ENV=production ionic cordova run android --prod

[ERROR] Error while getting native targets for android: No valid Android Emulator home found.

    This error occurred while using native-run. You can try running this command with --no-native-run, which will
    revert to using Cordova.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moodlemobile@4.1.0 prod:android: NODE_ENV=production ionic cordova run android --prod
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moodlemobile@4.1.0 prod:android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-12-29T06_59_24_442Z-debug.log

I ma trining to build android APk file by using command npm run prod:android and shows the following error` but it will comply successfully using command npm start. Is there any one has the solution for the above error. how can I generate apk file for android studio


问:
How to automatically bring the url (share-link of share api) of the corresponding app page to the clipboard when a screenshot is detected
literally, I need to know how to automatically bring the url (share-link of share api) of the corresponding app page to the clipboard when a screenshot is detected..
I'm not sure the store allow my app.. but I really want to know it is technically possible

I tried this using Android broadcast receive, and talked with many senior programmer.
But everytime I asked, they were so pessimistic.
I just know how it works in technically.


问:
Installing 'traffic' for use in JupyterLab
It is not possible for me to install the python library 'traffic' and get it running.

I'm trying to install the traffic library for python. So far, nothing has worked out.

When using pip install traffic the error "Could not build wheels for Cartopy, which is required to install pyproject.toml-based projects" is generated.

The command conda create -n traffic -c conda-forge python=3.9.7 traffic the installation is running several hours and evetually terminated.

I already downloaded Microsoft Visual Studio and ran conda create ... in there. The same error message came up.

Does anyone know how to install the traffic library


问:
instagram_basic scop not taking on oath request until and unless I don't add first time from graph api
so when I try to get instagramBusinessAccount info it's not come until and unless I add instagram_basic manually from graph API meta developer first time.

I create one business Facebook page and link my Instagram business account with that after linking successfully
I call this API " https://graph.facebook.com/v15.0/{id}?fields=instagram_business_account&access_toke={token}" I need "instagramBusinessAccount" data in response but the issue is only working when I use graph API and add instagram_basic scop manually and generate an access token once if I do the first time after that I got "instagramBusinessAccount" data all time but I have to do that step first time.
and also token not taking the "instagram_basic" scop until and unless I follow the above steps.


问:
Connection Monitor Vs Connection Troubleshoot Vs IP Flow Verify
There are a whole suit of tools available to monitor networks in Azure. Of these, I am trying to understand the difference between Connection Monitor, Connection Troubleshoot and IP Flow Verify. The last two are part of Network Watcher.

To me, it seems like these are meant for the same purpose: to check if communication is allowed between a source and a destination.

What exactly are the differences between these services and in what are use cases for each?


问:
Python Backend Server Design Patterns: Managing multiple databases through one server
I am relatively new to Python design patterns, and would like to ask for input from more experienced developers, on some possible pattern options for managing two independent databases through one backend server.

DB 1 and DB 2 are entirely independent, but there requires certain aspects where data from DB 2 is processed in the backend and used to update parts of DB 1.

I currently have a working singleton pattern which manages the connection for DB 1, but I am reading that a singleton approach is not recommended in most Python development circles.

So, I am considering implementing a few tweaks to the current singleton for DB 1 and making the connection a reserved pool - But this is where the question arises of how to implement DB 2 into the mixture.

Just from a workload and ease of implementation perspective, the simplest solution would be to just create another singleton connection object for DB 2 and just making sure the two connections are separately managed. But from the reading I am doing, it seems this would be bad engineering.

So I would like to ask what are some acceptable ways to design a backend server when managing multiple databases. Any and all directional guides, or simple pointers to factors I should consider would be greatly appreciated.

Thank you much in advance.


问:
How to fix the following error despite it coming from a different system?
The code was built and was successfully running in another system. When I ran the code in this system we were interrupted by this error:


问:
receivedMessage.content comes out as blank on discord.js version 12
I'm following the devdungeon tutorial for making a discord bot. (they use version 11 in the video, i'm using version 12, and yes i have resolved all the version difference issues before this current issue).
I'm on the part where, when you send a message, the bot will echo your message with extra stuff like mentioning the author.
i've followed the code exactly, but when i run my code and test the bot, it only responds with the other stuff and not the message it's supposed to echo.

snippet:

```<code>receivedMessage.channel.send("Message received from " + receivedMessage.author.toString() +
  ": " + receivedMessage.content)
</code>```

everything except for receivedMessage.content works as intended.

screenshot of what happens

I thought it might be some discord policy update for preventing bots acquiring private messages, but from what i read that only applies to official verified bots.

anybody know why this is happening?

here's the full function:

```<code>client.on('message', (receivedMessage) => {
  if (receivedMessage.author == client.user) {
    return
  }

  receivedMessage.channel.send("Message received from " + receivedMessage.author.toString() +
  ": " + receivedMessage.content)
})
</code>```

i've tried changing some properties that may have been changed from v11 to v12, but to no avail.

Body:
I'm following the devdungeon tutorial for making a discord bot. (they use version 11 in the video, i'm using version 12, and yes i have resolved all the version difference issues before this current issue).
I'm on the part where, when you send a message, the bot will echo your message with extra stuff like mentioning the author.
i've followed the code exactly, but when i run my code and test the bot, it only responds with the other stuff and not the message it's supposed to echo.

snippet:

receivedMessage.channel.send("Message received from " + receivedMessage.author.toString() +
  ": " + receivedMessage.content)

everything except for receivedMessage.content works as intended.

screenshot of what happens

I thought it might be some discord policy update for preventing bots acquiring private messages, but from what i read that only applies to official verified bots.

anybody know why this is happening?

here's the full function:

client.on('message', (receivedMessage) => {
  if (receivedMessage.author == client.user) {
    return
  }

  receivedMessage.channel.send("Message received from " + receivedMessage.author.toString() +
  ": " + receivedMessage.content)
})

i've tried changing some properties that may have been changed from v11 to v12, but to no avail.


问:
Netsuite sublist get and set
I am trying to add sublist "amount" field multiple value in the "total amount" field how can i get "expence" sublist "amount" field multiple selected value and total set in the "total amount" field

I need script code for my problem

Title: Netsuite sublist get and set


问:
I am trying to Redirecting page to the specific tab (slide tab) by using navigateToSObject but it is not working in Aura
I am trying to redirect into specific slide Tab in record page, we can simply achieve this by using workspace API but since workspace api is not supported in the Apps like sales and service etc, I am using navigation to Sobject, here's a sample code that I'm using..
`

```<code>toDetail : function(component, event, helper) {
        console.log('changeSubtab');
        //get record id from url
        var url = window.location.href;
        var recordId = url.substring(0, url.lastIndexOf('/'));
        recordId = recordId.substring(recordId.lastIndexOf('/') + 1);
        console.log('recordId: ' + recordId);

        //using navigation event to change subtab
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId": recordId,
            "slideDevName": "related"
        });
        navEvt.fire();
        console.log('navEvt fired', navEvt);
    },
</code>```

`

I am basically trying to redirecting it to the related tab but everytime it is redirecting to the default tab Activity, I have also added the line in the .cmp file
`

```<code>    <aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>
</code>```

`

Body:
I am trying to redirect into specific slide Tab in record page, we can simply achieve this by using workspace API but since workspace api is not supported in the Apps like sales and service etc, I am using navigation to Sobject, here's a sample code that I'm using..
`

toDetail : function(component, event, helper) {
        console.log('changeSubtab');
        //get record id from url
        var url = window.location.href;
        var recordId = url.substring(0, url.lastIndexOf('/'));
        recordId = recordId.substring(recordId.lastIndexOf('/') + 1);
        console.log('recordId: ' + recordId);

        //using navigation event to change subtab
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId": recordId,
            "slideDevName": "related"
        });
        navEvt.fire();
        console.log('navEvt fired', navEvt);
    },

`

I am basically trying to redirecting it to the related tab but everytime it is redirecting to the default tab Activity, I have also added the line in the .cmp file
`

    <aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>

`


问:
How do I add an object to an array without the need of reloading the page to see the result?
I want to add to an array that looks like const [product, setProduct]=useState([]) and product looks something like product = {product_name: "yes", product_price: "2", product_vendor: "someone"}.

I tried to look up on the internet but none of the examples really worked in my case. Most of them did insert a object into the array but with no data.