问:
Expression cannot be a selector (occur after a dot) in Kotlin
I am using Kotlin library to code my android app. I have one activity with one button. I have set click listener on it, I am displaying a toast on clicking on button.

```<code>import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        submitButton.setOnClickListener({ view ->
            Toast.makeText(MainActivity.this, "Clicked", Toast.LENGTH_SHORT).show()
        })
    }
}
</code>```

I am getting a message expression cannot be a selector (occur after a dot) on MainActivity.this in click listener.

What is the way to do this in Kotlin ?

答:
```<code>Toast.makeText(this@MainActivity, "Clicked", Toast. LENGTH_SHORT).show()
</code>```

This is the right way to do in Kotlin

Body:
I am using Kotlin library to code my android app. I have one activity with one button. I have set click listener on it, I am displaying a toast on clicking on button.

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        submitButton.setOnClickListener({ view ->
            Toast.makeText(MainActivity.this, "Clicked", Toast.LENGTH_SHORT).show()
        })
    }
}

I am getting a message expression cannot be a selector (occur after a dot) on MainActivity.this in click listener.

What is the way to do this in Kotlin ?

Body:
Toast.makeText(this@MainActivity, "Clicked", Toast. LENGTH_SHORT).show()

This is the right way to do in Kotlin


来源: stackexchange

问:
How to deploy a Spring Boot (Executable Jar) to Azure App Service
The problem is that currently Azure offers support for deployment of a WAR file into Tomcat.  Spring Boot does support deployment via a WAR, however this negates some of the benefits of using Spring Boot.</p>

答:
The first problem is that you need a way to communicate to the service what you are trying to run.  This can be handled by adding a web.config to the site\wwwroot folder of the app service.

```<code><?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
        arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\@project.artifactId@-@project.version@.jar"">
        </httpPlatform>
    </system.webServer>
</configuration>
</code>```

To keep the web.config out of the src I prefer to place it under {project root}/wwwroot

Using Maven you can add the following and get a project / release dynamically included on package.

```<code>    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/wwwroot</directory>
                <filtering>true</filtering>
                <targetPath>${basedir}/target</targetPath>
            </resource>
        </resources>
    </build>
</code>```

Now place the jar file and the web.config within the Azure App Service.

If you are using VSTS you will need 3 tasks

Task 1: Stop the Azure App

Task 2: FTP or SSH to upload the jar and web.config to the App Service

Task 3: Start the App Service.

ContentLicense: CC BY-SA 3.0

Body:
The first problem is that you need a way to communicate to the service what you are trying to run.  This can be handled by adding a web.config to the site\wwwroot folder of the app service.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
        arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\@project.artifactId@-@project.version@.jar&quot;">
        </httpPlatform>
    </system.webServer>
</configuration>

To keep the web.config out of the src I prefer to place it under {project root}/wwwroot

Using Maven you can add the following and get a project / release dynamically included on package.

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/wwwroot</directory>
                <filtering>true</filtering>
                <targetPath>${basedir}/target</targetPath>
            </resource>
        </resources>
    </build>

Now place the jar file and the web.config within the Azure App Service.

If you are using VSTS you will need 3 tasks

Task 1: Stop the Azure App

Task 2: FTP or SSH to upload the jar and web.config to the App Service

Task 3: Start the App Service.


问:
How to copy all rows from one SQL Server table to a table on a different SQL Server
I have a database in SQL Server 2008 and the same database (backup) in SQL Server 2016. All the schema and tables are exactly the same.

I need to copy all rows from a table in SQL Server 2008 to the same table in SQL Server 2016. How to achieve this?

答:
Another Option you can use OpenRowSet like:

```<code>SELECT * into insertTable FROM
OPENROWSET('SQLNCLI', 'Server=ServerIP\ServerExtentionNameIfhas;Database=dbname;Uid=uname;PWD=password;'
,'SET FMTONLY OFF;SET NOCOUNT ON;SELECT * FROM fromTable')
</code>```

this will create automatically a table name which is inserTable and copy all rows into it.

Body:
Another Option you can use OpenRowSet like:

SELECT * into insertTable FROM
OPENROWSET('SQLNCLI', 'Server=ServerIP\ServerExtentionNameIfhas;Database=dbname;Uid=uname;PWD=password;'
,'SET FMTONLY OFF;SET NOCOUNT ON;SELECT * FROM fromTable')

this will create automatically a table name which is inserTable and copy all rows into it.


问:
Permission denied but publickey added on server?
In ~/.ssh/authorized_keys I have added a public-key of a user that would like to connect to the server.

When that user tries to connect he gets a Permission denied (publickey) error. Error log:

```<code>input_userauth_request: invalid user USERNAME [preauth]
</code>```

In my config (/etc/ssh/sshd_config) file I have:

```<code>AllowUsers USERNAME
</code>```

In my config (/~.ssh/config), I have:

```<code>Host hostname
  User root
  User USERNAME
  HostName IP address
  IdentityFile ~/.ssh/id_rsa
  PubKeyAuthentication yes
</code>```

Why can't he login to the server?

答:
input_userauth_request: invalid user USERNAME [preauth]

Means that the user does not exist on the server. Is it a local user or a user from some LDAP/IdM? If it should be local, and is not in /etc/passwd, you should add it first (for example using useradd).

```<code>User root
User USERNAME
</code>```

This is also wrong. In this case, root user will be used, not your USERNAME.

Body:
In ~/.ssh/authorized_keys I have added a public-key of a user that would like to connect to the server.

When that user tries to connect he gets a Permission denied (publickey) error. Error log:

input_userauth_request: invalid user USERNAME [preauth]

In my config (/etc/ssh/sshd_config) file I have:

AllowUsers USERNAME

In my config (/~.ssh/config), I have:

Host hostname
  User root
  User USERNAME
  HostName IP address
  IdentityFile ~/.ssh/id_rsa
  PubKeyAuthentication yes

Why can't he login to the server?

Body:
input_userauth_request: invalid user USERNAME [preauth]

Means that the user does not exist on the server. Is it a local user or a user from some LDAP/IdM? If it should be local, and is not in /etc/passwd, you should add it first (for example using useradd).

User root
User USERNAME

This is also wrong. In this case, root user will be used, not your USERNAME.


问:
UINavigationButton in Tabbar - possible rejection?
Someone wants me to make an App, where the NavigationButton (usually top left) shall be put into the Tabbar (in this case leftmost Button of the Tabbar). I wonder if that might yield a possible rejection.

It reads in the Appstore Review Guidelines:

a) Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected

-> Could that also include NavButtons?

Furthermore:

b) Apps that do not use system provided items, such as buttons and icons, correctly and as described in the Apple iPhone Human Interface Guidelines and the Apple iPad Human Interface Guidelines may be rejected

I do not know whether we crossed the line there.

What's your opinion on this?

答: Instapaper has a back button in a tab bar at the bottom. I think that if you decide to do this, you shouldn't use the system back button but create your own. Using the system button feels like a HIG violation.</p>

ContentLicense: CC BY-SA 2.5


问:
Android: force gradle to include only one version of a library
I use 'com.android.support:support-v4:23.3.0' in my build.gradle but when explore external libraries I see two version of support-v4 library (23.3.0 & 24.0.0). How can I find which dependency use support-v4:24.0.0 library?  How can I force gradle to only add version 23.3.0?

this is my dependency list in build.gradle:

