问:
Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
I am stuck a whole afternoon trying to run again my small Android/Kotlin application in Android Studio. The message pasted on this question topic suddenly nocked me down.

I have done these tentatives:

1 - cold boot (On Virtual Devices screen > Actions > Cold Boot Now)

2 - I deleted my previous Virtual Device and I downloaded a new one (Nexus One)

3 - I followed all steps from other stackoverflow answer

3.1

```<code>cd C:\Users\Jimis\AppData\Local\Android\Sdk\platform-tool

adb kill-server
adb.exe start-server
adb devices -l
</code>```

3.2

deleted plataform-tool and redownlowaded it from SDK Plataform

3.3

restart computer

I am completely stuck.

Something called my attention: why so many PIDs to port 5037. See bellow that initially when I started Androdi Studio I had only 3 and after I tried debug my application I got a lot more.

```<code>Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50714        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50731        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50734        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50736        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50737        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50738        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50739        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50740        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50741        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50742        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50743        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50744        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50745        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50746        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50747        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50748        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50749        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50750        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50751        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50752        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50753        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50754        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50755        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50756        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50757        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50758        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50759        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50760        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50761        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50762        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50763        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50764        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50765        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50766        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50767        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50768        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50769        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50770        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50771        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50772        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50773        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50779        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50780        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50781        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50782        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50783        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50784        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50785        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50786        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50787        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50788        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50789        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50790        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50791        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50792        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50793        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50794        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50714        127.0.0.1:5037         ESTABLISHED     792
  TCP    127.0.0.1:50717        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50719        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50722        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50729        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50731        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50734        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50736        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50738        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50739        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50740        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50741        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50742        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50743        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50744        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50745        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50746        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50747        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50748        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50749        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50750        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50751        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50752        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50753        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50754        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50755        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50756        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50757        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50758        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50760        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50761        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50762        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50763        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50764        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50765        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50766        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50767        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50768        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50770        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50771        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50772        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50773        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50791        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50793        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50794        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>
</code>```

Trying to figure out with "netstat -a -b" why so many established connections to same port 5037 I reached this list but I don't if it is normal when using Android Studio and Emulator

```<code>...
     TCP    127.0.0.1:5037         SPANOT149:0            LISTENING
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50582        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50714        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50731        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50734        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50736        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50738        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50739        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50740        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50741        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50742        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50744        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50745        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50746        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50747        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50748        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50750        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50751        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50753        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50756        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50757        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50760        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50761        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50762        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50763        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50764        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50765        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50766        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50767        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50768        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50770        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50772        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50773        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50793        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50797        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50955        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:51276        ESTABLISHED
     [adb.exe]
</code>```

My app build.gradle

```<code>apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }

    defaultConfig {
        applicationId "com.mycomp.appfirestore"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    // Firebase Libraries
    implementation 'com.google.firebase:firebase-core:17.4.2'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
}
</code>```

Project build.gradle

```<code>// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.71'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

*** added

in case it is relevant I just aupdated to Android Studio 4.0 and same issue.

```<code>Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 20, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins:
</code>```

Reading a lot on stackoverflow I reached this other issue

I tried added advancedFeatures.ini in my C:\Users....android with

```<code>Vulkan = off
GLDirectMem = on
</code>```

I don't know exactly what I did but I tried it anyway and I am still getting same issue. In this same stackoverflow discussion I noted someone talking about hyper-V.

In case it is relevant, I have turned off Hyper-V some time ago in my Windows 10 because I had to use VirtualBox for other reasons (OpenShift/minishift). I don't think it has relathionship with my issue because until 2 days ago I had not such problem with port 5037. BTW, I am curious: does Androids Emulators depend on HyperV somehow?

*** edited after Jacob's comment

Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

1) Before I started Android Studio I had no connection to 5037 as expected

C:\Users>netstat -ano | findstr "5037"

2) Then I started Android Studio and I see at least three connections to port 5037.

```<code>C:\Users\Cast>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348
</code>```

3) And when I click on Debug app (shift + F9) I get two messages errors on left bottom side of Android Studio

```<code>Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037

Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
</code>```

and a lot of connections with numerous TIME WAIT. It seems so weird to me.

```<code>C:\Users>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54631        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54643        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54647        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54648        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54649        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54650        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54662        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54663        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54665        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54666        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54667        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54668        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54669        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54670        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54671        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54672        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54673        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54674        TIME_WAIT       0
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54631        127.0.0.1:5037         ESTABLISHED     5224
  TCP    127.0.0.1:54634        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54636        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54639        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54641        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54643        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54671        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54673        127.0.0.1:5037         ESTABLISHED     348

C:\Users>
</code>```

Whole Event Log

```<code>Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50714        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50731        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50734        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50736        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50737        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50738        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50739        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50740        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50741        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50742        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50743        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50744        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50745        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50746        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50747        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50748        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50749        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50750        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50751        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50752        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50753        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50754        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50755        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50756        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50757        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50758        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50759        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50760        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50761        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50762        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50763        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50764        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50765        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50766        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50767        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50768        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50769        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50770        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50771        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50772        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50773        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50779        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50780        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50781        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50782        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50783        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50784        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50785        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50786        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50787        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50788        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50789        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50790        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50791        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50792        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50793        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50794        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50714        127.0.0.1:5037         ESTABLISHED     792
  TCP    127.0.0.1:50717        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50719        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50722        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50729        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50731        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50734        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50736        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50738        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50739        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50740        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50741        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50742        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50743        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50744        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50745        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50746        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50747        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50748        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50749        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50750        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50751        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50752        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50753        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50754        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50755        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50756        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50757        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50758        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50760        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50761        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50762        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50763        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50764        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50765        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50766        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50767        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50768        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50770        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50771        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50772        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50773        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50791        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50793        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50794        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>
