问:
Deployment error after upgrade to Xcode 10.2.1
Upgrade my Mac to MacOS 10.14.5, Upgrade Xcode to 10.2.1 and now i can't deploy my projects on emulators and on real devices.

Visual Studio Community 2017 for Mac Version 7.6.5 (build 20)

Runtime:  Mono
5.12.0.301 (2018-02/4fe3280bba1) (64-bit)     GTK+ 2.24.23 (Raleigh theme)    Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

Package version: 512000301

Apple Developer Tools Xcode 10.2.1 (14490.122) Build 10E1001

Xamarin.Mac Version: 4.6.0.14 (Visual Studio Community) Hash: 1a6e2786
Branch:  Build date: 2018-08-28 00:12:06-0400

Xamarin.iOS Version: 11.14.0.14 (Visual Studio Community) Hash:
1a6e2786 Branch: HEAD Build date: 2018-08-28 00:12:06-0400

Here is my deployment error log

```<code>/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -sdkroot "/Applications/Xcode.app/Contents/Developer" --installdev "/Users/dev/Desktop/My Projects/Gefsinus/TapNOrderIOS/bin/iPhone/Debug/device-builds/iphone6.2-12.1.4/TapNOrder.app" --device ios "--devname=Emmanouil’s iPhone" --install-progress
objc[1639]: Class _TtCs18__stdlib_AtomicInt is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a10c8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x112279158). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs19__EmptyArrayStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55931e0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b268). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVVs17__CocoaDictionary5Index7Storage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1258) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122792e8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVs17__CocoaDictionary8Iterator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1310) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122793a0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs22__RawDictionaryStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593290) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b318). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs26__EmptyDictionarySingleton is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593348) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b3d0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs24__SwiftEmptyNSEnumerator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593408) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b490). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs11_AnyKeyPath is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1538) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122795c8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs20__SwiftNativeNSArray is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593470) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b4f8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs25__SwiftNativeNSDictionary is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55934d8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b560). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs18__SwiftNativeNSSet is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593540) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b5c8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs25__SwiftNativeNSEnumerator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55935a8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b630). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs19__SwiftNativeNSData is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593610) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b698). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs32__stdlib_ReturnAutoreleasedDummy is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593678) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b700). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVVs10__CocoaSet5Index7Storage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1690) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x112279720). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVs10__CocoaSet8Iterator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1748) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122797d8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs15__RawSetStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55936e0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b768). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs19__EmptySetSingleton is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593790) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b818). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs18_StringBreadcrumbs is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1850) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122798e0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs21__SwiftNativeNSString is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593848) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b8d0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs15__StringStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55938b0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b938). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs21__SharedStringStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593930) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b9b8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs41__SwiftNativeNSArrayWithContiguousStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55939c0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226ba48). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs22__SwiftDeferredNSArray is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593a30) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bab8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs28__ContiguousArrayStorageBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593ab8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bb40). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs15__VaListBuilder is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a19c0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x112279a50). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSError is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593b50) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bbd8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs12_SwiftObject is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593ba0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bc28). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftValue is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593c18) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bca0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNull is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593c68) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bcf0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSArrayBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593cb8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bd40). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSDictionaryBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593d08) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bd90). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSSetBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593d58) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bde0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSStringBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593da8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226be30). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSEnumeratorBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593df8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226be80). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSDataBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593e48) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bed0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSIndexSetBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593e98) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bf20). One of the two will be used. Which one is undefined.
This copy of libswiftCore.dylib requires an OS version prior to 10.14.4.
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) ObjCRuntime.Dlfcn._dlopen (string,int) [0x00014] in <17ce5e57d7854eaebabaf5a28945d061>:0
  at ObjCRuntime.Dlfcn.dlopen (string,int) [0x00001] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.6.0.14/src/Xamarin.Mac/ObjCRuntime/Dlfcn.cs:93
  at Xamarin.Hosting.Services.LoadFramework (string,bool) [0x00044] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Hosting/Services.cs:233
  at Xamarin.Hosting.Services.LoadFrameworks () [0x0011c] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Hosting/Services.cs:136
  at Xamarin.Hosting.Services.Initialize (string,bool) [0x000e7] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Hosting/Services.cs:102
  at Xamarin.Launcher.DevController.Initialize () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:35
  at Xamarin.Launcher.DevController/<InstallApplicationAsync>d__4.MoveNext () [0x00066] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:73
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<TStateMachine_REF> (TStateMachine_REF&) [0x0002c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.6.0.14/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
  at Xamarin.Launcher.DevController.InstallApplicationAsync (string,string,string) [0x00038] in <4309e8c26f834115a4dd8fcefb457162>:0
  at Xamarin.Launcher.Driver/<MainAsync>d__56.MoveNext () [0x00256] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/Main.cs:459
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int>.Start<Xamarin.Launcher.Driver/<MainAsync>d__56> (Xamarin.Launcher.Driver/<MainAsync>d__56&) [0x0002c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.6.0.14/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
  at Xamarin.Launcher.Driver.MainAsync () [0x00023] in <4309e8c26f834115a4dd8fcefb457162>:0
  at Xamarin.Launcher.Driver.Main2 (string[]) [0x00af2] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/Main.cs:446
  at Xamarin.Launcher.Driver.Main (string[]) [0x0006d] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/Main.cs:147
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00057] in <4309e8c26f834115a4dd8fcefb457162>:0

Native stacktrace:

    0   mlaunch                             0x000000010b4f3408 mono_handle_native_crash + 264
    1   libsystem_platform.dylib            0x00007fff6eeeab5d _sigtramp + 29
    2   ???                                 0x00007ffee4829a60 0x0 + 140732732185184
    3   libsystem_c.dylib                   0x00007fff6eda46a6 abort + 127
    4   libswiftCore.dylib                  0x00000001121aab05 _ZN5swift10fatalErrorEjPKcz + 149
    5   libswiftCore.dylib                  0x00000001121a26df _ZL12checkVersionv + 47
    6   ???                                 0x0000000111d22592 0x0 + 4593952146
    7   ???                                 0x0000000111d22798 0x0 + 4593952664
    8   ???                                 0x0000000111d1dbea 0x0 + 4593933290
    9   ???                                 0x0000000111d1cd73 0x0 + 4593929587
    10  ???                                 0x0000000111d1ce05 0x0 + 4593929733
    11  ???                                 0x0000000111d0fcb2 0x0 + 4593876146
Entering thread summarizer from 4594517440
    12  ???                                 0x0000000111d193dc 0x0 + 4593914844
    13  libdyld.dylib                       0x00007fff6ecead43 dlopen + 200
    14  ???                                 0x000000010fcb5634 0x0 + 4559951412
    15  ???                                 0x00000001102e7a91 0x0 + 4566448785
    16  ???                                 0x00000001102e73cb 0x0 + 4566447051
    17  ???                                 0x00000001102ddedb 0x0 + 4566408923
    18  ???                                 0x00000001102dc8d3 0x0 + 4566403283
    19  ???                                 0x000000010b9f16d3 0x0 + 4489942739
    20  ???                                 0x000000010b9f1b9d 0x0 + 4489943965
    21  mlaunch                             0x000000010b5069a3 mono_jit_runtime_invoke + 1443
    22  mlaunch                             0x000000010b601c2f mono_runtime_invoke_checked + 127
    23  mlaunch                             0x000000010b608c4e mono_runtime_exec_main_checked + 110
    24  mlaunch                             0x000000010b463de9 mono_jit_exec + 297
    25  mlaunch                             0x000000010b466dfa mono_main + 11178
    26  mlaunch                             0x000000010b4040ce xamarin_main + 1182
    27  mlaunch                             0x000000010b405044 main + 36
    28  libdyld.dylib                       0x00007fff6ecff3d5 start + 1
Entering thread summarizer from 123145522233344
Self-reporting for thread 123145522233344. Registered summarizing thread right now is 123145522233344
Waiting for signalled thread 123145522233344 to collect stacktrace. Status: MONO_SUMMARY_EMPTY
Self-reporting for thread 4594517440. Registered summarizing thread right now is 4594517440
2019-05-27 15:45:00.282 mlaunch[1639:177278] error: * Assertion at ../../../../external/mono/mono/mini/mini-exceptions.c:1405, condition `frame->ji && frame->type != FRAME_TYPE_TRAMPOLINE' not met

