问:
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>```

答:
Update the gstreamer library to version 1.10.4. The newer version of gstreamer has fixed this bug. To update modify the script 'update-gst.sh' as below
master_commit=git ls-remote git://anongit.freedesktop.org/git/gstreamer/$i | grep "1.10.4$" | awk '{print $1}'

Then run the script, after that do a clean build for os x first and then iOS.

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);


来源: stackexchange

问:
Extract a tar file using tar -xzvf
I want to extract a tar file that I obtained by using: curl -O https://github.com/fhcrc/seqmagick/archive/0.6.1.tar.gz
but when I try: tar -xzvf 0.6.1
I get tar: Error opening archive: Failed to open '0.6.1'

I see the file in the directory as 0.6.1.tar.gz and  I tried to do tar -xzvf 0.6.1.tar.gz but I get error Error exit delayed from previous errors.

Any suggestion will be much appreciated.

答:
If you open the file 0.6.1.tar.gz, you will see the following message

```<code><html><body>You are being <a href="https://codeload.github.com/fhcrc/seqmagick/tar.gz/0.6.1">redirected</a>.</body></html>
</code>```

It seems that curl does not follow the redirect. wget appears to work for this purpose.

```<code>wget https://github.com/fhcrc/seqmagick/archive/0.6.1.tar.gz
tar xfz 0.6.1.tar.gz
</code>```

ContentLicense: CC BY-SA 3.0

Title: Extract a tar file using tar -xzvf

Body:
If you open the file 0.6.1.tar.gz, you will see the following message

<html><body>You are being <a href="https://codeload.github.com/fhcrc/seqmagick/tar.gz/0.6.1">redirected</a>.</body></html>

It seems that curl does not follow the redirect. wget appears to work for this purpose.

wget https://github.com/fhcrc/seqmagick/archive/0.6.1.tar.gz
tar xfz 0.6.1.tar.gz


问:
take values between spaces and dot
i have these kind of strings,

```<code>1. "Drs. H. Ahmad Malik S.Kom S.E S.pd"
2. "H. Ahmad Abdul Malik S.Kom S.E S.pd"
</code>```

Expected output :

```<code>1. Ahmad Malik
2. Ahmad Abdul Malik
</code>```

can anyone help me to solve it, i've try with substring, patindex but always did not get the expected output

答:
Updated for new information

```<code>Declare @YourTable table (ID int,Name varchar(100))
Insert Into @YourTable values
(4,'Drs. H. Ahmad Malik A. N. S.Kom S.E S.pd'),
(1,'Drs. H. Ahmad Malik S.Kom S.E S.pd'),
(2,'H. Ahmad Abdul Malik S.Kom S.E S.pd'),
(3,'Drs. H. Ahmad Malik S.Kom S.E S.pd')

Select A.*
      ,C.*
 From  @YourTable A
 Cross Apply (Select * From [dbo].[udf-Str-Parse](A.Name,'S.Kom') Where RetSeq=1) B
 Cross Apply (
              Select NewString = Stuff((Select  ' ' +RetVal
                                        From (
                                              Select *,Excl=min(Flag) over (Order By RetSeq)
                                               From (Select *,Flag=case when charindex('.',RetVal)>0 then 1 else 0 end From [dbo].[udf-Str-Parse](B.RetVal,' ') ) C1
                                             ) C2
                                        Where Excl=0
                                        Order by RetSeq
                                        For XML Path ('')),1,1,'')
             ) C
