问:
Running automated Selenium web driver UI tests using JAVA in Azure Devops CI/CD pipelines
I have a JAVA spring boot application. I have JUnit unit tests and functional tests using Selenium Web Driver in the same project.
I want to automate these tests in Azure DevOps pipelines.

What I have done so far is:
Setup a Maven task in build pipeline to automate the unit tests.

Problem statement: How do I setup the Selenium UI tests in Release pipeline.

The Microsoft documentation talks about VsTest task. But this task is not supported for Java projects.
What am I missing?

答:
In the Release pipeline, you can use bash script task to perform selenium UI automation testing with headless chrome.

1) First, install the chrome browser and web driver in a build or release agent. You can use Microsoft hosted agents or self-hosted agents. All your pipelines need at least one agent to complete the job.

2) Clone the functional test repository from source control.

3) Run MVN test command

Make sure you have the same version of the chrome web driver and chrome web browser installed on the build agent.

The following property will be required to run the functional tests in headless mode.

```<code>ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
</code>```

And add path to web driver,

```<code>System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
</code>```

Here you can follow the sample script for Azure pipeline bash task

```<code>apt-get update
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
wget https://chromedriver.storage.googleapis.com/84.0.4147.30/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
git clone https://repo_url/functionalTests
cd functionalTests
mvn test
</code>```

Body:
In the Release pipeline, you can use bash script task to perform selenium UI automation testing with headless chrome.

1) First, install the chrome browser and web driver in a build or release agent. You can use Microsoft hosted agents or self-hosted agents. All your pipelines need at least one agent to complete the job.

2) Clone the functional test repository from source control.

3) Run MVN test command

Make sure you have the same version of the chrome web driver and chrome web browser installed on the build agent.

The following property will be required to run the functional tests in headless mode.

ChromeOptions options = new ChromeOptions();
options.addArguments("headless");

And add path to web driver,

System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");

Here you can follow the sample script for Azure pipeline bash task

apt-get update
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
wget https://chromedriver.storage.googleapis.com/84.0.4147.30/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
git clone https://repo_url/functionalTests
cd functionalTests
mvn test


来源: stackexchange

问:
How to replace decoded Non-breakable space (nbsp)
Assuming I have a sting which is "a s d d" and htmlentities turns it into

"a s d d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying to remove those special characters from my string as I don't need them

What are possibilities beyond regexp?

Edit
String I want to parse: http://pastebin.com/raw/7eNT9sZr

with function preg_replace('/[\r\n]+/', "[##]", $text)