```<code>dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile ('com.nightonke:wowoviewpager:1.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.j256.ormlite:ormlite-android:5.0'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/easyandroidanimationslibrary-v0.5.jar')
    compile files('libs/apache-httpcomponents-httpclient.jar')
    compile files('libs/apache-httpcomponents-httpcore.jar')
    compile 'co.ronash.android:pushe-base:1.2.0'
    compile 'com.google.android.gms:play-services-gcm:9.4.0'
    compile('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
        transitive = true;
    }
    compile files('libs/btsdk.jar')
    compile project(':zxing_barcode') // this project include the same version of support-v4 library
    compile project(':cropper')// this project include the same version of support-v4 library
    compile project(':taptargetview')// this project include the same version of support-v4 library
    compile ('me.cheshmak:analytics:1.0.28'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
    compile ('com.github.rey5137:material:1.2.2'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('jp.wasabeef:recyclerview-animators:2.2.3'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.github.deano2390:MaterialShowcaseView:1.1.0@aar'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.google.code.gson:gson:2.4'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:answers:1.3.11@aar') {
        transitive = true;
    }

    compile ('cat.ereza:customactivityoncrash:1.5.0'){
        exclude group: 'com.android.support', module:'support-v4'
    }
}
</code>```

I use exclude group: 'com.android.support', module:'support-v4' to avoid others adding support library but no change happened.

答:
I can't add comment so I link here:

https://stackoverflow.com/a/37357786/3442734

use:

```<code>configurations.all {
    resolutionStrategy.force 'com.android.support:support-v4:24.0.0'
}
</code>```

Body:
I use 'com.android.support:support-v4:23.3.0' in my build.gradle but when explore external libraries I see two version of support-v4 library (23.3.0 & 24.0.0). How can I find which dependency use support-v4:24.0.0 library?  How can I force gradle to only add version 23.3.0?