</code>```

Returns

```<code>ID  Name                                        NewString
1   Drs. H. Ahmad Malik S.Kom S.E S.pd          Ahmad Malik
2   H. Ahmad Abdul Malik S.Kom S.E S.pd         Ahmad Abdul Malik
3   Drs. H. Ahmad Malik S.Kom S.E S.pd          Ahmad Malik
4   Drs. H. Ahmad Malik A. N. S.Kom S.E S.pd    Ahmad Malik A. N.   << Notice A. N.
</code>```

Title: take values between spaces and dot

Body:
i have these kind of strings,

1. "Drs. H. Ahmad Malik S.Kom S.E S.pd"
2. "H. Ahmad Abdul Malik S.Kom S.E S.pd"

Expected output :

1. Ahmad Malik
2. Ahmad Abdul Malik

can anyone help me to solve it, i've try with substring, patindex but always did not get the expected output

Body:
Updated for new information

Declare @YourTable table (ID int,Name varchar(100))
Insert Into @YourTable values
(4,'Drs. H. Ahmad Malik A. N. S.Kom S.E S.pd'),
(1,'Drs. H. Ahmad Malik S.Kom S.E S.pd'),
(2,'H. Ahmad Abdul Malik S.Kom S.E S.pd'),
(3,'Drs. H. Ahmad Malik S.Kom S.E S.pd')

Select A.*
      ,C.*
 From  @YourTable A
 Cross Apply (Select * From [dbo].[udf-Str-Parse](A.Name,'S.Kom') Where RetSeq=1) B
 Cross Apply (
              Select NewString = Stuff((Select  ' ' +RetVal
                                        From (
                                              Select *,Excl=min(Flag) over (Order By RetSeq)
                                               From (Select *,Flag=case when charindex('.',RetVal)>0 then 1 else 0 end From [dbo].[udf-Str-Parse](B.RetVal,' ') ) C1
                                             ) C2
                                        Where Excl=0
                                        Order by RetSeq
                                        For XML Path ('')),1,1,'')
             ) C

Returns

ID  Name                                        NewString
1   Drs. H. Ahmad Malik S.Kom S.E S.pd          Ahmad Malik
2   H. Ahmad Abdul Malik S.Kom S.E S.pd         Ahmad Abdul Malik
3   Drs. H. Ahmad Malik S.Kom S.E S.pd          Ahmad Malik
4   Drs. H. Ahmad Malik A. N. S.Kom S.E S.pd    Ahmad Malik A. N.   << Notice A. N.


问:
removing index.php in hmvc
i want to removing index.php in hmvc code igniter , when i type the url without index.php it's running well but when i process to other controller the url is automatically showing index.php after my codeigniter folder.

example i type :

```<code>localhost/ci_hmvc/user/login
</code>```

and the result when i process to other controller is :

```<code>localhost/ci_hmvc/index.php/user/dashboard
</code>```

and my .htaccess

```<code><IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_hmvc/index.php/$1 [L]
</IfModule>
</code>```

please any one help me

答:
put this code in .htaccess and place the htaccess file to the root of the folder..  </p>

```<code>DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
</code>```

Title: removing index.php in hmvc

Body:
i want to removing index.php in hmvc code igniter , when i type the url without index.php it's running well but when i process to other controller the url is automatically showing index.php after my codeigniter folder.

example i type :

localhost/ci_hmvc/user/login

and the result when i process to other controller is :

localhost/ci_hmvc/index.php/user/dashboard

and my .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_hmvc/index.php/$1 [L]
</IfModule>

please any one help me

Body:
put this code in .htaccess and place the htaccess file to the root of the folder..

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]


问:
Excel is not updating cells, options > formula > workbook calculation set to automatic
The usual answer to this question is to turn formulas to automatic.  This, in my case, is not working.

The second usual answer is that there is some macro that is affecting the Excel settings.  This is not the case with my problem (xlsx file).

Office 2010, my simple formula is not updating.

The formula is:

```<code>=IFERROR(TRIM(OFFSET(MainCopy!AG$3,$A77,0)),"")
</code>```

Everything else is updating in the spreadsheet.  The cell in MainCopy has the correct value.  The value displayed is the value before I updated the information on MainCopy.  When I put new information in MainCopy, the value on this page stayed the same.

I have:

Researched this issue on the internet - all solutions easy to find do not address this problem

Pressed F9 (did nothing)

Pressed Shift-F9 (did nothing)

Turned calculation to manual and hit all combinations of F9 (did nothing)

Turned calculation back to automatic (did nothing)

Saved with a new name (did nothing)

Re-updated data on MainCopy (did nothing)

Selected the cell and hit F9 (did nothing)

Put my cursor in the box and hit enter (UPDATED VALUE CORRECTLY)

I cannot put my cursor in each box and hit enter, there are too many boxes.  In addition, this is creating a major error trap in a spreadsheet that needs to be correct.  Is there some obscure setting that has been triggered in this file that is creating this issue?

答: Go to Files->Options->Formulas-> Calculation Options / Set Workbook calculation to Automatic</p>

Body:
The usual answer to this question is to turn formulas to automatic.  This, in my case, is not working.

The second usual answer is that there is some macro that is affecting the Excel settings.  This is not the case with my problem (xlsx file).

Office 2010, my simple formula is not updating.

The formula is:

=IFERROR(TRIM(OFFSET(MainCopy!AG$3,$A77,0)),"")

Everything else is updating in the spreadsheet.  The cell in MainCopy has the correct value.  The value displayed is the value before I updated the information on MainCopy.  When I put new information in MainCopy, the value on this page stayed the same.

I have:

Researched this issue on the internet - all solutions easy to find do not address this problem

Pressed F9 (did nothing)

Pressed Shift-F9 (did nothing)

Turned calculation to manual and hit all combinations of F9 (did nothing)

Turned calculation back to automatic (did nothing)

Saved with a new name (did nothing)

Re-updated data on MainCopy (did nothing)

Selected the cell and hit F9 (did nothing)

Put my cursor in the box and hit enter (UPDATED VALUE CORRECTLY)

I cannot put my cursor in each box and hit enter, there are too many boxes.  In addition, this is creating a major error trap in a spreadsheet that needs to be correct.  Is there some obscure setting that has been triggered in this file that is creating this issue?


问:
WP7 Native code?
anybody tried running native code on WP7?  http://blog.walshie.me/2010/11/

every time i call Invoke() method

```<code>object o = dynMethod.Invoke(null, new object[] { "Assembly.dll", new Guid("SomeGuidHere") });
</code>```

o returns 2147942593.  I can't find a proper description for this code either.

any help highly appreciated.

答: In the current incarnation of the platform, application developers (i.e. anyone not a device OEM) cannot write native code to run on Windows Phone devices.</p>

ContentLicense: CC BY-SA 2.5

Title: WP7 Native code?

Body:
anybody tried running native code on WP7?  http://blog.walshie.me/2010/11/

every time i call Invoke() method

object o = dynMethod.Invoke(null, new object[] { "Assembly.dll", new Guid("SomeGuidHere") });

o returns 2147942593.  I can't find a proper description for this code either.

any help highly appreciated.


问:
Angular multiple loading controller
i have problem with loading angular. This is my code:

```<code>    var myApp = angular.module("myApp", ["ngSanitize"]);
myApp.controller("MyAppController",
    function myAppController($scope, $http, $log, $rootScope, listsModel) {
        $scope.$log = $log;
    });

<div ng-app="myApp ">
    <div ng-controller="MyAppController">
        <script>console.log("A")</script>
        {{$log.debug("B")}}
    </div>
</div>
</code>```

This code write to console this: A, B, B
I think that angular loading multiple. Why? What can I do? Thanks

答: Your controller is not loaded twice it's the digest cycle that is running twice at the beginning when the application is loaded since watch is registered to every log so it will be printed twice. It will log twice only first time moreover if there is more digest cycle it will be logged again.</p>

Title: Angular multiple loading controller

Body:
i have problem with loading angular. This is my code:

    var myApp = angular.module("myApp", ["ngSanitize"]);
myApp.controller("MyAppController",
    function myAppController($scope, $http, $log, $rootScope, listsModel) {
        $scope.$log = $log;
    });

        {{$log.debug("B")}}

This code write to console this: A, B, B
I think that angular loading multiple. Why? What can I do? Thanks


问:
Processing a GET request followed by a PUT in Python
I am attempting to write a Python script which will allow me to process a GET request followed by a PUT based on the data received back from that same GET request. I would also need to run through this process for several different "members" so I am sure I will need to set up a "for" loop. There is a particular field that I need to change for several different "members" but the surrounding data that these members return may be different every time. For example, a GET request I would normally process using a Python script may return something like this:

```<code>{
"member": {
    "id": 12233444,
    "code": null,
    "code2": null,
    "code3": null,
    "state": "active",
    "cost_quarter": null,
    "master_id": 818667,
    "timeout_period": 2000,
    "enable_for_change": true,
    "is_prohibited": false,
    "site_id": 5544,
}}
</code>```

I would then like to take this data, change the value for "timeout_period", and submit a PUT request. Typically, in the past, I have used the requests library in Python to process a GET request but for something like this, I am left a little puzzled. If someone could help, I would greatly appreciate it. Thanks.

答:
To make a PUT request to change the timeout period of the member with id 12233444 to 3000, you would do something like:

```<code>url = 'your_url/12233444'
updated_member = {
  "member": {
      "id": 12233444,
      "code": null,
      "code2": null,
      "code3": null,
      "state": "active",
      "cost_quarter": null,
      "master_id": 818667,
      "timeout_period": 3000,
      "enable_for_change": true,
      "is_prohibited": false,
      "site_id": 5544,
  }}
