问:
OpenWebRTC iOS random crash gstglcontext
I am working on a WebRTC project. I chose OpenWebRTC to implement in my project.

I have made it to work for both web and iOS. I developed a signaling server in asp.net MVC and used coTurn server as a turn server.

Everything is working fine except for one issue.

The iOS app crashes randomly with the exception

EXC_BAD_ACCESS exception:(gstglcontext(14):EXC_BAD_ACCESS (code=1,address=0x30))

The exception is thrown from somewhere within the SDK. I have been trying for days now to find a solution, but have not succeeded so far.

Has anyone else faced a similar problem?

Following is the stack trace from the device logs of the crash

```<code>Incident Identifier: FA4FC9DB-B4CA-497E-9A25-639A4F743BC8
CrashReporter Key:   ff7120b6353817347fd122932620c25469ace55e
Hardware Model:      iPad4,5
Process:             NativeDemo [983]
Path:                /private/var/containers/Bundle/Application/13129A20-974B-405C-AB44-B5F8526AF362/NativeDemo.app/NativeDemo
Identifier:          com.ericsson.research.owr.NativeDemo
Version:             1 (1.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.ericsson.research.owr.NativeDemo [1284]

Date/Time:           2017-03-22 04:52:45.7874 -0700
Launch Time:         2017-03-22 04:26:17.7434 -0700
OS Version:          iPhone OS 10.2.1 (14D27)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000030
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Triggered by Thread:  9

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   GraphicsServices                0x000000018fd7e198 GSEventRunModal + 180
6   UIKit                           0x000000019430a7fc -[UIApplication _run] + 684
7   UIKit                           0x0000000194305534 UIApplicationMain + 208
8   NativeDemo                      0x0000000100050e90 0x100040000 + 69264
9   libdyld.dylib                   0x000000018d2ad5b8 start + 4

Thread 1 name:  owr_main_loop
Thread 1:
0   libsystem_kernel.dylib          0x000000018d3a56e4 poll + 8
1   NativeDemo                      0x000000010031d8c0 0x100040000 + 3004608
2   NativeDemo                      0x000000010031dc18 0x100040000 + 3005464
3   NativeDemo                      0x000000010059794c 0x100040000 + 5601612
4   NativeDemo                      0x0000000100597a88 0x100040000 + 5601928
5   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
6   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
7   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
8   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 2 name:  AVAudioSession Notify Thread
Thread 2:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   AVFAudio                        0x00000001a7867d24 GenericRunLoopThread::Entry(void*) + 164
6   AVFAudio                        0x00000001a788dd9c CAPThread::Entry(CAPThread*) + 84
7   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 3 name:  com.apple.uikit.eventfetch-thread
Thread 3:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   Foundation                      0x000000018ee0726c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6   Foundation                      0x000000018ee27dd0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7   UIKit                           0x0000000194c7ec38 -[UIEventFetcher threadMain] + 136
8   Foundation                      0x000000018ef04e68 __NSThread__start__ + 1024
9   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
10  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
11  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 4 name:  com.apple.NSURLConnectionLoader
Thread 4:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   CFNetwork                       0x000000018eacfa70 +[NSURLConnection(Loader) _resourceLoadLoop:] + 336
6   Foundation                      0x000000018ef04e68 __NSThread__start__ + 1024
7   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 5 name:  gmain
Thread 5:
0   libsystem_kernel.dylib          0x000000018d3a56e4 poll + 8
1   NativeDemo                      0x000000010031d8c0 0x100040000 + 3004608
2   NativeDemo                      0x000000010031d994 0x100040000 + 3004820
3   NativeDemo                      0x000000010031ecec 0x100040000 + 3009772
4   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
5   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
6   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
7   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 6 name:  video-source:src
Thread 6:
0   libsystem_kernel.dylib          0x000000018d3bee1c __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000018d4849f4 _pthread_cond_wait + 692
2   Foundation                      0x000000018ee11f28 -[NSCondition waitUntilDate:] + 340
3   Foundation                      0x000000018ee0ef24 -[NSConditionLock lockWhenCondition:beforeDate:] + 256
4   NativeDemo                      0x0000000100070894 0x100040000 + 198804
5   NativeDemo                      0x0000000100071b44 0x100040000 + 203588
6   NativeDemo                      0x000000010040ce74 0x100040000 + 3985012
7   NativeDemo                      0x000000010040c678 0x100040000 + 3982968
8   NativeDemo                      0x00000001004886a8 0x100040000 + 4490920
9   NativeDemo                      0x0000000100303e24 0x100040000 + 2899492
10  NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
11  libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
12  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
13  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 7 name:  sink-queue-0:src
Thread 7:
0   libsystem_kernel.dylib          0x000000018d3bee1c __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000018d4849c0 _pthread_cond_wait + 640
2   NativeDemo                      0x000000010036a1d0 0x100040000 + 3318224
3   NativeDemo                      0x0000000100099c40 0x100040000 + 367680
4   NativeDemo                      0x00000001004886a8 0x100040000 + 4490920
5   NativeDemo                      0x0000000100303e24 0x100040000 + 2899492
6   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
7   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 8 name:  gstglnavigation
Thread 8:
0   libsystem_kernel.dylib          0x000000018d3a56e4 poll + 8
1   NativeDemo                      0x000000010031d8c0 0x100040000 + 3004608
2   NativeDemo                      0x000000010031dc18 0x100040000 + 3005464
3   NativeDemo                      0x000000010043ba28 0x100040000 + 4176424
4   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
5   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
6   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
7   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 9 name:  gstglcontext
Thread 9 Crashed:
0   IOAccelerator                   0x000000019097ecbc IOAccelResourceGetResidentDataSize + 0
1   AGXGLDriver                     0x00000001a2901390 0x1a289a000 + 422800
2   AGXGLDriver                     0x00000001a28c1354 0x1a289a000 + 160596
3   AGXGLDriver                     0x00000001a28c14bc 0x1a289a000 + 160956
4   AGXGLDriver                     0x00000001a28bee38 0x1a289a000 + 151096
5   GLEngine                        0x00000001a303b81c glClear_Exec + 432
6   NativeDemo                      0x00000001000d3340 0x100040000 + 602944
7   NativeDemo                      0x000000010043f8a8 0x100040000 + 4192424
8   NativeDemo                      0x000000010043ccb8 0x100040000 + 4181176
9   NativeDemo                      0x000000010043ccf8 0x100040000 + 4181240
10  NativeDemo                      0x000000010031d5e4 0x100040000 + 3003876
11  NativeDemo                      0x000000010031d924 0x100040000 + 3004708
12  NativeDemo                      0x000000010031dc18 0x100040000 + 3005464
13  NativeDemo                      0x0000000100437f48 0x100040000 + 4161352
14  NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
15  libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
16  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
17  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 10 name:  source-output-queue-0:src
Thread 10:
0   libsystem_kernel.dylib          0x000000018d3bee1c __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000018d4849c0 _pthread_cond_wait + 640
2   NativeDemo                      0x000000010036a1d0 0x100040000 + 3318224
3   NativeDemo                      0x000000010043ca84 0x100040000 + 4180612
4   NativeDemo                      0x000000010043bde4 0x100040000 + 4177380
5   NativeDemo                      0x00000001000d417c 0x100040000 + 606588
6   NativeDemo                      0x00000001000d2540 0x100040000 + 599360
7   NativeDemo                      0x0000000100403f48 0x100040000 + 3948360
8   NativeDemo                      0x0000000100407524 0x100040000 + 3962148
9   NativeDemo                      0x0000000100472894 0x100040000 + 4401300
10  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
11  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
12  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
13  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
14  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
15  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
16  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
17  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
18  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
19  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
20  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
21  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
22  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
23  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
24  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
25  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
26  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
27  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
28  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
29  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
30  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
31  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
32  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
33  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
34  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
35  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
36  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
37  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
38  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
39  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
40  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
41  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
42  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
43  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
44  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
45  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
46  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
47  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
48  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
49  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
50  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
51  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
52  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
53  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
54  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
55  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
56  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
57  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
58  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
59  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
60  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
61  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
62  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
63  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
64  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
65  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
66  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
67  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
68  NativeDemo                      0x000000010009a014 0x100040000 + 368660
69  NativeDemo                      0x00000001004886a8 0x100040000 + 4490920
70  NativeDemo                      0x0000000100303e24 0x100040000 + 2899492
71  NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
72  libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
73  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
74  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4
</code>```

I further tracked down the issue.

The exception is thrown on the following line in gstglimagesink.c in the function 'gst_glimage_sink_on_draw'

```<code>gl->Clear (GL_COLOR_BUFFER_BIT);
</code>```

答:
```<code>gl->Clear (GL_COLOR_BUFFER_BIT);
</code>```

