问:
'create-react-app' is not recognized as an internal or external command
I am trying to set up react app using create-react-app command on windows pc. I already used it on my mac computer, and it works well. But I encounter a problem. Here my steps on command line. Am i missing something?

```<code>C:\Windows\system32>cd C:\Users\ugur\Desktop\deneme

C:\Users\ugur\Desktop\deneme>npm init

This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See 'npm help json' for definitive documentation on these fields
and exactly what they do.

Use 'npm install <pkg> --save' afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (deneme)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
license: (ISC)
About to write to C:\Users\ugur\Desktop\deneme\package.json:

{
   "name": "deneme",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "Ugur <ugur@abc.com.tr> (http://www.abc.com.tr)",
   "license": "ISC"
}

Is this ok? (yes)

C:\Users\ugur\Desktop\deneme>npm install -g create-react-app
C:\Users\ugur\AppData\Roaming\npm\create-react-app -> C:\Users\ugur\
AppData\Roaming\npm\node_modules\create-react-app\index.js
C:\Users\ugur\AppData\Roaming\npm
`-- create-react-app@0.2.0
  +-- chalk@1.1.3
  | +-- ansi-styles@2.2.1
  | +-- escape-string-regexp@1.0.5
  | +-- has-ansi@2.0.0
  | | `-- ansi-regex@2.0.0
  | +-- strip-ansi@3.0.1
  | `-- supports-color@2.0.0
  +-- cross-spawn@4.0.0
  | +-- lru-cache@4.0.1
  | | +-- pseudomap@1.0.2
  | | `-- yallist@2.0.0
  | `-- which@1.2.10
  |   `-- isexe@1.1.2
  +-- minimist@1.2.0
  `-- semver@5.3.0

C:\Users\ugur\Desktop\deneme>create-react-app new_app

'create-react-app' is not recognized as an internal or external command, operable program or batch file.
</code>```

Also npm configuration path is like

C:\Users\ugur\AppData\Roaming\npm\node_modules\create-react-app\

答:
First Check your Node version. if your node version is 8 or greater then 8 then
use

'npx create-react-app my-app'

In the above version we need to change only one word that is npx

You don't need to do another things.
I hope this will help you

Body:
I am trying to set up react app using create-react-app command on windows pc. I already used it on my mac computer, and it works well. But I encounter a problem. Here my steps on command line. Am i missing something?

C:\Windows\system32>cd C:\Users\ugur\Desktop\deneme

C:\Users\ugur\Desktop\deneme>npm init

This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See 'npm help json' for definitive documentation on these fields
and exactly what they do.

Use 'npm install <pkg> --save' afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (deneme)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
license: (ISC)
About to write to C:\Users\ugur\Desktop\deneme\package.json:

{
   "name": "deneme",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "Ugur <ugur@abc.com.tr> (http://www.abc.com.tr)",
   "license": "ISC"
}

Is this ok? (yes)

C:\Users\ugur\Desktop\deneme>npm install -g create-react-app
C:\Users\ugur\AppData\Roaming\npm\create-react-app -> C:\Users\ugur\
AppData\Roaming\npm\node_modules\create-react-app\index.js
C:\Users\ugur\AppData\Roaming\npm
`-- create-react-app@0.2.0
  +-- chalk@1.1.3
  | +-- ansi-styles@2.2.1
  | +-- escape-string-regexp@1.0.5
  | +-- has-ansi@2.0.0
  | | `-- ansi-regex@2.0.0
  | +-- strip-ansi@3.0.1
  | `-- supports-color@2.0.0
  +-- cross-spawn@4.0.0
  | +-- lru-cache@4.0.1
  | | +-- pseudomap@1.0.2
  | | `-- yallist@2.0.0
  | `-- which@1.2.10
  |   `-- isexe@1.1.2
  +-- minimist@1.2.0
  `-- semver@5.3.0

C:\Users\ugur\Desktop\deneme>create-react-app new_app

'create-react-app' is not recognized as an internal or external command, operable program or batch file.

Also npm configuration path is like

C:\Users\ugur\AppData\Roaming\npm\node_modules\create-react-app\


来源: stackexchange

问:
How to prevent currency rounding errors with decimal variable type?
I am working on a payment plan calculator. I switched from 'double' to 'decimal' variable types to prevent rounding errors but I am still getting one somewhere. I came up with this data-set to use to test my code because there is a clear remainder:

Balance: $1,575.75

Down Payment: $500.00

Remaining Balance: $1,075.75

Number of Payments after the Down Payment: 9

Installment Amount: $119.53 (x8)

Remainder: $119.51

I switched my datatypes from double to decimal (obviously)
I tried re-writing the code multiple times calculating the same things in different ways (which is why some of the math at this point is less than 'minimalist')
I tried making my code more modular to find the rounding error

```<code>// Method within my WinForms project
public void CalculateInstallmentPayments()
{
    decimal currentBalance = Convert.ToDecimal(txtBalanceInput.Text); // Current Balance
    decimal downPayment = Convert.ToDecimal(txtDownPayment.Text); // Down Payment
    decimal installmentCount = sliderRemainingPmtCount.Value; // Installment Count
    decimal balanceAfterDP = currentBalance - downPayment; // Balance After Down Payment
    decimal installmentAmount = (balanceAfterDP / installmentCount); // Installment Amount
    decimal remainderPayment = (balanceAfterDP - (installmentAmount * (installmentCount - 1))); // Final Payment (Remainder)

    // Using Rich Text box as a 'Console' for debugging
    rtxtNotate.Text = ($"Current Balance: {currentBalance.ToString()}\nDown Payment: {downPayment.ToString("C")}\n" +
        $"Installment Count: {installmentCount.ToString()}\nInstallment Amount: {installmentAmount.ToString("C")}\n" +
        $"Remainder: {remainderPayment.ToString("C")}\n");
}
</code>```

This is currently the output:

Current Balance: 1575.75

Down Payment: $500.00

Installment Count: 9

Installment Amount: $119.53

Remainder: $119.53 -- This is the rounding error. It should read $119.51

I've been refactoring this code for hours and I feel like I'm missing something incredibly simple.

答:
Update the installmentAmount calculation as below</p>

