问:
JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException:
I am working on VPN app and follows the code of strongswan app. I have used the code of this  app and it is loading .so files through JNI and i have copied these files from the strongswan project. It gives this exception for one of these files:

```A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.strongswan.android.logic.CharonVpnService" on path: DexPathList[[zip file "/data/app/com.whizpool.vpn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.whizpool.vpn-1/lib/arm, /data/app/com.whizpool.vpn-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
art/runtime/java_vm_ext.cc:410]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
art/runtime/java_vm_ext.cc:410]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
art/runtime/java_vm_ext.cc:410]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
art/runtime/java_vm_ext.cc:410]   at void com.whizpool.vpn.logic.CharonVpnService.<clinit>() (CharonVpnService.java:744)
art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3772)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.access$2100(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:221)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1882)
art/runtime/java_vm_ext.cc:410]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
art/runtime/java_vm_ext.cc:410]   at void android.os.Looper.loop() (Looper.java:158)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7224)
art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
art/runtime/java_vm_ext.cc:410]
art/runtime/java_vm_ext.cc:410]     in call to NewGlobalRef
art/runtime/java_vm_ext.cc:410]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
art/runtime/java_vm_ext.cc:410] "main" prio=5 tid=1 Runnable
art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/java_vm_ext.cc:410]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 0 0 0 ) utm=15 stm=9 core=6 HZ=100
art/runtime/java_vm_ext.cc:410]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
art/runtime/java_vm_ext.cc:410]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/java_vm_ext.cc:410]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/java_vm_ext.cc:410]   native: #02 pc 0025b30b  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+742)
art/runtime/java_vm_ext.cc:410]   native: #03 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/java_vm_ext.cc:410]   native: #05 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/java_vm_ext.cc:410]   native: #06 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/java_vm_ext.cc:410]   native: #07 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/java_vm_ext.cc:410]   native: #08 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/java_vm_ext.cc:410]   native: #09 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/java_vm_ext.cc:410]   native: #10 pc 0020d51d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/java_vm_ext.cc:410]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/java_vm_ext.cc:410]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/java_vm_ext.cc:410]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class.newInstance!(Native method)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/java_vm_ext.cc:410]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/java_vm_ext.cc:410]   at android.os.Looper.loop(Looper.java:158)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/java_vm_ext.cc:410]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/java_vm_ext.cc:410]
A/art: art/runtime/runtime.cc:366] Runtime aborting...
art/runtime/runtime.cc:366] Aborting thread:
art/runtime/runtime.cc:366] "main" prio=5 tid=1 Native
art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/runtime.cc:366]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/runtime.cc:366]   | state=R schedstat=( 0 0 0 ) utm=15 stm=10 core=4 HZ=100
art/runtime/runtime.cc:366]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
art/runtime/runtime.cc:366]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/runtime.cc:366]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/runtime.cc:366]   native: #02 pc 00333fb9  /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const+28)
art/runtime/runtime.cc:366]   native: #03 pc 00334257  /system/lib/libart.so (art::Runtime::Abort()+566)
art/runtime/runtime.cc:366]   native: #04 pc 000f476b  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
art/runtime/runtime.cc:366]   native: #05 pc 0025b635  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
art/runtime/runtime.cc:366]   native: #06 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/runtime.cc:366]   native: #07 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/runtime.cc:366]   native: #08 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/runtime.cc:366]   native: #09 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/runtime.cc:366]   native: #10 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/runtime.cc:366]   native: #11 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/runtime.cc:366]   native: #12 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/runtime.cc:366]   native: #13 pc 0020d51d  /system/framework/arm/boot.oat (???)
art/runtime/runtime.cc:366]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/runtime.cc:366]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/runtime.cc:366]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/runtime.cc:366]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/runtime.cc:366]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/runtime.cc:366]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Class.newInstance!(Native method)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:158)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/runtime.cc:366] Pending exception java.lang.ClassNotFoundException: Didn't find class "org.strongswan.android.logic.CharonVpnService" on path: DexPathList[[zip file "/data/app/com.whizpool.vpn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.whizpool.vpn-1/lib/arm, /data/app/com.whizpool.vpn-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
art/runtime/runtime.cc:366]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
art/runtime/runtime.cc:366]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
art/runtime/runtime.cc:366]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
art/runtime/runtime.cc:366]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
art/runtime/runtime.cc:366]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
art/runtime/runtime.cc:366]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
art/runtime/runtime.cc:366]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
art/runtime/runtime.cc:366]   at void com.whizpool.vpn.logic.CharonVpnService.<clinit>() (CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.access$2100(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:221)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
art/runtime/runtime.cc:366]   at void android.os.Looper.loop() (Looper.java:158)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
art/runtime/runtime.cc:366]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
art/runtime/runtime.cc:366] Dumping all threads without appropriate locks held: thread list lock mutator lock
art/runtime/runtime.cc:366] All threads:
art/runtime/runtime.cc:366] DALVIK THREADS (12):
art/runtime/runtime.cc:366] "main" prio=5 tid=1 Runnable
art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/runtime.cc:366]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/runtime.cc:366]   | state=R schedstat=( 0 0 0 ) utm=15 stm=12 core=0 HZ=100
art/runtime/runtime.cc:366]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/runtime.cc:366]   | held mutexes= "abort lock" "mutator lock"(shared held)
art/runtime/runtime.cc:366]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/runtime.cc:366]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/runtime.cc:366]   native: #02 pc 0035b0b7  /system/lib/libart.so (art::DumpCheckpoint::Run(art::Thread*)+446)
art/runtime/runtime.cc:366]   native: #03 pc 0035bc79  /system/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure*)+212)
art/runtime/runtime.cc:366]   native: #04 pc 0035c1ef  /system/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+154)
art/runtime/runtime.cc:366]   native: #05 pc 003341cd  /system/lib/libart.so (art::Runtime::Abort()+428)
art/runtime/runtime.cc:366]   native: #06 pc 000f476b  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
art/runtime/runtime.cc:366]   native: #07 pc 0025b635  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
art/runtime/runtime.cc:366]   native: #08 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/runtime.cc:366]   native: #09 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/runtime.cc:366]   native: #10 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/runtime.cc:366]   native: #11 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/runtime.cc:366]   native: #12 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/runtime.cc:366]   native: #13 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/runtime.cc:366]   native: #14 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/runtime.cc:366]   native: #15 pc 0020d51d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
art/runtime/runtime.cc:366]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/runtime.cc:366]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/runtime.cc:366]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/runtime.cc:366]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/runtime.cc:366]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/runtime.cc:366]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Class.newInstance!(Native method)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:158)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/runtime.cc:366]
art/runtime/runtime.cc:366] "Signal Catcher" prio=5 tid=2 WaitingInMainSignalCatcherLoop
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c680a0 self=0xee3e2c00
art/runtime/runtime.cc:366]   | sysTid=15407 nice=0 cgrp=default sched=0/0 handle=0xf425c930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=5 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf4160000-0xf4162000 stackSize=1014KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: do_sigtimedwait+0xd8/0x1ac
art/runtime/runtime.cc:366]   kernel: compat_SyS_rt_sigtimedwait+0x94/0xd8
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 0004135c  /system/lib/libc.so (__rt_sigtimedwait+12)
art/runtime/runtime.cc:366]   native: #01 pc 0001d0df  /system/lib/libc.so (sigwait+22)
art/runtime/runtime.cc:366]   native: #02 pc 0033aae9  /system/lib/libart.so (art::SignalCatcher::WaitForSignal(art::Thread*, art::SignalSet&)+76)
art/runtime/runtime.cc:366]   native: #03 pc 0033c535  /system/lib/libart.so (art::SignalCatcher::Run(void*)+260)
art/runtime/runtime.cc:366]   native: #04 pc 0003fc53  /system/lib/libc.so (__pthread_start(void*)+30)
art/runtime/runtime.cc:366]   native: #05 pc 0001a38b  /system/lib/libc.so (__start_thread+6)
art/runtime/runtime.cc:366]   (no managed stack frames)
art/runtime/runtime.cc:366]
art/runtime/runtime.cc:366] "JDWP" prio=5 tid=3 WaitingInMainDebuggerLoop
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c6b0a0 self=0xee43b900
art/runtime/runtime.cc:366]   | sysTid=15408 nice=0 cgrp=default sched=0/0 handle=0xf415d930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=5 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf4061000-0xf4063000 stackSize=1014KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: poll_schedule_timeout+0x54/0xb8
art/runtime/runtime.cc:366]   kernel: do_select+0x414/0x468
art/runtime/runtime.cc:366]   kernel: compat_core_sys_select+0x160/0x20c
art/runtime/runtime.cc:366]   kernel: compat_sys_pselect6+0x178/0x214
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 00041278  /system/lib/libc.so (__pselect6+20)
art/runtime/runtime.cc:366]   native: #01 pc 0001c431  /system/lib/libc.so (select+60)
art/runtime/runtime.cc:366]   native: #02 pc 00402093  /system/lib/libart.so (art::JDWP::JdwpAdbState::ProcessIncoming()+218)
art/runtime/runtime.cc:366]   native: #03 pc 00267a2f  /system/lib/libart.so (art::JDWP::JdwpState::Run()+314)
art/runtime/runtime.cc:366]   native: #04 pc 002688ad  /system/lib/libart.so (art::JDWP::StartJdwpThread(void*)+16)
art/runtime/runtime.cc:366]   native: #05 pc 0003fc53  /system/lib/libc.so (__pthread_start(void*)+30)
art/runtime/runtime.cc:366]   native: #06 pc 0001a38b  /system/lib/libc.so (__start_thread+6)
art/runtime/runtime.cc:366]   (no managed stack frames)
art/runtime/runtime.cc:366]
A/art: art/runtime/runtime.cc:366] "ReferenceQueueDaemon" prio=5 tid=4 Waiting
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c64e80 self=0xee43a500
art/runtime/runtime.cc:366]   | sysTid=15409 nice=0 cgrp=default sched=0/0 handle=0xf405e930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=4 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf3f5c000-0xf3f5e000 stackSize=1038KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
art/runtime/runtime.cc:366]   kernel: futex_wait+0xd8/0x1cc
art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
art/runtime/runtime.cc:366]   kernel: compat_SyS_futex+0xd0/0x14c
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 00017684  /system/lib/libc.so (syscall+28)
art/runtime/runtime.cc:366]   native: #01 pc 000f6d05  /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+96)
art/runtime/runtime.cc:366]   native: #02 pc 002bf87d  /system/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+1144)
art/runtime/runtime.cc:366]   native: #03 pc 002c05db  /system/lib/libart.so (art::Monitor::Wait(art::Thread*, art::mirror::Object*, long long, int, bool, art::ThreadState)+142)
art/runtime/runtime.cc:366]   native: #04 pc 002d1e2b  /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+38)
```