At that line gl is a virtual conversion table of type GstGLFuncs. GstGLFuncs is a member of type struct GstGLContext which contains user's data.

So clearly, you don't have the user's data which you are trying to access. You are having a Dangling pointer. This could be because

The pointer(in your case GstGLContext) used to point to memory that was ok, but its chunk was
    deallocated.

The pointer is corrupt.

The line of code that your app crashes on is not the root cause of the problem. The problem in #1 is whatever line of code caused the premature deallocation, and the problem in #2 is whatever line of code corrupted the pointer.

Body:
I am working on a WebRTC project. I chose OpenWebRTC to implement in my project.

I have made it to work for both web and iOS. I developed a signaling server in asp.net MVC and used coTurn server as a turn server.

Everything is working fine except for one issue.

The iOS app crashes randomly with the exception

EXC_BAD_ACCESS exception:(gstglcontext(14):EXC_BAD_ACCESS (code=1,address=0x30))

The exception is thrown from somewhere within the SDK. I have been trying for days now to find a solution, but have not succeeded so far.

Has anyone else faced a similar problem?

Following is the stack trace from the device logs of the crash

Incident Identifier: FA4FC9DB-B4CA-497E-9A25-639A4F743BC8
CrashReporter Key:   ff7120b6353817347fd122932620c25469ace55e
Hardware Model:      iPad4,5
Process:             NativeDemo [983]
Path:                /private/var/containers/Bundle/Application/13129A20-974B-405C-AB44-B5F8526AF362/NativeDemo.app/NativeDemo
Identifier:          com.ericsson.research.owr.NativeDemo
Version:             1 (1.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.ericsson.research.owr.NativeDemo [1284]

Date/Time:           2017-03-22 04:52:45.7874 -0700
Launch Time:         2017-03-22 04:26:17.7434 -0700
OS Version:          iPhone OS 10.2.1 (14D27)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000030
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Triggered by Thread:  9

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   GraphicsServices                0x000000018fd7e198 GSEventRunModal + 180
6   UIKit                           0x000000019430a7fc -[UIApplication _run] + 684
7   UIKit                           0x0000000194305534 UIApplicationMain + 208
8   NativeDemo                      0x0000000100050e90 0x100040000 + 69264
9   libdyld.dylib                   0x000000018d2ad5b8 start + 4

Thread 1 name:  owr_main_loop
Thread 1:
0   libsystem_kernel.dylib          0x000000018d3a56e4 poll + 8
1   NativeDemo                      0x000000010031d8c0 0x100040000 + 3004608
2   NativeDemo                      0x000000010031dc18 0x100040000 + 3005464
3   NativeDemo                      0x000000010059794c 0x100040000 + 5601612
4   NativeDemo                      0x0000000100597a88 0x100040000 + 5601928
5   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
6   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
7   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
8   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 2 name:  AVAudioSession Notify Thread
Thread 2:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   AVFAudio                        0x00000001a7867d24 GenericRunLoopThread::Entry(void*) + 164
6   AVFAudio                        0x00000001a788dd9c CAPThread::Entry(CAPThread*) + 84
7   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 3 name:  com.apple.uikit.eventfetch-thread
Thread 3:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   Foundation                      0x000000018ee0726c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6   Foundation                      0x000000018ee27dd0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7   UIKit                           0x0000000194c7ec38 -[UIEventFetcher threadMain] + 136
8   Foundation                      0x000000018ef04e68 __NSThread__start__ + 1024
9   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
10  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
11  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 4 name:  com.apple.NSURLConnectionLoader
Thread 4:
0   libsystem_kernel.dylib          0x000000018d3a1188 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000018d3a0ff8 mach_msg + 72
2   CoreFoundation                  0x000000018e39e5d0 __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x000000018e39c1ec __CFRunLoopRun + 1132
4   CoreFoundation                  0x000000018e2ca2b8 CFRunLoopRunSpecific + 444
5   CFNetwork                       0x000000018eacfa70 +[NSURLConnection(Loader) _resourceLoadLoop:] + 336
6   Foundation                      0x000000018ef04e68 __NSThread__start__ + 1024
7   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 5 name:  gmain
Thread 5:
0   libsystem_kernel.dylib          0x000000018d3a56e4 poll + 8
1   NativeDemo                      0x000000010031d8c0 0x100040000 + 3004608
2   NativeDemo                      0x000000010031d994 0x100040000 + 3004820
3   NativeDemo                      0x000000010031ecec 0x100040000 + 3009772
4   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
5   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
6   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
7   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 6 name:  video-source:src
Thread 6:
0   libsystem_kernel.dylib          0x000000018d3bee1c __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000018d4849f4 _pthread_cond_wait + 692
2   Foundation                      0x000000018ee11f28 -[NSCondition waitUntilDate:] + 340
3   Foundation                      0x000000018ee0ef24 -[NSConditionLock lockWhenCondition:beforeDate:] + 256
4   NativeDemo                      0x0000000100070894 0x100040000 + 198804
5   NativeDemo                      0x0000000100071b44 0x100040000 + 203588
6   NativeDemo                      0x000000010040ce74 0x100040000 + 3985012
7   NativeDemo                      0x000000010040c678 0x100040000 + 3982968
8   NativeDemo                      0x00000001004886a8 0x100040000 + 4490920
9   NativeDemo                      0x0000000100303e24 0x100040000 + 2899492
10  NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
11  libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
12  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
13  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 7 name:  sink-queue-0:src
Thread 7:
0   libsystem_kernel.dylib          0x000000018d3bee1c __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000018d4849c0 _pthread_cond_wait + 640
2   NativeDemo                      0x000000010036a1d0 0x100040000 + 3318224
3   NativeDemo                      0x0000000100099c40 0x100040000 + 367680
4   NativeDemo                      0x00000001004886a8 0x100040000 + 4490920
5   NativeDemo                      0x0000000100303e24 0x100040000 + 2899492
6   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
7   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
8   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
9   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 8 name:  gstglnavigation
Thread 8:
0   libsystem_kernel.dylib          0x000000018d3a56e4 poll + 8
1   NativeDemo                      0x000000010031d8c0 0x100040000 + 3004608
2   NativeDemo                      0x000000010031dc18 0x100040000 + 3005464
3   NativeDemo                      0x000000010043ba28 0x100040000 + 4176424
4   NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
5   libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
6   libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
7   libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 9 name:  gstglcontext
Thread 9 Crashed:
0   IOAccelerator                   0x000000019097ecbc IOAccelResourceGetResidentDataSize + 0
1   AGXGLDriver                     0x00000001a2901390 0x1a289a000 + 422800
2   AGXGLDriver                     0x00000001a28c1354 0x1a289a000 + 160596
3   AGXGLDriver                     0x00000001a28c14bc 0x1a289a000 + 160956
4   AGXGLDriver                     0x00000001a28bee38 0x1a289a000 + 151096
5   GLEngine                        0x00000001a303b81c glClear_Exec + 432
6   NativeDemo                      0x00000001000d3340 0x100040000 + 602944
7   NativeDemo                      0x000000010043f8a8 0x100040000 + 4192424
8   NativeDemo                      0x000000010043ccb8 0x100040000 + 4181176
9   NativeDemo                      0x000000010043ccf8 0x100040000 + 4181240
10  NativeDemo                      0x000000010031d5e4 0x100040000 + 3003876
11  NativeDemo                      0x000000010031d924 0x100040000 + 3004708
12  NativeDemo                      0x000000010031dc18 0x100040000 + 3005464
13  NativeDemo                      0x0000000100437f48 0x100040000 + 4161352
14  NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
15  libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
16  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
17  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

Thread 10 name:  source-output-queue-0:src
Thread 10:
0   libsystem_kernel.dylib          0x000000018d3bee1c __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000018d4849c0 _pthread_cond_wait + 640
2   NativeDemo                      0x000000010036a1d0 0x100040000 + 3318224
3   NativeDemo                      0x000000010043ca84 0x100040000 + 4180612
4   NativeDemo                      0x000000010043bde4 0x100040000 + 4177380
5   NativeDemo                      0x00000001000d417c 0x100040000 + 606588
6   NativeDemo                      0x00000001000d2540 0x100040000 + 599360
7   NativeDemo                      0x0000000100403f48 0x100040000 + 3948360
8   NativeDemo                      0x0000000100407524 0x100040000 + 3962148
9   NativeDemo                      0x0000000100472894 0x100040000 + 4401300
10  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
11  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
12  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
13  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
14  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
15  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
16  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
17  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
18  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
19  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
20  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
21  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
22  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
23  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
24  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
25  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
26  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
27  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
28  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
29  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
30  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
31  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
32  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
33  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
34  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
35  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
36  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
37  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
38  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
39  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
40  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
41  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
42  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
43  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
44  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
45  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
46  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
47  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
48  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
49  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
50  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
51  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
52  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
53  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
54  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
55  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
56  NativeDemo                      0x00000001003f78e4 0x100040000 + 3897572
57  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
58  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
59  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
60  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
61  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
62  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
63  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
64  NativeDemo                      0x000000010049b000 0x100040000 + 4567040
65  NativeDemo                      0x0000000100472894 0x100040000 + 4401300
66  NativeDemo                      0x00000001004732b8 0x100040000 + 4403896
67  NativeDemo                      0x00000001004730f4 0x100040000 + 4403444
68  NativeDemo                      0x000000010009a014 0x100040000 + 368660
69  NativeDemo                      0x00000001004886a8 0x100040000 + 4490920
70  NativeDemo                      0x0000000100303e24 0x100040000 + 2899492
71  NativeDemo                      0x0000000100307d90 0x100040000 + 2915728
72  libsystem_pthread.dylib         0x000000018d485850 _pthread_body + 240
73  libsystem_pthread.dylib         0x000000018d485760 _pthread_body + 0
74  libsystem_pthread.dylib         0x000000018d482d94 thread_start + 4

I further tracked down the issue.

The exception is thrown on the following line in gstglimagesink.c in the function 'gst_glimage_sink_on_draw'

gl->Clear (GL_COLOR_BUFFER_BIT);

Body:
gl->Clear (GL_COLOR_BUFFER_BIT);

At that line gl is a virtual conversion table of type GstGLFuncs. GstGLFuncs is a member of type struct GstGLContext which contains user's data.

So clearly, you don't have the user's data which you are trying to access. You are having a Dangling pointer. This could be because

The pointer(in your case GstGLContext) used to point to memory that was ok, but its chunk was
    deallocated.

The pointer is corrupt.

The line of code that your app crashes on is not the root cause of the problem. The problem in #1 is whatever line of code caused the premature deallocation, and the problem in #2 is whatever line of code corrupted the pointer.


来源: stackexchange

问:
UICollectionView Programmatically
I created my own window in storyboard like below:

```<code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.makeKeyAndVisible()
        window?.rootViewController = UINavigationController(rootViewController: HomeController())
        return true
    }
</code>```

This actually worked fine when my class is subclassing UIViewController.

```<code>class HomeController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        view.backgroundColor = UIColor.red
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
</code>```

Now when I subclass my class with UICollectionViewController:

```<code>class HomeController: UICollectionViewController {

        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
            Collectionview.backgroundColor = UIColor.red
        }

        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }

    }
</code>```

At runtime it gives me an error saying:

Terminating app due to uncaught exception
  'NSInvalidArgumentException', reason: 'UICollectionView must be
  initialized with a non-nil layout parameter'
  *** First throw call stack:

In my understanding it is asking me to give layout for UICollectionView.Correct me here if I am wrong.So I tried this-:

```<code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.makeKeyAndVisible()
        let layout = UICollectionViewFlowLayout()
        window?.rootViewController = UINavigationController(rootViewController: HomeController(UICollectionViewLayout: layout))
        return true
    }
</code>```

But Still ending up with an error:

Argument labels 'UICollectionViewLayout' do not match any available
  overloads.

Am I using a wrong swift3 syntax? If yes what is correct to solve out this issue.

答:
You need to implement UICollectionViewFlowLayout in UICollectionViewController.

Check this Link

You must use initWithFrame:collectionViewLayout: to initialise your UICollectionView and you must pass a non-nil UICollectionViewLayout object.

ContentLicense: CC BY-SA 3.0

Title: UICollectionView Programmatically

Body:
I created my own window in storyboard like below:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.makeKeyAndVisible()
        window?.rootViewController = UINavigationController(rootViewController: HomeController())
        return true
    }

