问:
External IP pending ingress controller
Iam facing wierd problem i was following a tutorial with stephen grider in microservices
i built skafold file and ingress service and 2 services one called auth and the other called client and this is output after running skafold dev

```<code>Listing files to watch...
 - moatazemadnaeem/auth
 - moatazemadnaeem/client
Generating tags...
 - moatazemadnaeem/auth -> moatazemadnaeem/auth:latest
 - moatazemadnaeem/client -> moatazemadnaeem/client:latest
Some taggers failed. Rerun with -vdebug for errors.
Checking cache...
 - moatazemadnaeem/auth: Found Locally
 - moatazemadnaeem/client: Found Locally
Tags used in deployment:
 - moatazemadnaeem/auth -> moatazemadnaeem/auth:02cc5bb4a3dd94ee5f02dcbeb23a8e7ba7308f12c55e701b6d5a50fd950df4da
 - moatazemadnaeem/client -> moatazemadnaeem/client:f6f4b9ce5f6c3f1655e6a902b6a5d7fa27e203ec75b6c8772a8ebe4b9c105dbd
Starting deploy...
 - deployment.apps/auth-depl created
 - service/auth-srv created
 - deployment.apps/mongo-depl created
 - service/auth-mongo-srv created
 - deployment.apps/client-depl created
 - service/client-srv created
 - ingress.networking.k8s.io/ingress-srv created
Waiting for deployments to stabilize...
 - deployment/client-depl is ready. [2/3 deployment(s) still pending]
 - deployment/auth-depl is ready. [1/3 deployment(s) still pending]
 - deployment/mongo-depl is ready.
Deployments stabilized in 3.103 seconds
Press Ctrl+C to exit
Watching for changes...
[client]
[auth]
[auth] > auth@1.0.0 start
[auth] > nodemon ./src/index.ts
[auth]
[auth] [nodemon] 2.0.15
[auth] [nodemon] to restart at any time, enter `rs`
[client] > client@1.0.0 dev
[auth] [nodemon] watching path(s): *.*
[client] > next
[auth] [nodemon] watching extensions: ts,json
[client]
[auth] [nodemon] starting `ts-node ./src/index.ts`
[client] ready - started server on 0.0.0.0:3000, url: http://localhost:3000
[auth] connected to db
[auth] listening in port 3000
[client] event - compiled client and server successfully in 2.8s (185 modules)
[client] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[client] This information is used to shape Next.js' roadmap and prioritize features.
[client] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[client] https://nextjs.org/telemetry
[client]
</code>```

and this is my ingress service

```<code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - path: /api/users/?(.*)
            pathType: Prefix
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000
          - path: /?(.*)
            pathType: Prefix
            backend:
              service:
                name: client-srv
                port:
                  number: 3000
</code>```

and here is my skafold file

```<code>apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: moatazemadnaeem/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "src/**/*.ts"
            dest: .
    - image: moatazemadnaeem/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "**/*.js"
            dest: .
</code>```

every thing was working fine until i decided to resize my docker disk every image deleted all containers etc...
so i started from the beginning first i need to apply the ingress controller after applying it

```<code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
</code>```

everything seems to work api pod is working and connected to Database
but after reaching out ticketing.dev the website is not responding
so i troubleshoot and figure out that ingress controller does not have external ip its in the state pending (forever)

```<code>ingress-nginx-controller             LoadBalancer   10.103.240.204   <pending>     80:31413/TCP,443:30200/TCP   34s
</code>```

and here is logs of ingress-controller i used this command kubectl logs -n ingress-nginx ingress-nginx-controller-54d8b558d4-bwjjd

```-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v1.1.1
  Build:         a17181e43ec85534a6fea968d95d019c5a4bc8cf
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.9

-------------------------------------------------------------------------------

W0213 04:09:10.888703       7 client_config.go:615] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0213 04:09:10.888860       7 main.go:223] "Creating API client" host="https://10.96.0.1:443"
I0213 04:09:10.900669       7 main.go:267] "Running in Kubernetes cluster" major="1" minor="22" git="v1.22.4" state="clean" commit="b695d79d4f967c403a96986f1750a35eb75e75f1" platform="linux/arm64"
I0213 04:09:10.982532       7 main.go:104] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I0213 04:09:10.994820       7 ssl.go:531] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"
I0213 04:09:11.003072       7 nginx.go:255] "Starting NGINX Ingress controller"
I0213 04:09:11.009752       7 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"ingress-nginx-controller", UID:"10ad2461-56de-4c14-9614-3d341476a118", APIVersion:"v1", ResourceVersion:"3699", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I0213 04:09:12.206706       7 nginx.go:297] "Starting NGINX process"
I0213 04:09:12.206782       7 leaderelection.go:248] attempting to acquire leader lease ingress-nginx/ingress-controller-leader...
I0213 04:09:12.207597       7 nginx.go:317] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"
I0213 04:09:12.207902       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:09:12.234784       7 leaderelection.go:258] successfully acquired lease ingress-nginx/ingress-controller-leader
I0213 04:09:12.236967       7 status.go:84] "New leader elected" identity="ingress-nginx-controller-54d8b558d4-bwjjd"
I0213 04:09:12.309234       7 controller.go:172] "Backend successfully reloaded"
I0213 04:09:12.309306       7 controller.go:183] "Initial sync, sleeping for 1 second"
I0213 04:09:12.309339       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:17:36.404962       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:17:36.406104       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"bf9349f3-9e16-44b4-876f-e1ee0de9ea51", APIVersion:"networking.k8s.io/v1", ResourceVersion:"4833", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:17:39.645534       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:17:39.739356       7 controller.go:172] "Backend successfully reloaded"
I0213 04:17:39.739891       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:19:14.912300       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:19:14.914196       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:19:15.132889       7 controller.go:172] "Backend successfully reloaded"
I0213 04:19:15.134516       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 04:19:17 http: TLS handshake error from 192.168.65.3:63670: remote error: tls: bad certificate
I0213 04:19:18.246782       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:19:18.330122       7 controller.go:172] "Backend successfully reloaded"
I0213 04:19:18.330756       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:19:51.033718       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:19:51.035689       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"fe4c4a5c-8186-475e-b862-3574c995394e", APIVersion:"networking.k8s.io/v1", ResourceVersion:"5233", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:19:54.271841       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:19:54.382188       7 controller.go:172] "Backend successfully reloaded"
I0213 04:19:54.382524       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:36:53.789772       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:36:53.792021       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:36:54.084136       7 controller.go:172] "Backend successfully reloaded"
I0213 04:36:54.089358       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:36:57.122506       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:36:57.194378       7 controller.go:172] "Backend successfully reloaded"
I0213 04:36:57.194546       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 04:37:12 http: TLS handshake error from 192.168.65.3:62628: remote error: tls: bad certificate
I0213 04:37:47.079701       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:37:47.081605       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"a538b7de-9b58-4ced-83a2-2f7f91972e3d", APIVersion:"networking.k8s.io/v1", ResourceVersion:"6949", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:37:50.324726       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:37:50.466695       7 controller.go:172] "Backend successfully reloaded"
I0213 04:37:50.467301       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:41:45.984007       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:41:45.986154       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:41:46.239624       7 controller.go:172] "Backend successfully reloaded"
I0213 04:41:46.242229       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:41:49.312445       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:41:49.382286       7 controller.go:172] "Backend successfully reloaded"
I0213 04:41:49.382557       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:42:34.030470       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:42:34.032340       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"baeaac48-a580-4334-9c6d-e5ec9b9322fd", APIVersion:"networking.k8s.io/v1", ResourceVersion:"7459", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:42:37.264159       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:42:37.350956       7 controller.go:172] "Backend successfully reloaded"
I0213 04:42:37.351720       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:51:07.915558       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:51:07.917577       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:51:08.145057       7 controller.go:172] "Backend successfully reloaded"
I0213 04:51:08.147466       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:51:11.249421       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:51:11.326464       7 controller.go:172] "Backend successfully reloaded"
I0213 04:51:11.326711       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 05:02:51.329191       7 store.go:424] "Found valid IngressClass" ingress="default/demo" ingressclass="nginx"
I0213 05:02:51.329962       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"demo", UID:"b2009c54-0c51-46ac-bc00-52946563d25f", APIVersion:"networking.k8s.io/v1", ResourceVersion:"9220", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 05:02:51.335381       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:02:51.444871       7 controller.go:172] "Backend successfully reloaded"
I0213 05:02:51.445228       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 05:11:52.100612       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 05:11:52.101829       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"67c8b6ed-6449-4710-bb0c-05132287ce6a", APIVersion:"networking.k8s.io/v1", ResourceVersion:"10007", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 05:11:55.348373       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:11:55.485075       7 controller.go:172] "Backend successfully reloaded"
I0213 05:11:55.486547       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 05:16:56.655485       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 05:16:56.655708       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:16:56.868807       7 controller.go:172] "Backend successfully reloaded"
I0213 05:16:56.869459       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 05:16:59.992987       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:17:00.060763       7 controller.go:172] "Backend successfully reloaded"
I0213 05:17:00.060950       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 16:10:58 http: TLS handshake error from 192.168.65.3:65258: remote error: tls: bad certificate
2022/02/13 16:11:02 http: TLS handshake error from 192.168.65.3:65322: remote error: tls: bad certificate
2022/02/13 16:11:05 http: TLS handshake error from 192.168.65.3:65360: remote error: tls: bad certificate
I0213 16:12:09.427485       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 16:12:09.428413       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"1d7284a4-9337-4394-97bc-9e50311bfd14", APIVersion:"networking.k8s.io/v1", ResourceVersion:"11403", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 16:12:12.658798       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 16:12:12.768695       7 controller.go:172] "Backend successfully reloaded"
I0213 16:12:12.769331       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 16:34:00.171544       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 16:34:00.177362       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 16:34:00.404447       7 controller.go:172] "Backend successfully reloaded"
I0213 16:34:00.405281       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 16:34:03.508701       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 16:34:03.580855       7 controller.go:172] "Backend successfully reloaded"
I0213 16:34:03.581050       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 16:34:18 http: TLS handshake error from 192.168.65.3:56440: remote error: tls: bad certificate
2022/02/13 17:19:25 http: TLS handshake error from 192.168.65.3:62284: remote error: tls: bad certificate
I0213 17:19:51.751884       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 17:19:51.753174       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"fb63a4c5-437f-4737-a4c2-4cfc581fe560", APIVersion:"networking.k8s.io/v1", ResourceVersion:"14499", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 17:19:54.977214       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 17:19:55.179125       7 controller.go:172] "Backend successfully reloaded"
I0213 17:19:55.181141       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 17:44:53.550406       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"fb63a4c5-437f-4737-a4c2-4cfc581fe560", APIVersion:"networking.k8s.io/v1", ResourceVersion:"16638", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
W0213 18:06:01.779080       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 18:06:01.780145       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:06:02.062236       7 controller.go:172] "Backend successfully reloaded"
I0213 18:06:02.071438       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 18:06:04.757208       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 18:06:04.758134       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"982dc419-95cb-45cd-938d-6150a5732baa", APIVersion:"networking.k8s.io/v1", ResourceVersion:"18548", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
W0213 18:06:05.110417       7 controller.go:1083] Service "default/auth-srv" does not have any active Endpoint.
W0213 18:06:05.110441       7 controller.go:1083] Service "default/client-srv" does not have any active Endpoint.
I0213 18:06:05.110548       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:06:05.202121       7 controller.go:172] "Backend successfully reloaded"
I0213 18:06:05.202707       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 18:11:48.540680       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 18:11:48.543520       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:11:48.755536       7 controller.go:172] "Backend successfully reloaded"
I0213 18:11:48.758696       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 18:11:51.877652       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:11:51.987030       7 controller.go:172] "Backend successfully reloaded"
I0213 18:11:51.987707       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 18:11:52.600029       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 18:11:52.603754       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"cfcc5c54-e596-4fd6-80d0-a8c1689261ff", APIVersion:"networking.k8s.io/v1", ResourceVersion:"19149", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 18:11:55.205772       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:11:55.273789       7 controller.go:172] "Backend successfully reloaded"
I0213 18:11:55.274700       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
moataznaeem@moatazs-air ticketing %
```

