text:
Q: XCode crashes at start (at launch) My XCode crashes with the following error
Process:               Xcode [972]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               11.2.1 (15526.1)
Build Info:            IDEFrameworks-15526001000000000~4 (11B500)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [972]
User ID:               167860746

Date/Time:             2020-07-20 16:14:09.203 +0300
OS Version:            Mac OS X 10.15.5 (19F101)
Report Version:        12
Anonymous UUID:        0B196765-5F42-FDBE-EF0C-E0879215BB57

Sleep/Wake UUID:       EF4EEF31-7B40-43FF-B0D2-316C16B8E1AE

Time Awake Since Boot: 970 seconds
Time Since Wake:       270 seconds

System Integrity Protection: enabled

Crashed Thread:        28  Dispatch queue: Diff queue for DVTDiffContext <0x7fe80b26e9a0>

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x0000700003400000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [972]

VM Regions Near 0x700003400000:
    Stack                  000070000337e000-0000700003400000 [  520K] rw-/rwx SM=COW  thread 28
--> STACK GUARD            0000700003400000-0000700003401000 [    4K] ---/rwx SM=NUL  stack guard for thread 25
    Stack                  0000700003401000-0000700003483000 [  520K] rw-/rwx SM=COW  thread 25

Application Specific Information:
ProductBuildVersion: 11B500

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462
5   com.apple.HIToolbox             0x00007fff2c26eabd RunCurrentEventLoopInMode + 292
6   com.apple.HIToolbox             0x00007fff2c26e7d5 ReceiveNextEventCommon + 584
7   com.apple.HIToolbox             0x00007fff2c26e579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
8   com.apple.AppKit                0x00007fff2a8b6829 _DPSNextEvent + 883
9   com.apple.AppKit                0x00007fff2a8b5070 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
10  com.apple.dt.DVTKit             0x0000000102f8dfeb -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 390
11  com.apple.AppKit                0x00007fff2a8a6d7e -[NSApplication run] + 658
12  com.apple.AppKit                0x00007fff2a878b86 NSApplicationMain + 777
13  com.apple.dt.Xcode              0x0000000102667e8d main + 541
14  libdyld.dylib                   0x00007fff6763ccc9 start + 1

Thread 1:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 3:: Dispatch queue: <IDEXCBuildSupport.IDEXCBuildServiceBuildOperation:0x7fe80b473cd0:REfc>-builder-queue (QOS: UNSPECIFIED)
0   libsystem_kernel.dylib          0x00007fff6777de36 semaphore_wait_trap + 10
1   libdispatch.dylib               0x00007fff675e3aed _dispatch_sema4_wait + 16
2   libdispatch.dylib               0x00007fff675e3fbf _dispatch_semaphore_wait_slow + 98
3   libswiftDispatch.dylib          0x00007fff670ab17f OS_dispatch_semaphore.wait(wallTimeout:) + 15
4   com.apple.dt.IDE.XCBuildSupport 0x000000012900b8a2 closure #1 in IDEXCBuildServiceBuildOperation.addOperations(to:) + 306
5   com.apple.dt.IDE.XCBuildSupport 0x0000000129002829 thunk for @escaping @callee_guaranteed () -> () + 25
6   com.apple.Foundation            0x00007fff2fcb9ac5 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
7   com.apple.Foundation            0x00007fff2fcb99e6 -[NSBlockOperation main] + 80
8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
10  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
11  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
12  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83
13  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
14  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414
15  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703
16  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326
17  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92
18  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220
19  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 4:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 6:: Dispatch queue: -[IDEExecutionEnvironment initWithWorkspaceArena:] (QOS: UNSPECIFIED)
0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698
2   com.apple.Foundation            0x00007fff2fcc8ecb -[NSOperation waitUntilFinished] + 697
3   com.apple.Foundation            0x00007fff2fe5b270 __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__ + 17
4   com.apple.Foundation            0x00007fff2fd87df0 -[NSOperationQueue waitUntilAllOperationsAreFinished] + 229
5   com.apple.dt.IDEFoundation      0x000000010352738f __61-[IDEScheme _groupAndImposeDependenciesForOrderedOperations:]_block_invoke + 10
6   com.apple.dt.DVTFoundation      0x000000010280bf2d __DVTOPERATIONGROUP_CREATED_BY_CALLEE_IS_WAITING_ON_SUBOPERATIONS__ + 164
7   com.apple.dt.DVTFoundation      0x000000010280c196 -[DVTOperationGroup main] + 69
8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
10  com.apple.dt.DVTFoundation      0x000000010280c146 -[DVTOperationGroup start] + 113
11  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
12  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
13  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83
14  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
15  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414
16  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703
17  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326
18  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92
19  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220
20  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 7:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 8:: Dispatch queue: NSOperationQueue 0x7fe80b4709b0 (QOS: UNSPECIFIED)
0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698
2   com.apple.Foundation            0x00007fff2fcc8ecb -[NSOperation waitUntilFinished] + 697
3   com.apple.Foundation            0x00007fff2fe5b270 __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__ + 17
4   com.apple.Foundation            0x00007fff2fd87df0 -[NSOperationQueue waitUntilAllOperationsAreFinished] + 229
5   com.apple.dt.IDEFoundation      0x00000001035a0c2f __75-[IDEBuildOperationGroup initWithBuildOperations:otherOperations:buildLog:]_block_invoke + 10
6   com.apple.dt.DVTFoundation      0x000000010280bf2d __DVTOPERATIONGROUP_CREATED_BY_CALLEE_IS_WAITING_ON_SUBOPERATIONS__ + 164
7   com.apple.dt.DVTFoundation      0x000000010280c196 -[DVTOperationGroup main] + 69
8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
10  com.apple.dt.DVTFoundation      0x000000010280c146 -[DVTOperationGroup start] + 113
11  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
12  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
13  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83
14  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
15  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414
16  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703
17  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326
18  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92
19  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220
20  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 9:
0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462
5   com.apple.Foundation            0x00007fff2fcd81c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
6   com.apple.DTDeviceKitBase       0x000000011acd844e +[DTDKRemoteDeviceConnection startServiceBrowsers] + 204
7   com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064
8   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
9   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 10:
0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462
5   com.apple.Foundation            0x00007fff2fcd81c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
6   com.apple.DTDeviceKitBase       0x000000011ace5f7d -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 636
7   com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064
8   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
9   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 11:: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x00007fff677860fe __select + 10
1   com.apple.CoreFoundation        0x00007fff2d66ace3 __CFSocketManager + 641
2   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
3   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 12:: JavaScriptCore bmalloc scavenger
0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698
2   libc++.1.dylib                  0x00007fff64910592 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 18
3   com.apple.JavaScriptCore        0x00007fff31e3c224 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 84
4   com.apple.JavaScriptCore        0x00007fff31e40a2b bmalloc::Scavenger::threadRunLoop() + 299
5   com.apple.JavaScriptCore        0x00007fff31e405f9 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 9
6   com.apple.JavaScriptCore        0x00007fff31e42cd7 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::Scavenger*), bmalloc::Scavenger*> >(void*) + 39
7   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
8   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 13:: com.apple.NSEventThread
0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462
5   com.apple.AppKit                0x00007fff2aa58144 _NSEventThread + 132
6   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
7   libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 14:: Dispatch queue: NSOperationQueue 0x7fe80b46bfb0 (QOS: UNSPECIFIED)
0   libsystem_kernel.dylib          0x00007fff67780882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff67841425 _pthread_cond_wait + 698
2   com.apple.Foundation            0x00007fff2fcc8ecb -[NSOperation waitUntilFinished] + 697
3   com.apple.Foundation            0x00007fff2fe5b270 __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__ + 17
4   com.apple.Foundation            0x00007fff2fd87df0 -[NSOperationQueue waitUntilAllOperationsAreFinished] + 229
5   com.apple.dt.IDEFoundation      0x00000001035a0c3b __75-[IDEBuildOperationGroup initWithBuildOperations:otherOperations:buildLog:]_block_invoke_2 + 10
6   com.apple.dt.DVTFoundation      0x000000010280bf2d __DVTOPERATIONGROUP_CREATED_BY_CALLEE_IS_WAITING_ON_SUBOPERATIONS__ + 164
7   com.apple.dt.DVTFoundation      0x000000010280c196 -[DVTOperationGroup main] + 69
8   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
9   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
10  com.apple.dt.DVTFoundation      0x000000010280c146 -[DVTOperationGroup start] + 113
11  com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
12  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
13  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83
14  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
15  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414
16  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703
17  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326
18  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92
19  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220
20  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 15:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 16:: DYMobileDeviceManager
0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462
5   com.apple.Foundation            0x00007fff2fcd81c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
6   com.apple.Foundation            0x00007fff2fd8ac6f -[NSRunLoop(NSRunLoop) run] + 76
7   com.apple.GPUToolsMobileFoundation  0x00000001205245a9 -[DYMobileDeviceManager _deviceNotificationThread:] + 126
8   com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064
9   libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
10  libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 17:
0   libsystem_kernel.dylib          0x00007fff6777ddfa mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff6777e170 mach_msg + 60
2   com.apple.CoreFoundation        0x00007fff2d641f85 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation        0x00007fff2d640a52 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation        0x00007fff2d63fece CFRunLoopRunSpecific + 462
5   com.apple.CoreFoundation        0x00007fff2d6c8519 CFRunLoopRun + 40
6   libSwiftPM.dylib                0x000000012479e146 closure #1 in FSEventStream.start() + 262
7   libSwiftPM.dylib                0x000000012461c7a2 closure #1 in Thread.init(task:) + 146
8   libSwiftPM.dylib                0x000000012461c8f9 thunk for @escaping @callee_guaranteed () -> () + 25
9   libSwiftPM.dylib                0x000000012461c8be @objc ThreadImpl.main() + 46
10  com.apple.Foundation            0x00007fff2fcd07a2 __NSThread__start__ + 1064
11  libsystem_pthread.dylib         0x00007fff67841109 _pthread_start + 148
12  libsystem_pthread.dylib         0x00007fff6783cb8b thread_start + 15