This actually worked fine when my class is subclassing UIViewController.

class HomeController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        view.backgroundColor = UIColor.red
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

Now when I subclass my class with UICollectionViewController:

class HomeController: UICollectionViewController {

        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
            Collectionview.backgroundColor = UIColor.red
        }

        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }

    }

At runtime it gives me an error saying:

Terminating app due to uncaught exception
  'NSInvalidArgumentException', reason: 'UICollectionView must be
  initialized with a non-nil layout parameter'
  *** First throw call stack:

In my understanding it is asking me to give layout for UICollectionView.Correct me here if I am wrong.So I tried this-:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.makeKeyAndVisible()
        let layout = UICollectionViewFlowLayout()
        window?.rootViewController = UINavigationController(rootViewController: HomeController(UICollectionViewLayout: layout))
        return true
    }

But Still ending up with an error:

Argument labels 'UICollectionViewLayout' do not match any available
  overloads.

Am I using a wrong swift3 syntax? If yes what is correct to solve out this issue.


问:
EditText losing focus if I hit the record button
I'm trying to build chat interface . I've written code for recording voice with animation for the fab.my problem is when I press the button and my edittext is focused the edittext for no reason is losing focus which is hiding the autodetect words bar in the keyboard leaving the Fab above the keyboard with 1 cm . I know that this problem is due to the recycle view since when i just set the visibility of the recycler view to Gone the edittext don't lose focus when I try to record .I've tried also to change windowSoftInputMode.  Thanks for the help. </p>

```<code> <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        android:id="@+id/relativeLayout_chat_background"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"

        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android"

        >

    <com.example.fcb.insurance.customViews.holdingbutton.HoldingButtonLayout
        android:id="@+id/input_holder"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        app:hbl_cancel_icon="@drawable/ic_clear_white_24dp"
        app:hbl_color="@color/colorAccent"
        app:hbl_holding_view="@+id/start_record"
        app:hbl_icon="@drawable/ic_mic_white_24dp"
        app:hbl_radius="@dimen/activity_main_holding_button_radius"
        app:hbl_second_radius="@dimen/activity_main_holding_button_second_radius"
        android:layout_toLeftOf="@+id/sendMessage"
       android:paddingRight="10dp"
        android:paddingBottom="10dp"
        android:paddingTop="10dp"
        android:clipChildren="false"
        android:clipToPadding="false"        >

        <LinearLayout
            android:id="@+id/slide_to_cancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|end"
            android:layout_marginEnd="@dimen/activity_main_slide_to_cancel_margin_right"
            android:layout_marginRight="@dimen/activity_main_slide_to_cancel_margin_right"
            android:gravity="center_vertical"
            android:visibility="invisible">

            <ImageView
                android:layout_width="@dimen/activity_main_slide_to_cancel_icon_size"
                android:layout_height="@dimen/activity_main_slide_to_cancel_icon_size"
                android:layout_marginEnd="@dimen/activity_main_slide_to_cancel_icon_margin_right"
                android:layout_marginRight="@dimen/activity_main_slide_to_cancel_icon_margin_right"
                android:scaleType="center"
                android:src="@drawable/ic_keyboard_arrow_left_black_24dp"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/label_slide_to_cancel"/>

            <TextView

                android:id="@+id/textView_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:textColor="@color/colorAccent"
                />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"

            android:minHeight="@dimen/activity_main_input_holder_min_height"
            android:orientation="horizontal"
            >

            <EditText
                android:id="@+id/editText_message"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/activity_main_input_margin_left"
                android:layout_marginStart="@dimen/activity_main_input_margin_left"
               android:paddingLeft="16dp"
                android:layout_weight="1"
                android:hint="@string/hint_type_your_message"
                android:paddingBottom="@dimen/activity_main_input_padding_vertical"
                android:paddingTop="@dimen/activity_main_input_padding_vertical"
                android:textSize="@dimen/activity_main_input_text_size"
                android:background="@drawable/chat_input_text"
                android:maxLines="6"
                android:scrollbarStyle="insideInset"
                android:scrollbars="vertical"
                android:layout_gravity="bottom"
                ></EditText>

            <android.support.design.widget.FloatingActionButton
                android:id="@+id/start_record"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="@style/Widget.AppCompat.Button.Borderless.Colored"
                android:src="@drawable/ic_mic_white_24dp"
                android:layout_marginLeft="10dp"
                android:layout_gravity="bottom"
                />

        </LinearLayout>

  </com.example.fcb.insurance.customViews.holdingbutton.HoldingButtonLayout>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/sendMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/Widget.AppCompat.Button.Borderless.Colored"
        android:src="@drawable/ic_send_white_24dp"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="10dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:visibility="gone"

        />
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView_chat_item_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/input_holder"
        android:layout_marginEnd="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginStart="5dp"
        android:clipToPadding="false"
        android:paddingTop="8dp"
        android:visibility="visible"
        app:layoutManager="LinearLayoutManager"
        tools:listitem="@layout/item_chat_list_out"

        />

    </RelativeLayout>
</code>```