</code>```0

*** edited after changed ADB port

I changed ANDROID_ADB_SERVER_PORT to 5038 in Windows Environment and restart Android Studio and I still see some 5037 waiting for connection.

After changed Environemnt Variable ANDROID_ADB_SERVER_PORT in Windows

```<code>Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50714        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50731        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50734        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50736        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50737        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50738        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50739        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50740        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50741        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50742        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50743        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50744        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50745        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50746        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50747        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50748        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50749        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50750        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50751        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50752        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50753        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50754        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50755        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50756        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50757        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50758        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50759        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50760        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50761        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50762        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50763        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50764        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50765        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50766        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50767        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50768        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50769        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50770        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50771        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50772        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50773        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50779        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50780        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50781        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50782        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50783        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50784        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50785        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50786        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50787        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50788        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50789        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50790        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50791        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50792        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50793        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50794        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50714        127.0.0.1:5037         ESTABLISHED     792
  TCP    127.0.0.1:50717        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50719        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50722        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50729        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50731        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50734        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50736        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50738        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50739        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50740        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50741        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50742        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50743        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50744        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50745        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50746        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50747        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50748        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50749        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50750        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50751        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50752        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50753        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50754        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50755        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50756        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50757        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50758        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50760        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50761        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50762        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50763        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50764        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50765        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50766        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50767        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50768        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50770        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50771        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50772        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50773        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50791        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50793        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50794        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>
</code>```1

答: This is likely caused by insufficient permissions. Run Android Studio or your command prompt (whichever you prefer) as an administrator and that should solve your problem.</p>

Body:
I am stuck a whole afternoon trying to run again my small Android/Kotlin application in Android Studio. The message pasted on this question topic suddenly nocked me down.

I have done these tentatives:

1 - cold boot (On Virtual Devices screen > Actions > Cold Boot Now)

2 - I deleted my previous Virtual Device and I downloaded a new one (Nexus One)

3 - I followed all steps from other stackoverflow answer

3.1

cd C:\Users\Jimis\AppData\Local\Android\Sdk\platform-tool

adb kill-server
adb.exe start-server
adb devices -l

3.2

deleted plataform-tool and redownlowaded it from SDK Plataform

3.3

restart computer

I am completely stuck.

Something called my attention: why so many PIDs to port 5037. See bellow that initially when I started Androdi Studio I had only 3 and after I tried debug my application I got a lot more.

Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50714        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50731        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50734        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50736        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50737        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50738        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50739        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50740        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50741        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50742        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50743        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50744        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50745        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50746        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50747        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50748        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50749        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50750        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50751        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50752        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50753        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50754        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50755        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50756        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50757        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50758        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50759        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50760        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50761        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50762        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50763        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50764        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50765        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50766        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50767        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50768        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50769        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50770        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50771        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50772        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50773        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50779        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50780        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50781        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50782        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50783        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50784        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50785        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50786        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50787        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50788        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50789        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50790        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50791        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50792        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50793        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50794        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50714        127.0.0.1:5037         ESTABLISHED     792
  TCP    127.0.0.1:50717        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50719        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50722        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50729        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50731        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50734        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50736        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50738        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50739        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50740        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50741        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50742        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50743        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50744        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50745        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50746        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50747        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50748        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50749        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50750        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50751        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50752        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50753        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50754        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50755        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50756        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50757        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50758        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50760        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50761        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50762        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50763        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50764        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50765        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50766        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50767        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50768        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50770        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50771        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50772        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50773        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50791        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50793        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50794        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>

Trying to figure out with "netstat -a -b" why so many established connections to same port 5037 I reached this list but I don't if it is normal when using Android Studio and Emulator

...
     TCP    127.0.0.1:5037         SPANOT149:0            LISTENING
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50582        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50714        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50731        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50734        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50736        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50738        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50739        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50740        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50741        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50742        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50744        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50745        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50746        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50747        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50748        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50750        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50751        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50753        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50756        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50757        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50760        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50761        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50762        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50763        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50764        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50765        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50766        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50767        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50768        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50770        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50772        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50773        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50793        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50797        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50955        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:51276        ESTABLISHED
     [adb.exe]

My app build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }

    defaultConfig {
        applicationId "com.mycomp.appfirestore"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    // Firebase Libraries
    implementation 'com.google.firebase:firebase-core:17.4.2'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
}

Project build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.71'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

*** added

in case it is relevant I just aupdated to Android Studio 4.0 and same issue.

Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 20, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins:

Reading a lot on stackoverflow I reached this other issue

I tried added advancedFeatures.ini in my C:\Users....android with

Vulkan = off
GLDirectMem = on

I don't know exactly what I did but I tried it anyway and I am still getting same issue. In this same stackoverflow discussion I noted someone talking about hyper-V.

In case it is relevant, I have turned off Hyper-V some time ago in my Windows 10 because I had to use VirtualBox for other reasons (OpenShift/minishift). I don't think it has relathionship with my issue because until 2 days ago I had not such problem with port 5037. BTW, I am curious: does Androids Emulators depend on HyperV somehow?

*** edited after Jacob's comment

Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

1) Before I started Android Studio I had no connection to 5037 as expected

C:\Users>netstat -ano | findstr "5037"

2) Then I started Android Studio and I see at least three connections to port 5037.

C:\Users\Cast>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348

3) And when I click on Debug app (shift + F9) I get two messages errors on left bottom side of Android Studio

Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037

Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)

and a lot of connections with numerous TIME WAIT. It seems so weird to me.

C:\Users>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54631        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54643        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54647        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54648        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54649        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54650        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54662        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54663        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54665        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54666        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54667        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54668        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54669        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54670        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54671        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54672        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54673        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54674        TIME_WAIT       0
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54631        127.0.0.1:5037         ESTABLISHED     5224
  TCP    127.0.0.1:54634        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54636        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54639        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54641        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54643        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54671        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54673        127.0.0.1:5037         ESTABLISHED     348

C:\Users>

Whole Event Log

01/06/2020
00:08   Gradle sync started
00:08   * daemon not running; starting now at tcp:5037
00:08   * daemon started successfully
00:08   Gradle sync finished in 2 s 418 ms (from cached state)
00:08   Executing tasks: [:app:assembleDebug] in project C:\WSs\FireStoreDemos\AppFirestore
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56296 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56296 above FD_SETSIZE (32768)
00:08   Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56928 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56928 above FD_SETSIZE (32768)
00:08   Gradle build finished in 19 s 659 ms
00:08   Install successfully finished in 584 ms.: App restart successful without requiring a re-install.

*** edited after changed ADB port

I changed ANDROID_ADB_SERVER_PORT to 5038 in Windows Environment and restart Android Studio and I still see some 5037 waiting for connection.

After changed Environemnt Variable ANDROID_ADB_SERVER_PORT in Windows

C:\Users\>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         127.0.0.1:54643        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54671        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54673        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:55204        TIME_WAIT       0
  TCP    127.0.0.1:54602        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54631        127.0.0.1:5037         TIME_WAIT       0

C:\Users\>netstat -ano | findstr "5038"
  TCP    127.0.0.1:5038         0.0.0.0:0              LISTENING       7912
  TCP    127.0.0.1:5038         127.0.0.1:55238        ESTABLISHED     7912
  TCP    127.0.0.1:55238        127.0.0.1:5038         ESTABLISHED     11368


来源: stackexchange

问:
Update based on same column
I have a table like this:

```<code>ID | Flag
-----------
 1 | True
 1 | True
 1 | NULL
 1 | True
 1 | NULL
 2 | False
 2 | False
 2 | False
 2 | NULL
 2 | NULL