and after digging and digging there is no way to solve this issue so please any help

答:
after many many hours of digging i got stuck so i decided to re-install docker
and started fresh for somehow External ip (localhost) got assigned to LoadBalancer so i test it and everything is working now.</p>

Title: External IP pending ingress controller

Body:
Iam facing wierd problem i was following a tutorial with stephen grider in microservices
i built skafold file and ingress service and 2 services one called auth and the other called client and this is output after running skafold dev

Listing files to watch...
 - moatazemadnaeem/auth
 - moatazemadnaeem/client
Generating tags...
 - moatazemadnaeem/auth -> moatazemadnaeem/auth:latest
 - moatazemadnaeem/client -> moatazemadnaeem/client:latest
Some taggers failed. Rerun with -vdebug for errors.
Checking cache...
 - moatazemadnaeem/auth: Found Locally
 - moatazemadnaeem/client: Found Locally
Tags used in deployment:
 - moatazemadnaeem/auth -> moatazemadnaeem/auth:02cc5bb4a3dd94ee5f02dcbeb23a8e7ba7308f12c55e701b6d5a50fd950df4da
 - moatazemadnaeem/client -> moatazemadnaeem/client:f6f4b9ce5f6c3f1655e6a902b6a5d7fa27e203ec75b6c8772a8ebe4b9c105dbd
Starting deploy...
 - deployment.apps/auth-depl created
 - service/auth-srv created
 - deployment.apps/mongo-depl created
 - service/auth-mongo-srv created
 - deployment.apps/client-depl created
 - service/client-srv created
 - ingress.networking.k8s.io/ingress-srv created
Waiting for deployments to stabilize...
 - deployment/client-depl is ready. [2/3 deployment(s) still pending]
 - deployment/auth-depl is ready. [1/3 deployment(s) still pending]
 - deployment/mongo-depl is ready.
Deployments stabilized in 3.103 seconds
Press Ctrl+C to exit
Watching for changes...
[client]
[auth]
[auth] > auth@1.0.0 start
[auth] > nodemon ./src/index.ts
[auth]
[auth] [nodemon] 2.0.15
[auth] [nodemon] to restart at any time, enter `rs`
[client] > client@1.0.0 dev
[auth] [nodemon] watching path(s): *.*
[client] > next
[auth] [nodemon] watching extensions: ts,json
[client]
[auth] [nodemon] starting `ts-node ./src/index.ts`
[client] ready - started server on 0.0.0.0:3000, url: http://localhost:3000
[auth] connected to db
[auth] listening in port 3000
[client] event - compiled client and server successfully in 2.8s (185 modules)
[client] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[client] This information is used to shape Next.js' roadmap and prioritize features.
[client] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[client] https://nextjs.org/telemetry
[client]

and this is my ingress service

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - path: /api/users/?(.*)
            pathType: Prefix
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000
          - path: /?(.*)
            pathType: Prefix
            backend:
              service:
                name: client-srv
                port:
                  number: 3000

and here is my skafold file

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: moatazemadnaeem/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "src/**/*.ts"
            dest: .
    - image: moatazemadnaeem/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "**/*.js"
            dest: .

every thing was working fine until i decided to resize my docker disk every image deleted all containers etc...
so i started from the beginning first i need to apply the ingress controller after applying it

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml

everything seems to work api pod is working and connected to Database
but after reaching out ticketing.dev the website is not responding
so i troubleshoot and figure out that ingress controller does not have external ip its in the state pending (forever)

ingress-nginx-controller             LoadBalancer   10.103.240.204   <pending>     80:31413/TCP,443:30200/TCP   34s

and here is logs of ingress-controller i used this command kubectl logs -n ingress-nginx ingress-nginx-controller-54d8b558d4-bwjjd