requests.put(url, data=updated_member)
</code>```

Body:
I am attempting to write a Python script which will allow me to process a GET request followed by a PUT based on the data received back from that same GET request. I would also need to run through this process for several different "members" so I am sure I will need to set up a "for" loop. There is a particular field that I need to change for several different "members" but the surrounding data that these members return may be different every time. For example, a GET request I would normally process using a Python script may return something like this:

{
"member": {
    "id": 12233444,
    "code": null,
    "code2": null,
    "code3": null,
    "state": "active",
    "cost_quarter": null,
    "master_id": 818667,
    "timeout_period": 2000,
    "enable_for_change": true,
    "is_prohibited": false,
    "site_id": 5544,
}}

I would then like to take this data, change the value for "timeout_period", and submit a PUT request. Typically, in the past, I have used the requests library in Python to process a GET request but for something like this, I am left a little puzzled. If someone could help, I would greatly appreciate it. Thanks.

Body:
To make a PUT request to change the timeout period of the member with id 12233444 to 3000, you would do something like:

url = 'your_url/12233444'
updated_member = {
  "member": {
      "id": 12233444,
      "code": null,
      "code2": null,
      "code3": null,
      "state": "active",
      "cost_quarter": null,
      "master_id": 818667,
      "timeout_period": 3000,
      "enable_for_change": true,
      "is_prohibited": false,
      "site_id": 5544,
  }}
requests.put(url, data=updated_member)


问:
Check if timestamp older than 30 seconds
I am trying to determine if a timestamp is older than 30 seconds, but for some reason it is coming back as older than 30 seconds when it hasn't even been a couple seconds. </p>

<p>Example: https://ideone.com/KLIIBz </p>

```<code>public static Boolean cooldown(int id) {

    Calendar now = Calendar.getInstance();
    now.add(Calendar.SECOND, -secondsAgo);
    long timeAgo = now.getTimeInMillis();
    if ( cooldown.containsKey(id) ) {

        System.out.println(cooldown.get(id) + " | " + timeAgo);

        // Stored timestamp always older than timeAgo
        if ( cooldown.get(id) < timeAgo ) {

            cooldown.remove(id);

        } else {

            // This code should be executed, as I am running the function one after another from same UUID not even a second or two apart.
            return false;

        }

    }

    now = Calendar.getInstance();
    cooldown.put(id, now.getTimeInMillis());

    return true;

}
</code>```

答:
tl;dr

```<code>Duration
.between( then , Instant.now() )
.toNanos()
>
Duration
.ofSeconds( 30 )
.toNanos()
</code>```

Using java.time

You are using troublesome old date-time classes that are now legacy, supplanted by the java.time classes.

The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction).

```<code>Instant start = Instant.now();
…
Instant stop = Instant.now();
</code>```

Capture the span of time in between the start and stop as a Duration.

```<code>Duration duration = Duration.between( start , stop );
</code>```

Represent your limit of 30 seconds.

```<code>Duration limit = Duration.ofSeconds( 30 );
</code>```

Compare by calling the Comparable method of Duration::compareTo.

```<code>Boolean exceededLimit = ( duration.compareTo( limit ) > 0 );
</code>```

By the way, having a collection and a method both named cooldown is not helpful.

About java.time

The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.

The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.

To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.

Where to obtain the java.time classes?

Java SE 8 and SE 9 and later

Built-in.

Part of the standard Java API with a bundled implementation.

Java 9 adds some minor features and fixes.

Java SE 6 and SE 7

Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.

Android

The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically.

See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.

Body:
I am trying to determine if a timestamp is older than 30 seconds, but for some reason it is coming back as older than 30 seconds when it hasn't even been a couple seconds.

Example: https://ideone.com/KLIIBz

public static Boolean cooldown(int id) {

    Calendar now = Calendar.getInstance();
    now.add(Calendar.SECOND, -secondsAgo);
    long timeAgo = now.getTimeInMillis();
    if ( cooldown.containsKey(id) ) {

        System.out.println(cooldown.get(id) + " | " + timeAgo);

        // Stored timestamp always older than timeAgo
        if ( cooldown.get(id) < timeAgo ) {

            cooldown.remove(id);

        } else {

            // This code should be executed, as I am running the function one after another from same UUID not even a second or two apart.
            return false;

        }

    }

    now = Calendar.getInstance();
    cooldown.put(id, now.getTimeInMillis());

    return true;

}

Body:
tl;dr

Duration
.between( then , Instant.now() )
.toNanos()
>
Duration
.ofSeconds( 30 )
.toNanos()

Using java.time

You are using troublesome old date-time classes that are now legacy, supplanted by the java.time classes.

The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction).

Instant start = Instant.now();
…
Instant stop = Instant.now();

Capture the span of time in between the start and stop as a Duration.

Duration duration = Duration.between( start , stop );

Represent your limit of 30 seconds.

Duration limit = Duration.ofSeconds( 30 );

Compare by calling the Comparable method of Duration::compareTo.

Boolean exceededLimit = ( duration.compareTo( limit ) > 0 );

By the way, having a collection and a method both named cooldown is not helpful.

About java.time

The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.

The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.

To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.

Where to obtain the java.time classes?

Java SE 8 and SE 9 and later

Built-in.

Part of the standard Java API with a bundled implementation.

Java 9 adds some minor features and fixes.

Java SE 6 and SE 7

Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.

Android

The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically.

See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.

ContentLicense: CC BY-SA 4.0


问:
Pandas: Multiplying two columns of same dataframe thats dependent on third column
How can I multiply two columns of within a same dataframe? My dataframe looks like below image and I want to output like this. However, I cannot find how to multiply two columns that are dependent on first row of same dataframe. I would really appreciate some help on this.

```<code>request                            totalbytes
/login                              8520
/shuttle/countdown/                 7970
/shuttle/countdown/liftoff.html     0
</code>```

So far my output is below, but how can I get unique rows.

答:
Please edit your title because it's very misleading.

Also, to answer your question, pandas has a handy drop_duplicates method. I strongly suggest you check it out.

In a nutshell, the method literally drops all duplicate rows and returns a new DataFrame. Optionally, you can make the method only consider certain rows - details can be found in the docs.

In your case, you could simply do:

```<code>df2 = df2.drop_duplicates()[['requests', 'totalbytes']]
</code>```

Column indexing is totally optional, but I added them because I thought you wanted only those two columns in your final output.

Body:
How can I multiply two columns of within a same dataframe? My dataframe looks like below image and I want to output like this. However, I cannot find how to multiply two columns that are dependent on first row of same dataframe. I would really appreciate some help on this.

request                            totalbytes
/login                              8520
/shuttle/countdown/                 7970
/shuttle/countdown/liftoff.html     0

So far my output is below, but how can I get unique rows.

Body:
Please edit your title because it's very misleading.

Also, to answer your question, pandas has a handy drop_duplicates method. I strongly suggest you check it out.

In a nutshell, the method literally drops all duplicate rows and returns a new DataFrame. Optionally, you can make the method only consider certain rows - details can be found in the docs.

In your case, you could simply do:

df2 = df2.drop_duplicates()[['requests', 'totalbytes']]

Column indexing is totally optional, but I added them because I thought you wanted only those two columns in your final output.


问:
git - how to set a remote branch out of a branch in upstream?
Use case - I have a code base on github, which has several branches.
e.g. developer, integration, regression, production, etc.
I usually use this command to add remote branch: git remote add upstream <repo link>.git

So, git remote -v shows as below:

```<code>upstream        <repo link>.git (fetch)
upstream        <repo link>.git (push)
</code>```

but if remote has a branch then what command should I use to set to that branch to?

答:
Run git fetch or git pull to bring up the remote changes including new branches.

Run git branch -a to list down all the remote branches.

To move or work with fetched remote branch use

```<code>Syntax: git checkout -t remotes/upstream/branchname
Example: git checkout -t remotes/origin/branchname
</code>```

Here -t will create local branch with upstream branch mapping. So the next push/pull/fetch operation will not ask you to run git branch --set-upstream-to sometime.

Body:
Use case - I have a code base on github, which has several branches.
e.g. developer, integration, regression, production, etc.
I usually use this command to add remote branch: git remote add upstream <repo link>.git

So, git remote -v shows as below:

upstream        <repo link>.git (fetch)
upstream        <repo link>.git (push)

but if remote has a branch then what command should I use to set to that branch to?

Body:
Run git fetch or git pull to bring up the remote changes including new branches.

Run git branch -a to list down all the remote branches.

To move or work with fetched remote branch use

Syntax: git checkout -t remotes/upstream/branchname
Example: git checkout -t remotes/origin/branchname

Here -t will create local branch with upstream branch mapping. So the next push/pull/fetch operation will not ask you to run git branch --set-upstream-to sometime.


问:
I am getting error while importing model in maya
I bought a model in fbx form and I want to do some animation on that model . When I tried to import the model in Maya software I got an error:

  1.The imported scene has no initial binding position (Bind Pose) for the skin. The plug-in will compute one automatically. However, running the 'Go To Bind Pose' command may create unexpected results.
2. The plug-in does not support the following material types:
    Material  will be imported as a Phong material.

答:
You have missed to export the Bind Pose.

Export that along with the model and you will get your error fixed.

No default Bind Pose is assigned by default so you should export along with the model.

Try using baking method to export.


问:
Identifying unique visitors from web log
I am currently have a project analysing web logs of a website using machine learning. I am cleaning the data and want to identify unique visitors to this site.

I don't have much experience in dealing with web logs, but it is obvious to see that when a user visits, several files were retrieved (for example the records in column cs.uri.stem shown below).

My questions, how about when a user goes through several pages (like went to page B from a link in page A)? How can I know he's behaviours on this site?

Additionally, can anyone suggest any great python library that helps analysing web logs?

Much appreciated!!!

```<code>         date     time        s.ip cs.method cs.uri.stem                                                               cs.uri.query s.port cs.username         c.ip sc.status sc.substatus sc.win32.status time.taken device            os          browser
1  2014-08-05 00:00:03 10.130.0.12       GET /                                                                                -     80           - 67.205.67.76       200            0               0       1391 Spider         Other   PingdomBot_1.4
2  2014-08-05 00:00:11 10.130.0.12       GET /about-the-hotel.aspx                                                                -     80           -  70.56.59.43       200            0               0       1194     PC Mac_OS_X_10.8     Firefox_31.0
3  2014-08-05 00:00:11 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/a-hotel-unlike-any-others.ashx            -     80           -  70.56.59.43       200            0               0        976     PC Mac_OS_X_10.8     Firefox_31.0
4  2014-08-05 00:00:12 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/0713-ExComTeam.ashx                       -     80           -  70.56.59.43       200            0               0       1620     PC Mac_OS_X_10.8     Firefox_31.0
5  2014-08-05 00:00:12 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/vivienne-tam.ashx                    -     80           -  70.56.59.43       200            0               0       1713     PC Mac_OS_X_10.8     Firefox_31.0
6  2014-08-05 00:00:12 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/william-lim.ashx                     -     80           -  70.56.59.43       200            0               0       2387     PC Mac_OS_X_10.8     Firefox_31.0
7  2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/barney-cheng.ashx                    -     80           -  70.56.59.43       200            0               0       2180     PC Mac_OS_X_10.8     Firefox_31.0
8  2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/tommy-li.ashx                        -     80           -  70.56.59.43       200            0               0       1146     PC Mac_OS_X_10.8     Firefox_31.0
9  2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/yang-rutherford.ashx                 -     80           -  70.56.59.43       200            0               0        869     PC Mac_OS_X_10.8     Firefox_31.0
10 2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/justin_wong_img1.ashx                -     80           -  70.56.59.43       200            0               0        845     PC Mac_OS_X_10.8     Firefox_31.0
</code>```

答: It may be a good idea to look at pandas library. Once you have loaded data using pandas (see example here), it should be straight forward to find unique elements conditioned on one or multiple columns, example here.

Body:
I am currently have a project analysing web logs of a website using machine learning. I am cleaning the data and want to identify unique visitors to this site.

I don't have much experience in dealing with web logs, but it is obvious to see that when a user visits, several files were retrieved (for example the records in column cs.uri.stem shown below).

My questions, how about when a user goes through several pages (like went to page B from a link in page A)? How can I know he's behaviours on this site?

Additionally, can anyone suggest any great python library that helps analysing web logs?

Much appreciated!!!

         date     time        s.ip cs.method cs.uri.stem                                                               cs.uri.query s.port cs.username         c.ip sc.status sc.substatus sc.win32.status time.taken device            os          browser
1  2014-08-05 00:00:03 10.130.0.12       GET /                                                                                -     80           - 67.205.67.76       200            0               0       1391 Spider         Other   PingdomBot_1.4
2  2014-08-05 00:00:11 10.130.0.12       GET /about-the-hotel.aspx                                                                -     80           -  70.56.59.43       200            0               0       1194     PC Mac_OS_X_10.8     Firefox_31.0
3  2014-08-05 00:00:11 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/a-hotel-unlike-any-others.ashx            -     80           -  70.56.59.43       200            0               0        976     PC Mac_OS_X_10.8     Firefox_31.0
4  2014-08-05 00:00:12 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/0713-ExComTeam.ashx                       -     80           -  70.56.59.43       200            0               0       1620     PC Mac_OS_X_10.8     Firefox_31.0
5  2014-08-05 00:00:12 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/vivienne-tam.ashx                    -     80           -  70.56.59.43       200            0               0       1713     PC Mac_OS_X_10.8     Firefox_31.0
6  2014-08-05 00:00:12 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/william-lim.ashx                     -     80           -  70.56.59.43       200            0               0       2387     PC Mac_OS_X_10.8     Firefox_31.0
7  2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/barney-cheng.ashx                    -     80           -  70.56.59.43       200            0               0       2180     PC Mac_OS_X_10.8     Firefox_31.0
8  2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/tommy-li.ashx                        -     80           -  70.56.59.43       200            0               0       1146     PC Mac_OS_X_10.8     Firefox_31.0
9  2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/yang-rutherford.ashx                 -     80           -  70.56.59.43       200            0               0        869     PC Mac_OS_X_10.8     Firefox_31.0
10 2014-08-05 00:00:14 10.130.0.12       GET /~/media/Images/Hotel_ICON_revamp/about+us/icon/justin_wong_img1.ashx                -     80           -  70.56.59.43       200            0               0        845     PC Mac_OS_X_10.8     Firefox_31.0


问:
Can Android 4.4 support cipher with SHA256?
I am working on a device running Android 4.4 (API level 19). But I need to develop an application connecting to a server only support TLSv1.2 and cipher of SHA256. I tried creating the SSL context with the legacy apache library and the updated apache 4.4.1.2 (cz.msebera.android). After creating the context and I get the supported cipher, nothing of them contains SHA256. The program is running fine on other Android 5.0+ devices.

My question is that any way I can support TLSv1.2 and cipher SHA256 on an Android 4.4 device?

Thanks.

答:
... running Android 4.4 (API level 19)

According to the documentation of SSLSocket any ciphers using SHA-256 as HMAC are only available since API level 20.


问:
android studio how to import custom java class from other module(package)?
i'm trying to use opensource android project

https://github.com/ksoichiro/Android-ObservableScrollView

so i cloned library module(there exist ObservableGridView, ...)

but i can't import that libraries... i don't know what is is and how to do. please help me.

but... i don't know how can i show my problem. i'm working in develop company so this code should not be shown...

答:
1) First of all keep library parallel with your android project

For eg: My library name is mylibs and it is located under D:\Android_Workspace

So My project must be located under D:\Android_Workspace and my android project's name is MyApp

But both will be parally  located

2) Ill recommend you to see this video => https://www.youtube.com/watch?v=1MyBO9z7ojk

It will explain  all steps clearly


问:
Get last entered record for each item from mysql
how to join t_detail and t_header mysql, by group by item, by taking the last data record ?

```<code>id | doc | item | price
1  | 002 | asz  | 1200
2  | 002 | aqw  | 3000
3  | 002 | qwe  | 1300
4  | 005 | qwe  | 1000
5  | 005 | aqw  | 2000
</code>```

output

```<code>id | doc | item | price
1  | 002 | asz  | 1200
4  | 005 | qwe  | 1000
5  | 005 | aqw  | 2000
</code>```

答:
Try this: expanding on @Kushan's answer</p>

```<code>SELECT * FROM table t1
WHERE id IN (SELECT MAX(id) FROM table t2
WHERE t2.item = t1.item GROUP BY item )
</code>```

Body:
how to join t_detail and t_header mysql, by group by item, by taking the last data record ?

id | doc | item | price
1  | 002 | asz  | 1200
2  | 002 | aqw  | 3000
3  | 002 | qwe  | 1300
4  | 005 | qwe  | 1000
5  | 005 | aqw  | 2000

output

id | doc | item | price
1  | 002 | asz  | 1200
4  | 005 | qwe  | 1000
5  | 005 | aqw  | 2000

Body:
Try this: expanding on @Kushan's answer

SELECT * FROM table t1
WHERE id IN (SELECT MAX(id) FROM table t2
WHERE t2.item = t1.item GROUP BY item )


问:
sql left join: always return left table columns, no matter the condition
I've got two tables:

account_settings

This table uses the settings.id field as an FK to store the users custom settings (the settings table below has the name of the setting and the default value)

```<code>    Column    |           Type           |                           Modifiers
--------------+--------------------------+---------------------------------------------------------------
 id           | integer                  | not null default nextval('account_settings_id_seq'::regclass)
 user_id      | uuid                     | not null
 setting_id   | integer                  | not null
 value        | text                     |
