问:
Question about creating custom tab bar using SwiftUI
Essentially I am trying to create a custom tab bar in SwiftUI using the design layout below. The current issue is that while it looks like a tab bar, it doesn't fully act like one, it does not save state between view (all views reset when tapping out and back in to them). What can be added/modified to keep the same design (including the circle with a plus in the center) while also making it into proper tab bar.

Code so far:

```<code>@State var selectedIndex = 0
let icons = ["house", "magnifyingglass", "plus", "squareshape.controlhandles.on.squareshape.controlhandles", "bell"]

    let iconText = ["Home", "Search", "", "Tools", "Messages"]

switch selectedIndex {
                case 0:

                    NavigationView {
                        ScrollView(.vertical) {
                            VStack {
                                Text("Hello")
                            }
                        }
                            ToolbarItem(placement: .navigationBarTrailing) {

                                Button {
                                    self.showSettings = true
                                } label: {
                                    Image(systemName: "person.circle.fill")
                                        .resizable()
                                        .frame(width: 28, height: 28)
                                        .padding([.top, .trailing], 10)
                                        .padding(.bottom, 15)
                                        .foregroundColor(.blue)
                                }

                            }
                        }

                    }

                case 1:

                    NavigationView {

                       VStack {
                                Text("Hello")
                            }
                    }
                case 2:
                    NavigationView {
                        VStack {
                                Text("Hello")
                            }
                        .navigationTitle("Tools")
                    }
                case 3:
                    NavigationView {
                        GeometryReader { geometry in
                            ScrollView(.vertical) {

                                VStack {
                                Text("Hello")
                            }
                                .frame(maxWidth: geometry.size.width)
                                .padding(.horizontal)
                                .padding(.top, 15)

                            } }
                    }
                default:
                    NavigationView {
                        VStack {
                            Lottielmage(animationName: "bell", loopMode: .playOnce, pauseTime: 100)
                                .frame(width: 100, height: 100)
                        }
                        .toolbar {
                            ToolbarItem(placement: .navigationBarLeading) {
                                Text("Messages")
                                    .font(.system(size: 28,
                                                  weight: .bold,
                                                  design: .default))
                                    .padding(.bottom, 10)

                            }
                        }
                    }
                }

                HStack {
                ForEach(0..<5, id: \.self) { number in
                    Spacer()
                    Button(action: {
                        if number == 2 {
                            Haptic.impact(.heavy).generate()
                            presented.toggle()
                        } else {
                            self.selectedIndex = number
                        }
                    }, label: {
                        if number == 2 {
                            Image(systemName: icons[number])
                                .font(.system(size: 25, weight: .regular, design: .default))
                                .foregroundColor(.white)
                                .frame(width: 60, height: 60)
                                .background(Color.blue)
                                .cornerRadius(30)
                                .padding(.bottom, 10)
                        } else {
                            VStack {
                                Image(systemName: icons[number])
                                    .font(.system(size: 25, weight: .regular, design: .default))
                                    .frame(width: 2, height: 2)
                                    .padding(.bottom, 10)
                                Text(iconText[number])
                                    .font(.system(size: 12, weight: .regular, design: .default))
                            }
                            .foregroundColor(selectedIndex == number ? Color(.label) : Color(UIColor.lightGray))
                        }
                    })
                    .buttonStyle(ScaleButtonStyle())
                    Spacer()

                }

            }
</code>```

Body:
Essentially I am trying to create a custom tab bar in SwiftUI using the design layout below. The current issue is that while it looks like a tab bar, it doesn't fully act like one, it does not save state between view (all views reset when tapping out and back in to them). What can be added/modified to keep the same design (including the circle with a plus in the center) while also making it into proper tab bar.

Code so far:

@State var selectedIndex = 0
let icons = ["house", "magnifyingglass", "plus", "squareshape.controlhandles.on.squareshape.controlhandles", "bell"]

    let iconText = ["Home", "Search", "", "Tools", "Messages"]