</code>```

And I want an output like this:

```<code>ID | Flag
-----------
 1 | True
 1 | True
 1 | True
 1 | True
 1 | True
 2 | False
 2 | False
 2 | False
 2 | False
 2 | False
</code>```

I want to replace nulls with the value assigned in different records. Is there a way to do it in a single update statement?

答:
The answers provided satisfy your sample data, but may still leave you short of a satisfactory answer. That is because your sample data is missing a couple significant sets. What happens if you had the following, either instead of or in addition to your current sample data?

```<code>+----+-------+
| id | flag  |
+----+-------+
|  3 | true  |
|  3 | false |
|  3 | null  |
|  4 | null  |
|  4 | null  |
+----+-------+
</code>```

The answer could be significantly different.

ContentLicense: CC BY-SA 4.0

Title: Update based on same column

Body:
I have a table like this:

ID | Flag
-----------
 1 | True
 1 | True
 1 | NULL
 1 | True
 1 | NULL
 2 | False
 2 | False
 2 | False
 2 | NULL
 2 | NULL

And I want an output like this:

ID | Flag
-----------
 1 | True
 1 | True
 1 | True
 1 | True
 1 | True
 2 | False
 2 | False
 2 | False
 2 | False
 2 | False

I want to replace nulls with the value assigned in different records. Is there a way to do it in a single update statement?

Body:
The answers provided satisfy your sample data, but may still leave you short of a satisfactory answer. That is because your sample data is missing a couple significant sets. What happens if you had the following, either instead of or in addition to your current sample data?

+----+-------+
| id | flag  |
+----+-------+
|  3 | true  |
|  3 | false |
|  3 | null  |
|  4 | null  |
|  4 | null  |
+----+-------+

The answer could be significantly different.


问:
Selecting default item from Combobox C#
I have few items on my ComboBox items collection, and i'd like to select one item from this list and set it as default item - when app starts - this item is already on comboBox.

I'm trying something like that:

```<code>SelectPrint11.SelectedIndex=2;
</code>```

but error is:

```<code>System.ArgumentOutOfRangeException: InvalidArgument=Value of '2' is not valid for 'SelectedIndex'
</code>```

Edit:

In mylist are 3 items, Printer1, Printer2, Printer3. All are added in ComboBox Properties -> Items -> Collection

答:
this is the correct form:

```<code>comboBox1.Text = comboBox1.Items[0].ToString();
</code>```

U r welcome

Title: Selecting default item from Combobox C#

Body:
I have few items on my ComboBox items collection, and i'd like to select one item from this list and set it as default item - when app starts - this item is already on comboBox.

I'm trying something like that:

SelectPrint11.SelectedIndex=2;

but error is:

System.ArgumentOutOfRangeException: InvalidArgument=Value of '2' is not valid for 'SelectedIndex'

Edit:

In mylist are 3 items, Printer1, Printer2, Printer3. All are added in ComboBox Properties -> Items -> Collection

Body:
this is the correct form:

comboBox1.Text = comboBox1.Items[0].ToString();

U r welcome


问:
How do I make fonts of different sizes vertically centered in html spans?
I'm making a pitch controller:

```<code><div id="pitchWrapper">
  <span id="pitchButtons">-</span>
  <span id="pitchValue">0</span>
  <span id="pitchButtons">+</span>
</div>
</code>```

I want the minus, plus, and pitch value all to be vertically centered. I want the plus and minus to be a bigger font-size than the pitch value.

It works reasonably well when I set the font sizes to all be the same...

...but when I try to make the pitch buttons bigger, they align below center:

Here's my css:

```<code>#pitchWrapper {
  display: flex;
  align-items: center;
  vertical-align: middle;
}