</code>```

settings:

This table holds all the available settings. E.g weekly_email, app_notifications, block_user, etc...It also holds the default value for each of them.

```<code>     Column     |           Type           |                       Modifiers
----------------+--------------------------+-------------------------------------------------------
 id             | integer                  | not null default nextval('settings_id_seq'::regclass)
 key            | text                     | not null
 frontend_label | text                     |
 default_value  | text                     |
</code>```

I'm using the property bag schema design to store user settings for our app! It will include notification settings, email settings, etc...

Is it possible to have a query that always returns the settings columns, even when you add a where statement in there (the where statement is there for querying for the account_settings by user_id)?

I'm trying to get an accounts customs settings, as well as the LEFT JOIN the settings table for the default values & labels.

Here is what I have now:

```<code>select account_settings.*, settings.* from settings
LEFT JOIN account_settings
ON settings.id = account_settings.id
where account_settings.user_id = 'UUID_HERE';
</code>```

This won't return the the settings table values though! It will only return the settings values if the settings.id column is referenced in the account_settings.setting_id column.

答:
remove your where condition put it with join on condition</p>

```<code> select account_settings.*, settings.* from settings
    LEFT JOIN account_settings
    ON settings.id = account_settings.id and account_settings.user_id = 'UUID_HERE';
</code>```

Body:
I've got two tables:

account_settings

This table uses the settings.id field as an FK to store the users custom settings (the settings table below has the name of the setting and the default value)

    Column    |           Type           |                           Modifiers
--------------+--------------------------+---------------------------------------------------------------
 id           | integer                  | not null default nextval('account_settings_id_seq'::regclass)
 user_id      | uuid                     | not null
 setting_id   | integer                  | not null
 value        | text                     |

settings:

This table holds all the available settings. E.g weekly_email, app_notifications, block_user, etc...It also holds the default value for each of them.

     Column     |           Type           |                       Modifiers
----------------+--------------------------+-------------------------------------------------------
 id             | integer                  | not null default nextval('settings_id_seq'::regclass)
 key            | text                     | not null
 frontend_label | text                     |
 default_value  | text                     |

I'm using the property bag schema design to store user settings for our app! It will include notification settings, email settings, etc...

Is it possible to have a query that always returns the settings columns, even when you add a where statement in there (the where statement is there for querying for the account_settings by user_id)?

I'm trying to get an accounts customs settings, as well as the LEFT JOIN the settings table for the default values & labels.

Here is what I have now:

select account_settings.*, settings.* from settings
LEFT JOIN account_settings
ON settings.id = account_settings.id
where account_settings.user_id = 'UUID_HERE';

This won't return the the settings table values though! It will only return the settings values if the settings.id column is referenced in the account_settings.setting_id column.

Body:
remove your where condition put it with join on condition

 select account_settings.*, settings.* from settings
    LEFT JOIN account_settings
    ON settings.id = account_settings.id and account_settings.user_id = 'UUID_HERE';


问:
How to achieve this effect? its about borders/lines
https://codepen.io/anon/pen/NpoevM

http://imgur.com/a/OQ3cu

I want to have the small lines to separate the boxes. I was thinking about how to make the lines like in the picture. I was thinking using borders or span but having trouble

#third {
  height: 55%;
  width: 40%;
  display: flex;
  flex-direction: column;
  float: right;
}
.t-row {
  height: 100%;
  display: flex;
}
.tbox {
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.fa {
  font-size: 5em !important;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><section id="third">
  <div class="hr-lines">
    <hr class="icon-sep">
  </div>
  <div class="t-row">
    <div class="tbox tb-one">
      <i class="fa fa-home" aria-hidden="true"></i>
      <h1 class="t-text">Home</h1>
    </div>
    <div class="tbox tb-two">
      <i class="fa fa-info-circle" aria-hidden="true"></i>
      <h1 class="t-text">About</h1>
    </div>
  </div>
  <div class="t-row">
    <div class="tbox tb-three">
      <i class="fa fa-book" aria-hidden="true"></i>
      <h1 class="t-text">Work</h1>
    </div>
    <div class="tbox tb-four">
      <i class="fa fa-envelope" aria-hidden="true"></i>
      <h1 class="t-text">Hire</h1>
    </div>
  </div>
</section></code>```

