问:
ACR to AKS deployment ERROR: The container operating system does not match the host operating system
I have deployed a windows container which runs successfully in my local system using docker. Moved the image to Azure container registry and deployed the image from ACR to AKS.

I have created a windows node using AKS windows preview

```<code>C:\Users\HTECH>kubectl get nodes -o wide
NAME                                STATUS   ROLES   AGE    VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                    KERNEL-VERSION      CONTAINER-RUNTIME
aks-nodepool1-36563144-vmss000000   Ready    agent   2d3h   v1.14.0   10.240.0.4    <none>        Ubuntu 16.04.6 LTS          4.15.0-1042-azure   docker://3.0.4
akssample000000                     Ready    agent   2d2h   v1.14.0   10.240.0.35   <none>        Windows Server Datacenter   10.0.17763.379      docker://18.9.2

</code>```

Docker File:

```<code>FROM microsoft/iis:latest
SHELL ["powershell"]

RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
    Install-WindowsFeature Web-Asp-Net45

COPY . ewims
RUN Remove-WebSite -Name 'Default Web Site'
RUN New-Website -Name 'sample' -Port 80 \
    -PhysicalPath 'c:\sample' -ApplicationPool '.NET v4.5'
EXPOSE 80
</code>```

Manifest YAML

```<code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: samplecloudpoc-v1
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  selector:
    matchLabels:
      app: samplecloudpoc-v1
  template:
    metadata:
      labels:
        app: samplecloudpoc-v1
    spec:
      containers:
      - name: samplecloudpoc-v1
        image: samplecloud.azurecr.io/sample:v1
        ports:
        - containerPort: 80
        resources:
          requests:
            cpu: 100m
          limits:
            cpu: 100m
        env:
        - name: dev
          value: "samplecloudpoc-v1"
      imagePullSecrets:
        - name: sampleauth
      nodeSelector:
        beta.kubernetes.io/os: windows
---
apiVersion: v1
kind: Service
metadata:
  name: samplecloudpoc-v1
spec:
  loadBalancerIP: 13.90.205.141
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: samplecloudpoc-v1

</code>```

While checking the deployement status using below command, I'm getting the following error.

```<code>D:\Cloud>kubectl describe po samplecloudpoc-v1-5d567d48d9-7gtx8
Name:               samplecloudpoc-v1-5d567d48d9-7gtx8
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               akssample000000/10.240.0.35
Start Time:         Thu, 30 May 2019 13:05:13 +0530
Labels:             app=samplecloudpoc-v1
                    pod-template-hash=5d567d48d9
Annotations:        <none>
Status:             Running
IP:                 10.240.0.44
Controlled By:      ReplicaSet/samplecloudpoc-v1-5d567d48d9
Containers:
  sample:
    Container ID:  docker://0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112
    Image:         samplecloud.azurecr.io/sample:v1
    Image ID:      docker-pullable://samplecloud.azurecr.io/sample@sha256:55ac14dc512abc0f8deebb8b87ee47d51fdfbfd997ce6cee0ab521bd69d42b08
    Port:          80/TCP
    Host Port:     0/TCP
    Args:
      -it
    State:       Waiting
      Reason:    CrashLoopBackOff
    Last State:  Terminated
      Reason:    ContainerCannotRun
      Message:   CreateComputeSystem 0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112: The container operating system does not match the host operating system.
(extra info: {"SystemType":"Container","Name":"0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112","Owner":"docker","VolumePath":"\\\\?\\Volume{f5ff1135-4e83-4baa-961d-f4533dcb6985}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112","Layers":[{"ID":"b3b88c23-310f-5e95-86bc-117e9f6a6184","Path":"C:\\ProgramData\\docker\\windowsfilter\\0cc15446c028e2fe68601b10a1921a809dedb2a981162c4ed90344d2fde58f0e"},{"ID":"fb1ae57e-89dc-502c-996b-75804b972adc","Path":"C:\\ProgramData\\docker\\windowsfilter\\7217ca2e8bbd2c431c9db44050946ec4f8040c42fdd79f7ceae321e48dc5ca0d"},{"ID":"bb5e3864-b1af-51c8-a8e4-63d88749f082","Path":"C:\\ProgramData\\docker\\windowsfilter\\16f07ffe70a600c95bea2e8297c04cbb6af877562c2cc2ac1693267b152d3793"},{"ID":"2fae8c16-582f-5ab1-acfe-0a88980adec3","Path":"C:\\ProgramData\\docker\\windowsfilter\\a325070d766dd4af490b433d75eac6e1d71297961d89011e5798949eae2e7e4a"},{"ID":"dffd6df2-a500-5985-9c9c-1bc03c9efce3","Path":"C:\\ProgramData\\docker\\windowsfilter\\1221f773d66647fd1dc7aad44693f28843c8385612edb520231c1cb754eb2f97"},{"ID":"7e349a26-81b9-554e-aa13-a6e4286de93e","Path":"C:\\ProgramData\\docker\\windowsfilter\\67d6d22eae7f829e590fde792c6b8129aff3d9f9242850fe72e8d167e284a6b7"},{"ID":"8730db1a-385d-5e9a-a4ec-c45525b5fcb3","Path":"C:\\ProgramData\\docker\\windowsfilter\\2a53ed97b10bd4f67e62e8511e8922496651f3d343dd1889425ba1bedca134fa"},{"ID":"d1e23520-6c0b-5909-8e52-bb6961f80876","Path":"C:\\ProgramData\\docker\\windowsfilter\\d3a27083556be1bb7e36997f0eee2b544f6a16eab94797715bc21db99bf42e88"},{"ID":"18d8ab30-09e9-54e3-a991-f48cca651c8d","Path":"C:\\ProgramData\\docker\\windowsfilter\\9b4143f537ff70f6b1e05b2a5e38e3b05dd2a4b2f624822e32bb2b7cd17b7cca"},{"ID":"2acb6fa3-f27c-50cf-9033-eedb06d5bf32","Path":"C:\\ProgramData\\docker\\windowsfilter\\f71b6708cc4045bf9633f971dd4d6eddb1c5ffeda52d38e648c740e0e277b2df"},{"ID":"0dc40cf1-482a-5fed-af35-c5d1902b95ae","Path":"C:\\ProgramData\\docker\\windowsfilter\\100f3380579a77f2fb2c0f997201e34a0dd2c42e4b0d9a39fb850706aa16e474"}],"ProcessorWeight":5000,"HostName":"samplecloudpoc-v1-5d567d48d9-7gtx8","MappedDirectories":[{"HostPath":"c:\\var\\lib\\kubelet\\pods\\75f48f65-82ad-11e9-8e99-a24a72224ed5\\volumes\\kubernetes.io~secret\\default-token-67g2m","ContainerPath":"c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount","ReadOnly":true,"BandwidthMaximum":0,"IOPSMaximum":0,"CreateInUtilityVM":false}],"HvPartition":false,"NetworkSharedContainerName":"d11237887aec604bfbb9b3cd56fca586975e5a92e04dab4d4ba19b1fcc56ed99"})
      Exit Code:    128
      Started:      Thu, 30 May 2019 13:25:00 +0530
      Finished:     Thu, 30 May 2019 13:25:00 +0530
    Ready:          False
    Restart Count:  5
    Limits:
      cpu:  100m
    Requests:
      cpu:  100m
    Environment:
      dev:  samplecloudpoc-v1
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-67g2m (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-67g2m:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-67g2m
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  beta.kubernetes.io/os=windows
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                    From                      Message
  ----     ------     ----                   ----                      -------
  Normal   Scheduled  21m                    default-scheduler         Successfully assigned default/samplecloudpoc-v1-5d567d48d9-7gtx8 to akssample000000
  Normal   Pulling    21m                    kubelet, akssample000000  Pulling image "samplecloud.azurecr.io/sample:v1"
  Normal   Pulled     4m31s                  kubelet, akssample000000  Successfully pulled image "samplecloud.azurecr.io/sample:v1"
  Normal   Created    3m (x5 over 4m31s)     kubelet, akssample000000  Created container sample
  Normal   Pulled     3m (x4 over 4m28s)     kubelet, akssample000000  Container image "samplecloud.azurecr.io/sample:v1" already present on machine
  Warning  Failed     2m59s (x5 over 4m30s)  kubelet, akssample000000  Error: failed to start container "sample": Error response from daemon: CreateComputeSystem sample: The container operating system does not match the host operating system.
(extra info: {"SystemType":"Container","Name":"sample","Owner":"docker","VolumePath":"\\\\?\\Volume{f5ff1135-4e83-4baa-961d-f4533dcb6985}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\sample","Layers":[{"ID":"b3b88c23-310f-5e95-86bc-117e9f6a6184","Path":"C:\\ProgramData\\docker\\windowsfilter\\0cc15446c028e2fe68601b10a1921a809dedb2a981162c4ed90344d2fde58f0e"},{"ID":"fb1ae57e-89dc-502c-996b-75804b972adc","Path":"C:\\ProgramData\\docker\\windowsfilter\\7217ca2e8bbd2c431c9db44050946ec4f8040c42fdd79f7ceae321e48dc5ca0d"},{"ID":"bb5e3864-b1af-51c8-a8e4-63d88749f082","Path":"C:\\ProgramData\\docker\\windowsfilter\\16f07ffe70a600c95bea2e8297c04cbb6af877562c2cc2ac1693267b152d3793"},{"ID":"2fae8c16-582f-5ab1-acfe-0a88980adec3","Path":"C:\\ProgramData\\docker\\windowsfilter\\a325070d766dd4af490b433d75eac6e1d71297961d89011e5798949eae2e7e4a"},{"ID":"dffd6df2-a500-5985-9c9c-1bc03c9efce3","Path":"C:\\ProgramData\\docker\\windowsfilter\\1221f773d66647fd1dc7aad44693f28843c8385612edb520231c1cb754eb2f97"},{"ID":"7e349a26-81b9-554e-aa13-a6e4286de93e","Path":"C:\\ProgramData\\docker\\windowsfilter\\67d6d22eae7f829e590fde792c6b8129aff3d9f9242850fe72e8d167e284a6b7"},{"ID":"8730db1a-385d-5e9a-a4ec-c45525b5fcb3","Path":"C:\\ProgramData\\docker\\windowsfilter\\2a53ed97b10bd4f67e62e8511e8922496651f3d343dd1889425ba1bedca134fa"},{"ID":"d1e23520-6c0b-5909-8e52-bb6961f80876","Path":"C:\\ProgramData\\docker\\windowsfilter\\d3a27083556be1bb7e36997f0eee2b544f6a16eab94797715bc21db99bf42e88"},{"ID":"18d8ab30-09e9-54e3-a991-f48cca651c8d","Path":"C:\\ProgramData\\docker\\windowsfilter\\9b4143f537ff70f6b1e05b2a5e38e3b05dd2a4b2f624822e32bb2b7cd17b7cca"},{"ID":"2acb6fa3-f27c-50cf-9033-eedb06d5bf32","Path":"C:\\ProgramData\\docker\\windowsfilter\\f71b6708cc4045bf9633f971dd4d6eddb1c5ffeda52d38e648c740e0e277b2df"},{"ID":"0dc40cf1-482a-5fed-af35-c5d1902b95ae","Path":"C:\\ProgramData\\docker\\windowsfilter\\100f3380579a77f2fb2c0f997201e34a0dd2c42e4b0d9a39fb850706aa16e474"}],"ProcessorWeight":5000,"HostName":"samplecloudpoc-v1-5d567d48d9-7gtx8","MappedDirectories":[{"HostPath":"c:\\var\\lib\\kubelet\\pods\\75f48f65-82ad-11e9-8e99-a24a72224ed5\\volumes\\kubernetes.io~secret\\default-token-67g2m","ContainerPath":"c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount","ReadOnly":true,"BandwidthMaximum":0,"IOPSMaximum":0,"CreateInUtilityVM":false}],"HvPartition":false,"NetworkSharedContainerName":"d11237887aec604bfbb9b3cd56fca586975e5a92e04dab4d4ba19b1fcc56ed99"})
  Warning  BackOff  119s (x10 over 3m59s)  kubelet, akssample000000  Back-off restarting failed container

</code>```