```<code>decimal installmentAmount = Math.Round((balanceAfterDP / installmentCount),2);
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am working on a payment plan calculator. I switched from 'double' to 'decimal' variable types to prevent rounding errors but I am still getting one somewhere. I came up with this data-set to use to test my code because there is a clear remainder:

Balance: $1,575.75

Down Payment: $500.00

Remaining Balance: $1,075.75

Number of Payments after the Down Payment: 9

Installment Amount: $119.53 (x8)

Remainder: $119.51

I switched my datatypes from double to decimal (obviously)
I tried re-writing the code multiple times calculating the same things in different ways (which is why some of the math at this point is less than 'minimalist')
I tried making my code more modular to find the rounding error

// Method within my WinForms project
public void CalculateInstallmentPayments()
{
    decimal currentBalance = Convert.ToDecimal(txtBalanceInput.Text); // Current Balance
    decimal downPayment = Convert.ToDecimal(txtDownPayment.Text); // Down Payment
    decimal installmentCount = sliderRemainingPmtCount.Value; // Installment Count
    decimal balanceAfterDP = currentBalance - downPayment; // Balance After Down Payment
    decimal installmentAmount = (balanceAfterDP / installmentCount); // Installment Amount
    decimal remainderPayment = (balanceAfterDP - (installmentAmount * (installmentCount - 1))); // Final Payment (Remainder)

    // Using Rich Text box as a 'Console' for debugging
    rtxtNotate.Text = ($"Current Balance: {currentBalance.ToString()}\nDown Payment: {downPayment.ToString("C")}\n" +
        $"Installment Count: {installmentCount.ToString()}\nInstallment Amount: {installmentAmount.ToString("C")}\n" +
        $"Remainder: {remainderPayment.ToString("C")}\n");
}

This is currently the output:

Current Balance: 1575.75

Down Payment: $500.00

Installment Count: 9

Installment Amount: $119.53

Remainder: $119.53 -- This is the rounding error. It should read $119.51

I've been refactoring this code for hours and I feel like I'm missing something incredibly simple.

Body:
Update the installmentAmount calculation as below

decimal installmentAmount = Math.Round((balanceAfterDP / installmentCount),2);


问:
Generating insert statements from an sqlite table
Is there any tool or script available?</p>

答:
To generate output into a file follow these steps:</p>

```<code>$ sqlite3 mytable.db

sqlite> .output output.sql

sqlite> .dump table_name

sqlite> .quit
</code>```

ContentLicense: CC BY-SA 2.5

Body: Is there any tool or script available?

Body:
To generate output into a file follow these steps:

$ sqlite3 mytable.db

sqlite> .output output.sql

sqlite> .dump table_name

sqlite> .quit


问:
Updating a row in Microsoft SQL Server
I need to update a couple of rows in my database. But after updating the values and having confirmation that the values were updated, it reverts back to its original values.

Here is the script that I wrote

```<code>BEGIN TRAN;

UPDATE cars
SET sold = sold + 5
WHERE id IN (18, 25);

COMMIT TRAN;
</code>```

I ran the above script successfully, no errors were displayed and it showed that 2 rows were updated. I ran SELECT on the cars table and it showed that sold was indeed updated.

After that, I went and opened the system (a custom system for my project) that is using this database to view it on my admin panel. However, the sold column was not updated and showed the old values. When I ran SELECT again on the cars table, it returns my old values instead of the updated one.

Am I doing anything wrong? Since I have ran SELECT after updating and it showed that the values were indeed updated.

答:
begin try

BEGIN TRAN;
UPDATE cars
SET sold = sold + 5
WHERE id IN (18, 25) and isnumeric(sold)=1

isnumeric fileters only numerics bcz your trying add numeric values it does't meets casting problems

COMMIT TRAN;

Commits if it is ok

end try
begin catch

rollback

rollbacks the transaction if any exception occured.

end catch

Title: Updating a row in Microsoft SQL Server

Body:
I need to update a couple of rows in my database. But after updating the values and having confirmation that the values were updated, it reverts back to its original values.

Here is the script that I wrote

BEGIN TRAN;

UPDATE cars
SET sold = sold + 5
WHERE id IN (18, 25);

COMMIT TRAN;

I ran the above script successfully, no errors were displayed and it showed that 2 rows were updated. I ran SELECT on the cars table and it showed that sold was indeed updated.

After that, I went and opened the system (a custom system for my project) that is using this database to view it on my admin panel. However, the sold column was not updated and showed the old values. When I ran SELECT again on the cars table, it returns my old values instead of the updated one.

Am I doing anything wrong? Since I have ran SELECT after updating and it showed that the values were indeed updated.


问:
Scraping a json request `ak` parameter value
I'm currently trying to scrape embedded m3u8 url paths for self-study.

So far, I managed to pin down the request produces a json response with the m3u8 information.

For example, the https://headlines.yahoo.co.jp/videonews/ann?a=20190527-00000051-ann-soci page would make the following request:

https://feapi-yvpub.yahooapis.jp/v1/content/1579522?appid=dj0zaiZpPVZMTVFJR0FwZWpiMyZzPWNvbnN1bWVyc2VjcmV0Jng9YjU-&output=json&space_id=2078710307&domain=headlines.yahoo.co.jp&ak=e25b66ca8b37b7a383feecf4e084fe95&device_type=1100&thumb_width=1204&thumb_height=676&thumb_priority=l&thumb_bd=0

In order to make a successful request, the contentid (1579522), appid, space_id, device_type, and ak parameters are required. I managed to scrape the id and device_type values but have no idea where to get the ak value, which I guess stands for access key. Any idea on how to get this value?

Side note: I accessed the page through different browsers and they all produced the same ak parameter value in the request, so I'm guessing the value is not uniquely linked to each session, but I could be wrong.

Thanks in advance!

答:
The mystery argument ak is created by first combining space_id and domain into a single string such as "2078710307_headlines.yahoo.co.jp". Then it is run through an obfuscator which is located in player.script.js.

The obfuscator looks a bit complicated and seems to be made hard to understand on purpose. Below are debugger screenshots from the obfuscator main function, and a subroutine that it calls.

While a bit daunting, it doesn't seem impossible to convert this to a Python program so that you could then get ak by obfuscating any space_id and domain you needed in youtube-dl. Good luck.


问:
Read ENUM and its fields from a database (JPA)
I have a model object that's in fact an enum with fields and getters:

```<code>@Entity
public enum Type {
   TYPE1, TYPE2, TYPE3, TYPE4;