#pitchValue {
  font-size: 200%;
}

#pitchButtons {
  font-size: 300%;
}
</code>```

How can I increase the font size of the pitch buttons while keeping everything vertically centered please?

Thank you.

答: for your CSS instead of vertical-align, try justify-content: center

Body:
I'm making a pitch controller:

  -
  0
  +

I want the minus, plus, and pitch value all to be vertically centered. I want the plus and minus to be a bigger font-size than the pitch value.

It works reasonably well when I set the font sizes to all be the same...

...but when I try to make the pitch buttons bigger, they align below center:

Here's my css:

#pitchWrapper {
  display: flex;
  align-items: center;
  vertical-align: middle;
}

#pitchValue {
  font-size: 200%;
}

#pitchButtons {
  font-size: 300%;
}

How can I increase the font size of the pitch buttons while keeping everything vertically centered please?

Thank you.


问:
Public REST API differentiating logged in vs non logged in
I'm thinking about creating an auth flow. There are some apis which are public in nature (doesn't necessary require authentication but if a user is logged in, I want to be able to do personalisation) and some apis are protected.

I understand how the protected apis are to be built and what status codes to be returned there.

However, I'm uncertain about should I send the information to the clients of the public apis that the user is not logged in ? And if so what is the correct way to send this information that the api is accessible for all but the user is not logged in vs the user is logged in ?

I'm using access and refresh token based auth mechanism to protect my apis. I can think of 2 ways but not sure which is the better approach :

In case an access token is passed to the public api, I validate the token like a private api and return 401 in case it is invalid and 200 if it's valid. The client then attempts to generate a fresh access token, which in case the user is logged out it fails. Now the client attempts the api call without the access token and since the api is public, the logic is executed and the response is returned.
In this approach the client understands that he's logged out since he doesn't have a valid access token. However there are extra calls to be made each time the access token is no longer valid (which can happen a lot since the access token is short lived)

In case the token is invalid, I still execute the code and return the result but somehow make the client aware that the access token is no longer valid. In this approach there are no extra network calls and if the client can understand the response in a standard approach he can also know that the access token is no longer valid.
However, in this case since the token is no longer valid I can't assume that the user is logged in and perform personalisation.

Which approach is the best and what is the recommended practice ? Or are there any other approach that I'm missing completely.

Any help will be greatly appreciated.

答:
Your public APIs should have 2 variants: personalized and non-personalized. Let the client software decide whether or not it wants personalization.

This doesn't necessarily mean having 2 endpoints for each call, you can add a ?personalized=true query param. The important part is that the decision is on the client: The client has to know if it's logged in or not, and the client has to request a personalized response (and add its access token).

This means that you don't return 401 Unauthorized from a public non-personalized API variant is called, but in all other cases you return 401 if no valid token was provided.

There are several reasons to put the decision in the client:

First, client complexity: You don't want to bake into the API in the assumption that the client wants personalized content solely because it's logged in. Since these are public APIs, you aren't the person writing the client, and you don't know how people write their clients. For one, they might implement the access token in some central place that always sends it if it's available. They might auto refreshes the token in a flow that's separate from from the actual API calls (those will be a problem with your approach 1). For another, in most cases checking error codes is easier than checking other things (which will be a problem with your approach 2).

Second, server complexity: At some point a logged in client will want non-personalized content. That could be easy or hard to implement depending on how much of your server code makes the above assumption.

Last, flexibility: You might have a web client. You might have a mobile client. The client might not be interacting with humans at all. The client might care about efficiency more than it cares about personalization. The client might want to avoid the specialization but still provide a login option for another reason. You're already exposing two implementations, let the client choose.

Regarding the number of calls, assuming this has to do with efficiency, in almost all cases the client can easily know whether or not it has logged in. The session may time out, of course, but this case is usually not worth optimizing.

If you're planning on having many session timeouts because the personalized content contains sensitive information, then it most definitely needs to be a private API, clients need to be explicit about handling private data.

If the personalized content is not sensitive, then your login can return 2  tokens, one for private APIs and one for non-private personalized APIs, and the access token for non-private APIs can remain valid for a longer time, so that you don't have many calls regardless of how you implement personalization.


问:
increasing the stroke with increases the size of the entire stroke while decreasing does not
i'm making a very basic drawing application in java using javafx

i use the following code to draw on the canvas:

 canvas.setOnMouseDragged(e -> {

            if (e.getButton() == MouseButton.PRIMARY) {//draw

                gc.setStroke(brushColour);
                gc.setLineWidth(parent.getBrushSize());
                gc.beginPath();
                gc.lineTo(e.getX(), e.getY());
                gc.stroke();//draws the stroke
            }
});
```

and I change the variable parent.getBrushSize() when i scroll up or down.
the problem is that when i increase the brush size while drawing the entire stroke becomes bigger while if i decrease the brush size while drawing it behaves as expected:
see this image
as you can see on the left i started drawing from the top with a big brush an made the brush size smaller. on the right side i started drawing on the top with a small brush and made it bigger but by doing so it increased the size of the  whole stroke.

how can i make increasing the stroke size behave in the same way as when making the stroke smaller?

答:
it turned out that it redraws the entire stroke as soon as i increase the brush size.
to fixed this I added gc.beginPath(); so if the stroke increases in size it starts a new stroke but this no longer takes advantage of the gc.lineTo since now it just draws spheres so i added a boolean private boolean biggerStroke = false; with a setter method to my class and added a if statement around the gc.beginPath(); like so:

canvas.setOnMouseDragged(e -> {

            if (e.getButton() == MouseButton.PRIMARY) {//draw
                if(biggerStroke){
                    gc.beginPath();
                    smallerStroke = false;
                }

                gc.setStroke(brushColour);
                gc.setLineWidth(parent.getBrushSize());
                gc.lineTo(e.getX(), e.getY());
                gc.stroke();//draws the stroke
            }
});
```

and i set the biggerStroke boolean to true each time I increase the stroke size. this way it only starts a new line each time I increase the brush size.

Body:
i'm making a very basic drawing application in java using javafx

i use the following code to draw on the canvas:

 canvas.setOnMouseDragged(e -> {

            if (e.getButton() == MouseButton.PRIMARY) {//draw

                gc.setStroke(brushColour);
                gc.setLineWidth(parent.getBrushSize());
                gc.beginPath();
                gc.lineTo(e.getX(), e.getY());
                gc.stroke();//draws the stroke
            }
});

and I change the variable parent.getBrushSize() when i scroll up or down.
the problem is that when i increase the brush size while drawing the entire stroke becomes bigger while if i decrease the brush size while drawing it behaves as expected:
see this image
as you can see on the left i started drawing from the top with a big brush an made the brush size smaller. on the right side i started drawing on the top with a small brush and made it bigger but by doing so it increased the size of the  whole stroke.

how can i make increasing the stroke size behave in the same way as when making the stroke smaller?

Body:
it turned out that it redraws the entire stroke as soon as i increase the brush size.
to fixed this I added gc.beginPath(); so if the stroke increases in size it starts a new stroke but this no longer takes advantage of the gc.lineTo since now it just draws spheres so i added a boolean private boolean biggerStroke = false; with a setter method to my class and added a if statement around the gc.beginPath(); like so:

canvas.setOnMouseDragged(e -> {

            if (e.getButton() == MouseButton.PRIMARY) {//draw
                if(biggerStroke){
                    gc.beginPath();
                    smallerStroke = false;
                }

                gc.setStroke(brushColour);
                gc.setLineWidth(parent.getBrushSize());
                gc.lineTo(e.getX(), e.getY());
                gc.stroke();//draws the stroke
            }
});

and i set the biggerStroke boolean to true each time I increase the stroke size. this way it only starts a new line each time I increase the brush size.


问:
Return one word at a time
I have a function that takes in a text file and prints each word in the file one by one, each on a new line.

Here's the code that does what I said above:

```<code>def print_one_word():
    with open("test_script.txt", "r") as f:
        lines = f.readlines()
        word_current = []
        for line in lines:
            for word in line.split():
                word_current.append(word)
                print("".join(word_current))
                word_current.clear()
</code>```

Example, with specified text file content:

test_script.txt has the content (as formatted): stack, hello test python's name

The function print_one_word() will print the following to stdout (as formatted):

```<code>stack,
hello
test
python's
name
</code>```

The goal is to pass each word, one by one, into a second function that will perform some operations on it (Ex: capitalize the first letter). However, the most important part is that it sends to the second function only one word, and once the operation is performed, the next word is sent.

To do this, I've replaced print with return, after realizing that that wouldn't work (would only send one word), I tried using yield. However, it still only sends one word to the second function and then stops (it won't continue sending the following words).

I've also tried methods besides what I have currently (creating a list of one word, printing that list without formatting, and then clearing the list), such as simply printing word and so forth. Unfortunately, I got the same result; I could print each word one at a time, but not send to the second function each word one at a time.

Does anyone have any suggestions? Thanks in advance.

Edit, for clarity:

The second function takes in an argument, and I use the first function as the argument.

Example:

```<code>def operation(script):
    does some things
</code>```

operation(print_one_word())

答:
Just store all the words into a list and then call whatever function you want (in this case I'm calling do_something() on them afterwards:

```<code>def do_something(word):
  print(word.upper())

def print_one_word():
    with open("test_script.txt", "r") as f:
        lines = f.readlines()
        all_words = []
        for line in lines:
            for word in line.split():
                all_words.append(word)
                print(word)

    for word in all_words:
      do_something(word)