答:
in your onclick event</p>

```<code>YOUR_EDITTEXT.requestFocus()
</code>```

Body:
I'm trying to build chat interface . I've written code for recording voice with animation for the fab.my problem is when I press the button and my edittext is focused the edittext for no reason is losing focus which is hiding the autodetect words bar in the keyboard leaving the Fab above the keyboard with 1 cm . I know that this problem is due to the recycle view since when i just set the visibility of the recycler view to Gone the edittext don't lose focus when I try to record .I've tried also to change windowSoftInputMode.  Thanks for the help.

 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        android:id="@+id/relativeLayout_chat_background"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"

        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android"

        >

    <com.example.fcb.insurance.customViews.holdingbutton.HoldingButtonLayout
        android:id="@+id/input_holder"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        app:hbl_cancel_icon="@drawable/ic_clear_white_24dp"
        app:hbl_color="@color/colorAccent"
        app:hbl_holding_view="@+id/start_record"
        app:hbl_icon="@drawable/ic_mic_white_24dp"
        app:hbl_radius="@dimen/activity_main_holding_button_radius"
        app:hbl_second_radius="@dimen/activity_main_holding_button_second_radius"
        android:layout_toLeftOf="@+id/sendMessage"
       android:paddingRight="10dp"
        android:paddingBottom="10dp"
        android:paddingTop="10dp"
        android:clipChildren="false"
        android:clipToPadding="false"        >

        <LinearLayout
            android:id="@+id/slide_to_cancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|end"
            android:layout_marginEnd="@dimen/activity_main_slide_to_cancel_margin_right"
            android:layout_marginRight="@dimen/activity_main_slide_to_cancel_margin_right"
            android:gravity="center_vertical"
            android:visibility="invisible">

            <ImageView
                android:layout_width="@dimen/activity_main_slide_to_cancel_icon_size"
                android:layout_height="@dimen/activity_main_slide_to_cancel_icon_size"
                android:layout_marginEnd="@dimen/activity_main_slide_to_cancel_icon_margin_right"
                android:layout_marginRight="@dimen/activity_main_slide_to_cancel_icon_margin_right"
                android:scaleType="center"
                android:src="@drawable/ic_keyboard_arrow_left_black_24dp"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/label_slide_to_cancel"/>

            <TextView

                android:id="@+id/textView_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:textColor="@color/colorAccent"
                />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"

            android:minHeight="@dimen/activity_main_input_holder_min_height"
            android:orientation="horizontal"
            >

            <EditText
                android:id="@+id/editText_message"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/activity_main_input_margin_left"
                android:layout_marginStart="@dimen/activity_main_input_margin_left"
               android:paddingLeft="16dp"
                android:layout_weight="1"
                android:hint="@string/hint_type_your_message"
                android:paddingBottom="@dimen/activity_main_input_padding_vertical"
                android:paddingTop="@dimen/activity_main_input_padding_vertical"
                android:textSize="@dimen/activity_main_input_text_size"
                android:background="@drawable/chat_input_text"
                android:maxLines="6"
                android:scrollbarStyle="insideInset"
                android:scrollbars="vertical"
                android:layout_gravity="bottom"
                ></EditText>

            <android.support.design.widget.FloatingActionButton
                android:id="@+id/start_record"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="@style/Widget.AppCompat.Button.Borderless.Colored"
                android:src="@drawable/ic_mic_white_24dp"
                android:layout_marginLeft="10dp"
                android:layout_gravity="bottom"
                />

        </LinearLayout>

  </com.example.fcb.insurance.customViews.holdingbutton.HoldingButtonLayout>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/sendMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/Widget.AppCompat.Button.Borderless.Colored"
        android:src="@drawable/ic_send_white_24dp"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="10dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:visibility="gone"

        />
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView_chat_item_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/input_holder"
        android:layout_marginEnd="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginStart="5dp"
        android:clipToPadding="false"
        android:paddingTop="8dp"
        android:visibility="visible"
        app:layoutManager="LinearLayoutManager"
        tools:listitem="@layout/item_chat_list_out"

        />

    </RelativeLayout>

Body:
in your onclick event

YOUR_EDITTEXT.requestFocus()


问:
Django - static/CACHE files not found
I'm using Django 1.10 + uWsgi + nginx.
In Prod mode the static files do not show up, this is what my nginx error-log tells me:

```<code>404   ... static/CACHE/js/e3a6fa7588d1.js" failed (2: No such file or directory),
</code>```