switch selectedIndex {
                case 0:

                    NavigationView {
                        ScrollView(.vertical) {
                            VStack {
                                Text("Hello")
                            }
                        }
                            ToolbarItem(placement: .navigationBarTrailing) {

                                Button {
                                    self.showSettings = true
                                } label: {
                                    Image(systemName: "person.circle.fill")
                                        .resizable()
                                        .frame(width: 28, height: 28)
                                        .padding([.top, .trailing], 10)
                                        .padding(.bottom, 15)
                                        .foregroundColor(.blue)
                                }

                            }
                        }

                    }

                case 1:

                    NavigationView {

                       VStack {
                                Text("Hello")
                            }
                    }
                case 2:
                    NavigationView {
                        VStack {
                                Text("Hello")
                            }
                        .navigationTitle("Tools")
                    }
                case 3:
                    NavigationView {
                        GeometryReader { geometry in
                            ScrollView(.vertical) {

                                VStack {
                                Text("Hello")
                            }
                                .frame(maxWidth: geometry.size.width)
                                .padding(.horizontal)
                                .padding(.top, 15)

                            } }
                    }
                default:
                    NavigationView {
                        VStack {
                            Lottielmage(animationName: "bell", loopMode: .playOnce, pauseTime: 100)
                                .frame(width: 100, height: 100)
                        }
                        .toolbar {
                            ToolbarItem(placement: .navigationBarLeading) {
                                Text("Messages")
                                    .font(.system(size: 28,
                                                  weight: .bold,
                                                  design: .default))
                                    .padding(.bottom, 10)

                            }
                        }
                    }
                }

                HStack {
                ForEach(0..<5, id: \.self) { number in
                    Spacer()
                    Button(action: {
                        if number == 2 {
                            Haptic.impact(.heavy).generate()
                            presented.toggle()
                        } else {
                            self.selectedIndex = number
                        }
                    }, label: {
                        if number == 2 {
                            Image(systemName: icons[number])
                                .font(.system(size: 25, weight: .regular, design: .default))
                                .foregroundColor(.white)
                                .frame(width: 60, height: 60)
                                .background(Color.blue)
                                .cornerRadius(30)
                                .padding(.bottom, 10)
                        } else {
                            VStack {
                                Image(systemName: icons[number])
                                    .font(.system(size: 25, weight: .regular, design: .default))
                                    .frame(width: 2, height: 2)
                                    .padding(.bottom, 10)
                                Text(iconText[number])
                                    .font(.system(size: 12, weight: .regular, design: .default))
                            }
                            .foregroundColor(selectedIndex == number ? Color(.label) : Color(UIColor.lightGray))
                        }
                    })
                    .buttonStyle(ScaleButtonStyle())
                    Spacer()

                }

            }


来源: stackexchange

问:
How to use helm chart deploy a .net 6 worker service?
I have a .net 6 MVC program and a Worker Service program. they work in both local environment and on AKS if I deploy them with a "Deployment" yaml file. But when I try creating a helm chart and deploy them, only the MVC program works. The Worker Service doesn't. When I run the chart with "dry-run", it doesn't even generate the Deployment yaml for the Worker Service, only MVC Deployment and Service get generated.

```<code>helm upgrade --install my-release . --dry-run
</code>```

here is the value.yaml I created for the helm chart

```<code>#this is the MVC section
corewebmvc:
  replicaCount: 1

  image:
    repository: t3odeqiclinkacr01.azurecr.io/corewebmvc
    pullPolicy: IfNotPresent
    tag: "v1.0.0"

  nodeSelector:
    "kubernetes.io/os": linux

  service:
    type: LoadBalancer
    port: 80

  ingress:
    enabled: false

  serviceAccount:
    create: false

  autoscaling:
    enabled: false

#this is the Worker Service section
corewkrsvc:
  replicaCount: 1

  image:
    repository: t3odeqiclinkacr01.azurecr.io/corewkrsvc
    pullPolicy: IfNotPresent
    tag: "v1.0.0"

  nodeSelector:
    "kubernetes.io/os": linux

  service: QLWkrSvc

  ingress:
    enabled: false

  serviceAccount:
    create: false

  autoscaling:
    enabled: false
</code>```

I am completely new to helm, so if anyone can show me what I am doing wrong here, it will be highly appreciated.

UPDATE
I created the chart by following this article . Here is my chart folder

and here is the templates/deployment.yaml file for the Worker Service chart

```<code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "corewkrsvc.fullname" . }}
  labels:
    {{- include "corewkrsvc.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "corewkrsvc.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      {{- with .Values.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "corewkrsvc.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "corewkrsvc.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
</code>```

UPDATE-1

further testing show that the problem seems to be relate to the "service" entry for the Worker Serive in the value.yaml file.

```<code>  service: QLWkrSvc
</code>```

There is an error related to the line above - "Error: UPGRADE FAILED: template: tpa-poc/charts/corewkrsvc/templates/service.yaml:8:18: executing "tpa-poc/charts/corewkrsvc/templates/service.yaml" at <.Values.service.type>: can't evaluate field type in type interface {}"

If I remove the above line from value.yaml, I get error "Error: UPGRADE FAILED: template: tpa-poc/charts/corewkrsvc/templates/service.yaml:8:18: executing "tpa-poc/charts/corewkrsvc/templates/service.yaml" at <.Values.service.type>: nil pointer evaluating interface {}.type" instead.

So looks like I need to have the service entry in there, but with what value (type) then?

ContentLicense: CC BY-SA 4.0

Body:
I have a .net 6 MVC program and a Worker Service program. they work in both local environment and on AKS if I deploy them with a "Deployment" yaml file. But when I try creating a helm chart and deploy them, only the MVC program works. The Worker Service doesn't. When I run the chart with "dry-run", it doesn't even generate the Deployment yaml for the Worker Service, only MVC Deployment and Service get generated.