for later implode("

", explode("[##]", $text))

My question is not exactly "how" to do this (since I could encode entities, remove entities i don't need and decode entities). But how to remove those with just str_replace or preg_replace.

答:
Sanitize every type of white spaces.

```<code>preg_replace("/\s+/u", " ", $str);
</code>```

https://stackoverflow.com/a/40264711/635364

FYI, PHP Sanitization filter_var() has no filter about these white spaces.

ContentLicense: CC BY-SA 3.0

Body:
Sanitize every type of white spaces.

preg_replace("/\s+/u", " ", $str);

https://stackoverflow.com/a/40264711/635364

FYI, PHP Sanitization filter_var() has no filter about these white spaces.

ContentLicense: CC BY-SA 4.0


问:
Androind 2.2 Preview 1 - Using ConstraintsLayout with GuideLine app crashes
I am trying to create layout using ContraintsLayout.

In my layout I have added horizontal GuideLine.

But when I run the app it crashes and if I remove the GuideLine it works.

I also checked the APK and there is a class java.awt.Rectagle

StackStrace

```<code>java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Rectangle;
 at android.support.constraint.solver.widgets.Guideline.<init>(Guideline.java:43)
 at android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:128)
 at android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:106)
 at android.support.constraint.ConstraintLayout.onFinishInflate(ConstraintLayout.java:87)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
 at com.infostretch.app.MainActivity.onCreate(MainActivity.java:11)
 at android.app.Activity.performCreate(Activity.java:6669)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686)
 at android.app.ActivityThread.-wrap12(ActivityThread.java)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:154)
 at android.app.ActivityThread.main(ActivityThread.java:5969)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.awt.Rectangle" on path: DexPathList[[zip file "/data/app/com.infostretch.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.infostretch.app-1/lib/x86_64, /system/lib64, /vendor/lib64]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
 at android.support.constraint.solver.widgets.Guideline.<init>(Guideline.java:43)
 at android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:128)
 at android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:106)
 at android.support.constraint.ConstraintLayout.onFinishInflate(ConstraintLayout.java:87)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
 at com.infostretch.app.MainActivity.onCreate(MainActivity.java:11)
 at android.app.Activity.performCreate(Activity.java:6669)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686)
 at android.app.ActivityThread.-wrap12(ActivityThread.java)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:154)
 at android.app.ActivityThread.main(ActivityThread.java:5969)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
</code>```

Layout xml file

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="80dp">

<ImageView
    android:id="@+id/imageView"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:src="@color/accent_material_light"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintTop_toTopOf="@+id/constraintLayout"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="16dp" />

<TextView
    android:id="@+id/textView11"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:text="TextView"
    app:layout_constraintLeft_toRightOf="@+id/imageView"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toTopOf="@+id/constraintLayout"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="80dp"
    tools:layout_editor_absoluteY="16dp" />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="28dp"
    android:layout_height="28dp"
    android:layout_marginEnd="16dp"
    android:layout_marginTop="8dp"
    android:src="@color/abc_input_method_navigation_guard"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toBottomOf="@+id/textView11"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="367dp"
    tools:layout_editor_absoluteY="40dp" />

<android.support.constraint.Guideline
    android:id="@+id/guideline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:orientation="horizontal"
    app:relativeBegin="83dp"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="83dp" />

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="0dp"
    android:layout_height="120dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:gravity="center"
    android:orientation="vertical"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toTopOf="@+id/guideline"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="99dp">

    <TextView
        android:id="@+id/textView12"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="MapView"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="230dp" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout2"
    android:layout_width="0dp"
    android:layout_height="120dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="8dp"
    android:gravity="center"
    android:orientation="vertical"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toBottomOf="@+id/linearLayout"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="227dp">

    <TextView
        android:id="@+id/textView13"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Alert View"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="358dp" />
</LinearLayout>

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="8dp"
    android:gravity="center"
    android:orientation="vertical"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
    tools:layout_constraintBottom_creator="0"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="355dp">

    <TextView
        android:id="@+id/textView14"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Recycler View"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="522dp" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout3"
    android:layout_width="0dp"
    android:layout_height="48dp"
    android:orientation="horizontal"
    app:layout_constraintBottom_toBottomOf="@+id/constraintLayout"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    tools:layout_constraintBottom_creator="0"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="554dp">

  </LinearLayout>
</android.support.constraint.ConstraintLayout>
</code>```

答:
I was having a similar issue... but then I discovered I was using androidX but mistakenly put

    <android.support.constraint.Guideline
        android:id="@+id/guideline3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_begin="406dp" />```
</div>
</div>
</p>

<p>instead of using the androidX equivalent</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_begin="406dp" /></code>```

I hope this helps someone out there

Body:
I am trying to create layout using ContraintsLayout.

In my layout I have added horizontal GuideLine.

But when I run the app it crashes and if I remove the GuideLine it works.

I also checked the APK and there is a class java.awt.Rectagle

StackStrace

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Rectangle;
 at android.support.constraint.solver.widgets.Guideline.<init>(Guideline.java:43)
 at android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:128)
 at android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:106)
 at android.support.constraint.ConstraintLayout.onFinishInflate(ConstraintLayout.java:87)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
 at com.infostretch.app.MainActivity.onCreate(MainActivity.java:11)
 at android.app.Activity.performCreate(Activity.java:6669)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686)
 at android.app.ActivityThread.-wrap12(ActivityThread.java)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:154)
 at android.app.ActivityThread.main(ActivityThread.java:5969)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.awt.Rectangle" on path: DexPathList[[zip file "/data/app/com.infostretch.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.infostretch.app-1/lib/x86_64, /system/lib64, /vendor/lib64]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
 at android.support.constraint.solver.widgets.Guideline.<init>(Guideline.java:43)
 at android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:128)
 at android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:106)
 at android.support.constraint.ConstraintLayout.onFinishInflate(ConstraintLayout.java:87)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
 at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
 at com.infostretch.app.MainActivity.onCreate(MainActivity.java:11)
 at android.app.Activity.performCreate(Activity.java:6669)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686)
 at android.app.ActivityThread.-wrap12(ActivityThread.java)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:154)
 at android.app.ActivityThread.main(ActivityThread.java:5969)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)

Layout xml file

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="80dp">

<ImageView
    android:id="@+id/imageView"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:src="@color/accent_material_light"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintTop_toTopOf="@+id/constraintLayout"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="16dp" />

<TextView
    android:id="@+id/textView11"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:text="TextView"
    app:layout_constraintLeft_toRightOf="@+id/imageView"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toTopOf="@+id/constraintLayout"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="80dp"
    tools:layout_editor_absoluteY="16dp" />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="28dp"
    android:layout_height="28dp"
    android:layout_marginEnd="16dp"
    android:layout_marginTop="8dp"
    android:src="@color/abc_input_method_navigation_guard"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toBottomOf="@+id/textView11"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="367dp"
    tools:layout_editor_absoluteY="40dp" />

<android.support.constraint.Guideline
    android:id="@+id/guideline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:orientation="horizontal"
    app:relativeBegin="83dp"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="83dp" />

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="0dp"
    android:layout_height="120dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:gravity="center"
    android:orientation="vertical"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toTopOf="@+id/guideline"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="99dp">

    <TextView
        android:id="@+id/textView12"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="MapView"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="230dp" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout2"
    android:layout_width="0dp"
    android:layout_height="120dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="8dp"
    android:gravity="center"
    android:orientation="vertical"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toBottomOf="@+id/linearLayout"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="227dp">

    <TextView
        android:id="@+id/textView13"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Alert View"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="358dp" />
</LinearLayout>

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="8dp"
    android:gravity="center"
    android:orientation="vertical"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout3"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
    tools:layout_constraintBottom_creator="0"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_constraintTop_creator="0"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="355dp">

    <TextView
        android:id="@+id/textView14"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Recycler View"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="522dp" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout3"
    android:layout_width="0dp"
    android:layout_height="48dp"
    android:orientation="horizontal"
    app:layout_constraintBottom_toBottomOf="@+id/constraintLayout"
    app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
    app:layout_constraintRight_toRightOf="@+id/constraintLayout"
    tools:layout_constraintBottom_creator="0"
    tools:layout_constraintLeft_creator="0"
    tools:layout_constraintRight_creator="0"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="554dp">

  </LinearLayout>
</android.support.constraint.ConstraintLayout>

Body:
I was having a similar issue... but then I discovered I was using androidX but mistakenly put

    <android.support.constraint.Guideline
        android:id="@+id/guideline3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_begin="406dp" />

instead of using the androidX equivalent

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_begin="406dp" />

I hope this helps someone out there


问:
Phone Number Validation Javascript
I want users to allow only phone numbers in following format

xxx-xxx-xxxx or xxxxxxxxxx all digits only . Can some one suggest a regular expression to do this ?

Title: Phone Number Validation Javascript

Body:
The following regular expression can be used to validate defined and operational (as of 6/2011) telephone area codes within the U.S.:

var area_code_RE=
 '(2(?:0[1-35-9]|1[02-9]|2[4589]|3[1469]|4[08]|5[1-46]|6[0279]|7[068]|8[13])'+
 '|3(?:0[1-57-9]|1[02-9]|2[0139]|3[014679]|47|5[12]|6[019]|8[056])'+
 '|4(?:0[126-9]|1[02-579]|2[3-5]|3[0245]|4[023]|6[49]|7[0589]|8[04])'+
 '|5(?:0[1-57-9]|1[0235-8]|[23]0|4[01]|5[179]|6[1-47]|7[01234]|8[056])'+
 '|6(?:0[1-35-9]|1[024-9]|2[0368]|3[016]|4[16]|5[01]|6[012]|7[89]|8[29])'+
 '|7(?:0[1-4678]|1[2-9]|2[047]|3[1247]|4[07]|5[47]|6[02359]|7[02-59]|8[156])'+
 '|8(?:0[1-8]|1[02-8]|28|3[0-25]|4[3578]|5[06-9]|6[02-5]|7[028])'+
 '|9(?:0[1346-9]|1[02-9]|2[0578]|3[15679]|4[0179]|5[124679]|7[1-35689]|8[0459])'+
 ')';


问:
Top Down Approach for this dynamic programming problem
Here is the problem-

You are given array B of size n. You have to construct array A such that 1<=A[i]<=B[i] and sum of the absolute difference of consecutive pairs of A is maximized ,that is, summation of abs(A[i]-A[i-1]) is maximised.You have to return this cost.

Example B=[1,2,3] A can be [1,2,1],[1,1,3],[1,2,3] In all these cases cost is 2 which is the maximum.

Constraints n<=10^5 ,1<=B[i]<=100

Here is my approach -
Cost will be maximum when A[i]=1 or A[i]=B[i]

So I created dp[idx][flag][curr] of size [100002][2][102] where it calculates the cost till index idx. flag will be 0 or 1 representing if A[i] should be 1 or B[i] respectively. curr will be the value of A[i] depending upon flag

Here is my code

```<code>     #include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long int ll;
#define mod 1000000007

 ll n;
ll dp[100002][2][101];
ll b[100005];
 ll solve(ll idx,ll flag,ll curr)
 {

     if(idx>=n)
         return 0;
     ll s1=0;
    if(dp[idx][flag][curr]!=-1)
        return dp[idx][flag][curr];
     if(idx==0)
     {
         int left=solve(idx+1,0,curr);
         int right=solve(idx+1,1,curr);
         return dp[idx][flag][curr]=max(left,right);
     }
     else
     {
         if(flag==0)
         {
             s1=abs(curr-1);
             return dp[idx][flag][curr]=s1+max(solve(idx+1,0,1),solve(idx+1,1,1));
         }
         else
         {
             s1=abs(b[idx]-curr);
        return dp[idx][flag][curr]=s1+max(solve(idx+1,0,b[idx]),solve(idx+1,1,b[idx]));
         }
     }
 }

int main()
{
    boost
ll t;
cin>>t;
while(t--)
{
cin>>n;
memset(dp,-1,sizeof(dp));
ll res=0;
for(int i=0;i<n;i++)
    cin>>b[i];
ll s1=solve(0,0,1);//Starting from idx 0 flag 0 and value as 1
ll s2=solve(0,1,b[0]);//Starting from idx 0 flag 1 and value as B[0]
cout<<max(s1,s2)<<"\n";
}
}'
</code>```

Is there any way to reduce states of dp or any other top down solution because my code fails if values of B[i] are large

答:
Actually I found the solution using only two states idx and flag </p>

```<code>#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll n,k;
ll dp[100002][2];
ll b[100005];

ll solve(ll idx,ll flag)
{
    if(idx>=n-1)
        return 0;
    if(dp[idx][flag]!=-1)
        return dp[idx][flag];
    ll val=(flag==1)?b[idx]:1;
    ll left=solve(idx+1,0)+val-1;
    ll right=solve(idx+1,1)+abs(val-b[idx+1]);
    return (dp[idx][flag]=max(left,right));
}

int main()
{
ll t;
cin>>t;
while(t--)
{
cin>>n;
memset(dp,-1,sizeof(dp));
ll res=0;
for(int i=0;i<n;i++)
    cin>>b[i];
ll s1=solve(0,0);
ll s2=solve(0,1);
cout<<max(s1,s2)<<"\n";
}
}
</code>```

Body:
Here is the problem-

You are given array B of size n. You have to construct array A such that 1<=A[i]<=B[i] and sum of the absolute difference of consecutive pairs of A is maximized ,that is, summation of abs(A[i]-A[i-1]) is maximised.You have to return this cost.

Example B=[1,2,3] A can be [1,2,1],[1,1,3],[1,2,3] In all these cases cost is 2 which is the maximum.

Constraints n<=10^5 ,1<=B[i]<=100

Here is my approach -
Cost will be maximum when A[i]=1 or A[i]=B[i]

So I created dp[idx][flag][curr] of size [100002][2][102] where it calculates the cost till index idx. flag will be 0 or 1 representing if A[i] should be 1 or B[i] respectively. curr will be the value of A[i] depending upon flag

Here is my code

     #include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long int ll;
#define mod 1000000007

 ll n;
ll dp[100002][2][101];
ll b[100005];
 ll solve(ll idx,ll flag,ll curr)
 {

     if(idx>=n)
         return 0;
     ll s1=0;
    if(dp[idx][flag][curr]!=-1)
        return dp[idx][flag][curr];
     if(idx==0)
     {
         int left=solve(idx+1,0,curr);
         int right=solve(idx+1,1,curr);
         return dp[idx][flag][curr]=max(left,right);
     }
     else
     {
         if(flag==0)
         {
             s1=abs(curr-1);
             return dp[idx][flag][curr]=s1+max(solve(idx+1,0,1),solve(idx+1,1,1));
         }
         else
         {
             s1=abs(b[idx]-curr);
        return dp[idx][flag][curr]=s1+max(solve(idx+1,0,b[idx]),solve(idx+1,1,b[idx]));
         }
     }
 }

int main()
{
    boost
ll t;
cin>>t;
while(t--)
{
cin>>n;
memset(dp,-1,sizeof(dp));
ll res=0;
for(int i=0;i<n;i++)
    cin>>b[i];
ll s1=solve(0,0,1);//Starting from idx 0 flag 0 and value as 1
ll s2=solve(0,1,b[0]);//Starting from idx 0 flag 1 and value as B[0]
cout<<max(s1,s2)<<"\n";
}
}'

Is there any way to reduce states of dp or any other top down solution because my code fails if values of B[i] are large

Body:
Actually I found the solution using only two states idx and flag

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll n,k;
ll dp[100002][2];
ll b[100005];

ll solve(ll idx,ll flag)
{
    if(idx>=n-1)
        return 0;
    if(dp[idx][flag]!=-1)
        return dp[idx][flag];
    ll val=(flag==1)?b[idx]:1;
    ll left=solve(idx+1,0)+val-1;
    ll right=solve(idx+1,1)+abs(val-b[idx+1]);
    return (dp[idx][flag]=max(left,right));
}

int main()
{
ll t;
cin>>t;
while(t--)
{
cin>>n;
memset(dp,-1,sizeof(dp));
ll res=0;
for(int i=0;i<n;i++)
    cin>>b[i];
ll s1=solve(0,0);
ll s2=solve(0,1);
cout<<max(s1,s2)<<"\n";
}
}


问:
How do you prefer functions to fail in python
I'm currently writing a style guide for programmers and just wondered how you prefer functions to fail soft.

I'm not talking about actual errors but for instance if you have a function that is should return a parameter from the command line and that parameter is not found.

Should the function:

Return an empty string

Return False

Return a constant "fail" string

Raise an exception that the caller can catch in a try

I'm seeing a combination of all of these and wondered, as a programmer which you prefer to see when using a library.

(My preference is 2 so you can do

```<code>thing=getsomething(thing_to_get)
if thing:
  #deal with thing
else:
  #deal with missing thing
</code>```

)

答:
It depends on your program but most of the time it's better to send a message to the user and tell him why the program can't be executed. for example if the user should provide some input argument but he didn't, you can print a message and help the user how to run program correctly.

You should consider that it's not acceptable for an ideal program to terminate suddenly with an error! even with a clear message. instead it's better to give the user why program can't run and give him another chance to try.

Body:
I'm currently writing a style guide for programmers and just wondered how you prefer functions to fail soft.

I'm not talking about actual errors but for instance if you have a function that is should return a parameter from the command line and that parameter is not found.

Should the function:

Return an empty string

Return False

Return a constant "fail" string

Raise an exception that the caller can catch in a try

I'm seeing a combination of all of these and wondered, as a programmer which you prefer to see when using a library.

(My preference is 2 so you can do

thing=getsomething(thing_to_get)
if thing:
  #deal with thing
else:
  #deal with missing thing

)


问:
What is a concise way of counting how many requests were sent?
I am wondering how to count the number of sent requests concisely. There is an API that allows you to send maximum 50 requests in a minute to any endpoint of that API. Every 60 seconds they reset the number of requests that I sent to zero again, after the first request were sent.
I need to do a lot of requests and I wonder, how I can keep track of them correctly.

```<code>async dataCollector(){
    let urlList = this.urlList; // 100+ urls
    for(let url in urlList){
      await this.getResource(url).then( data =>
        // do something with data
      )
}
</code>```

Now I have to somehow check in getResource() how many requests I sent and so on such that I just wait until more requests are available. What would be the best way to check them?

```<code>getResource(url){
    return this.http.get(url);
}
</code>```

I appreciate any advise.

答:
You could keep a count of the requests sent, and the time of the first request. You also need a way to wait for the previous requests, that can be done with a Promise chain:

```<code> chain = Promise.resolve();
 count = 0;
 first = undefined;

 aquireSlot() {
    return this.chain = this.chain.then(async () => {
       if(this.count >= 20) {
         await timer(60_000 - (Date.now() - this.first));
         this.count = 0;
         this.first = undefined;
       }
       if(!this.first) this.first = Date.now();
       this.count += 1;
    });
 }

 async getResource(url){
   await this.aquireSlot();
   return await this.http.get(url);
 }

  // the implementation of timer is left to the reader
</code>```

With this code, every getResource call kind of ends in a queue (a promise chain). If the queue only has less than 20 elements, the chain simply continues and the calls are done. If there are 20 elements, the queue is paused till at least 60 seconds passed since the first call. Then the count is reset, and the whole thing repeats.

Body:
I am wondering how to count the number of sent requests concisely. There is an API that allows you to send maximum 50 requests in a minute to any endpoint of that API. Every 60 seconds they reset the number of requests that I sent to zero again, after the first request were sent.
I need to do a lot of requests and I wonder, how I can keep track of them correctly.

async dataCollector(){
    let urlList = this.urlList; // 100+ urls
    for(let url in urlList){
      await this.getResource(url).then( data =>
        // do something with data
      )
}

Now I have to somehow check in getResource() how many requests I sent and so on such that I just wait until more requests are available. What would be the best way to check them?

getResource(url){
    return this.http.get(url);
}

I appreciate any advise.

Body:
You could keep a count of the requests sent, and the time of the first request. You also need a way to wait for the previous requests, that can be done with a Promise chain:

 chain = Promise.resolve();
 count = 0;
 first = undefined;

 aquireSlot() {
    return this.chain = this.chain.then(async () => {
       if(this.count >= 20) {
         await timer(60_000 - (Date.now() - this.first));
         this.count = 0;
         this.first = undefined;
       }
       if(!this.first) this.first = Date.now();
       this.count += 1;
    });
 }

 async getResource(url){
   await this.aquireSlot();
   return await this.http.get(url);
 }

  // the implementation of timer is left to the reader

With this code, every getResource call kind of ends in a queue (a promise chain). If the queue only has less than 20 elements, the chain simply continues and the calls are done. If there are 20 elements, the queue is paused till at least 60 seconds passed since the first call. Then the count is reset, and the whole thing repeats.


问:
Shiny save multiple reactive data frames in one xlsx file R
Im trying to save two data frames in one xlsx file, each one in a different sheet. The thing is that each data frame is a reactive object that depends on the same action button to generate them. The code in the download is like this: </p>

```<code>output$downloadtable <- downloadHandler(
                                  filename = function(){
                                    paste("file.csv")
                                  },
                                  content = function(file){
                                       write.xlsx(dataframe1(), file, row.names = FALSE, sheetName = "Hoja1")
                                       write.xlsx(dataframe2(), file, row.names = FALSE, append = TRUE, sheetName = "Hoja2")
                                  }
                              )
</code>```

<p>The problem is that I only get in my excel file the "Hoja2" sheet with the second data frame and not the first one... Somebody knows what might be wrong with this? </p>

答:
```<code>library(openxlsx)

filename = function() {
    "mydata.xlsx"
  },
  content = function(file) {

g= openxlsx::createWorkbook()
   openxlsx::addWorksheet(wb,"Hoja1")
   openxlsx::writeData(wb,"Hoja1",dataframe1())

   openxlsx::addWorksheet(wb,"Hoja2")
   openxlsx::writeData(wb,"Hoja2",dataframe2())

   openxlsx::saveWorkbook(g,file)

  }
</code>```

Body:
Im trying to save two data frames in one xlsx file, each one in a different sheet. The thing is that each data frame is a reactive object that depends on the same action button to generate them. The code in the download is like this:

output$downloadtable <- downloadHandler(
                                  filename = function(){
                                    paste("file.csv")
                                  },
                                  content = function(file){
                                       write.xlsx(dataframe1(), file, row.names = FALSE, sheetName = "Hoja1")
                                       write.xlsx(dataframe2(), file, row.names = FALSE, append = TRUE, sheetName = "Hoja2")
                                  }
                              )

The problem is that I only get in my excel file the "Hoja2" sheet with the second data frame and not the first one... Somebody knows what might be wrong with this?


问:
How to insert hyperlinks in Rich Text Box in RTF format
I'm trying to insert a hyperlink to a Rich Text Box in WinForms (using .NET Framework 4.6.1).
The way I'm doing it is asking both the URL and text to be inserted, and afterwards appending it to the rtb (I know it might be better to do it with a selected text, then only asking for the URL).

But when I try to append the RTF it's as if it wasn't appended at all. The way I append it is the following:

   string rtf = $"{{\\field{{\\*\\fldinst HYPERLINK \"{url}\"}}{{\\fldrslt {urlText}}}}}";
   richTb.Rtf += rtf;
```

I've also tried appending to richTb.SelectionRtf instead, but I got the same result. Am I missing something??

答:
For WinForms you can try to use LinkLabel

```<code>LinkLabel link = new LinkLabel();
link.Text = "Microsoft";
LinkLabel.Link data = new LinkLabel.Link();
data.LinkData = "https://www.microsoft.com/";
link.Links.Add(data);
link.Location = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength);
richTextBox1.Controls.Add(link);
</code>```

For WPF you have to insert hyperlinks like Hyperlink not like text:

```<code>Paragraph parx = new Paragraph();
Run run1 = new Run("Text preceeding the hyperlink.");
Run run2 = new Run("Text following the hyperlink.");
Run run3 = new Run("Link Text.");

Hyperlink hyperl = new Hyperlink(run3);
hyperl.NavigateUri = new Uri("http://search.msn.com");

parx.Inlines.Add(run1);
parx.Inlines.Add(hyperl);
parx.Inlines.Add(run2);
</code>```

Adding a paragraph to the RichTextBox should look like

```<code>richTextBox1.IsDocumentEnabled = true;
richTextBox1.Document.Blocks.Add(parx);
</code>```

Body:
I'm trying to insert a hyperlink to a Rich Text Box in WinForms (using .NET Framework 4.6.1).
The way I'm doing it is asking both the URL and text to be inserted, and afterwards appending it to the rtb (I know it might be better to do it with a selected text, then only asking for the URL).

But when I try to append the RTF it's as if it wasn't appended at all. The way I append it is the following:

   string rtf = $"{{\\field{{\\*\\fldinst HYPERLINK \"{url}\"}}{{\\fldrslt {urlText}}}}}";
   richTb.Rtf += rtf;

I've also tried appending to richTb.SelectionRtf instead, but I got the same result. Am I missing something??

Body:
For WinForms you can try to use LinkLabel

LinkLabel link = new LinkLabel();
link.Text = "Microsoft";
LinkLabel.Link data = new LinkLabel.Link();
data.LinkData = "https://www.microsoft.com/";
link.Links.Add(data);
link.Location = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength);
richTextBox1.Controls.Add(link);

For WPF you have to insert hyperlinks like Hyperlink not like text:

Paragraph parx = new Paragraph();
Run run1 = new Run("Text preceeding the hyperlink.");
Run run2 = new Run("Text following the hyperlink.");
Run run3 = new Run("Link Text.");

Hyperlink hyperl = new Hyperlink(run3);
hyperl.NavigateUri = new Uri("http://search.msn.com");

parx.Inlines.Add(run1);
parx.Inlines.Add(hyperl);
parx.Inlines.Add(run2);

Adding a paragraph to the RichTextBox should look like

richTextBox1.IsDocumentEnabled = true;
richTextBox1.Document.Blocks.Add(parx);


问:
Is there a DOM event that fires when an HTML select element is closed?
I'm looking for a DOM event that I can listen to with JavaScript for when a select element that has been opened (but no options changed) is then closed by clicking off the select element, somewhere (anywhere) else on the page.

It's not the blur event of the select, because the select retains focus. Likewise, it's not the focus event of some other element or the document, or a mousedown or click on the window, document or body.

It's not the change event of the select, since no option within the select has been changed.

I'm not concerned about legacy Internet Explorers - just something to work in standards compliant modern browsers. Proprietary hacks could be worth knowing though.

I've created a JSFiddle to demonstrate the problem: http://jsfiddle.net/premasagar/FpfnM/

Click on the selectbox in the "Result" panel

Click on the text marked "HERE" (or anywhere else) with a single click and see if any event is added to the log. There isn't an event in the latest Chrome or Firefox.

So the question is: What JavaScript could be added, to get an event logged when clicking off the selectbox?

(I've asked a similar, but different question here:

JavaScript on iOS: opening an HTML select element)

答:
I got the following events by following the directions on your JSFiddle to the letter:

```<code>BODY, mousedown, STRONG
#document, mousedown, STRONG
window, mousedown, STRONG
SELECT, blur, SELECT
BODY, click, STRONG
#document, click, STRONG
window, click, STRONG
</code>```

These are all events that were triggered when I clicked "HERE" after the select menu was already in focus and expanded. This was in the latest version of Chrome.

Shouldn't any one of these suffice for your purposes?

Edit: If you want to make sure it's your Select element that's losing focus, set a global Javascript variable, 'selectFocused', and set it to False. Set it to True when your Select menu receives focus, and set it to False when any of the above events occurs. 'selectFocused' can now be used anywhere in your code to detect whether or not your Select element currently has focus, and when it changes values, you know your Select element has been selected or unselected.

Body:
I got the following events by following the directions on your JSFiddle to the letter:

BODY, mousedown, STRONG
#document, mousedown, STRONG
window, mousedown, STRONG
SELECT, blur, SELECT
BODY, click, STRONG
#document, click, STRONG
window, click, STRONG

These are all events that were triggered when I clicked "HERE" after the select menu was already in focus and expanded. This was in the latest version of Chrome.

Shouldn't any one of these suffice for your purposes?

Edit: If you want to make sure it's your Select element that's losing focus, set a global Javascript variable, 'selectFocused', and set it to False. Set it to True when your Select menu receives focus, and set it to False when any of the above events occurs. 'selectFocused' can now be used anywhere in your code to detect whether or not your Select element currently has focus, and when it changes values, you know your Select element has been selected or unselected.


问:
Is there a way to inline/add a non-publicly accessible image to a Google Doc using the Docs API?
Looking at the API guide here https://developers.google.com/docs/api/how-tos/images, the banner states that "The image must be publicly accessible using the URL that you provide in this method."

Is there any other way that I can add/inline a non-public image to a Google Doc through the API?For example, if I have an image stored in my Drive, or image byte data that is in the scope of the code.

答: It's not possible with the Docs API. There is a Feature Request on Google's Issue Tracker to insert images only with the Drive Id, if the user has access to the file and the Doc. You can click on the star next to the issue number to give more prioirity to the request and to receive updates.</p>


问:
contenteditable not working in IE 10
I am trying to create client side editable table. Here is my code. It works in Chrome, Firefox but not in IE. Is there anything more to do with script for IE?</p>

```<code><script type="text/javascript"       src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(document).ready(function() {

$("td").click(function(){
if($(this).attr("contentEditable") == true){
    $(this).attr("contentEditable","false");
} else {
    $(this).attr("contentEditable","true");
}
})
});
</script>

<p>
<table id='transitTable' border="1" cellspacing="2" cellpadding="2" class='display'    width="400">
<tr id='1'>
<td >H1</td>
<td >H2</td>
<td >H3</td>
<td >H4</td></tr>
<tr id='2'>
<td >R1</td>
<td >R1</td>
<td >R1</td>
<td >R1</td></tr>
<tr id='3'>
<td >R2</td>
<td >R2</td>
<td >R2</td>
<td>R2</td></tr></table></p>
</code>```

答:
Below code will work in IE as well chrome without meshup the GUI.</p>

```<code>   <td contentEditable="true">
    <div contentEditable="true">
        ...
    </div>
   </td>
</code>```

Title: contenteditable not working in IE 10

Body:
I am trying to create client side editable table. Here is my code. It works in Chrome, Firefox but not in IE. Is there anything more to do with script for IE?

H1
H2
H3
H4

R1
R1
R1
R1

R2
R2
R2
R2

Body:
Below code will work in IE as well chrome without meshup the GUI.

   <td contentEditable="true">
    <div contentEditable="true">
        ...
    </div>
   </td>