<p>Excecption pointing error at this line :</p>

```System.loadLibrary("androidbridge");
```

<p>Package name in the exception is the package name of the project from where i copied the code.
<code>org.strongswan.android.logic.CharonVpnService</code></p>

<p>but my app's package name is <code>com.whizpool.vpn.logic.CharonVpnService</code>.</p>

<p>I have searched this <code>org.strongswan.android</code> every where but no where in my project.</p>

<p>here is my manifest file:</p>

``` <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.whizpool.vpn">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.whizpool.vpn.action.START_PROFILE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <service
            android:name=".logic.VpnStateService"
            android:exported="false" >
        </service>
        <service
            android:name=".logic.CharonVpnService"
            android:exported="false"
            android:permission="android.permission.BIND_VPN_SERVICE" >
            <intent-filter>
                <action android:name="android.net.VpnService" />
            </intent-filter>
        </service>

        <provider
            android:name=".data.LogContentProvider"
            android:authorities="com.whizpool.vpn.content.log"
            android:exported="true" >

        </provider>
    </application>

</manifest>[enter link description here][1]
```

答:
Be careful with the package name of the native file (XXX.so file)

if the so file is not in the correct package/directory, you may get this error.

Body:
I am working on VPN app and follows the code of strongswan app. I have used the code of this  app and it is loading .so files through JNI and i have copied these files from the strongswan project. It gives this exception for one of these files:

A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.strongswan.android.logic.CharonVpnService" on path: DexPathList[[zip file "/data/app/com.whizpool.vpn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.whizpool.vpn-1/lib/arm, /data/app/com.whizpool.vpn-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
art/runtime/java_vm_ext.cc:410]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
art/runtime/java_vm_ext.cc:410]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
art/runtime/java_vm_ext.cc:410]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
art/runtime/java_vm_ext.cc:410]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
art/runtime/java_vm_ext.cc:410]   at void com.whizpool.vpn.logic.CharonVpnService.<clinit>() (CharonVpnService.java:744)
art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3772)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.access$2100(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:221)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1882)
art/runtime/java_vm_ext.cc:410]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
art/runtime/java_vm_ext.cc:410]   at void android.os.Looper.loop() (Looper.java:158)
art/runtime/java_vm_ext.cc:410]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7224)
art/runtime/java_vm_ext.cc:410]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
art/runtime/java_vm_ext.cc:410]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
art/runtime/java_vm_ext.cc:410]
art/runtime/java_vm_ext.cc:410]     in call to NewGlobalRef
art/runtime/java_vm_ext.cc:410]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
art/runtime/java_vm_ext.cc:410] "main" prio=5 tid=1 Runnable
art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/java_vm_ext.cc:410]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 0 0 0 ) utm=15 stm=9 core=6 HZ=100
art/runtime/java_vm_ext.cc:410]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
art/runtime/java_vm_ext.cc:410]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/java_vm_ext.cc:410]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/java_vm_ext.cc:410]   native: #02 pc 0025b30b  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+742)
art/runtime/java_vm_ext.cc:410]   native: #03 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/java_vm_ext.cc:410]   native: #05 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/java_vm_ext.cc:410]   native: #06 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/java_vm_ext.cc:410]   native: #07 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/java_vm_ext.cc:410]   native: #08 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/java_vm_ext.cc:410]   native: #09 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/java_vm_ext.cc:410]   native: #10 pc 0020d51d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/java_vm_ext.cc:410]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/java_vm_ext.cc:410]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/java_vm_ext.cc:410]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/java_vm_ext.cc:410]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/java_vm_ext.cc:410]   at java.lang.Class.newInstance!(Native method)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/java_vm_ext.cc:410]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/java_vm_ext.cc:410]   at android.os.Looper.loop(Looper.java:158)
art/runtime/java_vm_ext.cc:410]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/java_vm_ext.cc:410]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/java_vm_ext.cc:410]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/java_vm_ext.cc:410]
A/art: art/runtime/runtime.cc:366] Runtime aborting...
art/runtime/runtime.cc:366] Aborting thread:
art/runtime/runtime.cc:366] "main" prio=5 tid=1 Native
art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/runtime.cc:366]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/runtime.cc:366]   | state=R schedstat=( 0 0 0 ) utm=15 stm=10 core=4 HZ=100
art/runtime/runtime.cc:366]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
art/runtime/runtime.cc:366]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/runtime.cc:366]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/runtime.cc:366]   native: #02 pc 00333fb9  /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const+28)
art/runtime/runtime.cc:366]   native: #03 pc 00334257  /system/lib/libart.so (art::Runtime::Abort()+566)
art/runtime/runtime.cc:366]   native: #04 pc 000f476b  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
art/runtime/runtime.cc:366]   native: #05 pc 0025b635  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
art/runtime/runtime.cc:366]   native: #06 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/runtime.cc:366]   native: #07 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/runtime.cc:366]   native: #08 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/runtime.cc:366]   native: #09 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/runtime.cc:366]   native: #10 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/runtime.cc:366]   native: #11 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/runtime.cc:366]   native: #12 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/runtime.cc:366]   native: #13 pc 0020d51d  /system/framework/arm/boot.oat (???)
art/runtime/runtime.cc:366]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/runtime.cc:366]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/runtime.cc:366]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/runtime.cc:366]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/runtime.cc:366]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/runtime.cc:366]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Class.newInstance!(Native method)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:158)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/runtime.cc:366] Pending exception java.lang.ClassNotFoundException: Didn't find class "org.strongswan.android.logic.CharonVpnService" on path: DexPathList[[zip file "/data/app/com.whizpool.vpn-1/base.apk"],nativeLibraryDirectories=[/data/app/com.whizpool.vpn-1/lib/arm, /data/app/com.whizpool.vpn-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
art/runtime/runtime.cc:366]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
art/runtime/runtime.cc:366]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
art/runtime/runtime.cc:366]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
art/runtime/runtime.cc:366]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
art/runtime/runtime.cc:366]   at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
art/runtime/runtime.cc:366]   at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
art/runtime/runtime.cc:366]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
art/runtime/runtime.cc:366]   at void com.whizpool.vpn.logic.CharonVpnService.<clinit>() (CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.access$2100(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:221)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
art/runtime/runtime.cc:366]   at void android.os.Looper.loop() (Looper.java:158)
art/runtime/runtime.cc:366]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
art/runtime/runtime.cc:366]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1120)
art/runtime/runtime.cc:366] Dumping all threads without appropriate locks held: thread list lock mutator lock
art/runtime/runtime.cc:366] All threads:
art/runtime/runtime.cc:366] DALVIK THREADS (12):
art/runtime/runtime.cc:366] "main" prio=5 tid=1 Runnable
art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x767e53e8 self=0xf4be4500
art/runtime/runtime.cc:366]   | sysTid=15402 nice=0 cgrp=default sched=0/0 handle=0xf73eeb4c
art/runtime/runtime.cc:366]   | state=R schedstat=( 0 0 0 ) utm=15 stm=12 core=0 HZ=100
art/runtime/runtime.cc:366]   | stack=0xff291000-0xff293000 stackSize=8MB
art/runtime/runtime.cc:366]   | held mutexes= "abort lock" "mutator lock"(shared held)
art/runtime/runtime.cc:366]   native: #00 pc 00371bd7  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+142)
art/runtime/runtime.cc:366]   native: #01 pc 00351199  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, BacktraceMap*) const+160)
art/runtime/runtime.cc:366]   native: #02 pc 0035b0b7  /system/lib/libart.so (art::DumpCheckpoint::Run(art::Thread*)+446)
art/runtime/runtime.cc:366]   native: #03 pc 0035bc79  /system/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure*)+212)
art/runtime/runtime.cc:366]   native: #04 pc 0035c1ef  /system/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+154)
art/runtime/runtime.cc:366]   native: #05 pc 003341cd  /system/lib/libart.so (art::Runtime::Abort()+428)
art/runtime/runtime.cc:366]   native: #06 pc 000f476b  /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
art/runtime/runtime.cc:366]   native: #07 pc 0025b635  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1552)
art/runtime/runtime.cc:366]   native: #08 pc 0025b9e5  /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
art/runtime/runtime.cc:366]   native: #09 pc 000fd391  /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
art/runtime/runtime.cc:366]   native: #10 pc 001024a5  /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
art/runtime/runtime.cc:366]   native: #11 pc 00114891  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+392)
art/runtime/runtime.cc:366]   native: #12 pc 00002a44  /data/app/com.whizpool.vpn-1/lib/arm/libandroidbridge.so (JNI_OnLoad+108)
art/runtime/runtime.cc:366]   native: #13 pc 0025bf6f  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1238)
art/runtime/runtime.cc:366]   native: #14 pc 002d1fc7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
art/runtime/runtime.cc:366]   native: #15 pc 0020d51d  /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
art/runtime/runtime.cc:366]   at java.lang.Runtime.nativeLoad(Native method)
art/runtime/runtime.cc:366]   at java.lang.Runtime.doLoad(Runtime.java:435)
art/runtime/runtime.cc:366]   - locked <0x0d37d22d> (a java.lang.Runtime)
art/runtime/runtime.cc:366]   at java.lang.Runtime.loadLibrary(Runtime.java:370)
art/runtime/runtime.cc:366]   at java.lang.System.loadLibrary(System.java:1076)
art/runtime/runtime.cc:366]   at com.whizpool.vpn.logic.CharonVpnService.<clinit>(CharonVpnService.java:744)
art/runtime/runtime.cc:366]   at java.lang.Class.newInstance!(Native method)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleCreateService(ActivityThread.java:3772)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$2100(ActivityThread.java:221)
art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:158)
art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:7224)
art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
art/runtime/runtime.cc:366]
art/runtime/runtime.cc:366] "Signal Catcher" prio=5 tid=2 WaitingInMainSignalCatcherLoop
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c680a0 self=0xee3e2c00
art/runtime/runtime.cc:366]   | sysTid=15407 nice=0 cgrp=default sched=0/0 handle=0xf425c930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=5 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf4160000-0xf4162000 stackSize=1014KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: do_sigtimedwait+0xd8/0x1ac
art/runtime/runtime.cc:366]   kernel: compat_SyS_rt_sigtimedwait+0x94/0xd8
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 0004135c  /system/lib/libc.so (__rt_sigtimedwait+12)
art/runtime/runtime.cc:366]   native: #01 pc 0001d0df  /system/lib/libc.so (sigwait+22)
art/runtime/runtime.cc:366]   native: #02 pc 0033aae9  /system/lib/libart.so (art::SignalCatcher::WaitForSignal(art::Thread*, art::SignalSet&)+76)
art/runtime/runtime.cc:366]   native: #03 pc 0033c535  /system/lib/libart.so (art::SignalCatcher::Run(void*)+260)
art/runtime/runtime.cc:366]   native: #04 pc 0003fc53  /system/lib/libc.so (__pthread_start(void*)+30)
art/runtime/runtime.cc:366]   native: #05 pc 0001a38b  /system/lib/libc.so (__start_thread+6)
art/runtime/runtime.cc:366]   (no managed stack frames)
art/runtime/runtime.cc:366]
art/runtime/runtime.cc:366] "JDWP" prio=5 tid=3 WaitingInMainDebuggerLoop
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c6b0a0 self=0xee43b900
art/runtime/runtime.cc:366]   | sysTid=15408 nice=0 cgrp=default sched=0/0 handle=0xf415d930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=5 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf4061000-0xf4063000 stackSize=1014KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: poll_schedule_timeout+0x54/0xb8
art/runtime/runtime.cc:366]   kernel: do_select+0x414/0x468
art/runtime/runtime.cc:366]   kernel: compat_core_sys_select+0x160/0x20c
art/runtime/runtime.cc:366]   kernel: compat_sys_pselect6+0x178/0x214
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 00041278  /system/lib/libc.so (__pselect6+20)
art/runtime/runtime.cc:366]   native: #01 pc 0001c431  /system/lib/libc.so (select+60)
art/runtime/runtime.cc:366]   native: #02 pc 00402093  /system/lib/libart.so (art::JDWP::JdwpAdbState::ProcessIncoming()+218)
art/runtime/runtime.cc:366]   native: #03 pc 00267a2f  /system/lib/libart.so (art::JDWP::JdwpState::Run()+314)
art/runtime/runtime.cc:366]   native: #04 pc 002688ad  /system/lib/libart.so (art::JDWP::StartJdwpThread(void*)+16)
art/runtime/runtime.cc:366]   native: #05 pc 0003fc53  /system/lib/libc.so (__pthread_start(void*)+30)
art/runtime/runtime.cc:366]   native: #06 pc 0001a38b  /system/lib/libc.so (__start_thread+6)
art/runtime/runtime.cc:366]   (no managed stack frames)
art/runtime/runtime.cc:366]
A/art: art/runtime/runtime.cc:366] "ReferenceQueueDaemon" prio=5 tid=4 Waiting
art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12c64e80 self=0xee43a500
art/runtime/runtime.cc:366]   | sysTid=15409 nice=0 cgrp=default sched=0/0 handle=0xf405e930
art/runtime/runtime.cc:366]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=4 HZ=100
art/runtime/runtime.cc:366]   | stack=0xf3f5c000-0xf3f5e000 stackSize=1038KB
art/runtime/runtime.cc:366]   | held mutexes=
art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
art/runtime/runtime.cc:366]   kernel: futex_wait+0xd8/0x1cc
art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
art/runtime/runtime.cc:366]   kernel: compat_SyS_futex+0xd0/0x14c
art/runtime/runtime.cc:366]   kernel: __sys_trace+0x3c/0x40
art/runtime/runtime.cc:366]   native: #00 pc 00017684  /system/lib/libc.so (syscall+28)
art/runtime/runtime.cc:366]   native: #01 pc 000f6d05  /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+96)
art/runtime/runtime.cc:366]   native: #02 pc 002bf87d  /system/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+1144)
art/runtime/runtime.cc:366]   native: #03 pc 002c05db  /system/lib/libart.so (art::Monitor::Wait(art::Thread*, art::mirror::Object*, long long, int, bool, art::ThreadState)+142)
art/runtime/runtime.cc:366]   native: #04 pc 002d1e2b  /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+38)