Application could not be uploaded to the device.
</code>```

答:
I saw in the log has this: "This copy of libswiftCore.dylib requires an OS version prior to 10.14.4."
I can fine the answer from: https://github.com/Microsoft/appcenter/issues/303

Xcode 10.2 compatible

https://www.nuget.org/packages/Xamarin.UITest/2.2.7.2002-dev

Xcode 10.2 compatible and allows NUnit 3

https://www.nuget.org/packages/Xamarin.UITest/3.0.0-dev1

Body:
Upgrade my Mac to MacOS 10.14.5, Upgrade Xcode to 10.2.1 and now i can't deploy my projects on emulators and on real devices.

Visual Studio Community 2017 for Mac Version 7.6.5 (build 20)

Runtime:  Mono
5.12.0.301 (2018-02/4fe3280bba1) (64-bit)     GTK+ 2.24.23 (Raleigh theme)    Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

Package version: 512000301

Apple Developer Tools Xcode 10.2.1 (14490.122) Build 10E1001

Xamarin.Mac Version: 4.6.0.14 (Visual Studio Community) Hash: 1a6e2786
Branch:  Build date: 2018-08-28 00:12:06-0400

Xamarin.iOS Version: 11.14.0.14 (Visual Studio Community) Hash:
1a6e2786 Branch: HEAD Build date: 2018-08-28 00:12:06-0400

Here is my deployment error log

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -sdkroot "/Applications/Xcode.app/Contents/Developer" --installdev "/Users/dev/Desktop/My Projects/Gefsinus/TapNOrderIOS/bin/iPhone/Debug/device-builds/iphone6.2-12.1.4/TapNOrder.app" --device ios "--devname=Emmanouil’s iPhone" --install-progress
objc[1639]: Class _TtCs18__stdlib_AtomicInt is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a10c8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x112279158). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs19__EmptyArrayStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55931e0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b268). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVVs17__CocoaDictionary5Index7Storage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1258) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122792e8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVs17__CocoaDictionary8Iterator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1310) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122793a0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs22__RawDictionaryStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593290) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b318). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs26__EmptyDictionarySingleton is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593348) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b3d0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs24__SwiftEmptyNSEnumerator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593408) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b490). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs11_AnyKeyPath is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1538) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122795c8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs20__SwiftNativeNSArray is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593470) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b4f8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs25__SwiftNativeNSDictionary is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55934d8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b560). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs18__SwiftNativeNSSet is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593540) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b5c8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs25__SwiftNativeNSEnumerator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55935a8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b630). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs19__SwiftNativeNSData is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593610) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b698). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs32__stdlib_ReturnAutoreleasedDummy is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593678) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b700). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVVs10__CocoaSet5Index7Storage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1690) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x112279720). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCVs10__CocoaSet8Iterator is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1748) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122797d8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs15__RawSetStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55936e0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b768). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs19__EmptySetSingleton is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593790) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b818). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs18_StringBreadcrumbs is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a1850) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x1122798e0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs21__SwiftNativeNSString is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593848) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b8d0). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs15__StringStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55938b0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b938). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs21__SharedStringStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593930) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226b9b8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs41__SwiftNativeNSArrayWithContiguousStorage is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55939c0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226ba48). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs22__SwiftDeferredNSArray is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593a30) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bab8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs28__ContiguousArrayStorageBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593ab8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bb40). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs15__VaListBuilder is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa55a19c0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x112279a50). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSError is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593b50) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bbd8). One of the two will be used. Which one is undefined.
objc[1639]: Class _TtCs12_SwiftObject is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593ba0) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bc28). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftValue is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593c18) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bca0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNull is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593c68) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bcf0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSArrayBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593cb8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bd40). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSDictionaryBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593d08) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bd90). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSSetBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593d58) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bde0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSStringBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593da8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226be30). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSEnumeratorBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593df8) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226be80). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSDataBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593e48) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bed0). One of the two will be used. Which one is undefined.
objc[1639]: Class __SwiftNativeNSIndexSetBase is implemented in both /usr/lib/swift/libswiftCore.dylib (0x7fffa5593e98) and /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib (0x11226bf20). One of the two will be used. Which one is undefined.
This copy of libswiftCore.dylib requires an OS version prior to 10.14.4.
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) ObjCRuntime.Dlfcn._dlopen (string,int) [0x00014] in <17ce5e57d7854eaebabaf5a28945d061>:0
  at ObjCRuntime.Dlfcn.dlopen (string,int) [0x00001] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.6.0.14/src/Xamarin.Mac/ObjCRuntime/Dlfcn.cs:93
  at Xamarin.Hosting.Services.LoadFramework (string,bool) [0x00044] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Hosting/Services.cs:233
  at Xamarin.Hosting.Services.LoadFrameworks () [0x0011c] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Hosting/Services.cs:136
  at Xamarin.Hosting.Services.Initialize (string,bool) [0x000e7] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Hosting/Services.cs:102
  at Xamarin.Launcher.DevController.Initialize () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:35
  at Xamarin.Launcher.DevController/<InstallApplicationAsync>d__4.MoveNext () [0x00066] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:73
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<TStateMachine_REF> (TStateMachine_REF&) [0x0002c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.6.0.14/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
  at Xamarin.Launcher.DevController.InstallApplicationAsync (string,string,string) [0x00038] in <4309e8c26f834115a4dd8fcefb457162>:0
  at Xamarin.Launcher.Driver/<MainAsync>d__56.MoveNext () [0x00256] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/Main.cs:459
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int>.Start<Xamarin.Launcher.Driver/<MainAsync>d__56> (Xamarin.Launcher.Driver/<MainAsync>d__56&) [0x0002c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.6.0.14/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
  at Xamarin.Launcher.Driver.MainAsync () [0x00023] in <4309e8c26f834115a4dd8fcefb457162>:0
  at Xamarin.Launcher.Driver.Main2 (string[]) [0x00af2] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/Main.cs:446
  at Xamarin.Launcher.Driver.Main (string[]) [0x0006d] in /Users/builder/jenkins/workspace/xamarin-macios/maciostools/Xamarin.Hosting/Xamarin.Launcher/Main.cs:147
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00057] in <4309e8c26f834115a4dd8fcefb457162>:0

Native stacktrace:

    0   mlaunch                             0x000000010b4f3408 mono_handle_native_crash + 264
    1   libsystem_platform.dylib            0x00007fff6eeeab5d _sigtramp + 29
    2   ???                                 0x00007ffee4829a60 0x0 + 140732732185184
    3   libsystem_c.dylib                   0x00007fff6eda46a6 abort + 127
    4   libswiftCore.dylib                  0x00000001121aab05 _ZN5swift10fatalErrorEjPKcz + 149
    5   libswiftCore.dylib                  0x00000001121a26df _ZL12checkVersionv + 47
    6   ???                                 0x0000000111d22592 0x0 + 4593952146
    7   ???                                 0x0000000111d22798 0x0 + 4593952664
    8   ???                                 0x0000000111d1dbea 0x0 + 4593933290
    9   ???                                 0x0000000111d1cd73 0x0 + 4593929587
    10  ???                                 0x0000000111d1ce05 0x0 + 4593929733
    11  ???                                 0x0000000111d0fcb2 0x0 + 4593876146
Entering thread summarizer from 4594517440
    12  ???                                 0x0000000111d193dc 0x0 + 4593914844
    13  libdyld.dylib                       0x00007fff6ecead43 dlopen + 200
    14  ???                                 0x000000010fcb5634 0x0 + 4559951412
    15  ???                                 0x00000001102e7a91 0x0 + 4566448785
    16  ???                                 0x00000001102e73cb 0x0 + 4566447051
    17  ???                                 0x00000001102ddedb 0x0 + 4566408923
    18  ???                                 0x00000001102dc8d3 0x0 + 4566403283
    19  ???                                 0x000000010b9f16d3 0x0 + 4489942739
    20  ???                                 0x000000010b9f1b9d 0x0 + 4489943965
    21  mlaunch                             0x000000010b5069a3 mono_jit_runtime_invoke + 1443
    22  mlaunch                             0x000000010b601c2f mono_runtime_invoke_checked + 127
    23  mlaunch                             0x000000010b608c4e mono_runtime_exec_main_checked + 110
    24  mlaunch                             0x000000010b463de9 mono_jit_exec + 297
    25  mlaunch                             0x000000010b466dfa mono_main + 11178
    26  mlaunch                             0x000000010b4040ce xamarin_main + 1182
    27  mlaunch                             0x000000010b405044 main + 36
    28  libdyld.dylib                       0x00007fff6ecff3d5 start + 1
Entering thread summarizer from 123145522233344
Self-reporting for thread 123145522233344. Registered summarizing thread right now is 123145522233344
Waiting for signalled thread 123145522233344 to collect stacktrace. Status: MONO_SUMMARY_EMPTY
Self-reporting for thread 4594517440. Registered summarizing thread right now is 4594517440
2019-05-27 15:45:00.282 mlaunch[1639:177278] error: * Assertion at ../../../../external/mono/mono/mini/mini-exceptions.c:1405, condition `frame->ji && frame->type != FRAME_TYPE_TRAMPOLINE' not met