helm upgrade --install my-release . --dry-run

here is the value.yaml I created for the helm chart

#this is the MVC section
corewebmvc:
  replicaCount: 1

  image:
    repository: t3odeqiclinkacr01.azurecr.io/corewebmvc
    pullPolicy: IfNotPresent
    tag: "v1.0.0"

  nodeSelector:
    "kubernetes.io/os": linux

  service:
    type: LoadBalancer
    port: 80

  ingress:
    enabled: false

  serviceAccount:
    create: false

  autoscaling:
    enabled: false

#this is the Worker Service section
corewkrsvc:
  replicaCount: 1

  image:
    repository: t3odeqiclinkacr01.azurecr.io/corewkrsvc
    pullPolicy: IfNotPresent
    tag: "v1.0.0"

  nodeSelector:
    "kubernetes.io/os": linux

  service: QLWkrSvc

  ingress:
    enabled: false

  serviceAccount:
    create: false

  autoscaling:
    enabled: false

I am completely new to helm, so if anyone can show me what I am doing wrong here, it will be highly appreciated.

UPDATE
I created the chart by following this article . Here is my chart folder

and here is the templates/deployment.yaml file for the Worker Service chart

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "corewkrsvc.fullname" . }}
  labels:
    {{- include "corewkrsvc.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "corewkrsvc.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      {{- with .Values.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "corewkrsvc.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "corewkrsvc.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}

UPDATE-1

further testing show that the problem seems to be relate to the "service" entry for the Worker Serive in the value.yaml file.

  service: QLWkrSvc

There is an error related to the line above - "Error: UPGRADE FAILED: template: tpa-poc/charts/corewkrsvc/templates/service.yaml:8:18: executing "tpa-poc/charts/corewkrsvc/templates/service.yaml" at <.Values.service.type>: can't evaluate field type in type interface {}"

If I remove the above line from value.yaml, I get error "Error: UPGRADE FAILED: template: tpa-poc/charts/corewkrsvc/templates/service.yaml:8:18: executing "tpa-poc/charts/corewkrsvc/templates/service.yaml" at <.Values.service.type>: nil pointer evaluating interface {}.type" instead.

So looks like I need to have the service entry in there, but with what value (type) then?


Body:
I am getting this error while trying to connect to sftp folders from AWS ECR instance.
The connection works fine in the local machine. AWS doesn't seem to be the problem as we have other applications running on Java and python that are able to connect on the same network.
Any more info on debugging this issue is appreciated

The current systems that I am running on

Node Version: 16.17.1
ssh2-sftp-client version: 9.0.4

The code :

async connect()
{
    if (this.client) {
        return;
    }
    this.client = new SFTPClient();
    await this.client.connect(<any>{
        host: process.env.SFTP_HOST,
        port: process.env.SFTP_PORT,
        username: process.env.SFTP_USER,
        password: process.env.SFTP_PASS,
        debug: console.log
    });
}

The output logs :

2022-12-19T09:10:17.245-06:00   CLIENT[sftp]: connect: Debugging turned on

2022-12-19T09:10:17.245-06:00   CLIENT[sftp]: ssh2-sftp-client Version: 9.0.4 {

2022-12-19T09:10:17.245-06:00   "node": "16.17.1",

2022-12-19T09:10:17.245-06:00   "v8": "9.4.146.26-node.22",

2022-12-19T09:10:17.245-06:00   "uv": "1.43.0",

2022-12-19T09:10:17.245-06:00   "zlib": "1.2.11",

2022-12-19T09:10:17.245-06:00   "brotli": "1.0.9",

2022-12-19T09:10:17.245-06:00   "ares": "1.18.1",

2022-12-19T09:10:17.245-06:00   "modules": "93",

2022-12-19T09:10:17.245-06:00   "nghttp2": "1.47.0",

2022-12-19T09:10:17.245-06:00   "napi": "8",

2022-12-19T09:10:17.245-06:00   "llhttp": "6.0.9",

2022-12-19T09:10:17.245-06:00   "openssl": "3.0.1",

2022-12-19T09:10:17.245-06:00   "cldr": "41.0",

2022-12-19T09:10:17.245-06:00   "icu": "71.1",

2022-12-19T09:10:17.245-06:00   "tz": "2022a",

2022-12-19T09:10:17.245-06:00   "unicode": "14.0"

2022-12-19T09:10:17.245-06:00   }

2022-12-19T09:10:17.246-06:00   CLIENT[sftp]: connect: Connect attempt 1

2022-12-19T09:10:17.248-06:00   Custom crypto binding not available

2022-12-19T09:10:17.249-06:00   Local ident: 'SSH-2.0-ssh2js1.11.0'

2022-12-19T09:10:17.250-06:00   Client: Trying  <ip address> on port 22 ...

2022-12-19T09:10:17.303-06:00   Socket connected

2022-12-19T09:10:17.492-06:00   Remote ident: 'SSH-2.0-7.9.0.0_openssh GlobalSCAPE'

2022-12-19T09:10:17.493-06:00   Outbound: Sending KEXINIT

2022-12-19T09:10:17.509-06:00   Inbound: Handshake in progress

2022-12-19T09:10:17.510-06:00   Handshake: (local) KEX method: curve25519-sha256@libssh.org,curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512

2022-12-19T09:10:17.510-06:00   Handshake: (remote) KEX method: diffie-hellman-group16-sha512,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

2022-12-19T09:10:17.510-06:00   Handshake: KEX algorithm: diffie-hellman-group-exchange-sha256

2022-12-19T09:10:17.510-06:00   Handshake: (local) Host key format: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa

2022-12-19T09:10:17.510-06:00   Handshake: (remote) Host key format: ssh-rsa

2022-12-19T09:10:17.510-06:00   Handshake: Host key format: ssh-rsa

2022-12-19T09:10:17.510-06:00   Handshake: (local) C->S cipher: aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,chacha20-poly1305@openssh.com

2022-12-19T09:10:17.510-06:00   Handshake: (remote) C->S cipher: aes256-cbc,aes256-ctr,aes128-cbc,aes128-ctr

2022-12-19T09:10:17.510-06:00   Handshake: C->S Cipher: aes128-ctr

2022-12-19T09:10:17.510-06:00   Handshake: (local) S->C cipher: aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,chacha20-poly1305@openssh.com

2022-12-19T09:10:17.510-06:00   Handshake: (remote) S->C cipher: aes256-cbc,aes256-ctr,aes128-cbc,aes128-ctr

2022-12-19T09:10:17.510-06:00   Handshake: S->C cipher: aes128-ctr

2022-12-19T09:10:17.510-06:00   Handshake: (local) C->S MAC: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1

2022-12-19T09:10:17.510-06:00   Handshake: (remote) C->S MAC: hmac-sha2-512,hmac-sha2-256,hmac-sha1

2022-12-19T09:10:17.510-06:00   Handshake: C->S MAC: hmac-sha2-256

2022-12-19T09:10:17.510-06:00   Handshake: (local) S->C MAC: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1

2022-12-19T09:10:17.510-06:00   Handshake: (remote) S->C MAC: hmac-sha2-512,hmac-sha2-256,hmac-sha1

2022-12-19T09:10:17.510-06:00   Handshake: S->C MAC: hmac-sha2-256

2022-12-19T09:10:17.510-06:00   Handshake: (local) C->S compression: none,zlib@openssh.com,zlib

2022-12-19T09:10:17.510-06:00   Handshake: (remote) C->S compression: zlib,none

2022-12-19T09:10:17.510-06:00   Handshake: C->S compression: none

2022-12-19T09:10:17.511-06:00   Handshake: (local) S->C compression: none,zlib@openssh.com,zlib

2022-12-19T09:10:17.511-06:00   Handshake: (remote) S->C compression: zlib,none

2022-12-19T09:10:17.511-06:00   Handshake: S->C compression: none

2022-12-19T09:10:17.511-06:00   Outbound: Sending KEXDH_GEX_REQUEST

2022-12-19T09:10:17.613-06:00   Received DH GEX Group

2022-12-19T09:10:17.756-06:00   Outbound: Sending KEXDH_GEX_INIT

2022-12-19T09:10:17.878-06:00   Received DH GEX Reply

2022-12-19T09:10:17.879-06:00   Received DH Reply

2022-12-19T09:10:17.879-06:00   Host accepted by default (no verification)

2022-12-19T09:10:17.879-06:00   Host accepted (verified)

2022-12-19T09:10:17.879-06:00   Outbound: Sending NEWKEYS

2022-12-19T09:10:17.880-06:00   Inbound: NEWKEYS

2022-12-19T09:10:18.014-06:00   Verifying signature ...

2022-12-19T09:10:18.017-06:00   Signature verification failed: Error: error:03000098:digital envelope routines::invalid digest

2022-12-19T09:10:18.017-06:00   at verifyOneShot (node:internal/crypto/sig:288:39)

2022-12-19T09:10:18.017-06:00   at OpenSSH_Public.verify (/usr/src/app/node_modules/ssh2/lib/protocol/keyParser.js:408:18)

2022-12-19T09:10:18.017-06:00   at DHGroupExchange.finish (/usr/src/app/node_modules/ssh2/lib/protocol/kex.js:669:40)

2022-12-19T09:10:18.017-06:00   at DHGroupExchange.parse (/usr/src/app/node_modules/ssh2/lib/protocol/kex.js:1216:25)

2022-12-19T09:10:18.017-06:00   at Protocol.onKEXPayload (/usr/src/app/node_modules/ssh2/lib/protocol/kex.js:1767:20)

2022-12-19T09:10:18.017-06:00   at NullDecipher.decrypt (/usr/src/app/node_modules/ssh2/lib/protocol/crypto.js:612:26)

2022-12-19T09:10:18.017-06:00   at Protocol.parsePacket [as _parse] (/usr/src/app/node_modules/ssh2/lib/protocol/Protocol.js:1994:25)

2022-12-19T09:10:18.017-06:00   at Protocol.parse (/usr/src/app/node_modules/ssh2/lib/protocol/Protocol.js:293:16)

2022-12-19T09:10:18.017-06:00   at Socket.<anonymous> (/usr/src/app/node_modules/ssh2/lib/client.js:713:21)

2022-12-19T09:10:18.017-06:00   at Socket.emit (node:events:513:28)

2022-12-19T09:10:18.017-06:00   at Socket.emit (node:domain:489:12)

2022-12-19T09:10:18.017-06:00   at addChunk (node:internal/streams/readable:315:12)

2022-12-19T09:10:18.017-06:00   at readableAddChunk (node:internal/streams/readable:289:9)

2022-12-19T09:10:18.017-06:00   at Socket.Readable.push (node:internal/streams/readable:228:10)

2022-12-19T09:10:18.017-06:00   at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

2022-12-19T09:10:18.017-06:00   Outbound: Sending DISCONNECT (3)

2022-12-19T09:10:18.018-06:00   CLIENT[sftp]: connect errorListener - ignoring handled error

2022-12-19T09:10:18.018-06:00   CLIENT[sftp]: Global: Ignoring handled error: Handshake failed: signature verification failed

2022-12-19T09:10:18.035-06:00   Socket ended

2022-12-19T09:10:18.035-06:00   CLIENT[sftp]: connect endListener - ignoring handled error

2022-12-19T09:10:18.035-06:00   CLIENT[sftp]: Global: Ignoring hanlded end event

2022-12-19T09:10:18.035-06:00   Socket closed


问:
node-gyp process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
I'm getting this error:

```<code>raphy@raohy:~/ForgeTypescriptReactWebpack$ yarn rebuild-sqlite3
yarn run v1.22.19
$ electron-rebuild -f -w better-sqlite3
✔ Rebuild Complete
Done in 0.56s.
raphy@raohy:~/ForgeTypescriptReactWebpack$ yarn run dist
yarn run v1.22.19
$ electron-builder -wl
  • electron-builder  version=23.6.0 os=5.15.0-56-generic
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • executing node-gyp rebuild  platform=linux arch=x64
  ⨯ node-gyp process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Error output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.12.1 | linux | x64
gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/.electron-gyp/19.1.9/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/raphy/.electron-gyp/19.1.9',
gyp info spawn args   '-Dnode_gyp_dir=/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/raphy/.electron-gyp/19.1.9/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/raphy/ForgeTypescriptReactWebpack',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: /home/raphy/ForgeTypescriptReactWebpack) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.15.0-56-generic
gyp ERR! command "/home/raphy/.nvm/versions/node/v18.12.1/bin/node" "/home/raphy/ForgeTypescriptReactWebpack/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/raphy/ForgeTypescriptReactWebpack
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
  failedTask=build stackTrace=Error: node-gyp process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Error output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.12.1 | linux | x64
gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/.electron-gyp/19.1.9/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/raphy/.electron-gyp/19.1.9',
gyp info spawn args   '-Dnode_gyp_dir=/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/raphy/.electron-gyp/19.1.9/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/raphy/ForgeTypescriptReactWebpack',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: /home/raphy/ForgeTypescriptReactWebpack) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.15.0-56-generic
gyp ERR! command "/home/raphy/.nvm/versions/node/v18.12.1/bin/node" "/home/raphy/ForgeTypescriptReactWebpack/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/raphy/ForgeTypescriptReactWebpack
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
                                                                                at ChildProcess.<anonymous> (/home/raphy/ForgeTypescriptReactWebpack/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
</code>```

In package.json :

```<code>   "scripts": {
    "rebuild-sqlite3": "electron-rebuild -f -w better-sqlite3",
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "pack": "electron-builder -wl --dir",
    "dist": "electron-builder -wl",
    "publish": "electron-forge publish",
    "lint": "eslint --ext .ts,.tsx ."
  },
  "build": {
    "appId": "forgetypescriptreactwebpack",
    "productName": "forgetypescriptreactwebpack",
    "dmg": {
      "title": "forgetypescriptreactwebpack"
    },
    "mac": {
      "category": "forgetypescriptreactwebpack.app.category.type"
    },
    "nodeGypRebuild": "true",
    "win": {
      "target": "portable"
    },
    "linux": {
      "target": "AppImage"
    }
  },
</code>```

Other Info:

```<code>electron : 19
node: 18
O.S. : Ubuntu 22.04 Desktop
</code>```

What am I missing or doing wrongly?

Body:
I'm getting this error:

raphy@raohy:~/ForgeTypescriptReactWebpack$ yarn rebuild-sqlite3
yarn run v1.22.19
$ electron-rebuild -f -w better-sqlite3
✔ Rebuild Complete
Done in 0.56s.
raphy@raohy:~/ForgeTypescriptReactWebpack$ yarn run dist
yarn run v1.22.19
$ electron-builder -wl
  • electron-builder  version=23.6.0 os=5.15.0-56-generic
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • executing node-gyp rebuild  platform=linux arch=x64
  ⨯ node-gyp process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Error output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.12.1 | linux | x64
gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/.electron-gyp/19.1.9/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/raphy/.electron-gyp/19.1.9',
gyp info spawn args   '-Dnode_gyp_dir=/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/raphy/.electron-gyp/19.1.9/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/raphy/ForgeTypescriptReactWebpack',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: /home/raphy/ForgeTypescriptReactWebpack) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.15.0-56-generic
gyp ERR! command "/home/raphy/.nvm/versions/node/v18.12.1/bin/node" "/home/raphy/ForgeTypescriptReactWebpack/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/raphy/ForgeTypescriptReactWebpack
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
  failedTask=build stackTrace=Error: node-gyp process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Error output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.12.1 | linux | x64
gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/raphy/.electron-gyp/19.1.9/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/raphy/.electron-gyp/19.1.9',
gyp info spawn args   '-Dnode_gyp_dir=/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/raphy/.electron-gyp/19.1.9/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/raphy/ForgeTypescriptReactWebpack',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: /home/raphy/ForgeTypescriptReactWebpack) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/raphy/ForgeTypescriptReactWebpack/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.15.0-56-generic
gyp ERR! command "/home/raphy/.nvm/versions/node/v18.12.1/bin/node" "/home/raphy/ForgeTypescriptReactWebpack/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/raphy/ForgeTypescriptReactWebpack
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
                                                                                at ChildProcess.<anonymous> (/home/raphy/ForgeTypescriptReactWebpack/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

In package.json :

   "scripts": {
    "rebuild-sqlite3": "electron-rebuild -f -w better-sqlite3",
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "pack": "electron-builder -wl --dir",
    "dist": "electron-builder -wl",
    "publish": "electron-forge publish",
    "lint": "eslint --ext .ts,.tsx ."
  },
  "build": {
    "appId": "forgetypescriptreactwebpack",
    "productName": "forgetypescriptreactwebpack",
    "dmg": {
      "title": "forgetypescriptreactwebpack"
    },
    "mac": {
      "category": "forgetypescriptreactwebpack.app.category.type"
    },
    "nodeGypRebuild": "true",
    "win": {
      "target": "portable"
    },
    "linux": {
      "target": "AppImage"
    }
  },

Other Info:

electron : 19
node: 18
O.S. : Ubuntu 22.04 Desktop

What am I missing or doing wrongly?


问:
Problem to deploy ASP.NET Core 6 Web API site
I'm having a problem with deploying an ASP.NET Core 6 Web API on a Windows 2016 server. Once I deploy my site I get a 500.30 error indicating an "ASP. NET Core app failed to start" (see screenshot).

To verify that this was not due to my server configuration I deployed an ASP.NET Core 6 MVC web app and I have no problem; the site works perfectly and I can access the different pages.

I don't understand why my API site doesn't work. I tried to deploy it on another server with the same configuration and it works perfectly.
Below are the parameters of my project and the elements installed on the server.

Project: ASP.NET Core 6 Web API

Windows server :

.NET 6.0.12 - Windows Server Hosting

Microsoft .NET Runtime 6.0.12 (x84 & x64)

Thanks in advance for your help.


问:
Add top panel header bar with Streamlit markdown hack
I am currently using streamlit to create a dashboard.  My current page looks like Screenshot A.  I wanted to add a top panel header bar shown in Screenshot B (mockup).  Is there a way i can inject a top panel header bar to my desire style to display information ?

When I inspect the streamlit page, I do see there is a header tag with data-testid=stHeader.  Wondering if I can inject div.  I actually managed to change the stHeader style to what I want, but I just do not know how to inject a div into it.  Screenshot C
I just update the style [data-testid='stHeader']

Screenshot A

Screenshot B

Screenshot C


问:
conda-provided gfortran cannot compile MPI program
I have an account on a cluster which I access through SSH. The cluster uses Red Hat. My account does not have root privileges.

I do not have gfortran installed but I need it to compile a program that I will be using. This program is a Python wrapper of a Fortran code, which uses MPI.

I followed this brilliant answer to create a conda environment with Fortran compilers.

I activate the environment and then try to run python setup.py install for my Python code. I get this error:

/disk/username/bin/x86_64-conda-linux-gnu-gfortran -ffree-line-length-none -cpp -fPIC -fno-stack-arrays  -Ofast -DMPI -c utils.F90
utils.F90:5: Error: Can't open included file 'mpif.h'
```

Then I try to modify the Makefile of the original Fortran code, including an explicit reference to where mpif.h is, with -I/path/to/conda/environment/include, following this other brilliant SO answer. This helps, and the installation is then complete.

However, when I try to import the Python package I get the following error:

ImportError: undefined symbol: mpi_allreduce_

What is going wrong? Incidentally, if I compile the Fortran code without MPI, everything works fine.

Body:
I have an account on a cluster which I access through SSH. The cluster uses Red Hat. My account does not have root privileges.

I do not have gfortran installed but I need it to compile a program that I will be using. This program is a Python wrapper of a Fortran code, which uses MPI.

I followed this brilliant answer to create a conda environment with Fortran compilers.

I activate the environment and then try to run python setup.py install for my Python code. I get this error:

/disk/username/bin/x86_64-conda-linux-gnu-gfortran -ffree-line-length-none -cpp -fPIC -fno-stack-arrays  -Ofast -DMPI -c utils.F90
utils.F90:5: Error: Can't open included file 'mpif.h'

Then I try to modify the Makefile of the original Fortran code, including an explicit reference to where mpif.h is, with -I/path/to/conda/environment/include, following this other brilliant SO answer. This helps, and the installation is then complete.

However, when I try to import the Python package I get the following error:

ImportError: undefined symbol: mpi_allreduce_

What is going wrong? Incidentally, if I compile the Fortran code without MPI, everything works fine.


问:
yarn dev does not finish building plugin
I’m following the Grafana tutorial for buiding a new plugin (running Grafana v9.2.2
Node v16.18.1) but yarn dev is stuck at "No errors found." Here's the complete output.

```<code>yarn run v1.22.19
$ webpack -w -c ./.config/webpack/webpack.config.ts --env development
<i> [LiveReloadPlugin] Live Reload listening on port 35729
assets by path *.md 161 bytes
  asset README.md 109 bytes [emitted] [from: README.md] [copied]
  asset CHANGELOG.md 52 bytes [emitted] [from: ../CHANGELOG.md] [copied]
asset module.js 16.3 KiB [emitted] (name: module)
asset LICENSE 11.1 KiB [emitted] [from: ../LICENSE] [copied]
asset img/logo.svg 1.55 KiB [emitted] [from: img/logo.svg] [copied]
asset plugin.json 789 bytes [emitted] [from: plugin.json] [copied]
runtime modules 937 bytes 4 modules
built modules 2.7 KiB [built]
  cacheable modules 2.53 KiB
    ./module.ts 1.04 KiB [built] [code generated]
    ./components/SimplePanel.tsx 1.49 KiB [built] [code generated]
  modules by path external "@grafana/ 84 bytes
    external "@grafana/data" 42 bytes [built] [code generated]
    external "@grafana/ui" 42 bytes [built] [code generated]
  external "react" 42 bytes [built] [code generated]
  external "@emotion/css" 42 bytes [built] [code generated]
webpack 5.75.0 compiled successfully in 2031 ms
Type-checking in progress...
assets by status 29.9 KiB [cached] 6 assets
cached modules 2.7 KiB (javascript) 937 bytes (runtime) [cached] 10 modules
webpack 5.75.0 compiled successfully in 574 ms
Type-checking in progress...
No errors found.
</code>```

While I was trying to solve this issue, I've found the repo grafana-toolkit (also from Grafana), with a different set of instructions to build a plugin. In this case, yarn dev runs without a problem.

However it appears that grafana/toolkit is going to be deprecated and the correct way to build plugins is to use grafana/create-plugin (i.e. following the first set of instructions). Therefore I still have to solve my initiall problem. Any ideas?

Body:
I’m following the Grafana tutorial for buiding a new plugin (running Grafana v9.2.2
Node v16.18.1) but yarn dev is stuck at "No errors found." Here's the complete output.

yarn run v1.22.19
$ webpack -w -c ./.config/webpack/webpack.config.ts --env development
 [LiveReloadPlugin] Live Reload listening on port 35729
assets by path *.md 161 bytes
  asset README.md 109 bytes [emitted] [from: README.md] [copied]
  asset CHANGELOG.md 52 bytes [emitted] [from: ../CHANGELOG.md] [copied]
asset module.js 16.3 KiB [emitted] (name: module)
asset LICENSE 11.1 KiB [emitted] [from: ../LICENSE] [copied]
asset img/logo.svg 1.55 KiB [emitted] [from: img/logo.svg] [copied]
asset plugin.json 789 bytes [emitted] [from: plugin.json] [copied]
runtime modules 937 bytes 4 modules
built modules 2.7 KiB [built]
  cacheable modules 2.53 KiB
    ./module.ts 1.04 KiB [built] [code generated]
    ./components/SimplePanel.tsx 1.49 KiB [built] [code generated]
  modules by path external "@grafana/ 84 bytes
    external "@grafana/data" 42 bytes [built] [code generated]
    external "@grafana/ui" 42 bytes [built] [code generated]
  external "react" 42 bytes [built] [code generated]
  external "@emotion/css" 42 bytes [built] [code generated]
webpack 5.75.0 compiled successfully in 2031 ms
Type-checking in progress...
assets by status 29.9 KiB [cached] 6 assets
cached modules 2.7 KiB (javascript) 937 bytes (runtime) [cached] 10 modules
webpack 5.75.0 compiled successfully in 574 ms
Type-checking in progress...
No errors found.

While I was trying to solve this issue, I've found the repo grafana-toolkit (also from Grafana), with a different set of instructions to build a plugin. In this case, yarn dev runs without a problem.

However it appears that grafana/toolkit is going to be deprecated and the correct way to build plugins is to use grafana/create-plugin (i.e. following the first set of instructions). Therefore I still have to solve my initiall problem. Any ideas?


问:
Why is my character only moving for a split second then moving back to the original spot
When pressing one of the keys for movement the image does move for a second (picture of what's happening) but then moves back to the original spot. Am I doing something wrong with the screen blit line?

```<code>import pygame

pygame.init()

class Player:
    def __init__(self,image, x, y):
        self.image = image
        self.rect = pygame.Rect((x, y, 165, 241))
        self.x = x
        self.y = y
        self.vel_y = 0

    def move(self):
        speed = 35
        # Check for key presses

        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_a:
                    self.x -= speed
                elif event.key == pygame.K_d:
                    self.x += speed

    def update(self,screen):
        screen.blit(self.image,(self.x,self.y))
</code>```

Body:
When pressing one of the keys for movement the image does move for a second (picture of what's happening) but then moves back to the original spot. Am I doing something wrong with the screen blit line?

import pygame

pygame.init()

class Player:
    def __init__(self,image, x, y):
        self.image = image
        self.rect = pygame.Rect((x, y, 165, 241))
        self.x = x
        self.y = y
        self.vel_y = 0

    def move(self):
        speed = 35
        # Check for key presses

        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_a:
                    self.x -= speed
                elif event.key == pygame.K_d:
                    self.x += speed

    def update(self,screen):
        screen.blit(self.image,(self.x,self.y))


问:
PhpStorm recommended file type association for *.heex files?
I'm trying to figure out the best file type association for .heex files and I can't quite get anything set that's right for it. Does anyone have a recommended file type association or a plugin that includes a good file type association for .heex files?

I do already have the Elixir plugin installed and that did not include any color coding for .heex files and it's driving me insane.

Or, if a good file type association does not exist, what do you recommend I do to get the files' text color-coded?

Thanks!


问:
getting 404 error while I'm testing my express app
I am coding a route that gets all answers that the user has responded to, I created a model for it and create a route using express, only authenticated users can reach this route, I have middleware that checks the user's token when I'm testing the route in postman I get 404 error, I am passing the token in postman, I made sure that user has at least one answer to a question but couldn't figure out what went wrong, I appreciate any help

mongoose model

```<code>
const answeredQuestionsSchema = new mongoose.Schema({
  user: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true
  },
  questions: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Question'
    }
  ]
});