print_one_word()
</code>```

output:

```<code>stack,
hello
test
python's
name
STACK,
HELLO
TEST
PYTHON'S
NAME
</code>```

Title: Return one word at a time

Body:
I have a function that takes in a text file and prints each word in the file one by one, each on a new line.

Here's the code that does what I said above:

def print_one_word():
    with open("test_script.txt", "r") as f:
        lines = f.readlines()
        word_current = []
        for line in lines:
            for word in line.split():
                word_current.append(word)
                print("".join(word_current))
                word_current.clear()

Example, with specified text file content:

test_script.txt has the content (as formatted): stack, hello test python's name

The function print_one_word() will print the following to stdout (as formatted):

stack,
hello
test
python's
name

The goal is to pass each word, one by one, into a second function that will perform some operations on it (Ex: capitalize the first letter). However, the most important part is that it sends to the second function only one word, and once the operation is performed, the next word is sent.

To do this, I've replaced print with return, after realizing that that wouldn't work (would only send one word), I tried using yield. However, it still only sends one word to the second function and then stops (it won't continue sending the following words).

I've also tried methods besides what I have currently (creating a list of one word, printing that list without formatting, and then clearing the list), such as simply printing word and so forth. Unfortunately, I got the same result; I could print each word one at a time, but not send to the second function each word one at a time.

Does anyone have any suggestions? Thanks in advance.

Edit, for clarity:

The second function takes in an argument, and I use the first function as the argument.

Example:

def operation(script):
    does some things

operation(print_one_word())

Body:
Just store all the words into a list and then call whatever function you want (in this case I'm calling do_something() on them afterwards:

def do_something(word):
  print(word.upper())

def print_one_word():
    with open("test_script.txt", "r") as f:
        lines = f.readlines()
        all_words = []
        for line in lines:
            for word in line.split():
                all_words.append(word)
                print(word)

    for word in all_words:
      do_something(word)

print_one_word()

output:

stack,
hello
test
python's
name
STACK,
HELLO
TEST
PYTHON'S
NAME


问:
What are the implications of "Do you want to allow your PC to be discoverable by other PCs and devices on this network?" on AWS EC2?
When a Windows Server EC2 is started, it immediately prompts

Do you want to allow your pc to be discoverable by other pcs and
  devices on this network?

I can also see how to turn it on/off here

My question is, are there implications (security or otherwise) for Windows Server EC2 instances? In layman's terms, what does it mean I can/cannot do?

答:
Windows Network Discovery actually opens a bunch of different inbound/outbound ports on the Windows Server instance. A (somewhat) outdated list is available in some scientific publications and books, e.g. [1]:

Inbound

■ Network Discovery (LLMNR-UDP-In) Creates an inbound rule to allow Link Local Multicast Name Resolution on UDP port 5355.

■
  Network Discovery (NB-Datagram-ln) Creates an inbound rule to allow NetBIOS Datagram transmission and reception on UDP port 138.

■
  Network Discovery (NB-Name-In) Creates an inbound rule to allow NetBIOS Name Resolution on UDP port 137.

■
  Network Discovery (Pub-WSD-In) Creates an inbound rule to discover devices via Function Discovery on UDP port 3702.

■
  Network Discovery (SSDP-In) Creates an inbound rule to allow use of the Simple Service Discovery Protocol on UDP port 1900.

■
  Network Discovery (UPnP-In) Creates an inbound rule to allow use of Universal Plug and Play on TCP port 2869.

■
  Network Discovery (WSD Events-In) Creates an inbound rule to allow WSDAPI Events via Function Discovery on TCP port 5357.

■
  Network Discovery (WSD EventsSecure-In) Creates an inbound rule to allow Secure WSDAPI Events via Function Discovery on TCP port 5358.

■
  Network Discovery (WSD-In) Creates an inbound rule to discover devices via Function Discovery on UDP port 3702.

Outbound

■ Network Discovery (LLMNR-TCP-Out) Creates an outbound rule to allow LLMNIL on TCP port 5355.

■
  Network Discovery (LLMNR-UDP-Out) Creates an outbound rule to allow LLMNR on UDP port 5355.

■
  Network Discovery (NB-Datagram-Out) Creates an outbound rule to allow NetBIOS Datagram transmission and reception on UDP port 138.

■
  Network Discovery (NB-Name-Out) Creates an outbound rule to allow NetBIOS Name Resolution on UDP port 137.

■
  Network Discovery (Pub WSD-Out) Creates an outbound rule to discover devices via Function Discovery on UDP port 3702.

■
  Network Discovery (SSDP-Out) Creates an outbound rule to allow use of the Simple Service Discovery Protocol on UDP port 1900.

■
  Network Discovery (UPnPHost-Out) Creates an outbound rule to allow the use of Universal Plug and Play over TCP (all ports).

■
  Network Discovery (UPnP-Out) Creates a second outbound rule to allow the use of Universal Plug and Play over TCP (all ports).

■
  Network Discovery (WSD Events-Out) Creates an outbound rule to allow WSDAPI Events via Function Discovery on TCP port 5357.

■
  Network Discovery (WSD EventsSecure-Out) Creates an outbound rule to allow for Secure WSDAPI Events via Function Discovery on TCP port 5358.

■
  Network Discovery (WSD-Out) Creates an outbound rule to discover devices via Function Discovery on UDP port 3702.

If your security groups for the EC2 instance are set up correctly, there should probably be no real security implications. Inbound ports used by several network discovery features should be blocked by AWS Security Groups by default.

What I honestly do not know: Whether the Windows services create outbound traffic which makes the EC2 instance visible to other instances inside the same VPC subnet. That is definitely possible... Maybe there is someone reading this thread and knows this for sure??

Btw.: I found two discussions on the offical AWS forums. Maybe they are useful to someone reading this thead: [2][3].

References

[1] Google Books: How to Cheat at Microsoft Vista Administration

[2] https://forums.aws.amazon.com/thread.jspa?threadID=62760

[3] https://forums.aws.amazon.com/thread.jspa?threadID=110844


问:
Assigning values to an array of ints through a function in C
I am making a weird unpractical program that calls four functions.

First function reads 30 integers to an array;

Second does the same but to another array;

Third should make another array with 60 elements, half being the elements of the first array, other half being the elements of the second array;

Fourth will show the entire array to the user.

I'm stuck on my third function. I am not finding anything explaining how to change the values of an array of integers through a function.

```<code>#include <stdio.h>

void array1(int *a1);
void array2(int *a2);
void mash(int *a1, int *a2, int *a);
void exhibit(int *a);

int main()
{
    int a1[30];
    array1(a1);

    int a2[30];
    array2(a2);

    int a[60];
    mash(a1, a2, a);

    exhibit(a);

    return 0;
}

void array1(int *a1)
{
    int temp[30];
    for (int i = 0; i < 30; i++)
    {
        scanf("%i", a1 + i);
    }
}

void array2(int *a2)
{
    for (int i = 0; i < 30; i++)
    {
        scanf("%i", a2 + i);
    }
}

void mash(int *a1, int *a2, int *a)
{
    for (int i = 0; i < 30; i++)
    {
        a + i = a1 + i;
    }
}