this is my dependency list in build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile ('com.nightonke:wowoviewpager:1.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.j256.ormlite:ormlite-android:5.0'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/easyandroidanimationslibrary-v0.5.jar')
    compile files('libs/apache-httpcomponents-httpclient.jar')
    compile files('libs/apache-httpcomponents-httpcore.jar')
    compile 'co.ronash.android:pushe-base:1.2.0'
    compile 'com.google.android.gms:play-services-gcm:9.4.0'
    compile('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
        transitive = true;
    }
    compile files('libs/btsdk.jar')
    compile project(':zxing_barcode') // this project include the same version of support-v4 library
    compile project(':cropper')// this project include the same version of support-v4 library
    compile project(':taptargetview')// this project include the same version of support-v4 library
    compile ('me.cheshmak:analytics:1.0.28'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
    compile ('com.github.rey5137:material:1.2.2'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('jp.wasabeef:recyclerview-animators:2.2.3'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.github.deano2390:MaterialShowcaseView:1.1.0@aar'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.google.code.gson:gson:2.4'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:answers:1.3.11@aar') {
        transitive = true;
    }

    compile ('cat.ereza:customactivityoncrash:1.5.0'){
        exclude group: 'com.android.support', module:'support-v4'
    }
}

I use exclude group: 'com.android.support', module:'support-v4' to avoid others adding support library but no change happened.

Body:
I can't add comment so I link here:

https://stackoverflow.com/a/37357786/3442734

use:

configurations.all {
    resolutionStrategy.force 'com.android.support:support-v4:24.0.0'
}


问:
Click option is not working in Appium program
```<code>public class basic extends base{

    public static void main(String[] args) throws MalformedURLException {
        // TODO Auto-generated method stub

        AndroidDriver<AndroidElement>  driver=  Capabilities();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click();
    }
}
</code>```

This is my program. When I ran, only the application gets invoke but preference menu is not opening. Please refer below image.

Appium Preference

This is appium log

info: --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"requiredCapabilities":{}}
  info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_131)
  info: [debug] No appActivity desired capability or server param. Parsing from apk.
  info: [debug] No appPackage desired capability or server param. Parsing from apk.
  info: [debug] Using local app from desired caps: C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] Creating new appium session 2ee7300a-fdaf-4b56-8b3f-17688e987e33
  info: Starting android appium
  info: [debug] Getting Java version
  info: Java version is: 1.8.0_77
  info: [debug] Checking whether adb is present
  info: [debug] Using adb from C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe
  info: [debug] Parsing package and activity from app manifest
  info: [debug] Checking whether aapt is present
  info: [debug] Using aapt from C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
  info: [debug] Extracting package and launch activity from manifest.
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe dump badging C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] badging package: io.appium.android.apis
  info: [debug] badging act: io.appium.android.apis.ApiDemos
  info: [debug] Parsed package and activity are: io.appium.android.apis/io.appium.android.apis.ApiDemos
  info: [debug] Using fast reset? true
  info: [debug] Preparing device for session
  info: [debug] Checking whether app is actually present
  info: Retrieving device
  info: [debug] Trying to find a connected android device
  info: [debug] Getting connected devices...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe devices
  info: [debug] 1 device(s) connected
  info: Found device 9b56dc7f0603
  info: [debug] Setting device id to 9b56dc7f0603
  info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 wait-for-device
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "echo 'ready'"
  info: [debug] Starting logcat capture
  info: [debug] Getting device API level
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.sdk"
  info: [debug] Device is at API Level 23
  info: Device API level is: 23
  info: [debug] Extracting strings for language: default
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop persist.sys.language"
  info: [debug] Current device persist.sys.language:
  info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk" "C:\Users\Sachin\AppData\Local\Temp\io.appium.android.apis"
  info: [debug] Reading strings from converted strings.json
  info: [debug] Setting language to default
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 push "C:\Users\Sachin\AppData\Local\Temp\io.appium.android.apis\strings.json" /data/local/tmp
  info: [debug] Checking whether aapt is present
  info: [debug] Using aapt from C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
  info: [debug] Retrieving process from manifest.
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe dump xmltree C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk AndroidManifest.xml
  info: [debug] Set app process to: io.appium.android.apis
  info: [debug] Not uninstalling app since server not started with --full-reset
  info: [debug] Checking app cert for C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk.
  info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] App already signed.
  info: [debug] Zip-aligning C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] Checking whether zipalign is present
  info: [debug] Using zipalign from C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\zipalign.exe
  info: [debug] Zip-aligning apk.
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\zipalign.exe -f 4 C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk C:\Users\Sachin\AppData\Local\Temp\11756-5248-1j4mqt2\appium.tmp
  info: [debug] MD5 for app is 29649242b53e9a67ba855b067422713c
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "ls /data/local/tmp/29649242b53e9a67ba855b067422713c.apk"
  info: [debug] Getting install status for io.appium.android.apis
  info: [debug] Getting device API level
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.sdk"
  info: [debug] Device is at API Level 23
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "pm list packages -3 io.appium.android.apis"
  info: [debug] App is installed
  info: App is already installed, resetting app
  info: [debug] Running fast reset (stop and clear)
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "am force-stop io.appium.android.apis"
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "pm clear io.appium.android.apis"
  info: [debug] Forwarding system:4724 to device:4724
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 forward tcp:4724 tcp:4724
  info: [debug] Pushing appium bootstrap to device...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
  info: [debug] Pushing settings apk to device...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
  info: [debug] Pushing unlock helper app to device...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
  info: Starting App
  info: [debug] Attempting to kill all 'uiautomator' processes
  info: [debug] Getting all processes with 'uiautomator'
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "ps 'uiautomator'"
  info: [debug] No matching processes found
  info: [debug] Running bootstrap
  info: [debug] spawning: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg io.appium.android.apis -e disableAndroidWatchers false
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
  info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
  info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
  info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
  info: [debug] [BOOTSTRAP] [debug] Loading json...
  info: [debug] [BOOTSTRAP] [debug] json loading complete.
  info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
  info: [debug] Waking up device if it's not alive
  info: [debug] Pushing command to appium work queue: ["wake",{}]
  info: [debug] [BOOTSTRAP] [debug] Client connected
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: wake
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "dumpsys window"
  info: [debug] Screen already unlocked, continuing.
  info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
  info: [debug] dataDir set to: /data/local/tmp
  info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"/data/local/tmp"}
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
  info: [debug] Getting device API level
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.sdk"
  info: [debug] Device is at API Level 23
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.android.apis/io.appium.android.apis.ApiDemos"
  info: [debug] Waiting for pkg "io.appium.android.apis" and activity "io.appium.android.apis.ApiDemos" to be focused
  info: [debug] Getting focused package and activity
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "dumpsys window windows"
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.release"
  info: [debug] Device is at release version 6.0.1
  info: [debug] Device launched! Ready for commands
  info: [debug] Setting command timeout to the default of 60 secs
  info: [debug] Appium session started with sessionId 2ee7300a-fdaf-4b56-8b3f-17688e987e33
  info: <-- POST /wd/hub/session 303 23206.481 ms - 74
  info: --> GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 {}
  info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 200 10.415 ms - 573 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 {}
  info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 200 3.540 ms - 573 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 {}
  info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 200 2.099 ms - 573 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/timeouts {"type":"implicit","ms":10000}
  info: [debug] Set Android implicit wait to 10000ms
  info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/timeouts 200 9.747 ms - 76 {"status":0,"value":null,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element {"using":"xpath","value":"//android.widget.TextView[@text='Preference']"}
  info: [debug] Waiting up to 10000ms for condition
  info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.TextView[@text='Preference']","context":"","multiple":false}]
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.TextView[@text='Preference']","context":"","multiple":false}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: find
  info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.TextView[@text='Preference'] using XPATH with the contextId:  multiple: false
  info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.TextView, INSTANCE=9]
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
  info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element 200 169.685 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element/1/click {"id":"1"}
  info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}]
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: click
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
  info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element/1/click 200 23.573 ms - 76 {"status":0,"value":true,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: [debug] Didn't get a new command in 60 secs, shutting down...
  info: Shutting down appium session
  info: [debug] Pressing the HOME button
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "input keyevent 3"
  info: [debug] Stopping logcat capture
  info: [debug] Logcat terminated with code null, signal SIGTERM
  info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
  info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
  info: [debug] [BOOTSTRAP] [debug] Closed client connection
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
  info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
  info: [debug] [UIAUTOMATOR STDOUT] Time: 63.96
  info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.SecurityException
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: longMsg=Permission Denial: getIntentSender() from pid=32374, uid=2000, (need uid=1000) is not allowed to send as package android

答:
You can click on the link by using below line of code:</p>

```<code>driver.findElementByAccessibityID("Preference").click();
</code>```

Body:
public class basic extends base{

    public static void main(String[] args) throws MalformedURLException {
        // TODO Auto-generated method stub

        AndroidDriver<AndroidElement>  driver=  Capabilities();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click();
    }
}

This is my program. When I ran, only the application gets invoke but preference menu is not opening. Please refer below image.

Appium Preference

This is appium log

info: --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"requiredCapabilities":{}}
  info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_131)
  info: [debug] No appActivity desired capability or server param. Parsing from apk.
  info: [debug] No appPackage desired capability or server param. Parsing from apk.
  info: [debug] Using local app from desired caps: C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] Creating new appium session 2ee7300a-fdaf-4b56-8b3f-17688e987e33
  info: Starting android appium
  info: [debug] Getting Java version
  info: Java version is: 1.8.0_77
  info: [debug] Checking whether adb is present
  info: [debug] Using adb from C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe
  info: [debug] Parsing package and activity from app manifest
  info: [debug] Checking whether aapt is present
  info: [debug] Using aapt from C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
  info: [debug] Extracting package and launch activity from manifest.
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe dump badging C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] badging package: io.appium.android.apis
  info: [debug] badging act: io.appium.android.apis.ApiDemos
  info: [debug] Parsed package and activity are: io.appium.android.apis/io.appium.android.apis.ApiDemos
  info: [debug] Using fast reset? true
  info: [debug] Preparing device for session
  info: [debug] Checking whether app is actually present
  info: Retrieving device
  info: [debug] Trying to find a connected android device
  info: [debug] Getting connected devices...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe devices
  info: [debug] 1 device(s) connected
  info: Found device 9b56dc7f0603
  info: [debug] Setting device id to 9b56dc7f0603
  info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 wait-for-device
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "echo 'ready'"
  info: [debug] Starting logcat capture
  info: [debug] Getting device API level
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.sdk"
  info: [debug] Device is at API Level 23
  info: Device API level is: 23
  info: [debug] Extracting strings for language: default
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop persist.sys.language"
  info: [debug] Current device persist.sys.language:
  info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk" "C:\Users\Sachin\AppData\Local\Temp\io.appium.android.apis"
  info: [debug] Reading strings from converted strings.json
  info: [debug] Setting language to default
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 push "C:\Users\Sachin\AppData\Local\Temp\io.appium.android.apis\strings.json" /data/local/tmp
  info: [debug] Checking whether aapt is present
  info: [debug] Using aapt from C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe
  info: [debug] Retrieving process from manifest.
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe dump xmltree C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk AndroidManifest.xml
  info: [debug] Set app process to: io.appium.android.apis
  info: [debug] Not uninstalling app since server not started with --full-reset
  info: [debug] Checking app cert for C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk.
  info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] App already signed.
  info: [debug] Zip-aligning C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk
  info: [debug] Checking whether zipalign is present
  info: [debug] Using zipalign from C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\zipalign.exe
  info: [debug] Zip-aligning apk.
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\build-tools\25.0.2\zipalign.exe -f 4 C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk C:\Users\Sachin\AppData\Local\Temp\11756-5248-1j4mqt2\appium.tmp
  info: [debug] MD5 for app is 29649242b53e9a67ba855b067422713c
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "ls /data/local/tmp/29649242b53e9a67ba855b067422713c.apk"
  info: [debug] Getting install status for io.appium.android.apis
  info: [debug] Getting device API level
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.sdk"
  info: [debug] Device is at API Level 23
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "pm list packages -3 io.appium.android.apis"
  info: [debug] App is installed
  info: App is already installed, resetting app
  info: [debug] Running fast reset (stop and clear)
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "am force-stop io.appium.android.apis"
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "pm clear io.appium.android.apis"
  info: [debug] Forwarding system:4724 to device:4724
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 forward tcp:4724 tcp:4724
  info: [debug] Pushing appium bootstrap to device...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
  info: [debug] Pushing settings apk to device...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
  info: [debug] Pushing unlock helper app to device...
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
  info: Starting App
  info: [debug] Attempting to kill all 'uiautomator' processes
  info: [debug] Getting all processes with 'uiautomator'
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "ps 'uiautomator'"
  info: [debug] No matching processes found
  info: [debug] Running bootstrap
  info: [debug] spawning: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg io.appium.android.apis -e disableAndroidWatchers false
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
  info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
  info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
  info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
  info: [debug] [BOOTSTRAP] [debug] Loading json...
  info: [debug] [BOOTSTRAP] [debug] json loading complete.
  info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
  info: [debug] Waking up device if it's not alive
  info: [debug] Pushing command to appium work queue: ["wake",{}]
  info: [debug] [BOOTSTRAP] [debug] Client connected
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: wake
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "dumpsys window"
  info: [debug] Screen already unlocked, continuing.
  info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
  info: [debug] dataDir set to: /data/local/tmp
  info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"/data/local/tmp"}
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
  info: [debug] Getting device API level
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.sdk"
  info: [debug] Device is at API Level 23
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.android.apis/io.appium.android.apis.ApiDemos"
  info: [debug] Waiting for pkg "io.appium.android.apis" and activity "io.appium.android.apis.ApiDemos" to be focused
  info: [debug] Getting focused package and activity
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "dumpsys window windows"
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "getprop ro.build.version.release"
  info: [debug] Device is at release version 6.0.1
  info: [debug] Device launched! Ready for commands
  info: [debug] Setting command timeout to the default of 60 secs
  info: [debug] Appium session started with sessionId 2ee7300a-fdaf-4b56-8b3f-17688e987e33
  info: <-- POST /wd/hub/session 303 23206.481 ms - 74
  info: --> GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 {}
  info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 200 10.415 ms - 573 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 {}
  info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 200 3.540 ms - 573 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 {}
  info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- GET /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33 200 2.099 ms - 573 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"sachin"},"app":"C:\Users\Sachin\workspace\Practise\src\ApiDemos-debug.apk","platformName":"Android","deviceName":"9b56dc7f0603"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/timeouts {"type":"implicit","ms":10000}
  info: [debug] Set Android implicit wait to 10000ms
  info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/timeouts 200 9.747 ms - 76 {"status":0,"value":null,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element {"using":"xpath","value":"//android.widget.TextView[@text='Preference']"}
  info: [debug] Waiting up to 10000ms for condition
  info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.TextView[@text='Preference']","context":"","multiple":false}]
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.TextView[@text='Preference']","context":"","multiple":false}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: find
  info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.TextView[@text='Preference'] using XPATH with the contextId:  multiple: false
  info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.TextView, INSTANCE=9]
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
  info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element 200 169.685 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: --> POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element/1/click {"id":"1"}
  info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}]
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
  info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  info: [debug] [BOOTSTRAP] [debug] Got command action: click
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
  info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: <-- POST /wd/hub/session/2ee7300a-fdaf-4b56-8b3f-17688e987e33/element/1/click 200 23.573 ms - 76 {"status":0,"value":true,"sessionId":"2ee7300a-fdaf-4b56-8b3f-17688e987e33"}
  info: [debug] Didn't get a new command in 60 secs, shutting down...
  info: Shutting down appium session
  info: [debug] Pressing the HOME button
  info: [debug] executing cmd: C:\Users\Sachin\AppData\Local\Android\sdk\platform-tools\adb.exe -s 9b56dc7f0603 shell "input keyevent 3"
  info: [debug] Stopping logcat capture
  info: [debug] Logcat terminated with code null, signal SIGTERM
  info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
  info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
  info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
  info: [debug] [BOOTSTRAP] [debug] Closed client connection
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
  info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
  info: [debug] [UIAUTOMATOR STDOUT] Time: 63.96
  info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.SecurityException
  info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: longMsg=Permission Denial: getIntentSender() from pid=32374, uid=2000, (need uid=1000) is not allowed to send as package android