   @Column
   private Long id;
   @Column
   private String name;
   ...

   public String getName() {
      return this.name;
   }
   ...
}
</code>```

It compiles and runs fine. However, if I call a getter method, it returns null (it doesn't load any values stored in the database). Is this the standard behavior? Is there a way to make JPA load them?

答:
I'd say there is some misconception in this aproach:

Entities represent objects that can be stored in the database. In this case, the database (or any other persistent store) defines which instances are available.

Enums represent a fixed set of constants that are defined in source code. Thus the class itself defines which constants are available. In addition, it's generally bad practice to change the values of an enum, i.e. the name or id in your case.

You see that they are two quite different concepts which should be treated differently.

To store enums in entities (where the enum is a field of that entity), you could either use @Enumerated and store the name or ordinal of the enum, or (what we do more often) store one of the fields (we mostly use the id) and provide conversion methods.

If you want to store configurable "constants" in the database you might try and use plain entities for that, make the constructor private (Hibernate and other JPA providers should be able to deal with that) and provide an alternative implementation of the Enum class (you can't use the enum keyword though).

ContentLicense: CC BY-SA 3.0

Body:
I have a model object that's in fact an enum with fields and getters:

@Entity
public enum Type {
   TYPE1, TYPE2, TYPE3, TYPE4;

   @Column
   private Long id;
   @Column
   private String name;
   ...

   public String getName() {
      return this.name;
   }
   ...
}

It compiles and runs fine. However, if I call a getter method, it returns null (it doesn't load any values stored in the database). Is this the standard behavior? Is there a way to make JPA load them?


问:
How can I Access to variable in public in laravel
I have a project in Laravel and I want to show a article form my database in index.blade

so in Controller I get the article and keep it in a variable
problem is this : the image of that article is not in index.blade and it is in css in public directory so How Can I change it with that image that I've gotten form database? in my css file you can see that image as a url

Contorller

```<code> public function home(Request $request)
{
    $headerIntroduction=Category::where('name','معرفی کسب و کار')->get()->first()->articles()->get()->values()[1];

    return view('app.index',compact('headerIntroduction'));
</code>```

css

```<code>#slider-section, #home-section{
background-image:url(../../images/app/slider/1.jpg);
background-repeat:no-repeat;
background-size:cover;
background-color:#282f1f;
position:relative;
color:#fff;
padding: 130px 0;
</code>```

}

答:
You can use variables in Laravel's blade templates only if you talk about the view part. So using this variable in css file is not possible.

If you still want to use it. Then you have to use your styles which need your variables in style tag(, commonly known as inline css) in your index.blade.php file (or any blade file).

I am assuming the image 1.jpg file comes from your article then why won't you use the code below.

```<code><style>
 .backgroundclass
 {
  background-image:url(../../images/app/slider/{{your-article-variable}});
  background-repeat:no-repeat;
  background-size:cover;
  background-color:#282f1f;
  position:relative;
  color:#fff;
  padding: 130px 0;
  }
</style>
</code>```

Body:
I have a project in Laravel and I want to show a article form my database in index.blade

so in Controller I get the article and keep it in a variable
problem is this : the image of that article is not in index.blade and it is in css in public directory so How Can I change it with that image that I've gotten form database? in my css file you can see that image as a url

Contorller

 public function home(Request $request)
{
    $headerIntroduction=Category::where('name','معرفی کسب و کار')->get()->first()->articles()->get()->values()[1];

    return view('app.index',compact('headerIntroduction'));

css

#slider-section, #home-section{
background-image:url(../../images/app/slider/1.jpg);
background-repeat:no-repeat;
background-size:cover;
background-color:#282f1f;
position:relative;
color:#fff;
padding: 130px 0;

}

Body:
You can use variables in Laravel's blade templates only if you talk about the view part. So using this variable in css file is not possible.

If you still want to use it. Then you have to use your styles which need your variables in style tag(<style>css</style>, commonly known as inline css) in your index.blade.php file (or any blade file).

I am assuming the image 1.jpg file comes from your article then why won't you use the code below.

<style>
 .backgroundclass
 {
  background-image:url(../../images/app/slider/{{your-article-variable}});
  background-repeat:no-repeat;
  background-size:cover;
  background-color:#282f1f;
  position:relative;
  color:#fff;
  padding: 130px 0;
  }
</style>


问:
Opening a new tab with `send_keys(Keys.CONTROL + 't')` doesn't work and doesn't show any error
I am trying to open multiple tabs using this code but its syntax is not having any effect (i.e. the second tab is not opening) nor this code is showing any error. It just opens google and then stops</p>

```<code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(r'C:\chromedriver_win32\chromedriver')
driver.maximize_window()
driver.get('https://google.com')
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')'
</code>```

答:
This code should work for you :

Code :

```<code>driver.maximize_window()
driver.get("https://google.com")
url = "https://www.gmail.com"
driver.execute_script("window.open('"+url+"','_blank');");
</code>```

Body:
I am trying to open multiple tabs using this code but its syntax is not having any effect (i.e. the second tab is not opening) nor this code is showing any error. It just opens google and then stops

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(r'C:\chromedriver_win32\chromedriver')
driver.maximize_window()
driver.get('https://google.com')
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')'

Body:
This code should work for you :

Code :

driver.maximize_window()
driver.get("https://google.com")
url = "https://www.gmail.com"
driver.execute_script("window.open('"+url+"','_blank');");


问:
Unable to Locate Realm File on Device
I am attempting to locate the realm DB file on my device (iPhone) and I followed the steps here and here. However, I do not see any realm files in the folder AppData/Documents.

I print out the URL path as I run the app on my device and my simulator, and this is what I see:

```<code>//On device
/private/var/mobile/Containers/Shared/AppGroup/C7332EE4-1567-4C96-8392-7FBD0DC9C863/DB/default.realm

//On simulator
/Users/MYNAME/Library/Developer/CoreSimulator/Devices/D205C50D-F432-4A1F-80CB-FB3D91E0A1EA/data/Containers/Shared/AppGroup/5E67A740-A338-4583-9B9D-461F5D1A734A/DB/default.realm
</code>```

The URL written on the simulator appears to be any default URL where the Realm DB is written to. I can't seem to understand why can't I find the realm file at AppData/Documents on the actual device.

答:
Realm files are only created on disk when you call Realm() for the first time. Once you've created an instance of Realm, you can find the exact file route of that Realm by printing out realm.configuration.fileURL. You can normally use Realm.Configuration to set a different location of the Realm file on disk as opposed to the Documents directory.

Both of those file paths you displayed show that the file is located in a folder named DB and it appears to be in an app group (eg, a shared folder between apps and extensions) instead of your app's default Documents directory.

So with that being said, it would appear that somewhere in your app, a custom Realm.Configuration object is being used to create the Realm file somewhere else, which would explain why you can't find it in Documents.

Title: Unable to Locate Realm File on Device

Body:
I am attempting to locate the realm DB file on my device (iPhone) and I followed the steps here and here. However, I do not see any realm files in the folder AppData/Documents.

I print out the URL path as I run the app on my device and my simulator, and this is what I see:

//On device
/private/var/mobile/Containers/Shared/AppGroup/C7332EE4-1567-4C96-8392-7FBD0DC9C863/DB/default.realm

//On simulator
/Users/MYNAME/Library/Developer/CoreSimulator/Devices/D205C50D-F432-4A1F-80CB-FB3D91E0A1EA/data/Containers/Shared/AppGroup/5E67A740-A338-4583-9B9D-461F5D1A734A/DB/default.realm

The URL written on the simulator appears to be any default URL where the Realm DB is written to. I can't seem to understand why can't I find the realm file at AppData/Documents on the actual device.


问:
Got an unexpected response: {"code":"ECONNRESET"} when executing appium script in android emulator
I am running the following script:
this code is to open PlayStore in android emulator

```<code>DesiredCapabilities capabilities = new DesiredCapabilities();

        capabilities.setCapability("deviceName", "Nexus 5 API Q");
        capabilities.setCapability("automationName", "UiAutomator2");
        capabilities.setCapability("udid", "emulator-5554");
        capabilities.setCapability("platformVersion", "10");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("appPackage","com.android.vending");
 capabilities.setCapability("appActivity","com.google.android.finsky.activities.MainActivity");
//        capabilities.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
        capabilities.setCapability("noReset", "true");

        try {
            AppiumDriver<MobileElement> driver = new AndroidDriver<>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

        } catch (MalformedURLException e) {
            System.out.println(e.getMessage());
        }
    }