Excecption pointing error at this line :

System.loadLibrary("androidbridge");

Package name in the exception is the package name of the project from where i copied the code.
org.strongswan.android.logic.CharonVpnService

but my app's package name is com.whizpool.vpn.logic.CharonVpnService.

I have searched this org.strongswan.android every where but no where in my project.

here is my manifest file:

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.whizpool.vpn">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.whizpool.vpn.action.START_PROFILE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <service
            android:name=".logic.VpnStateService"
            android:exported="false" >
        </service>
        <service
            android:name=".logic.CharonVpnService"
            android:exported="false"
            android:permission="android.permission.BIND_VPN_SERVICE" >
            <intent-filter>
                <action android:name="android.net.VpnService" />
            </intent-filter>
        </service>

        <provider
            android:name=".data.LogContentProvider"
            android:authorities="com.whizpool.vpn.content.log"
            android:exported="true" >

        </provider>
    </application>

</manifest>[enter link description here][1]


来源: stackexchange

问:
Cannot Add Option List to Multiple Select jQuery
I want to create multi select option list like this example plugin. The option list is populated using ajax call to the database. The ajax call works fine but the option list is not being populated. I also followed this guide. Any help highly appreciated.

HTML

```<code><div class="form-group">
    <label for="langOpt">Select Option</label>
    <select class="form-control" name="langOpt[]" multiple id="langOpt">
    <!--option list-->
    </select>
</div>
</code>```

Plugin Call

```<code><script>
$('select[multiple]').multiselect();
</script>
</code>```

jQuery

```<code><script>
$('#langOpt').click(function () {

      $.ajax({
            type : "GET",
            dataType :'json',
            url : "<?php echo base_url('registration/get_opton_list') ?>",
            success : function(data) {
              $('#langOpt').html('');
              jQuery(data).each(function(i, item){
                $('#langOpt').append("<option value='"+ item.optionId+"'>" + item.optionName+ "</option>");

                //this ensure the ajax call, values print on console
                console.log(item.optionId);
                console.log(item.optionName);
              });

            }

          });
    });
</script>
</code>```

UPDATE:
Calling plugin into ajax success gives an error

```<code>Uncaught TypeError: $(...).multiselect is not a function
    at Object.<anonymous> ((index):190)
    at Function.each (jquery.min.js:2)
    at k.fn.init.each (jquery.min.js:2)
    at Object.success ((index):183)
    at c (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at l (jquery.min.js:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2)
(anonymous) @ (index):190
each @ jquery.min.js:2
each @ jquery.min.js:2
success @ (index):183
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
load (async)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
(anonymous) @ (index):176
dispatch @ jquery.min.js:2
v.handle @ jquery.min.js:2
</code>```

答:
Try to change

```<code>jQuery(data).each(function(i, item){
    $('#langOpt').append("<option value='"+ item.optionId+"'>" + item.optionName+ "</option>");
    //this ensure the ajax call, values print on console
    console.log(item.optionId);
    console.log(item.optionName);
});
</code>```

↓

```<code>$.each(data, function (i, item) {
    $('#langOpt').append("<option value='"+ item.optionId+"'>" + item.optionName+ "</option>");
    //this ensure the ajax call, values print on console
    console.log(item.optionId);
    console.log(item.optionName);
});
</code>```

Take a look here: https://www.sitepoint.com/jquery-each-function-examples/

Best regards,

Brhaka

ContentLicense: CC BY-SA 4.0

Body:
I want to create multi select option list like this example plugin. The option list is populated using ajax call to the database. The ajax call works fine but the option list is not being populated. I also followed this guide. Any help highly appreciated.

HTML

    Select Option
    <select class="form-control" name="langOpt[]" multiple id="langOpt">

    </select>

Plugin Call

jQuery

UPDATE:
Calling plugin into ajax success gives an error

Uncaught TypeError: $(...).multiselect is not a function
    at Object.<anonymous> ((index):190)
    at Function.each (jquery.min.js:2)
    at k.fn.init.each (jquery.min.js:2)
    at Object.success ((index):183)
    at c (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at l (jquery.min.js:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2)
(anonymous) @ (index):190
each @ jquery.min.js:2
each @ jquery.min.js:2
success @ (index):183
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
load (async)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
(anonymous) @ (index):176
dispatch @ jquery.min.js:2
v.handle @ jquery.min.js:2

Body:
Try to change

jQuery(data).each(function(i, item){
    $('#langOpt').append("<option value='"+ item.optionId+"'>" + item.optionName+ "</option>");
    //this ensure the ajax call, values print on console
    console.log(item.optionId);
    console.log(item.optionName);
});

↓

$.each(data, function (i, item) {
    $('#langOpt').append("<option value='"+ item.optionId+"'>" + item.optionName+ "</option>");
    //this ensure the ajax call, values print on console
    console.log(item.optionId);
    console.log(item.optionName);
});

Take a look here: https://www.sitepoint.com/jquery-each-function-examples/

Best regards,

Brhaka


问:
Locating the first WPF tab stop
Thanks to an answer on a previous question (Previous Question), I now have a body of code that navigates WPF tab stops (shown below).  It works fine except for the first tab stop.  Calling this.MoveFocus(...First) and followed by FocusManager.GetFocusedElement returns null.  Any ideas?  How do I get the first tab stop in my window?

Thanks,
- Mike

```<code>// Select the first element in the window
this.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));

TraversalRequest next = new TraversalRequest(FocusNavigationDirection.Next);
List<IInputElement> elements = new List<IInputElement>();

// Get the current element.
UIElement currentElement = FocusManager.GetFocusedElement(this) as UIElement;
while (currentElement != null)
{
    elements.Add(currentElement);

    // Get the next element.
    currentElement.MoveFocus(next);
    currentElement = FocusManager.GetFocusedElement(this) as UIElement;

    // If we looped (If that is possible), exit.
    if (elements[0] == currentElement)
        break;
}
</code>```

答:
I needed to do something similar in a project I'm working on, and I found something that seems to work well enough.

Here's a quick demo project with the code:

XAML:

```<code><Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfApplication3"
        Title="MainWindow" SizeToContent="WidthAndHeight">

    <StackPanel>
        <TextBox Width="200" />
        <TextBox Width="200" />
        <TextBox Width="200" />
    </StackPanel>
</Window>
</code>```

Code Behind:

```<code>using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;

namespace WpfApplication3
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();

            // Code needs window to be active to work, so just call it in Loaded event for demo
            this.Loaded += (s, e) =>
            {
                FocusManager.SetFocusedElement(this, this);
                UIElement element = FocusManager.GetFocusedElement(this) as UIElement;
                element.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
            };
        }
    }
}
</code>```

I know this is really late response, but does this help you at all?

ContentLicense: CC BY-SA 2.5

Title: Locating the first WPF tab stop

Body:
Thanks to an answer on a previous question (Previous Question), I now have a body of code that navigates WPF tab stops (shown below).  It works fine except for the first tab stop.  Calling this.MoveFocus(...First) and followed by FocusManager.GetFocusedElement returns null.  Any ideas?  How do I get the first tab stop in my window?

Thanks,
- Mike

// Select the first element in the window
this.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));

TraversalRequest next = new TraversalRequest(FocusNavigationDirection.Next);
List<IInputElement> elements = new List<IInputElement>();

// Get the current element.
UIElement currentElement = FocusManager.GetFocusedElement(this) as UIElement;
while (currentElement != null)
{
    elements.Add(currentElement);

    // Get the next element.
    currentElement.MoveFocus(next);
    currentElement = FocusManager.GetFocusedElement(this) as UIElement;

    // If we looped (If that is possible), exit.
    if (elements[0] == currentElement)
        break;
}