I have tried to fix this by pulling the latest version IIS image from docker also throws the same error.

答:
I suppose the issue is with the fact AKS doesnt yet support windows nodes, so you dont really have windows nodes. You can create AKS with windows nodes, but its in preview at this point in time.

https://github.com/Azure/AKS/blob/master/previews.md#windows

If you have windows nodes, you'd need to make sure that the base image you are using matches the windows host os version

https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility

Body:
I have deployed a windows container which runs successfully in my local system using docker. Moved the image to Azure container registry and deployed the image from ACR to AKS.

I have created a windows node using AKS windows preview

C:\Users\HTECH>kubectl get nodes -o wide
NAME                                STATUS   ROLES   AGE    VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                    KERNEL-VERSION      CONTAINER-RUNTIME
aks-nodepool1-36563144-vmss000000   Ready    agent   2d3h   v1.14.0   10.240.0.4    <none>        Ubuntu 16.04.6 LTS          4.15.0-1042-azure   docker://3.0.4
akssample000000                     Ready    agent   2d2h   v1.14.0   10.240.0.35   <none>        Windows Server Datacenter   10.0.17763.379      docker://18.9.2

Docker File:

FROM microsoft/iis:latest
SHELL ["powershell"]

RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
    Install-WindowsFeature Web-Asp-Net45

COPY . ewims
RUN Remove-WebSite -Name 'Default Web Site'
RUN New-Website -Name 'sample' -Port 80 \
    -PhysicalPath 'c:\sample' -ApplicationPool '.NET v4.5'
EXPOSE 80

Manifest YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: samplecloudpoc-v1
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  selector:
    matchLabels:
      app: samplecloudpoc-v1
  template:
    metadata:
      labels:
        app: samplecloudpoc-v1
    spec:
      containers:
      - name: samplecloudpoc-v1
        image: samplecloud.azurecr.io/sample:v1
        ports:
        - containerPort: 80
        resources:
          requests:
            cpu: 100m
          limits:
            cpu: 100m
        env:
        - name: dev
          value: "samplecloudpoc-v1"
      imagePullSecrets:
        - name: sampleauth
      nodeSelector:
        beta.kubernetes.io/os: windows
---
apiVersion: v1
kind: Service
metadata:
  name: samplecloudpoc-v1
spec:
  loadBalancerIP: 13.90.205.141
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: samplecloudpoc-v1

While checking the deployement status using below command, I'm getting the following error.

D:\Cloud>kubectl describe po samplecloudpoc-v1-5d567d48d9-7gtx8
Name:               samplecloudpoc-v1-5d567d48d9-7gtx8
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               akssample000000/10.240.0.35
Start Time:         Thu, 30 May 2019 13:05:13 +0530
Labels:             app=samplecloudpoc-v1
                    pod-template-hash=5d567d48d9
Annotations:        <none>
Status:             Running
IP:                 10.240.0.44
Controlled By:      ReplicaSet/samplecloudpoc-v1-5d567d48d9
Containers:
  sample:
    Container ID:  docker://0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112
    Image:         samplecloud.azurecr.io/sample:v1
    Image ID:      docker-pullable://samplecloud.azurecr.io/sample@sha256:55ac14dc512abc0f8deebb8b87ee47d51fdfbfd997ce6cee0ab521bd69d42b08
    Port:          80/TCP
    Host Port:     0/TCP
    Args:
      -it
    State:       Waiting
      Reason:    CrashLoopBackOff
    Last State:  Terminated
      Reason:    ContainerCannotRun
      Message:   CreateComputeSystem 0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112: The container operating system does not match the host operating system.