答:
You can use a '+' inside a span and position / style it

#third {
 height: 55%;
 width: 40%;
 display: flex;
 flex-direction: column;
 float: right;
  position:relative;
}

.t-row {
 height: 100%;
 display: flex;
}

.tbox {
 width: 50%;
 display: flex;
 flex-direction: column;
 justify-content: center;
 align-items: center;
}

.fa {
 font-size: 5em !important;
}

.lines { position:absolute; font-size:150px; top:17%; left:40% }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">

<section id="third">
  <span class="lines">+</span>
  <div class="t-row">
   <div class="tbox tb-one">
    <i class="fa fa-home" aria-hidden="true"></i>
    <h1 class="t-text">Home</h1>
   </div>
   <div class="tbox tb-two">
    <i class="fa fa-info-circle" aria-hidden="true"></i>
    <h1 class="t-text">About</h1>
   </div>
  </div>
  <div class="t-row">
   <div class="tbox tb-three">
    <i class="fa fa-book" aria-hidden="true"></i>
    <h1 class="t-text">Work</h1>
   </div>
   <div class="tbox tb-four">
    <i class="fa fa-envelope" aria-hidden="true"></i>
    <h1 class="t-text">Hire</h1>
   </div>
  </div>
 </section></code>```

Body:
https://codepen.io/anon/pen/NpoevM

http://imgur.com/a/OQ3cu

I want to have the small lines to separate the boxes. I was thinking about how to make the lines like in the picture. I was thinking using borders or span but having trouble

#third {
  height: 55%;
  width: 40%;
  display: flex;
  flex-direction: column;
  float: right;
}
.t-row {
  height: 100%;
  display: flex;
}
.tbox {
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.fa {
  font-size: 5em !important;
}

Home

About

Work

Hire

Body:
You can use a '+' inside a span and position / style it

#third {
 height: 55%;
 width: 40%;
 display: flex;
 flex-direction: column;
 float: right;
  position:relative;
}

.t-row {
 height: 100%;
 display: flex;
}

.tbox {
 width: 50%;
 display: flex;
 flex-direction: column;
 justify-content: center;
 align-items: center;
}

.fa {
 font-size: 5em !important;
}

.lines { position:absolute; font-size:150px; top:17%; left:40% }

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">

<section id="third">
  <span class="lines">+</span>
  <div class="t-row">
   <div class="tbox tb-one">
    <i class="fa fa-home" aria-hidden="true"></i>
    <h1 class="t-text">Home</h1>
   </div>
   <div class="tbox tb-two">
    <i class="fa fa-info-circle" aria-hidden="true"></i>
    <h1 class="t-text">About</h1>
   </div>
  </div>
  <div class="t-row">
   <div class="tbox tb-three">
    <i class="fa fa-book" aria-hidden="true"></i>
    <h1 class="t-text">Work</h1>
   </div>
   <div class="tbox tb-four">
    <i class="fa fa-envelope" aria-hidden="true"></i>
    <h1 class="t-text">Hire</h1>
   </div>
  </div>
 </section>


问:
Splash Screen image background in LinearLayout not fit
I used an image as a background of LinearLayout in splash screen activity but it show not fit for the screen. I don't know how to use attribute for it to stretching it.</p>

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_splash"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.myproject.SplashActivity"
    android:orientation="horizontal"
    android:background="@drawable/my_image_background">

</LinearLayout>
</code>```