Body:
I needed to do something similar in a project I'm working on, and I found something that seems to work well enough.

Here's a quick demo project with the code:

XAML:

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfApplication3"
        Title="MainWindow" SizeToContent="WidthAndHeight">

    <StackPanel>
        <TextBox Width="200" />
        <TextBox Width="200" />
        <TextBox Width="200" />
    </StackPanel>
</Window>

Code Behind:

using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;

namespace WpfApplication3
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();

            // Code needs window to be active to work, so just call it in Loaded event for demo
            this.Loaded += (s, e) =>
            {
                FocusManager.SetFocusedElement(this, this);
                UIElement element = FocusManager.GetFocusedElement(this) as UIElement;
                element.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
            };
        }
    }
}

I know this is really late response, but does this help you at all?

ContentLicense: CC BY-SA 3.0


问:
SyntaxError: Unexpected identifier 'modal_html'. Expected a ':'
SyntaxError: Unexpected identifier 'modal_html'. Expected a ':'
following the property name 'var'. (anonymous function) — modal.self-</p>

```<code>Helpers = window.Helpers || {}
Helpers.Bootstrap = Helpers.Bootstrap || {}

Helpers.Bootstrap.Modal = {

  var modal_html = `
  <div class="modal fade" id="AlertModal" tabindex="-1" role="dialog" aria-labelledby="AlertModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">

        <div class="modal-header">
          <h5 class="modal-title" id="AlertModalLabel">${title}</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
          </button>
        </div>

        <div class="modal-body">
          ${message}
        </div>
        <div class="modal-footer">
          ${ button_html( button1 )}
          ${ button_html( button2 )}
        </div>

    </div>
  </div>
  `;

  init(title, message, button1, button2, existingelementid) {
    if (b === undefined) {
      Helpers.Bootstrap.Modal.closee(existingelementid)
    }
    modal_html
  }

  close(elementid) {
    $( elementid + " .close").click();
  }

  button_html(button_name) {
    var button_cancel = "<button type="button" class="btn btn-outline-danger" data-dismiss="modal">Cancel</button>";
    var button_save   = "<button type="submit" class="btn btn-outline-primary spinner" >Save</button>";
    var button_ok     = "<button type="button" class="btn btn-outline-primary" data-dismiss="modal">Ok</button>";
    var button_close  = "<button type="button" class="btn btn-outline-primary" data-dismiss="modal">Close</button>";

    switch(button_name) {
      case "cancel":
        button_cancel;
        break;
      case "save":
        button_save;
        break;
      case "ok":
        button_ok;
        break;
      case "close":
        button_close;
        break;
      default:
        button_name;
    }
  }
}
</code>```

答:
You are doing a lot of things wrong here:

End your assignments Helpers = window.Helpers || {} and Helpers.Bootstrap = Helpers.Bootstrap || {} with semicolons ; (just because!)

I think Helpers.Bootstrap.Modal.closee(existingelementid) should be .close not .closee

Your html in modal_html is missing a closing
 tag in the end

you cant decalare a var inside a object like you did with var XXX = something;
insted you just do: XXX : something, <-- (note the , in the end)

in your function init it just randomly says modal_html in the end (without assignment or anything else)

the whole code in button_html is just utter gibberish...ofc var button_cancel = "<button type=" is not a real assignment and continuing with
button " class=" will just break everything!
---> YOU CAN'T USE " to delimiter inside of ""

You are never returning anything from your switch, (atleast thats what I think you want to do)

there is alot more, but I suggest fixing this first, and maybe your original error will dissapear magically ;)

Helpers = window.Helpers || {}; /* <------ */
Helpers.Bootstrap = Helpers.Bootstrap || {}; /* <------- */

Helpers.Bootstrap.Modal = {

  modal_html : `

          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
          </button>

  `,

  button_html(button_name) {
  /*
    var button_cancel = "<button type="
    button " class="
    btn btn - outline - danger " data-dismiss="
    modal ">Cancel</button>";
    var button_save = "<button type="
    submit " class="
    btn btn - outline - primary spinner " >Save</button>";
    var button_ok = "<button type="
    button " class="
    btn btn - outline - primary " data-dismiss="
    modal ">Ok</button>";
    var button_close = "<button type="
    button " class="
    btn btn - outline - primary " data-dismiss="
    modal ">Close</button>";

    switch (button_name) {
      case "cancel":
        button_cancel;
        break;
      case "save":
        button_save;
        break;
      case "ok":
        button_ok;
        break;
      case "close":
        button_close;
        break;
      default:
        button_name;
    }

    THE ABOVE CODE IN THIS COMMENT IS ALL GIBBERISH AND IS NOT CORRECT */
  }

}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"></code>```

Body:
SyntaxError: Unexpected identifier 'modal_html'. Expected a ':'
following the property name 'var'. (anonymous function) — modal.self-

Helpers = window.Helpers || {}
Helpers.Bootstrap = Helpers.Bootstrap || {}

Helpers.Bootstrap.Modal = {

  var modal_html = `

${title}

          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
          </button>

          ${message}

          ${ button_html( button1 )}
          ${ button_html( button2 )}

  `;

  init(title, message, button1, button2, existingelementid) {
    if (b === undefined) {
      Helpers.Bootstrap.Modal.closee(existingelementid)
    }
    modal_html
  }

  close(elementid) {
    $( elementid + " .close").click();
  }

  button_html(button_name) {
    var button_cancel = "<button type="button" class="btn btn-outline-danger" data-dismiss="modal">Cancel</button>";
    var button_save   = "<button type="submit" class="btn btn-outline-primary spinner" >Save</button>";
    var button_ok     = "<button type="button" class="btn btn-outline-primary" data-dismiss="modal">Ok</button>";
    var button_close  = "<button type="button" class="btn btn-outline-primary" data-dismiss="modal">Close</button>";

    switch(button_name) {
      case "cancel":
        button_cancel;
        break;
      case "save":
        button_save;
        break;
      case "ok":
        button_ok;
        break;
      case "close":
        button_close;
        break;
      default:
        button_name;
    }
  }
}

Body:
You are doing a lot of things wrong here:

End your assignments Helpers = window.Helpers || {} and Helpers.Bootstrap = Helpers.Bootstrap || {} with semicolons ; (just because!)

I think Helpers.Bootstrap.Modal.closee(existingelementid) should be .close not .closee

Your html in modal_html is missing a closing </div> tag in the end

you cant decalare a var inside a object like you did with var XXX = something;
insted you just do: XXX : something, <-- (note the , in the end)

in your function init it just randomly says modal_html in the end (without assignment or anything else)

the whole code in button_html is just utter gibberish...ofc var button_cancel = "<button type=" is not a real assignment and continuing with
button " class=" will just break everything!
---> YOU CAN'T USE " to delimiter inside of ""

You are never returning anything from your switch, (atleast thats what I think you want to do)

there is alot more, but I suggest fixing this first, and maybe your original error will dissapear magically ;)

Helpers = window.Helpers || {}; /* <------ */
Helpers.Bootstrap = Helpers.Bootstrap || {}; /* <------- */

Helpers.Bootstrap.Modal = {

  modal_html : `
  <div class="modal fade" id="AlertModal" tabindex="-1" role="dialog"               aria-labelledby="AlertModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">

        <div class="modal-header">
          <h5 class="modal-title" id="AlertModalLabel"></h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
          </button>
        </div>

        <div class="modal-body">

        </div>
        <div class="modal-footer">
        </div>

    </div>
  </div>
  </div> <!-- <--------- -->
  `,

  button_html(button_name) {
  /*
    var button_cancel = "<button type="
    button " class="
    btn btn - outline - danger " data-dismiss="
    modal ">Cancel</button>";
    var button_save = "<button type="
    submit " class="
    btn btn - outline - primary spinner " >Save</button>";
    var button_ok = "<button type="
    button " class="
    btn btn - outline - primary " data-dismiss="
    modal ">Ok</button>";
    var button_close = "<button type="
    button " class="
    btn btn - outline - primary " data-dismiss="
    modal ">Close</button>";

    switch (button_name) {
      case "cancel":
        button_cancel;
        break;
      case "save":
        button_save;
        break;
      case "ok":
        button_ok;
        break;
      case "close":
        button_close;
        break;
      default:
        button_name;
    }

    THE ABOVE CODE IN THIS COMMENT IS ALL GIBBERISH AND IS NOT CORRECT */
  }

}

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">