(extra info: {"SystemType":"Container","Name":"0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112","Owner":"docker","VolumePath":"\\\\?\\Volume{f5ff1135-4e83-4baa-961d-f4533dcb6985}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\0cf6c92b15738c2786caca5b989aa2773c9375352cb4f1d95472ff63cc7b5112","Layers":[{"ID":"b3b88c23-310f-5e95-86bc-117e9f6a6184","Path":"C:\\ProgramData\\docker\\windowsfilter\\0cc15446c028e2fe68601b10a1921a809dedb2a981162c4ed90344d2fde58f0e"},{"ID":"fb1ae57e-89dc-502c-996b-75804b972adc","Path":"C:\\ProgramData\\docker\\windowsfilter\\7217ca2e8bbd2c431c9db44050946ec4f8040c42fdd79f7ceae321e48dc5ca0d"},{"ID":"bb5e3864-b1af-51c8-a8e4-63d88749f082","Path":"C:\\ProgramData\\docker\\windowsfilter\\16f07ffe70a600c95bea2e8297c04cbb6af877562c2cc2ac1693267b152d3793"},{"ID":"2fae8c16-582f-5ab1-acfe-0a88980adec3","Path":"C:\\ProgramData\\docker\\windowsfilter\\a325070d766dd4af490b433d75eac6e1d71297961d89011e5798949eae2e7e4a"},{"ID":"dffd6df2-a500-5985-9c9c-1bc03c9efce3","Path":"C:\\ProgramData\\docker\\windowsfilter\\1221f773d66647fd1dc7aad44693f28843c8385612edb520231c1cb754eb2f97"},{"ID":"7e349a26-81b9-554e-aa13-a6e4286de93e","Path":"C:\\ProgramData\\docker\\windowsfilter\\67d6d22eae7f829e590fde792c6b8129aff3d9f9242850fe72e8d167e284a6b7"},{"ID":"8730db1a-385d-5e9a-a4ec-c45525b5fcb3","Path":"C:\\ProgramData\\docker\\windowsfilter\\2a53ed97b10bd4f67e62e8511e8922496651f3d343dd1889425ba1bedca134fa"},{"ID":"d1e23520-6c0b-5909-8e52-bb6961f80876","Path":"C:\\ProgramData\\docker\\windowsfilter\\d3a27083556be1bb7e36997f0eee2b544f6a16eab94797715bc21db99bf42e88"},{"ID":"18d8ab30-09e9-54e3-a991-f48cca651c8d","Path":"C:\\ProgramData\\docker\\windowsfilter\\9b4143f537ff70f6b1e05b2a5e38e3b05dd2a4b2f624822e32bb2b7cd17b7cca"},{"ID":"2acb6fa3-f27c-50cf-9033-eedb06d5bf32","Path":"C:\\ProgramData\\docker\\windowsfilter\\f71b6708cc4045bf9633f971dd4d6eddb1c5ffeda52d38e648c740e0e277b2df"},{"ID":"0dc40cf1-482a-5fed-af35-c5d1902b95ae","Path":"C:\\ProgramData\\docker\\windowsfilter\\100f3380579a77f2fb2c0f997201e34a0dd2c42e4b0d9a39fb850706aa16e474"}],"ProcessorWeight":5000,"HostName":"samplecloudpoc-v1-5d567d48d9-7gtx8","MappedDirectories":[{"HostPath":"c:\\var\\lib\\kubelet\\pods\\75f48f65-82ad-11e9-8e99-a24a72224ed5\\volumes\\kubernetes.io~secret\\default-token-67g2m","ContainerPath":"c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount","ReadOnly":true,"BandwidthMaximum":0,"IOPSMaximum":0,"CreateInUtilityVM":false}],"HvPartition":false,"NetworkSharedContainerName":"d11237887aec604bfbb9b3cd56fca586975e5a92e04dab4d4ba19b1fcc56ed99"})
      Exit Code:    128
      Started:      Thu, 30 May 2019 13:25:00 +0530
      Finished:     Thu, 30 May 2019 13:25:00 +0530
    Ready:          False
    Restart Count:  5
    Limits:
      cpu:  100m
    Requests:
      cpu:  100m
    Environment:
      dev:  samplecloudpoc-v1
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-67g2m (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-67g2m:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-67g2m
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  beta.kubernetes.io/os=windows
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                    From                      Message
  ----     ------     ----                   ----                      -------
  Normal   Scheduled  21m                    default-scheduler         Successfully assigned default/samplecloudpoc-v1-5d567d48d9-7gtx8 to akssample000000
  Normal   Pulling    21m                    kubelet, akssample000000  Pulling image "samplecloud.azurecr.io/sample:v1"
  Normal   Pulled     4m31s                  kubelet, akssample000000  Successfully pulled image "samplecloud.azurecr.io/sample:v1"
  Normal   Created    3m (x5 over 4m31s)     kubelet, akssample000000  Created container sample
  Normal   Pulled     3m (x4 over 4m28s)     kubelet, akssample000000  Container image "samplecloud.azurecr.io/sample:v1" already present on machine
  Warning  Failed     2m59s (x5 over 4m30s)  kubelet, akssample000000  Error: failed to start container "sample": Error response from daemon: CreateComputeSystem sample: The container operating system does not match the host operating system.
(extra info: {"SystemType":"Container","Name":"sample","Owner":"docker","VolumePath":"\\\\?\\Volume{f5ff1135-4e83-4baa-961d-f4533dcb6985}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\sample","Layers":[{"ID":"b3b88c23-310f-5e95-86bc-117e9f6a6184","Path":"C:\\ProgramData\\docker\\windowsfilter\\0cc15446c028e2fe68601b10a1921a809dedb2a981162c4ed90344d2fde58f0e"},{"ID":"fb1ae57e-89dc-502c-996b-75804b972adc","Path":"C:\\ProgramData\\docker\\windowsfilter\\7217ca2e8bbd2c431c9db44050946ec4f8040c42fdd79f7ceae321e48dc5ca0d"},{"ID":"bb5e3864-b1af-51c8-a8e4-63d88749f082","Path":"C:\\ProgramData\\docker\\windowsfilter\\16f07ffe70a600c95bea2e8297c04cbb6af877562c2cc2ac1693267b152d3793"},{"ID":"2fae8c16-582f-5ab1-acfe-0a88980adec3","Path":"C:\\ProgramData\\docker\\windowsfilter\\a325070d766dd4af490b433d75eac6e1d71297961d89011e5798949eae2e7e4a"},{"ID":"dffd6df2-a500-5985-9c9c-1bc03c9efce3","Path":"C:\\ProgramData\\docker\\windowsfilter\\1221f773d66647fd1dc7aad44693f28843c8385612edb520231c1cb754eb2f97"},{"ID":"7e349a26-81b9-554e-aa13-a6e4286de93e","Path":"C:\\ProgramData\\docker\\windowsfilter\\67d6d22eae7f829e590fde792c6b8129aff3d9f9242850fe72e8d167e284a6b7"},{"ID":"8730db1a-385d-5e9a-a4ec-c45525b5fcb3","Path":"C:\\ProgramData\\docker\\windowsfilter\\2a53ed97b10bd4f67e62e8511e8922496651f3d343dd1889425ba1bedca134fa"},{"ID":"d1e23520-6c0b-5909-8e52-bb6961f80876","Path":"C:\\ProgramData\\docker\\windowsfilter\\d3a27083556be1bb7e36997f0eee2b544f6a16eab94797715bc21db99bf42e88"},{"ID":"18d8ab30-09e9-54e3-a991-f48cca651c8d","Path":"C:\\ProgramData\\docker\\windowsfilter\\9b4143f537ff70f6b1e05b2a5e38e3b05dd2a4b2f624822e32bb2b7cd17b7cca"},{"ID":"2acb6fa3-f27c-50cf-9033-eedb06d5bf32","Path":"C:\\ProgramData\\docker\\windowsfilter\\f71b6708cc4045bf9633f971dd4d6eddb1c5ffeda52d38e648c740e0e277b2df"},{"ID":"0dc40cf1-482a-5fed-af35-c5d1902b95ae","Path":"C:\\ProgramData\\docker\\windowsfilter\\100f3380579a77f2fb2c0f997201e34a0dd2c42e4b0d9a39fb850706aa16e474"}],"ProcessorWeight":5000,"HostName":"samplecloudpoc-v1-5d567d48d9-7gtx8","MappedDirectories":[{"HostPath":"c:\\var\\lib\\kubelet\\pods\\75f48f65-82ad-11e9-8e99-a24a72224ed5\\volumes\\kubernetes.io~secret\\default-token-67g2m","ContainerPath":"c:\\var\\run\\secrets\\kubernetes.io\\serviceaccount","ReadOnly":true,"BandwidthMaximum":0,"IOPSMaximum":0,"CreateInUtilityVM":false}],"HvPartition":false,"NetworkSharedContainerName":"d11237887aec604bfbb9b3cd56fca586975e5a92e04dab4d4ba19b1fcc56ed99"})
  Warning  BackOff  119s (x10 over 3m59s)  kubelet, akssample000000  Back-off restarting failed container

I have tried to fix this by pulling the latest version IIS image from docker also throws the same error.


来源: stackexchange

问:
How to get a value from the last inserted row using Codeigniter
Is there any codeigniter function to do this?</p>

答:
You can get inserted data by below code,

```<code>$query = $this->db->get_where('table1', array('id' => $id)); //get inserted data
return $query->result_array();
</code>```

Refer:https://www.codeigniter.com/user_guide/database/query_builder.html

ContentLicense: CC BY-SA 3.0

Body:
You can get inserted data by below code,

$query = $this->db->get_where('table1', array('id' => $id)); //get inserted data
return $query->result_array();

Refer:https://www.codeigniter.com/user_guide/database/query_builder.html

ContentLicense: CC BY-SA 4.0


问:
Make page public, then hide page from public based on settings. How?
I have user profiles on my site. Users can make it public by checking a checkbox (search able via a search engine) and uncheck the box to block the page from being searched on a search engine. Site is in php codeignitor.

How is this accomplished? I am esp lost on when the user unchecks the box to block the page from being public how is that done and how to do this in as real time as possible? A good example are the profiles on fb or linkedin.

答:
This isn't secure, but you could check the referring URL of the visitors and allow/deny their requests by looking for a search engine's address. The results would still show up in Google, and there would be page caching (which you can kinda stop with a <meta> tag).

Basically, warn the users that when they make the page public, it's not that easy to make it private after that. I'd make it a tedious and painful process, as people will complain that "your site is brokeded".


问:
symfony redirect from one domain to another
I got a Symfony 4.2 site that serves content on two sub domains:

a.example.com

b.example.com

How can I redirect requests made for /resetting/reset/ on a to b, while keeping the query string?

I tried the below but it's not doing anything - ie when I hit a.example.com/resetting/reset it just stays there. No errors.

```<code>resetting:
    host: ^%a_domain%$
    path: ^/resetting/reset/
    controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
    defaults:
        path: '%b_domain%/resetting/reset/'
        permanent: true
        keepQueryParams: true
</code>```

Any ideas would be appreciated!

答:
I couldn't get the yaml approach to work so instead I overwrote the route with a custom redirect action as follows:

```<code>/**
 * @Route("/resetting/reset/{token}",
 *     name="fos_user_resetting_reset_override",
 *     host="{domain}",
 *     defaults={"domain"="%a_domain%"},
 *     requirements={"domain"="(%a_domain%)"},
 * )
 */
public function redirectResettingRouteToBDomain(string $token): RedirectResponse
{
    // generate the current url with an absolute path
    $path = $this->generateUrl(
        'fos_user_resetting_reset',
        ['token' => $token],
        UrlGeneratorInterface::ABSOLUTE_PATH
    );

    // replace A_DOMAIN with B_DOMAIN in the path
    $domain = preg_replace(
        '/' . preg_quote(getenv('A_DOMAIN'), '/') . '/',
        getenv('B_DOMAIN'),
        $this->getRequest()->server->get('HTTP_HOST')
    );

    // ensure the redirect works on http and https
    $url = '//' . $domain . $path;

    return $this->redirect($url);
}
</code>```

Note that I set up env vars for A_DOMAIN and B_DOMAIN and then made these available as a_domain and b_domain parameters.

Essentially, the controller action above only triggers on A_DOMAIN, overriding the default fos_user_resetting_reset route for B_DOMAIN, and then redirects the request.

Body:
I got a Symfony 4.2 site that serves content on two sub domains:

a.example.com

b.example.com

How can I redirect requests made for /resetting/reset/ on a to b, while keeping the query string?

I tried the below but it's not doing anything - ie when I hit a.example.com/resetting/reset it just stays there. No errors.

resetting:
    host: ^%a_domain%$
    path: ^/resetting/reset/
    controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
    defaults:
        path: '%b_domain%/resetting/reset/'
        permanent: true
        keepQueryParams: true

Any ideas would be appreciated!

Body:
I couldn't get the yaml approach to work so instead I overwrote the route with a custom redirect action as follows:

/**
 * @Route("/resetting/reset/{token}",
 *     name="fos_user_resetting_reset_override",
 *     host="{domain}",
 *     defaults={"domain"="%a_domain%"},
 *     requirements={"domain"="(%a_domain%)"},
 * )
 */
public function redirectResettingRouteToBDomain(string $token): RedirectResponse
{
    // generate the current url with an absolute path
    $path = $this->generateUrl(
        'fos_user_resetting_reset',
        ['token' => $token],
        UrlGeneratorInterface::ABSOLUTE_PATH
    );

    // replace A_DOMAIN with B_DOMAIN in the path
    $domain = preg_replace(
        '/' . preg_quote(getenv('A_DOMAIN'), '/') . '/',
        getenv('B_DOMAIN'),
        $this->getRequest()->server->get('HTTP_HOST')
    );

    // ensure the redirect works on http and https
    $url = '//' . $domain . $path;

    return $this->redirect($url);
}

Note that I set up env vars for A_DOMAIN and B_DOMAIN and then made these available as a_domain and b_domain parameters.

Essentially, the controller action above only triggers on A_DOMAIN, overriding the default fos_user_resetting_reset route for B_DOMAIN, and then redirects the request.


问:
Unity editor frame drops on Mac
I'm trying to use Unity in a Mac but the editor drops frames all the time. It shows it's rendering 330 fps but still feels laggy and dropping frames, also enemy movement is weird (I think it´s because it's dropping frames). This doesn't happen on windows (I tried both platforms). Before I used metal, and it rendered 35 - 45 fps dropping frames too. When I switched to OpenGL it went up to 330fps. I think the problem is not performance, but incompatibility of some kind. When I play the game built for Mac it works well.

Any idea of what could it be?

Statistics using OpenGL:

Statistics using Metal:

答:
Make sure metal is enabled in the editor (not just when you export the game).
https://docs.unity3d.com/Manual/Metal.html

in old unity version metal was not enabled by default on mac and you had to use -force-gfx-metal and start the editor with terminal command line.

If it still not working I'm not sure what you can try... maybe try also to change your screen res.
Remember that Unity editor always use more resource, if the game is working fine when you export the game you can ignore the problem.

Title: Unity editor frame drops on Mac


问:
Hawtio executable jar always "Failed to log in, Forbidden"
I'm trying to put hawtio-1.4.11 to work, but failing. I'm using the simplest configuration.
In the same host, activemq-5.9.0 (clean, no configs), and I just run java -jar hawtio-app-1.4.11.jar.
I've tested the logins to activemq (both old console and hawtio) and it was working ok.
Then I accessed hawtio

```<code>http://my_ip_address:8080/hawtio
</code>```

and filled the form, and I was redirected to the login page. Then when I click login, I get "Failed to log in, Forbidden".

Could not see any log messages the give me a hint.

Thanks in advance for any help.

Update:

I did the fowlling test:

```<code>wget --user admin --password admin --auth-no-challenge http://localhost:8161/hawtio/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost/TotalConsumerCount
</code>```

And it worked (HTTP 200), and using a wrong password (HTTP 403). It seems to be working as it supposed to, but still can not make hawtio standalone to connect.

When I try to login using hawtio, the only log messages are those (regardless if I used the correct password or not):

```<code>2014-07-17 19:08:47,342 | DEBUG | Handling request for path /auth/login | io.hawt.web.AuthenticationFilter | qtp962581073-40
2014-07-17 19:08:47,342 | DEBUG | Doing authentication and authorization for path /auth/login | io.hawt.web.AuthenticationFilter | qtp962581073-40
</code>```

BTW, I've tried a lot of different setups, including war version in jboss-4.2.3 but all failed too.

答:
I was able to login to activemq console, but not in hawtio.

In my case I found that:

activemq console credetial are read from conf/jetty-realm.properties

hawtio credential are read from conf/users.properties and conf/groups.properties

In users.properties the password cannot contains same characters, in my case the euro sign €

Body:
I'm trying to put hawtio-1.4.11 to work, but failing. I'm using the simplest configuration.
In the same host, activemq-5.9.0 (clean, no configs), and I just run java -jar hawtio-app-1.4.11.jar.
I've tested the logins to activemq (both old console and hawtio) and it was working ok.
Then I accessed hawtio

http://my_ip_address:8080/hawtio

and filled the form, and I was redirected to the login page. Then when I click login, I get "Failed to log in, Forbidden".

Could not see any log messages the give me a hint.

Thanks in advance for any help.

Update:

I did the fowlling test:

wget --user admin --password admin --auth-no-challenge http://localhost:8161/hawtio/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost/TotalConsumerCount

And it worked (HTTP 200), and using a wrong password (HTTP 403). It seems to be working as it supposed to, but still can not make hawtio standalone to connect.

When I try to login using hawtio, the only log messages are those (regardless if I used the correct password or not):

2014-07-17 19:08:47,342 | DEBUG | Handling request for path /auth/login | io.hawt.web.AuthenticationFilter | qtp962581073-40
2014-07-17 19:08:47,342 | DEBUG | Doing authentication and authorization for path /auth/login | io.hawt.web.AuthenticationFilter | qtp962581073-40

BTW, I've tried a lot of different setups, including war version in jboss-4.2.3 but all failed too.


问:
Embed all video in universal HTML5 video player
I search a system to embed all media in universal video player as :

Twitter videos

Facebook videos

Youtube videos

Vimeo videos

etc...

Have you got an idea to embed this in PHP or HTML5?

答:
Youtube, Fb or Vimeo doesn't let you push them in other players than its own, but this embeds video from a url in its native player. Haven't studied twitter videos, but you can extend my script. (The function getvidinfo also gets thumbnails, but i didn't find how to get one from fb).

```<code><?
function getYoutubeIdFromUrl($url) {
    $parts = parse_url($url);
    if(($parts["host"]=="m.youtube.com" || $parts["host"]=="youtube.com" || $parts["host"]=="www.youtube.com" || $parts["host"]=="youtu.be" || $parts["host"]=="www.youtu.be") && !strstr($url,"/c/") && !strstr($url,"/channel/") && !strstr($url,"/user/")){
    if(isset($parts['query'])){
        parse_str($parts['query'], $qs);
        if(isset($qs['v'])){
            return $qs['v'];
        }else if(isset($qs['vi'])){
            return $qs['vi'];
        }
    }
    if(($parts["host"]=="youtu.be" || $parts["host"]=="www.youtu.be") && isset($parts['path'])){
        $path = explode('/', trim($parts['path'], '/'));
        return $path[count($path)-1];
    }
    }
    if(strlen($url)==11 && (!strstr($url, "http://") && !strstr($url, "https://") && !strstr($url, "www.") && !strstr($url, "youtube") && !strstr($url, "www.") && !strstr($url, "youtu.be"))) return $url;
    return false;
}

function validateFbVideoUrl($url){
    $parts = parse_url($url);
    if(($parts["host"]=="facebook.com" || $parts["host"]=="www.facebook.com" || $parts["host"]=="fb.me" || $parts["host"]=="fb.com") && !strstr($url,"/pg/")){
        return $url;
    }
    return false;
}

function getVimeoId($url){
    $parts = parse_url($url);
    if($parts['host'] == 'www.vimeo.com' || $parts['host'] == 'vimeo.com'){
        $vidid=substr($parts['path'], 1);
        return $vidid;
    }
    return false;
}

function getvidinfo($url){
     $getYT=getYoutubeIdFromUrl($url);
     if($getYT){
        $result["type"]="yt";
        $result["string"]=$getYT;
        $result["img"]="https://img.youtube.com/vi/".$getYT."/mqdefault.jpg";
        return($result);
     }else{
         //fb video
         $getFB=validateFbVideoUrl($url);
         if($getFB){
            $result["type"]="fb";
            $result["string"]=$getFB;
            $result["img"]="example.com/your-image-here.jpg";// I DIDN'T FIND A WAY TO GET FB VIDEO THUMBNAIL
            return($result);
         }else{
             $vimeoid=getVimeoId($url);
             if($vimeoid){
                $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$vimeoid.php"));
                $result["type"]="vim";
                $result["string"]=$vimeoid;
                $result["img"]=$hash[0]["thumbnail_large"];
                return($result);
             }
         }
    }
    return false;
}

function echovideo($url){
    if($url){
        $vidinfo=getvidinfo($url);
        if($vidinfo){
            if($vidinfo["type"]=="yt"){
            ?><div>
                <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/<?echo $vidinfo["string"]?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
                <?
            }elseif($vidinfo["type"]=="fb"){
                ?>
                <div>
                 <iframe src="https://www.facebook.com/plugins/video.php?href=<? echo $vidinfo["string"]; ?>&show_text=0&width=560&height=315" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe></div>
                 <?
            }elseif($vidinfo["type"]=="vim"){
                ?><div><iframe src="https://player.vimeo.com/video/<?echo $vimeoid;?>" width="560" height="315" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div>
                <?
            }
        }
    }
}
?>
</code>```

Simple usage:

```<code>echovideo("https://www.youtube.com/watch?v=VRuL3_5rFnU");
</code>```

Body:
Youtube, Fb or Vimeo doesn't let you push them in other players than its own, but this embeds video from a url in its native player. Haven't studied twitter videos, but you can extend my script. (The function getvidinfo also gets thumbnails, but i didn't find how to get one from fb).

<?
function getYoutubeIdFromUrl($url) {
    $parts = parse_url($url);
    if(($parts["host"]=="m.youtube.com" || $parts["host"]=="youtube.com" || $parts["host"]=="www.youtube.com" || $parts["host"]=="youtu.be" || $parts["host"]=="www.youtu.be") && !strstr($url,"/c/") && !strstr($url,"/channel/") && !strstr($url,"/user/")){
    if(isset($parts['query'])){
        parse_str($parts['query'], $qs);
        if(isset($qs['v'])){
            return $qs['v'];
        }else if(isset($qs['vi'])){
            return $qs['vi'];
        }
    }
    if(($parts["host"]=="youtu.be" || $parts["host"]=="www.youtu.be") && isset($parts['path'])){
        $path = explode('/', trim($parts['path'], '/'));
        return $path[count($path)-1];
    }
    }
    if(strlen($url)==11 && (!strstr($url, "http://") && !strstr($url, "https://") && !strstr($url, "www.") && !strstr($url, "youtube") && !strstr($url, "www.") && !strstr($url, "youtu.be"))) return $url;
    return false;
}

function validateFbVideoUrl($url){
    $parts = parse_url($url);
    if(($parts["host"]=="facebook.com" || $parts["host"]=="www.facebook.com" || $parts["host"]=="fb.me" || $parts["host"]=="fb.com") && !strstr($url,"/pg/")){
        return $url;
    }
    return false;
}

function getVimeoId($url){
    $parts = parse_url($url);
    if($parts['host'] == 'www.vimeo.com' || $parts['host'] == 'vimeo.com'){
        $vidid=substr($parts['path'], 1);
        return $vidid;
    }
    return false;
}

function getvidinfo($url){
     $getYT=getYoutubeIdFromUrl($url);
     if($getYT){
        $result["type"]="yt";
        $result["string"]=$getYT;
        $result["img"]="https://img.youtube.com/vi/".$getYT."/mqdefault.jpg";
        return($result);
     }else{
         //fb video
         $getFB=validateFbVideoUrl($url);
         if($getFB){
            $result["type"]="fb";
            $result["string"]=$getFB;
            $result["img"]="example.com/your-image-here.jpg";// I DIDN'T FIND A WAY TO GET FB VIDEO THUMBNAIL
            return($result);
         }else{
             $vimeoid=getVimeoId($url);
             if($vimeoid){
                $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$vimeoid.php"));
                $result["type"]="vim";
                $result["string"]=$vimeoid;
                $result["img"]=$hash[0]["thumbnail_large"];
                return($result);
             }
         }
    }
    return false;
}

function echovideo($url){
    if($url){
        $vidinfo=getvidinfo($url);
        if($vidinfo){
            if($vidinfo["type"]=="yt"){
            ?><div>
                <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/<?echo $vidinfo["string"]?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
                <?
            }elseif($vidinfo["type"]=="fb"){
                ?>
                <div>
                 <iframe src="https://www.facebook.com/plugins/video.php?href=<? echo $vidinfo["string"]; ?>&show_text=0&width=560&height=315" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe></div>
                 <?
            }elseif($vidinfo["type"]=="vim"){
                ?><div><iframe src="https://player.vimeo.com/video/<?echo $vimeoid;?>" width="560" height="315" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div>
                <?
            }
        }
    }
}
?>

Simple usage:

echovideo("https://www.youtube.com/watch?v=VRuL3_5rFnU");


问:
Need to run a stored procedure on all non system databases
I'm trying to loop through all non system databases and run a stored procedure. This stored procedure exists in all of the user databases.

This is what I have found so far:

```<code>DECLARE @command varchar(1000)
SELECT @command = 'USE ? SELECT name FROM sysobjects WHERE xtype = ''U'' ORDER BY name'

USE @command;
GO

EXECUTE Support.CleanIndiciesAndShrinkDatabase;
GO
</code>```

I get an error this error:

Msg 102, Level 15, State 1, Line 3

  Incorrect syntax near '@command'.

Msg 2812, Level 16, State 62, Line 1

  Could not find stored procedure 'Support.CleanIndiciesAndShrinkDatabase'.

Any suggestions on fixing this?

答:
Try the following

```<code>
DECLARE @command varchar(1000)
DECLARE @spName VARCHAR(50)
SET @spName = 'Support.CleanIndiciesAndShrinkDatabase'

SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'')
BEGIN
    USE ?
        IF EXISTS(SELECT TOP 1 1 FROM sys.procedures AS P WHERE p.name = ''' + @spName + ''')
        BEGIN
            PRINT ''running '+ @spName + ' on '' + DB_NAME()
            EXEC ' +@spName+'
        END
        ELSE
        BEGIN
            PRINT ''' + @spName + ' was on found on database '' + DB_NAME()''
        END

END '

EXEC sp_MSforeachdb @command

</code>```

It will run on all non-system databases.
Now, the error you get means that SQL Server cannot find the stored procedure. You could fix this by creating the stored procedure on any database that does not have it yet and then running it.
So a better query would be

```<code>
DECLARE @command varchar(1000)
DECLARE @schemaName VARCHAR(50)
DECLARE @spName VARCHAR(50)
SET @schemaName  = 'Support'
SET @spName = 'CleanIndiciesAndShrinkDatabase'

SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'')
BEGIN
    USE ?

        IF NOT EXISTS(SELECT TOP 1 1
                        FROM sys.procedures AS P
                            INNER JOIN sys.schemas AS S ON S.schema_id = P.schema_id
                        WHERE p.name = ''' + @spName + '''
                            AND s.name = ''' + @schemaName + ''')
        BEGIN
            PRINT ''creating '+ @spName + ' on '' + DB_NAME()
            IF NOT EXISTS (   SELECT TOP 1 1
                  FROM   sys.schemas AS S
                  WHERE  S.name = ''' + @schemaName + ''' )
                BEGIN
                    PRINT ''CREATING SCHEMA ' + @schemaName + '''
                    EXEC ( '' CREATE SCHEMA ' + @schemaName + ''' );
                END;

                EXEC ( ''
                    CREATE PROCEDURE ' + @schemaName + '.' + @spName + '
                    AS
                    BEGIN
                        -- SP CODE GOES HERE
                        -- SELECT COUNT(*) FROM SYS.TABLES --uncomment this for check
                    END
                '' );
        END

        PRINT ''running '+ @spName + ' on '' + DB_NAME()
        EXEC ' + @schemaName + '.' + @spName +'

END '

EXEC sp_MSforeachdb @command

</code>```

Body:
I'm trying to loop through all non system databases and run a stored procedure. This stored procedure exists in all of the user databases.

This is what I have found so far:

DECLARE @command varchar(1000)
SELECT @command = 'USE ? SELECT name FROM sysobjects WHERE xtype = ''U'' ORDER BY name'

USE @command;
GO

EXECUTE Support.CleanIndiciesAndShrinkDatabase;
GO

I get an error this error:

Msg 102, Level 15, State 1, Line 3

  Incorrect syntax near '@command'.

Msg 2812, Level 16, State 62, Line 1

  Could not find stored procedure 'Support.CleanIndiciesAndShrinkDatabase'.

Any suggestions on fixing this?

Body:
Try the following

DECLARE @command varchar(1000)
DECLARE @spName VARCHAR(50)
SET @spName = 'Support.CleanIndiciesAndShrinkDatabase'

SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'')
BEGIN
    USE ?
        IF EXISTS(SELECT TOP 1 1 FROM sys.procedures AS P WHERE p.name = ''' + @spName + ''')
        BEGIN
            PRINT ''running '+ @spName + ' on '' + DB_NAME()
            EXEC ' +@spName+'
        END
        ELSE
        BEGIN
            PRINT ''' + @spName + ' was on found on database '' + DB_NAME()''
        END

END '

EXEC sp_MSforeachdb @command

It will run on all non-system databases.
Now, the error you get means that SQL Server cannot find the stored procedure. You could fix this by creating the stored procedure on any database that does not have it yet and then running it.
So a better query would be

DECLARE @command varchar(1000)
DECLARE @schemaName VARCHAR(50)
DECLARE @spName VARCHAR(50)
SET @schemaName  = 'Support'
SET @spName = 'CleanIndiciesAndShrinkDatabase'

SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'')
BEGIN
    USE ?

        IF NOT EXISTS(SELECT TOP 1 1
                        FROM sys.procedures AS P
                            INNER JOIN sys.schemas AS S ON S.schema_id = P.schema_id
                        WHERE p.name = ''' + @spName + '''
                            AND s.name = ''' + @schemaName + ''')
        BEGIN
            PRINT ''creating '+ @spName + ' on '' + DB_NAME()
            IF NOT EXISTS (   SELECT TOP 1 1
                  FROM   sys.schemas AS S
                  WHERE  S.name = ''' + @schemaName + ''' )
                BEGIN
                    PRINT ''CREATING SCHEMA ' + @schemaName + '''
                    EXEC ( '' CREATE SCHEMA ' + @schemaName + ''' );
                END;

                EXEC ( ''
                    CREATE PROCEDURE ' + @schemaName + '.' + @spName + '
                    AS
                    BEGIN
                        -- SP CODE GOES HERE
                        -- SELECT COUNT(*) FROM SYS.TABLES --uncomment this for check
                    END
                '' );
        END

        PRINT ''running '+ @spName + ' on '' + DB_NAME()
        EXEC ' + @schemaName + '.' + @spName +'

END '

EXEC sp_MSforeachdb @command


问:
Setting up the emission via script for a particle system
I have a problem with particle emission.
I have a gun that shoots smoke when a button is pressed. I have set up the particle system in a way that it looks ok when its emitting (in the particle system settings) (first picture).

The problem now lies that when I try to emit the particle only by the code it completely changes how the emission looks.

According to the particle effect I have 1500 particles with smoke.emit(30); which is way more than the 1000 set up by the emitter option.

But it appears it just clumps the particles together and just increases the number of particles on the same position as others.

Is there any way I can achieve a similar graphical setting as the emitter shows?

Thank you.

答:
The answer was to use ParticleSystem.Play(); and ParticleSystem.Stop();

Seems like it acts differently if you use the above function instead of ParticleSystem.emit(1);


问:
How to get data from mongodb to put in an option?
I am creating a dashboard table for displaying the saved data in mongoDB. I already have a table and display all the data in the table, now what I want to achieve is to create a select element above the database table the select element should contains all the available dates from mongodb. For example I have 20 same dates of 05/25/2019 and 10 same dates of 05/26/2019 and 30 same dates of 05/29/2019 I want to display only three options which the dates said above in the select element. and if another dates is added in the database that should also be displayed on the option too.

I tried doing on the same thing that I did on the table to my select options but of course like the data in the table it display all the same date so I had like 60 options where 30 were same dates of  05/29/2019 and 10 were same dates of 05/26/2019 and 20 were the same dates of 05/25/2019

this is my index.js

```<code>var express = require("express"),
app = express(),
bodyparser = require("body-parser"),
mongoose = require("mongoose");
mongoose.connect("mongodb://localhost:27017/sample", {useNewUrlParser: true});
app.use(bodyparser.urlencoded({ extended: true }));
app.set("view engine", "ejs");
app.use('/views', express.static('views'));

var nameSchema = new mongoose.Schema({
  route : String,
  origin : String,
  destination : String,
  estimatedTimeOfArrival : String,
  date : String,
  time : String
},{
    collection : 'log'
})

  var User = mongoose.model("User", nameSchema);

app.get("/", function (req, res) {
res.render("index",{ details: null })
})

app.get("/getdetails", function (req, res) {
    User.find({}, function (err, allDetails) {
    if (err) {
        console.log(err);
    } else {
        res.render("index", { details: allDetails })
    }
});
});

app.listen(1412, "localhost", function () {
console.log("server has started at " + 1412);
})
</code>```

this is my index.ejs

```<code><div  class="tableFixHead">
                            <% if(details!=null) { %>
                        <table  id="myTable" >
                            <thead>
                                <tr class="header" style=" color: white !important;font-weight:bold;">
                                    <th scope="col">Route</th>
                                    <th scope="col">Origin </th>
                                    <th scope="col">Destination</th>
                                    <th scope="col">Estimated Time of Arrival </th>
                                    <th scope="col">Date </th>
                                    <th scope="col">Time</th>
                                </tr>
                            </thead>
                            <% details.forEach(function(item){ %>
                            <tbody id="myTable" style="color:black;">
                                <tr>
                                    <td><%= item.route%></td>
                                    <td><%= item.origin %></td>
                                    <td><%= item.destination%></td>
                                    <td><%= item.estimatedTimeOfArrival %></td>
                                    <td><%= item.date%></td>
                                    <td><%= item.time%></td>
                                </tr>
                            </tbody>
                            <% }) %>
                        </table>
                        <% } %>
                    </div>
</code>```

and a sample html data https://jsfiddle.net/indefinite/3yzvemcg/2/

The dates are coming from a web app. so after the user submit the form from the app it will saved in my mongoDB and right now I have many data in database and many are sent on the same dates and what I want to achieve is to get the all the dates saved in the database and if the some dates are the same it will only display as one and  option will be added if the dates were added too in the database. I'm really new at this so thank you in advanced.

答:
If I understand well your problem, you want to find all distinct dates from your User model. Maybe your solution is the distinct mongoose option.

Try this in your index.js:

```<code>User.find().distinct('date', function(err, dates) {
    // dates are an array of all distinct dates.
    if (err) {
        console.log(err);
    } else {
        res.render("index", { dates: dates })
    }
});
</code>```

And in your ejs file add this.

```<code>// display select only when 'dates' array is defined.
<% if (locals.dates) { %>
    <select name="date" id="dates">
    <% dates.forEach(function(date){ %>
        <option><%= date %></option>
    <% }) %>
    </select>
<% } %>
</code>```

Body:
I am creating a dashboard table for displaying the saved data in mongoDB. I already have a table and display all the data in the table, now what I want to achieve is to create a select element above the database table the select element should contains all the available dates from mongodb. For example I have 20 same dates of 05/25/2019 and 10 same dates of 05/26/2019 and 30 same dates of 05/29/2019 I want to display only three options which the dates said above in the select element. and if another dates is added in the database that should also be displayed on the option too.

I tried doing on the same thing that I did on the table to my select options but of course like the data in the table it display all the same date so I had like 60 options where 30 were same dates of  05/29/2019 and 10 were same dates of 05/26/2019 and 20 were the same dates of 05/25/2019

this is my index.js

var express = require("express"),
app = express(),
bodyparser = require("body-parser"),
mongoose = require("mongoose");
mongoose.connect("mongodb://localhost:27017/sample", {useNewUrlParser: true});
app.use(bodyparser.urlencoded({ extended: true }));
app.set("view engine", "ejs");
app.use('/views', express.static('views'));

var nameSchema = new mongoose.Schema({
  route : String,
  origin : String,
  destination : String,
  estimatedTimeOfArrival : String,
  date : String,
  time : String
},{
    collection : 'log'
})

  var User = mongoose.model("User", nameSchema);

app.get("/", function (req, res) {
res.render("index",{ details: null })
})

app.get("/getdetails", function (req, res) {
    User.find({}, function (err, allDetails) {
    if (err) {
        console.log(err);
    } else {
        res.render("index", { details: allDetails })
    }
});
});

app.listen(1412, "localhost", function () {
console.log("server has started at " + 1412);
})

this is my index.ejs

                            <% if(details!=null) { %>

                                    Route
                                    Origin
                                    Destination
                                    Estimated Time of Arrival
                                    Date
                                    Time

                            <% details.forEach(function(item){ %>

                                    <%= item.route%>
                                    <%= item.origin %>
                                    <%= item.destination%>
                                    <%= item.estimatedTimeOfArrival %>
                                    <%= item.date%>
                                    <%= item.time%>

                            <% }) %>

                        <% } %>

and a sample html data https://jsfiddle.net/indefinite/3yzvemcg/2/

The dates are coming from a web app. so after the user submit the form from the app it will saved in my mongoDB and right now I have many data in database and many are sent on the same dates and what I want to achieve is to get the all the dates saved in the database and if the some dates are the same it will only display as one and  option will be added if the dates were added too in the database. I'm really new at this so thank you in advanced.

Body:
If I understand well your problem, you want to find all distinct dates from your User model. Maybe your solution is the distinct mongoose option.

Try this in your index.js:

User.find().distinct('date', function(err, dates) {
    // dates are an array of all distinct dates.
    if (err) {
        console.log(err);
    } else {
        res.render("index", { dates: dates })
    }
});

And in your ejs file add this.

// display select only when 'dates' array is defined.
<% if (locals.dates) { %>
    <select name="date" id="dates">
    <% dates.forEach(function(date){ %>
        <option><%= date %></option>
    <% }) %>
    </select>
<% } %>


问:
Can't create D3D11 SwapChain in DLL
I'm currently trying to create an application which stops rendering of a game and takes screenshots of a Dx11 game every few seconds.

My approach for this is to create a basic SwapChain and then search the memory for something that has the same vTable as that one.

Now my problem is I'm completely stuck on the SwapChain creation. It results in an DXGI_ERROR_INVALID_CALL every time and I can't figure out what parameter is wrong.

This is my code. I use VS2017 with x86 settings and nothing additional.

```<code>#include <Windows.h>
#include <iostream>

#include <d3d11.h>
#pragma comment(lib, "d3d11.lib")

bool CreateSwapChain() {

    // Gets handle of game
    HWND window = FindWindow(NULL, L"WARFRAME");
    if (window == NULL) return false;

    DXGI_SWAP_CHAIN_DESC swap_desc;
    memset(&swap_desc, 0, sizeof(struct DXGI_SWAP_CHAIN_DESC));
    swap_desc.BufferDesc.Width = NULL;  // Output window width
    swap_desc.BufferDesc.Height = NULL; // Output window height
    swap_desc.BufferDesc.Format = DXGI_FORMAT_UNKNOWN;  // No idea what the right value is here
    swap_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;   // No specific scanline method
    swap_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;   // Seems to be the best option
    swap_desc.SampleDesc.Count = 1;     // Multisampling count (default)
    swap_desc.SampleDesc.Quality = 0;   // Multisampling quality (default
    swap_desc.BufferUsage = DXGI_USAGE_READ_ONLY;   // Dont need anything to do with the window
    swap_desc.BufferCount = 1;                      // Only one (the window)
    swap_desc.OutputWindow = window;    // Output window
    swap_desc.Windowed = TRUE;          // Game is windowed
    swap_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;    // Discard backbuffer after Present call
    swap_desc.Flags = NULL;

    D3D_FEATURE_LEVEL feature_level[1];
    feature_level[0] = D3D_FEATURE_LEVEL_11_0;

    IDXGISwapChain** swapchain_result = nullptr;

    HRESULT swapchain = D3D11CreateDeviceAndSwapChain(
        NULL,                       // Adapter. NULL because default adapter
        D3D_DRIVER_TYPE_HARDWARE,   // Driver. Hardware because it provides the best performance
        NULL,                       // Software. NULL because driver is not software
        NULL,                       // Flags. No Flags because none are needed
        feature_level,              // Feature level. Features supported by Direct3D 11.0
        1,                          // Number of feature levels
        D3D11_SDK_VERSION,          // SDK Version. Default
        &swap_desc,                 // Swapchain description defined above
        swapchain_result,           // Swapchain output
        NULL,                       // Return feature level
        NULL,                       // Discard feature level result
        NULL                        // Discard device context result
    );

    std::cout << "Swapchain result: " << std::hex << swapchain << std::endl;
    std::cout << "Swapchain pointer: " << std::hex << swapchain_result << std::endl;

    return true;
}

FILE* pCout;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdReason, LPVOID lpvReserved) {

    if (fwdReason == DLL_PROCESS_ATTACH) {
        AllocConsole();
        freopen_s(&pCout, "CONOUT$", "w", stdout);
        std::cout << "DLL attached" << std::endl;

        // Create swapchain
        std::cout << "Swapchain function result: " << CreateSwapChain() << std::endl;
    }

    else if (fwdReason == DLL_PROCESS_DETACH) {

    }

    return true;
}
</code>```

答:
Have a look at this link.

https://learn.microsoft.com/zh-cn/windows/desktop/direct3ddxgi/d3d10-graphics-programming-guide-dxgi#dxgi-responses-from-dllmain

Because a DllMain function can't guarantee the order in which it loads and unloads DLLs, we recommend that your app's DllMain function not call Direct3D or DXGI functions or methods, including functions or methods that create or release objects.

Running function CreateSwapChain in a new thread may solve the problem.

Title: Can't create D3D11 SwapChain in DLL

Body:
I'm currently trying to create an application which stops rendering of a game and takes screenshots of a Dx11 game every few seconds.

My approach for this is to create a basic SwapChain and then search the memory for something that has the same vTable as that one.

Now my problem is I'm completely stuck on the SwapChain creation. It results in an DXGI_ERROR_INVALID_CALL every time and I can't figure out what parameter is wrong.

This is my code. I use VS2017 with x86 settings and nothing additional.

#include <Windows.h>
#include <iostream>

#include <d3d11.h>
#pragma comment(lib, "d3d11.lib")

bool CreateSwapChain() {

    // Gets handle of game
    HWND window = FindWindow(NULL, L"WARFRAME");
    if (window == NULL) return false;

    DXGI_SWAP_CHAIN_DESC swap_desc;
    memset(&swap_desc, 0, sizeof(struct DXGI_SWAP_CHAIN_DESC));
    swap_desc.BufferDesc.Width = NULL;  // Output window width
    swap_desc.BufferDesc.Height = NULL; // Output window height
    swap_desc.BufferDesc.Format = DXGI_FORMAT_UNKNOWN;  // No idea what the right value is here
    swap_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;   // No specific scanline method
    swap_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;   // Seems to be the best option
    swap_desc.SampleDesc.Count = 1;     // Multisampling count (default)
    swap_desc.SampleDesc.Quality = 0;   // Multisampling quality (default
    swap_desc.BufferUsage = DXGI_USAGE_READ_ONLY;   // Dont need anything to do with the window
    swap_desc.BufferCount = 1;                      // Only one (the window)
    swap_desc.OutputWindow = window;    // Output window
    swap_desc.Windowed = TRUE;          // Game is windowed
    swap_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;    // Discard backbuffer after Present call
    swap_desc.Flags = NULL;

    D3D_FEATURE_LEVEL feature_level[1];
    feature_level[0] = D3D_FEATURE_LEVEL_11_0;

    IDXGISwapChain** swapchain_result = nullptr;

    HRESULT swapchain = D3D11CreateDeviceAndSwapChain(
        NULL,                       // Adapter. NULL because default adapter
        D3D_DRIVER_TYPE_HARDWARE,   // Driver. Hardware because it provides the best performance
        NULL,                       // Software. NULL because driver is not software
        NULL,                       // Flags. No Flags because none are needed
        feature_level,              // Feature level. Features supported by Direct3D 11.0
        1,                          // Number of feature levels
        D3D11_SDK_VERSION,          // SDK Version. Default
        &swap_desc,                 // Swapchain description defined above
        swapchain_result,           // Swapchain output
        NULL,                       // Return feature level
        NULL,                       // Discard feature level result
        NULL                        // Discard device context result
    );

    std::cout << "Swapchain result: " << std::hex << swapchain << std::endl;
    std::cout << "Swapchain pointer: " << std::hex << swapchain_result << std::endl;

    return true;
}

FILE* pCout;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdReason, LPVOID lpvReserved) {

    if (fwdReason == DLL_PROCESS_ATTACH) {
        AllocConsole();
        freopen_s(&pCout, "CONOUT$", "w", stdout);
        std::cout << "DLL attached" << std::endl;

        // Create swapchain
        std::cout << "Swapchain function result: " << CreateSwapChain() << std::endl;
    }

    else if (fwdReason == DLL_PROCESS_DETACH) {

    }

    return true;
}


问:
Custom PropertyPlaceholderConfigurer not resolving
Hi I am new to Spring Boot (but have been using Spring in my apps for a while). I am trying to use a custom SSM PropertyPlaceholderConfigurer, based on my SSM Client, that reads my properties from AWS SSM, in addition to properties in my normal application.properties.
This code works fine in my pre-spring-boot application. However, in the new application, I see that it overrides the application.properties. And this seems to be a well documented problem.

So i decided to include the application.properties file in my custom PropertyPlaceholderConfigurer class and load all the properties together and still it does not resolve any properties in application.properties that are marked with "${}" and resolve by my custom location. What more do i need to do?

As an alternative, I tried to have the properties i need to load from SSM to be loaded via an EnvironmentPostProcessor but it was unable to connect to the AWS SSM server at this point in the loading process (not sure why)

答:
The answer is to use the EnvironmentPostProcessor. Works perfectly. See code below:</p>

```<code>import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;

import java.util.HashMap;
import java.util.Map;

/**
 * This class loads SSM parameters base on region and environment
 * Needs to be added to spring.factories class so that it will be invoked. as follow:
 * org.springframework.boot.env.EnvironmentPostProcessor=<full package>.SSMEnvironmentPostProcessor
 * Add the SSM propeties to other properties already set
 */

public class SSMEnvironmentPostProcessor implements EnvironmentPostProcessor {
    private static final String QUOTE = "\"";

    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
        SSMClient ssmClient = new SSMClient(DefaultAWSCredentialsProviderChain.getInstance(), System.getProperty("env" +
                ".region"), new ClientConfiguration());
        ssmClient.init();
        Map<String, Object> parameters = new HashMap<>();
        ssmClient.getParametersByPath("/" + System.getProperty("env"), true).entrySet().stream()
                .forEach(entry -> parameters.put(entry.getKey(), entry.getValue()));

        MapPropertySource mapPropertySource = new MapPropertySource("ssm", parameters);
        environment.getPropertySources().addLast(mapPropertySource);
    }

}

</code>```

Body:
The answer is to use the EnvironmentPostProcessor. Works perfectly. See code below:

import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;

import java.util.HashMap;
import java.util.Map;

/**
 * This class loads SSM parameters base on region and environment
 * Needs to be added to spring.factories class so that it will be invoked. as follow:
 * org.springframework.boot.env.EnvironmentPostProcessor=<full package>.SSMEnvironmentPostProcessor
 * Add the SSM propeties to other properties already set
 */

public class SSMEnvironmentPostProcessor implements EnvironmentPostProcessor {
    private static final String QUOTE = "\"";

    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
        SSMClient ssmClient = new SSMClient(DefaultAWSCredentialsProviderChain.getInstance(), System.getProperty("env" +
                ".region"), new ClientConfiguration());
        ssmClient.init();
        Map<String, Object> parameters = new HashMap<>();
        ssmClient.getParametersByPath("/" + System.getProperty("env"), true).entrySet().stream()
                .forEach(entry -> parameters.put(entry.getKey(), entry.getValue()));

        MapPropertySource mapPropertySource = new MapPropertySource("ssm", parameters);
        environment.getPropertySources().addLast(mapPropertySource);
    }

}


问:
is there an equivalent to python's request module in Java for working on REST based App
I am looking for an equivalent Java API lib which can do same things as Python's HTTP Requests module.

Key features of the Requests lib:

One-step initialization of an HTTP request returns response object.

The response object contains methods/member-vars to quickly access response status, headers, body/data, and a JSON-parsing method.

答:
Late to the party, but posting for posterity:

After trying Unirest, it didn't feel  like Python Requests and I couldn't make it work for my needs.  My key complaints were cookie/session management were intentionally left out.

https://github.com/hsiafan/requests is working fine for me so far and has session based cookie management implemented transparently.  This one was "inspired by" Python's requests so should be comparable.


问:
Databricks not updating in SQL query
I am trying to replace special characters from a table column using SQL a SQL query. However, I get the following error. Can anyone tell me what I did wrong or how I should approach this?

SQL QUERY

```<code>UPDATE wine SET description = REPLACE(description, '%', '')
</code>```

ERROR

```<code>error in sql statement: analysisexception: update destination only supports delta sources.
</code>```

答:
Databricks only supports updates for delta (delta lake) tables. The error message indicates that you try the update on a non-delta-table. So you would have to convert your data source to delta. For parquet it is very simple:

```<code>CONVERT TO DELTA parquet.`path/to/table` [NO STATISTICS]
[PARTITIONED BY (col_name1 col_type1, col_name2 col_type2, ...)]
</code>```

See the Documentation for more details.

Title: Databricks not updating in SQL query

Body:
I am trying to replace special characters from a table column using SQL a SQL query. However, I get the following error. Can anyone tell me what I did wrong or how I should approach this?

SQL QUERY

UPDATE wine SET description = REPLACE(description, '%', '')

ERROR

error in sql statement: analysisexception: update destination only supports delta sources.

Body:
Databricks only supports updates for delta (delta lake) tables. The error message indicates that you try the update on a non-delta-table. So you would have to convert your data source to delta. For parquet it is very simple:

CONVERT TO DELTA parquet.`path/to/table` [NO STATISTICS]
[PARTITIONED BY (col_name1 col_type1, col_name2 col_type2, ...)]

See the Documentation for more details.


问:
Auth::id() can't find user id and return null, laravel
I am setting like and unlike options on articles. but in LikeController there is problem. when I push the like button it says ->

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id'
  cannot be null (SQL: insert into likes (user_id, article_id,
  updated_at, created_at) values (?, 5, 2019-05-30 07:58:34,
  2019-05-30 07:58:34))

Updated JWT and Routes

Like model:

```<code>class Like extends Model
{
    public $timestamps = true;
    public $with = ["user"];

    protected $fillable = ["user_id", "article_id"];

    public function article()
    {
        return $this->belongsTo("App\Article");
    }

    public function user()
    {
        return $this->belongsTo("App\User");
    }
}
</code>```

and LikeController:

```<code>use Auth;
use App\Article;
use App\Like;

public function like($id)
{
    $article = Article::find($id);

    $like =  Like::create([
        "user_id" => Auth::id(),
        "article_id" => $article->id
    ]);

    return Like::find($like->id);
}

public function unlike($id)
{
    $article = Article::find($id);

    Like::where("user_id", Auth::id())
        ->where("article_id", $article->id)
        ->first()
        ->delete();

    return 1;
}
</code>```

I am not very sure why Auth::id() can't find the user id and return null?

Using JWT with vue.js

Routes:

```<code>Route::group(['prefix' => 'auth'], function ($router) {

  Route::post('register', 'AuthController@register');
  Route::post('login', 'AuthController@login');
  Route::post('logout', 'AuthController@logout');
  Route::post('refresh', 'AuthController@refresh');
  Route::post('me', 'AuthController@me');

});

Route::get("/like/{id}", [
        "uses" => "LikeController@like"
    ]);
Route::get("/unlike/{id}", [
        "uses" => "LikeController@unlike"
    ]);
</code>```

AuthController and User

to set controller and user model I followed the docs: https://jwt-auth.readthedocs.io/en/develop/quick-start/

答:
Try importing Auth as such

use Illuminate\Support\Facades\Auth;

and getting the ID like this:

```<code>$user = Auth::user();
$id = $user->id;
</code>```

Hope this helps

Add this middelware on kernel.php

```<code>protected $middlewareGroups = [
        'web' => [
            \Illuminate\Session\Middleware\StartSession::class,
        ],
];
</code>```

this link might help :
Answer Link

Body:
I am setting like and unlike options on articles. but in LikeController there is problem. when I push the like button it says ->

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id'
  cannot be null (SQL: insert into likes (user_id, article_id,
  updated_at, created_at) values (?, 5, 2019-05-30 07:58:34,
  2019-05-30 07:58:34))

Updated JWT and Routes

Like model:

class Like extends Model
{
    public $timestamps = true;
    public $with = ["user"];

    protected $fillable = ["user_id", "article_id"];

    public function article()
    {
        return $this->belongsTo("App\Article");
    }

    public function user()
    {
        return $this->belongsTo("App\User");
    }
}

and LikeController:

use Auth;
use App\Article;
use App\Like;

public function like($id)
{
    $article = Article::find($id);

    $like =  Like::create([
        "user_id" => Auth::id(),
        "article_id" => $article->id
    ]);

    return Like::find($like->id);
}

public function unlike($id)
{
    $article = Article::find($id);

    Like::where("user_id", Auth::id())
        ->where("article_id", $article->id)
        ->first()
        ->delete();

    return 1;
}

I am not very sure why Auth::id() can't find the user id and return null?

Using JWT with vue.js

Routes:

Route::group(['prefix' => 'auth'], function ($router) {

  Route::post('register', 'AuthController@register');
  Route::post('login', 'AuthController@login');
  Route::post('logout', 'AuthController@logout');
  Route::post('refresh', 'AuthController@refresh');
  Route::post('me', 'AuthController@me');

});

Route::get("/like/{id}", [
        "uses" => "LikeController@like"
    ]);
Route::get("/unlike/{id}", [
        "uses" => "LikeController@unlike"
    ]);

AuthController and User

to set controller and user model I followed the docs: https://jwt-auth.readthedocs.io/en/develop/quick-start/

Body:
Try importing Auth as such

use Illuminate\Support\Facades\Auth;

and getting the ID like this:

$user = Auth::user();
$id = $user->id;

Hope this helps

Add this middelware on kernel.php

protected $middlewareGroups = [
        'web' => [
            \Illuminate\Session\Middleware\StartSession::class,
        ],
];

this link might help :
Answer Link


问:
Creating 2 numbers from a one #C
I should create two new numbers from a one, the first group will contain digits which are divisible by 2 and the other group will contain the others.

```<code>int checkCount = 94321, num1 = 94321, count2 = 0, countRest = 0;

        while (checkCount > 0)
        {
            if (checkCount % 2 == 0)
                count2++;
            else
                countRest++;
            checkCount /= 10;
        }

        int[] a = new int[count2];
        int[] b = new int[countRest];

        int k2 = 0, kRest = 0;

        for (int j = 0; j < a.Length + b.Length; j++)
        {
            if (num1 % 2 == 0)
            {
                a[k2] = num1 % 10;
                k2++;
            }
            else
            {
                b[kRest] = num1 % 10;
                kRest++;
            }
            num1 /= 10;
        }
</code>```

I created two arrays with the numbers I should use, now how can I build two INT varabile when each one contains all of the numbers together from the array?

Example:
If I have this number - 12345 so
var = 24, other var = 135

If you have another solution without arrays I think it will be better.
Thank you.

答:
If I understand what you're looking for this will do the trick:</p>

```<code>        //Setup a sample array
        int[] a = new int[2];
        a[0] = 2;
        a[1] = 4;

        //Convert each item to a string, convert that to a string array, join the strings and turn into an int
        int output = int.Parse(String.Join("", a.Select(s => s.ToString()).ToArray()));
</code>```

Title: Creating 2 numbers from a one #C

Body:
I should create two new numbers from a one, the first group will contain digits which are divisible by 2 and the other group will contain the others.

int checkCount = 94321, num1 = 94321, count2 = 0, countRest = 0;

        while (checkCount > 0)
        {
            if (checkCount % 2 == 0)
                count2++;
            else
                countRest++;
            checkCount /= 10;
        }

        int[] a = new int[count2];
        int[] b = new int[countRest];

        int k2 = 0, kRest = 0;

        for (int j = 0; j < a.Length + b.Length; j++)
        {
            if (num1 % 2 == 0)
            {
                a[k2] = num1 % 10;
                k2++;
            }
            else
            {
                b[kRest] = num1 % 10;
                kRest++;
            }
            num1 /= 10;
        }

I created two arrays with the numbers I should use, now how can I build two INT varabile when each one contains all of the numbers together from the array?

Example:
If I have this number - 12345 so
var = 24, other var = 135

If you have another solution without arrays I think it will be better.
Thank you.

Body:
If I understand what you're looking for this will do the trick:

        //Setup a sample array
        int[] a = new int[2];
        a[0] = 2;
        a[1] = 4;

        //Convert each item to a string, convert that to a string array, join the strings and turn into an int
        int output = int.Parse(String.Join("", a.Select(s => s.ToString()).ToArray()));


问:
What is MONITORING in Toad generated code snippet for a Table (create table)?
I created a table named test_tbl in oracle as following. After table is created I analysed the DDL statement from toad it has one physical properties named MONITORING?
What is the use of this MONITORING clause?

create table test_tbl
(
    col_a number(5,0),
    col_b varchar2(30)
);
```

<p>This is the code generated from TOAD (schema browser --> Script)</p>

<pre class="lang-sql prettyprint-override"><code>DROP TABLE MEERAN.TEST_TBL CASCADE CONSTRAINTS;

CREATE TABLE MEERAN.TEST_TBL
(
  COL_A  NUMBER(5),
  COL_B  VARCHAR2(30 BYTE)
)
TABLESPACE PANAMA_TS
PCTUSED    0
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            NEXT             1M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
LOGGING
NOCOMPRESS
NOCACHE
MONITORING;
</code>```

答:
It's a deprecated clause; from the 10gR2 docs:

MONITORING | NOMONITORING

In earlier releases, you could use these clauses to start or stop the collection of modification statistics on this table. These clauses have been deprecated.

If you formerly collected modification statistics on tables by using the DBMS_STATS package in GATHER AUTO or GATHER STALE mode, then you no longer have to do anything. Oracle Database now collects these statistics automatically, and the MONITORING and NOMONITORING keywords in existing code will not cause an error.

If, for performance reasons, you do not want to collect modification statistics on any tables, then you should set the STATISTICS_LEVEL initialization parameter to BASIC. Be aware, however, that doing so disables a number of manageability features.

This clause isn't even mentioned in later versions of that documentation; and dbms_metadata.get_ddl doesn't include it when run against an 11gR2 table for me - at least with default settings. There is still a monitoring column in all_tables though.

The 11g+ documentation also says:

Formerly, you enabled DBMS_STATS to automatically gather statistics for a table by specifying the MONITORING keyword in the CREATE (or ALTER) TABLE statement. Starting with Oracle Database 11g, the MONITORING and NOMONITORING keywords have been deprecated and statistics are collected automatically. If you do specify these keywords, they are ignored.

It seems that Toad is reconstructing the DDL manually from the data dictionary rather than using that package - the clause order and lack of double-quotes around the schema and table names also suggest that is the case. If you want to change what is included, see this Quest knowledge base article.

But basically, you can just ignore MONITORING, since Oracle will.

Body:
I created a table named test_tbl in oracle as following. After table is created I analysed the DDL statement from toad it has one physical properties named MONITORING?
What is the use of this MONITORING clause?

create table test_tbl
(
    col_a number(5,0),
    col_b varchar2(30)
);

This is the code generated from TOAD (schema browser --> Script)

DROP TABLE MEERAN.TEST_TBL CASCADE CONSTRAINTS;

CREATE TABLE MEERAN.TEST_TBL
(
  COL_A  NUMBER(5),
  COL_B  VARCHAR2(30 BYTE)
)
TABLESPACE PANAMA_TS
PCTUSED    0
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            NEXT             1M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
LOGGING
NOCOMPRESS
NOCACHE
MONITORING;


答:
```<code>Auth::user()->id
</code>```

use this code

Title: Auth::id() can't find user id and return null, laravel

Body:
Auth::user()->id

use this code


问:
How can I embed resources in output of Web Deployment Project?
I have an asp.net project that holds my user controls within a Web Deployment project.
I use Web Deployment project to output a single dll file, so I can use controls easily in other projects.
So how can I embed resourses (like js, image,... files) into this single dll?</p>

答: Change the build action to embedded resource for the files.</p>


问:
wso2 apim docker - http://host-ip:9443/publisher is downloading a binary file instead of showing a login page
I am following https://wso2.com/api-management/install/docker/get-started/ this guide for wso2-apim setup but i cannot see any webpage on these url

```<code>- Publisher  http://localhost:9443/publisher
- Store  http://localhost:9443/store
- Admin console  http://localhost:9443/admin
- Carbon console  http://localhost:9443/carbon
</code>```

instead on going to these url it downloads a binary file.

docker run -it -p 8280:8280 -p 8243:8243 -p 9443:9443 --name api-manager wso2/wso2am:2.6.0

答:
As was mentioned , all the urls are wrong the correct ones are:

```<code>Publisher - https://localhost:9443/publisher
Store - https://localhost:9443/store
Admin console - https://localhost:9443/admin
Carbon console - https://localhost:9443/carbon
</code>```

Anyway I can't download a "binary" when I reach the url http://localhost:9443/publisher

I used curl command and get this:

```<code>curl -v http://127.0.0.1:9443/publisher
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 9443 (#0)
> GET /publisher HTTP/1.1
> Host: 127.0.0.1:9443
> User-Agent: curl/7.54.0
> Accept: */*
>
* Connection #0 to host 127.0.0.1 left intact
P%
</code>```

Could you add more information. What browser did you used ?

Body:
I am following https://wso2.com/api-management/install/docker/get-started/ this guide for wso2-apim setup but i cannot see any webpage on these url

- Publisher  http://localhost:9443/publisher
- Store  http://localhost:9443/store
- Admin console  http://localhost:9443/admin
- Carbon console  http://localhost:9443/carbon

instead on going to these url it downloads a binary file.

docker run -it -p 8280:8280 -p 8243:8243 -p 9443:9443 --name api-manager wso2/wso2am:2.6.0

Body:
As was mentioned , all the urls are wrong the correct ones are:

Publisher - https://localhost:9443/publisher
Store - https://localhost:9443/store
Admin console - https://localhost:9443/admin
Carbon console - https://localhost:9443/carbon

Anyway I can't download a "binary" when I reach the url http://localhost:9443/publisher

I used curl command and get this:

curl -v http://127.0.0.1:9443/publisher
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 9443 (#0)
> GET /publisher HTTP/1.1
> Host: 127.0.0.1:9443
> User-Agent: curl/7.54.0
> Accept: */*
>
* Connection #0 to host 127.0.0.1 left intact
P%

Could you add more information. What browser did you used ?


问:
Groovy enum: switch statement throws error before running relating to static
The following code can be compiled fine in Intellij, but when trying to use Groovy as a script, it throws an error even before running.
I can't find out the crack, since everything is static actually?

```<code>public enum OutputType {
        ABC,
        DEF,
        GHI
    }
    //Just initializing here
        public static OutputType output=OutputType.ABC;

    public static void run() {

        switch (output){
            case ABC:
                runABC();
                break;

            case DEF:
                runDEF();
                break;

            case GHI:
                runGHI();
                break;

            default:
                break;
        }
    }
</code>```

The error:

```<code>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 50: Apparent variable 'ABC' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'ABC' but left out brackets in a place not allowed by the grammar.
 @ line 50, column 18.
               case ABC:
                    ^

Script1.groovy: 54: Apparent variable 'DEF' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'DEF' but left out brackets in a place not allowed by the grammar.
 @ line 54, column 18.
               case DEF:
                    ^

Script1.groovy: 58: Apparent variable 'GHI' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'GHI' but left out brackets in a place not allowed by the grammar.
 @ line 58, column 18.
               case GHI:
</code>```

答:
Have you tried removing the static stuff from your script and adding enum class name in your cases?</p>

```<code>    switch (output){
        case OutputType.ABC:
            runABC();
            break;

        case OutputType.DEF:
            runDEF();
            break;

        case OutputType.GHI:
            runGHI();
            break;

        default:
            break;
    }
</code>```

Body:
The following code can be compiled fine in Intellij, but when trying to use Groovy as a script, it throws an error even before running.
I can't find out the crack, since everything is static actually?

public enum OutputType {
        ABC,
        DEF,
        GHI
    }
    //Just initializing here
        public static OutputType output=OutputType.ABC;

    public static void run() {

        switch (output){
            case ABC:
                runABC();
                break;

            case DEF:
                runDEF();
                break;

            case GHI:
                runGHI();
                break;

            default:
                break;
        }
    }

The error:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 50: Apparent variable 'ABC' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'ABC' but left out brackets in a place not allowed by the grammar.
 @ line 50, column 18.
               case ABC:
                    ^

Script1.groovy: 54: Apparent variable 'DEF' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'DEF' but left out brackets in a place not allowed by the grammar.
 @ line 54, column 18.
               case DEF:
                    ^

Script1.groovy: 58: Apparent variable 'GHI' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'GHI' but left out brackets in a place not allowed by the grammar.
 @ line 58, column 18.
               case GHI:

Body:
Have you tried removing the static stuff from your script and adding enum class name in your cases?

    switch (output){
        case OutputType.ABC:
            runABC();
            break;

        case OutputType.DEF:
            runDEF();
            break;

        case OutputType.GHI:
            runGHI();
            break;

        default:
            break;
    }


问:
Checked List Box with data value property for each item?
Does anyone know of a control such as a Checked List Box where each item can have a value against it.

For example you have a list of fruits and in the listbox it displays Apple, Orange & Banana but the values for those items are A, O & B.

答:
I think this is default functionality for .Net Listboxes, comboboxes etc.

If your Listbox has a datasource with items which have properties FruitName and FruitId you can set the DisplayMember to FruitName and the ValueMember to FruitId.

On selecting an item the SelectedValue will be the FruitId.


问:
@reboot is not working in CRON
I'm trying to run a shell-script and a command at the start of my Ubuntu server.

Here is my CRON

```<code>@reboot /home/steam/check.sh
@reboot screen -d -S up -m node /var/www/html/Up1/server/server.js
</code>```

What I'm getting in the logs:
grep CRON /var/log/syslog

```<code>Jul 19 19:48:28 vc1s cron[3185]: (CRON) INFO (pidfile fd = 3)
Jul 19 19:48:28 vc1s cron[3185]: (CRON) INFO (Running @reboot jobs)
Jul 19 19:48:28 vc1s CRON[3209]: (root) CMD (screen -d -S up -m node /var/www/html/Up1/server/server.js)
Jul 19 19:48:28 vc1s CRON[3211]: (root) CMD (/home/steam/check.sh)
Jul 19 19:51:20 vc1s cron[3779]: (CRON) DEATH (can't lock /var/run/crond.pid, otherpid may be 3185: Resource temporarily unavailable)
Jul 19 19:55:01 vc1s CRON[3996]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
</code>```

My check.sh.

```<code>#!/bin/bash

until screen -d -S unturned -m /home/steam/start.sh; do
        echo "Server 'myserver' crashed with exit code $?.  Respawning.." >&2
        sleep 1
done
</code>```

My start.sh. It's for launching an Unturned game server. I don't think this script is important but I guess I should show you.

```<code>#!/bin/bash
# This script starts a Unturned 3 server on Linux machines
# Syntax: start.sh <instance name>
# Author: fr34kyn01535

#CONFIG
INSTANCE_NAME=1
STEAMCMD_HOME="./steamcmd"
UNTURNED_HOME="./unturned"

#COLORS
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLLOW='\033[0;33m'
NC='\033[0m'

#Steam checks
STEAMCMD_API=$STEAMCMD_HOME/linux32/steamclient.so
UNTURNED_API=$UNTURNED_HOME/Unturned_Data/Plugins/x86/steamclient.so
printf "Steam: "
if [ -f $STEAMCMD_API ]; then
        if diff $STEAMCMD_API $UNTURNED_API >/dev/null ; then
                printf "${GREEN}UP TO DATE${NC}\n\n"
        else
                cp $STEAMCMD_API $UNTURNED_API
                printf "${YELLLOW}UPDATING${NC}\n\n"
        fi
else
        printf "${RED}NOT FOUND${NC}\n\n"
fi

cd $UNTURNED_HOME

if [ -f RocketLauncher.exe ]; then
        ulimit -n 2048
        mono RocketLauncher.exe $INSTANCE_NAME
else
        echo "RocketLauncher not found."
fi
</code>```

The thing is that if I execute ./check.sh from /home/steam It works fine. The bad news is that the @reboot doesn't work for me when I reboot my VPS.

screen -list doesn't throw anything if I reboot.

I've tried multiple things but didn't work, the last thing I changed was adding -d parameter in the screen commands so the server wouldn't need a terminal to write down the start-up.

I'm not sure how much can be done here to make @reboot work as expected.

How can I make my scripts run on boot? Are there any other alternatives to CRON's @reboot?

Thanks in advance.

答:
Try man 5 crontab. If your crontab supported, you should see @reboot, @yearly, @monthly,.,,,

then try add some sleep for moment may can help.

```<code>@reboot sleep 60;/root/s3-mount.sh
</code>```

Title: @reboot is not working in CRON

Body:
I'm trying to run a shell-script and a command at the start of my Ubuntu server.

Here is my CRON

@reboot /home/steam/check.sh
@reboot screen -d -S up -m node /var/www/html/Up1/server/server.js

What I'm getting in the logs:
grep CRON /var/log/syslog

Jul 19 19:48:28 vc1s cron[3185]: (CRON) INFO (pidfile fd = 3)
Jul 19 19:48:28 vc1s cron[3185]: (CRON) INFO (Running @reboot jobs)
Jul 19 19:48:28 vc1s CRON[3209]: (root) CMD (screen -d -S up -m node /var/www/html/Up1/server/server.js)
Jul 19 19:48:28 vc1s CRON[3211]: (root) CMD (/home/steam/check.sh)
Jul 19 19:51:20 vc1s cron[3779]: (CRON) DEATH (can't lock /var/run/crond.pid, otherpid may be 3185: Resource temporarily unavailable)
Jul 19 19:55:01 vc1s CRON[3996]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)

My check.sh.

#!/bin/bash

until screen -d -S unturned -m /home/steam/start.sh; do
        echo "Server 'myserver' crashed with exit code $?.  Respawning.." >&2
        sleep 1
done

My start.sh. It's for launching an Unturned game server. I don't think this script is important but I guess I should show you.

#!/bin/bash
# This script starts a Unturned 3 server on Linux machines
# Syntax: start.sh <instance name>
# Author: fr34kyn01535

#CONFIG
INSTANCE_NAME=1
STEAMCMD_HOME="./steamcmd"
UNTURNED_HOME="./unturned"

#COLORS
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLLOW='\033[0;33m'
NC='\033[0m'

#Steam checks
STEAMCMD_API=$STEAMCMD_HOME/linux32/steamclient.so
UNTURNED_API=$UNTURNED_HOME/Unturned_Data/Plugins/x86/steamclient.so
printf "Steam: "
if [ -f $STEAMCMD_API ]; then
        if diff $STEAMCMD_API $UNTURNED_API >/dev/null ; then
                printf "${GREEN}UP TO DATE${NC}\n\n"
        else
                cp $STEAMCMD_API $UNTURNED_API
                printf "${YELLLOW}UPDATING${NC}\n\n"
        fi
else
        printf "${RED}NOT FOUND${NC}\n\n"
fi

cd $UNTURNED_HOME

if [ -f RocketLauncher.exe ]; then
        ulimit -n 2048
        mono RocketLauncher.exe $INSTANCE_NAME
else
        echo "RocketLauncher not found."
fi

The thing is that if I execute ./check.sh from /home/steam It works fine. The bad news is that the @reboot doesn't work for me when I reboot my VPS.

screen -list doesn't throw anything if I reboot.

I've tried multiple things but didn't work, the last thing I changed was adding -d parameter in the screen commands so the server wouldn't need a terminal to write down the start-up.

I'm not sure how much can be done here to make @reboot work as expected.

How can I make my scripts run on boot? Are there any other alternatives to CRON's @reboot?

Thanks in advance.

Body:
Try man 5 crontab. If your crontab supported, you should see @reboot, @yearly, @monthly,.,,,

then try add some sleep for moment may can help.

@reboot sleep 60;/root/s3-mount.sh


问:
Is there any other way to change the color to the bootstrap nav links ? Using dark theme
When using the bootstrap framework and trying to change the nav-link colors on the dark theme , there is a very specific way of targeting and is the only way and I am curious if somebody figured out another way . </p>

<p>This is the only selector that worked </p>

```<code>.navbar-dark .navbar-nav .active > .nav-link
</code>```

答:
Actually, while using this framework, we're using it's own css so the selector needs to go according to the pre-defined one in the css. However, you can tweak it by "!important". For example:</p>

```<code>.nav-link {
    color: #000 !important;
}
</code>```

Body:
When using the bootstrap framework and trying to change the nav-link colors on the dark theme , there is a very specific way of targeting and is the only way and I am curious if somebody figured out another way .

This is the only selector that worked

.navbar-dark .navbar-nav .active > .nav-link

Body:
Actually, while using this framework, we're using it's own css so the selector needs to go according to the pre-defined one in the css. However, you can tweak it by "!important". For example:

.nav-link {
    color: #000 !important;
}


问:
Not able to login to Salesforce application through JMeter
Not able to login into Salesforce Application through JMeter.

Please help.

I am providing correct Username and Password but still not able to login successfully.

答:
A login HTTP Request will not work, you need to authenticate with network login by adding Port, proxy details and all.
If that doesn't help then you can try "BlazeMeter" plugin, install this extension in Chrome browser and record your steps, it will then convert your inputs into a JMX file, there you can see which steps need to be added and modify accordingly. Hope it helps.</p>


问:
HTML Version 4 vs 5
Is there a way to avoid HTML 5 parser ?
My app has the following doctype:

```<code>DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
</code>```

And I wish that it's interpreted with HTML4 definitions not HTML5

EDIT:

My question reason is to solve this:
Chrome popup Please Fill Out this Field

答:
New answer based on updated question:

It isn't the HTML 5 parsing rules you have a problem with, it is support for HTML 5 attributes. No, you can't override this. If you don't want to use things that are new in HTML 5 — don't use them in your document!

Original answer:

No, there isn't.

The HTML 5 parsing rules are mostly "What browsers have been doing for the last decade and a half anyway".

This just lets us get away from having perfectly valid SGML features with limited support  in the language (and validators which pass them as valid).

Title: HTML Version 4 vs 5

Body:
Is there a way to avoid HTML 5 parser ?
My app has the following doctype:

DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"

And I wish that it's interpreted with HTML4 definitions not HTML5

EDIT:

My question reason is to solve this:
Chrome popup Please Fill Out this Field