const AnsweredQuestions = mongoose.model('AnsweredQuestions', answeredQuestionsSchema);

module.exports = AnsweredQuestions;
</code>```

and this is the route

```<code>const router = express.Router();
const AnsweredQuestions = require('../models/useranswers');
const auth = require('../middleware/auth');

// Get all answers for a user
router.get('/answers', auth, async (req, res) => {
  try {
    const answeredQuestions = await AnsweredQuestions.findOne({ user: req.user._id });
    if (!answeredQuestions) {
      return res.status(404).send({ message: 'No answers found for this user' });
    }
    res.send(answeredQuestions.questions);
  } catch (error) {
    res.status(500).send(error);
  }
});

module.exports = router;

</code>```

Body:
I am coding a route that gets all answers that the user has responded to, I created a model for it and create a route using express, only authenticated users can reach this route, I have middleware that checks the user's token when I'm testing the route in postman I get 404 error, I am passing the token in postman, I made sure that user has at least one answer to a question but couldn't figure out what went wrong, I appreciate any help

mongoose model

const answeredQuestionsSchema = new mongoose.Schema({
  user: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true
  },
  questions: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Question'
    }
  ]
});

const AnsweredQuestions = mongoose.model('AnsweredQuestions', answeredQuestionsSchema);

module.exports = AnsweredQuestions;

and this is the route

const router = express.Router();
const AnsweredQuestions = require('../models/useranswers');
const auth = require('../middleware/auth');

// Get all answers for a user
router.get('/answers', auth, async (req, res) => {
  try {
    const answeredQuestions = await AnsweredQuestions.findOne({ user: req.user._id });
    if (!answeredQuestions) {
      return res.status(404).send({ message: 'No answers found for this user' });
    }
    res.send(answeredQuestions.questions);
  } catch (error) {
    res.status(500).send(error);
  }
});

module.exports = router;