问:
Entity Framework "Code supposed to be unreachable" on agrigated include expression
First

I have created this GitHub repo that only needs to be F5 to hit this error so it should be easy for you to try this out. All links in this question lead to that repo.

Flow of code

The following expression code in my controller is where I want to give the front end developers the power to include the relations they need.

```<code>// The included tables I want to control from my controller
Expression<Func<CompanyDto, object>>[] includes = { x => x.Employees, x => x.Cars };

var companyDto2 = await service.GetByIdAsync(1, includes).ConfigureAwait(false);
</code>```

and then in my service layer I map the dto includes to my entity includes and send them to the repository

```<code>var entityIncludes = mapper.Map<Expression<Func<Entity, object>>[]>(includes);

var result = await repository.GetByIdAsync(id, entityIncludes).ConfigureAwait(false);
</code>```

The error

When I run the include expressions in my repository I get the following error.

"Code supposed to be unreachable"

Here are two examples of things I have tried that throw this error.

First attempt

This was attempt from enter link description here

```<code>var queryableResultWithIncludes = includes
.Aggregate(dbContext.Set<TEntity>().AsQueryable(),
(current, include) => current.Include(include));

// return the result of the query using the specification's criteria expression
var result = queryableResultWithIncludes.AsEnumerable();

// Here we get "Code supposed to be unreachable"
var neverHappens = result .ToList();
</code>```

Second attempt

```<code>// Second attempts
if (includes.Length > 0)
{
    IQueryable<TEntity> set = includes
       .Aggregate<Expression<Func<TEntity, object>>, IQueryable<TEntity>>
       (dbContext.Set<TEntity>(), (current, expression) => current.Include(expression));

    // Here we also get "Code supposed to be unreachable"
    return await set.SingleOrDefaultAsync(s => s.Id == id).ConfigureAwait(false);
}
</code>```

Summary

What am I missing? Am I doing some kind of anti pattern stuff? I need some EF expert to tell me please :-)

答:
As I was suspecting, the issue has nothing in common with EF, but invalid expression produced by AutoMapper expression translation here:

```<code>var entityIncludes = mapper.Map<Expression<Func<Entity, object>>[]>(includes);
</code>```

It can be seen by expanding the entityIncludes variable in Locals/Watch window - you will see the exception in question for debug view or Parameters property of LambdaExpression.

With that said, the issue is caused by improper AutoMapper configuration, specifically the lack of AddExpressionMapping(). You did that for AutoMapper global configuration, but your code is using dependency injection, so you need to do it there, e.g.

Current

```<code>services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
// Auto Mapper Configurations
AutoMapper.Mapper.Initialize(cfg =>
{
    cfg.DisableConstructorMapping();
    cfg.AddExpressionMapping();
    cfg.AddProfile<CompanyProfile>();
});
</code>```

Should be

```<code>services.AddAutoMapper(cfg =>
{
    cfg.DisableConstructorMapping();
    cfg.AddExpressionMapping();
}, AppDomain.CurrentDomain.GetAssemblies());
</code>```

Body:
First

I have created this GitHub repo that only needs to be F5 to hit this error so it should be easy for you to try this out. All links in this question lead to that repo.

Flow of code

The following expression code in my controller is where I want to give the front end developers the power to include the relations they need.

// The included tables I want to control from my controller
Expression<Func<CompanyDto, object>>[] includes = { x => x.Employees, x => x.Cars };

var companyDto2 = await service.GetByIdAsync(1, includes).ConfigureAwait(false);

and then in my service layer I map the dto includes to my entity includes and send them to the repository

var entityIncludes = mapper.Map<Expression<Func<Entity, object>>[]>(includes);

var result = await repository.GetByIdAsync(id, entityIncludes).ConfigureAwait(false);

The error

When I run the include expressions in my repository I get the following error.

"Code supposed to be unreachable"

Here are two examples of things I have tried that throw this error.

First attempt

This was attempt from enter link description here

var queryableResultWithIncludes = includes
.Aggregate(dbContext.Set<TEntity>().AsQueryable(),
(current, include) => current.Include(include));

// return the result of the query using the specification's criteria expression
var result = queryableResultWithIncludes.AsEnumerable();

// Here we get "Code supposed to be unreachable"
var neverHappens = result .ToList();

Second attempt

// Second attempts
if (includes.Length > 0)
{
    IQueryable<TEntity> set = includes
       .Aggregate<Expression<Func<TEntity, object>>, IQueryable<TEntity>>
       (dbContext.Set<TEntity>(), (current, expression) => current.Include(expression));

    // Here we also get "Code supposed to be unreachable"
    return await set.SingleOrDefaultAsync(s => s.Id == id).ConfigureAwait(false);
}

Summary

What am I missing? Am I doing some kind of anti pattern stuff? I need some EF expert to tell me please :-)

Body:
As I was suspecting, the issue has nothing in common with EF, but invalid expression produced by AutoMapper expression translation here:

var entityIncludes = mapper.Map<Expression<Func<Entity, object>>[]>(includes);

It can be seen by expanding the entityIncludes variable in Locals/Watch window - you will see the exception in question for debug view or Parameters property of LambdaExpression.

With that said, the issue is caused by improper AutoMapper configuration, specifically the lack of AddExpressionMapping(). You did that for AutoMapper global configuration, but your code is using dependency injection, so you need to do it there, e.g.

Current

services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
// Auto Mapper Configurations
AutoMapper.Mapper.Initialize(cfg =>
{
    cfg.DisableConstructorMapping();
    cfg.AddExpressionMapping();
    cfg.AddProfile<CompanyProfile>();
});

Should be

services.AddAutoMapper(cfg =>
{
    cfg.DisableConstructorMapping();
    cfg.AddExpressionMapping();
}, AppDomain.CurrentDomain.GetAssemblies());


问:
Packaging Electron app into ASAR causes module not found error
I am having an issue packing my application into a single .asar file.  I am using electron-builder to initiate packing of the .asarfile.  If I do not package the app into an asar, it works as expected if I unpack the generated asar, it also works as expected.

However, running the electron using the asar produces this error:

Error: Cannot find module './MyModuleBase'
    at Module._resolveFilename (internal/modules/cjs/loader.js:584:15)

Previously, the asar was working without issue but we did some refactoring in the project splitting code out into a new module.

**Initial Configuration  (ASAR Working) **

```<code>+--electron-application
  +--application
</code>```

electron-application depends on the application module.

**New Configuration (ASAR Broken) **

```<code>+--electron-application
  +--application
    +--application-core
</code>```

electron-application depends on the application module and application depends on application-core MyModuleBase is in the application-core module

One other point which may be relevant: The application is being packaged with web-pack using the webpack-stream module.

Update: I've solved the problem, however I would still like to know why the .asar version would fail and extracting the files would work.

答: After digging into this further, it looks like the root cause of the problem is further upstream.  The main process was referencing a class in application, however main process is not being webpacked. The class has been moved to main, and now everything works as expected.  It appears the Electron app was able to resolve the files in the unpackaged state, but not the packaged state.

Body:
I am having an issue packing my application into a single .asar file.  I am using electron-builder to initiate packing of the .asarfile.  If I do not package the app into an asar, it works as expected if I unpack the generated asar, it also works as expected.

However, running the electron using the asar produces this error:

Error: Cannot find module './MyModuleBase'
    at Module._resolveFilename (internal/modules/cjs/loader.js:584:15)

Previously, the asar was working without issue but we did some refactoring in the project splitting code out into a new module.

**Initial Configuration  (ASAR Working) **

+--electron-application
  +--application

electron-application depends on the application module.

**New Configuration (ASAR Broken) **

+--electron-application
  +--application
    +--application-core

electron-application depends on the application module and application depends on application-core MyModuleBase is in the application-core module

One other point which may be relevant: The application is being packaged with web-pack using the webpack-stream module.

Update: I've solved the problem, however I would still like to know why the .asar version would fail and extracting the files would work.