void exhibit(int *a)
{

}
</code>```

I thought I should be able to access each element by adding 1 to the pointer as I did to get input on my earlier functions.

答:
You want to access those pointers, i.e. dereference them like this:

```<code>*(a + i) = *(a1 + i);
</code>```

To make it less ugly there's syntactic sugar:

```<code>a[i] = a1[i];
</code>```

Body:
I am making a weird unpractical program that calls four functions.

First function reads 30 integers to an array;

Second does the same but to another array;

Third should make another array with 60 elements, half being the elements of the first array, other half being the elements of the second array;

Fourth will show the entire array to the user.

I'm stuck on my third function. I am not finding anything explaining how to change the values of an array of integers through a function.

#include <stdio.h>

void array1(int *a1);
void array2(int *a2);
void mash(int *a1, int *a2, int *a);
void exhibit(int *a);

int main()
{
    int a1[30];
    array1(a1);

    int a2[30];
    array2(a2);

    int a[60];
    mash(a1, a2, a);

    exhibit(a);

    return 0;
}

void array1(int *a1)
{
    int temp[30];
    for (int i = 0; i < 30; i++)
    {
        scanf("%i", a1 + i);
    }
}

void array2(int *a2)
{
    for (int i = 0; i < 30; i++)
    {
        scanf("%i", a2 + i);
    }
}

void mash(int *a1, int *a2, int *a)
{
    for (int i = 0; i < 30; i++)
    {
        a + i = a1 + i;
    }
}

void exhibit(int *a)
{

}

I thought I should be able to access each element by adding 1 to the pointer as I did to get input on my earlier functions.

Body:
You want to access those pointers, i.e. dereference them like this:

*(a + i) = *(a1 + i);

To make it less ugly there's syntactic sugar:

a[i] = a1[i];


问:
DevExpress controls for WPF load time
When i use DevExpress controls for WPF-load time of the window on which they are declared-increases. But on second access-it loads fast. Isnt there a way to preload all of needed dll/themes on program startup (let it took 5-10 secs!), but load them fast in overall program? I've searched a bit, found something like this:

```<code>    private static void RunTypeInitializers(Assembly a)
    {
        Type[] types = a.GetExportedTypes();
        for (int i = 0; i < types.Length; i++)
        {
            RuntimeHelpers.RunClassConstructor(types[i].TypeHandle);
        }
    }

    private static void PreloadControls()
    {
        ThemeManager.ApplicationThemeName = Theme.Office2007BlueName;

        ThemeManager.SetThemeName(new TextEdit(), Theme.Office2007BlueName);
        ThemeManager.SetThemeName(new TreeListControl(), Theme.Office2007BlueName);

        RunTypeInitializers(Assembly.GetAssembly(typeof(TextEdit)));
        RunTypeInitializers(Assembly.GetAssembly(typeof(TreeListControl)));
        RunTypeInitializers(Assembly.GetAssembly(typeof(BarManager)));

        //GC.KeepAlive(typeof(TreeListControl));
        //GC.KeepAlive(typeof(BarManager));
        //GC.KeepAlive(typeof(TreeListView));
        //GC.KeepAlive(typeof(DevExpress.Xpf.Editors.Settings.MemoEditSettings));
        //GC.KeepAlive(typeof(DevExpress.Xpf.Editors.Settings.TextEditSettings));
    }
</code>```

But non of that helps. First load is still long.

答:
To resolve this issue, I suggest that you ngen our assemblies and use the DXSplashWindow (11.1) or create a similar window manually and show it when the main form opens for the first time.

This slowdown is caused by JIT and theme loading.

The RunTypeInitializers simply calls an object constructor.  WPF themes are not loaded at this moment because this happens only when a control is about to be shown and the visual tree is generated.

A possible solution to this problem is to create an invisible window which will contain all our controls, then show and hide it.  However, I do not like this approach.  In my opinion,  it is better to show a splash window.

ContentLicense: CC BY-SA 3.0

Title: DevExpress controls for WPF load time

Body:
When i use DevExpress controls for WPF-load time of the window on which they are declared-increases. But on second access-it loads fast. Isnt there a way to preload all of needed dll/themes on program startup (let it took 5-10 secs!), but load them fast in overall program? I've searched a bit, found something like this:

    private static void RunTypeInitializers(Assembly a)
    {
        Type[] types = a.GetExportedTypes();
        for (int i = 0; i < types.Length; i++)
        {
            RuntimeHelpers.RunClassConstructor(types[i].TypeHandle);
        }
    }

    private static void PreloadControls()
    {
        ThemeManager.ApplicationThemeName = Theme.Office2007BlueName;

        ThemeManager.SetThemeName(new TextEdit(), Theme.Office2007BlueName);
        ThemeManager.SetThemeName(new TreeListControl(), Theme.Office2007BlueName);

        RunTypeInitializers(Assembly.GetAssembly(typeof(TextEdit)));
        RunTypeInitializers(Assembly.GetAssembly(typeof(TreeListControl)));
        RunTypeInitializers(Assembly.GetAssembly(typeof(BarManager)));

        //GC.KeepAlive(typeof(TreeListControl));
        //GC.KeepAlive(typeof(BarManager));
        //GC.KeepAlive(typeof(TreeListView));
        //GC.KeepAlive(typeof(DevExpress.Xpf.Editors.Settings.MemoEditSettings));
        //GC.KeepAlive(typeof(DevExpress.Xpf.Editors.Settings.TextEditSettings));
    }

But non of that helps. First load is still long.


问:
Check if each row in a pandas series contains a string from a list using apply?
I'm trying to add a column to the DF, depending on whether other column's value contains any of the strings in a list.

The list is:

```<code>services = [
        "TELECOM",
        "AYSA",
        "PERSONAL"
]
</code>```

And so far I've tried:

```<code>payments["category"] = "services" if payments["concept"].contains(service for service in services) else ""
</code>```

And this:

```<code>payments["category"] = payments["concept"].apply(lambda x: "services" if x.contains(service) for service in services) else ""
</code>```

Among some other variations... I've seen other questions but they're mostly related to the opposite problem (checking whether a column's value is contained by a string in a list)

I could use your help! Thanks!!

答:
You can use np.where and str.contains:

```<code>payments['category'] = np.where(payments['concept'].str.contains('|'.join(services)),
                                'services', '')