Body:
You can click on the link by using below line of code:

driver.findElementByAccessibityID("Preference").click();


问:
Remove Circle From Google Map V3
I want to remove a circle from a google map.

Anyone up to drop me that little piece of code on how to just remove
the circle?

答: It's using simple setMap as null. This might be helpful: http://enbake.com/remove-circle-polygons-from-google-map-api-v3</p>

Title: Remove Circle From Google Map V3


问:
Pushing keys to an array or javascript object?
I need to create an array or js object with specific keys, which should be pushed to an empty array or js object. After that, I need to push some specific values according to that keys, something like this:

```<code>var arr = ["john":["jval1","jval2"], "matt":["mval1","mval2","mval3"]]
</code>```

I know that's not the rigt notation for a js object or an array, but that's the idea.

This is basically what I'm trying to do:

```<code>var keys = ["john","matt"];             //my keys
var jvals = ["jval1","jval2"];          //my values for key john
var mvals = ["mval1","mval2","mval3"];  //my values for key matt

var arr = [];

for(var i in keys) arr.push(keys[i])  //pushing the names (I need to push this names as keys so next lines should work)

for(var i in jvals) arr["john"].push(jvals[i])  //Trying to push john values, which doesn't work because "john is not a key"
for(var i in mvals) arr["matt"].push(mvals[i])  //Same.
</code>```

This doesn't work at all, so how should I do this?

答:
Here is the more shorter version of the code, using forEach

var keys = ["john","matt"];             //my keys
var jvals = ["jval1","jval2"];          //my values for key john
var mvals = ["mval1","mval2","mval3"];  //my values for key matt
var object = {}
  keys.forEach(function(key, index) {
    object[key] = index == 0 ? jvals.slice() : mvals.slice()
  });
console.log(object)```

Body:
I need to create an array or js object with specific keys, which should be pushed to an empty array or js object. After that, I need to push some specific values according to that keys, something like this:

var arr = ["john":["jval1","jval2"], "matt":["mval1","mval2","mval3"]]

I know that's not the rigt notation for a js object or an array, but that's the idea.

This is basically what I'm trying to do:

var keys = ["john","matt"];             //my keys
var jvals = ["jval1","jval2"];          //my values for key john
var mvals = ["mval1","mval2","mval3"];  //my values for key matt

var arr = [];

for(var i in keys) arr.push(keys[i])  //pushing the names (I need to push this names as keys so next lines should work)

for(var i in jvals) arr["john"].push(jvals[i])  //Trying to push john values, which doesn't work because "john is not a key"
for(var i in mvals) arr["matt"].push(mvals[i])  //Same.

This doesn't work at all, so how should I do this?


问:
Fatal error: SFML/Graphics.hpp: no such file or directory exists
I'm running into problem after problem with SFML, but hopefully it will be worth it in the end.

Here's the error:

fatal error:  SFML/Graphics.hpp : No such file or directory

and the code:

```<code>#include < SFML/Graphics.hpp >
#include < SFML/Window.hpp >

int main(){
sf::RenderWindow Window;
Window.create(sf::VideoMode(800, 600), "SFML");

while(Window.isOpen()){
    sf::Event Event;
    while(Window.pollEvent(Event)){
        if(Event.type == sf::Event::Closed)
            Window.close();
    }
}
}
</code>```

答:
I guess you did a mistake with you're additional includes and/or libraries. Check this again - and if problem still not solved -then make sure - if you're not using SFML static - if the SFML DLL files are in the right directory

I personally found out, that it is a good idea to place the whole SFMl folder into your C drive.

EDIT
A common mistake with SFML and the Linker is writing graphic-d.lib instead of graphics-d.lib (in case of debug mode)

Body:
I'm running into problem after problem with SFML, but hopefully it will be worth it in the end.

Here's the error:

fatal error:  SFML/Graphics.hpp : No such file or directory

and the code:

#include < SFML/Graphics.hpp >
#include < SFML/Window.hpp >

int main(){
sf::RenderWindow Window;
Window.create(sf::VideoMode(800, 600), "SFML");

while(Window.isOpen()){
    sf::Event Event;
    while(Window.pollEvent(Event)){
        if(Event.type == sf::Event::Closed)
            Window.close();
    }
}
}


问:
How do I edit a todo in React
my question is that when i click on edit icon and edit my todo update it. Then that edited todo display new todo in todo-list.New todo and old todo(which i had edited) both display in todo-list. how to solve this problem? How to display todo in list...which i had edited? can any one help me out.
here is my code..
todoApp.JSx

```<code>editTask:function(todo_id,newValue,todoStartDate,todoEndDate){
        console.log(todo_id,newValue,todoStartDate,todoEndDate);
        axios.post('/edittodos',{
            todo_id:todo_id,
            todo_text:newValue,
            todo_start_at:todoStartDate,
            todo_end_at:todoEndDate
        }).then(function (response){

        }).catch(function (error){

       });
//how to display todo in list after editing todo
            this.setState({
                todos:[
                {
                    todo_text:newValue,
                    todo_start_at:todoStartDate,
                    todo_end_at:todoEndDate
                 },
                ...this.state.todos,
                ]
             });

        },