-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v1.1.1
  Build:         a17181e43ec85534a6fea968d95d019c5a4bc8cf
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.9

-------------------------------------------------------------------------------

W0213 04:09:10.888703       7 client_config.go:615] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0213 04:09:10.888860       7 main.go:223] "Creating API client" host="https://10.96.0.1:443"
I0213 04:09:10.900669       7 main.go:267] "Running in Kubernetes cluster" major="1" minor="22" git="v1.22.4" state="clean" commit="b695d79d4f967c403a96986f1750a35eb75e75f1" platform="linux/arm64"
I0213 04:09:10.982532       7 main.go:104] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I0213 04:09:10.994820       7 ssl.go:531] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"
I0213 04:09:11.003072       7 nginx.go:255] "Starting NGINX Ingress controller"
I0213 04:09:11.009752       7 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"ingress-nginx-controller", UID:"10ad2461-56de-4c14-9614-3d341476a118", APIVersion:"v1", ResourceVersion:"3699", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I0213 04:09:12.206706       7 nginx.go:297] "Starting NGINX process"
I0213 04:09:12.206782       7 leaderelection.go:248] attempting to acquire leader lease ingress-nginx/ingress-controller-leader...
I0213 04:09:12.207597       7 nginx.go:317] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"
I0213 04:09:12.207902       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:09:12.234784       7 leaderelection.go:258] successfully acquired lease ingress-nginx/ingress-controller-leader
I0213 04:09:12.236967       7 status.go:84] "New leader elected" identity="ingress-nginx-controller-54d8b558d4-bwjjd"
I0213 04:09:12.309234       7 controller.go:172] "Backend successfully reloaded"
I0213 04:09:12.309306       7 controller.go:183] "Initial sync, sleeping for 1 second"
I0213 04:09:12.309339       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:17:36.404962       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:17:36.406104       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"bf9349f3-9e16-44b4-876f-e1ee0de9ea51", APIVersion:"networking.k8s.io/v1", ResourceVersion:"4833", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:17:39.645534       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:17:39.739356       7 controller.go:172] "Backend successfully reloaded"
I0213 04:17:39.739891       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:19:14.912300       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:19:14.914196       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:19:15.132889       7 controller.go:172] "Backend successfully reloaded"
I0213 04:19:15.134516       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 04:19:17 http: TLS handshake error from 192.168.65.3:63670: remote error: tls: bad certificate
I0213 04:19:18.246782       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:19:18.330122       7 controller.go:172] "Backend successfully reloaded"
I0213 04:19:18.330756       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:19:51.033718       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:19:51.035689       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"fe4c4a5c-8186-475e-b862-3574c995394e", APIVersion:"networking.k8s.io/v1", ResourceVersion:"5233", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:19:54.271841       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:19:54.382188       7 controller.go:172] "Backend successfully reloaded"
I0213 04:19:54.382524       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:36:53.789772       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:36:53.792021       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:36:54.084136       7 controller.go:172] "Backend successfully reloaded"
I0213 04:36:54.089358       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:36:57.122506       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:36:57.194378       7 controller.go:172] "Backend successfully reloaded"
I0213 04:36:57.194546       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 04:37:12 http: TLS handshake error from 192.168.65.3:62628: remote error: tls: bad certificate
I0213 04:37:47.079701       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:37:47.081605       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"a538b7de-9b58-4ced-83a2-2f7f91972e3d", APIVersion:"networking.k8s.io/v1", ResourceVersion:"6949", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:37:50.324726       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:37:50.466695       7 controller.go:172] "Backend successfully reloaded"
I0213 04:37:50.467301       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:41:45.984007       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:41:45.986154       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:41:46.239624       7 controller.go:172] "Backend successfully reloaded"
I0213 04:41:46.242229       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:41:49.312445       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:41:49.382286       7 controller.go:172] "Backend successfully reloaded"
I0213 04:41:49.382557       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:42:34.030470       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 04:42:34.032340       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"baeaac48-a580-4334-9c6d-e5ec9b9322fd", APIVersion:"networking.k8s.io/v1", ResourceVersion:"7459", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 04:42:37.264159       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:42:37.350956       7 controller.go:172] "Backend successfully reloaded"
I0213 04:42:37.351720       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 04:51:07.915558       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 04:51:07.917577       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:51:08.145057       7 controller.go:172] "Backend successfully reloaded"
I0213 04:51:08.147466       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 04:51:11.249421       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 04:51:11.326464       7 controller.go:172] "Backend successfully reloaded"
I0213 04:51:11.326711       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 05:02:51.329191       7 store.go:424] "Found valid IngressClass" ingress="default/demo" ingressclass="nginx"
I0213 05:02:51.329962       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"demo", UID:"b2009c54-0c51-46ac-bc00-52946563d25f", APIVersion:"networking.k8s.io/v1", ResourceVersion:"9220", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 05:02:51.335381       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:02:51.444871       7 controller.go:172] "Backend successfully reloaded"
I0213 05:02:51.445228       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 05:11:52.100612       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 05:11:52.101829       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"67c8b6ed-6449-4710-bb0c-05132287ce6a", APIVersion:"networking.k8s.io/v1", ResourceVersion:"10007", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 05:11:55.348373       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:11:55.485075       7 controller.go:172] "Backend successfully reloaded"
I0213 05:11:55.486547       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 05:16:56.655485       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 05:16:56.655708       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:16:56.868807       7 controller.go:172] "Backend successfully reloaded"
I0213 05:16:56.869459       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 05:16:59.992987       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 05:17:00.060763       7 controller.go:172] "Backend successfully reloaded"
I0213 05:17:00.060950       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 16:10:58 http: TLS handshake error from 192.168.65.3:65258: remote error: tls: bad certificate
2022/02/13 16:11:02 http: TLS handshake error from 192.168.65.3:65322: remote error: tls: bad certificate
2022/02/13 16:11:05 http: TLS handshake error from 192.168.65.3:65360: remote error: tls: bad certificate
I0213 16:12:09.427485       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 16:12:09.428413       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"1d7284a4-9337-4394-97bc-9e50311bfd14", APIVersion:"networking.k8s.io/v1", ResourceVersion:"11403", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 16:12:12.658798       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 16:12:12.768695       7 controller.go:172] "Backend successfully reloaded"
I0213 16:12:12.769331       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 16:34:00.171544       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 16:34:00.177362       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 16:34:00.404447       7 controller.go:172] "Backend successfully reloaded"
I0213 16:34:00.405281       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 16:34:03.508701       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 16:34:03.580855       7 controller.go:172] "Backend successfully reloaded"
I0213 16:34:03.581050       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
2022/02/13 16:34:18 http: TLS handshake error from 192.168.65.3:56440: remote error: tls: bad certificate
2022/02/13 17:19:25 http: TLS handshake error from 192.168.65.3:62284: remote error: tls: bad certificate
I0213 17:19:51.751884       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 17:19:51.753174       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"fb63a4c5-437f-4737-a4c2-4cfc581fe560", APIVersion:"networking.k8s.io/v1", ResourceVersion:"14499", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 17:19:54.977214       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 17:19:55.179125       7 controller.go:172] "Backend successfully reloaded"
I0213 17:19:55.181141       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 17:44:53.550406       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"fb63a4c5-437f-4737-a4c2-4cfc581fe560", APIVersion:"networking.k8s.io/v1", ResourceVersion:"16638", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
W0213 18:06:01.779080       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 18:06:01.780145       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:06:02.062236       7 controller.go:172] "Backend successfully reloaded"
I0213 18:06:02.071438       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 18:06:04.757208       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 18:06:04.758134       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"982dc419-95cb-45cd-938d-6150a5732baa", APIVersion:"networking.k8s.io/v1", ResourceVersion:"18548", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
W0213 18:06:05.110417       7 controller.go:1083] Service "default/auth-srv" does not have any active Endpoint.
W0213 18:06:05.110441       7 controller.go:1083] Service "default/client-srv" does not have any active Endpoint.
I0213 18:06:05.110548       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:06:05.202121       7 controller.go:172] "Backend successfully reloaded"
I0213 18:06:05.202707       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
W0213 18:11:48.540680       7 controller.go:988] Error obtaining Endpoints for Service "default/auth-srv": no object matching key "default/auth-srv" in local store
I0213 18:11:48.543520       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:11:48.755536       7 controller.go:172] "Backend successfully reloaded"
I0213 18:11:48.758696       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 18:11:51.877652       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:11:51.987030       7 controller.go:172] "Backend successfully reloaded"
I0213 18:11:51.987707       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0213 18:11:52.600029       7 store.go:424] "Found valid IngressClass" ingress="default/ingress-srv" ingressclass="nginx"
I0213 18:11:52.603754       7 event.go:282] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"ingress-srv", UID:"cfcc5c54-e596-4fd6-80d0-a8c1689261ff", APIVersion:"networking.k8s.io/v1", ResourceVersion:"19149", FieldPath:""}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0213 18:11:55.205772       7 controller.go:155] "Configuration changes detected, backend reload required"
I0213 18:11:55.273789       7 controller.go:172] "Backend successfully reloaded"
I0213 18:11:55.274700       7 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-54d8b558d4-bwjjd", UID:"10331660-de0e-4f65-8519-38c834383472", APIVersion:"v1", ResourceVersion:"4068", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
moataznaeem@moatazs-air ticketing %