The folder static/CACHE remains empty (so the 404's make sense), but why?
I already set the permissions to 775 for static/CACHE .

nginx conf:

```<code># /etc/nginx/sites/available/mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream bdjango {
   server unix:///tmp/mysite.sock; # for a file socket
}
# configuration of the server
server {
   # the port your site will be served on
   listen 80;

   # the domain name it will serve for
   server_name dev.mysite.com; # substitute your machine's IP address or FQDN
   charset utf-8;

   # max upload size
   client_max_body_size 8M; # adjust to taste

   # Django media
   location /media {
      alias /var/www/mysite/src/media; # your Django project's media files - amend as required
   }
   location /static {
      alias /var/www/mysite/src/static; # your Django project's static files - amend as required
   }
   # Finally, send all non-media requests to the Django server.
   location / {
      uwsgi_pass adjango;
      include /var/www/mysite/src/uwsgi_params; # the uwsgi_params file you installed
   }
}
</code>```

Django settings contains

```<code>PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../../")
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
</code>```

So, why are my js/css files not in static/CACHE ?

EDIT:
solved it: uwsgi_pass was pointing at the wrong upstream location (which happened to be a different website):
      uwsgi_pass adjango;

答:
It could be that django-compressor is failing.

Have you tried having DEBUG = True and COMPRESS_ENABLED = True in your settings and seeing if it works?

https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED

Alternatively, I suggest having ADMINS setup in production so it emails you any errors, or setup sentry in your production setup.

Title: Django - static/CACHE files not found

Body:
I'm using Django 1.10 + uWsgi + nginx.
In Prod mode the static files do not show up, this is what my nginx error-log tells me:

404   ... static/CACHE/js/e3a6fa7588d1.js" failed (2: No such file or directory),

The folder static/CACHE remains empty (so the 404's make sense), but why?
I already set the permissions to 775 for static/CACHE .

nginx conf:

# /etc/nginx/sites/available/mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream bdjango {
   server unix:///tmp/mysite.sock; # for a file socket
}
# configuration of the server
server {
   # the port your site will be served on
   listen 80;

   # the domain name it will serve for
   server_name dev.mysite.com; # substitute your machine's IP address or FQDN
   charset utf-8;

   # max upload size
   client_max_body_size 8M; # adjust to taste

   # Django media
   location /media {
      alias /var/www/mysite/src/media; # your Django project's media files - amend as required
   }
   location /static {
      alias /var/www/mysite/src/static; # your Django project's static files - amend as required
   }
   # Finally, send all non-media requests to the Django server.
   location / {
      uwsgi_pass adjango;
      include /var/www/mysite/src/uwsgi_params; # the uwsgi_params file you installed
   }
}

Django settings contains

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../../")
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')

So, why are my js/css files not in static/CACHE ?

EDIT:
solved it: uwsgi_pass was pointing at the wrong upstream location (which happened to be a different website):
      uwsgi_pass adjango;


问:
Kendo upload change color when hover with file
I'm using the Kendo Upload-control to upload files.
When I hover over the button, it changes color.
How can I achieve the same thing, when I hover over the button while dragging a file to it?</p>

答: You can hook on dragenter and dragleave jQuery events of the upload input element and change the color of the button as for example it is done in this dojo page.


问:
How to get a rule to check all the conditions before exiting?
I'm trying to write a predicate weird_sum(List, Result) which takes a List of numbers, and computes the sum of the squares of the numbers in the list that are greater than or equal to 5, minus the sum of the absolute values of the numbers that are less than or equal to 2. For example:

```<code>?- weird_sum([3,6,2,-1], Result).
Result = 33
</code>```

That's 6×6 - 2 - 1.

I'm trying to check using two conditions whether the number is >= 5 or <= 2. But whenever I call the predicate "computerResult" it will only check the first condition and exit. It never reaches the 2nd condition. How do I make it check the 2nd condition if it fails the first condition?

Here is my code:

```<code>%base case
weird_sum([], 0).

%figuring out if number is large or small
computeResult(Head, Result + Head*Head):-
    Head >= 5.

computeResult(Head, Result - abs(Head)):-
    Head @=< 2.

%recursive case
weird_sum([Head|Tail], Result):-
    weird_sum(Tail, Result),
    computeResult(Head,Result).
</code>```

答:
The problem is not that it does not try the second clause. The problem is the second parameter in the computeResult/2 predicate. You write Result + Head*Head, etc. so that means that Prolog will try to unify a number (0) with something of the form +(Result,*(Head,Head)) and this obviously fails.

You can however easily modify the result like:

```<code>%base case
weird_sum([], 0).
%recursive case
weird_sum([Head|Tail], Result) :-
    weird_sum(Tail, <b>SubResult</b>),
    computeResult(Head,<b>Adder</b>),
    <b>Result is SubResult+Adder</b>.

%figuring out if number is large or small
computeResult(Head, <b>Head*Head</b>):-
    Head >= 5.
computeResult(Head, <b>-abs(Head)</b>):-
    Head <b>=<</b> 2.
<b>computeResult(Head, 0) :-
    Head < 5,
    Head > 2.</b></code>```

You can also add cuts (!) to the conditions to prevent backtracking over the computeResult/2 clauses. In that case you can omit the checks in the last clause.

```<code>%figuring out if number is large or small
computeResult(Head, <b>Head*Head</b>):-
    Head >= 5,
    <b>!</b>.
computeResult(Head, <b>-abs(Head)</b>):-
    Head <b>=<</b> 2,
    <b>!</b>.
computeResult(_, 0).</code>```

Nevertheless it is more efficient to use an accumulator, like:

```<code>weird_sum(List, Result) :-
    weird_sum(List, <b>0</b>, Result).

weird_sum([], Result, Result).
weird_sum([Head|Tail], SubResult, Result) :-
    computeResult(Head,Adder),
    SubResult2 is SubResult+Adder,
    weird_sum(Tail, SubResult2, Result).</code>```

Body:
I'm trying to write a predicate weird_sum(List, Result) which takes a List of numbers, and computes the sum of the squares of the numbers in the list that are greater than or equal to 5, minus the sum of the absolute values of the numbers that are less than or equal to 2. For example:

?- weird_sum([3,6,2,-1], Result).
Result = 33

That's 6×6 - 2 - 1.

I'm trying to check using two conditions whether the number is >= 5 or <= 2. But whenever I call the predicate "computerResult" it will only check the first condition and exit. It never reaches the 2nd condition. How do I make it check the 2nd condition if it fails the first condition?

Here is my code:

%base case
weird_sum([], 0).

%figuring out if number is large or small
computeResult(Head, Result + Head*Head):-
    Head >= 5.

computeResult(Head, Result - abs(Head)):-
    Head @=< 2.

%recursive case
weird_sum([Head|Tail], Result):-
    weird_sum(Tail, Result),
    computeResult(Head,Result).

Body:
The problem is not that it does not try the second clause. The problem is the second parameter in the computeResult/2 predicate. You write Result + Head*Head, etc. so that means that Prolog will try to unify a number (0) with something of the form +(Result,*(Head,Head)) and this obviously fails.

You can however easily modify the result like:

%base case
weird_sum([], 0).
%recursive case
weird_sum([Head|Tail], Result) :-
    weird_sum(Tail, SubResult),
    computeResult(Head,Adder),
    Result is SubResult+Adder.

%figuring out if number is large or small
computeResult(Head, Head*Head):-
    Head >= 5.
computeResult(Head, -abs(Head)):-
    Head =< 2.
computeResult(Head, 0) :-
    Head < 5,
    Head > 2.

You can also add cuts (!) to the conditions to prevent backtracking over the computeResult/2 clauses. In that case you can omit the checks in the last clause.

%figuring out if number is large or small
computeResult(Head, Head*Head):-
    Head >= 5,
    !.
computeResult(Head, -abs(Head)):-
    Head =< 2,
    !.
computeResult(_, 0).

Nevertheless it is more efficient to use an accumulator, like:

weird_sum(List, Result) :-
    weird_sum(List, 0, Result).

weird_sum([], Result, Result).
weird_sum([Head|Tail], SubResult, Result) :-
    computeResult(Head,Adder),
    SubResult2 is SubResult+Adder,
    weird_sum(Tail, SubResult2, Result).


问:
Angular 2 Child route module display the correct url but displays another component
I cleaned up my root route file, by creating a child custom module for routes, and here is the script:

```<code>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SigninComponent } from './signin/signin.component';
import { SignupComponent } from './signup/signup.component';

const childRoutes: Routes = [

    {path: 'signin', component: SigninComponent},

    {path: 'signup', component: SignupComponent}

];

@NgModule({
  imports: [
    RouterModule.forChild(childRoutes)
  ],
  exports:[RouterModule]
})
export class ChildRoutingModule { }
</code>```

The root route module now is:

```<code>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SigninComponent } from './auth/signin/signin.component';
import { SignupComponent } from './auth/signup/signup.component';
import { NotfoundComponent } from './notfound/notfound.component';
import { ChildRoutingModule } from './auth/auth.route'

const appRoutes: Routes = [
    {path: '', redirectTo:'/signup', pathMatch:'full'},

    {path: '**', component: NotfoundComponent}
];

@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes)
  ],
  exports:[RouterModule]
})
export class AppRoutingModule { }
</code>```

I imported the 2 route modules into the app.module.ts:

```<code>import ...
import ...
import { AppRoutingModule } from './routes'
import { ChildRoutingModule } from './auth/auth.route'
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    AppRoutingModule,
    ChildRoutingModule,
    BrowserModule,
    AuthModule,
    RouterModule
  ],
  providers: [AuthService],
  bootstrap: [AppComponent]
})
export class AppModule { }
</code>```

The problem now is on the startup component of the app that is the signup component, the url is correct: http://localhost:4200/signup but the displayed component is the 404 component which is defined in the root route component by {path: '**', component: NotfoundComponent}

To mention that no errors are displayed at the console at all

答: You need to import AppRoutingModule last. https://angular.io/docs/ts/latest/guide/router.html#!#routing-module-order

Body:
I cleaned up my root route file, by creating a child custom module for routes, and here is the script:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SigninComponent } from './signin/signin.component';
import { SignupComponent } from './signup/signup.component';

const childRoutes: Routes = [

    {path: 'signin', component: SigninComponent},

    {path: 'signup', component: SignupComponent}

];

@NgModule({
  imports: [
    RouterModule.forChild(childRoutes)
  ],
  exports:[RouterModule]
})
export class ChildRoutingModule { }

The root route module now is:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SigninComponent } from './auth/signin/signin.component';
import { SignupComponent } from './auth/signup/signup.component';
import { NotfoundComponent } from './notfound/notfound.component';
import { ChildRoutingModule } from './auth/auth.route'

const appRoutes: Routes = [
    {path: '', redirectTo:'/signup', pathMatch:'full'},

    {path: '**', component: NotfoundComponent}
];

@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes)
  ],
  exports:[RouterModule]
})
export class AppRoutingModule { }

I imported the 2 route modules into the app.module.ts:

import ...
import ...
import { AppRoutingModule } from './routes'
import { ChildRoutingModule } from './auth/auth.route'
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    AppRoutingModule,
    ChildRoutingModule,
    BrowserModule,
    AuthModule,
    RouterModule
  ],
  providers: [AuthService],
  bootstrap: [AppComponent]
})
export class AppModule { }

The problem now is on the startup component of the app that is the signup component, the url is correct: http://localhost:4200/signup but the displayed component is the 404 component which is defined in the root route component by {path: '**', component: NotfoundComponent}

To mention that no errors are displayed at the console at all


问:
Laravel 5.4 Eloquent relationship sorting
I have two database tables called deliverables, and deliverable_version.

Deliverable hasMany Deliverable_Version.

Deliverable has id column, and the model has a function to get the most recent version:

```<code>public function getRecentVersion()
    {
        $deliverable_version_max = $this->versions()->max('version');

        $deliverable_version = DeliverableVersion::where([
            'version'=>$deliverable_version_max,
            'deliverable_ID'=>$this->id,
        ])->first();

        return $deliverable_version;
    }
</code>```

Deliverable_version table has id, deliverable_ID, title, message, deadline, version, created_at, updated_at.

How I would perform an operation where I can:

Get all deliverables and the most recent version associated with the deliverable.

Sort the deliverables by it by the columns of the deliverable_version table (updated_at)

Paginate the result?

Here is my attempt at it, which isn't working because it selects all the versions when I join the tables, not just the recent version:

```<code>$deliverables = Accounts::find($owner_account_ID)->deliverables();
    $deliverables = $deliverables->join('deliverable_version', 'deliverable.id', '=', 'deliverable_version.deliverable_ID');
    $deliverables = $deliverables->search($search);
    $deliverables = $deliverables->orderBy('deliverable_version.updated_at', 'desc');
    $deliverables = $deliverables->paginate(4);
</code>```