</code>```

todo.jsx

答:
The problem is in your setState, you are actually adding a todo rather than replacing it

Do it like

```<code>var todos = [...this.state.todos];
   var index = todos.findIndex((todo) => todo.todo_id == todo_id)
   todos[index].todo_text = newValue
   todos[index].todo_start_at = todoStartDate
   todos[index].todo_end_at=todoEndDate
   this.setState({
                todos
             });
</code>```

Title: How do I edit a todo in React

Body:
my question is that when i click on edit icon and edit my todo update it. Then that edited todo display new todo in todo-list.New todo and old todo(which i had edited) both display in todo-list. how to solve this problem? How to display todo in list...which i had edited? can any one help me out.
here is my code..
todoApp.JSx

editTask:function(todo_id,newValue,todoStartDate,todoEndDate){
        console.log(todo_id,newValue,todoStartDate,todoEndDate);
        axios.post('/edittodos',{
            todo_id:todo_id,
            todo_text:newValue,
            todo_start_at:todoStartDate,
            todo_end_at:todoEndDate
        }).then(function (response){

        }).catch(function (error){

       });
//how to display todo in list after editing todo
            this.setState({
                todos:[
                {
                    todo_text:newValue,
                    todo_start_at:todoStartDate,
                    todo_end_at:todoEndDate
                 },
                ...this.state.todos,
                ]
             });

        },

todo.jsx

Body:
The problem is in your setState, you are actually adding a todo rather than replacing it

Do it like

var todos = [...this.state.todos];
   var index = todos.findIndex((todo) => todo.todo_id == todo_id)
   todos[index].todo_text = newValue
   todos[index].todo_start_at = todoStartDate
   todos[index].todo_end_at=todoEndDate
   this.setState({
                todos
             });


问:
Is there some way to get amsul pickadate/pickatime object in the different script after picker initializing and use on('close') event?
There is amsul pickadate plugin on my project.
Can I get pickadate/pickatime object in the different script to use on handler? (I don't want to change core js script, where is pickadate initialization).

I tried to do that:

```<code>$('input[data-type="date"]').on('close',function(){
                        // do something
                    });
</code>```

also I tried to do:

```<code>$('input[data-type="date"]').pickadate('picker').on('close',function(){
                        // do something
                    });
</code>```

But on both ways it didn't work at all :(

答:
Looks to me you missing one .pickadate() chain. It should be :

```<code>$('input[data-type="date"]').pickadate().pickadate('picker').on('close',
    function(){
      //Do something here
    }
);
</code>```

Here is working example at plunker show how to bind close event using on.

Please check detail API documentation at: http://amsul.ca/pickadate.js/api/

ContentLicense: CC BY-SA 4.0

Body:
There is amsul pickadate plugin on my project.
Can I get pickadate/pickatime object in the different script to use on handler? (I don't want to change core js script, where is pickadate initialization).

I tried to do that:

$('input[data-type="date"]').on('close',function(){
                        // do something
                    });

also I tried to do:

$('input[data-type="date"]').pickadate('picker').on('close',function(){
                        // do something
                    });

But on both ways it didn't work at all :(

Body:
Looks to me you missing one .pickadate() chain. It should be :

$('input[data-type="date"]').pickadate().pickadate('picker').on('close',
    function(){
      //Do something here
    }
);

Here is working example at plunker show how to bind close event using on.

Please check detail API documentation at: http://amsul.ca/pickadate.js/api/


问:
How to write script tag inside build html in a javascript function?
I am trying open build html(inside js funtion) to show table on a new tab.
Now I am trying to add a js function for user to download table in excel format, but as soon as I try to add  tag code breaks.

I tried following:
Wrote download funtion inside script tag of built html code in js function.
Added a new javascript file containing download js function.
Added download function in a variable and tried including it in script tag.
Used '+
        '
'+Header+'

    Key	    Value
';

        for (var key in data) {
            var eachrow = '
'
            + '' + key + '	'
            + '' + data[key] + '	'
            + '
';
            html=html+eachrow;
        }
        html=html+'

<button id="exportExcel" onclick="download()">Export</button>';
        return html;
    }
```

The problem here is as soon as I close script tag(i.e ),
my main script tag (in which all functions are written) is shown as closed. And same appears on screen.

