问:
Webview shows error "Didn't find class "android.webkit.RenderProcessGoneDetail"
My tablet Android version is 7.0 and Chrome version 62.0.3202.84.

When first run my webview app, debug window show

Didn't find class "android.webkit.RenderProcessGoneDetail

RenderProcessGoneDetail is android 8.0 API

How do I prevent the error message?

```<code>11-28 13:23:13.133 28584-28584/com.himart.omni.himartomniapp I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.eb>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:652)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View com.android.internal.policy.PhoneLayoutInflater.onCreateView(java.lang.String, android.util.AttributeSet) (PhoneLayoutInflater.java:58)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:724)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:792)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:734)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:865)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:873)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:525)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:427)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:378)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.policy.PhoneWindow.setContentView(int) (PhoneWindow.java:459)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.setContentView(int) (Activity.java:2548)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.himart.omni.himartomniapp.view.activity.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:257)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Looper.loop() (Looper.java:154)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.RenderProcessGoneDetail" on path: DexPathList[[zip file "/data/app/com.android.chrome-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-1/lib/arm, /data/app/com.android.chrome-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:652)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View com.android.internal.policy.PhoneLayoutInflater.onCreateView(java.lang.String, android.util.AttributeSet) (PhoneLayoutInflater.java:58)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:724)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:792)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:734)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:865)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:873)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:525)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:427)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:378)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.policy.PhoneWindow.setContentView(int) (PhoneWindow.java:459)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.setContentView(int) (Activity.java:2548)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.himart.omni.himartomniapp.view.activity.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:257)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Looper.loop() (Looper.java:154)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)
</code>```

答:
It appears to be a bug, more details here: https://groups.google.com/a/chromium.org/forum/#!topic/android-webview-dev/m0EtO3IXNn0

On N+ new ART logging appears to have been introduced letting app
  developers know about certain binary compatibility problems in their
  code. Unfortunately, this is triggering for some of the API-level
  guarded code in WebView.

One example is "Failed resolution of:
  Landroid/webkit/RenderProcessGoneDetail;", which is triggered whenever
  a recent version of WebView with O features is used on an N device.
  This is harmless, but confusing and spammy to developers looking at
  logcat.

Body:
My tablet Android version is 7.0 and Chrome version 62.0.3202.84.

When first run my webview app, debug window show

Didn't find class "android.webkit.RenderProcessGoneDetail

RenderProcessGoneDetail is android 8.0 API

How do I prevent the error message?

11-28 13:23:13.133 28584-28584/com.himart.omni.himartomniapp I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.eb>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:652)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View com.android.internal.policy.PhoneLayoutInflater.onCreateView(java.lang.String, android.util.AttributeSet) (PhoneLayoutInflater.java:58)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:724)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:792)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:734)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:865)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:873)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:525)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:427)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:378)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.policy.PhoneWindow.setContentView(int) (PhoneWindow.java:459)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.setContentView(int) (Activity.java:2548)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.himart.omni.himartomniapp.view.activity.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:257)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Looper.loop() (Looper.java:154)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.RenderProcessGoneDetail" on path: DexPathList[[zip file "/data/app/com.android.chrome-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-1/lib/arm, /data/app/com.android.chrome-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:652)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View com.android.internal.policy.PhoneLayoutInflater.onCreateView(java.lang.String, android.util.AttributeSet) (PhoneLayoutInflater.java:58)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:724)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:792)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:734)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:865)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:873)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:828)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:525)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:427)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:378)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.policy.PhoneWindow.setContentView(int) (PhoneWindow.java:459)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.setContentView(int) (Activity.java:2548)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.himart.omni.himartomniapp.view.activity.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:257)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6955)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1126)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2927)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3045)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.-wrap14(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1642)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.os.Looper.loop() (Looper.java:154)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6776)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1496)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1386)


来源: stackexchange

问:
Communicating between different docker services in docker-compose
I just started working with docker-compose and am currently struggling with communication between the different services.

I have 2 services, alice and bob. I want these to be able to send http requests to each other. As far as I understood, services should be able to reach each other by using the servicename as hostname.

Unfortunately, alice in my example is not able to reach bob on http://bob:5557, and bob is not able to reach alice on http://alice:5556.

What am I not understanding correctly? Is it even possible to make http requests between services?

This is my docker-compose.yml file:

```<code>version: '3'
services:
  alice:
    build: blockchain
    ports:
    - "5556:5000"
    environment:
      NAME: Alice
  bob:
    build: blockchain
    ports:
    - "5557:5000"
    environment:
      NAME: Bob
</code>```

答:
As clearly documented in Networking in Compose

Networked service-to-service communication use the CONTAINER_PORT

Thus you should use the container ports to communicate between the containers.
http://bob:5000 and http://alice:5000 .

ContentLicense: CC BY-SA 3.0

Body:
I just started working with docker-compose and am currently struggling with communication between the different services.

I have 2 services, alice and bob. I want these to be able to send http requests to each other. As far as I understood, services should be able to reach each other by using the servicename as hostname.

Unfortunately, alice in my example is not able to reach bob on http://bob:5557, and bob is not able to reach alice on http://alice:5556.

What am I not understanding correctly? Is it even possible to make http requests between services?

This is my docker-compose.yml file:

version: '3'
services:
  alice:
    build: blockchain
    ports:
    - "5556:5000"
    environment:
      NAME: Alice
  bob:
    build: blockchain
    ports:
    - "5557:5000"
    environment:
      NAME: Bob


问:
How to watch a CMap (CArray) object, based on its memory address
I'm still working with the same script, I mentioned in this other StackOverflow post.

General idea:

open a dumpfile, using a script

view the memory addresses of all variables

try to get some information

This time the dt function seems to be failing on a CMap object:

```<code>dt <application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> m_nCount 000000eab8748430
Ambiguous matches found for <application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> (dumping largest sized):
<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>::~CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>
<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>::CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> {0x02b bytes}
</code>```

In order to solve this, I tried to open the object in Visual Studio watch-window, but this seems to be failing, regardless of what I try:

```<code>(CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "sCMap..." is undefined
(CMap)0x000000eab8748430 => identifier "CMap" is undefined
(<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "<application_name>" is undefined
(mfc110u!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "mfc110u" is undefined
...
</code>```

However this way of working seems to be working for other MFC classes, like CStringArray:

```<code>(CStringArray*)0x000000eab87c6d10 => this is giving good results
</code>```

Does anybody know how I can show a CMap (or CArray) object in Visual Studio's watch-window, based on its memory address?

答:
It seems that the debugger has problems with the CMap definition, and by removing the __ptr64 entries from the type definition (mind the space at the beginning of __ptr64), I can see the content of the variable:

```<code>(CMap<int,int,CUIntArray *,CUIntArray *>*) 0x000000eab8748430
</code>```

I believe there is a bug in the debugger :-)

ContentLicense: CC BY-SA 4.0

Body:
I'm still working with the same script, I mentioned in this other StackOverflow post.

General idea:

open a dumpfile, using a script

view the memory addresses of all variables

try to get some information

This time the dt function seems to be failing on a CMap object:

dt <application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> m_nCount 000000eab8748430
Ambiguous matches found for <application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> (dumping largest sized):
<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>::~CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>
<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>::CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> {0x02b bytes}