Application could not be uploaded to the device.


来源: stackexchange

问:
Pycharm: run only part of my Python file
Is it possible to run only a part of a program in PyCharm?

In other editors there is something like a cell which I can run, but I can't find such an option in PyCharm?

If this function doesn't exist it would be a huge drawback for me... Because for my data analysis I very often only need to run the last few lines of my code.

答:
Go to File >> Settings >> Plugins and install the plugin PyCharm cell mode

Go to File >> Settings >> Appearance & Behavior >> Keymap and assign your keyboard shortcuts for Run Cell and Run Cell and go to next

A cell is delimited by ##

Ref
https://plugins.jetbrains.com/plugin/7858-pycharm-cell-mode

ContentLicense: CC BY-SA 3.0

ContentLicense: CC BY-SA 4.0


问:
Python2.7 requests exception handling
I am attempting to post an object to an http end point, this is my code:

```<code>try:
    response = requests.post(url, data=obj['message'], headers=headers)
    logger.warn("Not bad resp: %s" % (response))
except requests.exceptions.HTTPError as e:
    logger.warn(str(e))
</code>```

Bizarrely enough, I actually get a 200 response, but for some reason, the exception condition gets triggered. I know this as I used to output response code in the exception section, but since it was 200, and I wanted more context, I tried to play with the more advanced error handling, I tried a few things including this except like:

```<code>except requests.RequestException as e:
</code>```

These logger lines:

```<code>logger.warn(e)
print(e)
</code>```

Nothing seems to work.. I always fail with this error:

```<code>Traceback (most recent call last):
  File "/opt/python/bin/lam_replay.py", line 190, in <module>
    main()
  File "/opt/python/bin/lam_replay.py", line 187, in main
    replayer(filename, moogsoft['hostname'])
  File "/opt/python/bin/lam_replay.py", line 92, in replayer
    response = requests.post(url, data=obj['message'], headers=headers)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 108, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 349, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib64/python2.7/httplib.py", line 1041, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1075, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1037, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 885, in _send_output
    self.send(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 857, in send
    self.sock.sendall(data)
  File "/usr/lib64/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 24781: ordinal not in range(128)
</code>```

Is there a way to fix exception encoding?? what am I missing ??

答:
As I read in line from file, I use the unicode function and set it to 'ignore errors'

```<code>    obj = unicode(f.readline(), errors='ignore')
    obj = json.loads(obj)
</code>```

Then, I load the line as json. Instead of loading the line straight as json.

Title: Python2.7 requests exception handling

Body:
I am attempting to post an object to an http end point, this is my code:

try:
    response = requests.post(url, data=obj['message'], headers=headers)
    logger.warn("Not bad resp: %s" % (response))
except requests.exceptions.HTTPError as e:
    logger.warn(str(e))

Bizarrely enough, I actually get a 200 response, but for some reason, the exception condition gets triggered. I know this as I used to output response code in the exception section, but since it was 200, and I wanted more context, I tried to play with the more advanced error handling, I tried a few things including this except like:

except requests.RequestException as e:

These logger lines:

logger.warn(e)
print(e)

Nothing seems to work.. I always fail with this error:

Traceback (most recent call last):
  File "/opt/python/bin/lam_replay.py", line 190, in <module>
    main()
  File "/opt/python/bin/lam_replay.py", line 187, in main
    replayer(filename, moogsoft['hostname'])
  File "/opt/python/bin/lam_replay.py", line 92, in replayer
    response = requests.post(url, data=obj['message'], headers=headers)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 108, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 349, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib64/python2.7/httplib.py", line 1041, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1075, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1037, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 885, in _send_output
    self.send(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 857, in send
    self.sock.sendall(data)
  File "/usr/lib64/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 24781: ordinal not in range(128)

Is there a way to fix exception encoding?? what am I missing ??

Body:
As I read in line from file, I use the unicode function and set it to 'ignore errors'

    obj = unicode(f.readline(), errors='ignore')
    obj = json.loads(obj)

Then, I load the line as json. Instead of loading the line straight as json.


问:
How to print a form in appmaker?
I have a page which contains a form. I want that form to be printed when I click on a button.

From this link(Print Friendly Page) I got the below code but its not working as expected.

```<code>       function print(widget, title){
         var content=widget.getElement().innerHTML;
         var win = window.open('', 'printWindow', 'height=600,width=800');
         win.document.write('<head><title>'+title+'/title></head>');
         win.document.write('<body>'+content+'</body>');
         win.document.close();
         win.focus();
         win.print();
         win.close();
       }
</code>```

Calling function

```<code>        print(app.currentPage.descendants.Form1,'User Details');
</code>```

Expected Result - Print page should appear with the form rendered.

Actual Result - Print page appears with form not rendered, only html code appears.

答:
I can't really tell why that happend and I have not much time to investigate right now; Nevertheless, I assumed that if instead of writing to the document I just replaced the innerHTML values of what currently exists when the window is created, it should work, and it did for me:

```<code>function print(widget, title){
  var win = window.open('', 'printWindow', 'height=600,width=800');
  win.document.children[0].children[0].innerHTML = "<title>"+title+"</title>";
  win.document.children[0].children[1].innerHTML = "<body>"+widget.getElement().innerHTML+"</body>";
  win.print();
  win.close();
}
</code>```

The only thing about the approach above is that it lacks style, since the form will be rendered without any css and thus you might not want to print something like that. To improve that, you can insert the materialize css via CDN like this:

```<code>function print(widget, title){
  var win = window.open('', 'printWindow', 'height=600,width=800');
  var css = document.createElement("link");
  css.setAttribute("href", "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css");
  css.setAttribute("rel","stylesheet");
  win.document.children[0].appendChild(css);
  win.document.children[0].children[0].innerHTML = "<title>"+title+"</title>";
  win.document.children[0].children[1].innerHTML = "<body>"+widget.getElement().innerHTML+"</body>";
  setTimeout(function(){
    win.print();
    win.close();
  },500);
}
</code>```

That should render a more decent form for you to print out. Furthermore, that will not print out the values of the form fields and that is because of App Maker bindings. In order to get the field values to print, you'll have to programmatically build the html elements. So you need to do something like this:

```<code>function print(widget, title){
  var htmlContent = "";
  var fields = widget.children.{formNameBody}.descendants._values;
  fields.forEach(function(field){
    var label = field.getElement().getElementsByTagName("label")[0];
    htmlContent += label.outerHTML;
    var input = field.getElement().getElementsByTagName("input")[0];
    var fieldVal = field.value;
    input.setAttribute("value", fieldVal);
    htmlContent += input.outerHTML;
  });
  var win = window.open('', 'printWindow', 'height=600,width=800');
  var css= document.createElement("link");
  css.setAttribute("href", "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css");
  css.setAttribute("rel","stylesheet");
  win.document.children[0].appendChild(css);
  win.document.children[0].children[0].innerHTML = "<title>"+title+"</title>";
  win.document.children[0].children[1].innerHTML = "<body>"+htmlContent+"</body>";
  setTimeout(function(){
    win.print();
    win.close();
  },500);
}
</code>```

That should render the html input fields with the respective labels and values. I hope this helps!

Title: How to print a form in appmaker?

Body:
I have a page which contains a form. I want that form to be printed when I click on a button.

From this link(Print Friendly Page) I got the below code but its not working as expected.

       function print(widget, title){
         var content=widget.getElement().innerHTML;
         var win = window.open('', 'printWindow', 'height=600,width=800');
         win.document.write('<title>'+title+'/title>');
         win.document.write(''+content+'');
         win.document.close();
         win.focus();
         win.print();
         win.close();
       }

Calling function

        print(app.currentPage.descendants.Form1,'User Details');

Expected Result - Print page should appear with the form rendered.

Actual Result - Print page appears with form not rendered, only html code appears.

Body:
I can't really tell why that happend and I have not much time to investigate right now; Nevertheless, I assumed that if instead of writing to the document I just replaced the innerHTML values of what currently exists when the window is created, it should work, and it did for me:

function print(widget, title){
  var win = window.open('', 'printWindow', 'height=600,width=800');
  win.document.children[0].children[0].innerHTML = "<title>"+title+"</title>";
  win.document.children[0].children[1].innerHTML = "<body>"+widget.getElement().innerHTML+"</body>";
  win.print();
  win.close();
}

The only thing about the approach above is that it lacks style, since the form will be rendered without any css and thus you might not want to print something like that. To improve that, you can insert the materialize css via CDN like this:

function print(widget, title){
  var win = window.open('', 'printWindow', 'height=600,width=800');
  var css = document.createElement("link");
  css.setAttribute("href", "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css");
  css.setAttribute("rel","stylesheet");
  win.document.children[0].appendChild(css);
  win.document.children[0].children[0].innerHTML = "<title>"+title+"</title>";
  win.document.children[0].children[1].innerHTML = "<body>"+widget.getElement().innerHTML+"</body>";
  setTimeout(function(){
    win.print();
    win.close();
  },500);
}

That should render a more decent form for you to print out. Furthermore, that will not print out the values of the form fields and that is because of App Maker bindings. In order to get the field values to print, you'll have to programmatically build the html elements. So you need to do something like this:

function print(widget, title){
  var htmlContent = "";
  var fields = widget.children.{formNameBody}.descendants._values;
  fields.forEach(function(field){
    var label = field.getElement().getElementsByTagName("label")[0];
    htmlContent += label.outerHTML;
    var input = field.getElement().getElementsByTagName("input")[0];
    var fieldVal = field.value;
    input.setAttribute("value", fieldVal);
    htmlContent += input.outerHTML;
  });
  var win = window.open('', 'printWindow', 'height=600,width=800');
  var css= document.createElement("link");
  css.setAttribute("href", "https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css");
  css.setAttribute("rel","stylesheet");
  win.document.children[0].appendChild(css);
  win.document.children[0].children[0].innerHTML = "<title>"+title+"</title>";
  win.document.children[0].children[1].innerHTML = "<body>"+htmlContent+"</body>";
  setTimeout(function(){
    win.print();
    win.close();
  },500);
}

That should render the html input fields with the respective labels and values. I hope this helps!


问:
Difference between two geom_smooth() lines
I made a plot for my data and am now I would like to have the difference in y for every x that was estimated by geom_smooth(). There is a similiar question which unfortunately has no answer. For example, how to get the differences for the following plot (data below):

EDIT

Two suggestions were made but I still don't know how to calculate the differences.

First suggestion was to access the data from the ggplot object. I did so with

```<code>pb <- ggplot_build(p)
pb[["data"]][[1]]
</code>```

That approach kind of works, but the data doesn't use the same x values for the groups. For example, the first x value of the first group is -3.21318853, but there is no x of -3.21318853 for the second group, hence, I can not calculate the difference in y for -3.21318853 between both groups

Second suggestion was to see what formula is used in geom_smooth(). The package description says that "loess() is used for less than 1,000 observations; otherwise mgcv::gam() is used with formula = y ~ s(x, bs = "cs")". My N is more than 60,000, hence, gam is used by default. I am not familiar with gam; can anyone provide a short answer how to calculate the difference between the two lines considering the things just described?

R Code

```<code>library("ggplot2") # library ggplot
set.seed(1) # make example reproducible
n <- 5000 # set sample size
df <- data.frame(x= rnorm(n), g= factor(rep(c(0,1), n/2))) # generate data
df$y <- NA # include y in df
df$y[df$g== 0] <- df$x[df$g== 0]**2 + rnorm(sum(df$g== 0))*5 # y for group g= 0
df$y[df$g== 1] <-2 + df$x[df$g== 1]**2 + rnorm(sum(df$g== 1))*5 # y for g= 1 (with intercept 2)
ggplot(df, aes(x, y, col= g)) + geom_smooth() + geom_point(alpha= .1) # make a plot
</code>```

答:
Hi and welcome on Stack Overflow,

The first suggestion is good. To make the x-sequences match, you can interpolate the values in between using the approx function (in stats).

```<code>library("ggplot2") # library ggplot
set.seed(1) # make example reproducible
n <- 5000 # set sample size
df <- data.frame(x= rnorm(n), g= factor(rep(c(0,1), n/2))) # generate data
df$y <- NA # include y in df
df$y[df$g== 0] <- df$x[df$g== 0]**2 + rnorm(sum(df$g== 0))*5 # y for group g= 0
df$y[df$g== 1] <-2 + df$x[df$g== 1]**2 + rnorm(sum(df$g== 1))*5 # y for g= 1 (with intercept 2)

p <- ggplot(df, aes(x, y, col= g)) + geom_smooth() + geom_point(alpha= .1) # make a plot
pb <- ggplot_build(p) # Get computed data

data.of.g1 <- pb[['data']][[1]][pb[['data']][[1]]$group == 1, ] # Extract info for group 1
data.of.g2 <- pb[['data']][[1]][pb[['data']][[1]]$group == 2, ] # Extract info for group 2

xlimit.inf <- max(min(data.of.g1$x), min(data.of.g2$x)) # Get the minimum X the two smoothed data have in common
xlimit.sup <- min(max(data.of.g1$x), max(data.of.g2$x)) # Get the maximum X
xseq <- seq(xlimit.inf, xlimit.sup, 0.01) # Sequence of X value (you can use bigger/smaller step size)

# Based on data from group 1 and group 2, interpolates linearly for all the values in `xseq`
y.g1 <- approx(x = data.of.g1$x, y = data.of.g1$y, xout = xseq)
y.g2 <- approx(x = data.of.g2$x, y = data.of.g2$y, xout = xseq)

difference <- data.frame(x = xseq, dy = abs(y.g1$y - y.g2$y)) # Compute the difference
ggplot(difference, aes(x = x, y = dy)) + geom_line() # Make the plot
</code>```

Output:

Body:
I made a plot for my data and am now I would like to have the difference in y for every x that was estimated by geom_smooth(). There is a similiar question which unfortunately has no answer. For example, how to get the differences for the following plot (data below):

EDIT

Two suggestions were made but I still don't know how to calculate the differences.

First suggestion was to access the data from the ggplot object. I did so with

pb <- ggplot_build(p)
pb[["data"]][[1]]

That approach kind of works, but the data doesn't use the same x values for the groups. For example, the first x value of the first group is -3.21318853, but there is no x of -3.21318853 for the second group, hence, I can not calculate the difference in y for -3.21318853 between both groups

Second suggestion was to see what formula is used in geom_smooth(). The package description says that "loess() is used for less than 1,000 observations; otherwise mgcv::gam() is used with formula = y ~ s(x, bs = "cs")". My N is more than 60,000, hence, gam is used by default. I am not familiar with gam; can anyone provide a short answer how to calculate the difference between the two lines considering the things just described?

R Code

library("ggplot2") # library ggplot
set.seed(1) # make example reproducible
n <- 5000 # set sample size
df <- data.frame(x= rnorm(n), g= factor(rep(c(0,1), n/2))) # generate data
df$y <- NA # include y in df
df$y[df$g== 0] <- df$x[df$g== 0]**2 + rnorm(sum(df$g== 0))*5 # y for group g= 0
df$y[df$g== 1] <-2 + df$x[df$g== 1]**2 + rnorm(sum(df$g== 1))*5 # y for g= 1 (with intercept 2)
ggplot(df, aes(x, y, col= g)) + geom_smooth() + geom_point(alpha= .1) # make a plot

Body:
Hi and welcome on Stack Overflow,

The first suggestion is good. To make the x-sequences match, you can interpolate the values in between using the approx function (in stats).

library("ggplot2") # library ggplot
set.seed(1) # make example reproducible
n <- 5000 # set sample size
df <- data.frame(x= rnorm(n), g= factor(rep(c(0,1), n/2))) # generate data
df$y <- NA # include y in df
df$y[df$g== 0] <- df$x[df$g== 0]**2 + rnorm(sum(df$g== 0))*5 # y for group g= 0
df$y[df$g== 1] <-2 + df$x[df$g== 1]**2 + rnorm(sum(df$g== 1))*5 # y for g= 1 (with intercept 2)

p <- ggplot(df, aes(x, y, col= g)) + geom_smooth() + geom_point(alpha= .1) # make a plot
pb <- ggplot_build(p) # Get computed data

data.of.g1 <- pb[['data']][[1]][pb[['data']][[1]]$group == 1, ] # Extract info for group 1
data.of.g2 <- pb[['data']][[1]][pb[['data']][[1]]$group == 2, ] # Extract info for group 2

xlimit.inf <- max(min(data.of.g1$x), min(data.of.g2$x)) # Get the minimum X the two smoothed data have in common
xlimit.sup <- min(max(data.of.g1$x), max(data.of.g2$x)) # Get the maximum X
xseq <- seq(xlimit.inf, xlimit.sup, 0.01) # Sequence of X value (you can use bigger/smaller step size)

# Based on data from group 1 and group 2, interpolates linearly for all the values in `xseq`
y.g1 <- approx(x = data.of.g1$x, y = data.of.g1$y, xout = xseq)
y.g2 <- approx(x = data.of.g2$x, y = data.of.g2$y, xout = xseq)

difference <- data.frame(x = xseq, dy = abs(y.g1$y - y.g2$y)) # Compute the difference
ggplot(difference, aes(x = x, y = dy)) + geom_line() # Make the plot

Output:


问:
Editing Twilio TwiML using API or HTTP POST
My company uses Twilio Flex as our phone system and I was recently tasked with setting up a feature that will let us edit a TwiML voice message that plays before our normal voice message. This TwiML message will be changed through a Twilio bot that I've published in our Microsoft Teams.

The reason for this is so that our support desk can add a short message in the lines of "We're currently experiencing issues with X" before our normal "Welcome to [Company] support" message.

If TwiML's can be edited using HTTP POST/PUT or Twilio's API this should be a trivial matter, but so far I've not been able to figure out how.

I couldn't find any reference to this in the API doc, so I decided that HTTP POST would be the way to go. Using this as a start off point, I'm able to retrieve my TwiML using HTTP GET:

https://support.twilio.com/hc/en-us/articles/223132187--Not-Authorized-error-when-trying-to-view-TwiML-Bin-URL

```<code>const axios = require('axios');
const crypto = require('crypto');
const accountSidFlex = process.env.accountSidFlex;
const authTokenFlex = process.env.authTokenFlex;

var URL = 'https://handler.twilio.com/twiml/EHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + '?AccountSid=' + accountSidFlex
    var twilioSig = crypto.createHmac('sha1', authTokenFlex).update(new Buffer(URL, 'utf-8')).digest('Base64')
var config = {
    headers:{
    'X-TWILIO-SIGNATURE': twilioSig
    }
}

axios.get(
    URL,config
).catch(error => console.log(error))
.then(response => {
    console.log(response.data)
})
</code>```

response.data shows the TwiML's current XML content.

My attempts at a POST only gives the same output as the GET, while PUT gives 405 Method Not Allowed.

```<code>var URL = 'https://handler.twilio.com/twiml/EHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + '?AccountSid=' + accountSidFlex
var twilioSig = crypto.createHmac('sha1', authTokenFlex).update(new Buffer(URL, 'utf-8')).digest('Base64')

var config = {
    headers:{
    'X-TWILIO-SIGNATURE': twilioSig,
    'Content-Type': 'text/xml'
    }
}

var xml =
'<?xml version="1.0" encoding="UTF-8"?>\
<Response><Play digits="www"/>\
<Say voice="alice">"We are currently experiencing X related issues". </Say>\
</Response>';

axios.post(
    URL,xml,config
)
.catch(error => console.log(error))
.then(response => {
    console.log(response.data)
})
</code>```

Ideally I'd like to be able to change a specific TwiML using either HTTP methods or the Twilio-API, so that we can use it in out Studio Flow. We'd just keep it silent until we need to add something to it and revert back to silent once the issues have passed.

Any help would be appreciated!

答:
You cannot currently change the contents of TwiML Bins, Studio Flows, or Twilio Functions programatically. I believe the key functionality you are looking for is a way to dynamically update the messaging (Say/Play Widget) in a Studio flow based on some condition.

One way is to use a Function Widget to retrieve a Twilio Sync document for the message, returning the message as JSON and have the Say/Play widget play that message. You can find the Twilio Sync REST API examples for Add, Modify, and Retrieve in the associated document.

You can retrieve the parsed response using variable syntax detailed here, https://www.twilio.com/docs/studio/widget-library#run-function.

Body:
My company uses Twilio Flex as our phone system and I was recently tasked with setting up a feature that will let us edit a TwiML voice message that plays before our normal voice message. This TwiML message will be changed through a Twilio bot that I've published in our Microsoft Teams.

The reason for this is so that our support desk can add a short message in the lines of "We're currently experiencing issues with X" before our normal "Welcome to [Company] support" message.

If TwiML's can be edited using HTTP POST/PUT or Twilio's API this should be a trivial matter, but so far I've not been able to figure out how.

I couldn't find any reference to this in the API doc, so I decided that HTTP POST would be the way to go. Using this as a start off point, I'm able to retrieve my TwiML using HTTP GET:

https://support.twilio.com/hc/en-us/articles/223132187--Not-Authorized-error-when-trying-to-view-TwiML-Bin-URL

const axios = require('axios');
const crypto = require('crypto');
const accountSidFlex = process.env.accountSidFlex;
const authTokenFlex = process.env.authTokenFlex;

var URL = 'https://handler.twilio.com/twiml/EHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + '?AccountSid=' + accountSidFlex
    var twilioSig = crypto.createHmac('sha1', authTokenFlex).update(new Buffer(URL, 'utf-8')).digest('Base64')
var config = {
    headers:{
    'X-TWILIO-SIGNATURE': twilioSig
    }
}

axios.get(
    URL,config
).catch(error => console.log(error))
.then(response => {
    console.log(response.data)
})

response.data shows the TwiML's current XML content.

My attempts at a POST only gives the same output as the GET, while PUT gives 405 Method Not Allowed.

var URL = 'https://handler.twilio.com/twiml/EHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + '?AccountSid=' + accountSidFlex
var twilioSig = crypto.createHmac('sha1', authTokenFlex).update(new Buffer(URL, 'utf-8')).digest('Base64')

var config = {
    headers:{
    'X-TWILIO-SIGNATURE': twilioSig,
    'Content-Type': 'text/xml'
    }
}

var xml =
'<?xml version="1.0" encoding="UTF-8"?>\
<Response><Play digits="www"/>\
<Say voice="alice">"We are currently experiencing X related issues". </Say>\
</Response>';

axios.post(
    URL,xml,config
)
.catch(error => console.log(error))
.then(response => {
    console.log(response.data)
})

Ideally I'd like to be able to change a specific TwiML using either HTTP methods or the Twilio-API, so that we can use it in out Studio Flow. We'd just keep it silent until we need to add something to it and revert back to silent once the issues have passed.

Any help would be appreciated!


问:
Netlink implementation for the Android NDK
I have a requirement for similar task as mentioned in this link.. Passive monitoring of sockets in Android. One way is parsing the /proc/net/{tcp,udp,...} tables. But we have to keep on reading continuously for keep on monitoring; which is not efficient way. As it will be a mobile device app, it will eat up the battery as it requires CPU Time for keep on monitoring for time interval (say 1 sec).

But, I am looking for an event based approach. As I googled about the same, I ended with NETLINK for monitoring the sockets. But I observe that Android NDK doesn't have support for the

```<code>#include <linux/sock_diag.h>
#include <linux/inet_diag.h>
#include <linux/unix_diag.h>
#include <linux/packet_diag.h>
#include <linux/netlink_diag.h>
</code>```

Does anyone tried using NETLINK in Android for monitoring the INET sockets? If so please share the information.

Thanks.

UPDATE:
I tried copy pasting the above mentioned files in the "jni" folder and built using ndk-build. Building was successful and also no crashes at the runtime. But, socket creation of type

```<code>socket(AF_NETLINK, SOCK_DGRAM, NETLINK_INET_DIAG)
</code>```

is failing with error EACCES(13) - Permission to create a socket of the specified type and/or protocol is denied.

Any suggestions how to proceed further?

答: i think, your app should have root permision!</p>

Body:
I have a requirement for similar task as mentioned in this link.. Passive monitoring of sockets in Android. One way is parsing the /proc/net/{tcp,udp,...} tables. But we have to keep on reading continuously for keep on monitoring; which is not efficient way. As it will be a mobile device app, it will eat up the battery as it requires CPU Time for keep on monitoring for time interval (say 1 sec).

But, I am looking for an event based approach. As I googled about the same, I ended with NETLINK for monitoring the sockets. But I observe that Android NDK doesn't have support for the

#include <linux/sock_diag.h>
#include <linux/inet_diag.h>
#include <linux/unix_diag.h>
#include <linux/packet_diag.h>
#include <linux/netlink_diag.h>

Does anyone tried using NETLINK in Android for monitoring the INET sockets? If so please share the information.

Thanks.

UPDATE:
I tried copy pasting the above mentioned files in the "jni" folder and built using ndk-build. Building was successful and also no crashes at the runtime. But, socket creation of type

socket(AF_NETLINK, SOCK_DGRAM, NETLINK_INET_DIAG)

is failing with error EACCES(13) - Permission to create a socket of the specified type and/or protocol is denied.

Any suggestions how to proceed further?


问:
Can numerical values be assigned to alphabetic elements of a list and then added using the sum() function?
I am  trying the following problem and I don't know what's wrong. Can somebody help me through it?

```<code>java=10
python=10
sql=5
unix=5
javascript=5
framework=10
i=eval(input("Enter courses done in a list"))
if sum(i)>=30:
    print("eligible since the score is", sum(i))
else:
    print("Not eligible since the score is",sum(i))
</code>```

But I am getting the following error,

```<code>Traceback (most recent call last):
  File "E:/Python Notes/Python Programs/Eligible for placement.py", line 8, in <module>
    if sum(i)>=30:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
</code>```

Thanks in advance!!

答:
Let's assume that user input is a string of course names split by whitespace, then:</p>

```<code>courses = {"java":10,
           "python":10,
           "sql":5,
           "unix":5,
           "javascript":5,
           "framework":10}
user_input = input("Enter courses done in a list")
course_names = user_input.split()
i = sum([courses.get(course,0) for course in course_names])
if i >= 30:
    print("eligible since the score is", i)
else:
    print("Not eligible since the score is",i)

</code>```

Body:
I am  trying the following problem and I don't know what's wrong. Can somebody help me through it?

java=10
python=10
sql=5
unix=5
javascript=5
framework=10
i=eval(input("Enter courses done in a list"))
if sum(i)>=30:
    print("eligible since the score is", sum(i))
else:
    print("Not eligible since the score is",sum(i))

But I am getting the following error,

Traceback (most recent call last):
  File "E:/Python Notes/Python Programs/Eligible for placement.py", line 8, in <module>
    if sum(i)>=30:
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Thanks in advance!!

Body:
Let's assume that user input is a string of course names split by whitespace, then:

courses = {"java":10,
           "python":10,
           "sql":5,
           "unix":5,
           "javascript":5,
           "framework":10}
user_input = input("Enter courses done in a list")
course_names = user_input.split()
i = sum([courses.get(course,0) for course in course_names])
if i >= 30:
    print("eligible since the score is", i)
else:
    print("Not eligible since the score is",i)


问:
How to make a RecylerView like WhatsApp Chat activity?
I building an app which should have a layout almost identical to the one used in WhatsApp in the chat activity. it should have a text input, camera & video recording option. Items should be centered inside the recycler and when the dataset is changed the recycler should scroll to the last item added. when the user clicks on the Editext keyboard should resize the view moving recycler up and focus on the last item in the Dataset.

For the scrolling part, I have used SmoothScrollToPosiotion but when an item, which contains an image or a video, the view gets chopped, auto scroll also stops working. a weird bug is when I open the keyboard by clicking on editText the recycler scrolls almost to the last item but not completely, only if reopen the keyboard multiple times it shows the item completely.

already tried solutions found on google, and here with not expected results :(

EDIT: almost solved, I have just moved SmoothScrollToposition inside the onClickListener of every button. Now it does not scroll to the last item it just scrolls to the item before the last but completely :D

here some code:
(if needed full code at https://github.com/MikeSys/ChatApp)

MainActivity Layout

```<code><android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<android.support.v7.widget.RecyclerView
    android:background="@drawable/sfondo"
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout"
    app:layout_constraintTop_toTopOf="parent"
    />

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="55dp"
    app:layout_constraintBottom_toBottomOf="parent"
    android:orientation="horizontal">

    <EditText
        android:layout_gravity="center_vertical"
        android:id="@+id/editText"
        android:layout_width="255dp"
        android:layout_height="55dp"
        android:background="#0003A9F4"
        android:hint="Scrivi"
        android:padding="10dp" />

    <Button
        android:layout_gravity="center_vertical"
        android:id="@+id/camera"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@drawable/camera"
      />

    <Button
        android:layout_gravity="center_vertical"
        android:id="@+id/video"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@drawable/video"
        />

    <Button
        android:id="@+id/send"
        android:layout_width="55dp"
        android:layout_height="55dp"
        android:background="@drawable/send" />

</LinearLayout>

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

MainActivity Code

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

private ArrayList<ModelloDati> dati = new ArrayList<>();
private LinearLayoutManager linearLayoutManager;
private static final String VIDEO_DIRECTORY = "/Chat";
private myAdapter adapter;
public  Uri passUri;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Variables-----------------------------------------

    final RecyclerView recyclerView = findViewById(R.id.recyclerView);
    Button video = findViewById(R.id.video);
    Button camera = findViewById(R.id.camera);
    Button send = findViewById(R.id.send);
    final EditText editText = findViewById(R.id.editText);

    // Layout Manager------------------------------------------------

    linearLayoutManager = new LinearLayoutManager(MainActivity.this);
    linearLayoutManager.setReverseLayout(true);
    recyclerView.setLayoutManager(linearLayoutManager);

    // Adapter-----------------------------------------

    if(dati.size()> 1){
        adapter =  new myAdapter(dati, this);
        //Removed SmoothScroll form here
        adapter.notifyDataSetChanged();
        recyclerView.setAdapter(adapter);

    }

    else{
        Collections.reverse(dati);
        adapter =  new myAdapter(dati,this);
        recyclerView.setAdapter(adapter);
    }

    // Click Listener Video button---------------------------------------------
    video.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            startActivityForResult(intent,0);
            //Added here SmotthScroll
            recyclerView.smoothScrollToPosition(dati.size());
        }
    });

    // Click Listener Camera button--------------------------------------------
    camera.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(intent,1);
            //Added here SmotthScroll
            recyclerView.smoothScrollToPosition(dati.size());
        }
    });

    // Click Listener Send button----------------------------------------------
    send.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String string = editText.getText().toString();
            dati.add(new ModelloDati(0,string));
            editText.getText().clear();
            //Added here SmotthScroll
            recyclerView.smoothScrollToPosition(dati.size());
            closeKeyboard();
        }
    });

}

private void closeKeyboard() {
    View view = getCurrentFocus();
    if(view != null){
        InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(),0);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable
Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode){
        case 0:
            try {
                Uri contentURI = data.getData();
                passUri = contentURI;
                String recordedVideoPath = getPath(contentURI);
                Log.d("frrr", recordedVideoPath);
                saveVideoToInternalStorage(recordedVideoPath);
                dati.add(new ModelloDati(2, contentURI));
            }catch (Throwable o){Log.i("CAM","User aborted action");}
        case 1:
            try {
                Bitmap bitmap = (Bitmap)data.getExtras().get("data");
                dati.add(new ModelloDati(1,bitmap));
            }catch(Throwable o){
                Log.i("CAM","User aborted action");
            }
    }

}

private void saveVideoToInternalStorage (String filePath) {

    File new file;

    try {

        File currentFile = new File(filePath);
        File wallpaperDirectory = new
File(Environment.getExternalStorageDirectory() + VIDEO_DIRECTORY);
        newfile = new File(wallpaperDirectory,
Calendar.getInstance().getTimeInMillis() + ".mp4");

        if (!wallpaperDirectory.exists()) {
            wallpaperDirectory.mkdirs();
        }

        if(currentFile.exists()){

            InputStream in = new FileInputStream(currentFile);
            OutputStream out = new FileOutputStream(newfile);

            // Copy the bits from instream to outstream
            byte[] buf = new byte[1024];
            int len;

            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
            in.close();
            out.close();
            Log.v("vii", "Video file saved successfully.");
        }else{
            Log.v("vii", "Video saving failed. Source file missing.");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Video.Media.DATA };
    Cursor cursor = getContentResolver().query(uri, projection, null, null,
null);
    if (cursor != null) {
        // HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL
        // THIS CAN BE, IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA
        int column_index = cursor
                .getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } else
        return null;
}

}
</code>```

答:
Solved by Moving smoothScrollToPosition inside onClickListerner (video/camera button I had to move it inside onActivityResult).

Updated Main

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

private ArrayList<ModelloDati> dati = new ArrayList<>();
private LinearLayoutManager linearLayoutManager;
private static final String VIDEO_DIRECTORY = "/Chat";
private myAdapter adapter;
private RecyclerView recyclerView;
private VideoView videoView;
public  Uri passUri;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Variables-----------------------------------------

     recyclerView = findViewById(R.id.recyclerView);
    Button video = findViewById(R.id.video);
    Button camera = findViewById(R.id.camera);
    Button send = findViewById(R.id.send);
    final EditText editText = findViewById(R.id.editText);

    // Layout Manager------------------------------------------------

    linearLayoutManager = new LinearLayoutManager(MainActivity.this);
    linearLayoutManager.setStackFromEnd(true);
    RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator();
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setItemAnimator(itemAnimator);

    // Adapter-----------------------------------------

        //adapter.notifyDataSetChanged();
        adapter =  new myAdapter(dati, this);
        recyclerView.setAdapter(adapter);

    // Click Listener Video button----------------------------------------------
    video.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            startActivityForResult(intent,0);
        }
    });

    // Click Listener Camera button----------------------------------------------
    camera.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(intent,1);
        }
    });

    // Click Listener Send button------------------------------------------------
    send.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String string = editText.getText().toString();
            dati.add(new ModelloDati(0,string));
            adapter.notifyItemInserted(dati.size());
            editText.getText().clear();
            recyclerView.smoothScrollToPosition(dati.size());
            closeKeyboard();
        }
    });

}