答:
I have updated your code please check :

   $(function () {
    var myfunction = function download() {
        $("#btnExport").click(function (e) {
            e.preventDefault();

            var data_type = "data:application/vnd.ms-excel";
            var table_div = document.getElementById("table_wrapper");
            var table_html = table_div.outerHTML.replace(/ /g, "%20");

            var a = document.createElement("a");
            a.href = data_type + ", " + table_html;
            a.download = "exported_table_" + Math.floor((Math.random() * 9999999) + 1000000) + ".xls";
            a.click();
        });

    var html = '<title>Locale Value</title>

Body:
I am trying open build html(inside js funtion) to show table on a new tab.
Now I am trying to add a js function for user to download table in excel format, but as soon as I try to add  tag code breaks.

I tried following:
Wrote download funtion inside script tag of built html code in js function.
Added a new javascript file containing download js function.
Added download function in a variable and tried including it in script tag.
Used '+
        '
'+Header+'

    Key	    Value
';

        for (var key in data) {
            var eachrow = '
'
            + '' + key + '	'
            + '' + data[key] + '	'
            + '
';
            html=html+eachrow;
        }
        html=html+'

<button id="exportExcel" onclick="download()">Export</button>';
        return html;
    }

The problem here is as soon as I close script tag(i.e ),
my main script tag (in which all functions are written) is shown as closed. And same appears on screen.

Body:
I have updated your code please check :

   $(function () {
    var myfunction = function download() {
        $("#btnExport").click(function (e) {
            e.preventDefault();

            var data_type = "data:application/vnd.ms-excel";
            var table_div = document.getElementById("table_wrapper");
            var table_html = table_div.outerHTML.replace(/ /g, "%20");

            var a = document.createElement("a");
            a.href = data_type + ", " + table_html;
            a.download = "exported_table_" + Math.floor((Math.random() * 9999999) + 1000000) + ".xls";
            a.click();
        });

    var html = '<html><head><title>Locale Value</title><script>' + myfunction + '</' + 'script></head>' +
    '<body><h2>' + Header + '</h2><br><br><table>  <tr>    <th>Key</th>    <th>Value</th></tr>';

    for (var key in data) {
        var eachrow = '<tr>'
        + '<td>' + key + '</td>'
        + '<td>' + data[key] + '</td>'
        + '</tr>';
        html = html + eachrow;
    }
    html = html + '</table><br><br><button id="exportExcel" onclick="download()">Export</button></body></html>';
    return html;
  };
});


问:
How to write query for created User, Created date, Modified User, Modified date for a table
I need help in knowing how to automatically make the table load the values for Created user , created date, modified user and modified date,

once any data goes into the table , we should have the Created user and created date column value to be fixed but the modified user and modified date should change

答:
For createdby and createtime you can use columns default values:

```<code>CreatedAt DATETIME DEFAULT GETDATE(),
CreatedBy VARCHAR(100) DEFAULT USER
</code>```

For UpdatedAt you have to create a trigger which sets the values:

```<code>CREATE TRIGGER [t_Table_upd] ON YourTable AFTER UPDATE AS
set nocount on
UPDATE YourTable
set
    YourTable.[Modified] = getdate(),
    YourTable.[ModifiedBy] = USER,
    YourTable.[Version] = YourTable.[Version] + 1
FROM
    DELETED d
WHERE
    YourTable.ID = d.ID
</code>```

Body:
For createdby and createtime you can use columns default values:

CreatedAt DATETIME DEFAULT GETDATE(),
CreatedBy VARCHAR(100) DEFAULT USER

For UpdatedAt you have to create a trigger which sets the values:

CREATE TRIGGER [t_Table_upd] ON YourTable AFTER UPDATE AS
set nocount on
UPDATE YourTable
set
    YourTable.[Modified] = getdate(),
    YourTable.[ModifiedBy] = USER,
    YourTable.[Version] = YourTable.[Version] + 1
FROM
    DELETED d
WHERE
    YourTable.ID = d.ID


问:
File path not getting set using 'save_screenshot' for python selenium in ubuntu
I am using python selenium to get a screenshot of test, but in ubuntu the saved screenshot is taking the path name as file name and getting saved on the desktop. I have used the same code on windows and the file was being saved in the correct destination:

```<code>def shot():
    ts = time.time()
    path = "\home\sudhanshu\Desktop\shots\sb"
    extension = ".png"
    screensave = datetime.datetime.fromtimestamp(ts).strftime('%d%m%Y%H%M%S')
    print (path+screensave+extension)
    wd.save_screenshot(path+screensave+extension)
</code>```

Here, if you see the path, I want to save the file with timestamp as file name in a folder named shots present on desktop, but it takes the complete path as file name and gets saved on the desktop. The same thing worked perfectly on windows. I have tried adding the path differently like setting ~\sudhanshu\Desktop\shots06062017170730.png as path but nothing works. Can anyone please suggest something.

答: Started working again by using / and using os.path.join together. Thanks everyone. </p>

Body:
I am using python selenium to get a screenshot of test, but in ubuntu the saved screenshot is taking the path name as file name and getting saved on the desktop. I have used the same code on windows and the file was being saved in the correct destination:

def shot():
    ts = time.time()
    path = "\home\sudhanshu\Desktop\shots\sb"
    extension = ".png"
    screensave = datetime.datetime.fromtimestamp(ts).strftime('%d%m%Y%H%M%S')
    print (path+screensave+extension)
    wd.save_screenshot(path+screensave+extension)

Here, if you see the path, I want to save the file with timestamp as file name in a folder named shots present on desktop, but it takes the complete path as file name and gets saved on the desktop. The same thing worked perfectly on windows. I have tried adding the path differently like setting ~\sudhanshu\Desktop\shots06062017170730.png as path but nothing works. Can anyone please suggest something.


问:
JqGrid with Fancybox - get cell object
Using the follow in jqGrid:

```<code> colModel: [
            {name:"",index:"",width:100},
            {name:"diagnosis",index:"diagnosis",width:100,formatter:fancyBoxFormatter},
            {name:"prescription", index:"prescription",width:100,formatter:fancyBoxFormatter},
            {name:"tests",index:"tests",width:100,formatter:fancyBoxFormatter},
            {name:"imaging",index:"imaging",width:100,formatter:fancyBoxFormatter},
            {name:"generic",index:"generic",width:100,formatter:fancyBoxFormatter},
            {name:"referral",index:"referral",width:100,formatter:fancyBoxFormatter},
            {name:"management",index:"management",width:100,formatter:fancyBoxFormatter},
            {name:"completed",index:"completed",width:100}
            ],
</code>```

Then:

```<code>function fancyBoxFormatter(cellvalue, options, rowObject) {

    var result,
        link,
        fancyBoxHTML,
        fancyBoxContent;

    link = "<a class=\"fancybox\" href=\"#data" + options.rowId + "\">" + cellvalue + "</a>";
    fancyBoxContent = cellvalue;
    fancyBoxHTML = "<div style=\"display:none\"><div id=\"data" + options.rowId + "\">" + fancyBoxContent + "</div></div>";
    return link + fancyBoxHTML;
}
</code>```

This displays the same content in Fancybox for all cells in the row (based on rowID...)  How can I change this function to individual cell IDs, rather than just the whole row?

答:
Please write in all questions about jqGrid the version of jqGrid, which you use (can use) and the fork which you use (free jqGrid, commercial Guriddo jqGrid JS or an old jqGrid in version <=4.7).

The options parameter of the custom formatter fancyBoxFormatter contains rowId, colModel, gid, pos and rowData properties (rowData exists only in free jqGrid fork). Thus you can use, for example,

```<code>function fancyBoxFormatter (cellvalue, options) {
    return "<a class=\"fancybox\" href=\"#data" +
        options.rowId + "_" + options.colModel.name + "\">" + cellvalue + "</a>" +
        "<div style=\"display:none\"><div id=\"data" +
        options.rowId + "_" + options.colModel.name + "\">" +
        cellvalue + "</div></div>";
}
</code>```

Additionally you have to fix the name property of the first column. One can't use empty name (see name:""). You could use any unique value for name holding the rules existing in HTML5/CSS for ids (for example no spaces).

I'd recommend you additionally to remove unneeded index properties and common width:100 option from all columns. Instead of placing width:100 in every column you can use cmTemplate: {width: 100} option of jqGrid.

Title: JqGrid with Fancybox - get cell object

Body:
Using the follow in jqGrid:

 colModel: [
            {name:"",index:"",width:100},
            {name:"diagnosis",index:"diagnosis",width:100,formatter:fancyBoxFormatter},
            {name:"prescription", index:"prescription",width:100,formatter:fancyBoxFormatter},
            {name:"tests",index:"tests",width:100,formatter:fancyBoxFormatter},
            {name:"imaging",index:"imaging",width:100,formatter:fancyBoxFormatter},
            {name:"generic",index:"generic",width:100,formatter:fancyBoxFormatter},
            {name:"referral",index:"referral",width:100,formatter:fancyBoxFormatter},
            {name:"management",index:"management",width:100,formatter:fancyBoxFormatter},
            {name:"completed",index:"completed",width:100}
            ],

Then:

function fancyBoxFormatter(cellvalue, options, rowObject) {

    var result,
        link,
        fancyBoxHTML,
        fancyBoxContent;

    link = "" + cellvalue + "";
    fancyBoxContent = cellvalue;
    fancyBoxHTML = "

" + fancyBoxContent + "

";
    return link + fancyBoxHTML;
}

This displays the same content in Fancybox for all cells in the row (based on rowID...)  How can I change this function to individual cell IDs, rather than just the whole row?

Body:
Please write in all questions about jqGrid the version of jqGrid, which you use (can use) and the fork which you use (free jqGrid, commercial Guriddo jqGrid JS or an old jqGrid in version <=4.7).

The options parameter of the custom formatter fancyBoxFormatter contains rowId, colModel, gid, pos and rowData properties (rowData exists only in free jqGrid fork). Thus you can use, for example,

function fancyBoxFormatter (cellvalue, options) {
    return "<a class=\"fancybox\" href=\"#data" +
        options.rowId + "_" + options.colModel.name + "\">" + cellvalue + "</a>" +
        "<div style=\"display:none\"><div id=\"data" +
        options.rowId + "_" + options.colModel.name + "\">" +
        cellvalue + "</div></div>";
}

Additionally you have to fix the name property of the first column. One can't use empty name (see name:""). You could use any unique value for name holding the rules existing in HTML5/CSS for ids (for example no spaces).

I'd recommend you additionally to remove unneeded index properties and common width:100 option from all columns. Instead of placing width:100 in every column you can use cmTemplate: {width: 100} option of jqGrid.


问:
How to find given 2D point position based on axis system
I have a axis system(origin,u direction,v direction).How to know given 2D point lie on the line which is used to denote the u or v direction line(ie, u=0 or v =0)?</p>

答:
If "given 2D point" P coordinates are presented in fixed coordinate system, then you have to represent vector P-origin in o-u-v basis.

```<code>op = P - origin

s * u.x + t * v.x = op.x
s * u.y + t * v.y = op.y
</code>```

Solve last system of linear equations for unknown coefficients s and t. Check for zero coefficients.

Body:
If "given 2D point" P coordinates are presented in fixed coordinate system, then you have to represent vector P-origin in o-u-v basis.

op = P - origin

s * u.x + t * v.x = op.x
s * u.y + t * v.y = op.y

Solve last system of linear equations for unknown coefficients s and t. Check for zero coefficients.


问:
ButterKnife and AnnotationProcessor
Based on ButterKnife lib, I upgrade to new version 8.5.1. I used

```<code>compile 'com.jakewharton:butterknife:8.5.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
</code>```

But it warns me in my Android Studio 2.3.  And ButterKnife doesn't work(cannot bind view).

Warning:Using incompatible plugins for the annotation processing:
  android-apt. This may result in an unexpected behavior.

I change  annotationProcessor to apt (I had plugin apply plugin: 'com.neenbedankt.android-apt' in my gradle) and it works as old version without warning (I used apt for old version 8.4.0)

```<code>compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'
</code>```

I think Android Studio 2.3 is incomatible with Annottaion processing. I searched and found to enable Annotation Processors in Android Studio 2.2 but cannot find in Android Studio 2.3

Settings > Build, Execution, Deployment > Compiler > Annotation
  Processors

Anyone can explain this problem? Thanks!

答:
An annotation processor was included in the Gradle version 2.2, so there is no reason to provide an extra one.

Check my updated answer here.

Title: ButterKnife and AnnotationProcessor

Body:
Based on ButterKnife lib, I upgrade to new version 8.5.1. I used

compile 'com.jakewharton:butterknife:8.5.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

But it warns me in my Android Studio 2.3.  And ButterKnife doesn't work(cannot bind view).

Warning:Using incompatible plugins for the annotation processing:
  android-apt. This may result in an unexpected behavior.

I change  annotationProcessor to apt (I had plugin apply plugin: 'com.neenbedankt.android-apt' in my gradle) and it works as old version without warning (I used apt for old version 8.4.0)

compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'

I think Android Studio 2.3 is incomatible with Annottaion processing. I searched and found to enable Annotation Processors in Android Studio 2.2 but cannot find in Android Studio 2.3

Settings > Build, Execution, Deployment > Compiler > Annotation
  Processors

Anyone can explain this problem? Thanks!


问:
Python, Convolve function from ndimage filters
I have a challenge: to write convolve function for images 56x56 argument as array, and second arg kernel which is in my case a matrix of 1x3 or 3x1.

The point is to write convolve(image, kernel) using only numpy.

I have a HOG filter which is using convolve from scipy however I need that convolve function to work.

I have no idea how to begin, does anybody have information how it can be easily done or someone had similar thing to write before?

答:
If your filter is only 1D (e.g., 1x3 or 3x1) you can use 1D convolutions row-wise or column wise:</p>

```<code>def my_conv(im2d, ker1d):
    out = np.zeros(im2d.shape, dtype=im2d.dtype)  # allocate output assuming mode='same'
    if ker1d.shape[0] == 1:
        # horizontal kernel
        for row in xrange(im2d.shape[0]):
            out[row,:] = np.convolve(im2d[row,:], ker1d.flatten(), mode='same')
    elif ker1d.shape[1] == 1:
        # vertical kernel
        for col in xrange(im2d.shape[1]):
            out[:,col] = np.convolve(im2d[:,col], ker1d.flatten(), mode='same')
    else:
        raise ValueError('input kernel is not 1D')
    return out
</code>```

Body:
If your filter is only 1D (e.g., 1x3 or 3x1) you can use 1D convolutions row-wise or column wise:

def my_conv(im2d, ker1d):
    out = np.zeros(im2d.shape, dtype=im2d.dtype)  # allocate output assuming mode='same'
    if ker1d.shape[0] == 1:
        # horizontal kernel
        for row in xrange(im2d.shape[0]):
            out[row,:] = np.convolve(im2d[row,:], ker1d.flatten(), mode='same')
    elif ker1d.shape[1] == 1:
        # vertical kernel
        for col in xrange(im2d.shape[1]):
            out[:,col] = np.convolve(im2d[:,col], ker1d.flatten(), mode='same')
    else:
        raise ValueError('input kernel is not 1D')
    return out


问:
Android Studio WebView Youtube Video BlackScreen
I want to play a video in the WebView but somehow I get an blackscreen on the video but I can hear the sound of it. Would be really glad if someone can help me</p>

```<code>public class MainActivity extends AppCompatActivity {

WebView displayYoutubeVideo;
TextView button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    String frameVideo = "<html><body>Video From YouTube<br><iframe
    width=\"560\" height=\"315\"
    src=\"https://www.youtube.com/embed/WtO3_tF8niU\" frameborder=\"0\"
    allowfullscreen></iframe></body></html>";

    WebView displayYoutubeVideo = (WebView) findViewById(R.id.youtube_view);

    displayYoutubeVideo.getSettings().setUserAgentString("Mozilla/5.0
           (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");

    displayYoutubeVideo.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;
        }
    });
    WebSettings webSettings = displayYoutubeVideo.getSettings();
    webSettings.setJavaScriptEnabled(true);
    displayYoutubeVideo.loadData(frameVideo, "text/html", "utf-8");
}
}
</code>```

答:
You must activate  Hardware acceleration if your android:targetSdkVersion is lower than 11 and have to set webChromeclient to your webview

```<code>displayYoutubeVideo.setWebChromeClient(new WebChromeClient());
</code>```

and in your manifest file add below line

```<code> <application android:hardwareAccelerated="true" ...>
</code>```

Body:
I want to play a video in the WebView but somehow I get an blackscreen on the video but I can hear the sound of it. Would be really glad if someone can help me

public class MainActivity extends AppCompatActivity {

WebView displayYoutubeVideo;
TextView button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    String frameVideo = "Video From YouTube
";

    WebView displayYoutubeVideo = (WebView) findViewById(R.id.youtube_view);

    displayYoutubeVideo.getSettings().setUserAgentString("Mozilla/5.0
           (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");

    displayYoutubeVideo.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;
        }
    });
    WebSettings webSettings = displayYoutubeVideo.getSettings();
    webSettings.setJavaScriptEnabled(true);
    displayYoutubeVideo.loadData(frameVideo, "text/html", "utf-8");
}
}