</code>```

My appium-doctor shows all upto date but on appium server I get the error:
    [Appium logs]https://www.dropbox.com/s/s0mros5scj4mikx/Screenshot%202019-05-27%2018.25.26.png?dl=0
Added the full appium server logs.

```<code> `[Appium] Welcome to Appium v1.13.0
[Appium] Non-default server args:
[Appium]   sessionOverride: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"com.google.android.finsky.activities.MainActivity","appPackage":"com.android.vending","platformVersion":"10","automationName":"UiAutomator2","platformName":"Android","udid":"emulator-5554","deviceName":"Nexus 5 API Q"},"capabilities":{"firstMatch":[{"appium:appActivity":"com.google.android.finsky.activities.MainActivity","appium:appPackage":"com.android.vending","appium:automationName":"UiAutomator2","appium:deviceName":"Nexus 5 API Q","platformName":"android","appium:platformVersion":"10","appium:udid":"emulator-5554"}]}}
[W3C] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.google.android.finsky.activities.MainActivity","appPackage":"com.android.vending","platformVersion":"10","automationName":"UiAutomator2","platformName":"Android","udid":"emulator-5554","deviceName":"Nexus 5 API Q"},null,{"firstMatch":[{"appium:appActivity":"com.google.android.finsky.activities.MainActivity","appium:appPackage":"com.android.vending","appium:automationName":"UiAutomator2","appium:deviceName":"Nexus 5 API Q","platformName":"android","appium:platformVersion":"10","appium:udid":"emulator-5554"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1559022178952 (11:12:58 GMT+0530 (IST))
[Appium] Appium v1.13.0 creating new AndroidUiautomator2Driver (v1.33.1) session
[Appium] Capabilities:
[Appium]   platformName: android
[Appium]   appActivity: com.google.android.finsky.activities.MainActivity
[Appium]   appPackage: com.android.vending
[Appium]   automationName: UiAutomator2
[Appium]   deviceName: Nexus 5 API Q
[Appium]   platformVersion: 10
[Appium]   udid: emulator-5554
[BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"appActivity":"com.google.... were provided
[BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[BaseDriver] Session created with session id: 1cea5658-2748-4d09-964a-25687e221d84
[ADB] Using 'adb' from '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Using device: emulator-5554
[ADB] Using 'adb' from '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb'
[ADB] Setting device id to emulator-5554
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 28
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 10
[ADB] Device API level: 28
[UiAutomator2] Relaxing hidden api policy
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put global hidden_api_policy_pre_p_apps 1'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put global hidden_api_policy_p_apps 1'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put global hidden_api_policy 1'
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] Using 'aapt' from '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/aapt'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.0' >= '2.14.0')
[ADB] There is no need to install/upgrade '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pgrep -f io\\.appium\\.settings'
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell appops set io.appium.settings android\:mock_location allow'
[Logcat] Starting logcat capture
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('3.5.1' >= '3.5.1')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk
[ADB] Using 'apksigner' from '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/apksigner'
[ADB] Starting '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/apksigner' with args '["verify","--print-certs","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB]
[ADB] '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk' is already signed.
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[ADB] Starting '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/apksigner' with args '["verify","--print-certs","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB]
[ADB] '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' is already signed.
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[ADB] Forwarding system: 8200 to device: 6790
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp\:8200 tcp\:6790'
[UiAutomator2] No app capability. Assuming it is already on the device
[ADB] Getting install status for com.android.vending
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package com.android.vending'
[ADB] 'com.android.vending' is installed
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.android.vending'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm clear com.android.vending'
[AndroidDriver] Performed fast reset on the installed 'com.android.vending' application (stop and clear)
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (Error: socket hang up)
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 3.5.1
[UiAutomator2] Using UIAutomator2 server from '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk' and test from '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[UiAutomator2] Error: The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability.
[UiAutomator2]     at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[UiAutomator2]     at UiAutomator2Server.errorAndThrow [as startSession] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/uiautomator2.js:192:15)
[UiAutomator2]     at process._tickCallback (internal/process/next_tick.js:68:7)
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.android.vending'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200'
[UiAutomator2] Restoring hidden api policy to the device default configuration
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings delete global hidden_api_policy_pre_p_apps'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings delete global hidden_api_policy_p_apps'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings delete global hidden_api_policy'
[BaseDriver] Event 'newSessionStarted' logged at 1559022211907 (11:13:31 GMT+0530 (IST))
[W3C] Encountered internal error running command: Error: The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability.
[W3C]     at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[W3C]     at UiAutomator2Server.errorAndThrow [as startSession] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/uiautomator2.js:192:15)
[W3C]     at process._tickCallback (internal/process/next_tick.js:68:7)
[HTTP] <-- POST /wd/hub/session 500 32957 ms - 1132
[HTTP]
</code>```