答:
The proper way is this so use this instead, in your styles.xml add this:

```<code> <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
</style>
</code>```

And in your Manifest file add this

```<code>  <activity
        android:name=".SplashActivity"
        android:theme="@style/SplashTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</code>```

and  @drawable/splash could be like

```<code><?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
    <!-- The background color, preferably the same as your normal theme -->
    <item android:drawable="@drawable/splashscreen"/>
    <!-- Your product logo - 144dp color version of your app icon -->
    <item>
        <bitmap
            android:src="@drawable/splash_logo"
            android:gravity="center"/>
    </item>
</layer-list>
</code>```

Body:
I used an image as a background of LinearLayout in splash screen activity but it show not fit for the screen. I don't know how to use attribute for it to stretching it.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_splash"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.myproject.SplashActivity"
    android:orientation="horizontal"
    android:background="@drawable/my_image_background">

</LinearLayout>

Body:
The proper way is this so use this instead, in your styles.xml add this:

 <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
</style>

And in your Manifest file add this

  <activity
        android:name=".SplashActivity"
        android:theme="@style/SplashTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

and  @drawable/splash could be like

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
    <!-- The background color, preferably the same as your normal theme -->
    <item android:drawable="@drawable/splashscreen"/>
    <!-- Your product logo - 144dp color version of your app icon -->
    <item>
        <bitmap
            android:src="@drawable/splash_logo"
            android:gravity="center"/>
    </item>