问:
How to use GROUP BY method in php-mysql
I’m trying to use "group by" instead of "DISTINCT" in my php file to select some rows that all of them have an specific column value and it’s "idchat".
And I want to get more than one columns
please help me!

I’ve checked every pages but I didn’t understand enything

```<code> <?php

$connection = mysqli_connect("localhost","---","pass","---");
    $id = $_GET["id"];
    $mobile = $_GET["mobile"];
    $idchat = $_GET["idchat"];

    if (strpos($mobile, '9') !== false) {

$query = "SELECT DISTINCT a,b,c,d,idchat  FROM database where mobile = '$mobile' ORDER BY id DESC";
$result = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($result)) {

    $array[] = $row;
}
header('Content-Type:Application/json');
echo json_encode($array);
    }
    mysqli_close($connection);?>
</code>```

and this code gives me this error:

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /home/---/test.php on line 12

答:
See next output:

```<code>mysql> SELECT * FROM database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> SELECT * FROM mytable;;
ERROR 1146 (42S02): Table 'test.mytable' doesn't exist
ERROR:
No query specified

mysql>
</code>```

The first query is not understood because database is a reserved word. You should not use that to name a table. A work around is to add backquotes around the name:

```<code>mysql> SELECT * FROM `database`;
ERROR 1146 (42S02): Table 'test.database' doesn't exist
mysql>
</code>```

Title: How to use GROUP BY method in php-mysql

Body:
I’m trying to use "group by" instead of "DISTINCT" in my php file to select some rows that all of them have an specific column value and it’s "idchat".
And I want to get more than one columns
please help me!

I’ve checked every pages but I didn’t understand enything

 <?php

$connection = mysqli_connect("localhost","---","pass","---");
    $id = $_GET["id"];
    $mobile = $_GET["mobile"];
    $idchat = $_GET["idchat"];

    if (strpos($mobile, '9') !== false) {

$query = "SELECT DISTINCT a,b,c,d,idchat  FROM database where mobile = '$mobile' ORDER BY id DESC";
$result = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($result)) {

    $array[] = $row;
}
header('Content-Type:Application/json');
echo json_encode($array);
    }
    mysqli_close($connection);?>

and this code gives me this error:

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /home/---/test.php on line 12

Body:
See next output:

mysql> SELECT * FROM database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> SELECT * FROM mytable;;
ERROR 1146 (42S02): Table 'test.mytable' doesn't exist
ERROR:
No query specified

mysql>

The first query is not understood because database is a reserved word. You should not use that to name a table. A work around is to add backquotes around the name:

mysql> SELECT * FROM `database`;
ERROR 1146 (42S02): Table 'test.database' doesn't exist
mysql>


问:
Can't create content with DataTemplate in code behind with control defined in xaml
I have the following label in a ResourceDictionary in xaml of my ContentPage:

```<code><ContentPage.Resources>
       <ResourceDictionary>
            <Label Text="I am label" x:Name="label" x:Key="label"/>
       </ResourceDictionary>
</ContentPaget.Resources>
</code>```

And in in my code behind I have this clicked event handler:

```<code>void Handle_Clicked(object sender, System.EventArgs e)
    {
        DataTemplate dataTemplate = new DataTemplate(() => label);
        for (int i = 0; i < 3; i ++)
        {
            Label content = (Label) dataTemplate.CreateContent();
            stack.Children.Add(content);
        }
    }
</code>```

In my StackLayout called stack - only 1 label is added when the button assigned with Handle_Clicked is pressed. Why is only 1 label added - when there should be 3 labels added?

答:
I suspect that all controls need a unique id. Since this was not working either:

```<code>void Handle_Clicked(object sender, System.EventArgs e)
{
    for (int i = 0; i < 3; i ++)
    {
        stack.Children.Add(label);
    }
}
</code>```

which had brought me to try and use DataTemplate in the first place. Meaning the same object can only be added once to the view.

It can also be noted that createContent() works - but only if it is being defined in xaml (not being instantiated in code behind):

```<code><ContentPage.Resources>
       <ResourceDictionary>
            <DataTemplate x:Name="dataTemplate" x:Key="dataTemplate">
                <Label Text="I am label"/>
            </DataTemplate>
       </ResourceDictionary>
</ContentPaget.Resources>
</code>```

The workaround I found was to get rid of the DataTemplate and clone the object instead before adding it:

```<code>void Handle_Clicked(object sender, System.EventArgs e)
{
    for (int i = 0; i < 3; i ++)
    {
        var l = FastDeepCloner.DeepCloner.Clone(label);
        stack.Children.Add(l);
    }
}
</code>```

Body:
I have the following label in a ResourceDictionary in xaml of my ContentPage:

<ContentPage.Resources>
       <ResourceDictionary>

       </ResourceDictionary>
</ContentPaget.Resources>

And in in my code behind I have this clicked event handler:

void Handle_Clicked(object sender, System.EventArgs e)
    {
        DataTemplate dataTemplate = new DataTemplate(() => label);
        for (int i = 0; i < 3; i ++)
        {
            Label content = (Label) dataTemplate.CreateContent();
            stack.Children.Add(content);
        }
    }

In my StackLayout called stack - only 1 label is added when the button assigned with Handle_Clicked is pressed. Why is only 1 label added - when there should be 3 labels added?

Body:
I suspect that all controls need a unique id. Since this was not working either:

void Handle_Clicked(object sender, System.EventArgs e)
{
    for (int i = 0; i < 3; i ++)
    {
        stack.Children.Add(label);
    }
}

which had brought me to try and use DataTemplate in the first place. Meaning the same object can only be added once to the view.

It can also be noted that createContent() works - but only if it is being defined in xaml (not being instantiated in code behind):

<ContentPage.Resources>
       <ResourceDictionary>
            <DataTemplate x:Name="dataTemplate" x:Key="dataTemplate">
                <Label Text="I am label"/>
            </DataTemplate>
       </ResourceDictionary>
</ContentPaget.Resources>

The workaround I found was to get rid of the DataTemplate and clone the object instead before adding it:

void Handle_Clicked(object sender, System.EventArgs e)
{
    for (int i = 0; i < 3; i ++)
    {
        var l = FastDeepCloner.DeepCloner.Clone(label);
        stack.Children.Add(l);
    }
}


问:
Pass an additional counter as parameter to a callback
I have a $("").load call to get data and dump it into several divs. Each div has a unique ID that I track with an index variable inside a For loop. I do several ajax calls inside this loop. In the call back function I want to use the value of this index again. However by the time the callback executes, the for loop is already finished the index variable always has the top limit value for the loop.

How can I pass the value to this index to the callback function?

EDIT:

```<code>for (var i=1;i<=daysNum;i++)
{

    var tomorrow = new Date();
    tomorrow.setDate(tomorrow.getDate() + i);

    var tmd=(tomorrow.getMonth()+1)+'/'+(tomorrow.getDate())+'/'+tomorrow.getFullYear();
    var tmdurl=(tomorrow.getMonth()+1)+'%2F'+(tomorrow.getDate())+'%2F'+tomorrow.getFullYear();

    $("#events").append("<div><div id='event"+i+"'></div><div id='date"+i+"'>"+tmd+"</div></div>");
    $("#event"+i).load(seicalendarurl+"/calendar.aspx?CalendarDate="+tmdurl+"&CalendarPeriod=Day .ms-cal-tdayitem, .ms-cal-alldayevent"

        ,  function (data){
             if($("event"+i).html()=="")
                $("date"+i).html("");

           }
    );

}
</code>```

答:
You can wrap the entier loop body (or only the Ajax part) into an immediate function and pass the index as parameter:

```<code>for(var i=1;i<=daysNum;i++) {
    // other stuff
    (function(index) {
        $("#event"+index).load('...', function (){
            if($("#event"+index).html() === "") // you need `#` here too!
                $("#date"+index).empty();       // you need `#` here too!
        });
    }(i));
}
</code>```

But you don't necessarily need the index. You can access the #eventX element inside the callback with this and the #dateX element is the next sibling. So you can simply do

```<code>for(var i=1;i<=daysNum;i++) {
    // other stuff
    $("#event"+index).load('...', function (){
        if($(this).html() === "") {
            $(this).next().empty();
        }
    });
}
</code>```

which is much more readable imo.

Body:
I have a $("").load call to get data and dump it into several divs. Each div has a unique ID that I track with an index variable inside a For loop. I do several ajax calls inside this loop. In the call back function I want to use the value of this index again. However by the time the callback executes, the for loop is already finished the index variable always has the top limit value for the loop.

How can I pass the value to this index to the callback function?

EDIT:

for (var i=1;i<=daysNum;i++)
{

    var tomorrow = new Date();
    tomorrow.setDate(tomorrow.getDate() + i);

    var tmd=(tomorrow.getMonth()+1)+'/'+(tomorrow.getDate())+'/'+tomorrow.getFullYear();
    var tmdurl=(tomorrow.getMonth()+1)+'%2F'+(tomorrow.getDate())+'%2F'+tomorrow.getFullYear();

    $("#events").append("

"+tmd+"

");
    $("#event"+i).load(seicalendarurl+"/calendar.aspx?CalendarDate="+tmdurl+"&CalendarPeriod=Day .ms-cal-tdayitem, .ms-cal-alldayevent"

        ,  function (data){
             if($("event"+i).html()=="")
                $("date"+i).html("");

           }
    );

}

Body:
You can wrap the entier loop body (or only the Ajax part) into an immediate function and pass the index as parameter:

for(var i=1;i<=daysNum;i++) {
    // other stuff
    (function(index) {
        $("#event"+index).load('...', function (){
            if($("#event"+index).html() === "") // you need `#` here too!
                $("#date"+index).empty();       // you need `#` here too!
        });
    }(i));
}

But you don't necessarily need the index. You can access the #eventX element inside the callback with this and the #dateX element is the next sibling. So you can simply do

for(var i=1;i<=daysNum;i++) {
    // other stuff
    $("#event"+index).load('...', function (){
        if($(this).html() === "") {
            $(this).next().empty();
        }
    });
}

which is much more readable imo.


Title: Join dataframe to multiple lists

Body:
I have the following list:

$df1
  x   y          z
1 a 145 2010-01-01
2 b  22 2010-02-01
3 c  33 2010-03-01

$df2
  x   y          z
1 d  45 2010-01-01
2 e  35 2010-02-01
3 f 633 2010-03-01

I also have a data frame which looks like the following:

    x   y          z
1 aty 451 2010-01-01
2 b43 452 2010-02-01
3 crf 343 2010-03-01

I am trying to join the dataframe by date of column z to each of the lists so the expected output would be something like:

$df1
  x   y          z  x.1 y.1
1 a 145 2010-01-01  aty 451
2 b  22 2010-02-01  b43 452
3 c  33 2010-03-01  crf 343

$df2
  x   y          z  x.1 y.1
1 d  45 2010-01-01  aty 451
2 e  35 2010-02-01  b43 452
3 f 633 2010-03-01  crf 343

Data:

foo <- list(df1 = data.frame(x=c('a', 'b', 'c'),y = c(145,22,33), z=c("2010-01-01", "2010-02-01", "2010-03-01")),
            df2 = data.frame(x=c('d', 'e', 'f'),y = c(45,35,633), z=c("2010-01-01", "2010-02-01", "2010-03-01")))

foo2 <- data.frame(x = c('aty', 'b43', 'crf'), y= c(451,452,343), z=c("2010-01-01", "2010-02-01", "2010-03-01"))

Body:
A base R option is to use Map and merge every dataframe in foo with foo2

Map(merge, foo, list(foo2), by = "z")

#$df1
#           z x.x y.x x.y y.y
#1 2010-01-01   a 145 aty 451
#2 2010-02-01   b  22 b43 452
#3 2010-03-01   c  33 crf 343

#$df2
#           z x.x y.x x.y y.y
#1 2010-01-01   d  45 aty 451
#2 2010-02-01   e  35 b43 452
#3 2010-03-01   f 633 crf 343


问:
Stretching content to fit desktop page using css
How do I stretch this content to fit full page width in desktop?

Html:

```<code><div class="entry-content">
<blockquote class="wp-embedded-content" data-secret="paBu4nyBJV">.
<p>. <a href="https://tbwdrawingprize.artopps.co.uk/online-
entry/">Online Entry</a></p></blockquote>
<p><iframe title="“Online Entry” — TBW Drawing
Prize" class="wp-embedded-content" sandbox="allow-scripts"
security="restricted" style="position: absolute; clip: rect(1px,
1px, 1px, 1px);" src="https://tbwdrawingprize.artopps.co.uk/online-
entry/embed/#?secret=paBu4nyBJV" data-secret="paBu4nyBJV"
width="600" height="338" frameborder="0" marginwidth="0"
marginheight="0" scrolling="no"></iframe></p>
<p> </p>
<p><embed style="width: 500px; height: 300px;"
</code>```

https://adsler.co.uk/adsler-blog/

答:
This is happening because you have applied inline width style to your embed and iframe tags, as you can see here:

and

(From page inspect: Chrome Devtools)

Change these to width:100% and you'll be good to go! Cheers!

Body:
How do I stretch this content to fit full page width in desktop?

Html:

.

. Online Entry

<embed style="width: 500px; height: 300px;"

https://adsler.co.uk/adsler-blog/


问:
Laravel Passport response from same endpoint at same time with two different access_tokens from two users in both cases return first user
I am using Laravel 5.8 with Passport 7.2 for building API for my application. I am using password_grant for authentication.

I have created everything from registration to login and everything seems to function properly. I am able to get access_token and refresh_token and to access routes that has middleware auth:api attached.

In my routes i have this:

```<code>Route::group(['middleware' => ['auth:api']], function () {
...
    Route::get('test', function (Request $request) {
        return $request->user();
    });
...
});
</code>```

When i call this /api/test URL with header Authorization: Bearer access_token i am getting currently authenticated user. That just works fine.

I am testing these endpoints with Postman, but everything is same if i test this using javascript from browser.

The problem is when i have two different access_token from two different users. If i call this URL with one access_token i get correct user data as response and if i wait for few seconds and call same URL with second access_token i get correct second user data as response. But if i call this URL two times with these two access_tokens at same time (call first and for example after half second call second) i get first call user data as response in both requests.

I hope you can understand what is problem.

Could this be caching problem, or maybe session problem (even if api is stateless)?

If you need more informations just tell me.

Firstly i thought it was browser cache issue, but it is same in postman. I have also tried to use Google Chrome for one request and Mozilla for second and everything is same.

If you have any idea about what could be wrong i will appreciate it :D

答:
I have found a solution. It is not Laravel or Passport problem.

The problem was:
on my server we have Nginx and https://engintron.com/ configured and this Engintron has some micro-caching mechanism.

This micro-cache could be completely disabled or can be disabled with headers in request (Cache-Control: private).

Micro-cache is caching GET request to URL for 1 second and ignoring different Authorization headers. That's why i get same user data for two different Authorization headers if i make these two requests in under 1 second period.

I hope this will help someone else in future. If somebody need more info do not hesitate to contact me :D

Body:
I am using Laravel 5.8 with Passport 7.2 for building API for my application. I am using password_grant for authentication.

I have created everything from registration to login and everything seems to function properly. I am able to get access_token and refresh_token and to access routes that has middleware auth:api attached.

In my routes i have this:

Route::group(['middleware' => ['auth:api']], function () {
...
    Route::get('test', function (Request $request) {
        return $request->user();
    });
...
});

When i call this /api/test URL with header Authorization: Bearer access_token i am getting currently authenticated user. That just works fine.

I am testing these endpoints with Postman, but everything is same if i test this using javascript from browser.

The problem is when i have two different access_token from two different users. If i call this URL with one access_token i get correct user data as response and if i wait for few seconds and call same URL with second access_token i get correct second user data as response. But if i call this URL two times with these two access_tokens at same time (call first and for example after half second call second) i get first call user data as response in both requests.

I hope you can understand what is problem.

Could this be caching problem, or maybe session problem (even if api is stateless)?

If you need more informations just tell me.

Firstly i thought it was browser cache issue, but it is same in postman. I have also tried to use Google Chrome for one request and Mozilla for second and everything is same.

If you have any idea about what could be wrong i will appreciate it :D