Body:
You must activate  Hardware acceleration if your android:targetSdkVersion is lower than 11 and have to set webChromeclient to your webview

displayYoutubeVideo.setWebChromeClient(new WebChromeClient());

and in your manifest file add below line

 <application android:hardwareAccelerated="true" ...>


问:
MySQL Copy Table Data of one Database Table to another AUTOMATICALLY; as table gets updated or by some specific time interval, schedule
Copy Table Data of one Database Table to another AUTOMATICALLY; as table gets updated or by some specific time interval, schedule

Database MySQL; Language PHP

I've got TWO databases; A and B

Database A contains a table USERS

I want to copy table data of USERS to Database B; by some routine, service, scheduly after some specific time that can be set dynamically. Aim is to get table data automatically.

So, Database B will have USERS table data same as Database A

答:
If you need copy data from one table to another you could use MySQL triggers called after INSERT/UPDATE/DELETE row in your source table.

If you nedd to copy data periodically you could use CRON.

Another options is replication .


问:
Oracle Modify statement - error
I added a new column in my table.

```<code>ALTER TABLE neue_buch modify preis not null;
</code>```

and I have got this error:

```<code>Error starting at line 40 in command:
ALTER TABLE neue_buch
modify preis not null
Error report:
SQL Error: ORA-02296: cannot enable (S1885872.) - null values found
02296. 00000 - "cannot enable (%s.%s) - null values found"
*Cause:    an alter table enable constraint failed because the table
           contains values that do not satisfy the constraint.
*Action:   Obvious
</code>```