I am using Java 11 and appium 1.13

答:
uninstall uiautomator-server and uiautomator-server-test app from your emulator and try to run the script again.

Run following command in command prompt to uninstall the apps:

```<code>adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
</code>```

And then run your automation script. That works for me when i get ECONNRESET error.

Body:
I am running the following script:
this code is to open PlayStore in android emulator

DesiredCapabilities capabilities = new DesiredCapabilities();

        capabilities.setCapability("deviceName", "Nexus 5 API Q");
        capabilities.setCapability("automationName", "UiAutomator2");
        capabilities.setCapability("udid", "emulator-5554");
        capabilities.setCapability("platformVersion", "10");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("appPackage","com.android.vending");
 capabilities.setCapability("appActivity","com.google.android.finsky.activities.MainActivity");
//        capabilities.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
        capabilities.setCapability("noReset", "true");

        try {
            AppiumDriver<MobileElement> driver = new AndroidDriver<>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

        } catch (MalformedURLException e) {
            System.out.println(e.getMessage());
        }
    }

My appium-doctor shows all upto date but on appium server I get the error:
    [Appium logs]https://www.dropbox.com/s/s0mros5scj4mikx/Screenshot%202019-05-27%2018.25.26.png?dl=0
Added the full appium server logs.

 `[Appium] Welcome to Appium v1.13.0
[Appium] Non-default server args:
[Appium]   sessionOverride: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"com.google.android.finsky.activities.MainActivity","appPackage":"com.android.vending","platformVersion":"10","automationName":"UiAutomator2","platformName":"Android","udid":"emulator-5554","deviceName":"Nexus 5 API Q"},"capabilities":{"firstMatch":[{"appium:appActivity":"com.google.android.finsky.activities.MainActivity","appium:appPackage":"com.android.vending","appium:automationName":"UiAutomator2","appium:deviceName":"Nexus 5 API Q","platformName":"android","appium:platformVersion":"10","appium:udid":"emulator-5554"}]}}
[W3C] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.google.android.finsky.activities.MainActivity","appPackage":"com.android.vending","platformVersion":"10","automationName":"UiAutomator2","platformName":"Android","udid":"emulator-5554","deviceName":"Nexus 5 API Q"},null,{"firstMatch":[{"appium:appActivity":"com.google.android.finsky.activities.MainActivity","appium:appPackage":"com.android.vending","appium:automationName":"UiAutomator2","appium:deviceName":"Nexus 5 API Q","platformName":"android","appium:platformVersion":"10","appium:udid":"emulator-5554"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1559022178952 (11:12:58 GMT+0530 (IST))
[Appium] Appium v1.13.0 creating new AndroidUiautomator2Driver (v1.33.1) session
[Appium] Capabilities:
[Appium]   platformName: android
[Appium]   appActivity: com.google.android.finsky.activities.MainActivity
[Appium]   appPackage: com.android.vending
[Appium]   automationName: UiAutomator2
[Appium]   deviceName: Nexus 5 API Q
[Appium]   platformVersion: 10
[Appium]   udid: emulator-5554
[BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"appActivity":"com.google.... were provided
[BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[BaseDriver] Session created with session id: 1cea5658-2748-4d09-964a-25687e221d84
[ADB] Using 'adb' from '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Using device: emulator-5554
[ADB] Using 'adb' from '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb'
[ADB] Setting device id to emulator-5554
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 28
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 10
[ADB] Device API level: 28
[UiAutomator2] Relaxing hidden api policy
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put global hidden_api_policy_pre_p_apps 1'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put global hidden_api_policy_p_apps 1'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings put global hidden_api_policy 1'
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] Using 'aapt' from '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/aapt'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.0' >= '2.14.0')
[ADB] There is no need to install/upgrade '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pgrep -f io\\.appium\\.settings'
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell appops set io.appium.settings android\:mock_location allow'
[Logcat] Starting logcat capture
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('3.5.1' >= '3.5.1')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk
[ADB] Using 'apksigner' from '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/apksigner'
[ADB] Starting '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/apksigner' with args '["verify","--print-certs","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB]
[ADB] '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk' is already signed.
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[ADB] Starting '/Users/shivam.somani/Library/Android/sdk/build-tools/28.0.3/apksigner' with args '["verify","--print-certs","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB]
[ADB] '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' is already signed.
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[ADB] Forwarding system: 8200 to device: 6790
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp\:8200 tcp\:6790'
[UiAutomator2] No app capability. Assuming it is already on the device
[ADB] Getting install status for com.android.vending
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package com.android.vending'
[ADB] 'com.android.vending' is installed
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.android.vending'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm clear com.android.vending'
[AndroidDriver] Performed fast reset on the installed 'com.android.vending' application (stop and clear)
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (Error: socket hang up)
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 3.5.1
[UiAutomator2] Using UIAutomator2 server from '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.5.1.apk' and test from '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"code":"ECONNRESET"}
[UiAutomator2] Error: The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability.
[UiAutomator2]     at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[UiAutomator2]     at UiAutomator2Server.errorAndThrow [as startSession] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/uiautomator2.js:192:15)
[UiAutomator2]     at process._tickCallback (internal/process/next_tick.js:68:7)
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.android.vending'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200'
[UiAutomator2] Restoring hidden api policy to the device default configuration
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings delete global hidden_api_policy_pre_p_apps'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings delete global hidden_api_policy_p_apps'
[ADB] Running '/Users/shivam.somani/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings delete global hidden_api_policy'
[BaseDriver] Event 'newSessionStarted' logged at 1559022211907 (11:13:31 GMT+0530 (IST))
[W3C] Encountered internal error running command: Error: The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability.
[W3C]     at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[W3C]     at UiAutomator2Server.errorAndThrow [as startSession] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/uiautomator2.js:192:15)
[W3C]     at process._tickCallback (internal/process/next_tick.js:68:7)
[HTTP] <-- POST /wd/hub/session 500 32957 ms - 1132
[HTTP]

I am using Java 11 and appium 1.13

Body:
uninstall uiautomator-server and uiautomator-server-test app from your emulator and try to run the script again.

Run following command in command prompt to uninstall the apps:

adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test

And then run your automation script. That works for me when i get ECONNRESET error.


问:
SSLHandshakeException: Received fatal alert: access_denied
Getting sslhandshake exception with access denied error while invoking a GET call using spring boot Rest Template.

I am developing a java client to GET metrics from prometheus server.
Creating a RestTemplate with basic authentication and sslContext with Tls1 ,1.1 & 1.2.

But getting the below exception when the GET call is invoked.

```<code>org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://a5faff994509b11e99f7d0285e129587-2110882066.us-east-1.elb.amazonaws.com/api/v1/query": Received fatal alert: access_denied; nested exception is javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:744)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:311)
    at com.opscx.prometheus.PrometheusPocApplication.main(PrometheusPocApplication.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:87)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
    at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:108)
    at com.opscx.prometheus.BasicAuthInterceptor.intercept(BasicAuthInterceptor.java:35)
    at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:92)
    at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:76)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:735)
    ... 11 more