Any help is appreciated. Thanks.

答:
```<code>in Accounts module add:

 public function deliverable_version(){
        return $this->hasMany('App\deliverable_version')->orderBy('update_at');
    }

in controller:

$deliverables = Accounts::find($owner_account_ID)->deliverables()>with('deliverable_version');
foreach($deliverables as $deliverable){
// last version
$deliverable = $deliverables->deliverable_version->last();
</code>```

Body:
I have two database tables called deliverables, and deliverable_version.

Deliverable hasMany Deliverable_Version.

Deliverable has id column, and the model has a function to get the most recent version:

public function getRecentVersion()
    {
        $deliverable_version_max = $this->versions()->max('version');

        $deliverable_version = DeliverableVersion::where([
            'version'=>$deliverable_version_max,
            'deliverable_ID'=>$this->id,
        ])->first();

        return $deliverable_version;
    }

Deliverable_version table has id, deliverable_ID, title, message, deadline, version, created_at, updated_at.

How I would perform an operation where I can:

Get all deliverables and the most recent version associated with the deliverable.

Sort the deliverables by it by the columns of the deliverable_version table (updated_at)

Paginate the result?

Here is my attempt at it, which isn't working because it selects all the versions when I join the tables, not just the recent version:

$deliverables = Accounts::find($owner_account_ID)->deliverables();
    $deliverables = $deliverables->join('deliverable_version', 'deliverable.id', '=', 'deliverable_version.deliverable_ID');
    $deliverables = $deliverables->search($search);
    $deliverables = $deliverables->orderBy('deliverable_version.updated_at', 'desc');
    $deliverables = $deliverables->paginate(4);

Any help is appreciated. Thanks.


问:
Autotest, RSpec 2 and Ruby 1.9.2-p0 - no output at all
I have started the book Continuous Testing with Ruby (B2.0 printing), but am running into immediate problems. Per the first chapter, I have created an empty Gem using Jeweler 1.5.1

```$ jeweler --rspec twits```

Running the specs manually with rake gives the correct failing output

```
$ rake spec
(in /Users/mfurtak/Documents/Programming/Ruby/twits)
/Users/mfurtak/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec rspec "spec/twits_spec.rb"
F

Failures:
  1) Twits fails
     Failure/Error: fail "Trying to get this working"
     Trying to get this working
     # ./spec/twits_spec.rb:5:in `block (2 levels) in '

Finished in 0.00176 seconds
1 example, 1 failure
rake aborted!
```

To get Autotest configured for RSpec 2, I have created ./autotest/discover.rb in the root of my project as described in the book and elsewhere with the following contents:

```<code>Autotest.add_discovery { "rspec2" }
</code>```

But when I attempt to run the RSpec (2.2.0) specs through autotest (ZenTest 4.4.0), I get no output at all.

```$ autotest```

This is all using Ruby 1.9.2-p0 through RVM (1.0.2). If I switch to Ruby 1.8.7-p302, things work as expected.

```
$ autotest
loading autotest/rspec2
bundle exec /Users/mfurtak/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -S /Users/mfurtak/.rvm/gems/ruby-1.8.7-p302/gems/rspec-core-2.2.1/bin/rspec --tty '/Users/mfurtak/Documents/Programming/Ruby/twits/spec/twits_spec.rb'
F

Failures:

  1) Twits fails
     Failure/Error: fail "Trying to get this working"
     Trying to get this working
     # ./spec/twits_spec.rb:5

Finished in 0.00036 seconds
1 example, 1 failure
```

答:
=]

I created this gem that is an alternative to Autotest that I think will help with your problem.
Called InfinityTest. (need RVM ok?)

For more information see:

https://github.com/tomas-stefano/infinity_test

If you have any problem let me know in gitub that I'll help you! =)

ContentLicense: CC BY-SA 2.5

Body:
I have started the book Continuous Testing with Ruby (B2.0 printing), but am running into immediate problems. Per the first chapter, I have created an empty Gem using Jeweler 1.5.1

$ jeweler --rspec twits

Running the specs manually with rake gives the correct failing output

$ rake spec
(in /Users/mfurtak/Documents/Programming/Ruby/twits)
/Users/mfurtak/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec rspec "spec/twits_spec.rb"
F

Failures:
  1) Twits fails
     Failure/Error: fail "Trying to get this working"
     Trying to get this working
     # ./spec/twits_spec.rb:5:in `block (2 levels) in '

Finished in 0.00176 seconds
1 example, 1 failure
rake aborted!

To get Autotest configured for RSpec 2, I have created ./autotest/discover.rb in the root of my project as described in the book and elsewhere with the following contents:

Autotest.add_discovery { "rspec2" }

But when I attempt to run the RSpec (2.2.0) specs through autotest (ZenTest 4.4.0), I get no output at all.

$ autotest

This is all using Ruby 1.9.2-p0 through RVM (1.0.2). If I switch to Ruby 1.8.7-p302, things work as expected.

$ autotest
loading autotest/rspec2
bundle exec /Users/mfurtak/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -S /Users/mfurtak/.rvm/gems/ruby-1.8.7-p302/gems/rspec-core-2.2.1/bin/rspec --tty '/Users/mfurtak/Documents/Programming/Ruby/twits/spec/twits_spec.rb'
F

Failures:

  1) Twits fails
     Failure/Error: fail "Trying to get this working"
     Trying to get this working
     # ./spec/twits_spec.rb:5

Finished in 0.00036 seconds
1 example, 1 failure


问:
Link not opening in system browser in ionic
I am in process of making an ionic application and trying to open a link in app using cordova.InAppBrowser but I get this error when I click it

```<code>Application Error
net::ERR_FILE_NOT_FOUND (file:///android_assets/www/(item.url))
</code>```

MY Code

```<code> <div ng-repeat="item in object.torrents" class="button-bar bar-dark" >
  <a onclick="window.open('(item.url)', '_system' );" class="button">Open</a>

</div>
</code>```

答: Use ng-click instead of onclick

Body:
I am in process of making an ionic application and trying to open a link in app using cordova.InAppBrowser but I get this error when I click it

Application Error
net::ERR_FILE_NOT_FOUND (file:///android_assets/www/(item.url))

MY Code

  Open

Body: Use ng-click instead of onclick


问:
Eclipse>WST>JSDT Javascript Refactoring Renaming variables working half of the time
In Eclipse (I am running 3.8.0 @ Linux (Mint 14 (Ubuntu (Debian))) at the moment), renaming variables using Refactor is an option that seems randomly available. For some code it's there, and for other code it's not.

I tried to see a pattern why some var declarations are up for renaming and others are not, but I haven't found it yet.

Why does refactor->rename not work for some code? How can I make this work?

You can see by the highlighted references that Eclipse is very aware of what should be refactored, so I don't understand what the problem is.

No problem:

Problem:

答:
You can always use Ctrl + 2 + R (Press R after appearing a small dropdown) to refactor the variable... [ Got it by chance ].

Update

working on Eclipse Neon... can't say about other older version. because it is the latest stable version at the time I am writing the answer.

Update 3-May-2017

one drawback is that it replaces all occurrences of that variable in the file.
special care is required.


问:
Input text field not showing on Ipad devices (Safari)
I have an input field in which I use ui-mask on. I was doing some QA and noticed that it shows when entering text on Ipad devices on Safari, I can see caret moving positions but i cannot see any text. This works fine on desktop browsers and mobile devices like nexus 5, samsung s6 but on ipad safari it doesn't work as expected.

I saw something online as regards to setting -webkit-user-select to text. I tried this and still it didn't work on ipad.

Would appreciate anyone who has any idea on how to resolve this bug

答:
Not sure why, but setting this rules to input's (well, page's actually) container helped in similar situation</p>

```<code>position: relative;
z-index: 1;
</code>```

Body:
Not sure why, but setting this rules to input's (well, page's actually) container helped in similar situation

position: relative;
z-index: 1;


问:
Button inside Nested Repeater
Please help me to fire the command of ItemCommand for child Repeater.

Here is my aspx code.

```<code><asp:Repeater ID="rpCompany" runat="server">
    <HeaderTemplate>
        <div id="accordion" class="details-accordion">
    </HeaderTemplate>
    <ItemTemplate>
        <h3 class="details-header clr">
            Company Name
        </h3>
        <div class="col-sm-12 details-content">
            <asp:Repeater ID="rpSO" runat="server">
                <HeaderTemplate>
                    <div id="SO">
                        <div id="accordion2" class="details-accordion">
                </HeaderTemplate>
                <ItemTemplate>
                    <h3 class="details-header clr">
                        SO Number
                    </h3>
                    <div class="col-xs-12 details-content">
                        <div class="col-xs-12 btn-center">
                            <asp:Button ID="btnSave" runat="server" Text="SAVE" CssClass="btn btn-primary btn-blue-save" CommandName="SAVE" />
                        </div>
                        <div class="clr"></div>
                        <div class="col-xs-12">
                            <asp:Label ID="lblErrorSave" runat="server" Text=""></asp:Label>
                        </div>
                    </div>
                </ItemTemplate>
                <FooterTemplate>
                    </div>
                </div>
                </FooterTemplate>
            </asp:Repeater>
        </div>
    </ItemTemplate>
    <FooterTemplate>
        </div>
    </FooterTemplate>
</asp:Repeater>
</code>```