Thread 18:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 19:: Dispatch queue: Working Copy Cached Location Queue (QOS: UTILITY)
0   libsystem_kernel.dylib          0x00007fff6777de36 semaphore_wait_trap + 10
1   libdispatch.dylib               0x00007fff675e3aed _dispatch_sema4_wait + 16
2   libdispatch.dylib               0x00007fff675e3fbf _dispatch_semaphore_wait_slow + 98
3   com.apple.dt.Xcode.DVTSourceControl 0x000000010f04d5d3 __52-[DVTSourceControlWorkingCopy updateCachedLocations]_block_invoke + 141
4   com.apple.Foundation            0x00007fff2fcb9ac5 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
5   com.apple.Foundation            0x00007fff2fcb99e6 -[NSBlockOperation main] + 80
6   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
7   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
8   com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
9   com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
10  libdispatch.dylib               0x00007fff675ef2b9 _dispatch_block_async_invoke2 + 83
11  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
12  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414
13  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703
14  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326
15  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92
16  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220
17  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 20:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 21:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 22:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 23:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 24:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 25:: Dispatch queue: IDE Source Control File Path Processesing Queue
0   libsystem_kernel.dylib          0x00007fff6777e672 __getattrlist + 10
1   com.apple.Foundation            0x00007fff2fc7caa7 _NSResolveSymlinksInPathUsingCache + 1009
2   com.apple.Foundation            0x00007fff2fc7c56b -[NSString(NSPathUtilities) _stringByResolvingSymlinksInPathUsingCache:] + 155
3   com.apple.dt.IDEFoundation      0x00000001035b7f30 __64-[IDESourceControlWorkspaceMonitor addWorkspaceFilePathToCheck:]_block_invoke + 280
4   com.apple.dt.DVTFoundation      0x00000001029803ba __DVT_CALLING_CLIENT_BLOCK__ + 7
5   com.apple.dt.DVTFoundation      0x0000000102981a92 __DVTDispatchAsync_block_invoke + 809
6   libdispatch.dylib               0x00007fff675e26c4 _dispatch_call_block_and_release + 12
7   libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
8   libdispatch.dylib               0x00007fff675e8c44 _dispatch_lane_serial_drain + 597
9   libdispatch.dylib               0x00007fff675e95d6 _dispatch_lane_invoke + 363
10  libdispatch.dylib               0x00007fff675f2c09 _dispatch_workloop_worker_thread + 596
11  libsystem_pthread.dylib         0x00007fff6783da3d _pthread_wqthread + 290
12  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 26:: Dispatch queue: IDE Source Control Fetch File Reference Status Processing Queue (QOS: BACKGROUND)
0   libsystem_kernel.dylib          0x00007fff6777de4e semaphore_timedwait_trap + 10
1   libdispatch.dylib               0x00007fff675e3b6b _dispatch_sema4_timedwait + 76
2   libdispatch.dylib               0x00007fff675e3f97 _dispatch_semaphore_wait_slow + 58
3   com.apple.dt.IDEFoundation      0x000000010328dd79 __91-[IDESourceControlWorkingTree _updateStatus:forceAuthentication:workspace:completionBlock:]_block_invoke_2 + 807
4   com.apple.dt.DVTFoundation      0x0000000102952375 -[DVTOperation main] + 287
5   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
6   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
7   com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
8   com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
9   libdispatch.dylib               0x00007fff675e26c4 _dispatch_call_block_and_release + 12
10  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
11  libdispatch.dylib               0x00007fff675e5818 _dispatch_continuation_pop + 414
12  libdispatch.dylib               0x00007fff675e4f16 _dispatch_async_redirect_invoke + 703
13  libdispatch.dylib               0x00007fff675f1957 _dispatch_root_queue_drain + 326
14  libdispatch.dylib               0x00007fff675f2097 _dispatch_worker_thread2 + 92
15  libsystem_pthread.dylib         0x00007fff6783d9f7 _pthread_wqthread + 220
16  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 27:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 28 Crashed:: Dispatch queue: Diff queue for DVTDiffContext <0x7fe80b26e9a0>
0   com.apple.CoreFoundation        0x00007fff2d5cddcb __CFStrConvertBytesToUnicode + 23
1   com.apple.CoreFoundation        0x00007fff2d5d4633 _CFStringCheckAndGetCharacters + 128
2   com.apple.CoreFoundation        0x00007fff2d5d4594 -[__NSCFString getCharacters:range:] + 30
3   com.apple.dt.DVTFoundation      0x00000001027d05df __FNVHash_block_invoke + 229
4   com.apple.dt.DVTFoundation      0x00000001027d04bb FNVHash + 364
5   com.apple.dt.DVTFoundation      0x00000001027d001b -[DVTDiffContextOperation _buildDiffDescriptors] + 958
6   com.apple.dt.DVTFoundation      0x00000001027cf88e -[DVTDiffContextOperation main] + 734
7   com.apple.Foundation            0x00007fff2fcb9981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
8   com.apple.Foundation            0x00007fff2fcb8bb3 -[NSOperation start] + 722
9   com.apple.Foundation            0x00007fff2fcb88d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
10  com.apple.Foundation            0x00007fff2fcb87a9 __NSOQSchedule_f + 182
11  libdispatch.dylib               0x00007fff675e26c4 _dispatch_call_block_and_release + 12
12  libdispatch.dylib               0x00007fff675e3658 _dispatch_client_callout + 8
13  libdispatch.dylib               0x00007fff675e8c44 _dispatch_lane_serial_drain + 597
14  libdispatch.dylib               0x00007fff675e95d6 _dispatch_lane_invoke + 363
15  libdispatch.dylib               0x00007fff675f2c09 _dispatch_workloop_worker_thread + 596
16  libsystem_pthread.dylib         0x00007fff6783da3d _pthread_wqthread + 290
17  libsystem_pthread.dylib         0x00007fff6783cb77 start_wqthread + 15

Thread 29:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 30:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 31:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 32:
0   libsystem_pthread.dylib         0x00007fff6783cb68 start_wqthread + 0

Thread 28 crashed with X86 Thread State (64-bit):
  rax: 0x00000000000132b0  rbx: 0x00007fe815500000  rcx: 0x0000000000000066  rdx: 0x0000000000117d76
  rdi: 0x00007fe815500018  rsi: 0x00007000033d9aa0  rbp: 0x00007000033d9a70  rsp: 0x00007000033d9a68
   r8: 0x00007fff84fc23a0   r9: 0x0000000000117d76  r10: 0x0000000000117d76  r11: 0x00007fff2d5d4576
  r12: 0x00007fe815500000  r13: 0x0000000000117d76  r14: 0x00007fff7194908d  r15: 0x00007fe80d2859b0
  rip: 0x00007fff2d5cddcb  rfl: 0x0000000000010206  cr2: 0x0000700003400000

Logical CPU:     6
Error Code:      0x00000006 (no mapping for user data write)
Trap Number:     14

Binary Images:
       0x102666000 -        0x102668fff  com.apple.dt.Xcode (11.2.1 - 15526.1) <615B5CCD-2B93-3F76-826B-8205D032D0E1> /Applications/Xcode.app/Contents/MacOS/Xcode
       0x102671000 -        0x102699fff  com.apple.dt.DVTCocoaAdditionsKit (11.2.1 - 15513) <DBA5A0F1-54DE-3CC0-89EA-4E33075A0253> /Applications/Xcode.app/Contents/SharedFrameworks/DVTCocoaAdditionsKit.framework/Versions/A/DVTCocoaAdditionsKit
       0x1026c1000 -        0x102cc0ff7  com.apple.dt.DVTFoundation (11.2.1 - 15513) <E922EEB1-FDC0-3233-93DF-195446D2DAD4> /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
       0x102f78000 -        0x10311ffff  com.apple.dt.DVTKit (11.2.1 - 15513) <A0941A35-13EC-32B0-8A09-4696E758480D> /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/DVTKit
       0x10324b000 -        0x103b2ffff  com.apple.dt.IDEFoundation (11.2.1 - 15526.1) <42FBCB43-0A9E-3012-9270-6D42F08BCD14> /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation
       0x10422f000 -        0x104be3fff  com.apple.dt.IDEKit (11.2.1 - 15526.1) <D2BA1164-38BD-3373-8A09-17DDB8157E01> /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/IDEKit
       0x10537e000 -        0x1053bdff3  com.apple.DebugSymbols (194 - 194) <9B2838A7-E292-3008-B7B0-4A4CCBA423F6> /Applications/Xcode.app/Contents/SharedFrameworks/DebugSymbolsDT.framework/Versions/A/DebugSymbolsDT
       0x1053df000 -        0x105465ffb  com.apple.CoreSymbolicationDT (11.2.1 - 64531.4) <340FC7F4-7582-38D1-BB9E-D05B0BE241C3> /Applications/Xcode.app/Contents/SharedFrameworks/CoreSymbolicationDT.framework/Versions/A/CoreSymbolicationDT
       0x1054b9000 -        0x1054b9ff7  com.apple.contentdelivery.ContentDeliveryServices (4.00 - 1181) <1C5E9577-E8B8-30FB-92DE-BB90F77EF40A> /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/ContentDeliveryServices
       0x1054c0000 -        0x1054e7ff3  com.apple.dt.instruments.DTXConnectionServices (11.2.1 - 64531.2) <56DECC43-6C08-3086-86CA-982830D32A5D> /Applications/Xcode.app/Contents/SharedFrameworks/DTXConnectionServices.framework/Versions/A/DTXConnectionServices

I tried to google and found this question https://stackoverflow.com/questions/34451126/xcode-crashes-on-launch
and tried to delete DerivedData folder but this hasn't resolved the problem and it keeps crashing. I don't have admin credentials on my machine, so I'm severely limited in what I can change.
Do I have to reinstall XCode or is there any other solution or workaround?

A: I would make a new user account on the Mac first. Log out of your current user, and then log in to the new user account.

*

*If Xcode crashes in the new account, you will know it's not any data or user settings and focus on reinstalling the OS / rebooting the OS / reinstalling the app.