private void closeKeyboard() {
    View view = getCurrentFocus();
    if(view != null){
        InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(),0);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode){
        case 0:
            try {
                Uri contentURI = data.getData();
                passUri = contentURI;
                String recordedVideoPath = getPath(contentURI);
                saveVideoToInternalStorage(recordedVideoPath);
                dati.add(new ModelloDati(2, contentURI));
                adapter.notifyItemInserted(dati.size());
                recyclerView.smoothScrollToPosition(dati.size());

            }catch (Throwable o){Log.i("CAM","User aborted action");}
        case 1:
            try {
                Bitmap bitmap = (Bitmap)data.getExtras().get("data");
                dati.add(new ModelloDati(1,bitmap));
                adapter.notifyItemInserted(dati.size());
                recyclerView.smoothScrollToPosition(dati.size());

            }catch(Throwable o){
                Log.i("CAM","User aborted action");
            }

    }

}

private void saveVideoToInternalStorage (String filePath) {

    File newfile;

    try {

        File currentFile = new File(filePath);
        File wallpaperDirectory = new File(Environment.getExternalStorageDirectory() +
VIDEO_DIRECTORY);
        newfile = new File(wallpaperDirectory, Calendar.getInstance().getTimeInMillis()
 + ".mp4");

        if (!wallpaperDirectory.exists()) {
            wallpaperDirectory.mkdirs();
        }

        if(currentFile.exists()){

            InputStream in = new FileInputStream(currentFile);
            OutputStream out = new FileOutputStream(newfile);

            // Copy the bits from instream to outstream
            byte[] buf = new byte[1024];
            int len;

            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
            in.close();
            out.close();
            Log.v("vii", "Video file saved successfully.");
        }else{
            Log.v("vii", "Video saving failed. Source file missing.");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Video.Media.DATA };
    Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
    if (cursor != null) {
        // HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL
        // THIS CAN BE, IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA
        int column_index = cursor
                .getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } else
        return null;
}

}
</code>```

Body:
I building an app which should have a layout almost identical to the one used in WhatsApp in the chat activity. it should have a text input, camera & video recording option. Items should be centered inside the recycler and when the dataset is changed the recycler should scroll to the last item added. when the user clicks on the Editext keyboard should resize the view moving recycler up and focus on the last item in the Dataset.

For the scrolling part, I have used SmoothScrollToPosiotion but when an item, which contains an image or a video, the view gets chopped, auto scroll also stops working. a weird bug is when I open the keyboard by clicking on editText the recycler scrolls almost to the last item but not completely, only if reopen the keyboard multiple times it shows the item completely.

already tried solutions found on google, and here with not expected results :(

EDIT: almost solved, I have just moved SmoothScrollToposition inside the onClickListener of every button. Now it does not scroll to the last item it just scrolls to the item before the last but completely :D

here some code:
(if needed full code at https://github.com/MikeSys/ChatApp)

MainActivity Layout

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<android.support.v7.widget.RecyclerView
    android:background="@drawable/sfondo"
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout"
    app:layout_constraintTop_toTopOf="parent"
    />

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="55dp"
    app:layout_constraintBottom_toBottomOf="parent"
    android:orientation="horizontal">

    <EditText
        android:layout_gravity="center_vertical"
        android:id="@+id/editText"
        android:layout_width="255dp"
        android:layout_height="55dp"
        android:background="#0003A9F4"
        android:hint="Scrivi"
        android:padding="10dp" />

    <Button
        android:layout_gravity="center_vertical"
        android:id="@+id/camera"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@drawable/camera"
      />

    <Button
        android:layout_gravity="center_vertical"
        android:id="@+id/video"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@drawable/video"
        />

    <Button
        android:id="@+id/send"
        android:layout_width="55dp"
        android:layout_height="55dp"
        android:background="@drawable/send" />

</LinearLayout>

</android.support.constraint.ConstraintLayout>

MainActivity Code

public class MainActivity extends AppCompatActivity {

private ArrayList<ModelloDati> dati = new ArrayList<>();
private LinearLayoutManager linearLayoutManager;
private static final String VIDEO_DIRECTORY = "/Chat";
private myAdapter adapter;
public  Uri passUri;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Variables-----------------------------------------

    final RecyclerView recyclerView = findViewById(R.id.recyclerView);
    Button video = findViewById(R.id.video);
    Button camera = findViewById(R.id.camera);
    Button send = findViewById(R.id.send);
    final EditText editText = findViewById(R.id.editText);

    // Layout Manager------------------------------------------------

    linearLayoutManager = new LinearLayoutManager(MainActivity.this);
    linearLayoutManager.setReverseLayout(true);
    recyclerView.setLayoutManager(linearLayoutManager);

    // Adapter-----------------------------------------

    if(dati.size()> 1){
        adapter =  new myAdapter(dati, this);
        //Removed SmoothScroll form here
        adapter.notifyDataSetChanged();
        recyclerView.setAdapter(adapter);

    }

    else{
        Collections.reverse(dati);
        adapter =  new myAdapter(dati,this);
        recyclerView.setAdapter(adapter);
    }

    // Click Listener Video button---------------------------------------------
    video.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            startActivityForResult(intent,0);
            //Added here SmotthScroll
            recyclerView.smoothScrollToPosition(dati.size());
        }
    });

    // Click Listener Camera button--------------------------------------------
    camera.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(intent,1);
            //Added here SmotthScroll
            recyclerView.smoothScrollToPosition(dati.size());
        }
    });

    // Click Listener Send button----------------------------------------------
    send.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String string = editText.getText().toString();
            dati.add(new ModelloDati(0,string));
            editText.getText().clear();
            //Added here SmotthScroll
            recyclerView.smoothScrollToPosition(dati.size());
            closeKeyboard();
        }
    });

}

private void closeKeyboard() {
    View view = getCurrentFocus();
    if(view != null){
        InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(),0);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable
Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode){
        case 0:
            try {
                Uri contentURI = data.getData();
                passUri = contentURI;
                String recordedVideoPath = getPath(contentURI);
                Log.d("frrr", recordedVideoPath);
                saveVideoToInternalStorage(recordedVideoPath);
                dati.add(new ModelloDati(2, contentURI));
            }catch (Throwable o){Log.i("CAM","User aborted action");}
        case 1:
            try {
                Bitmap bitmap = (Bitmap)data.getExtras().get("data");
                dati.add(new ModelloDati(1,bitmap));
            }catch(Throwable o){
                Log.i("CAM","User aborted action");
            }
    }

}

private void saveVideoToInternalStorage (String filePath) {

    File new file;

    try {

        File currentFile = new File(filePath);
        File wallpaperDirectory = new
File(Environment.getExternalStorageDirectory() + VIDEO_DIRECTORY);
        newfile = new File(wallpaperDirectory,
Calendar.getInstance().getTimeInMillis() + ".mp4");

        if (!wallpaperDirectory.exists()) {
            wallpaperDirectory.mkdirs();
        }

        if(currentFile.exists()){

            InputStream in = new FileInputStream(currentFile);
            OutputStream out = new FileOutputStream(newfile);

            // Copy the bits from instream to outstream
            byte[] buf = new byte[1024];
            int len;

            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
            in.close();
            out.close();
            Log.v("vii", "Video file saved successfully.");
        }else{
            Log.v("vii", "Video saving failed. Source file missing.");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Video.Media.DATA };
    Cursor cursor = getContentResolver().query(uri, projection, null, null,
null);
    if (cursor != null) {
        // HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL
        // THIS CAN BE, IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA
        int column_index = cursor
                .getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } else
        return null;
}

}

Body:
Solved by Moving smoothScrollToPosition inside onClickListerner (video/camera button I had to move it inside onActivityResult).

Updated Main

public class MainActivity extends AppCompatActivity {

private ArrayList<ModelloDati> dati = new ArrayList<>();
private LinearLayoutManager linearLayoutManager;
private static final String VIDEO_DIRECTORY = "/Chat";
private myAdapter adapter;
private RecyclerView recyclerView;
private VideoView videoView;
public  Uri passUri;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Variables-----------------------------------------

     recyclerView = findViewById(R.id.recyclerView);
    Button video = findViewById(R.id.video);
    Button camera = findViewById(R.id.camera);
    Button send = findViewById(R.id.send);
    final EditText editText = findViewById(R.id.editText);

    // Layout Manager------------------------------------------------

    linearLayoutManager = new LinearLayoutManager(MainActivity.this);
    linearLayoutManager.setStackFromEnd(true);
    RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator();
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setItemAnimator(itemAnimator);

    // Adapter-----------------------------------------

        //adapter.notifyDataSetChanged();
        adapter =  new myAdapter(dati, this);
        recyclerView.setAdapter(adapter);

    // Click Listener Video button----------------------------------------------
    video.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            startActivityForResult(intent,0);
        }
    });

    // Click Listener Camera button----------------------------------------------
    camera.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(intent,1);
        }
    });

    // Click Listener Send button------------------------------------------------
    send.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String string = editText.getText().toString();
            dati.add(new ModelloDati(0,string));
            adapter.notifyItemInserted(dati.size());
            editText.getText().clear();
            recyclerView.smoothScrollToPosition(dati.size());
            closeKeyboard();
        }
    });

}

private void closeKeyboard() {
    View view = getCurrentFocus();
    if(view != null){
        InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(),0);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode){
        case 0:
            try {
                Uri contentURI = data.getData();
                passUri = contentURI;
                String recordedVideoPath = getPath(contentURI);
                saveVideoToInternalStorage(recordedVideoPath);
                dati.add(new ModelloDati(2, contentURI));
                adapter.notifyItemInserted(dati.size());
                recyclerView.smoothScrollToPosition(dati.size());

            }catch (Throwable o){Log.i("CAM","User aborted action");}
        case 1:
            try {
                Bitmap bitmap = (Bitmap)data.getExtras().get("data");
                dati.add(new ModelloDati(1,bitmap));
                adapter.notifyItemInserted(dati.size());
                recyclerView.smoothScrollToPosition(dati.size());

            }catch(Throwable o){
                Log.i("CAM","User aborted action");
            }

    }

}

private void saveVideoToInternalStorage (String filePath) {

    File newfile;

    try {

        File currentFile = new File(filePath);
        File wallpaperDirectory = new File(Environment.getExternalStorageDirectory() +
VIDEO_DIRECTORY);
        newfile = new File(wallpaperDirectory, Calendar.getInstance().getTimeInMillis()
 + ".mp4");

        if (!wallpaperDirectory.exists()) {
            wallpaperDirectory.mkdirs();
        }

        if(currentFile.exists()){

            InputStream in = new FileInputStream(currentFile);
            OutputStream out = new FileOutputStream(newfile);

            // Copy the bits from instream to outstream
            byte[] buf = new byte[1024];
            int len;

            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
            in.close();
            out.close();
            Log.v("vii", "Video file saved successfully.");
        }else{
            Log.v("vii", "Video saving failed. Source file missing.");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Video.Media.DATA };
    Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
    if (cursor != null) {
        // HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL
        // THIS CAN BE, IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA
        int column_index = cursor
                .getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    } else
        return null;
}

}


问:
Delphi Calculate age of person from TDateEdit component
I have a very simple form with a TDateEdit, TButton and TLabel component.

What is the best way to get the age of someone if the date given is their birthdate? How would someone do this in Delphi from the TDateEdit component and then display the age within the label?

Is there maybe a built in function or something I can use to get the age of someone from their date of birth in the component? I'm looking for the simplest, easiest and best way to do this.

答:
You can use the function YearsBetween() from the System.DateUtils unit to calculate the number of years between today (which you get from the function now) and the date in your TDateEdit component, which you get from the date property.

```<code>Label1.Text:= Trunc(YearsBetween(Now,DateEdit1.Date)).toString;
</code>```

Body:
You can use the function YearsBetween() from the System.DateUtils unit to calculate the number of years between today (which you get from the function now) and the date in your TDateEdit component, which you get from the date property.

Label1.Text:= Trunc(YearsBetween(Now,DateEdit1.Date)).toString;


问:
Getting the first character of a word taken from user input using Scanner
I want to use a Scanner to get a word from the user, then print the first character of that word. For example, for the word "Lucas", it will print out 'L'.

import java.util.Scanner;
public class IDname {

    public static void main(String[] args) {
        String first;
        String second;
        Scanner scan = new Scanner(System.in);

        System.out.print("Enter your first name: ");
        first = scan.nextLine();
    }
}
```