and after digging and digging there is no way to solve this issue so please any help


来源: stackexchange

问:
Printing UTF-8 Encoded Text in EPSON TM-T88IV Thermal Printer
I have used the instruction below to print via .net for EPSON TM-T88IV Thermal Printer.

http://nicholas.piasecki.name/blog/2009/12/sending-a-bit-image-to-an-epson-tm-t88iii-receipt-printer-using-c-and-escpos/

I'm using below code, I have changed the encoding to UTF-8 but still can't print Unicode.

Some junk characters are printed.

```<code>private void frmMain_Load(object sender, EventArgs e)
    {
        Print(PrinterName, GetDocument());
    }

    private const string PrinterName = "EPSON TM-T88IV ReceiptE4";

    private static byte[] GetDocument()
    {
        UTF8Encoding utf8 = new UTF8Encoding();
        using (var ms = new MemoryStream())
        using (var bw = new BinaryWriter(ms,Encoding.UTF8))
        {
            // Reset the printer bws (NV images are not cleared)
            bw.Write(AsciiControlChars.Escape);
            bw.Write("سلام دنیا");
            bw.Write(AsciiControlChars.Newline);
            // Feed 3 vertical motion units and cut the paper with a 1 point cut
            bw.Write(AsciiControlChars.GroupSeparator);
            bw.Write('V');
            bw.Write((byte)66);
            bw.Write((byte)3);

            bw.Flush();

            return ms.ToArray();
        }
    }

    private static void Print(string printerName, byte[] document)
    {
        NativeMethods.DOC_INFO_1 documentInfo;
        IntPtr printerHandle;

        documentInfo = new NativeMethods.DOC_INFO_1();
        documentInfo.pDataType = "RAW";
        documentInfo.pDocName = "Bit Image Test";

        printerHandle = new IntPtr(0);

        if (NativeMethods.OpenPrinter(printerName.Normalize(), out printerHandle, IntPtr.Zero))
        {
            if (NativeMethods.StartDocPrinter(printerHandle, 1, documentInfo))
            {
                int bytesWritten;
                byte[] managedData;
                IntPtr unmanagedData;

                managedData = document;
                unmanagedData = Marshal.AllocCoTaskMem(managedData.Length);
                Marshal.Copy(managedData, 0, unmanagedData, managedData.Length);

                if (NativeMethods.StartPagePrinter(printerHandle))
                {
                    NativeMethods.WritePrinter(
                        printerHandle,
                        unmanagedData,
                        managedData.Length,
                        out bytesWritten);
                    NativeMethods.EndPagePrinter(printerHandle);
                }
                else
                {
                    throw new Win32Exception();
                }

                Marshal.FreeCoTaskMem(unmanagedData);

                NativeMethods.EndDocPrinter(printerHandle);
            }
            else
            {
                throw new Win32Exception();
            }

            NativeMethods.ClosePrinter(printerHandle);
        }
        else
        {
            throw new Win32Exception();
        }
    }
</code>```

答:
I have an EPSON TM-T88V and from here I understand both of them do NOT support UTF-8.

The only options are these ASCII encodings:
(taken from here)

for TM-T88IV I find them to be:

[South Asia models]

Page  0 [PC437: USA, Standard Europe]

Page 20 [Thai Character Code 42]

Page 21 [Thai Character Code 11]

Page 26 [Thai Character Code 18]

Page 30 [TCVN-3: Vietnamese]

Page 31 [TCVN-3: Vietnamese]

[Other models]

Page 0 [PC437: USA, Standard Europe]

Page 1 [Katakana]

Page 2 [PC850: Multilingual]

Page 3 [PC860: Portuguese]

Page 4 [PC863: Canadian-French]

Page 5 [PC865: Nordic]

Page 16 [WPC1252]