If Xcode does not crash on the new account, now you know how much time to spend triaging it. If you can move all your data and settings to the new account in 30 minutes - spend that time researching this and then move accounts.
Now, since this is a managed account you are forced to get help from an administrator or read the exact crash and hope it helps you determine why the app is crashing. In this case, you can watch the stack trace on each thread - especially the one that crashes and watch carefully what you do leading up to the crash.
Thread 28 Crashed:: Dispatch queue: Diff queue for DVTDiffContext <0x7fe80b26e9a0>
0   com.apple.CoreFoundation        0x00007fff2d5cddcb __CFStrConvertBytesToUnicode + 23
1   com.apple.CoreFoundation        0x00007fff2d5d4633 _CFStringCheckAndGetCharacters + 128

Xcode is converting bytes to Unicode, so perhaps this is a class name or something being rendered?


text: Q: google tag manager x google search console vs next.js I'm in a pickle and not too sure what I'm doing. I'm still working on a client's site. its searchable on google and I'm getting information about clicks on google search console but I'm struggling with Google tag manager and Google analytics. I tried installing the tag manager code snippet  I  think the issus is that I#m running a next.js project and the code snippet is inside the next/ head componant has anyone else seen this before? tia x

redpajama_set_name: RedPajamaStackExchange


text:
Q: Multiple if statements or else-if statement Is any difference in writing multiple if statements than only one and then adding else-if ones?
Like here:
        Console.WriteLine("Guess the number from 1/5");
        int number = int.Parse(Console.ReadLine());
        if (number == 1)
        {
            Console.WriteLine("You guessed wrong");
        }
        if (number == 2)
        {
            Console.WriteLine("You guessed wrong");
        }
        /* else if (number == 2)
        {
            Console.WriteLine("You guessed wrong");
        }
         * .......up to number 5
         */
        if (number == 3)
        {
            Console.WriteLine("You guessed wrong");
        }
        if (number == 4)
        {
            Console.WriteLine("You guessed wrong");
        }
        if (number == 5)
        {
            Console.WriteLine("You're right!");
        }
        Console.ReadKey();

I know that there is much better way of writing this but the difference is the only thing what matters here for me. It might has an impact on performance...

A: When you use multiple if, you are going to check them one by one. If you use if,else if when you enter in one of them no more checks will be made. In your case it will be better to use else if, because number can only have one of this values.
            Console.WriteLine("Guess the number from 1/5");
            int number = int.Parse(Console.ReadLine());
            if (number == 1)
            {
                Console.WriteLine("You guessed wrong");
            }
            else if (number == 2)
            {
                Console.WriteLine("You guessed wrong");
            }
            else if (number == 3)
            {
                Console.WriteLine("You guessed wrong");
            }
            else if (number == 4)
            {
                Console.WriteLine("You guessed wrong");
            }
            else if (number == 5)
            {
                Console.WriteLine("You're right!");
            }
            else
            {
                Console.WriteLine("Wrong guess");
            }
            Console.ReadKey();