</layer-list>


问:
EXTJS6.0 Build expandable row grid with column names coming from store data
I want to build a grid table as shown in the image in Extjs6.0, i have built basic grid with static column names and grid data coming from store but want to fetch column names from store and also have expandable rows. Any suggestions on how to approach it would be grateful.

Store:

```<code>Ext.define('Xmlgrid.store.Books', {
extend: 'Ext.data.Store',
alias: 'store.books',
requires: [
    'Ext.data.reader.Xml'
],
fiels:['-skillID','name','shortName','description','inspectionSkillInd','passdownInd'
       ],
data:{
    skill: [
              {
                "-skillId": "skill1",
                "name": "B2",
                "shortName": "00",
                "description": "B2",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill2",
                "name": "B1",
                "shortName": "01",
                "description": "B1",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill3",
                "name": "AIMS",
                "shortName": "02",
                "description": "AIMS",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill4",
                "name": "CAT A",
                "shortName": "03",
                "description": "CAT A",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill8",
                "name": "RADIO",
                "shortName": "07",
                "description": "RADIO",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill9",
                "name": "8",
                "shortName": "08",
                "description": "TOOL AND DIE",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill10",
                "name": "9",
                "shortName": "09",
                "description": "COMPOSITE REPAIR",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill11",
                "name": "10",
                "shortName": "10",
                "description": "SHOP SUPPORT",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "8a8a8a612b49030f012b4b1e08060010",
                "name": "MECH",
                "shortName": "20",
                "description": "Mechanic",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              }
            ],

},
proxy: {
    type: 'memory',
    reader: {
        type: 'json',
        rootProperty: 'skill'
    }
}

});
</code>```

Expandable gride with column names from store JSON data

答:
For column names to be dynamic, you can do the following:

```<code>{
        text: '',
        dataIndex: 'revisedPremiumText',
        renderer: 'premiumRenderer',
        flex: 1
}
</code>```

This is an example column of a grid where dataindex will be the data of each rows that you get in the json.

Inside renderer, you can write a function in controller or in view as:

```<code>premiumRenderer: function (value, row, record) {
    row.column.setText("abc");
}
</code>```

This will set the text of your column whatever u need or whatever you get in json. And about the rowexpanders, there is a plugin as rowexpander for the grid that you can use as follows inside the grid definition in view:

```<code>plugins: [
    {
        ptype: 'rowexpander',
        expandOnDblClick: false,
        selectRowOnExpand: true,
        onKeyDown: Ext.emptyFn,
        rowBodyTpl: new Ext.XTemplate(
        )
    }
],
</code>```

Hope this helps. Happy Learning :)

Body:
I want to build a grid table as shown in the image in Extjs6.0, i have built basic grid with static column names and grid data coming from store but want to fetch column names from store and also have expandable rows. Any suggestions on how to approach it would be grateful.

Store:

Ext.define('Xmlgrid.store.Books', {
extend: 'Ext.data.Store',
alias: 'store.books',
requires: [
    'Ext.data.reader.Xml'
],
fiels:['-skillID','name','shortName','description','inspectionSkillInd','passdownInd'
       ],
data:{
    skill: [
              {
                "-skillId": "skill1",
                "name": "B2",
                "shortName": "00",
                "description": "B2",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill2",
                "name": "B1",
                "shortName": "01",
                "description": "B1",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill3",
                "name": "AIMS",
                "shortName": "02",
                "description": "AIMS",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill4",
                "name": "CAT A",
                "shortName": "03",
                "description": "CAT A",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill8",
                "name": "RADIO",
                "shortName": "07",
                "description": "RADIO",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill9",
                "name": "8",
                "shortName": "08",
                "description": "TOOL AND DIE",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill10",
                "name": "9",
                "shortName": "09",
                "description": "COMPOSITE REPAIR",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "skill11",
                "name": "10",
                "shortName": "10",
                "description": "SHOP SUPPORT",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              },
              {
                "-skillId": "8a8a8a612b49030f012b4b1e08060010",
                "name": "MECH",
                "shortName": "20",
                "description": "Mechanic",
                "inspectionSkillInd": "false",
                "passdownInd": "true"
              }
            ],

},
proxy: {
    type: 'memory',
    reader: {
        type: 'json',
        rootProperty: 'skill'
    }
}

});