What wrong with my MODIFY STATEMENT.?

many thanks in advance,

magidu

答:
ALTER TABLE AG_PARTICELLE_AZIENDA MODIFY SEZIONE NOT NULL;
ORA-02296: impossibile abilitare (TRACKER.) - trovati valori non appropriati

nella tabella AG_PARTICELLE_AZIENDA alcuni valori di SEZIONE sono a null!

devo fare:

1)update AG_PARTICELLE_AZIENDA
  set sezione = null;

2)commit;

3)ALTER TABLE AG_PARTICELLE_AZIENDA MODIFY SEZIONE NOT NULL;

non ho capito il messaggio di errore!
qualcquno può aiutarmi?
grazie
ugo montorsi mail:ugo.montorsi@sin.it

OwnerDisplayName: magidu

Title: Oracle Modify statement - error

Body:
I added a new column in my table.

ALTER TABLE neue_buch modify preis not null;

and I have got this error:

Error starting at line 40 in command:
ALTER TABLE neue_buch
modify preis not null
Error report:
SQL Error: ORA-02296: cannot enable (S1885872.) - null values found
02296. 00000 - "cannot enable (%s.%s) - null values found"
*Cause:    an alter table enable constraint failed because the table
           contains values that do not satisfy the constraint.
*Action:   Obvious

What wrong with my MODIFY STATEMENT.?

many thanks in advance,

magidu

OwnerDisplayName: ugo montorsi


问:
Array indices start from a value not equals 1 in Ada
I've got an assignment about implementing access function to an array in Ada.
However, declaration of the array was frustrating for me:

```<code>A: array[1..15, 5..20] of integer;
</code>```

I found a lot of materials on the internet about multidimensional arrays in Ada, however, non of them mentioned memory allocation in this case. Is it just simple mapping of 1..15 to 5..20? Or, program actually skips first 4 elements in each row of the array and keeps memory blank? What if I try to access A[1, 3]?

答:
The Ada 2012 specification states:

The possible values for a given index are all the values between the lower and upper bounds, inclusive; this range of values is called the index range.

The bounds of an array are the bounds of its index ranges.

The length of a dimension of an array is the number of values of the index range of the dimension (zero for a null range).

Regarding memory representation, the section of the specification concerned with array operations states that the length of an array range is defined by its upper-bound minus its lower-bound, plus 1 (which is a restatement of the third bullet point above).

With this knowledge we can answer your questions:

Is it just simple mapping of 1..15 to 5..20?

There's an implicit mapping of indexes to internal array range locations, but your mapping is incorrect.

With array[ 1..15, 5..20]:

The 1st dimension array range length is 15 - 1 + 1, so 15 elements long.

The 2nd dimension array range length is 20 - 5 + 1, so 16 elements long.

Or, program actually skips first 4 elements in each row of the array and keeps memory blank?

No, as per the specification the system will not allocate space for array elements not accessible by the defined range.

What if I try to access A[1, 3]?

The specification states an index bounds check will be performed based on the range the array was initialized with, given that 1,3 is outside the range [1..15,5..20] this would result in a runtime index-out-of-bounds error.

Body:
I've got an assignment about implementing access function to an array in Ada.
However, declaration of the array was frustrating for me:

A: array[1..15, 5..20] of integer;

I found a lot of materials on the internet about multidimensional arrays in Ada, however, non of them mentioned memory allocation in this case. Is it just simple mapping of 1..15 to 5..20? Or, program actually skips first 4 elements in each row of the array and keeps memory blank? What if I try to access A[1, 3]?


问:
Hide comments in R markdown
Is is possible to hide some comments in code when kniting using knitr / R markdown? Example:

```<code>---
title: "SOSO"
author: "SO"
date: '2017-06-06'
output: pdf_document

---

```{r}

# Generate some data

rnorm(2)

## But keep this comment

```
</code>```

When kniting I would like the first comment to disapear, but keep the second one somehow.

答:
In fact, you can choose to show any lines of R code by passing numeric indices to the chunk option echo, e.g.

```<code>---
title: "SOSO"
author: "SO"
date: '2017-06-06'
output: pdf_document
---

```{r echo=4:7}

# Generate some data

rnorm(2)

## But keep this comment

```
</code>```

See knitr documentation for more information.

Title: Hide comments in R markdown

Body:
Is is possible to hide some comments in code when kniting using knitr / R markdown? Example:

---
title: "SOSO"
author: "SO"
date: '2017-06-06'
output: pdf_document

---

```{r}

# Generate some data

rnorm(2)

## But keep this comment

```

When kniting I would like the first comment to disapear, but keep the second one somehow.

Body:
In fact, you can choose to show any lines of R code by passing numeric indices to the chunk option echo, e.g.

---
title: "SOSO"
author: "SO"
date: '2017-06-06'
output: pdf_document
---

```{r echo=4:7}

# Generate some data

rnorm(2)

## But keep this comment

```

See knitr documentation for more information.


问:
show ProgressBar above WebView so that it does not hide when scrolling down WebView
I have a ProgressBar as a child of WebView, which works fine.

Problem is When I scroll the WebView up, the progress bar hides.
Here is my activity_main.xml

```<code> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ionicframework.VendeeTouch.MainActivity">

    <WebView  xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

        <ProgressBar
            android:id="@+id/progressbar"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_x="5dp"
            android:layout_y="26dp"
            android:padding="2dip"></ProgressBar>

        <TextView
            android:id="@+id/tV1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_x="119dp"
            android:layout_y="286dp"
            android:text="Loading, please wait . . ."
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="#000000"></TextView>
    </WebView>

</RelativeLayout>
</code>```

How do I keep it fixed at the top so that when I scroll down it does not hide?

答:
```<code>    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ionicframework.VendeeTouch.MainActivity"
    android:orientation="vertical" >

   <ProgressBar
            android:id="@+id/progressbar"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_x="5dp"
            android:layout_y="26dp"
            android:padding="2dip"></ProgressBar>

    <WebView  xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >

        <TextView
            android:id="@+id/tV1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_x="119dp"
            android:layout_y="286dp"
            android:text="Loading, please wait . . ."
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="#000000"></TextView>
    </WebView>

</LinearLayout>
</code>```

Body:
I have a ProgressBar as a child of WebView, which works fine.

Problem is When I scroll the WebView up, the progress bar hides.
Here is my activity_main.xml

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ionicframework.VendeeTouch.MainActivity">

    <WebView  xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

        <ProgressBar
            android:id="@+id/progressbar"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_x="5dp"
            android:layout_y="26dp"
            android:padding="2dip"></ProgressBar>

        <TextView
            android:id="@+id/tV1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_x="119dp"
            android:layout_y="286dp"
            android:text="Loading, please wait . . ."
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="#000000"></TextView>
    </WebView>

</RelativeLayout>

How do I keep it fixed at the top so that when I scroll down it does not hide?