What code should I add after this line?

答:
You can use the method subString(0, 1); Where the first argument is the startIndex inclusive and the second is endIndex exclusive. More info at substring tutorial.

```<code>public static void main (String[]args){
  String first;
  Scanner scan = new Scanner(System.in);

  System.out.print("Enter your first name: ");
  first = scan.nextLine();
  System.out.println("your name =" + first);
  if (first.length() > 0) {
        System.out.printf("The first character of your name = %s\n", first.substring(0, 1));
  }

}
</code>```

Body:
I want to use a Scanner to get a word from the user, then print the first character of that word. For example, for the word "Lucas", it will print out 'L'.

import java.util.Scanner;
public class IDname {

    public static void main(String[] args) {
        String first;
        String second;
        Scanner scan = new Scanner(System.in);

        System.out.print("Enter your first name: ");
        first = scan.nextLine();
    }
}

What code should I add after this line?

Body:
You can use the method subString(0, 1); Where the first argument is the startIndex inclusive and the second is endIndex exclusive. More info at substring tutorial.

public static void main (String[]args){
  String first;
  Scanner scan = new Scanner(System.in);

  System.out.print("Enter your first name: ");
  first = scan.nextLine();
  System.out.println("your name =" + first);
  if (first.length() > 0) {
        System.out.printf("The first character of your name = %s\n", first.substring(0, 1));
  }

}