In order to solve this, I tried to open the object in Visual Studio watch-window, but this seems to be failing, regardless of what I try:

(CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "sCMap..." is undefined
(CMap)0x000000eab8748430 => identifier "CMap" is undefined
(<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "<application_name>" is undefined
(mfc110u!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "mfc110u" is undefined
...

However this way of working seems to be working for other MFC classes, like CStringArray:

(CStringArray*)0x000000eab87c6d10 => this is giving good results

Does anybody know how I can show a CMap (or CArray) object in Visual Studio's watch-window, based on its memory address?

Body:
It seems that the debugger has problems with the CMap definition, and by removing the __ptr64 entries from the type definition (mind the space at the beginning of __ptr64), I can see the content of the variable:

(CMap<int,int,CUIntArray *,CUIntArray *>*) 0x000000eab8748430

I believe there is a bug in the debugger :-)


问:
How to toggle running Xcode project in debug or release mode by using only shortcut keys?
By default, to "run" my project in release mode, I need to edit the scheme's run settings to use "release" instead of debug.

To not have to edit the scheme each time I want to switch between debug and release mode, I created a new scheme which runs in release. But this is still tedious since I need to click on the relevant scheme if I want to switch.

Is there a way that I can automatically (build + run) in debug / release mode using only short cut keys ?

I don't wan't to profile! Because that launches instruments etc.

EDIT: To be clear - I'm always running on the device.

答:
The equivalent in XCode that you seek is the "schemes".

Right of the play/stop buttons, there a pretty handy scheme selector. You just need to create a scheme for debug and another for distribution.

In order to make a scheme for debug or distribution, simply go to the scheme configuration (either selecting "edit scheme..." or "new scheme...") and choose the correct build configuration under "Run -> Build Configuration":

Note: I have XCode 9.1, I don't know if this is valid for older versions.


问:
dyld: Library not loaded: @rpath/Charts.framework/Chart Reason: image not found Xcode 9.1 Crashes at Runtime
I am getting following error.Please help if anyone is having an idea.I have tried all the solutions but still facing same error.

dyld: Library not loaded: @rpath/Charts.framework/Charts
    Referenced from: /Users/adaptteq2017/Library/Developer/CoreSimulator/Devices/18393604-6D9B-4427-85A2-E0DB4F71DF0D/data/Containers/Bundle/Application/7FE7854D-35F1-4DE4-9049-DA7D936A903F/ezSchool.app/ezSchool
    Reason: image not found

答:
Facing the same issue.

Follow this process:

Remove the Chart frame work..

Check Chart Framework add in General-> Embedded Binaries + --> ChartFramework.

Add ChartFrame Work in General-> LinkedFrameworks

Build Phase--> Click on + --> Copy File select FrameWork

Add Chart.FrameWork in it.

Clean n Build.

It Works for me.


问:
Writing to a memory mapped text file printing NULL till the end of mapped memory
In this code, Im writing some text to a memory mapped text file. Data is written to the file successfully, but when i open it with notepad, after the written data, "NULL" is repeatedly written upto the mapped memory limit which is greater than the text i have written.

What could be the possible reason?

```<code>pLogMsg = (char*)calloc(1024,sizeof(char));
printf("[INFO] entering logger writeback thread\n");

log_file = CreateFile (TEXT("one.txt"),             // Open one.txt.
                    GENERIC_READ | GENERIC_WRITE,   // Open for reading and writing
                    FILE_SHARE_WRITE,               // file share
                    NULL,                           // No security
                    OPEN_ALWAYS,                    // Open or create
                    FILE_ATTRIBUTE_NORMAL,          // Normal file
                    NULL);                          // No template file
if (log_file == INVALID_HANDLE_VALUE)
{
    printf("%d [ERR] cant open file GLE %d\n",GetCurrentThreadId(),GetLastError());
    return -1;
}
hMapping = CreateFileMapping( log_file, 0, PAGE_READWRITE, 0,4096 ,0 );
if (hMapping == INVALID_HANDLE_VALUE)
{
    printf("%d [ERR] cant create file mapping %d\n",GetCurrentThreadId(),GetLastError());
    return -1;
}
pFileData = (CHAR*)MapViewOfFile( hMapping, FILE_MAP_ALL_ACCESS, 0,0, 0 );
if (pFileData == NULL)
{
    printf("%d [ERR] cant mapview of file %d\n",GetCurrentThreadId(),GetLastError());
    return -1;
}
pLogMsg = LogPrint();//returns a null terminated string
memcpy(pFileData,pLogMsg,strlen(pLogMsg));
pFileData += strlen(pLogMsg);
free(pLogMsg);
</code>```

答:
There is no 'end of file' marker within the file.  You need to set the file length, so the OS marks it correctly.

See MSDN documentation for SetEndOfFile

Sets the physical file size for the specified file to the current position of the file pointer.

Body:
In this code, Im writing some text to a memory mapped text file. Data is written to the file successfully, but when i open it with notepad, after the written data, "NULL" is repeatedly written upto the mapped memory limit which is greater than the text i have written.

What could be the possible reason?

pLogMsg = (char*)calloc(1024,sizeof(char));
printf("[INFO] entering logger writeback thread\n");

log_file = CreateFile (TEXT("one.txt"),             // Open one.txt.
                    GENERIC_READ | GENERIC_WRITE,   // Open for reading and writing
                    FILE_SHARE_WRITE,               // file share
                    NULL,                           // No security
                    OPEN_ALWAYS,                    // Open or create
                    FILE_ATTRIBUTE_NORMAL,          // Normal file
                    NULL);                          // No template file
if (log_file == INVALID_HANDLE_VALUE)
{
    printf("%d [ERR] cant open file GLE %d\n",GetCurrentThreadId(),GetLastError());
    return -1;
}
hMapping = CreateFileMapping( log_file, 0, PAGE_READWRITE, 0,4096 ,0 );
if (hMapping == INVALID_HANDLE_VALUE)
{
    printf("%d [ERR] cant create file mapping %d\n",GetCurrentThreadId(),GetLastError());
    return -1;
}
pFileData = (CHAR*)MapViewOfFile( hMapping, FILE_MAP_ALL_ACCESS, 0,0, 0 );
if (pFileData == NULL)
{
    printf("%d [ERR] cant mapview of file %d\n",GetCurrentThreadId(),GetLastError());
    return -1;
}
pLogMsg = LogPrint();//returns a null terminated string
memcpy(pFileData,pLogMsg,strlen(pLogMsg));
pFileData += strlen(pLogMsg);
free(pLogMsg);


问:
Custom loop not displaying all available posts
I am having trouble with a custom Wordpress / ACF loop I am working on.

The idea is that it displays the latest posts within the 'events' post type, hiding any posts where the event date has passed.

The posts do hide if the date has passed. However the loop is not displaying the full amount of posts available. Currently with the loop below, it is only showing 6 out of the available 10.

I have checked the reading settings in Wordpress and that's fine.

The code I am using for my loop is:

```<code><ul class="events-list">

<?php
    $loop = new WP_Query( array(
        'post_type' => 'events',
        'posts_per_page' => -1,
        'orderby' => 'meta_value',
        'order' => 'ASC',
        'meta_type' => 'DATE',
        'meta_key' => 'event-date'
    ));

    while ( $loop->have_posts() ) : $loop->the_post();

    $today = date('dmY');
    $expire = get_field('event-date');

    if( $expire > $today )

{ ?>

    <li>
        <h3><?php the_field('event-date'); ?> - <?php the_title(); ?></h3>
        <span class="time"><?php the_field('event-time'); ?></span>
        <?php the_field('event-details'); ?>
    </li>

<?php; } endwhile; wp_reset_query(); ?>

</ul>
</code>```

答:
The solution to this problem was to change the loop to:</p>

```<code><?php

    $today = date('Ymd');

    $loop = new WP_Query( array(
        'post_type' => 'events',
        'showposts' => 2,
        'meta_key' => 'event-date',
        'meta_compare' => '>',
        'meta_value' => date("Ymd"),
        'orderby' => 'meta_value_num',
        'order' => 'ASC'
    ));

    while ( $loop->have_posts() ) : $loop->the_post();

{ ?>

Post stuff here

<?php; } endwhile; wp_reset_query(); ?>
</code>```

Body:
I am having trouble with a custom Wordpress / ACF loop I am working on.

The idea is that it displays the latest posts within the 'events' post type, hiding any posts where the event date has passed.

The posts do hide if the date has passed. However the loop is not displaying the full amount of posts available. Currently with the loop below, it is only showing 6 out of the available 10.

I have checked the reading settings in Wordpress and that's fine.

The code I am using for my loop is:

<?php
    $loop = new WP_Query( array(
        'post_type' => 'events',
        'posts_per_page' => -1,
        'orderby' => 'meta_value',
        'order' => 'ASC',
        'meta_type' => 'DATE',
        'meta_key' => 'event-date'
    ));

    while ( $loop->have_posts() ) : $loop->the_post();

    $today = date('dmY');
    $expire = get_field('event-date');

    if( $expire > $today )

{ ?>

<?php the_field('event-date'); ?> - <?php the_title(); ?>

        <?php the_field('event-time'); ?>
        <?php the_field('event-details'); ?>

<?php; } endwhile; wp_reset_query(); ?>

Body:
The solution to this problem was to change the loop to:

<?php

    $today = date('Ymd');

    $loop = new WP_Query( array(
        'post_type' => 'events',
        'showposts' => 2,
        'meta_key' => 'event-date',
        'meta_compare' => '>',
        'meta_value' => date("Ymd"),
        'orderby' => 'meta_value_num',
        'order' => 'ASC'
    ));

    while ( $loop->have_posts() ) : $loop->the_post();

{ ?>

Post stuff here

<?php; } endwhile; wp_reset_query(); ?>


问:
Vue.js: progress upload doesn't render in view
I'm trying to make an uploader component in Vuejs + Firebase Storage. The method works fine, but I can't get to show the percent uploaded in the view. Here my code:

```<code><template>

  <div>
    <input type="file" multiple accept="image/*" @change="detectFiles($event.target.files)">
    <div>{{progressUpload}}</div>
  </div>

</template>

<script>

import { storage } from '../firebase'
export default {
  data () {
    return {
      progressUpload: 0,
      file: File,
    }
  },
  methods: {
    detectFiles (fileList) {
      Array.from(Array(fileList.length).keys()).map( x => {
        this.upload(fileList[x])
      })
    },
    upload (file) {
      let uploadTask = storage.ref('imagenes/articulos').put(file);

      uploadTask.on('state_changed', function(snapshot) {
        this.progressUpload = Math.floor(snapshot.bytesTransferred / snapshot.totalBytes * 100);
      })

      uploadTask.then(() => {
        console.info('File uploaded!');
      })
    }
  }
}
</script>
</code>```

Writing {{ progressUpload }} in the HTML template, doesn't show nothing. But in the console, the result is logged perfectly. The file is uploaded properly

答:
Ok, I found the solution. I had to add the uploadProgress calculation into a watcher that returns the new value of the upload task async method. So, my script has been as follows:</p>

```<code><script>

import { storage } from '../firebase'
export default {
  data () {
    return {
      progressUpload: 0,
      file: File,
      uploadTask: ''
    }
  },
  methods: {
    detectFiles (fileList) {
      Array.from(Array(fileList.length).keys()).map( x => {
        this.upload(fileList[x])
      })
    },
    upload (file) {
      this.uploadTask = storage.ref('imagenes/articulos').put(file);

      this.uploadTask.then(() => {
        console.info('Archivo guardado correctamente');
      })
    }
  },
  watch: {
    uploadTask: function() {
      this.uploadTask.on('state_changed', sp => {
        this.progressUpload = Math.floor(sp.bytesTransferred / sp.totalBytes * 100)
      })
    }
  }
}
</script>
</code>```

Body:
I'm trying to make an uploader component in Vuejs + Firebase Storage. The method works fine, but I can't get to show the percent uploaded in the view. Here my code:

<template>

    <input type="file" multiple accept="image/*" @change="detectFiles($event.target.files)">

{{progressUpload}}

</template>

Writing {{ progressUpload }} in the HTML template, doesn't show nothing. But in the console, the result is logged perfectly. The file is uploaded properly

Body:
Ok, I found the solution. I had to add the uploadProgress calculation into a watcher that returns the new value of the upload task async method. So, my script has been as follows:

<script>

import { storage } from '../firebase'
export default {
  data () {
    return {
      progressUpload: 0,
      file: File,
      uploadTask: ''
    }
  },
  methods: {
    detectFiles (fileList) {
      Array.from(Array(fileList.length).keys()).map( x => {
        this.upload(fileList[x])
      })
    },
    upload (file) {
      this.uploadTask = storage.ref('imagenes/articulos').put(file);

      this.uploadTask.then(() => {
        console.info('Archivo guardado correctamente');
      })
    }
  },
  watch: {
    uploadTask: function() {
      this.uploadTask.on('state_changed', sp => {
        this.progressUpload = Math.floor(sp.bytesTransferred / sp.totalBytes * 100)
      })
    }
  }
}
</script>


问:
How to edit this text file as merged information with same headers
I have a huge text file with data like this:-

```<code>EAST DUBBO - Unknown
EAST MAITLAND - 1892
EAST MAITLAND - 1902
EAST MAITLAND - 1920
EAST MAITLAND - 1937
EAST MAITLAND - 1940
EAST MAITLAND - 1956
EBOR - 1905
EBOR - 1911
EDEN - Unknown
ELLENBOROUGH - 1905
ELONG ELONG - 1920
ELONG ELONG - 1955
</code>```

and I need it to be in this format:-

```<code>EAST DUBBO - Unknown
EAST MAITLAND - 1892, 1902, 1920, 1937, 1940, 1956
EBOR - 1905, 1911
EDEN - Unknown
ELLENBOROUGH - 1905
ELONG ELONG - 1920, 1955
</code>```

It will take days to do by hand so i'm wondering if it can be solved programmatically or if there is an online tool?

答:
This can be done with a short and simple one-liner using datamash[1]:

```<code>datamash -t - --sort groupby 1 collapse 2 < your_file.txt
</code>```

Output:

```<code>EAST DUBBO - Unknown
EAST MAITLAND - 1892, 1902, 1920, 1937, 1940, 1956
EBOR - 1905, 1911
EDEN - Unknown
ELLENBOROUGH - 1905
ELONG ELONG - 1920, 1955
</code>```

-t - sets the field delimiter to a dash

--sort does what it says

groupby 1 sets the the first field as the one you want go be aggregated

collapse 2 tells datamash to list the corresponding values from the second field (rather than counting them or doing some other operation)

And for the fun of it, here another awk solution, similar to CWLiu's solution but not dependent on gawk. sed removes the last comma in the line, and sort does, well, the sorting.

```<code>awk 'BEGIN { FS="-"; OFS="-" }\
           { x[$1] = x[$1] $2 "," }\
       END { for( i in x ) print i, x[i] }'\
           your_file.txt | sed s'/.$//' | sort
</code>```

[1] If datamash is not on your system already, your package manager will certainly have it. Or you can download the latest version here.

Body:
I have a huge text file with data like this:-

EAST DUBBO - Unknown
EAST MAITLAND - 1892
EAST MAITLAND - 1902
EAST MAITLAND - 1920
EAST MAITLAND - 1937
EAST MAITLAND - 1940
EAST MAITLAND - 1956
EBOR - 1905
EBOR - 1911
EDEN - Unknown
ELLENBOROUGH - 1905
ELONG ELONG - 1920
ELONG ELONG - 1955

and I need it to be in this format:-

EAST DUBBO - Unknown
EAST MAITLAND - 1892, 1902, 1920, 1937, 1940, 1956
EBOR - 1905, 1911
EDEN - Unknown
ELLENBOROUGH - 1905
ELONG ELONG - 1920, 1955

It will take days to do by hand so i'm wondering if it can be solved programmatically or if there is an online tool?

Body:
This can be done with a short and simple one-liner using datamash[1]:

datamash -t - --sort groupby 1 collapse 2 < your_file.txt

Output:

EAST DUBBO - Unknown
EAST MAITLAND - 1892, 1902, 1920, 1937, 1940, 1956
EBOR - 1905, 1911
EDEN - Unknown
ELLENBOROUGH - 1905
ELONG ELONG - 1920, 1955

-t - sets the field delimiter to a dash

--sort does what it says

groupby 1 sets the the first field as the one you want go be aggregated

collapse 2 tells datamash to list the corresponding values from the second field (rather than counting them or doing some other operation)

And for the fun of it, here another awk solution, similar to CWLiu's solution but not dependent on gawk. sed removes the last comma in the line, and sort does, well, the sorting.

awk 'BEGIN { FS="-"; OFS="-" }\
           { x[$1] = x[$1] $2 "," }\
       END { for( i in x ) print i, x[i] }'\
           your_file.txt | sed s'/.$//' | sort

[1] If datamash is not on your system already, your package manager will certainly have it. Or you can download the latest version here.


问:
Finding Self-Intersections in Leaflet polygons using JSTS Library
I'm using Mapbox with Leaflet Draw, and I would like to avoid self-intersecting polygons.

I can already specify to not allow intersections while creating the draw control, but it only works when I use the control to create a new polygon. However, if I try to edit an already existing polygon, it allows intersections over there.

I searched around and found the JSTS Library which does exactly what I want, and I also found this JSFiddle to use as an example, where it works based on the Google Maps API.

So I created my own JSFiddle with Mapbox based on the above two links. Here, the 'findSelfIntersects' function kicks in if it's a polygon edit, and it is not used if it is a new polygon. The idea is that, if there's an intersection, I'll show an alert to the user and cancel the edit. However, when I try to do this, I'm getting an uncaught exception: [object Object] error.

The error seems to be formed on this line of the findSelfIntersects function:

```<code>var shell = geometryFactory.createLinearRing(coordinates);
</code>```

I checked out the coordinates returned by the Google Maps example, and that does seem similar to the coordinates I'm getting. But I'm not sure why I'm getting this error.

答:
I just noticed that in the Google Maps example, the starting and ending points were the same in the coordinates array, whereas mine weren't. I had missed it initially. Now I've added the below code after the 'for' loop, and it works fine.

```<code>coordinates.push(new jsts.geom.Coordinate(
    corners[0].lat, corners[0].lng));
</code>```

This is an updated JSFiddle in case anyone wants to use the JSTS library with Mapbox/Leaflet.

Body:
I'm using Mapbox with Leaflet Draw, and I would like to avoid self-intersecting polygons.

I can already specify to not allow intersections while creating the draw control, but it only works when I use the control to create a new polygon. However, if I try to edit an already existing polygon, it allows intersections over there.

I searched around and found the JSTS Library which does exactly what I want, and I also found this JSFiddle to use as an example, where it works based on the Google Maps API.

So I created my own JSFiddle with Mapbox based on the above two links. Here, the 'findSelfIntersects' function kicks in if it's a polygon edit, and it is not used if it is a new polygon. The idea is that, if there's an intersection, I'll show an alert to the user and cancel the edit. However, when I try to do this, I'm getting an uncaught exception: [object Object] error.

The error seems to be formed on this line of the findSelfIntersects function:

var shell = geometryFactory.createLinearRing(coordinates);

I checked out the coordinates returned by the Google Maps example, and that does seem similar to the coordinates I'm getting. But I'm not sure why I'm getting this error.

Body:
I just noticed that in the Google Maps example, the starting and ending points were the same in the coordinates array, whereas mine weren't. I had missed it initially. Now I've added the below code after the 'for' loop, and it works fine.

coordinates.push(new jsts.geom.Coordinate(
    corners[0].lat, corners[0].lng));

This is an updated JSFiddle in case anyone wants to use the JSTS library with Mapbox/Leaflet.


问:
Put list items into another list without transforming into list of list
I have code like below:

```<code>xx, yy = np.meshgrid(np.linspace(-5, 5, 500), np.linspace(-5, 5, 500))

Z = model.decision_function(np.c_[xx.ravel(), yy.ravel()])
</code>```

However, my code should be flexible enough to handle one feature and two feature case. Therefore, I plan to change my code into below:

```<code>xx, yy = np.meshgrid(np.linspace(-5, 5, 500), np.linspace(-5, 5, 500))

npc = [xx.ravel()]* feature_number

Z = model.decision_function(np.c_[npc])
</code>```

Unfortunately, npc is already a list, and when I decide to put it into np.c_[npc] it become double layer list. Any idea to use the dynamic method but still perform like the initial method?

答:
I think I understand. It seems all you need to do is just tile your array. You can use np.tile -

```<code>npc = np.tile(xx.ravel(), feature_number)
</code>```

npc will be repeated feature_number of times, and will remain a 1D array.

Body:
I have code like below:

xx, yy = np.meshgrid(np.linspace(-5, 5, 500), np.linspace(-5, 5, 500))

Z = model.decision_function(np.c_[xx.ravel(), yy.ravel()])

However, my code should be flexible enough to handle one feature and two feature case. Therefore, I plan to change my code into below:

xx, yy = np.meshgrid(np.linspace(-5, 5, 500), np.linspace(-5, 5, 500))

npc = [xx.ravel()]* feature_number

Z = model.decision_function(np.c_[npc])

Unfortunately, npc is already a list, and when I decide to put it into np.c_[npc] it become double layer list. Any idea to use the dynamic method but still perform like the initial method?

Body:
I think I understand. It seems all you need to do is just tile your array. You can use np.tile -

npc = np.tile(xx.ravel(), feature_number)

npc will be repeated feature_number of times, and will remain a 1D array.


问:
I am unable to access the webelement without using the find_elements
```<code>paymentNumber = driver.find_elements_by_xpath('.//*[@id="search"]')
paymentNumber.send_keys(check_number)
</code>```

but as it returns a list I am unable to send values to the textbox. Already tried with find_element_by_xpath(''), it just crashes by raising exception:raise exception_class(message, screen, stacktrace):cant locate the webelement

Error:   File

line 53, in downloadFile
      paymentNumber.send_keys(check_number) AttributeError: ("'list' object has no attribute 'send_keys'", u'occurred at index 0')

答:
The reason you are seeing the error AttributeError: ("'list' object has no attribute 'send_keys'", u'occurred at index 0') is because, you have used find_elements_by_xpath method which returns a List.

We can't invoke send_keys method on a List but we can invoke send_keys method on individual WebElement.

So the solution will be to use find_element_* method. You can use either of the following block of code :

Using find_element_by_id :

```<code>paymentNumber = driver.find_element_by_id("search")
paymentNumber.send_keys(check_number)
</code>```

Using find_element_by_xpath :

```<code>paymentNumber = driver.find_element_by_xpath("//*[@id='search']")
paymentNumber.send_keys(check_number)
</code>```

Body:
paymentNumber = driver.find_elements_by_xpath('.//*[@id="search"]')
paymentNumber.send_keys(check_number)

but as it returns a list I am unable to send values to the textbox. Already tried with find_element_by_xpath(''), it just crashes by raising exception:raise exception_class(message, screen, stacktrace):cant locate the webelement

Error:   File

line 53, in downloadFile
      paymentNumber.send_keys(check_number) AttributeError: ("'list' object has no attribute 'send_keys'", u'occurred at index 0')

Body:
The reason you are seeing the error AttributeError: ("'list' object has no attribute 'send_keys'", u'occurred at index 0') is because, you have used find_elements_by_xpath method which returns a List.

We can't invoke send_keys method on a List but we can invoke send_keys method on individual WebElement.

So the solution will be to use find_element_* method. You can use either of the following block of code :

Using find_element_by_id :

paymentNumber = driver.find_element_by_id("search")
paymentNumber.send_keys(check_number)

Using find_element_by_xpath :

paymentNumber = driver.find_element_by_xpath("//*[@id='search']")
paymentNumber.send_keys(check_number)


问:
Apply CSS at module level in angular 2
I have developed an application with three big modules. I want to apply some common CSS to 2 modules but the third module will have a different CSS. I do not want to apply the css of the first 2 modules to the third module.

I cannot apply css at component level because each module has many sub modules, component and sub components.

Please suggest a way to implement the CSS at module level.

Thanks In Advance

答: In an Angular app you should use ::ng-deep since /deep/ and >>> are deprecated. This link might help.

Title: Apply CSS at module level in angular 2


问:
Regex Group Capture to swap parts of the word places
I am trying to write a function that moves consonants from the start of word to the end of the word using $2$1.

My code is below and I have researched the problem and attempted multiple variations of my function. Cannot understand why it is not working.

```<code>function groupCap(s){
  str = s.replace(/(^[b-df-hj-np-tv-z]+)(\.$)/, '$2$1');
  return str;
}
groupCap("map");
</code>```

答:
Note that \.$ matches a dot and then asserts the position at the end of the string. You need to match and capture into Group 2 any chars there are in the string.

Use

function groupCap(s){
  str = s.replace(/^([b-df-hj-np-tv-z]+)(.*)/, '$2$1');
  return str;
}
console.log(groupCap("map"));```

Replace .* with [^]* if there can be line breaks in the string as . does not match line break chars, and [^] matches any char other than nothing, that is, all chars in the BMP plane.

Body:
I am trying to write a function that moves consonants from the start of word to the end of the word using $2$1.

My code is below and I have researched the problem and attempted multiple variations of my function. Cannot understand why it is not working.

function groupCap(s){
  str = s.replace(/(^[b-df-hj-np-tv-z]+)(\.$)/, '$2$1');
  return str;
}
groupCap("map");

Body:
Note that \.$ matches a dot and then asserts the position at the end of the string. You need to match and capture into Group 2 any chars there are in the string.

Use

function groupCap(s){
  str = s.replace(/^([b-df-hj-np-tv-z]+)(.*)/, '$2$1');
  return str;
}
console.log(groupCap("map"));

Replace .* with [^]* if there can be line breaks in the string as . does not match line break chars, and [^] matches any char other than nothing, that is, all chars in the BMP plane.


问:
Retain parent instance if using SelectMany on nested collection
I have a collection of my model Person:

```<code>class Person
{
    public string FirstName {get; set;}
    public string LastName {get; set;}
    public string Company {get; set;}
    public IEnumerable<string> Tags {get; set;}
}
</code>```

and would transform this one by LINQ into another collection grouped by tags. How can I do that?

My approach so far:

```<code>var result = PersonCollection
    .SelectMany(m => m.Tags)
    .GroupBy(b => b);
</code>```

But this throws all informations about the person away.

答:
You can persist the Person in an anonymous type:

```<code>var result = PersonCollection
    .SelectMany(p => p.Tags.Select(t => new{ Person = p, Tag = t }))
    .GroupBy(x => x.Tag);
</code>```

Now these groups still contain the tags as key and the persons:

```<code>foreach (var tagPersons in result)
{
    Console.WriteLine($"Tag: {tagPersons.Key}");
    Console.Write($" all persons: {string.Join(",", tagPersons.Select(x => x.Person.LastName))}");
}
</code>```

Body:
I have a collection of my model Person:

class Person
{
    public string FirstName {get; set;}
    public string LastName {get; set;}
    public string Company {get; set;}
    public IEnumerable<string> Tags {get; set;}
}

and would transform this one by LINQ into another collection grouped by tags. How can I do that?

My approach so far:

var result = PersonCollection
    .SelectMany(m => m.Tags)
    .GroupBy(b => b);

But this throws all informations about the person away.

Body:
You can persist the Person in an anonymous type:

var result = PersonCollection
    .SelectMany(p => p.Tags.Select(t => new{ Person = p, Tag = t }))
    .GroupBy(x => x.Tag);

Now these groups still contain the tags as key and the persons:

foreach (var tagPersons in result)
{
    Console.WriteLine($"Tag: {tagPersons.Key}");
    Console.Write($" all persons: {string.Join(",", tagPersons.Select(x => x.Person.LastName))}");
}


问:
PyGTK TextView that only accepts single lines
I feel rather silly to ask this, but how does one create a TextView that only accepts single lines? Most other gui toolkits have a method such as "setMultiline" etc, but PyGTK seems to really enjoy multiple lines. Some other languages have "TextFields" for these simpler text boxes.

http://www.pygtk.org/docs/pygtk/class-gtktextview.html#method-gtktextview--set-justification

答:
Oh I found it. I suppose the name makes sense...

http://www.pygtk.org/docs/pygtk/class-gtkentry.html

ContentLicense: CC BY-SA 2.5


问:
Google App Engine - SSL InsecurePlatformWarning
I'm using python's requests library inside Google App Engine to send GET requests to a private server.  When I make the request I get this warning:

```<code>requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
</code>```

According to the documentation that points to, I need to either upgrade past Python 2.7.x which GAE uses, or use pyopenssl.  Since I don't believe that I can force GAE to use Python 2.7.9 I tried to use pyopenssl.

Following the instruction on the page, I've downloaded the three libraries suggested into the lib directory of my app and where I use requests I try to inject pyopenssl into urllib3 with:

```<code>import requests.packages.urllib3.contrib.pyopenssl
requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()
</code>```

This however, fails in the devserver and the production server with the following traceback:

```<code>Traceback (most recent call last):

File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/main.py", line 24, in <module>
    from API import setupautomatorAPI
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/API.py", line 12, in <module>
    from ServiceActivationTest import uploadSAT, getSATsForService
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/ServiceActivationTest/__init__.py", line 3, in <module>
    from requests.packages.urllib3.contrib import pyopenssl as pyopenssl
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/lib/requests/packages/__init__.py", line 95, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3.contrib.pyopenssl'
</code>```

This import statement works fine in the Python interpreter, and works if I take off the pyopenssl on the end.  pyopenssl is also the first .py file besides __init__.py files in that path.

Am I doing something wrong here?  Is there an easier way to fix the InsecurePlatformWarning?

UPDATE: After going to the sockets API page(Thanks shazow!) I found that part of my problem was that httplib was misbehaving because I lacked an environment variable.  This didn't get rid of the warning, but my certificate is being accepted now!

答:
The best way to solve the InsecurePlatformWarning issue on Google AppEngine is to simply set version: latest for library ssl in app.yaml.

```<code>libraries:
- name: ssl
  version: latest
</code>```

While some people may still have version: 2.7, like I did.

Once this is set, there is no need to modify GAE_USE_SOCKETS_HTTPLIB as suggested by Steven Wendling.   No need to install additional libraries either.

Body:
I'm using python's requests library inside Google App Engine to send GET requests to a private server.  When I make the request I get this warning:

requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning

According to the documentation that points to, I need to either upgrade past Python 2.7.x which GAE uses, or use pyopenssl.  Since I don't believe that I can force GAE to use Python 2.7.9 I tried to use pyopenssl.

Following the instruction on the page, I've downloaded the three libraries suggested into the lib directory of my app and where I use requests I try to inject pyopenssl into urllib3 with:

import requests.packages.urllib3.contrib.pyopenssl
requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()

This however, fails in the devserver and the production server with the following traceback:

Traceback (most recent call last):

File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/main.py", line 24, in <module>
    from API import setupautomatorAPI
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/API.py", line 12, in <module>
    from ServiceActivationTest import uploadSAT, getSATsForService
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/ServiceActivationTest/__init__.py", line 3, in <module>
    from requests.packages.urllib3.contrib import pyopenssl as pyopenssl
  File "/base/data/home/apps/s~servicey1564/1.383321878696068897/lib/requests/packages/__init__.py", line 95, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3.contrib.pyopenssl'

This import statement works fine in the Python interpreter, and works if I take off the pyopenssl on the end.  pyopenssl is also the first .py file besides __init__.py files in that path.

Am I doing something wrong here?  Is there an easier way to fix the InsecurePlatformWarning?

UPDATE: After going to the sockets API page(Thanks shazow!) I found that part of my problem was that httplib was misbehaving because I lacked an environment variable.  This didn't get rid of the warning, but my certificate is being accepted now!

Body:
The best way to solve the InsecurePlatformWarning issue on Google AppEngine is to simply set version: latest for library ssl in app.yaml.

libraries:
- name: ssl
  version: latest

While some people may still have version: 2.7, like I did.

Once this is set, there is no need to modify GAE_USE_SOCKETS_HTTPLIB as suggested by Steven Wendling.   No need to install additional libraries either.


问:
Is there way to apply htmlspecialchars() or html_escape() whole PHP / Codeigniter base website?
I have build a Codeigniter based system.

When edit screens I take values from database and display on input fields.

Example :

```<code>   <input type="text" class="form-control" required="" name="tes_title" value="<?php echo htmlspecialchars($tes_info['tes_title']); ?>">
</code>```

So I had to use htmlspecialchars because some values contains double quotes and single quotes. But adding them manually to all input takes lot of time.

Is there any way to apply htmlspecialchars() or html_escape() whole site wise?

I mean even I use <input type="text" class="form-control" required="" name="tes_title" value="<?php echo $tes_info['tes_title']; ?>"> it should be worked as <input type="text" class="form-control" required="" name="tes_title" value="<?php echo htmlspecialchars($tes_info['tes_title']); ?>">

答:
You can define hook for every submission.

Edit your application/config/hooks.php file

```<code><?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$hook['post_controller_constructor'][] = array(                                 'class'    => 'SpecialChar',
'function' => 'remove_specials',
'filename' => 'removespecial.php',
'filepath' => 'hooks'
);
</code>```

In your function, you have to check if form submitted

ex :

```<code>if ($this->input->post()) {
     foreach($this->input->post() as $post)
     $newValue = htmlspecialchars($post);
}
</code>```

Body:
I have build a Codeigniter based system.

When edit screens I take values from database and display on input fields.

Example :

   <input type="text" class="form-control" required="" name="tes_title" value="<?php echo htmlspecialchars($tes_info['tes_title']); ?>">

So I had to use htmlspecialchars because some values contains double quotes and single quotes. But adding them manually to all input takes lot of time.

Is there any way to apply htmlspecialchars() or html_escape() whole site wise?

I mean even I use <input type="text" class="form-control" required="" name="tes_title" value="<?php echo $tes_info['tes_title']; ?>"> it should be worked as <input type="text" class="form-control" required="" name="tes_title" value="<?php echo htmlspecialchars($tes_info['tes_title']); ?>">

Body:
You can define hook for every submission.

Edit your application/config/hooks.php file

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$hook['post_controller_constructor'][] = array(                                 'class'    => 'SpecialChar',
'function' => 'remove_specials',
'filename' => 'removespecial.php',
'filepath' => 'hooks'
);

In your function, you have to check if form submitted

ex :

if ($this->input->post()) {
     foreach($this->input->post() as $post)
     $newValue = htmlspecialchars($post);
}


问:
_CONTEXT structure debugging on Windows: How to?
[ADDENDUM: QUESTION DOES NOT NEED TO BE ANSWERED DUE TO AN INCORRECT ASSUMPTION ON MY PART; SEE MY ANSWER BELOW, AND MY APOLOGIES]

My client has handed me a tracefile sent by a customer that includes (of relevance) only the CPU register information contained in the _CONTEXT structure at the time an exception was thrown.

I have been enhancing, compiling & building the code (written in C++, with some JNI calls to JVM) for the program for a few months, and the new version I built was just released to customers: hence the tracefile with the bug report.  This tracefile was produced by the program and simply corresponds to spitting out the register data (contained in the _CONTEXT structure) as captured by setting a custom exception handler for the program (via SetUnhandledExceptionFilter()).

My client reports to me that over the years, previous developers have found these tracefiles to be useful and have helped track down bugs, with nothing more than the information in the tracefiles.

I am therefore operating under the assumption that it was in fact the CPU register output from the _CONTEXT structure that previous developers have found useful in the tracefiles, and I am attempting to find a way to interpret that information to help track down what was occurring at the time of the crash.  (i.e., what function was being called and what its arguments were, etc.)

Perhaps it is not feasible to use the CPU register data without any other information, in which case perhaps my client is misleading me and in fact previous developers have had in their possession tracefiles that contained information in addition to the CPU register information.

So, this is one thing I would like to know: Is it feasible, in general, using ONLY the CPU register information available with the _CONTEXT data structure, along with having all source code available in a successful Debug & Release build environment, to obtain useful information?

Assuming the answer is "yes", the second thing I would like to know is:  How does one go about obtaining useful information from the CPU register information contained in the _CONTEXT structure, given that the source code is available, and that this source code builds & runs successfully on the development machine in both Debug & Release mode (but not in the end-user's environment and without any end-user files or data other than the single tracefile noted)?  The goal, I assume, is to locate the function that was called at the time of the exception, based on its address, and hopefully this function will be one that is within the existing code base (and not nested deeply inside the Windows DLL's).  Further, my client indicated that previous developers were even able to obtain arguments to the culprit function that caused the exception (though again, he could be misleading me).

Note that of course the end-user is using the Release-mode build of the program.  I would also assume that the _CONTEXT information spit out in the tracefile will correspond to the CPU used by the end-user.

In short, I am asking how to interpret the various fields of the _CONTEXT structure, which represent the CPU registers on Windows, in a useful way to debug an exception.  What do the registers correspond to and which ones should I be looking at?  Here is a link to a page that includes the definition of the _CONTEXT structure for some (not all) CPU's, as an example of possible _CONTEXT structures: http://msdn.microsoft.com/en-us/library/ms679284%28VS.85%29.aspx.  I am not certain which CPU the end-user is using, but that info will be easily available as needed if I am confident I can get some useful info from the _CONTEXT structure.  Note that the tracefile I have shows 128 (4-byte) entries - which doesn't seem to match the size of any of the _CONTEXT structures I've seen (I also looked in WINNT.H, the actual file that defines the _CONTEXT structure, and at first glance didn't see any possible definitions that contained 128x4 bytes, but that was just a quick glance and I could be mistaken).

I have hunted around for answers or hints, but have not found any useful ones yet.

Thank you,

Dan.

答:
MY QUESTION DID NOT CORRECTLY IDENTIFY THE INFORMATION PRESENT IN THE TRACEFILE, AND DOES NOT NEED TO BE ANSWERED.

My apologies all.

Upon reviewing the code that produces the data in the tracefile noted in the question, I have found that I made a mistake.  It is not the _CONTEXT structure whose values are being spit out into the tracefile, but rather the code is stepping through _CONTEXT::Esp and spitting that out (i.e. it is walking the stack itself, at runtime, in response to an exception - it's not spitting out the contents of the CPU registers).

Therefore my question is no longer relevant.  I leave it here only in case the information in the question (or answer) is useful to others, though the question was not itself answered (nor did it need to be for me).

Thanks,
Dan


问:
How to use Count SQL Server Query
i write this post to ask for help on a query on the following schema:

Imagine having two formats, for example, PDF and EBOOK. My goal is to get the following result:

```<code>PushiblerName  |  Number_PDF   |  Numerber_BOOK  |
--------------------------------------------------
ExampleName1   |    2          |   0
ExampleName2   |    3          |   1
</code>```

Would anyone help me write this query?
Thanks in advance.

答:
You can use this code,</p>

```<code>    SELECT publisher.Name as PublisherName,
        (SELECT COUNT(*)
         FROM T_BOOK book
         JOIN T_BOOK_FORMAT bookformat ON book.Id = bookformat.IdBook
         JOIN T_FORMAT format ON bookformat.IdFormat = format.Id
         WHERE book.IdPublisher = publisher.Id and format.Code='PDF'
         ) AS Number_PDF,
        (SELECT COUNT(*)
         FROM T_BOOK book
         JOIN T_BOOK_FORMAT bookformat ON book.Id = bookformat.IdBook
         JOIN T_FORMAT format ON bookformat.IdFormat = format.Id
         WHERE book.IdPublisher = publisher.Id and format.Code='EBOOK'
         ) AS Number_BOOK
    FROM T_PUBLISHER publisher
    GROUP BY publisher.Id
</code>```

Title: How to use Count SQL Server Query

Body:
i write this post to ask for help on a query on the following schema:

Imagine having two formats, for example, PDF and EBOOK. My goal is to get the following result:

PushiblerName  |  Number_PDF   |  Numerber_BOOK  |
--------------------------------------------------
ExampleName1   |    2          |   0
ExampleName2   |    3          |   1

Would anyone help me write this query?
Thanks in advance.

Body:
You can use this code,

    SELECT publisher.Name as PublisherName,
        (SELECT COUNT(*)
         FROM T_BOOK book
         JOIN T_BOOK_FORMAT bookformat ON book.Id = bookformat.IdBook
         JOIN T_FORMAT format ON bookformat.IdFormat = format.Id
         WHERE book.IdPublisher = publisher.Id and format.Code='PDF'
         ) AS Number_PDF,
        (SELECT COUNT(*)
         FROM T_BOOK book
         JOIN T_BOOK_FORMAT bookformat ON book.Id = bookformat.IdBook
         JOIN T_FORMAT format ON bookformat.IdFormat = format.Id
         WHERE book.IdPublisher = publisher.Id and format.Code='EBOOK'
         ) AS Number_BOOK
    FROM T_PUBLISHER publisher
    GROUP BY publisher.Id


问:
Asp.Net Core MVC - Can I move Identity and DataAccess to class library
I have created an ASP.NET Core MVC Web application with Individual User Account authentication (Identity).

The template has created one Web project, with a whole bunch of folders, including a "Data" folder which has the migrations for the Identity schema, and ApplicationDbContext.

Now, I have some other projects alongside the web app which will need to consume the data.  I don't want them to reference the web project for obvious reasons.

And ideally I don't want my web project to depend directly on EF.

Can I move the data access into a separate class library?  And if so, how!?

答:
Create a class library projects.

Move the content from corewebproject/data to class library projects.

Add following from nuget:

Entity Framework

AspNetCore.Identity

AspNetCore.Identity.EntityFramework

Microsoft.entityframeworkcore.SqlServer

Microsoft.entityframeworkcore.Tools

Microsoft.entityframeworkcore.Tools.Dotnet

Build class library projects.

Add as reference to your web project.

Change reference in startup contextdb file location.

If you want to change you sql server from localdb change defaultconnection in appsettings.

Add reference related files.

Build solutions.

Go to nuget package manager console and select your project.

Run next commands:

'Remove-Migration'. it will remove some file including snapmodel file

Add-Migrations "Name"

update database

Check you database: you can see upadated db with aspnetcore individual account related tables.

!!! Enjoy !!!!


问:
Why 'datas' array is always empty?
My code

```<code> $.getJSON('/load4',
    function (data) {
        for (var i = 0; i < data.length; i++) {
            var counter = data[i];
            datas.push([counter.Id, counter.login.substr(0, 25),'3', counter.hash , 'MA']);
        }
    });
console.log("Datas " + datas);
</code>```

I'm trying to fill my array like [[a,b],[a,c]], but can't.

```<code>datas[i] = [counter.Id, counter.login.substr(0, 25),'3', counter.hash , 'MA'];
</code>```

Also doesn't work.

答:
You have to create a variable datas first.</p>

```<code> var datas =[];
 $.getJSON('/load4',
        function (data) {
            for (var i = 0; i < data.length; i++) {
                var counter = data[i];
                datas.push([counter.Id, counter.login.substr(0, 25),'3', counter.hash , 'MA']);
            }
        });
console.log("Datas " + datas);
</code>```

Title: Why 'datas' array is always empty?

Body:
My code

 $.getJSON('/load4',
    function (data) {
        for (var i = 0; i < data.length; i++) {
            var counter = data[i];
            datas.push([counter.Id, counter.login.substr(0, 25),'3', counter.hash , 'MA']);
        }
    });
console.log("Datas " + datas);

I'm trying to fill my array like [[a,b],[a,c]], but can't.

datas[i] = [counter.Id, counter.login.substr(0, 25),'3', counter.hash , 'MA'];

Also doesn't work.

Body:
You have to create a variable datas first.

 var datas =[];
 $.getJSON('/load4',
        function (data) {
            for (var i = 0; i < data.length; i++) {
                var counter = data[i];
                datas.push([counter.Id, counter.login.substr(0, 25),'3', counter.hash , 'MA']);
            }
        });
console.log("Datas " + datas);


问:
Redirect page after login using php framework laravel
I'm trying to show a page from myController after successful to login.

```<code>$email = $req->input('username');
$pass = $req->input('password');
$login = DB::table('for_login')->where(['E_mail'=>$email, 'Password'=>$pass])->get();
if(count($login)>0) {
    return view('frontEnd.Home');
} else {
    echo "Invalid username/password";
}
</code>```

How can I redirect a page after a successful login?

答:
use
header("location:page.php");</p>

Body:
I'm trying to show a page from myController after successful to login.

$email = $req->input('username');
$pass = $req->input('password');
$login = DB::table('for_login')->where(['E_mail'=>$email, 'Password'=>$pass])->get();
if(count($login)>0) {
    return view('frontEnd.Home');
} else {
    echo "Invalid username/password";
}

How can I redirect a page after a successful login?

Body:
use
header("location:page.php");


问:
AngularJs ng-cloak Problems on large Pages with CSS display:none
I’ve been working on a rather complex and large Angular page. Unlike a typical AngularJS SPA style application this particular page is just that: a single page with a large amount of data on it that has to be visible all at once. The problem is that when this large page loads it flickers and displays template markup briefly before kicking into its actual content rendering. This is is what the Angular ng-cloak is supposed to address, but in this case I had no luck getting it to work properly.

CSS

```<code><style>
   [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
   display: none !important;
   }
</style>
</code>```

HTML

```<code><body ng-controller="MainCtrl">
   <button class="btn btn-primary" ng-click="loadSomething()">Load Something</button>
   <br/>
   <div ng-hide="loaded">
      Loading...
   </div>
   <div ng-show="loaded">
      <p>{{ text }}</p>
   </div>
</body>
</code>```

答:
You need to actually use the class on the thing you're cloaking:

```<code><ANY class="ng-cloak"> ... </ANY>
</code>```

Body:
I’ve been working on a rather complex and large Angular page. Unlike a typical AngularJS SPA style application this particular page is just that: a single page with a large amount of data on it that has to be visible all at once. The problem is that when this large page loads it flickers and displays template markup briefly before kicking into its actual content rendering. This is is what the Angular ng-cloak is supposed to address, but in this case I had no luck getting it to work properly.

CSS

HTML

   <button class="btn btn-primary" ng-click="loadSomething()">Load Something</button>

      Loading...

{{ text }}

Body:
You need to actually use the class on the thing you're cloaking:

<ANY class="ng-cloak"> ... </ANY>


问:
How can I make a clickable UILabel in Swift 3?
I'm trying to make a clickable UILabel by following this code:

```<code>class ViewNotificationsDetails: UIViewController {
   @IBOutlet weak var back: UILabel!

      override func viewDidLoad() {
          super.viewDidLoad()

          let tap = UITapGestureRecognizer(target: self, action: #selector(ViewNotificationsDetails.tapFunction))
          back.isUserInteractionEnabled = true
          back.addGestureRecognizer(tap)
      }

      @objc func tapFunction(sender:UITapGestureRecognizer) {
          print("tap working")
      }
}
</code>```

But when executing the code, I get the error ->

Thread 1: Fatal error: Unexpectedly found nil while unwrapping an
  Optional value on the line "back.isUserInteractionEnabled = true".

What could be the problem?

答:
Use back.userInteractionEnabled = true
you did wrong as isUserInteractionEnabled.

Body:
I'm trying to make a clickable UILabel by following this code:

class ViewNotificationsDetails: UIViewController {
   @IBOutlet weak var back: UILabel!

      override func viewDidLoad() {
          super.viewDidLoad()

          let tap = UITapGestureRecognizer(target: self, action: #selector(ViewNotificationsDetails.tapFunction))
          back.isUserInteractionEnabled = true
          back.addGestureRecognizer(tap)
      }

      @objc func tapFunction(sender:UITapGestureRecognizer) {
          print("tap working")
      }
}

But when executing the code, I get the error ->

Thread 1: Fatal error: Unexpectedly found nil while unwrapping an
  Optional value on the line "back.isUserInteractionEnabled = true".

What could be the problem?


问:
Accuracy in landmarks prediction using dlib
I'm trying to find landmarks using dlib. So, I'm fitting my model with HELEN dataset, there are 2000 items downloaded from here. But accuracy is very very low. But when I use shape_predictor_68_face_landmarks.dat accuracy is high. I've read the Kazemi paper and set nu as 0.1, depth=4 and oversampling_amount=20, but it's still work badly. What's wrong?</p>

答: Dlib landmark trainer uses default parameters if size of the dataset is large enough but bounding box for the detected face should be square. Since faces are almost symmetric, augmenting the dataset by flipping the images vertically may increase the accuracy.</p>


问:
How do I convert this for loop into enhanced for loop?
I´m struggling with making enhanced for loop from this regular for loop. I want each element of my String ArrayList to be equal to its value + " done"

```<code>for (int i = 0; i < stringList.size(); i ++)
{
    stringList.set(i, stringList.get(i) + " done");
}
</code>```

Thank you for helping me.

答:
You can't use an enhanced for loop for this.

Either continue to use your existing code (which is fine for a RandomAccess list), or use List.replaceAll:

```<code>stringList.replaceAll(s -> s + " done");
</code>```

Or, if you're still stuck on a pre-Java 8 version, use the code in the Java 8 Javadoc:

```<code> final ListIterator<String> li = stringList.listIterator();
 while (li.hasNext()) {
     li.set(li.next() + " done");
 }
</code>```

Body:
I´m struggling with making enhanced for loop from this regular for loop. I want each element of my String ArrayList to be equal to its value + " done"

for (int i = 0; i < stringList.size(); i ++)
{
    stringList.set(i, stringList.get(i) + " done");
}

Thank you for helping me.

Body:
You can't use an enhanced for loop for this.

Either continue to use your existing code (which is fine for a RandomAccess list), or use List.replaceAll:

stringList.replaceAll(s -> s + " done");

Or, if you're still stuck on a pre-Java 8 version, use the code in the Java 8 Javadoc:

 final ListIterator<String> li = stringList.listIterator();
 while (li.hasNext()) {
     li.set(li.next() + " done");
 }