And my aspx.vb code is

```<code>Private Sub rpSO_ItemCommand(sender As Object, e As RepeaterCommandEventArgs)
    If e.CommandName = "SAVE" Then

    End If
End Sub
</code>```

But it's not firing.

I already added OnItemCommand on my child repeater but it gives me an error.

I also added AddHandler rptSO.ItemCommand, AddressOf rpSO_ItemCommand in the Parent Repeater but still no luck.

Thanks in advance for the help.

答:
Solution:

Put the AddHandler in the Repeater Item Created.

This link helps me to solve my problem.

https://www.mindstick.com/Forum/45/itemcommand-event-in-nested-repeater-and-listview

Title: Button inside Nested Repeater

Body:
Please help me to fire the command of ItemCommand for child Repeater.

Here is my aspx code.

<asp:Repeater ID="rpCompany" runat="server">
    <HeaderTemplate>

    </HeaderTemplate>
    <ItemTemplate>

            Company Name

            <asp:Repeater ID="rpSO" runat="server">
                <HeaderTemplate>

                </HeaderTemplate>
                <ItemTemplate>

                        SO Number

                            <asp:Button ID="btnSave" runat="server" Text="SAVE" CssClass="btn btn-primary btn-blue-save" CommandName="SAVE" />

                            <asp:Label ID="lblErrorSave" runat="server" Text=""></asp:Label>

                </ItemTemplate>
                <FooterTemplate>

                </FooterTemplate>
            </asp:Repeater>

    </ItemTemplate>
    <FooterTemplate>

    </FooterTemplate>
</asp:Repeater>

And my aspx.vb code is

Private Sub rpSO_ItemCommand(sender As Object, e As RepeaterCommandEventArgs)
    If e.CommandName = "SAVE" Then

    End If
End Sub

But it's not firing.

I already added OnItemCommand on my child repeater but it gives me an error.

I also added AddHandler rptSO.ItemCommand, AddressOf rpSO_ItemCommand in the Parent Repeater but still no luck.

Thanks in advance for the help.


问:
Not understanding how to USE the fft library generated by altera's megacore library
Want to know what synthesizable VHDL code needs to be written in Quartus II to use the library. Note that the library has already been generated by the Megacore Wizard. I'm a complete beginner to FPGAs and VHDL so, apologies if this is obvious.

答:
Starting with an FFT IP core is quite a challenge if you have little to no experience with FPGAs of VHDL. You should start with a simple entity and simulation. Use an online tutorial.

MATLAB simulink and the HDL coder can help you make a design. The [Xilinx] HLS (high-level synthesis) C/C++ to HDL converter also can make you life easier.
In both cases there will be a learning curve.

As for the Altera FFT megacore: you should really read the official user guide. This states that you can actually have the core generator generate a testbench, which will show you how to instantiate the core.


问:
Is it possible to test whether a C define is declared in a gnu Makefile?
I want to include different directories in my build based on whether a #define is declared in a .h file in my project.  Is this possible or am I going about this completely wrong?</p>

答:
The other answers have explained why this is a bad idea. Nonetheless, one way to do it is by preprocessing a makefile fragment:

In foo.mk.in:

```<code>#ifdef FOO
FOO_DEFINED := y
#else
FOO_DEFINED := n
#endif
</code>```

In Makefile:

```<code>foo.mk: foo.mk.in
    $(CPP) $(CPPFLAGS) -o $@ $<
include foo.mk
ifeq ($(FOO_DEFINED),y)
$(warning FOO is defined)
else
$(warning FOO is not defined)
endif
</code>```

Body:
The other answers have explained why this is a bad idea. Nonetheless, one way to do it is by preprocessing a makefile fragment:

In foo.mk.in:

#ifdef FOO
FOO_DEFINED := y
#else
FOO_DEFINED := n
#endif

In Makefile:

foo.mk: foo.mk.in
    $(CPP) $(CPPFLAGS) -o $@ $<
include foo.mk
ifeq ($(FOO_DEFINED),y)
$(warning FOO is defined)
else
$(warning FOO is not defined)
endif


问:
High level data structures in html data attribute
I am happy that the html5 data attribute exists.

I can write a simple string into html attributes and access them via jquery.

But .... wouldn't it be nice to have more than a simple string?

Is there no way to encode JSON into these data attributes.

In my current use case I need to store a list of strings in a html5 data attribute.

答: You can put json as string in data attribute and use JSON.parse() to get it.


问:
Does the JIRA REST API have a limitation with number of JIRA ids in the JQL search?
I am running a request against the JIRA REST API and I am getting an error:

```<code> Response status code does not indicate success: 400 (Bad Request).
</code>```

I am thinking it has to do with a maximum number of items that can be in the JQL search query.

My query looks something like this:

search?jql=issue+in+('PROJ-741','PROJ-724','PROJ-851','PROJ-854','PROJ-856','PROJ-857','PROJ-980','PROJ-1133','PROJ-1132','PROJ-1071','PROJ-852','PROJ-727','PROJ-725','PROJ-853','PROJ-726','PROJ-434','PROJ-436','PROJ-433','PROJ-734','PROJ-733','PROJ-732','PROJ-182','PROJ-174','PROJ-173','PROJ-133','PROJ-301','PROJ-300','PROJ-281','PROJ-266','PROJ-253','PROJ-293','PROJ-287','PROJ-284','PROJ-276','PROJ-271','PROJ-262','PROJ-248','PROJ-214','PROJ-322','PROJ-323','PROJ-310','PROJ-332','PROJ-399','PROJ-600','PROJ-346','PROJ-389','PROJ-409','PROJ-521','PROJ-505','PROJ-490','PROJ-432','PROJ-486','PROJ-464','PROJ-438','PROJ-566','PROJ-534','PROJ-471','PROJ-178','PROJ-240','PROJ-210','PROJ-205','PROJ-655','PROJ-427','PROJ-419','PROJ-422','PROJ-426','PROJ-441','PROJ-442','PROJ-193','PROJ-194','PROJ-197','PROJ-195','PROJ-196','PROJ-513','PROJ-198','PROJ-514','PROJ-199','PROJ-516','PROJ-515','PROJ-200','PROJ-517','PROJ-201','PROJ-441','PROJ-188','PROJ-190','PROJ-189','PROJ-191','PROJ-192','PROJ-134','PROJ-213','PROJ-217','PROJ-219','PROJ-238','PROJ-237','PROJ-239','PROJ-221','PROJ-330','PROJ-418','PROJ-119','PROJ-463','PROJ-789','PROJ-331','PROJ-837','PROJ-959','PROJ-864','PROJ-957','PROJ-787','PROJ-445','PROJ-476','PROJ-786','PROJ-790','PROJ-791','PROJ-792')&startAt=0&maxResults=900&fields=labels,assignee,components,id,key,created,resolutiondate,customfield_10100,summary,issuetype,status,priority