`With else if you will have better performance ! Also you can check this things with debug ! You should learn to use it !

A: Generally to avoid using a huge if-else statement is to use a switch clause
switch(number)
{
    case 1:
        // this part will run if number is 1
        break; // break is required after cases

    case 2:
        // this part will run if number is 2
        break;

    case 3:
    case 4:
        // you can also join cases together
        // this part will run if number is either 3 or 4
        break;

    default:
        // the default case runs when no case was matched
        break;
}

In your case, using a switch can simplify your code to this
switch (number)
{
    default:
        Console.WriteLine("You guessed wrong");
        break;

    case 5:
        Console.WriteLine("You're right!");
        break;
}

A: In this scenario, you can just do the following:
  Console.WriteLine("Guess the number from 1/5");
  int number = int.Parse(Console.ReadLine());
  var result = number == 5  ? "You're right!" : "You guessed wrong";

  Console.WriteLine(result );

  Console.ReadKey();


text:
Q: Nodejs Lambda Streaming Response If I want to stream file to lambda output (writing client response to http for example,) how is that done? An example I thought of:
// lambda nodejs handler.ts
import { createReadStream, createWriteStream } from 'fs';

export const index = async (event: any, context: any, callback: any) => {
  const rs = createReadStream('./file.json');
  const ws = createWriteStream('some-lambda-output???');

  rs.pipe(ws).on('error', callback);
};


text:
Q: Spring Boot Test - Reduce Console Output We are acutally using Spring Boot 1.5.8 and as I can see, we haven't specified a specific logging framework. I'm responsible for JUnit tests as junior developer. We have about 17'000 Unit tests. When I run a lot of tests, IntelliJ can't or has performance issues with handling the console output. And I gave IntelliJ a lot of power ...
Now I adjusted the Log.LEVEL in application.yml to WARN, which works fine. But then I tried to get rid of the HTTP response & request output in the console. But even when I turn off the logging with
logging:
  level:
    root: WARN

in application.yml it still shows HTTP requests & responses like this:

this is filling up the console depending on the request with hundreds or thousand lines of in some cases unnecessary code!
I'm looking for an option to turn this off ... please help me. I was searching for a while, but couldn't find a answer. Probably I'm on a completely wrong road with looking after Spring Boot Logging. Thank you =)

Edit:
 As an other example:
I get an error an the following console output. I just need the first lines of the start and the red (+ some additional) lines. As you can see on the scrollbar, this is just a small piece of the complete output! Acutally 7033 lines (!) are filled with HTTP request & responses like the one in the first picture.

A: Eek! You used:
logging:
level:
root: WARN

which  is yaml format! (it would work just fine if you renamed your file application.yml)
I believe you need to express it like this:
logging.level.root=WARN

which is the correct way to express it in an application.properties file.

A: By chance I found the solution. I had to set print = MockMvcPrint.NONE in the @AutoConfigureMockMvc annotation. It seems like this collected the HTTP request & respones for each failed test and print everything whenever a test fails! This led to an tremendous output after some failures!


text:
Q: Simple variable assignment from two-dimensional array in php I have a two-dimensional array with two key values, [program] and [balance], created by a MySQL SELECT statement in WordPress. I know what the values of [program] will be (they never change) - it's the balances I'm interested in.
For example:
*[program] = 'Sales', [balance] = 10,000*

*[program] = 'Commission', [balance] = 1,250*

All I want to do is assign the balance value to a variable, so I will have:
*$sales = (the balance for the Sales program)*

*$commission = (the balance for the Commission program)*

I know I'm being thick here, but I cannot see how to do this after about an hour of searching and screwing around with php. It's a total brain block and all the references I can find online talk about loops and echoing all the values and stuff.
Would appreciate a de-blocking!

A: //make a function
function findBalanceByProgram($inputArray,$program)
 //loop trough all the keys on the first dimension
 foreach($inputArray as $val){
    //check in the second dimension if your program is the same as the program you are checking for
    if($val['program']==$program)
      //if so.. return the value and jump out of the function
      return $val['balance'];
  }
}

//an example of use.
echo findBalanceByProgram($yourArray,'sales');


text:
Q: PostgreSQL & JDBC set array of ints using `setArray` throw an exception "cannot cast type integer[] to integer" How do I set an array of integers in JDBC (prepared statement with setArray for an in clause?
String query = "SELECT * FROM table WHERE id IN (?)";
// other things.
// ArrayList<Integer> some_ids;
preparedStatement.setArray(1, conn.createArrayOf("INTEGER", some_ids.toArray()));

It compiles, but executing returns this from Postgres.
ERROR: cannot cast type integer[] to integer

A: In PostgreSQL You have to use = ANY(?) instead of IN (?)
"SELECT * FROM table WHERE id = ANY(?)";

Take a look at this : 9.21.3. ANY/SOME (array)


text:
Q: Sending mail from incrond I would like to monitor my /etc folder (ubuntu 12.04 lts) for changes with incrond and I would like send the result in e-mail with the following command:
/etc IN_ATTRIB,IN_CREATE,IN_DELETE,IN_MODIFY,IN_MOVED_FROM,IN_MOVED_TO /usr/bin/mail -s "ALERT:in etc: $@/$#" user@domain.com < /dev/null

But the e-mail doesnt come...
What is the matter?
Thanks for yor help.

A: I had similar troubles when I first tried using incron. The trick is that when the documentation says use command "abc $@/$#" it means exactly that. You will need to create a small shell script that takes the returned value from incrond and sends the appropriate mail message.
So the incrontab entry should look like this:
/etc IN_ATTRIB,IN_CREATE,IN_DELETE,IN_MODIFY,IN_MOVED_FROM,IN_MOVED_TO /usr/local/bin/mail_command.sh $@/$#

with mail_command.sh taking the given argument and processing as appropriate.
Matthew


text:
Q: how to introduce n timepoints for epoch for date java How to introduce n timepoints for epoch for date java ?
Suppose I have finite epoch τ = {t0, t1, . . . , tn } of n timepoints for Stream data.
I want to introduce it for Stream data using a (sliding window).
Please Guide?

A: My suggestion would be to use an IntStream to provide you a Stream of ints that allow you to represent τ:
final int n = 7;
IntStream.range(0, n).forEachOrdered(i -> {
    System.out.println("t" + i);
});


text:
Q: Pausing AvAudioPlayer from another view controller returns EXC_BAD_ACCESS Swift I've a page-based application where the root view controller has a button which is suposed to pause an AVAudioPlayer in the data view Controller.
I take for granted that you know how the root and data view controller work. Mine looks like this.
When I'm pressing the button I get an EXC_BAD_ACCESS. But when I'm pausing from a button I have on data view controller it's working fine without the crash. I've tried:
• To add the pause code in a function and call the function
var dataView = self.storyboard?.instantiateViewControllerWithIdentifier("DataViewController") as! DataViewController
dataView.pause()

dataViewController
func pause() {
    player.pause()
}

• Calling a function in dataView that calls a function that pauses the player
• Tried to call with
dataViewController().player.pause()

• Tried to call player.prepareForPlay() before player.pause
And all of them gives me the same error. Can it be because rootViewController doesn't have permission to edit player in dataViewController?

A: This code:
dataViewController().player.pause()

Creates a new instance of DataViewController. That new instance doesn't have a sound player. Don't do that. You need a way to get a pointer to your existing instance of dataViewController.
By the way, you should follow the Swift naming convention of naming classes and types starting with an upper-case letter. Thus the class name should be DataViewController.


text:
Q: how to use different authentication for different functions in a Django rest framework ViewSet how to use different authentication for different functions in a Django rest framework ViewSet?
I have created a UserViewSet, which has 2 functions:
1. list (list all users registered, permission_classes should be IsAuthenticated)
2. register(register a new user, permission_classes should be AllowAny).
--------------------views.py-----------------------------------

class UserViewSet(ViewSet):
    @list_route(methods=['get'], permission_classes = [IsAuthenticated, ])
    def list(self, request):
        ...
        ...

    @list_route(methods=['post'], permission_classes = [AllowAny, ])
    def register(self, request):
        ...
        ...

--------------------urls.py-----------------------------------

users_list = views.UserViewSet.as_view({
    'get': 'list',
    'post': 'register'
})

urlpatterns = [
    url(r'^$', users_list, name='users-list'),
    ...
    ...
]

--------------------settings.py---------------------------------

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
    'rest_framework.authentication.TokenAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    )
}
...
...

command line to register a user:
curl -H "Content-Type: application/json" -X POST -d '{ "email":"user@example.com"}' http://192.168.30.45:8000/users/

Response:
{"detail":"Authentication credentials were not provided."}

the "permission_class" of my "register" function is set to "AllowAny", still needs Authentication? why does this happen?

A: Your code seems to work, I don't really know what's the problem, but you could try writing a customized permission:
class IsAuthenticatedOrCreate(permissions.IsAuthenticated):
    def has_permission(self, request, view):
        if request.method == 'POST':
            return True
        return super(IsAuthenticatedOrCreate, self).\
            has_permission(request, view)


text:
Q: Associate a color palette with ggplot2 theme I want my ggplot2 theme to use a specific set of colors, but don't see how to avoid a separate line outside of the theme.
I have this data:
library(ggplot2)
mycars <- mtcars
mycars$cyl <- as.factor(mycars$cyl)

And here's a dummy theme I plot with:
mytheme <- theme(panel.grid.major = element_line(size = 2))

ggplot(mycars, aes(x = wt, y = mpg)) +
  geom_point(aes(color = cyl)) +
  mytheme

I want the point colors to default to my custom palette:
mycolors <- c("deeppink", "chartreuse", "midnightblue")

Can I somehow add that to my ggplot2 theme so that I don't constantly repeat this extra line of code at the end:
ggplot(mycars, aes(x = wt, y = mpg)) +
  geom_point(aes(color = cyl)) +
  mytheme +
  scale_color_manual(values = mycolors)

I tried:
mytheme2 <- mytheme + scale_color_manual(values = mycolors)

But got:

Error: Don't know how to add scale_color_manual(values = mycolors) to
  a theme object

A: Hi you can put your custom element in a list :
# Data
library("ggplot2")
mycars <- mtcars
mycars$cyl <- as.factor(mycars$cyl)

# Custom theme
mytheme <- theme(panel.grid.major = element_line(size = 2))
mycolors <- c("deeppink", "chartreuse", "midnightblue")
# put the elements in a list
mytheme2 <- list(mytheme, scale_color_manual(values = mycolors))

# plot
ggplot(mycars, aes(x = wt, y = mpg)) +
  geom_point(aes(color = cyl)) +
  mytheme2

A: I sometimes use this little trick to change colour palettes between plots,
library(ggplot2)
mycars <- mtcars
mycars$cyl <- as.factor(mycars$cyl)

scale_colour_discrete <- function(...) scale_colour_manual(values=palette())

(p <- ggplot(mycars, aes(x = wt, y = mpg)) +
  geom_point(aes(color = cyl)) )

palette(c("deeppink", "chartreuse", "midnightblue"))
p

palette(RColorBrewer::brewer.pal(5, "Set1"))
p


text:
Q: Compute math expression given in xml string using java Assumption is that

*

*when we see start element if number push it in number stack

*if we see start element of function/add/multiply push it in the operator stack

*when we see end element of function/add/multiply we pop one operator and required values from number stack

*we do the math operation and push back to number stack the result

The problem is not able to think of add with three multiply
XML String:
<function value="largest">
   <multiply>
      <numbr value="2" />
      <numbr value="3" />
   </multiply>
   <add>
      <multiply>
         <numbr value="5" />
         <numbr value="6" />
      </multiply>
      <multiply>
         <numbr value="7" />
         <numbr value="8" />
      </multiply>
       <multiply>
         <numbr value="7" />
         <numbr value="7" />
         <numbr value="7" />
      </multiply>
   </add>
</function>

Some rough Java Code :
    Stack<Value> value = new Stack<>();
    Stack<Operator> operator = new Stack<>();
    XMLInputFactory factory = XMLInputFactory.newInstance();
    InputStream stream = new ByteArrayInputStream(xml.getBytes());
    XMLStreamReader reader = factory.createXMLStreamReader(stream);
 while (reader.hasNext()) {
      int event = reader.next();
      switch (event) {
        case XMLStreamConstants.START_ELEMENT:
          String attributeValue = reader.getAttributeValue(null, "value");
          break;
        case XMLStreamConstants.END_ELEMENT:
          String localName = reader.getLocalName();
          break;
      }

 reference link

A: After giving my time on this problem, I found out that it has a recursive solution as the given XML has to arrange the data in the form of n-ary tree.
Here's what pseudo code looks like:
public class RecursiveProgram{
    /*the recfn is the recursive function to make new call on every new operator tag Example : "add", "multiply"*/
    public static int recfn(String currentOperator){
        int total;
        /*We will use list to store multiple values on which only one operator will perform operations.*/
        ArrayList<Integer> numberlist= new ArrayList<>();
        /* now we will continue traversing elements. Assume currentOperator as current xml tag*/
        while(nexttag() != currentOperator.end){
            String tag= nexttag();
            if(tag != value){
                /*if tag is operator then make a new call and store its result in numberlist of current operator */
                numberlist.add(recfn(tag));
            }else{
                numberlist.add(tag.value);
            }
        }
        /*Once we found the end of the current operator then perform operation on all elements of numberlist.*/
        if(currentOperator == "add"){
            total=0;
            for(Integer i : numberlist){
                total+=i;
            }
            return total;
        }else{
            total=1;
            for(Integer i : numberlist){
                total*=i;
            }
            return total;
        }
    }
    public static void main(String[] args){
        int total;
        String operator;
        total=recfn(operator); //suould pass start operator

    }
}

This answer has lot of analogies pointing to reading tags/values. So it won't compile and run. You have to digest the algorithmic idea and implement it yourself accordingly. Also, I recommend to verify the algorithm with the above sample XML code. If it satisfies, give it a shot.


text:
Q: How do I use the list name as part of column name using tidyr? I have a nested JSON file that is a pretty simply structure.  The list name is flavor, and then there is a nested df one level below.  One of the columns is nested further.  How can I use the name of the list "flavors" as a prefix to the column names when I unnest?  I would be looking for column names like flavor.id,  flavor.name, etc.
I don't have a great reprex example, but I'd be looking to use some form of tidyr or purrr.  I tried to use purrr::flatten() to no avail.
Sample Reprex
sample <- list(
  flavor = structure(list(nested_col = list(structure(list(column = 0L,id = "B30D41F4-5684-11E1-8E9A-8F09EE5110CB"), class = "data.frame", row.names = 1L),
                                       structure(list(id = "B30B5B28-5684-11E1-8E9A-8F09EE5110CB", column = 0L), class = "data.frame", row.names = 1L)),
                         short_name = c("Bi", "Br"), abbr = c("RR", "CHOC"), long_abbr = c("BXB","BK"), id = c("13", "11"), name = c("Rock n Road","Chocolate")), class = "data.frame", row.names = c(NA,2L)))

I would be looking to extract the list into a tbl_df.  The corresponding columns would look something like flavor_nested_col, flavor_short_name, etc.


text:
Q: TextInputLayout cannot add style Hi I tried to used TextInputLayout for my apps, at first it's worked but the problem came while I put 'style:' attribute and my app stopped working.
Here my code, I follow from AndroidDeveloper code and tried to put style
    <com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Test"
    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
    app:layout_constraintBottom_toBottomOf="parent">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</com.google.android.material.textfield.TextInputLayout>


text:
Q: Python Encryption - How do I get same encrypted value if I encrypt the same message I have been using a python library Fernet and using it to encrypt the emails. My problem is if I encrypt the same email again it gives a different token.
Is there a way, or alternate library which would give me the same output if the input(email in my case) remains the same?
I can't use hashing because we need to decrypt emails later.
this is what I am doing currently. We need to get the same token twice because before inserting a new email into the system I need to check its uniqueness. Alternate would be to decrypt all emails first which doesn't looks like ideal.
f = Fernet(key)
token = f.encrypt(b"xyz@asdfljlsdafjsdalkfj.com")
token

A: For the specified usage (storing the ciphertext within a secured server space, the ciphertext never leaves the server in encrypted form) the usage of AES in mode ECB could be an option (thanks to @Artjom B.).
As the ECB mode does not have any random element (except the key) you get the same [plaintext - key - ciphertext] combination for each run - you can test the encryption with my live example code: https://repl.it/@javacrypto/SoPythonAesEcb256StringEncryption.
This is the output:
AES ECB 256 String encryption with fixed key
plaintext: The quick brown fox jumps over the lazy dog
encryptionKey (Base64): UFmBQEE4MpP4m9btYFlUmEqRE3g5wa2Yfa2T28uB+OU=

* * * Encryption * * *
ciphertext: fp6Qqo3zzznH7Hs9c0q4Q+GDRjzhUcatkl/vbTMim2e/5HUQgZLUmsg7uMcNmQhZ

* * * Decryption * * *
plaintext:  The quick brown fox jumps over the lazy dog

To run the code you need to use the external library Pycryptodome, available here: https://pypi.org/project/pycryptodome/ and the documentation here: https://www.pycryptodome.org/en/latest/src/cipher/aes.html
Security warning The following code uses the AES algorithm in mode ECB that is UNSECURE in most cases!
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from Crypto.Util.Padding import unpad
import base64

def base64Encoding(input):
  dataBase64 = base64.b64encode(input)
  dataBase64P = dataBase64.decode("UTF-8")
  return dataBase64P

def base64Decoding(input):
    return base64.decodebytes(input.encode("ascii"))

def aesEcbEncryptToBase64(encryptionKey, plaintext):
  cipher = AES.new(encryptionKey, AES.MODE_ECB)
  ciphertext = cipher.encrypt(pad(plaintext.encode("ascii"), AES.block_size))
  return base64Encoding(ciphertext)

def aesEcbDecryptFromBase64(decryptionKey, ciphertextDecryptionBase64):
  ciphertext = base64Decoding(ciphertextDecryptionBase64)
  cipher = AES.new(decryptionKey, AES.MODE_ECB)
  decryptedtext = unpad(cipher.decrypt(ciphertext), AES.block_size)
  decryptedtextP = decryptedtext.decode("UTF-8")
  return decryptedtextP

print("AES ECB 256 String encryption with fixed key")

plaintext = "The quick brown fox jumps over the lazy dog"
print("plaintext: " + plaintext)

encryptionKeyBase64 = "UFmBQEE4MpP4m9btYFlUmEqRE3g5wa2Yfa2T28uB+OU="
encryptionKey = base64Decoding(encryptionKeyBase64)
print("encryptionKey (Base64): " + encryptionKeyBase64)

print("\n* * * Encryption * * *")
ciphertextBase64 = aesEcbEncryptToBase64(encryptionKey, plaintext)
print("ciphertext: " + ciphertextBase64)

print("\n* * * Decryption * * *")
decryptedtext = aesEcbDecryptFromBase64(encryptionKey, ciphertextBase64)
print("plaintext:  " + decryptedtext)


text:
Q: How to intercept Promises response in then or catch? I am trying to intercept the response from all Promises then method. But i am not able to get the response data in the prototype then method. please find below code.
(function(Promise) {
   var originalThen = Promise.prototype.then;
   var originalCatch = Promise.prototype.catch;
   Promise.prototype.then = function() {
      console.log(this, arguments);
      return originalThen.apply(this, arguments);
   };
   Promise.prototype.catch = function() {
      return originalCatch.apply(this, arguments);
   };
})(this.Promise)

In the above code I can see the console printed in all Promise call. But i cannot get the response object in the then.
The Printed 'this' object value in console:

The printed arguments inside the 'then' prototype method:

Please suggest me to get the response object in then method for all promises method.
I tried to get the value using "arguments[0].arguments" (Response object in the then callback).But its throwing the below error

Uncaught TypeError: 'caller' and 'arguments' are restricted function
  properties and cannot be accessed in this context.

Please suggest me the solution to intercept the response object.
Thanks in advance.

A: then is a synchronous method that registers success and failure callbacks. It returns immediately.
To intercept a future value, insert yourself in place of the success callback:

(function(Promise) {
   var originalThen = Promise.prototype.then;
   Promise.prototype.then = function(onFulfilled, onFailure) {
      return originalThen.call(this, function(value) {
        console.log(value);
        return onFulfilled(value);
      }, onFailure);
   };
})(this.Promise);

Promise.resolve(3).then(() => console.log("Done"));

A: then() is called when consuming a promise to add a callback, before the promise actually has a value.
Its arguments are the success and error callbacks.
To see the promise's value, you need to actually call then() and pass a callback to see its eventual value.  (or wrap the callbacks you were passed and pass your wrappers to the real then())


text:
Q: Detecting if facebook app is installed on idevice I Want to add a function to my game so that the user can share his highscore with his friends on facebook.
Now to do that, I first want to know if the facebook app is installed on his device, if not, he wil not see the function to share his highscore on facebook.
I AM using swift so I added the facebookSDK with a bridge-header.h file.
This is the code given by an example of facebook:
FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
params.link = [NSURL URLWithString:@"https://example.com/book/Snow-Crash.html"];
BOOL canShare = [FBDialogs canPresentShareDialogWithParams:params];
if (canShare) {
 // FBDialogs call to open Share dialog
}

Now this is in Objective-C, I tried to convert this to Swift and now this is my code:
    let params = FBShareDialogParams()
    params.link = NSURL(URLWithString:"https://example.com/book/Snow-Crash.html")
    let canShare:Bool = (FBDialogs.canPresentShareDialogWithParams(params))
    if (canShare) {
        // FBDialogs call to open Share dialog
    }

But now I get the error: FBShareDialogParams is unavailable
Bridge header looks like:
#ifndef FrogCross2_Bridge_Header_h
#define FrogCross2_Bridge_Header_h

#import <FacebookSDK/FacebookSDK.h>

#endif

What am I doing wrong?

A: This is kind of a work around, there may be a better way to do it, but you can make an attempt to open a Facebook url using the Facebook url scheme like so:
func facebookInstalled() -> Bool {
    if UIApplication.sharedApplication().canOpenURL(NSURL(string: "fb://")!) {
        return true
    }
    return false
}

I tried this on the simulator and it evaluated at false, but when I tried it on my device, it evaluated as true.


text:
Q: Correct way to push in string[] react+typescript What is the correct way to push elements in string[] in react?
I'm getting  Type '(string | string[])[]' is not assignable to type 'string[]'
This is a playground link : Here
Am I not initializing the string correctly?

A: You appear to be missing a square bracket in your example code:
| null>(['')

Should be
| null>([''])

Change line 8 so you're also spreading the second array, and it fixes your problem:
setArr((prev: string[])=> [...prev, ...tempArr])


text:
Q: request formData to API, gets "Network Error" in axios while uploading image I am making a POST request to  server to upload an image and sending formdata using axios in react-native.  i am getting "Network Error". i also try fetch but nothing work.using react native image picker libeary for select image.in postman api working fine
        formData.append('title', Title);
        formData.append('class_id', selectClass._id)
        formData.append('subject_id', checkSelected)
        formData.append('teacher_id', userId)
        formData.append('description', lecture);
        formData.append('type', 'image');

       var arr=[];
       arr.push(imageSource)
       arr.map((file,index)=>{
       formData.append('file',{
       uri:file.path,
       type:file.type,
       name:file.name
       })
       })

       axios({
       method: 'post',
       url: URL + 'admin/assignment/create',
       data: data,
       headers: {
       "content-type": "multipart/form-data",
       'x-auth-token': token,
        },
       })
     .then(function (response) {
    //handle success
    console.log('axios assigment post',response);
      })
   .catch(function (response) {
     //handle error
      console.log('axios assigment post',response);
    });

A: REACT NATIVE SOLUTION
If you are using Axios or Fetch in React Native and you got Network Error when uploading the file or data.
Try to commenting below line from the /android/app/src/main/java/com/{your_project}/MainApplication.java
its located around the 40-50 line
initializeFlipper(this, getReactNativeHost().getReactInstanceManager())

https://github.com/facebook/react-native/issues/28551

A: I faced the same issue. The following steps worked for me.

*

*update FLIPPER_VERSION=0.52.0 latest

*for formData code as below:

let formData = new FormData();
let file = {
          uri: brand.uri,
          type: 'multipart/form-data',
          name: brand.uri
};
formdata.append('logo', file);

The type must be 'multipart/form-data' as the post header.

A: "react-native": "0.62.1",
"react": "16.11.0",
"axios": "^0.19.2",
weird solution i have to delete debug folder
in android ->app->source->debug
and restart the app again
its solve my problem. i think it's cache problem.

A: I had this problem and solve it via commenting the 43 line in
android/src/debug/.../.../ReactNativeFlipper.java
// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));

could you test it?

A: The issue that I was facing which is close to what you are mentioning is that I was getting NetworkError when using image-picker and trying to upload the file using axios. It was working perfectly in iOS but not working in android.
This is how I solved the issue.
There are two independent issues at action here. Let's say we get imageUri from image-picker, then we would use these following lines of code to upload from the frontend.
const formData = new FormData();
formData.append('image', {
 uri : imageUri,
 type: "image",
 name: imageUri.split("/").pop()
});

The first issue is with the imageUri itself. If let's say photo path is /user/.../path/to/file.jpg. Then file picker in android would give imageUri value as file:/user/.../path/to/file.jpg whereas file picker in iOS would give imageUri value as file:///user/.../path/to/file.jpg.
The solution for the first issue is to use file:// instead of file: in the formData in android.
The second issue is that we are not using proper mime-type. It is working fine on iOS but not on Android. What makes this worse is that the file-picker package gives the type of the file as "image" and it does not give proper mime-type.
The solution is to use proper mime-type in the formData in the field type. Ex: mime-type for .jpg file would be image/jpeg and for .png file would be image/png. We do not have to do this manually. Instead, you can use a very famous npm package called mime.
The final working solution is:
import mime from "mime";

const newImageUri =  "file:///" + imageUri.split("file:/").join("");

const formData = new FormData();
formData.append('image', {
 uri : newImageUri,
 type: mime.getType(newImageUri),
 name: newImageUri.split("/").pop()
});

I hope this helps to solve your problem :)

A: Project keeps flipper java file under app > source > debug in react native > 0.62. There is an issue with Flipper Network that causes the problem in your case. If you remove the debug folder, you will not be able to debug Android with Flipper, so the best solution is upgrading Flipper version in android > gradle.properties to 0.46.0 that fixes the problem.
You can change it with this line
FLIPPER_VERSION=0.46.0
react-nativeandroid

A: in my case, the solution was to change to

const headers = {
    accept: 'application/json',
    'content-type': 'multipart/form-data',
};

A: change this line: form_data.append('file', data);
To form_data.append('file', JSON.stringify(data));
from https://github.com/react-native-image-picker/react-native-image-picker/issues/798
You need to add this uesCleartextTraffic="true" to the AndroidManifest.xml file found inside the dir android/app/src/main/AndroidManifest.xml
<application ... android:usesCleartextTraffic="true"> Then, Because of issue with Flipper Network.
I commented initializeFlipper(this, getReactNativeHost().getReactInstanceManager())
in this file /android/app/src/main/java/com/{your_project}/MainApplication.java
Also, commenting out line number 43 in this file android/app/src/debug/java/com/**/ReactNativeFlipper.java
line43: builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));

A: If using expo and expo-image-picker, then the problem is only with the image type and nothing else.
In the latest updates, they removed the bug related to path (as other answers mention to change the beginning of the path which was correct for the older versions).
Now to remove the problem, we need to change the type only and is mentioned by other answers to use mime which works fine;
 import mime from 'mime'

const data = new FormData();
data.append('image', {
     uri: image.uri,
     name: image.uri.split('/').pop() // getting the text after the last slash which is the name of the image
    type: mime.getType(image.uri) // image.type returns 'image' but mime.getType(image.uri) returns 'image/jpeg' or whatever is the type

})

A: In my case, after debbuging for a while, the issue was in nginx.
The image was "too big".
I Had to add annotations to the Kubernetes ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 20m
....

It was a bit tricky to debug since the request never got through the load balancer (nginx) to the Api service.
The "Network error" message didn't help a lot either.

A: I am using Expo SDK 42 (react-native v0.63). And I was using the expo-document-picker library to pick the documents & upload to server.
This is the code I am using to open the picker & get the metadata about the file.
const result = await DocumentPicker.getDocumentAsync({
    type: 'image/*',
    copyToCacheDirectory: false,
    multiple: false,
});

if (result.type === 'success') {
    const name_split = result.name.split('.');
    const ext = name_split[name_split.length - 1];
    // result.uri = 'file://' + result.uri;
    result.type = helper.get_mime_type(ext);
    delete result.size;
}

(You can write your function to get the mime type from the file extension or use some library from npm)
And this is the code I am using to upload the file to server:
const formdata = new FormData();
formdata.append('custom_param', 'value');
formdata.append('file', result); // 'result' is from previous code snippet

const headers = {
    accept: 'application/json',
    'content-type': 'multipart/form-data',
};

const opts = {
    method: 'POST',
    url: 'your backend endpoint',
    headers: headers,
    data: formdata,
};
return await axios.request(axiosopts);

The above code is the working code. I want to explain what I did wrong initially that was causing the Network Error in axios.
I had set copyToCacheDirectory to true initially and the uri I was getting in the result was in the format /data/path/to/file.jpeg. And I also tried appending file:// to beginning of the uri but it didn't work.
I then set copyToCacheDirectory to false and the uri I was getting in the result was in the format content://path/to/file.jpeg. And this didn't cause any Network Error in axios.

A: I have faced this error as well. I found out that I got this error because the file path is wrong and axios couldn't find the file. It is a weird error message when the uri is wrong though but that's what actually has happened. So double checking the uri of the file would fix the issue. Mainly consider file://.

A: I faced the same issue.
After capturing the photo wait for 10sec then start uploading. It worked for me.

A: Also got the same issue. I spent almost 4 days to find reason.
So in my case it was Content-Type: multipart/form-data. I forgot
indicate it. In Android it should be indicated explicitly...

A: After two days of searching for a solution, I found that the problem was in my rn-fetch-blob library, Changed it to in package.json dependencies
"rn-fetch-blob": "^0.12.0",

fix my Netowk issue and app crash on uploading. I am using
react-native-image-crop-picker

A: always send image and file in formdata in post api through axios in react js and react native

Blockquote

A: REACT NATIVE SOLUTION USING AXIOS
I face the same issue after upgrading react native cli project.
I'm using
"react-native": "0.70.6",
"react": "18.1.0",
"axios": "^1.1.3"
AND FLIPPER_VERSION=0.125.0
The below code solves my issue
const imageData = image;
const form = new FormData();
form.append("ProfileImage", {
  type: imageData.mime,
  uri: imageData.path,
  name: imageData.path.split("/").pop(),
});

axios({
  method: "put",
  url: `${URL}/api/UploadPhoto`,
  data: formData,
  headers: {
    "Content-Type": "multipart/form-data",
    "cache-control": "no-cache",
  },
  processData: false,
  contentType: false,
  mimeType: "multipart/form-data",
});

For me, I didn't comment on any line from the /android/app/src/main/java/com/{your_project}/MainApplication.java
initializeFlipper(this, getReactNativeHost().getReactInstanceManager())
Also not changed FLIPPER_VERSION


text:
Q: How to access stdout or stderr in a Capybara integration test I'm trying to debug some Capybara integration tests and running into an unexpected issue.  When I set a breakpoint inside a Capybara test, I can inspect variables, but i can not call puts or $stdout.puts or $stderr.puts.  To understand what I mean look at this output:
(rdb:1) "foo"
"foo"
(rdb:1) puts "foo"
nil

Presumably this is because Capybara captures both stderr and stdout as part of its standard operation in order to keep things quiet with selenium drivers, etc.  I get that, but the problem is that inspecting strings in the ruby debugger escapes newlines, which makes it impossible to read long formatted strings like HTML.
How can I get a reference to the active terminal to output something for debugging purposes using IO#puts?

A: Have you taken a look at the Capybara-cli maybe that will help doing debuging that way.
https://github.com/vspy/capybara-console


text:
Q: Can anyone explain what this command actually do? eval "$(/Users/jsmith/anaconda/bin/conda shell.YOUR_SHELL_NAME hook)" I am trying to create a Docker container with Anaconda and some other stuff.
After installing Anaconda I need to activate it.
When I run
CONDA_PATH=$HOME/anaconda3
eval "$($CONDA_PATH/bin/conda shell.bash hook)"

from my container it works. But when I include it to my Dockerfile as
ENV CONDA_PATH $HOME/anaconda3
RUN eval "$($CONDA_PATH/bin/conda shell.bash hook)"

it does not.
I know that eval executes arguments as a shell command, but I am confused with wrapping "$ ()"
Can anyone explain what it actually do?
My Dockerfile:
FROM ubuntu
MAINTAINER Kosh koshmariel@gmail.com
RUN apt-get update
RUN apt-get install htop
RUN apt-get install nano
WORKDIR /home
COPY Anaconda3-2020.02-Linux-x86_64.sh /home
ENV CONDA_PATH $HOME/anaconda3
RUN bash Anaconda3-2020.02-Linux-x86_64.sh -b -p $CONDA_PATH    #silent Anaconda installation without activation
#RUN eval "$($CONDA_PATH/bin/conda shell.bash hook)"
RUN $CONDA_PATH/bin/conda shell.bash hook
#RUN conda init
#RUN conda install -c conda-forge -y tensorflow
CMD /bin/bash

A: eval "$(shell-command)" will run shell-command and feed its output to the shell as a command to execute.
A hook in this context is a mechanism to attach custom actions to some event processed by a software.
so $CONDA_PATH/bin/conda shell.bash hook will probably generate a bash command line which, when executed, will connect Anaconda into the running bash process, and eval "$($CONDA_PATH/bin/conda shell.bash hook)" will take care of executing that command. Try running $CONDA_PATH/bin/conda shell.bash hook directly from a shell prompt to see what it is producing, in order to better understand what is going on. This may well help you understanding why it isn't working in the Docker context.

A: It execute a bash script in order to activate the conda environment. If you want to create a Docker image with Anaconda installed and conda environment activated, in the Dockerfile you just need to add anaconda path to the PATH environment variable. (It specifies the directories in which executable programs* are located)
RUN /bin/bash ~/Anaconda3-2020.11-Linux-x86_64.sh -b -p
ENV PATH=$CONDA_DIR/bin:$PATH

$CONDA_DIR usually is:
/home/$USER/anaconda3/bin

So, when the container starts, your conda env will be available

A: As bac0n has answered in a comment:

It will eval the result/output from the subcommand.
For example, eval "$(echo echo test)" will output test.

(Reproduced here with modified formatting.)


text:
Q: Simple_form collection disable I want the value to disappear from the list after it is choosed. Why my solution is not working ? My form partial code:
= f.input :value, :collection => ['red', 'blue', 'green'], :disabled => :used_values

A: You can't do this with pure rails stack, you'll need js/jquery.
Write a js/jquery script with following code,
$(document).ready(function () {
   $("#selectBox").change(function(){
    $("#selectBox option[value='selected']").remove();
});


text:
Q: How to Restrict RDP Access in an Azure PaaS Cloud Service I'm trying to implement ACL rules in my .cscfg file to restrict access to my cloud service's RDP endpoints (allow only traffic coming from my VNet's Subnet).
I followed this article by Kevin Williamson How to restrict RDP Access in an azure pass cloud service, but there's a problem with the config according to Visual Studio 2013 (it displays the yellow triangle on the "Roles" folder).
I'm using the Azure SDK 2.6.
I enabled the RDP Extension in Visual Studio 2013 itself, and then proceeded to add the necessary markup in ServiceConfiguration.Cloud.cscfg, but the moment I add the AccessControl and EndpointAcls Visual Studio alerts me to a problem.
I have:
<!-- I added this in the NetworkConfiguration opening tag, but before the VirtualNetworkSite and AddressAssignments -->
<AccessControls>
    <AccessControl name="RdpRestrictions">
        <Rule order="100" action="permit" remoteSubnet="10.1.0.0/24"     description="PermitRdp" />
        <Rule order="200" action="deny" remoteSubnet="0.0.0.0/0" description="DenyRdp" />
    </AccessControl>
</AccessControls>
<EndpointAcls>
    <EndpointAcl role="MyEndpoint" endpoint="Microsoft.WindowsAzure.Plugins.RemoteForwarder.RdpInput" accessControl="RdpRestrictions"/>
</EndpointAcls>

I checked and my cscfg file seems valid according to the NetworkConfiguration Schema Defintiion.
I checked that the role described in EndpointAcl does refer to the WebRole for which the Remote Forwarder Plugins have been imported.
What could possibly be wrong? I can't find any information on the internet as to how one could troubleshoot this issue.

A: Microsoft's Network Configuration Schema seems to be outdated in two regards.

*

*The EndpointAcl's endpoint attribute is supposed to be "endPoint".

*The AccessControls end EndpointAcls tags had to be placed at the end of the NetworkConfiguration section (after all the other elements).


text:
Q: SMS to multiple numbers (iPhone SDK) Is it possible to copy multiple numbers from a table to the clipboard then paste the same to the SMS.app's To-field, like possible using commas after each number?
Thanks in advance!! :)

A: This is not a full answer, but check out UIPasteboard which allows you to manipulate the system clipboard. You might try adding multiple NSURL 'sms:...' "items" to the general pasteboard to see if the sms app interprets them appropriately. Please reply and let me know if it works.
Also check out MFMailComposeViewController. I don't think it will internally support SMS, but you could use it to email multiple SMS numbers using a general SMS gateway, or use a lookup table of cell phone providers by number allocation block to use individual providers' gateways. Advantage of using MFMailComposeViewController is that you don't need to quit your app.
There are some "free text message", "free MMS message" apps on the app store that seem to use the later approach.


text:
Q: В массив передать значения другого массива нужно сделать так, по тригеру в значения массива sentences передавались значения массива из другого скрипта, и запускалась StartCoroutine.
как я только не пробовал значения не передает перед запуском. В чем тут проблема?
public class Dialog : MonoBehaviour
{
    public TextMeshProUGUI textDisplay;
    public GameObject continueButton;
    public GameObject imagePhone;

    public string[] sentences;
    private int index;
    public float typingSpeed;

    private void Update()
    {
        if (textDisplay.text == sentences[index])
        {
            continueButton.SetActive(true);
        }
    }

    public void StartCoroutine1() {
        StartCoroutine(TypeDialog());
        imagePhone.SetActive(true);
    }

    IEnumerator TypeDialog()
    {
        foreach (char letter in sentences[index].ToCharArray())
        {
            textDisplay.text += letter;
            yield return new WaitForSeconds(typingSpeed);
        }
    }
}

//////////////////////////////////////////////////// Здесь тригер
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Levl1_d1 : MonoBehaviour
{
    Dialog dialog;
    BaseDialog baseDialog;

    void Start()
    {
        baseDialog = GameObject.Find("BaseDialog").GetComponent<BaseDialog>();
        dialog = GameObject.Find("DialogManager").GetComponent<Dialog>();
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
         dialog.sentences = baseDialog.levl1_d1;
        dialog.StartCoroutine1();
        Destroy(gameObject);
    }

}

//////////////////////////////////////////////////  это база диалогов
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BaseDialog : MonoBehaviour
{
    [HideInInspector]
    public string[] levl1_d1 = new string[] { "001", "002", "003" };
}

A: Это связано с реализацией в Unity класса MonoBehaviour. Экземпляр этого класса (а соответственно и наследников) создаётся в момент, когда вы вешаете класс на объект.
public class BaseDialog : MonoBehaviour
{
    [HideInInspector]
    public string[] levl1_d1 = new string[] { "001", "002", "003" };
}

Подобный способ инициализации задаёт значение при создании нового экземпляра. Но! Он ничего не изменит в том классе, который был повешен на объект до появления этой строки.
Это связано с тем, что в Unity все public поля инициализируются в момент создания объекта. Любой [SerializableField] или public массив будет инициализирован новым пустым массивом при создании экземпляра класса (навешивании класса на GameObject), а значимые типы будут инициализированы default значениями.
Другими словами, если вы повесили класс на объект раньше, чем добавили код инициализации - массив уже будет инициализирован через new string[0], после чего это будет сохранено, как состояние объекта.
В дальнейшем, после добавления строк - оно будет загружать поверх вашего кода состояние объекта, в котором указано, что массив на самом деле пустой.
Т.е. если вы сейчас на новый объект повесите скрипт с кодом выше - его массив будет правильно инициализирован.

A: решением было инициализировать массив в void Start
[HideInInspector]
    public string[] levl1_d1;

    private void Start()
    {
        levl1_d1 = new string[] {
            "001 ",
            "002",
            "003" };
    }

не знаю с чем связано но так он не инициализировал
public class BaseDialog : MonoBehaviour
{
    [HideInInspector]
    public string[] levl1_d1 = new string[] { "001", "002", "003" };
}


text:
Q: SharePoint 2007 Remote File Access Denied CAS I have code running in an ascx within PageLayout within SharePoint 2007 that accesses files on a remote server i.e. File.Create("\servername\sharename\folder\file.txt").  The code runs within a SharePoint web application that has CAS trust set to Full in the web.config.  The File.Create throws the following exception:-
System.UnauthorizedAccessException
Access to the path '\\servername\sharename\folder\file.txt' is denied.
The share is shared to Everyone with Full Control and the NTFS permissions are set to Everyone with Full Control.  The web application app pool is running under a domain account also with explicit permissions to access that resource (not that this should be needed).
I ran Process Monitor on the remote machine and no hits were being recorded on the server.  This leads me to believe that it is an issue with the SharePoint Code Access Security settings.  Like I've said above, the trust in the web.config is set to Full.
Is it possible that CAS is still blocking the remote access?  Can anyone think of any other area to review?

Update
A bit more information...
I've tried making the app pool acct domain admin and the problem still occurs. When using the same method to access a drive on the local machine it works fine. Running the same code in SnippetCompiler outside of sharepoint using the app pool account works fine.
Hope this helps, let me know if you can think of any more avenues of investigation or tests I can try.

Update
Im not sure if this would affect the issue but the local server is running Windows Server 2003 and the remote server is running Windows 2000.

Update
I've just tried running the code through a web part and it works fine. The file structure I use in the project that is failing is as follows:-
wss
 - VirtualDirectories
   - SharePointWebApp
     - ...sp web app files
     - .
     - .
   - PageLayoutControls
     - control.ascx
     - .
     - .

Then in IIS I have the following structure:-
IIS
 - Websites
   - SharePointWebApp (pointing to \wss\VirtualDirectories\SharePointWebApp)
     - PageLayoutControls (virtual directory pointing to \wss\VirtualDirectories\PageLayoutControls)

Then within the PageLayouts I reference the controls using the following:-
<%@ Register TagPrefix="TEST" TagName="MyControl" Src="~/PageLayoutControls/control.ascx" %>
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
  <TEST:MyControl id="myControl" runat="server"/>
</asp:Content>Let me know if you need more info.

Update
The mystery deepens...
When I access the sharepoint site from Internet Explorer (6 or 7) on the SharePoint web front end server I do NOT get the exception.
When I access the sharepoint site from Mozilla Firefox from the SP web front end server I DO get the exception.
When I access the sharepoint site remotely from ANY browser I get the exception.
Also, it makes no difference what user I use to log on to the site, as long as they have permissions to access the sharepoint site.
Any thoughts?

Update
Hmm, I've now found that if I access the sharepoint site remotely and the sharepoint site tries to do a File.Create() locally (i.e. File.Create("C:\temp\abc.txt")) then it works. If I access the sharepoint site from the sharepoint box and do a File.Create() remotely (i.e. File.Create("\ServerName\ShareName\FolderName\file.txt")) then it works.
It only fails when I access the sharepoint site remotely and have the sharepoint site try to do a File.Create() remotely as well. Kind of a double hop problem. This makes me think it may be an NTLM / Kerberos issue.
Currently, we are running using NTLM authentication.
Has anyone else experienced this sort of issue?

Update
Yep, I'm pretty sure this is an NTLM issue not allowing a double hop. I just changed the authentication on the sharepoint site to use Basic Authentication and its worked. Changed it back to Integrated Authentication and it failed.
Now to decide whether to move the farm to use Kerberos or find another way around the issue. :-/

Update
Just giving SPSecurity.RunWithElevatedPrivileges a shot now. One thing though, is RunWithElevatedPrivileges meant to be used in this context? Previously, I've only used it to get access to lists and libraries within SharePoint rather than accessing a file access the network.
Any thoughts?

Update
Yep, SPSecurity.RunWithElevatedPrivileges resolves the issue. :-)

A: I wonder if this is the double-hop issue and that your code is trying to access the resource as the impersonated user, but that fails because NTLM will not impersonate to another server (Kerberos would).
Have you tried SPSecurity.RunWithElevatedPrivileges?  That would remove the impersonation (RevertToSelf) and then maybe the application pool owner can just act as himself (herself?) whereas maybe it couldn't before.
Just a thought and should be pretty easy to try out.


text:
Q: How to use markups in Org-Mode's tables? Is it possible to use regular org-mode markups, like #+BEGIN_SRC or lists, in org-tables?

A: Not that I'm aware of. Though, maybe well if quoted as strings. Maybe explaining what you're trying to achieve would help!


text:
Q: Angular 5 HttpClient 'get' call returns array if 2+ results but not an array on 1 result On my test Angular 5 web client, on this HTTP call to my Java Jax-RS REST server I expect a return of data as array of type - PlayerRecord. (It is a simple class with a few fields).
 this.http.get<PlayerRecord[]>(this.url)
        .subscribe(data => this.onDataSuccess(data),
                    err => this.errorHttp.set(err));

I am handling the data in the below function with parameter that expects data to be again an array of type - PlayerRecord:
playerRst: PlayerRecord[];

private onDataSuccess (data: PlayerRecord[]) {
    this.playerRst = data;
    console.log(this.playerRst.length);
    console.log(this.playerRst[0]);
    ...
}

Now, if the result has 2 or more elements in the array, I do get the expected array of data fine, HOWEVER, if I get only 1 record from the server, 'data' is no more an array and the steps in the onDataSuccess function fail.
Can you please explain why TypeScript can't keep an 1 element array as array or what I am missing, and how to work around this?
Thank you.

A: The problem is likely your backend.
If a query such as get player record can returns multiple records then your backend should return a list even if that list contains a single element otherwise you will have problem like this due to response being parsed.
It doesnt make any sense to have a service call that sometime returns a single object and other time a list of object and then angular expecting an array of object to map.


text:
Q: Most efficient way to read an entire file into vector of lines I am trying to find a more efficient way to read an entire file into a vector of lines, defined as std::vector<std::string>.
Currently, I have written the naive:
std::ifstream file{filepath};
std::vector<std::string> lines;

std::string line;
while(std::getline(file, line)) lines.push_back(line);

But feel as though the extra copy in push_back and the vector reallocation for every line would be extremely detrimental to efficiency and am looking for a more modern c++ type of approach, such as using stream buffer iterators when copying bytes:
std::ifstream file{filepath};
auto filesize = /* get file size */;
std::vector<char> bytes;
bytes.reserve(filesize);
bytes.assign(std::istreambuf_iterator{file}, istreambuf_iterator{});

Is there any such way I could read a text file in by lines into a vector?

A: There is very interesting and relative new approach - ranges. You can read very interesting articles by  Eric Niebler:
Out Parameters, Move Semantics, and Stateful Algorithms about fast getlines alternative
Input Iterators vs Input Ranges

A: Something along the following code might work.
struct FileContents
{
   // Contents of the file.
   std::string contents;

   // Each line consists of two indices.
   struct line { std::string::size_type begin; std::string::size_type end;};

   // List of lines.
   std::vector<line> lines;
};

void readFileContents(std::string const& file,
                      FileContents& fileContents)
{
   std::ifstream ifs(file);
   if ( !ifs )
   {
      // Deal with error.
      return;
   }

   // Get the size of the file.
   ifs.seekg(0, std::ios::end);
   std::fstream::pos_type size = ifs.tellg();

   // Reserve space to read the file contents.
   fileContents.contents.assign(static_cast<std::string::size_type>(size), '\0');

   // Read the file contents.
   ifs.seekg(0, std::ios::beg);
   ifs.read(&fileContents.contents[0], size);
   ifs.close();

   // Divide the contents of the file into lines.
   FileContents::line line = {0, 0};
   std::string::size_type pos;
   while ( (pos = fileContents.contents.find('\n', line.begin)) != std::string::npos )
   {
      line.end = pos+1;
      fileContents.lines.push_back(line);
      line.begin = line.end;
   }
   line.end = fileContents.contents.size();
   if ( line.begin < fileContents.contents.size() )
   {
      fileContents.lines.push_back(line);
   }
}


text:
Q: Tool to compare elasticsearch index into data base records to ascertain inconsistent state
I Want to know whether any tool available for comparing database entries into elastcisearch index to find the mismatch.

Thanks in advance.

A: There is a way to do this with the Scrutineer tool, which provides support for comparing data stored in Elasticsearch against a source of truth, usually relational database.
After running this tool, you'll get a report of:

*

*records in the source of truth and not in ES (missed create)

*records in ES and not in the source of truth (missed delete)

*records in ES and the source of truth which are out of synch (missed update)

Basically, this will give you an exact overview of the de-/synchronization state of the two data stores you're comparing (ES + DB).
UPDATE 1:
Here is another interesting blog article on the subject: Elasticsearch: Verifying Data Integrity with External Data Stores
UPDATE 2:
Here is yet another interesting blog article on the subject: How to keep Elasticsearch synchronized with a relational database using Logstash

A: I believe not, this has the potential to be a very taxing operation. However if you have used a unique PK from your database as the _id for the documents in elasticsearch then you could use the following command whilst iterating through records -
curl -XHEAD -i 'http://localhost:9200/twitter/tweet/1'

This will return an appropriate response as to whether the document exists or not. Storing all _id's which don't exist and placing these into ElasticSearch, within your own bespoke script or application.
If this is not the case the complexity of the problem significantly rise as do the implications to the cluster.


text:
Q: how to use RabbitMQ and REST-API in Nest App? Good Day!
I'm trying to implement 2 microservices that communicate with each other through a message broker. But one of them should accept Http requests via REST-Api. Unfortunately, I don't understand how to make the microservice listen to both the message queue and incoming HTTP requests. Perhaps I don't understand something in the paradigm of communication through a message broker, but how then to receive requests from the client and forward them to the microservice architecture?
Main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import {Transport, MicroserviceOptions} from '@nestjs/microservices'

async function bootstrap() {
  const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, {
    transport: Transport.RMQ,
    options: {
      urls: ['amqp://rabbitmq:5672'],
      queue: 'hello_world',
      queueOptions: {
        durable: false
      },
    },
  });
  await app.listen();
}
bootstrap();

As you can see, now the application is not listening on port 3000 as in the standard approach. What should be done?

A: The answer turned out to be quite simple. NEST js has hybrid apps. You can get to know them here https://docs.nestjs.com/faq/hybrid-application#hybrid-application. Thanks everyone
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import {Transport, MicroserviceOptions} from '@nestjs/microservices'

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const microservice = app.connectMicroservice({
    transport: Transport.RMQ,
    options: {
      urls: ['amqp://rabbitmq:5672'],
      queue: 'hello_world',
      queueOptions: {
        durable: false
      },
    },
  });

  await app.startAllMicroservices();
  await app.listen(3000);
}
bootstrap();


text:
Q: Java.exe exited with code 1 (Xamarin C#) I try to compile Android app and has this error
   Note: obj\Release\android\src\mono\com\google\android\gms\maps\GoogleMap_OnMyLocationChangeListenerImplementor.java uses or overrides a deprecated API.
1>  Note: Recompile with -Xlint:deprecation for details.
1>  Note: Some input files use unchecked or unsafe operations.
1>  Note: Recompile with -Xlint:unchecked for details.
1>  79 warnings
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2118,3): error MSB6006: "java.exe" exited with code 1.

I updated all packages and clear project. But have this error again
How I can solve this issue


text:
Q: Why exception before await not throw without await? Consider the following code:
static async Task ThrowException()
{
    throw new Exception("exception 1");
    Thread.Sleep(1000);
    await Task.Delay(1000);
    throw new Exception("exception 2");
}
static async Task Sleep()
{
    Console.WriteLine("begin sleep");
    Thread.Sleep(1000);
    Console.WriteLine("end sleep");
    Console.WriteLine("begin delay");
    await Task.Delay(1000);
    Console.WriteLine("end delay");
}
static async Task Main(string[] args)
{
    {
        Console.WriteLine("begin var task = Sleep();");
        var task = Sleep();
        Console.WriteLine("end var task = Sleep();");
        Console.WriteLine("begin await task;");
        await task;
        Console.WriteLine("end await task;");
    }
    {
        try
        {
            Console.WriteLine("begin var task = ThrowException();");
            var task = ThrowException();
            Console.WriteLine("end var task = ThrowException();");
            Console.WriteLine("begin await task;");
            await task;
            Console.WriteLine("end await task;");
        }
        catch(Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }
}

The result is following:
begin var task = Sleep();
begin sleep
end sleep
begin delay
end var task = Sleep();
begin await task;
end delay
end await task;
begin var task = ThrowException();
end var task = ThrowException();
begin await task;
exception 1

My question is that why exception 1 appears after "begin await task" task  but "end sleep" appears before "begin await task"? I think it does not start a new thread before await Task.Delay(), it should happen in the same thread like Thread.Sleep(), so I expect the "exception 1" throw immediately before "end var task = ThrowException();"

A: This code is
static async Task ThrowException()
{
    throw new Exception("exception 1");
    Thread.Sleep(1000);
    await Task.Delay(1000);
    throw new Exception("exception 2");
}

similar to
static Task ThrowException()
{
    Task.Run(() =>
        {
            throw new Exception("exception 1");
            Thread.Sleep(1000);
            await Task.Delay(1000);
            throw new Exception("exception 2");
        }
    )
}

The trick is the exception is swallowed by the task.
Then the exception is stored in the task and when you ask the task's result, that throw the exception.
And await return the task's result.
In your case :
try
{
    Console.WriteLine("begin var task = ThrowException();");
    // 1) Display : "begin var task = ThrowException();"
    var task = ThrowException();
    // 2) Starts a task that immediately ends with an exception
    Console.WriteLine("end var task = ThrowException();");
    // 3) Display : "end var task = ThrowException();"
    Console.WriteLine("begin await task;");
    // 4) Display : "begin await task;"
    await task;
    // 5) await return the task result,
    // in this case it's throw the exception stored in the task.
    // Go to in catch
    Console.WriteLine("end await task;");
    var task = ThrowException();
    await task;
}
catch(Exception e)
{
    Console.WriteLine(e.Message);
    //6) Display the exception message
}

A: According to Microsoft Documentation

The await operator suspends evaluation of the enclosing async method
until the asynchronous operation represented by its operand completes.
When the asynchronous operation completes, the await operator returns
the result of the operation,

*I wont dive deep into how multithreading works, I've tried to use an over-simplified model to make it easy to understand what is going on here. Under the hood it's a little bit more complicated.
In both cases var task = Sleep(); and var task = ThrowException();, instructions within those methods are executed when you assign the Task to the task variable. The difference is that Sleep() method does not have anything to return, so the await here does nothing. On the other hand, ThrowExeption() has something to return. Note that throwing an exeption or returning a value from a function are very similar actions. In this case, the exeption is thrown way before you access it with the await keyword.
It's like sayin: Hey Sleep() and ThrowExeption(), do your work, I'll get to you later when I'll need your results.
*Later:

*

*Hey Sleep(), give me your results

*I did what you said, I don't have anything to return to you.

*Hey TrowExeption(), give me the results of your work

*Alright! I've been waiting for you, here is the exeption that you might be interested in.

A: There are already answers here, but as I was also confused, just a few words (too long for a comment). There is big difference between:
static async Task ThrowException()
{
    throw new Exception("exception 1");
}

and
static Task ThrowException()
{
    throw new Exception("exception 1");
}

The first one returns a failed Task, here the exception will be thrown by awaiting the task result.
The second one throws immediately an exception.

A: I think you are confusing the question.
Because everything in your program is executing in sequencial order.
I think your confusion is that
you think you are executing the task in a asyncronous way so you are expecting
other order maybe.
If you want to execute asyncronously you should do this for example:
Task task = Task.StartNew(Sleep());

Detail your question better please.