问:
SonarQube can't find the project configuration path
Anyone knows how to figure this out?

```<code>C:\sonar-runner\bin\..
SonarQube Runner 2.3
Java 1.7.0_45 Oracle Corporation (64-bit)
Windows Server 2012 6.2 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\sonar-runner\bin\..\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "pt_BR", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: C:\sonar-runner\bin\.sonar
INFO: SonarQube Server 4.0
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 7.425s
Final Memory: 6M/31M
INFO: -----
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for 'Unknow
n': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
</code>```

For some reason the SonarQube can't find the configuration project path
its return NONE from the INFO.
I already have the file in the conf path of the sonar-runner.

答:
Important: the name of the project configuration file must be:
"sonar-project.properties" (not sonar-scanner.properties)

And you have to launch the sonar-scaner command from the path of your project.

Body:
Anyone knows how to figure this out?

C:\sonar-runner\bin\..
SonarQube Runner 2.3
Java 1.7.0_45 Oracle Corporation (64-bit)
Windows Server 2012 6.2 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\sonar-runner\bin\..\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "pt_BR", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: C:\sonar-runner\bin\.sonar
INFO: SonarQube Server 4.0
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 7.425s
Final Memory: 6M/31M
INFO: -----
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for 'Unknow
n': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources

For some reason the SonarQube can't find the configuration project path
its return NONE from the INFO.
I already have the file in the conf path of the sonar-runner.