I could try to batch these up into multiple queries, but I first wanted to see if there was any documented limit (I couldn't find anything mentioned in the documentation).

答:
There is no restriction on the JQL queries and fields has been mentioned within Atlassian Documentation.

But if the Query is too large to be encoded as a Query Param then you should instead POST to this resource.

Your JQL has used some reserved characters hence it is returning 400 Error.

I have corrected your Query which compiles correctly and returns 200 status.
Here it is:

```<code>search?jql=issue%20in%20('PROJ-741'%2C'PROJ-724'%2C'PROJ-851'%2C'PROJ-854'%2C'PROJ-856'%2C'PROJ-857'%2C'PROJ-980'%2C'PROJ-1133'%2C'PROJ-1132'%2C'PROJ-1071'%2C'PROJ-852'%2C'PROJ-727'%2C'PROJ-725'%2C'PROJ-853'%2C'PROJ-726'%2C'PROJ-434'%2C'PROJ-436'%2C'PROJ-433'%2C'PROJ-734'%2C'PROJ-733'%2C'PROJ-732'%2C'PROJ-182'%2C'PROJ-174'%2C'PROJ-173'%2C'PROJ-133'%2C'PROJ-301'%2C'PROJ-300'%2C'PROJ-281'%2C'PROJ-266'%2C'PROJ-253'%2C'PROJ-293'%2C'PROJ-287'%2C'PROJ-284'%2C'PROJ-276'%2C'PROJ-271'%2C'PROJ-262'%2C'PROJ-248'%2C'PROJ-214'%2C'PROJ-322'%2C'PROJ-323'%2C'PROJ-310'%2C'PROJ-332'%2C'PROJ-399'%2C'PROJ-600'%2C'PROJ-346'%2C'PROJ-389'%2C'PROJ-409'%2C'PROJ-521'%2C'PROJ-505'%2C'PROJ-490'%2C'PROJ-432'%2C'PROJ-486'%2C'PROJ-464'%2C'PROJ-438'%2C'PROJ-566'%2C'PROJ-534'%2C'PROJ-471'%2C'PROJ-178'%2C'PROJ-240'%2C'PROJ-210'%2C'PROJ-205'%2C'PROJ-655'%2C'PROJ-427'%2C'PROJ-419'%2C'PROJ-422'%2C'PROJ-426'%2C'PROJ-441'%2C'PROJ-442'%2C'PROJ-193'%2C'PROJ-194'%2C'PROJ-197'%2C'PROJ-195'%2C'PROJ-196'%2C'PROJ-513'%2C'PROJ-198'%2C'PROJ-514'%2C'PROJ-199'%2C'PROJ-516'%2C'PROJ-515'%2C'PROJ-200'%2C'PROJ-517'%2C'PROJ-201'%2C'PROJ-441'%2C'PROJ-188'%2C'PROJ-190'%2C'PROJ-189'%2C'PROJ-191'%2C'PROJ-192'%2C'PROJ-134'%2C'PROJ-213'%2C'PROJ-217'%2C'PROJ-219'%2C'PROJ-238'%2C'PROJ-237'%2C'PROJ-239'%2C'PROJ-221'%2C'PROJ-330'%2C'PROJ-418'%2C'PROJ-119'%2C'PROJ-463'%2C'PROJ-789'%2C'PROJ-331'%2C'PROJ-837'%2C'PROJ-959'%2C'PROJ-864'%2C'PROJ-957'%2C'PROJ-787'%2C'PROJ-445'%2C'PROJ-476'%2C'PROJ-786'%2C'PROJ-790'%2C'PROJ-791'%2C'PROJ-792')&maxResults=900&fields=labels%2Cassignee%2Ccomponents%2Cid%2Ckey%2Ccreated%2Cresolutiondate%2Ccustomfield_10100%2Csummary%2Cissuetype%2Cstatus%2Cpriority
</code>```

Body:
I am running a request against the JIRA REST API and I am getting an error:

 Response status code does not indicate success: 400 (Bad Request).

I am thinking it has to do with a maximum number of items that can be in the JQL search query.

My query looks something like this:

search?jql=issue+in+('PROJ-741','PROJ-724','PROJ-851','PROJ-854','PROJ-856','PROJ-857','PROJ-980','PROJ-1133','PROJ-1132','PROJ-1071','PROJ-852','PROJ-727','PROJ-725','PROJ-853','PROJ-726','PROJ-434','PROJ-436','PROJ-433','PROJ-734','PROJ-733','PROJ-732','PROJ-182','PROJ-174','PROJ-173','PROJ-133','PROJ-301','PROJ-300','PROJ-281','PROJ-266','PROJ-253','PROJ-293','PROJ-287','PROJ-284','PROJ-276','PROJ-271','PROJ-262','PROJ-248','PROJ-214','PROJ-322','PROJ-323','PROJ-310','PROJ-332','PROJ-399','PROJ-600','PROJ-346','PROJ-389','PROJ-409','PROJ-521','PROJ-505','PROJ-490','PROJ-432','PROJ-486','PROJ-464','PROJ-438','PROJ-566','PROJ-534','PROJ-471','PROJ-178','PROJ-240','PROJ-210','PROJ-205','PROJ-655','PROJ-427','PROJ-419','PROJ-422','PROJ-426','PROJ-441','PROJ-442','PROJ-193','PROJ-194','PROJ-197','PROJ-195','PROJ-196','PROJ-513','PROJ-198','PROJ-514','PROJ-199','PROJ-516','PROJ-515','PROJ-200','PROJ-517','PROJ-201','PROJ-441','PROJ-188','PROJ-190','PROJ-189','PROJ-191','PROJ-192','PROJ-134','PROJ-213','PROJ-217','PROJ-219','PROJ-238','PROJ-237','PROJ-239','PROJ-221','PROJ-330','PROJ-418','PROJ-119','PROJ-463','PROJ-789','PROJ-331','PROJ-837','PROJ-959','PROJ-864','PROJ-957','PROJ-787','PROJ-445','PROJ-476','PROJ-786','PROJ-790','PROJ-791','PROJ-792')&startAt=0&maxResults=900&fields=labels,assignee,components,id,key,created,resolutiondate,customfield_10100,summary,issuetype,status,priority

I could try to batch these up into multiple queries, but I first wanted to see if there was any documented limit (I couldn't find anything mentioned in the documentation).

Body:
There is no restriction on the JQL queries and fields has been mentioned within Atlassian Documentation.

But if the Query is too large to be encoded as a Query Param then you should instead POST to this resource.

Your JQL has used some reserved characters hence it is returning 400 Error.

I have corrected your Query which compiles correctly and returns 200 status.
Here it is:

search?jql=issue%20in%20('PROJ-741'%2C'PROJ-724'%2C'PROJ-851'%2C'PROJ-854'%2C'PROJ-856'%2C'PROJ-857'%2C'PROJ-980'%2C'PROJ-1133'%2C'PROJ-1132'%2C'PROJ-1071'%2C'PROJ-852'%2C'PROJ-727'%2C'PROJ-725'%2C'PROJ-853'%2C'PROJ-726'%2C'PROJ-434'%2C'PROJ-436'%2C'PROJ-433'%2C'PROJ-734'%2C'PROJ-733'%2C'PROJ-732'%2C'PROJ-182'%2C'PROJ-174'%2C'PROJ-173'%2C'PROJ-133'%2C'PROJ-301'%2C'PROJ-300'%2C'PROJ-281'%2C'PROJ-266'%2C'PROJ-253'%2C'PROJ-293'%2C'PROJ-287'%2C'PROJ-284'%2C'PROJ-276'%2C'PROJ-271'%2C'PROJ-262'%2C'PROJ-248'%2C'PROJ-214'%2C'PROJ-322'%2C'PROJ-323'%2C'PROJ-310'%2C'PROJ-332'%2C'PROJ-399'%2C'PROJ-600'%2C'PROJ-346'%2C'PROJ-389'%2C'PROJ-409'%2C'PROJ-521'%2C'PROJ-505'%2C'PROJ-490'%2C'PROJ-432'%2C'PROJ-486'%2C'PROJ-464'%2C'PROJ-438'%2C'PROJ-566'%2C'PROJ-534'%2C'PROJ-471'%2C'PROJ-178'%2C'PROJ-240'%2C'PROJ-210'%2C'PROJ-205'%2C'PROJ-655'%2C'PROJ-427'%2C'PROJ-419'%2C'PROJ-422'%2C'PROJ-426'%2C'PROJ-441'%2C'PROJ-442'%2C'PROJ-193'%2C'PROJ-194'%2C'PROJ-197'%2C'PROJ-195'%2C'PROJ-196'%2C'PROJ-513'%2C'PROJ-198'%2C'PROJ-514'%2C'PROJ-199'%2C'PROJ-516'%2C'PROJ-515'%2C'PROJ-200'%2C'PROJ-517'%2C'PROJ-201'%2C'PROJ-441'%2C'PROJ-188'%2C'PROJ-190'%2C'PROJ-189'%2C'PROJ-191'%2C'PROJ-192'%2C'PROJ-134'%2C'PROJ-213'%2C'PROJ-217'%2C'PROJ-219'%2C'PROJ-238'%2C'PROJ-237'%2C'PROJ-239'%2C'PROJ-221'%2C'PROJ-330'%2C'PROJ-418'%2C'PROJ-119'%2C'PROJ-463'%2C'PROJ-789'%2C'PROJ-331'%2C'PROJ-837'%2C'PROJ-959'%2C'PROJ-864'%2C'PROJ-957'%2C'PROJ-787'%2C'PROJ-445'%2C'PROJ-476'%2C'PROJ-786'%2C'PROJ-790'%2C'PROJ-791'%2C'PROJ-792')&maxResults=900&fields=labels%2Cassignee%2Ccomponents%2Cid%2Ckey%2Ccreated%2Cresolutiondate%2Ccustomfield_10100%2Csummary%2Cissuetype%2Cstatus%2Cpriority