</code>```

Output:

```<code>        concept  category
0       TELECOM  services
1          AYSA  services
2      PERSONAL  services
3  other things
</code>```

Body:
I'm trying to add a column to the DF, depending on whether other column's value contains any of the strings in a list.

The list is:

services = [
        "TELECOM",
        "AYSA",
        "PERSONAL"
]

And so far I've tried:

payments["category"] = "services" if payments["concept"].contains(service for service in services) else ""

And this:

payments["category"] = payments["concept"].apply(lambda x: "services" if x.contains(service) for service in services) else ""

Among some other variations... I've seen other questions but they're mostly related to the opposite problem (checking whether a column's value is contained by a string in a list)

I could use your help! Thanks!!

Body:
You can use np.where and str.contains:

payments['category'] = np.where(payments['concept'].str.contains('|'.join(services)),
                                'services', '')

Output:

        concept  category
0       TELECOM  services
1          AYSA  services
2      PERSONAL  services
3  other things


问:
getUserMedia how can i improve audio quality? How can I make audio to stop echoing?
I been trying to work with webRTC for a few day. One of the problem that I faced since then is the audio quality. The audio from getUserMedia is horrible. It is echoing a lot. I have try all the constraint but still echoing. This is my code. </p>

```<code>navigator.mediaDevices.getUserMedia({ video: { width: 300, height: 300, frameRate: 30 }, audio: { volume: 0.3, sampleSize: 16, sampleRate: 44100, echoCancellation: true, noiseSuppression: true }, })
</code>```

<p>I know that there is a way to make the audio quality better because a website like omegle use the same technology but they have very clear audio. So please if someone is kind enough to point me to the right direction to get the better audio, I really appreciate it. </p>

答: The reason for the audio keep echoing is because both input audio and output audio came from the same device. If the local video is muted and only turn on the incoming audio, the echo disappeared. I hope this will help if anyone experience the same problem as mine. </p>

Body:
I been trying to work with webRTC for a few day. One of the problem that I faced since then is the audio quality. The audio from getUserMedia is horrible. It is echoing a lot. I have try all the constraint but still echoing. This is my code.

navigator.mediaDevices.getUserMedia({ video: { width: 300, height: 300, frameRate: 30 }, audio: { volume: 0.3, sampleSize: 16, sampleRate: 44100, echoCancellation: true, noiseSuppression: true }, })

I know that there is a way to make the audio quality better because a website like omegle use the same technology but they have very clear audio. So please if someone is kind enough to point me to the right direction to get the better audio, I really appreciate it.


问:
JSON array convert to Python array
[{
data: "31/05/2010 19:39:00",
empresa: {
codigo: 1
},
descricao: "teste",
tipoEvento: "RHYTHM VARIATION"
},
{
data: "31/05/2010 18:15:00",
empresa: {
codigo: 1
},
descricao: "teste ",
tipoEvento: "RHYTHM VARIATION"
}]</p>

答:
This is an overly simple question, and I would encourage you to read the documentation in the future, but nonetheless:

import json
your_str_data = r'''
[{"data":"31/05/2010 19:39:00","empresa":{"codigo":1},"descricao":"teste","tipoEvento":"RHYTHM VARIATION"},{"data":"31/05/2010 18:15:00","empresa":{"codigo":1},"descricao":"teste ","tipoEvento":"RHYTHM VARIATION"}]
'''
jdata = json.loads(your_str_data)

import pprint
pprint.pprint(jdata)
```

Title: JSON array convert to Python array


问:
Ad Blocker w/ Segment.io
I'm considering using segment.io for several of my client-side 3rd party API needs, but I'm a little concerned about ad-blockers.

My app has no ads, but I do a lot of event-tracking for product analytics, as well as error tracking.

Segment.io offers a nice all-in-one solution, but if it's blocked, and all my eggs are in that basket, then, well, I won't have any eggs left, or however that idiom ends.

So my question is: is there a way to integrate multi-purpose event tracking (segment.io, keen.io, etc.) that isn't as susceptible to ad-blocking?

My app is mostly serverless, using a Firebase+AWS Lambda setup, so I've tried to think of some kind of back-end solution, but no big ideas so far.

ETA: I'm not looking to track adblocking users or violate anyone's trust. my question is about event-tracking unrelated to a user's identity, and whether or not that's possible in an all-in-one event tracking library that might be ad-blocked.

答:
When gathering analytics segment also provides server side tracking libraries. This can be quite useful when you want to gather metrics for certain types of events that might be blocked by users on the client. At it's simplest, Segment has an HTTP Source but there are a number of popular languages supported as well.
https://segment.com/docs/connections/sources/catalog/#server

The classic example is the order complete event, this would typically happen in your server once that transaction has been committed to a database. Regardless of browser configuration, you could send this event from the server and track.

Be sure you respect the users consent management settings here though.

Title: Ad Blocker w/ Segment.io


问:
How can i print a page in asp.net without master page and to change color schemes of the page?
i have made a page in asp.net, i have a costing calculator which has more than 50 fields, dependent on each other, one is the result of previous two and like that, i want my page to be printed in a well manner, and the header of the page which is in master page should not be in print, also the color schemes i want to adjust, let me know the best solution for this which .net provides</p>

答: You can make a new printable page version, which doesn't include a header. This version can also have the layout you need.</p>