Expandable gride with column names from store JSON data

Body:
For column names to be dynamic, you can do the following:

{
        text: '',
        dataIndex: 'revisedPremiumText',
        renderer: 'premiumRenderer',
        flex: 1
}

This is an example column of a grid where dataindex will be the data of each rows that you get in the json.

Inside renderer, you can write a function in controller or in view as:

premiumRenderer: function (value, row, record) {
    row.column.setText("abc");
}

This will set the text of your column whatever u need or whatever you get in json. And about the rowexpanders, there is a plugin as rowexpander for the grid that you can use as follows inside the grid definition in view:

plugins: [
    {
        ptype: 'rowexpander',
        expandOnDblClick: false,
        selectRowOnExpand: true,
        onKeyDown: Ext.emptyFn,
        rowBodyTpl: new Ext.XTemplate(
        )
    }
],

Hope this helps. Happy Learning :)


答:
```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/dighsplash">
</LinearLayout>
</code>```

try this way.

Title: Splash Screen image background in LinearLayout not fit

Body:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/dighsplash">
</LinearLayout>

try this way.


问:
getting the last item in a javascript object
If I have an object like:

```<code>{ 'a' : 'apple', 'b' : 'banana', 'c' : 'carrot' }
</code>```

If I don't know in advance that the list goes up to 'c', other than looping through the object, is there a way to get the last item in the object (e.g. 'carrot')?

答:
As for the ordering of object properties in Javascript, I will just link to this answer:

Elements order in a "for (… in …)" loop

Specifically:

All modern implementations of
  ECMAScript iterate through object
  properties in the order in which they
  were defined

So every other answer here is correct, there is no official guaranteed order to object properties. However in practice there is (barring any bugs which naturally can screw up even set-in-stone officially specified behavior).

Furthermore, the de-facto enumeration order of object properties is likely to be codified in future EMCAScript specs.

Still, at this time I would not write code around this, mostly because there are no built-in tools to help deal with object property order. You could write your own, but in the end you'd always be looping over each property in an object to determine its position.

As such the answer to your question is No, there is no way besides looping through an object.

Body:
If I have an object like:

{ 'a' : 'apple', 'b' : 'banana', 'c' : 'carrot' }

If I don't know in advance that the list goes up to 'c', other than looping through the object, is there a way to get the last item in the object (e.g. 'carrot')?


问:
Datatable update from another component
I'm using the datatables table plugin for jquery. I have another component that uses Ajax to retrieve an object from the server. I'd like to update the database with this object. I'm struggling on how to piece this together. The Ajax returns an object that is in the format that the datatable will accept for data. But how can I update the datatable from another components Ajax call? I'm using python flask and jinja2 templating. Here is the javascript as it currently exist:</p>

```<code>$(function() {
    var container = document.getElementById('visualization');
    var items = new vis.DataSet({{documents|safe}});
    var options = {};
    var timeline = new vis.Timeline(container, items, options);

    timeline.on('select', function (properties) {
        $.getJSON('/getDependencyHistory', {
            uuid: properties.items[0]
        }, function(data) {
            console.log("Place this into the datatable");
        });
        return false;
    });
});

$(document).ready(function() {
    var table = $('#example').DataTable();
});
</code>```

答:
here is a really simple one that "fools" the ajax call.

go to http://live.datatables.net/nesadivo/1/edit

Click on Run With JS button to initialize everything.  Click on the go button to go get the data

```<code>$(document).ready(function() {
     // created a global variable for the datatable to us to find the data
     var dtData = null;

     // On the button click, use regular ajax to get the data
     $("#btnGo").on("click", function(){
         $.ajax({url:"http://live.datatables.net/examples/server_side/scripts/server_processing.php",

             success:function(cData){
                    // on success, set the global variable then reload table
                    dtData = JSON.parse(cData);
                    $('#example').DataTable( ).ajax.reload();
                },
                error:function(err){debugger;}}  );
      });

      // initialize the table on page load
      $('#example').DataTable( {
          "ajax": function(a,callback,c){
               callback(dtData);
           }
       });
     });
</code>```

Title: Datatable update from another component

Body:
I'm using the datatables table plugin for jquery. I have another component that uses Ajax to retrieve an object from the server. I'd like to update the database with this object. I'm struggling on how to piece this together. The Ajax returns an object that is in the format that the datatable will accept for data. But how can I update the datatable from another components Ajax call? I'm using python flask and jinja2 templating. Here is the javascript as it currently exist:

$(function() {
    var container = document.getElementById('visualization');
    var items = new vis.DataSet({{documents|safe}});
    var options = {};
    var timeline = new vis.Timeline(container, items, options);

    timeline.on('select', function (properties) {
        $.getJSON('/getDependencyHistory', {
            uuid: properties.items[0]
        }, function(data) {
            console.log("Place this into the datatable");
        });
        return false;
    });
});

$(document).ready(function() {
    var table = $('#example').DataTable();
});

Body:
here is a really simple one that "fools" the ajax call.

go to http://live.datatables.net/nesadivo/1/edit

Click on Run With JS button to initialize everything.  Click on the go button to go get the data

$(document).ready(function() {
     // created a global variable for the datatable to us to find the data
     var dtData = null;

     // On the button click, use regular ajax to get the data
     $("#btnGo").on("click", function(){
         $.ajax({url:"http://live.datatables.net/examples/server_side/scripts/server_processing.php",

             success:function(cData){
                    // on success, set the global variable then reload table
                    dtData = JSON.parse(cData);
                    $('#example').DataTable( ).ajax.reload();
                },
                error:function(err){debugger;}}  );
      });

      // initialize the table on page load
      $('#example').DataTable( {
          "ajax": function(a,callback,c){
               callback(dtData);
           }
       });
     });