</code>```

class org.springframework.web.client.ResourceAccessException

Tried debugging with -Djavax.net.debug=ssl:handshake:verbose but couldn't make out the issue.

Here is the out of the debug log

```<code>trigger seeding of SecureRandom
done seeding SecureRandom
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1.1
%% No cached client session
*** ClientHello, TLSv1.2
RandomCookie:  GMT: 1542173365 bytes = { 177, 65, 144, 227, 154, 51, 246, 129, 182, 251, 188, 204, 134, 212, 156, 222, 208, 90, 86, 46, 87, 105, 16, 134, 146, 83, 144, 225 }
Session ID:  {}
Cipher Suites: [TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
Compression Methods:  { 0 }
Extension elliptic_curves, curve names: {secp256r1, secp384r1, secp521r1, sect283k1, sect283r1, sect409k1, sect409r1, sect571k1, sect571r1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Extension extended_master_secret
Extension server_name, server_name: [type=host_name (0), value=a5faff994509b11e99f7d0285e129587-2110882066.us-east-1.elb.amazonaws.com]
***
main, WRITE: TLSv1.2 Handshake, length = 273
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1.2 ALERT:  fatal, access_denied
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
</code>```

Here is my code

```<code>SSLContext sslContext = null;
        try {
            sslContext = SSLContextBuilder.create()
                    .loadTrustMaterial(null, (chain, authType) -> true)
                    .build();

        } catch (KeyManagementException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (KeyStoreException e) {
            e.printStackTrace();
        }

        SSLConnectionSocketFactory sslConnectionSocketFactory =
                new SSLConnectionSocketFactory(sslContext,

                        new String[] { "TLSv1","TLSv1.1","TLSv1.2" },
                        //null,
                        null,
                        new LaxHostnameVerifier());

        PoolingHttpClientConnectionManager poolingHttpClientConnectionManager =
                new PoolingHttpClientConnectionManager(RegistryBuilder.<ConnectionSocketFactory> create()
                        .register("http",
                                PlainConnectionSocketFactory.getSocketFactory())
                        .register("https",
                                sslConnectionSocketFactory)
                        .build());

        CloseableHttpClient httpClient = HttpClientBuilder.create().setConnectionManager(poolingHttpClientConnectionManager).build();
        return httpClient;
</code>```

I am creating an sslcontext with all three TLS protocols.
The out put of the debug log is confusing to me.

```<code>    main, WRITE: TLSv1.2 Handshake, length = 273
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1.2 ALERT:  fatal, access_denied
</code>```

The clienthello is done with TLSV1.2, why is there a READ message of a TLSv1 alert ? and then strangely a RECV message of TLSv1.2 ALERT ?

If the server is able to send an alert with TLSv1.2 why don't it accept the handshake request ?

All the cipher suites are enabled and it should agree upon any one of the cipher. There are common ciphers both the sides.

The same code works with other REST based servers. I don't usually send a certificate with the call and it is supposed to work.

NOTE: The same code worked last night IST. It is strange that some time it works and sometimes it doesn't

I have spent more time on this and couldn't get enough answer of an access denied error. Would be great if anyone could give me some insights on this.

答:
The clienthello is done with TLSV1.2, why is there a READ message of a TLSv1 alert ? and then strangely a RECV message of TLSv1.2 ALERT ?

The server decided that it does not like this client. From the description of the TLS alwert:

access_denied

A valid certificate was received, but when access control was
applied, the sender decided not to proceed with negotiation.  This
message is always fatal.

Thus, you need to check with the server provider of what the actual requirements of the server regarding the client are. It might for example that the client needs to provide a specific client certificate and that you've provided none or the wrong one.

Body:
Getting sslhandshake exception with access denied error while invoking a GET call using spring boot Rest Template.

I am developing a java client to GET metrics from prometheus server.
Creating a RestTemplate with basic authentication and sslContext with Tls1 ,1.1 & 1.2.

But getting the below exception when the GET call is invoked.

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://a5faff994509b11e99f7d0285e129587-2110882066.us-east-1.elb.amazonaws.com/api/v1/query": Received fatal alert: access_denied; nested exception is javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:744)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:311)
    at com.opscx.prometheus.PrometheusPocApplication.main(PrometheusPocApplication.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:87)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
    at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:108)
    at com.opscx.prometheus.BasicAuthInterceptor.intercept(BasicAuthInterceptor.java:35)
    at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:92)
    at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:76)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:735)
    ... 11 more

class org.springframework.web.client.ResourceAccessException

Tried debugging with -Djavax.net.debug=ssl:handshake:verbose but couldn't make out the issue.

Here is the out of the debug log

trigger seeding of SecureRandom
done seeding SecureRandom
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1.1
%% No cached client session
*** ClientHello, TLSv1.2
RandomCookie:  GMT: 1542173365 bytes = { 177, 65, 144, 227, 154, 51, 246, 129, 182, 251, 188, 204, 134, 212, 156, 222, 208, 90, 86, 46, 87, 105, 16, 134, 146, 83, 144, 225 }
Session ID:  {}
Cipher Suites: [TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
Compression Methods:  { 0 }
Extension elliptic_curves, curve names: {secp256r1, secp384r1, secp521r1, sect283k1, sect283r1, sect409k1, sect409r1, sect571k1, sect571r1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Extension extended_master_secret
Extension server_name, server_name: [type=host_name (0), value=a5faff994509b11e99f7d0285e129587-2110882066.us-east-1.elb.amazonaws.com]
***
main, WRITE: TLSv1.2 Handshake, length = 273
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1.2 ALERT:  fatal, access_denied
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied

Here is my code

SSLContext sslContext = null;
        try {
            sslContext = SSLContextBuilder.create()
                    .loadTrustMaterial(null, (chain, authType) -> true)
                    .build();

        } catch (KeyManagementException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (KeyStoreException e) {
            e.printStackTrace();
        }

        SSLConnectionSocketFactory sslConnectionSocketFactory =
                new SSLConnectionSocketFactory(sslContext,

                        new String[] { "TLSv1","TLSv1.1","TLSv1.2" },
                        //null,
                        null,
                        new LaxHostnameVerifier());

        PoolingHttpClientConnectionManager poolingHttpClientConnectionManager =
                new PoolingHttpClientConnectionManager(RegistryBuilder.<ConnectionSocketFactory> create()
                        .register("http",
                                PlainConnectionSocketFactory.getSocketFactory())
                        .register("https",
                                sslConnectionSocketFactory)
                        .build());

        CloseableHttpClient httpClient = HttpClientBuilder.create().setConnectionManager(poolingHttpClientConnectionManager).build();
        return httpClient;

I am creating an sslcontext with all three TLS protocols.
The out put of the debug log is confusing to me.

    main, WRITE: TLSv1.2 Handshake, length = 273
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1.2 ALERT:  fatal, access_denied

The clienthello is done with TLSV1.2, why is there a READ message of a TLSv1 alert ? and then strangely a RECV message of TLSv1.2 ALERT ?

If the server is able to send an alert with TLSv1.2 why don't it accept the handshake request ?

All the cipher suites are enabled and it should agree upon any one of the cipher. There are common ciphers both the sides.

The same code works with other REST based servers. I don't usually send a certificate with the call and it is supposed to work.

NOTE: The same code worked last night IST. It is strange that some time it works and sometimes it doesn't

I have spent more time on this and couldn't get enough answer of an access denied error. Would be great if anyone could give me some insights on this.


问:
Create Component without folder
I need to create a component without the folder. I am using Angular-Cli command ng g c testing to create the component. But, the command creates an folder wrapper for the newly created component.

答:
You can use --flat flag.

```<code>ng g c test --flat
</code>```

For more information follow this link

flat = true | false

When true creates the new files at the top level of the current project.

Default: false

Title: Create Component without folder

Body:
You can use --flat flag.

ng g c test --flat

For more information follow this link

flat = true | false

When true creates the new files at the top level of the current project.

Default: false


问:
what is the difference between Using Xml Parser and Xpath in XML
I Would like to know what are the difference between Using Xml Parser and Xpath in XML.Because, both are used to get the any pieces of information in the xml document.That why i asked this question...</p>

答:
XPath is a query language for selecting nodes from an XML.

An XML parser is a program that reads your XML and produces some kind of data structure, usually a Document Object Model (DOM) that you can programmatically manipulate in your programming language (java, perl, etc.).


问:
Im using Django as Backend and Reactjs as Frontend, So what must i use to route the urls
What must i use for routing urls?
Using React-Router or Urls from Django?

ReactJS Route:

```<code><Router>
<Route path="/" exact component={StatefullComponent} />
<Route path="/blog" exact component={BlogPost} />
<Route path="/blog/detail/:id" component={DetailPost} />
</Router>
</code>```

Django Route(Urls):

```<code>urlpatterns = [
    url(r'^blog/', include('blog.urls', namespace='blog')),
]
</code>```

Question:
1.Which route is better?
2.Can i use both route for my urls?
3.If i use django urls, my frontend will using single page route like react did?

答:
I personally prefer ReactJS handle the routing, where using django to serve the react. So I prefer using the following pattern in django:

```<code>urlpatterns = [
    url(<b>r'^.*$', TemplateView.as_view(template_name='react_template_name.html')</b>),
]</code>```

In this pattern, url accepts any path and servers ReactJs app in that. Then React Router takes over and does the rest of the routing.

Body:
What must i use for routing urls?
Using React-Router or Urls from Django?

ReactJS Route:

<Router>
<Route path="/" exact component={StatefullComponent} />
<Route path="/blog" exact component={BlogPost} />
<Route path="/blog/detail/:id" component={DetailPost} />
</Router>

Django Route(Urls):

urlpatterns = [
    url(r'^blog/', include('blog.urls', namespace='blog')),
]

Question:
1.Which route is better?
2.Can i use both route for my urls?
3.If i use django urls, my frontend will using single page route like react did?

Body:
I personally prefer ReactJS handle the routing, where using django to serve the react. So I prefer using the following pattern in django:

urlpatterns = [
    url(r'^.*$', TemplateView.as_view(template_name='react_template_name.html')),
]

In this pattern, url accepts any path and servers ReactJs app in that. Then React Router takes over and does the rest of the routing.


问:
Reset Flutter CustomScrollView on state change
I'm building a vertically scrolling calendar and I've implemented my days as multiple SliverLists so that I can init with a certain day focused while still having days in the past and future.

The problem is, when the focusDate changes via a state change in a parent, the list updates the dates correctly, but keeps its scroll position. For example, if I'm scrolled to the top of the list, then change the focusDate the days update, but I'm still at the top of the list.

I'm looking to completely replace the list (not just the days) when the focusDate changes. This happens when a date is picked from a date picker. Therefore, new data will need to be fetched anyway and a new CustomScrollView can be created and focused on the correct day.

```<code>import 'package:flutter/material.dart';

import 'day.dart';

class DaysManager extends StatelessWidget {
  List<Day> days;

  DaysManager({DateTime focusDate}) {
    final DateTime startDate = focusDate.subtract(Duration(days: 30));
    days = List.generate(61, (int index) {
      return Day(
        date: startDate.add(Duration(days: index)),
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return _buildScrollView();
  }

  CustomScrollView _buildScrollView() {
    final focusKey = ValueKey('focus');

    return CustomScrollView(
      center: focusKey,
      slivers: <Widget>[
        SliverList(
          delegate: SliverChildListDelegate(
            days.sublist(0, 31).reversed.toList(),
          ),
        ),
        SliverList(
          key: focusKey,
          delegate: SliverChildListDelegate(
            days.sublist(31, 32),
          ),
        ),
        SliverList(
          delegate: SliverChildListDelegate(
            days.sublist(32),
          ),
        ),
      ],
    );
  }
}
</code>```

答:
```<code>        ScrollController _scrollController;
        @override
        void initState() {
          super.initState();
          _scrollController = new ScrollController();
        }

        @override
        Widget build(BuildContext context) {
          return ListView.builder(itemBuilder: (context, index){
            return FlatButton(onPressed: (){
              _scrollController.animateTo(index*(YOUR_VIEW_HEIGHT), duration: new Duration(seconds: 2), curve: Curves.ease);
            }, child: Text("Item   $index"));
          }, controller: _scrollController,);
        }
</code>```

Body:
I'm building a vertically scrolling calendar and I've implemented my days as multiple SliverLists so that I can init with a certain day focused while still having days in the past and future.

The problem is, when the focusDate changes via a state change in a parent, the list updates the dates correctly, but keeps its scroll position. For example, if I'm scrolled to the top of the list, then change the focusDate the days update, but I'm still at the top of the list.

I'm looking to completely replace the list (not just the days) when the focusDate changes. This happens when a date is picked from a date picker. Therefore, new data will need to be fetched anyway and a new CustomScrollView can be created and focused on the correct day.

import 'package:flutter/material.dart';

import 'day.dart';

class DaysManager extends StatelessWidget {
  List<Day> days;

  DaysManager({DateTime focusDate}) {
    final DateTime startDate = focusDate.subtract(Duration(days: 30));
    days = List.generate(61, (int index) {
      return Day(
        date: startDate.add(Duration(days: index)),
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return _buildScrollView();
  }

  CustomScrollView _buildScrollView() {
    final focusKey = ValueKey('focus');

    return CustomScrollView(
      center: focusKey,
      slivers: <Widget>[
        SliverList(
          delegate: SliverChildListDelegate(
            days.sublist(0, 31).reversed.toList(),
          ),
        ),
        SliverList(
          key: focusKey,
          delegate: SliverChildListDelegate(
            days.sublist(31, 32),
          ),
        ),
        SliverList(
          delegate: SliverChildListDelegate(
            days.sublist(32),
          ),
        ),
      ],
    );
  }
}


问:
How to restore normal "New Project" windows on Visual Studio 2019
After upgrading to Visual Studio 2019 I noticed the very unpleasant change of the "new project" window, as announced here. As with much of the community I totally hate the new useless window and would pretty much prefer to use the normal old one.

To show what I'm refering to, here are screenshots of the old and the new screens:

VS 2017 and earlier:

VS 2019:

This is somewhat similar to this other question asking about the start page, but this time, it's about the new project dialog.

How can I restore the old, full featured dialog instead of the broken new one?

答:
Officially it is not possible and Microsoft ignores all negative feedback about it.

But there is now an extension called Classic 'New Project' Dialog that brings back the old and better tree based dialog:

After installing the extension, enable it in Settings

you can use it when you create a new project

I tested it in VS 2019 Update 2 Preview 1 and it works fine.


问:
Exporting multiple sheets to PDF and getting run time error VBA
I keep getting RunTime error of '(2147024773)8007007b' everytime I execute the macro, I don't know what I have done wrong. Any hints on how to fix this? </p>

```<code>Dim wsA As Worksheet
Set wsA = ActiveSheet
Sheets("Main_Page").Activate
ActiveSheet.Range("A01:F30").Select
Sheets("Sheet3").Activate
ActiveSheet.Range("A01:B6").Select

Sheets(Array("Sheet1", "Sheet3")).Select

Selection.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & strFilename & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

End Sub
</code>```

答:
I don't see you creating the variable and assigning a value to it you can try this. Also try avoiding select and activate.</p>

```<code>Sub SaveMultipleSheetsAsPDF()
Dim strFilename As String
Dim sht1 As Range
Dim sht3 As Range

Set sht1 = Worksheets("Main_Page").Range("A1:F30")
Set sht3 = Worksheets("Sheet3").Range("A1:B6")
strFilename = "mySheets"

sht1.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & strFilename & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

sht3.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & strFilename & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

End Sub
</code>```

Body:
I keep getting RunTime error of '(2147024773)8007007b' everytime I execute the macro, I don't know what I have done wrong. Any hints on how to fix this?

Dim wsA As Worksheet
Set wsA = ActiveSheet
Sheets("Main_Page").Activate
ActiveSheet.Range("A01:F30").Select
Sheets("Sheet3").Activate
ActiveSheet.Range("A01:B6").Select

Sheets(Array("Sheet1", "Sheet3")).Select

Selection.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & strFilename & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

End Sub

Body:
I don't see you creating the variable and assigning a value to it you can try this. Also try avoiding select and activate.

Sub SaveMultipleSheetsAsPDF()
Dim strFilename As String
Dim sht1 As Range
Dim sht3 As Range

Set sht1 = Worksheets("Main_Page").Range("A1:F30")
Set sht3 = Worksheets("Sheet3").Range("A1:B6")
strFilename = "mySheets"

sht1.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & strFilename & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

sht3.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\" & strFilename & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

End Sub