Page 17 [PC866: Cyrillic #2]

Page 18 [PC852: Latin 2]

Page 19 [PC858: Euro]

(Page 255 is a space page.)

ContentLicense: CC BY-SA 3.0

Body:
I have used the instruction below to print via .net for EPSON TM-T88IV Thermal Printer.

http://nicholas.piasecki.name/blog/2009/12/sending-a-bit-image-to-an-epson-tm-t88iii-receipt-printer-using-c-and-escpos/

I'm using below code, I have changed the encoding to UTF-8 but still can't print Unicode.

Some junk characters are printed.

private void frmMain_Load(object sender, EventArgs e)
    {
        Print(PrinterName, GetDocument());
    }

    private const string PrinterName = "EPSON TM-T88IV ReceiptE4";

    private static byte[] GetDocument()
    {
        UTF8Encoding utf8 = new UTF8Encoding();
        using (var ms = new MemoryStream())
        using (var bw = new BinaryWriter(ms,Encoding.UTF8))
        {
            // Reset the printer bws (NV images are not cleared)
            bw.Write(AsciiControlChars.Escape);
            bw.Write("سلام دنیا");
            bw.Write(AsciiControlChars.Newline);
            // Feed 3 vertical motion units and cut the paper with a 1 point cut
            bw.Write(AsciiControlChars.GroupSeparator);
            bw.Write('V');
            bw.Write((byte)66);
            bw.Write((byte)3);

            bw.Flush();

            return ms.ToArray();
        }
    }

    private static void Print(string printerName, byte[] document)
    {
        NativeMethods.DOC_INFO_1 documentInfo;
        IntPtr printerHandle;

        documentInfo = new NativeMethods.DOC_INFO_1();
        documentInfo.pDataType = "RAW";
        documentInfo.pDocName = "Bit Image Test";

        printerHandle = new IntPtr(0);

        if (NativeMethods.OpenPrinter(printerName.Normalize(), out printerHandle, IntPtr.Zero))
        {
            if (NativeMethods.StartDocPrinter(printerHandle, 1, documentInfo))
            {
                int bytesWritten;
                byte[] managedData;
                IntPtr unmanagedData;

                managedData = document;
                unmanagedData = Marshal.AllocCoTaskMem(managedData.Length);
                Marshal.Copy(managedData, 0, unmanagedData, managedData.Length);

                if (NativeMethods.StartPagePrinter(printerHandle))
                {
                    NativeMethods.WritePrinter(
                        printerHandle,
                        unmanagedData,
                        managedData.Length,
                        out bytesWritten);
                    NativeMethods.EndPagePrinter(printerHandle);
                }
                else
                {
                    throw new Win32Exception();
                }

                Marshal.FreeCoTaskMem(unmanagedData);

                NativeMethods.EndDocPrinter(printerHandle);
            }
            else
            {
                throw new Win32Exception();
            }

            NativeMethods.ClosePrinter(printerHandle);
        }
        else
        {
            throw new Win32Exception();
        }
    }

ContentLicense: CC BY-SA 4.0


问:
Cypress test: is .contains() equivalent to should('contain')?
Is this: cy.get('[name=planSelect]').contains(dummyPlan)

equivalent to this: cy.get('[name=planSelect]').should('contain', dummyPlan)

And if so, which is preferred? The first is more of an implicit assertion, but it's shorter and cleaner to my mind.

Follow-up question: After looking around to see how best to select elements for e2e testing I found that the Cypress docs recommend using data-cy attributes. Is there a reason this would be better than just adding name attributes to the markup? Should name only be used for forms fields?

答:
I recommend to use contains after get then verify existence with should.</p>
```<code>cy.get('[name=planSelect]').contains(dummyPlan, {matchCase: false}).should('exist')
</code>```

Body:
I recommend to use contains after get then verify existence with should.

cy.get('[name=planSelect]').contains(dummyPlan, {matchCase: false}).should('exist')


问:
Multiple scheduler with Grails Quartz plugin
I have an application using Grails Quartz plugin. I need to have two jobs to have multiple instances running, but have separate limitation on number of threads to be used for each job. As far as I understand, I need separate Thread Pools, which is possible by having separate schedulers. However, I cannot figure out how to create multiple schedulers with Quartz plugin.</p>

答:
Assuming you want to use different triggers to start the job multiple times. this works for me.

```<code>class MyJob {

    static triggers = {
        cron name: 'trigger1', cronExpression: "0 30 12 ? * WED"
        cron name: 'trigger2', cronExpression: "0 30 12 ? * SAT"
    }

    def execute() {

        // execute task, do your thing here
        println "Job executed"
    }
}
</code>```

Finally, about concurrent tasks.
This is from the plug-in page:

By default Jobs are executed in concurrent fashion, so new Job
  execution can start even if previous execution of the same Job is
  still running.

Body:
Assuming you want to use different triggers to start the job multiple times. this works for me.

class MyJob {

    static triggers = {
        cron name: 'trigger1', cronExpression: "0 30 12 ? * WED"
        cron name: 'trigger2', cronExpression: "0 30 12 ? * SAT"
    }

    def execute() {

        // execute task, do your thing here
        println "Job executed"
    }
}

Finally, about concurrent tasks.
This is from the plug-in page:

By default Jobs are executed in concurrent fashion, so new Job
  execution can start even if previous execution of the same Job is
  still running.


问:
How to use the blend / tblend filter with the t variable and between statement in FFMPEG
I want to use the blend or tblend filters in conjunction with the t variable's between statement. I'm open to other solutions that will achieve the same effect.

I know an image can be transposed over a video, e.g. between 00:00:01.000 to 00:00:02.000:

ffmpeg -i input.mkv -i input.jpg -filter_complex \ "[0:v][1:v] overlay=10:10:enable='between(t,1,2)'" output.mkv

Blurring a video at the same time can be done with smartblur:

ffmpeg -i input.mkv -vf "smartblur=enable='between(t,1,2)'" output.mkv

Changing the hue angle, e.g. by 90 degrees, can also be done:

ffmpeg -i input.mkv -vf "hue=h=-90:enable='between(t,1,2)'" output.mkv

Nothing from my searches or in the official documentation, however, explains how to compose a command using the blend or tblend filters in conjunction with the t variable's between statement. I've tried a number of formulations, but they all lead to errors. Is this simply not possible? Or is there another way to structure the command?

答:
According to the examples in the documentation, we may multiply the frame by the evaluated condition.

Example (the input is from here):

```<code>ffmpeg -y -i in.mp4 -i in.gif -filter_complex "[1:v][0:v]scale2ref[v1][v0];[v0][v1]blend=all_expr='A*if(between(T, 2, 6), 0.3, 1)+B*if(between(T, 2, 6), 0.7, 0)'" -vcodec libx264 -pix_fmt yuv444p -crf 17 -acodec copy out.mp4
</code>```

A applies the frame from the first video stream - [v0].

B applies the frame from the second video stream - [v1].

if(between(T, 2, 6), 0.3, 1) is evaluated to 0.3 when time is between 2 and 6 seconds, and evaluated to 1 otherwise.

if(between(T, 2, 6), 0.7, 0) is evaluated to 0.7 when time is between 2 and 6 seconds, and evaluated to 0 otherwise.

The entire expression is evaluated to 0.3*A + 0.7*B between 2 and 6 and 1*A + 0*B otherwise.

Sample output (between 2 and 6 seconds):

Note:

I think there is a bug regarding the exact time, but it could be related to my input.

We may also chain two blend filters if required.

The first blend applies some blending effect, and the second blend selects when to use the effect and when to use the original video stream.

Example:

```<code>ffmpeg -y -i in.mp4 -i in.gif -filter_complex "[1:v][0:v]scale2ref[v1][v0];[v0][v1]blend=all_mode=grainextract[b];[0:v][b]blend=all_expr='A*if(between(T, 2, 6), 0, 1)+B*if(between(T, 2, 6), 1, 0)'" -vcodec libx264 -pix_fmt yuv444p -crf 17 -acodec copy out.mp4
</code>```

Another option is to chain blend with overlay filter.

Body:
According to the examples in the documentation, we may multiply the frame by the evaluated condition.

Example (the input is from here):

ffmpeg -y -i in.mp4 -i in.gif -filter_complex "[1:v][0:v]scale2ref[v1][v0];[v0][v1]blend=all_expr='A*if(between(T, 2, 6), 0.3, 1)+B*if(between(T, 2, 6), 0.7, 0)'" -vcodec libx264 -pix_fmt yuv444p -crf 17 -acodec copy out.mp4

A applies the frame from the first video stream - [v0].

B applies the frame from the second video stream - [v1].

if(between(T, 2, 6), 0.3, 1) is evaluated to 0.3 when time is between 2 and 6 seconds, and evaluated to 1 otherwise.

if(between(T, 2, 6), 0.7, 0) is evaluated to 0.7 when time is between 2 and 6 seconds, and evaluated to 0 otherwise.

The entire expression is evaluated to 0.3*A + 0.7*B between 2 and 6 and 1*A + 0*B otherwise.

Sample output (between 2 and 6 seconds):

Note:

I think there is a bug regarding the exact time, but it could be related to my input.

We may also chain two blend filters if required.

The first blend applies some blending effect, and the second blend selects when to use the effect and when to use the original video stream.

Example:

ffmpeg -y -i in.mp4 -i in.gif -filter_complex "[1:v][0:v]scale2ref[v1][v0];[v0][v1]blend=all_mode=grainextract[b];[0:v][b]blend=all_expr='A*if(between(T, 2, 6), 0, 1)+B*if(between(T, 2, 6), 1, 0)'" -vcodec libx264 -pix_fmt yuv444p -crf 17 -acodec copy out.mp4

Another option is to chain blend with overlay filter.


问:
Count with conditional in pandas
i'm having a problem trying to count diferents variables for the same Name. The thing is: i have a sheet with the Name of all my workers and i need to count how many trainings they had, but thoses trainings have different classifications: "Comercial", "Funcional" and others...

One of my columns is "Name" and the other is "Trainings". How can i filter those trainings and aggregate per name

```<code>   import pandas as pd
   import numpy as np

   xls = pd.ExcelFile('BASE_Indicadores_treinamento_2021 - V3.xlsx')

   df = pd.read_excel(xls, 'Base')
   display(df)

   df2 = df.groupby("Nome").agg({'Eixo':'count'}).reset_index()
   display(df2)
</code>```

What im getting is the TOTAL of trainings per Name, but i need the count of all categories i have in trainings (there are 5 of them). Does anyone know what i need to do?

Thankss

答:
Problem solved!

Here's what i did

```<code>import pandas as pd
import numpy as np

xls = pd.ExcelFile('BASE_Indicadores_treinamento_2021 - V3.xlsx')

df = pd.read_excel(xls, 'Base')
display(df)

filt_funcional = df['Eixo'] == 'Funcional'
filt_comercial = df['Eixo'] == 'Comercial'
filt_liderança = df['Eixo'] == 'Liderança'
filt_negocio = df['Eixo'] == 'Negócio'
filt_obr_cert = df['Eixo'] == 'Obrigatórios e Certificações'

df.loc[filt_funcional]['Nome'].value_counts()
</code>```

Much easier than i thought!

And giving the credits, i only did bc of this video: https://www.youtube.com/watch?v=txMdrV1Ut64

Title: Count with conditional in pandas

Body:
i'm having a problem trying to count diferents variables for the same Name. The thing is: i have a sheet with the Name of all my workers and i need to count how many trainings they had, but thoses trainings have different classifications: "Comercial", "Funcional" and others...

One of my columns is "Name" and the other is "Trainings". How can i filter those trainings and aggregate per name

   import pandas as pd
   import numpy as np

   xls = pd.ExcelFile('BASE_Indicadores_treinamento_2021 - V3.xlsx')

   df = pd.read_excel(xls, 'Base')
   display(df)

   df2 = df.groupby("Nome").agg({'Eixo':'count'}).reset_index()
   display(df2)

What im getting is the TOTAL of trainings per Name, but i need the count of all categories i have in trainings (there are 5 of them). Does anyone know what i need to do?

Thankss

Body:
Problem solved!

Here's what i did

import pandas as pd
import numpy as np

xls = pd.ExcelFile('BASE_Indicadores_treinamento_2021 - V3.xlsx')

df = pd.read_excel(xls, 'Base')
display(df)

filt_funcional = df['Eixo'] == 'Funcional'
filt_comercial = df['Eixo'] == 'Comercial'
filt_liderança = df['Eixo'] == 'Liderança'
filt_negocio = df['Eixo'] == 'Negócio'
filt_obr_cert = df['Eixo'] == 'Obrigatórios e Certificações'

df.loc[filt_funcional]['Nome'].value_counts()

Much easier than i thought!

And giving the credits, i only did bc of this video: https://www.youtube.com/watch?v=txMdrV1Ut64


问:
Installing XGBoost on iMac M1 with GPU Support
I currently wrote some script for running XGBoost on my M1 iMac computer. I have installed XGBoost already within conda-forge as seen:

```<code>...
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xgboost                   1.5.0            py39ha480839_0    conda-forge
xz                        5.2.5                h642e427_1    conda-forge
...
</code>```

But I get this error, not sure why:

```<code>Traceback (most recent call last):
  File "/Volumes/XXXXDrive/ProjectDrive/Project/Project.py", line 195, in
    xgb_model.fit(dtrainx, dtrainy)
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 506, in inner_f
    return f(**kwargs)
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/sklearn.py", line 789, in fit
    self._Booster = train(
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/training.py", line 188, in train
    bst = _train_internal(params, dtrain,
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/training.py", line 81, in _train_internal
    bst.update(dtrain, i, obj)
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 1680, in update
    _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 218, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [01:00:46] /Users/runner/miniforge3/conda-bld/xgboost-split_1635105055642/work/src/gbm/../common/common.h:157: XGBoost version not compiled with GPU support.
Stack trace:
  [bt] (0) 1   libxgboost.dylib                    0x000000011f9418b0 dmlc::LogMessageFatal::~LogMessageFatal() + 124
  [bt] (1) 2   libxgboost.dylib                    0x000000011f9bf708 xgboost::gbm::GBTree::ConfigureUpdaters() + 464
  [bt] (2) 3   libxgboost.dylib                    0x000000011f9bf248 xgboost::gbm::GBTree::Configure(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) + 1008
  [bt] (3) 4   libxgboost.dylib                    0x000000011f9d91dc xgboost::LearnerConfiguration::Configure() + 1076
  [bt] (4) 5   libxgboost.dylib                    0x000000011f9d951c xgboost::LearnerImpl::UpdateOneIter(int, std::__1::shared_ptr<xgboost::DMatrix>) + 144
  [bt] (5) 6   libxgboost.dylib                    0x000000011f945b58 XGBoosterUpdateOneIter + 164
  [bt] (6) 7   libffi.dylib                        0x0000000199014050 ffi_call_SYSV + 80
  [bt] (7) 8   libffi.dylib                        0x000000019901c9e4 ffi_call_int + 948
  [bt] (8) 9   _ctypes.cpython-39-darwin.so        0x0000000113f8c744 _ctypes_callproc + 1236
</code>```

I'm guessing that the xgboost I currently have is not the GPU support but rather just CPU support. My predictor is a gpu_predictor. But does anyone know how to check if I have the GPU version? Or at least how I can install the GPU version of the XGBoost on my M1 iMac? Thanks!

答:
Fire,

xgb is not supporting Apple M1 GPU. You can check the issue on Github:
https://github.com/dmlc/xgboost/issues/6408

I don't expect xgb or lgbm to support Apple GPU very soon, which is very unfortunate.

Cheers

Body:
I currently wrote some script for running XGBoost on my M1 iMac computer. I have installed XGBoost already within conda-forge as seen:

...
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xgboost                   1.5.0            py39ha480839_0    conda-forge
xz                        5.2.5                h642e427_1    conda-forge
...

But I get this error, not sure why:

Traceback (most recent call last):
  File "/Volumes/XXXXDrive/ProjectDrive/Project/Project.py", line 195, in
    xgb_model.fit(dtrainx, dtrainy)
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 506, in inner_f
    return f(**kwargs)
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/sklearn.py", line 789, in fit
    self._Booster = train(
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/training.py", line 188, in train
    bst = _train_internal(params, dtrain,
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/training.py", line 81, in _train_internal
    bst.update(dtrain, i, obj)
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 1680, in update
    _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
  File "/Users/XXXX/miniforge3/lib/python3.9/site-packages/xgboost/core.py", line 218, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [01:00:46] /Users/runner/miniforge3/conda-bld/xgboost-split_1635105055642/work/src/gbm/../common/common.h:157: XGBoost version not compiled with GPU support.
Stack trace:
  [bt] (0) 1   libxgboost.dylib                    0x000000011f9418b0 dmlc::LogMessageFatal::~LogMessageFatal() + 124
  [bt] (1) 2   libxgboost.dylib                    0x000000011f9bf708 xgboost::gbm::GBTree::ConfigureUpdaters() + 464
  [bt] (2) 3   libxgboost.dylib                    0x000000011f9bf248 xgboost::gbm::GBTree::Configure(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) + 1008
  [bt] (3) 4   libxgboost.dylib                    0x000000011f9d91dc xgboost::LearnerConfiguration::Configure() + 1076
  [bt] (4) 5   libxgboost.dylib                    0x000000011f9d951c xgboost::LearnerImpl::UpdateOneIter(int, std::__1::shared_ptr<xgboost::DMatrix>) + 144
  [bt] (5) 6   libxgboost.dylib                    0x000000011f945b58 XGBoosterUpdateOneIter + 164
  [bt] (6) 7   libffi.dylib                        0x0000000199014050 ffi_call_SYSV + 80
  [bt] (7) 8   libffi.dylib                        0x000000019901c9e4 ffi_call_int + 948
  [bt] (8) 9   _ctypes.cpython-39-darwin.so        0x0000000113f8c744 _ctypes_callproc + 1236

I'm guessing that the xgboost I currently have is not the GPU support but rather just CPU support. My predictor is a gpu_predictor. But does anyone know how to check if I have the GPU version? Or at least how I can install the GPU version of the XGBoost on my M1 iMac? Thanks!


问:
How do I account for daylight savings time when retrieving current time in PHP?
When getting the time via PHP script (time()), during Daylight Savings Time it seems to return a time value that is one hour off. Is there any way to get the correct time, accounting for Daylight Savings Time?

答: This won't be "the" answer, but the local server time can be mismanaged by your provider.  I don't know the context for your use of the time information, but whenever I use such information, I attempt to use UTD/GMT.  If your users are spread out over the world, or even a single country, rectifying time can be a nightmare.  Representing things, like file save times, log times, or other uses can be done reasonably with UDT/GMT.</p>


问:
My code works when hovering in but not when hovering out
```<code>Alright, so when I use this code and hover over the object, the transition works. But if I take my mouse OFF of the object, the transition doesn't happen. I've seen other posts talk about this but the solutions don't work.
</code>```

Here's my code in CSS:

.square{
margin-top: 20px;
  height: 100px;
  width: 400px;
  border-radius: 20px;
  background:#3d3434;
  outline: none;
  transition: 0.25s;
}

.square:hover{
    outline: 3px solid #21ff46;
}```

Also, I'm relatively new to coding and CSS.

答:
You code works properly. The reason why you see no animation on mouseleave is that after hover pseudostate ends, there's no outline at all, and browser doesn't know to what position he has to shrink the outline. Also it doesn't understand what color it should preserve while shrinking, without hover state there's no color defined.

So, the solution is to add this line to your .square

```<code>outline: 0 solid #21ff46;
</code>```

Leave the rest as it is, your problem is solved.

Body:
Alright, so when I use this code and hover over the object, the transition works. But if I take my mouse OFF of the object, the transition doesn't happen. I've seen other posts talk about this but the solutions don't work.

Here's my code in CSS:

.square{
margin-top: 20px;
  height: 100px;
  width: 400px;
  border-radius: 20px;
  background:#3d3434;
  outline: none;
  transition: 0.25s;
}

.square:hover{
    outline: 3px solid #21ff46;
}

Also, I'm relatively new to coding and CSS.

Body:
You code works properly. The reason why you see no animation on mouseleave is that after hover pseudostate ends, there's no outline at all, and browser doesn't know to what position he has to shrink the outline. Also it doesn't understand what color it should preserve while shrinking, without hover state there's no color defined.

So, the solution is to add this line to your .square

outline: 0 solid #21ff46;

Leave the rest as it is, your problem is solved.


问:
How to remove only one of repeated chars in string using JavaScript
I have a string with repeated chars like : 'CANADA'.

And I am trying to get the string which removed only one of repeated chars :

'CNADA', 'CANDA', 'CANAD'.

I've tried it with subString, but it returned the part of string removed.
Also I've tried it with reduce, but it ended up removing all the repeated chars ('CND').

What is the way of removing only one char at time?
The results can be stored in array. (results = ['CNADA', 'CANDA', 'CANAD'])

Thank you.

答:
You can achieve this by utilizing the second parameter of String#indexOf() which specifies the position from which to start the search. Here in a while loop, and using a Set to remove dulplicates before returning.

function getReplaceOptions(str, char) {
  let res = [], i = str.indexOf(char, 0);
  while (i !== -1) {
    res.push(str.substring(0, i) + str.substring(++i));
    i = str.indexOf(char, i)
  }
  return Array.from(new Set(res))
}

console.log(getReplaceOptions('CANADA', 'A'));
console.log(getReplaceOptions('Mississippi', 's'));```


问:
Image breaking Flexbox grid
I wanted to create a flex grid as follows:

```<code>-------------------------------
| Menu |     Header Image     |
|      |-----------------------
|      |     Content          |
-------------------------------
</code>```

So I have this:

```<code>.container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  height: 100px;
  justify-content: space-between;
}

.sidebar {
  width: 20%;
  flex-basis: 100%;
  border: 1px solid red;
  background-color: yellow;
}

.header,
.content {
  width: 75%;
  flex-basis: 40%;
  border: 1px solid red;
}
</code>```

And the html:

      ...

Content Here

```
<p>The layout works great without an image, but with an image, even if it's small, it puts the <code>Content</code> item next to the <code>Header Image</code>:</p>
```-----------------------------------------
| Menu |     Header Image     | Content |
|      |---------------------------------
|      |
-------
```
<p>I tried:</p>
```
.logo img {
  box-sizing: border-box;
  max-width:  80%;
  max-height: 100%;
  flex: 0 0 auto;
}

```

If I tweak max-width to 20%, then the layout is fine. The image is not that wide, or tall, and hence am confused why it has to be shrunk so small for it to work.

答:
As mentioned before, it's better to use grid for this layout.
But it is possible to do it with flex,
It is best to think of flex as a way of styling one row (or one column) of a div

You need to handle one "row" with a few "columns" in Flex to achieve what you want
When you were trying to have two columns, your mistake was that you used three siblings under the container
There should only be two sibling elements within the container (the flex element).

so you need to have

```<code>    <div class="flex-parent">
      <div class="col1"></div>
      <div class="col2"></div>
    </div>
</code>```

for your example:

```<code><div class="container">
  <div class="sidebar">
    <nav id="menu">
      ...
    </nav>
  </div>
  <div class="content-and-header-wrapper"> // added this div
    <div class="header">
      <div class="logo">
        <img src="/images/site/logo.jpg">
      </div>
    </div>
    <div class="content">
     <p>Content Here</p>
    </div>
  <div>

</div>
</code>```
```<code> col-1         col-2
-------------------------------
| Menu |     Header Image     |
|      |-----------------------
|      |     Content          |
-------------------------------
</code>```

now the col-2 should be flex with flex-direction: column;
with 2 divs inside (one col with 2 rows ...)

.row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
  height:100px;
}
.column {
  display: flex;
  flex-direction: column;
  flex-basis: 100%;
  flex: 1;
  height:100%;
  border:1px solid red;
}

img {
  height: 100%;
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
  width: 30%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code>  <div class='row'>
    <div class='column'>
      <div>
        Column One
      </div>
    </div>
    <div class='column'>
      <div>
        <img src="">
      </div>
       <div>
       Column Two
      </div>
    </div>
  </div></code>```

Title: Image breaking Flexbox grid

Body:
I wanted to create a flex grid as follows:

-------------------------------
| Menu |     Header Image     |
|      |-----------------------
|      |     Content          |
-------------------------------

So I have this:

.container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  height: 100px;
  justify-content: space-between;
}

.sidebar {
  width: 20%;
  flex-basis: 100%;
  border: 1px solid red;
  background-color: yellow;
}

.header,
.content {
  width: 75%;
  flex-basis: 40%;
  border: 1px solid red;
}

And the html:

      ...

Content Here

The layout works great without an image, but with an image, even if it's small, it puts the Content item next to the Header Image:

-----------------------------------------
| Menu |     Header Image     | Content |
|      |---------------------------------
|      |
-------

I tried:

.logo img {
  box-sizing: border-box;
  max-width:  80%;
  max-height: 100%;
  flex: 0 0 auto;
}

If I tweak max-width to 20%, then the layout is fine. The image is not that wide, or tall, and hence am confused why it has to be shrunk so small for it to work.

Body:
As mentioned before, it's better to use grid for this layout.
But it is possible to do it with flex,
It is best to think of flex as a way of styling one row (or one column) of a div

You need to handle one "row" with a few "columns" in Flex to achieve what you want
When you were trying to have two columns, your mistake was that you used three siblings under the container
There should only be two sibling elements within the container (the flex element).

so you need to have

    <div class="flex-parent">
      <div class="col1"></div>
      <div class="col2"></div>
    </div>

for your example:

<div class="container">
  <div class="sidebar">
    <nav id="menu">
      ...
    </nav>
  </div>
  <div class="content-and-header-wrapper"> // added this div
    <div class="header">
      <div class="logo">
        <img src="/images/site/logo.jpg">
      </div>
    </div>
    <div class="content">
     <p>Content Here</p>
    </div>
  <div>

</div>

 col-1         col-2
-------------------------------
| Menu |     Header Image     |
|      |-----------------------
|      |     Content          |
-------------------------------

now the col-2 should be flex with flex-direction: column;
with 2 divs inside (one col with 2 rows ...)

.row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
  height:100px;
}
.column {
  display: flex;
  flex-direction: column;
  flex-basis: 100%;
  flex: 1;
  height:100%;
  border:1px solid red;
}

img {
  height: 100%;
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
  width: 30%;
}

  <div class='row'>
    <div class='column'>
      <div>
        Column One
      </div>
    </div>
    <div class='column'>
      <div>
        <img src="">
      </div>
       <div>
       Column Two
      </div>
    </div>
  </div>


问:
How get featured image via SQL query in WordPress?
I have created a custom JSON API for my website for my Blog Posts, but I cannot find any way to add the featured image URL to the API. Here is my API:

```<code><?php
header("Content-Type: application/json");
require_once 'wp-connect.php';

$result = [];
$sql = <<<SQL
SELECT *
FROM wp_users
INNER JOIN wp_posts ON wp_users.ID = wp_posts.post_author AND wp_posts.post_type = 'post'
INNER JOIN (
    SELECT user_id,
           MAX(IF(meta_key = 'first_name', meta_value, NULL)) AS first_name,
           MAX(IF(meta_key = 'last_name', meta_value, NULL)) AS last_name,
           MAX(IF(meta_key = 'avatar_hash', meta_value, NULL))AS avatar_hash
    FROM wp_usermeta
    GROUP BY user_id
) pivoted ON pivoted.user_id = wp_users.ID
ORDER BY wp_posts.ID
SQL;
foreach (mysqli_query($conn, $sql) as $row) {
    $result[] = [
        'post_id' => $row['ID'],
        'user_id' => $row['post_author'],
        'post' => $row['post_content'],
        'firstName' => $row['first_name'],
        'lastName' => $row['last_name'],
        'username' => $row['user_nicename'],
        'avatar' => $row['avatar_hash'],
        'post_date' => $row['post_date'],
        'post_type' => $row['post_type'],
        'post_title' => $row['post_title'],
        'post_name' => $row['post_name'],
        'post_modified' => $row['post_modified'],
    ];
}
echo json_encode($result, JSON_PRETTY_PRINT);
?>
</code>```

So, is there a way I can add the featured image URL inside my JSON API? Any answer will be appreciated!

答:
To get a featured image you need _thumbnail_id and from that id, you can get the image URL. _thumbnail_id you can find in the post meta table. try the below query.

```<code>header("Content-Type: application/json");
require_once 'wp-connect.php';

$result = [];
$sql = <<<SQL
SELECT *,
    (
        SELECT guid
        FROM   wp_posts
        WHERE  id = wp_postmeta.meta_value
    ) AS image
FROM wp_users
INNER JOIN wp_posts ON wp_users.ID = wp_posts.post_author AND wp_posts.post_type = 'post'
INNER JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.id AND wp_postmeta.meta_key = '_thumbnail_id'
INNER JOIN (
    SELECT user_id,
           MAX(IF(meta_key = 'first_name', meta_value, NULL)) AS first_name,
           MAX(IF(meta_key = 'last_name', meta_value, NULL)) AS last_name,
           MAX(IF(meta_key = 'avatar_hash', meta_value, NULL))AS avatar_hash
    FROM wp_usermeta
    GROUP BY user_id
) pivoted ON pivoted.user_id = wp_users.ID
ORDER BY wp_posts.ID;
SQL;

foreach ( mysqli_query($conn, $sql) as $row ) {
    $result[] = [
        'post_id'       => $row['ID'],
        'user_id'       => $row['post_author'],
        'post'          => $row['post_content'],
        'firstName'     => $row['first_name'],
        'lastName'      => $row['last_name'],
        'username'      => $row['user_nicename'],
        'avatar'        => $row['avatar_hash'],
        'post_date'     => $row['post_date'],
        'post_type'     => $row['post_type'],
        'post_title'    => $row['post_title'],
        'post_name'     => $row['post_name'],
        'post_modified' => $row['post_modified'],
        'image'         => $row['image']
    ];
}
</code>```

Body:
I have created a custom JSON API for my website for my Blog Posts, but I cannot find any way to add the featured image URL to the API. Here is my API:

<?php
header("Content-Type: application/json");
require_once 'wp-connect.php';

$result = [];
$sql = <<<SQL
SELECT *
FROM wp_users
INNER JOIN wp_posts ON wp_users.ID = wp_posts.post_author AND wp_posts.post_type = 'post'
INNER JOIN (
    SELECT user_id,
           MAX(IF(meta_key = 'first_name', meta_value, NULL)) AS first_name,
           MAX(IF(meta_key = 'last_name', meta_value, NULL)) AS last_name,
           MAX(IF(meta_key = 'avatar_hash', meta_value, NULL))AS avatar_hash
    FROM wp_usermeta
    GROUP BY user_id
) pivoted ON pivoted.user_id = wp_users.ID
ORDER BY wp_posts.ID
SQL;
foreach (mysqli_query($conn, $sql) as $row) {
    $result[] = [
        'post_id' => $row['ID'],
        'user_id' => $row['post_author'],
        'post' => $row['post_content'],
        'firstName' => $row['first_name'],
        'lastName' => $row['last_name'],
        'username' => $row['user_nicename'],
        'avatar' => $row['avatar_hash'],
        'post_date' => $row['post_date'],
        'post_type' => $row['post_type'],
        'post_title' => $row['post_title'],
        'post_name' => $row['post_name'],
        'post_modified' => $row['post_modified'],
    ];
}
echo json_encode($result, JSON_PRETTY_PRINT);
?>

So, is there a way I can add the featured image URL inside my JSON API? Any answer will be appreciated!

Body:
To get a featured image you need _thumbnail_id and from that id, you can get the image URL. _thumbnail_id you can find in the post meta table. try the below query.

header("Content-Type: application/json");
require_once 'wp-connect.php';

$result = [];
$sql = <<<SQL
SELECT *,
    (
        SELECT guid
        FROM   wp_posts
        WHERE  id = wp_postmeta.meta_value
    ) AS image
FROM wp_users
INNER JOIN wp_posts ON wp_users.ID = wp_posts.post_author AND wp_posts.post_type = 'post'
INNER JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.id AND wp_postmeta.meta_key = '_thumbnail_id'
INNER JOIN (
    SELECT user_id,
           MAX(IF(meta_key = 'first_name', meta_value, NULL)) AS first_name,
           MAX(IF(meta_key = 'last_name', meta_value, NULL)) AS last_name,
           MAX(IF(meta_key = 'avatar_hash', meta_value, NULL))AS avatar_hash
    FROM wp_usermeta
    GROUP BY user_id
) pivoted ON pivoted.user_id = wp_users.ID
ORDER BY wp_posts.ID;
SQL;

foreach ( mysqli_query($conn, $sql) as $row ) {
    $result[] = [
        'post_id'       => $row['ID'],
        'user_id'       => $row['post_author'],
        'post'          => $row['post_content'],
        'firstName'     => $row['first_name'],
        'lastName'      => $row['last_name'],
        'username'      => $row['user_nicename'],
        'avatar'        => $row['avatar_hash'],
        'post_date'     => $row['post_date'],
        'post_type'     => $row['post_type'],
        'post_title'    => $row['post_title'],
        'post_name'     => $row['post_name'],
        'post_modified' => $row['post_modified'],
        'image'         => $row['image']
    ];
}


问:
Python: remove brackets of list elements while printing pandas dataframe
I have a pandas dataframe of this kind

```<code>d = {'col1': [1, [2,3]], 'col2': [[3,4,5], 4]}
d = pd.DataFrame(d)
print(d)
</code>```

output:

```<code>     col1       col2
0       1  [3, 4, 5]
1  [2, 3]          4
</code>```

what is the best way to remove the brackets of all the list elements while printing this dataframe?

答:
Another way to do it:</p>
```<code>d.applymap(lambda x: str(x)[1:-1] if type(x)==list else x)
# Out:
#    col1     col2
# 0     1  3, 4, 5
# 1  2, 3        4
</code>```

Body:
I have a pandas dataframe of this kind

d = {'col1': [1, [2,3]], 'col2': [[3,4,5], 4]}
d = pd.DataFrame(d)
print(d)

output:

     col1       col2
0       1  [3, 4, 5]
1  [2, 3]          4

what is the best way to remove the brackets of all the list elements while printing this dataframe?

Body:
Another way to do it:

d.applymap(lambda x: str(x)[1:-1] if type(x)==list else x)
# Out:
#    col1     col2
# 0     1  3, 4, 5
# 1  2, 3        4