问:
pjsip pjsua USB SoundCard choopy
the pjsua runs in openwrt, we use USB SoundCard.

When we answer a call, allways choopy, both the capture and the playback are not work well!

Tips:We have use auddemo tested my soundcard, recoreding/playing are good, and the capture id is 8, playback id is 1.

thank you~~

below is logs:

```11:58:06.357    dlg0xdb687c  .Received Request msg ACK/cseq=103 (rdata0xdb3ecc)
11:58:06.360   strm0xe038dc !Start talksprut..
11:58:06.361          speex  warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:06.363     alsa_dev.c  pb_thread_func: underrun!
11:58:06.587   Master/sound !160 samples reduced, buf_cnt=1888
11:58:06.587   Master/sound  Buffer size adjusted from 2048 to 1888 (eff_cnt=1280)
11:58:06.588     alsa_dev.c  ca_thread_func: overrun!
11:58:06.756     alsa_dev.c  ca_thread_func: overrun!
11:58:06.968   Master/sound  228 samples reduced, buf_cnt=1980
11:58:06.968   Master/sound  Buffer size adjusted from 2208 to 1980 (eff_cnt=1280)
11:58:06.968     alsa_dev.c  ca_thread_func: overrun!
11:58:06.981          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:07.083   Master/sound  317 samples reduced, buf_cnt=1983
11:58:07.083     alsa_dev.c  ca_thread_func: overrun!
11:58:07.098          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:07.321   Master/sound !280 samples reduced, buf_cnt=1703
11:58:07.321   Master/sound  Buffer size adjusted from 1983 to 1703 (eff_cnt=1280)
11:58:07.321     alsa_dev.c  ca_thread_func: overrun!
11:58:07.493     alsa_dev.c  ca_thread_func: overrun!
11:58:07.505          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:07.707   Master/sound !182 samples reduced, buf_cnt=2161
11:58:07.711     alsa_dev.c  ca_thread_func: overrun!
11:58:07.506     alsa_dev.c !pb_thread_func: underrun!
11:58:07.936   Master/sound !376 samples reduced, buf_cnt=1785
11:58:07.937   Master/sound  Buffer size adjusted from 2161 to 1785 (eff_cnt=1280)
11:58:07.937     alsa_dev.c  ca_thread_func: overrun!
11:58:07.950          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.001          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.099   Master/sound  467 samples reduced, buf_cnt=1958
11:58:08.100     alsa_dev.c  ca_thread_func: overrun!
11:58:08.108          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:08.331   Master/sound !390 samples reduced, buf_cnt=1568
11:58:08.332   Master/sound  Buffer size adjusted from 1958 to 1568 (eff_cnt=1280)
11:58:08.332     alsa_dev.c  ca_thread_func: overrun!
11:58:08.508     alsa_dev.c  ca_thread_func: overrun!
11:58:08.521          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.574          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.677   Master/sound  320 samples reduced, buf_cnt=2208
11:58:08.677     alsa_dev.c  ca_thread_func: overrun!
11:58:08.688          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:08.915   Master/sound !499 samples reduced, buf_cnt=2029
11:58:08.915     alsa_dev.c  ca_thread_func: overrun!
11:58:09.128   Master/sound  193 samples reduced, buf_cnt=1836
11:58:09.128   Master/sound  Buffer size adjusted from 2029 to 1836 (eff_cnt=1280)
11:58:09.129     alsa_dev.c  ca_thread_func: overrun!
11:58:09.142          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.197          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.300   Master/sound  257 samples reduced, buf_cnt=2219
11:58:09.300     alsa_dev.c  ca_thread_func: overrun!
11:58:09.308          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:09.309     alsa_dev.c  pb_thread_func: underrun!
11:58:09.523   Master/sound !427 samples reduced, buf_cnt=1792
11:58:09.523   Master/sound  Buffer size adjusted from 2219 to 1792 (eff_cnt=1280)
11:58:09.523     alsa_dev.c  ca_thread_func: overrun!
11:58:09.718     alsa_dev.c  ca_thread_func: overrun!
11:58:09.731          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.832   Master/sound  297 samples reduced, buf_cnt=2135
11:58:09.833     alsa_dev.c  ca_thread_func: overrun!
11:58:09.845          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:10.080   Master/sound !160 samples reduced, buf_cnt=1975
11:58:10.080   Master/sound  Buffer size adjusted from 2135 to 1975 (eff_cnt=1280)
11:58:10.080     alsa_dev.c  ca_thread_func: overrun!
11:58:10.316   Master/sound  110 samples reduced, buf_cnt=2185
11:58:10.316     alsa_dev.c  ca_thread_func: overrun!
11:58:10.329          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:10.427   Master/sound  527 samples reduced, buf_cnt=1978
11:58:10.427          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:10.530   Master/sound  142 samples reduced, buf_cnt=2156
11:58:10.531     alsa_dev.c  ca_thread_func: overrun!
11:58:10.538          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:10.768   Master/sound !169 samples reduced, buf_cnt=1987
11:58:10.768   Master/sound  Buffer size adjusted from 2156 to 1987 (eff_cnt=1280)
11:58:10.769     alsa_dev.c  ca_thread_func: overrun!
11:58:11.004   Master/sound  67 samples reduced, buf_cnt=2240
11:58:11.005     alsa_dev.c  ca_thread_func: overrun!
11:58:11.017          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:11.117   Master/sound  439 samples reduced, buf_cnt=2121
11:58:11.118     alsa_dev.c  ca_thread_func: overrun!
11:58:11.124          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:11.125     alsa_dev.c  pb_thread_func: underrun!
11:58:11.349   Master/sound !162 samples reduced, buf_cnt=1959
11:58:11.349   Master/sound  Buffer size adjusted from 2121 to 1959 (eff_cnt=1280)
11:58:11.349     alsa_dev.c  ca_thread_func: overrun!
11:58:11.574   Master/sound  39 samples reduced, buf_cnt=2240
11:58:11.575     alsa_dev.c  ca_thread_func: overrun!
11:58:11.584          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:11.809   Master/sound !423 samples reduced, buf_cnt=1817
11:58:11.810   Master/sound  Buffer size adjusted from 2240 to 1817 (eff_cnt=1280)
11:58:11.810     alsa_dev.c  ca_thread_func: overrun!
11:58:11.984     alsa_dev.c  ca_thread_func: overrun!
11:58:11.998          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:12.106   Master/sound  224 samples reduced, buf_cnt=2233
11:58:12.106     alsa_dev.c  ca_thread_func: overrun!
11:58:12.115          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:12.328   Master/sound !295 samples reduced, buf_cnt=1938
11:58:12.329   Master/sound  Buffer size adjusted from 2233 to 1938 (eff_cnt=1280)
11:58:12.329     alsa_dev.c  ca_thread_func: overrun!
11:58:12.564   Master/sound  31 samples reduced, buf_cnt=2227
11:58:12.565     alsa_dev.c  ca_thread_func: overrun!
11:58:12.573          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:12.574     alsa_dev.c  pb_thread_func: underrun!
11:58:12.803   Master/sound !368 samples reduced, buf_cnt=1859
11:58:12.804   Master/sound  Buffer size adjusted from 2227 to 1859 (eff_cnt=1280)
11:58:12.804     alsa_dev.c  ca_thread_func: overrun!
11:58:12.990     alsa_dev.c  ca_thread_func: overrun!
11:58:13.002          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.223   Master/sound !568 samples reduced, buf_cnt=1931
11:58:13.223     alsa_dev.c  ca_thread_func: overrun!
11:58:13.469   Master/sound  416 samples reduced, buf_cnt=1515
11:58:13.469   Master/sound  Buffer size adjusted from 1931 to 1515 (eff_cnt=1280)
11:58:13.470     alsa_dev.c  ca_thread_func: overrun!
11:58:13.474          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.658     alsa_dev.c !ca_thread_func: overrun!
11:58:13.826     alsa_dev.c  ca_thread_func: overrun!
11:58:13.833          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.834     alsa_dev.c  pb_thread_func: underrun!
11:58:14.041   Master/sound !450 samples reduced, buf_cnt=1385
11:58:14.041   Master/sound  Buffer size adjusted from 1835 to 1385 (eff_cnt=1280)
11:58:14.041     alsa_dev.c  ca_thread_func: overrun!
11:58:14.216     alsa_dev.c  ca_thread_func: overrun!
11:58:14.223          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:14.433   Master/sound !169 samples reduced, buf_cnt=1536
11:58:14.434   Master/sound  Buffer size adjusted from 1705 to 1536 (eff_cnt=1280)
11:58:14.434     alsa_dev.c  ca_thread_func: overrun!
11:58:14.606     alsa_dev.c  ca_thread_func: overrun!
11:58:14.613          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:14.843   Master/sound !459 samples reduced, buf_cnt=1397
11:58:14.843   Master/sound  Buffer size adjusted from 1856 to 1397 (eff_cnt=1280)
11:58:14.844     alsa_dev.c  ca_thread_func: overrun!
11:58:15.023     alsa_dev.c  ca_thread_func: overrun!
11:58:15.032          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:15.033     alsa_dev.c  pb_thread_func: underrun!
11:58:15.254   Master/sound !454 samples reduced, buf_cnt=1263
11:58:15.254   Master/sound  Buffer size adjusted from 1717 to 1263 (eff_cnt=1280)
11:58:15.254     alsa_dev.c  ca_thread_func: overrun!
11:58:15.448     alsa_dev.c  ca_thread_func: overrun!
11:58:15.455          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:15.636     alsa_dev.c !ca_thread_func: overrun!
11:58:15.808     alsa_dev.c  ca_thread_func: overrun!
11:58:15.814          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.029   Master/sound !300 samples reduced, buf_cnt=1603
11:58:16.030   Master/sound  Buffer size adjusted from 1903 to 1603 (eff_cnt=1280)
11:58:16.030     alsa_dev.c  ca_thread_func: overrun!
11:58:16.195     alsa_dev.c  ca_thread_func: overrun!
11:58:16.204          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.205     alsa_dev.c  pb_thread_func: underrun!
11:58:16.429   Master/sound !369 samples reduced, buf_cnt=1554
11:58:16.430   Master/sound  Buffer size adjusted from 1923 to 1554 (eff_cnt=1280)
11:58:16.430     alsa_dev.c  ca_thread_func: overrun!
11:58:16.609     alsa_dev.c  ca_thread_func: overrun!
11:58:16.617          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.851   Master/sound !399 samples reduced, buf_cnt=1475
11:58:16.851   Master/sound  Buffer size adjusted from 1874 to 1475 (eff_cnt=1280)
11:58:16.852     alsa_dev.c  ca_thread_func: overrun!
11:58:17.037     alsa_dev.c  ca_thread_func: overrun!
11:58:17.047          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:17.268   Master/sound !461 samples reduced, buf_cnt=1334
11:58:17.268   Master/sound  Buffer size adjusted from 1795 to 1334 (eff_cnt=1280)
11:58:17.269     alsa_dev.c  ca_thread_func: overrun!
11:58:17.460     alsa_dev.c  ca_thread_func: overrun!
11:58:17.469          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:17.470     alsa_dev.c  pb_thread_func: underrun!
11:58:17.681   Master/sound !215 samples reduced, buf_cnt=1439
11:58:17.681   Master/sound  Buffer size adjusted from 1654 to 1439 (eff_cnt=1280)
11:58:17.682     alsa_dev.c  ca_thread_func: overrun!
11:58:17.859     alsa_dev.c  ca_thread_func: overrun!
11:58:17.867          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.089   Master/sound !350 samples reduced, buf_cnt=1409
11:58:18.089   Master/sound  Buffer size adjusted from 1759 to 1409 (eff_cnt=1280)
11:58:18.089     alsa_dev.c  ca_thread_func: overrun!
11:58:18.274     alsa_dev.c  ca_thread_func: overrun!
11:58:18.284          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.511   Master/sound !254 samples reduced, buf_cnt=1475
11:58:18.511   Master/sound  Buffer size adjusted from 1729 to 1475 (eff_cnt=1280)
11:58:18.512     alsa_dev.c  ca_thread_func: overrun!
11:58:18.514    pjsua_acc.c !Sending 2 bytes keep-alive packet for acc 1 to 211.149.184.241:5060
11:58:18.515   tdta0xe088f8  Destroying txdata raw
11:58:18.689     alsa_dev.c !ca_thread_func: overrun!
11:58:18.701          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.881     alsa_dev.c !ca_thread_func: overrun!
11:58:18.888     alsa_dev.c !pb_thread_func: underrun!
11:58:19.105   Master/sound !283 samples reduced, buf_cnt=1832
11:58:19.105   Master/sound  Buffer size adjusted from 2115 to 1832 (eff_cnt=1280)
11:58:19.105     alsa_dev.c  ca_thread_func: overrun!
11:58:19.114          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.342   Master/sound !414 samples reduced, buf_cnt=1418
11:58:19.343   Master/sound  Buffer size adjusted from 1832 to 1418 (eff_cnt=1280)
11:58:19.343     alsa_dev.c  ca_thread_func: overrun!
11:58:19.517     alsa_dev.c  ca_thread_func: overrun!
11:58:19.526          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.736   Master/sound !173 samples reduced, buf_cnt=1565
11:58:19.736   Master/sound  Buffer size adjusted from 1738 to 1565 (eff_cnt=1280)
11:58:19.736     alsa_dev.c  ca_thread_func: overrun!
11:58:19.924     alsa_dev.c  ca_thread_func: overrun!
11:58:19.935          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.936     alsa_dev.c  pb_thread_func: underrun!
11:58:20.115     alsa_dev.c !ca_thread_func: overrun!
11:58:20.132   strm0xe038dc !VAD re-enabled
11:58:20.331   Master/sound !460 samples reduced, buf_cnt=1745
11:58:20.337   Master/sound  Buffer size adjusted from 2205 to 1745 (eff_cnt=1280)
11:58:20.337     alsa_dev.c  ca_thread_func: overrun!
11:58:20.339   strm0xe038dc !Starting silence
11:58:20.340          speex  warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:20.574   Master/sound !387 samples reduced, buf_cnt=1358
11:58:20.574   Master/sound  Buffer size adjusted from 1745 to 1358 (eff_cnt=1280)
11:58:20.574     alsa_dev.c  ca_thread_func: overrun!
11:58:20.760     alsa_dev.c  ca_thread_func: overrun!
11:58:20.762    tsx0xdf545c !Timeout timer event
11:58:20.762    tsx0xdf545c  .State changed from Completed to Terminated, event=TIMER
11:58:20.765    tsx0xdf545c  Timeout timer event
11:58:20.765    tsx0xdf545c  .State changed from Terminated to Destroyed, event=TIMER
11:58:20.766   tdta0xdf43f0  ..Destroying txdata Response msg 200/NOTIFY/cseq=102 (tdta0xdf43f0)
11:58:20.766    tsx0xdf545c  Transaction destroyed!
11:58:20.948     alsa_dev.c !ca_thread_func: overrun!
11:58:20.958          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:20.960     alsa_dev.c  pb_thread_func: underrun!
11:58:21.187   Master/sound !295 samples reduced, buf_cnt=1383
11:58:21.187   Master/sound  Buffer size adjusted from 1678 to 1383 (eff_cnt=1280)
11:58:21.187     alsa_dev.c  ca_thread_func: overrun!
11:58:21.378     alsa_dev.c  ca_thread_func: overrun!
11:58:21.387          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:21.610   Master/sound !419 samples reduced, buf_cnt=1284
11:58:21.610   Master/sound  Buffer size adjusted from 1703 to 1284 (eff_cnt=1280)
11:58:21.612     alsa_dev.c  ca_thread_func: overrun!
11:58:21.804     alsa_dev.c  ca_thread_func: overrun!
11:58:21.810          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:22.040   Master/sound !168 samples reduced, buf_cnt=1436
11:58:22.040   Master/sound  Buffer size adjusted from 1604 to 1436 (eff_cnt=1280)
11:58:22.040     alsa_dev.c  ca_thread_func: overrun!
11:58:22.053     alsa_dev.c !pb_thread_func: underrun!
11:58:22.230     alsa_dev.c !ca_thread_func: overrun!
11:58:22.414          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:22.440     alsa_dev.c !ca_thread_func: overrun!
11:58:22.619     alsa_dev.c  ca_thread_func: overrun!
11:58:22.805     alsa_dev.c  ca_thread_func: overrun!
11:58:22.815     alsa_dev.c !pb_thread_func: underrun!
11:58:23.039   Master/sound !232 samples reduced, buf_cnt=1524
11:58:23.039   Master/sound  Buffer size adjusted from 1756 to 1524 (eff_cnt=1280)
11:58:23.039     alsa_dev.c  ca_thread_func: overrun!
11:58:23.229     alsa_dev.c  ca_thread_func: overrun!
11:58:23.237          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:23.470   Master/sound !341 samples reduced, buf_cnt=1503
11:58:23.470   Master/sound  Buffer size adjusted from 1844 to 1503 (eff_cnt=1280)
11:58:23.471     alsa_dev.c  ca_thread_func: overrun!
11:58:23.645     alsa_dev.c  ca_thread_func: overrun!
11:58:23.652          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:23.860   Master/sound !167 samples reduced, buf_cnt=1656
11:58:23.861   Master/sound  Buffer size adjusted from 1823 to 1656 (eff_cnt=1280)
11:58:23.861     alsa_dev.c  ca_thread_func: overrun!
11:58:24.049     alsa_dev.c  ca_thread_func: overrun!
11:58:24.056          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:24.057     alsa_dev.c  pb_thread_func: underrun!
11:58:24.267   Master/sound !166 samples reduced, buf_cnt=1810
11:58:24.267   Master/sound  Buffer size adjusted from 1976 to 1810 (eff_cnt=1280)
11:58:24.268     alsa_dev.c  ca_thread_func: overrun!
11:58:24.505   Master/sound  450 samples reduced, buf_cnt=1360
11:58:24.505   Master/sound  Buffer size adjusted from 1810 to 1360 (eff_cnt=1280)
11:58:24.505     alsa_dev.c  ca_thread_func: overrun!
11:58:24.697     alsa_dev.c  ca_thread_func: overrun!
11:58:24.708          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:24.883     alsa_dev.c !ca_thread_func: overrun!
11:58:25.121   Master/sound  209 samples reduced, buf_cnt=1791
11:58:25.121   Master/sound  Buffer size adjusted from 2000 to 1791 (eff_cnt=1280)
11:58:25.122     alsa_dev.c  ca_thread_func: overrun!
11:58:25.132          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:25.133     alsa_dev.c  pb_thread_func: underrun!
11:58:25.354   Master/sound !319 samples reduced, buf_cnt=1472
11:58:25.354   Master/sound  Buffer size adjusted from 1791 to 1472 (eff_cnt=1280)
11:58:25.354     alsa_dev.c  ca_thread_func: overrun!
11:58:25.547     alsa_dev.c  ca_thread_func: overrun!
11:58:25.557          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:25.790   Master/sound !320 samples reduced, buf_cnt=1472
11:58:25.791   Master/sound  Buffer size adjusted from 1792 to 1472 (eff_cnt=1280)
11:58:25.791     alsa_dev.c  ca_thread_func: overrun!
11:58:25.982     alsa_dev.c  ca_thread_func: overrun!
11:58:25.990          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:26.218   Master/sound !201 samples reduced, buf_cnt=1591
11:58:26.218   Master/sound  Buffer size adjusted from 1792 to 1591 (eff_cnt=1280)
11:58:26.218     alsa_dev.c  ca_thread_func: overrun!
11:58:26.419          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:26.422     alsa_dev.c !ca_thread_func: overrun!
11:58:26.424     alsa_dev.c !pb_thread_func: underrun!
11:58:26.643   Master/sound !275 samples reduced, buf_cnt=1636
11:58:26.644   Master/sound  Buffer size adjusted from 1911 to 1636 (eff_cnt=1280)
11:58:26.644     alsa_dev.c  ca_thread_func: overrun!
11:58:26.646 sip_endpoint.c !Processing incoming message: Request msg INVITE/cseq=104 (rdata0xdb3ecc)
11:58:26.646   pjsua_core.c  .RX 841 bytes Request msg INVITE/cseq=104 (rdata0xdb3ecc) from UDP 211.149.184.241:5060:
INVITE sip:192.168.199.246:30003 SIP/2.0
Via: SIP/2.0/UDP 211.149.184.241:5060;branch=z9hG4bK0ed27c3d;rport
Max-Forwards: 70
From: <sip:103009844960152@211.149.184.241>;tag=as47643774
To: <sip:8002@192.168.199.246:30003;ob>;tag=d7d7f583-6390-4a16-9b9c-2f35c8bef97f
Contact: <sip:103009844960152@211.149.184.241:5060>
Call-ID: 356bbaf75eabf6633e02135d7019b2e8@211.149.184.241:5060
CSeq: 104 INVITE
User-Agent: Asterisk PBX 11.7.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 238
```

答: Beforte I compling simple_pjsua.c I set the log level frome 4 to 5.After complied and I run it, I fond the same warnging as you, but have no effect to the session.when I set the log level from 5 back to 4,the waring disappeared.I didn't know the reasion that cause the waring but I know it dosn't have effect to the session.</p>

Title: pjsip pjsua USB SoundCard choopy

Body:
the pjsua runs in openwrt, we use USB SoundCard.

When we answer a call, allways choopy, both the capture and the playback are not work well!

Tips:We have use auddemo tested my soundcard, recoreding/playing are good, and the capture id is 8, playback id is 1.

thank you~~

below is logs:

11:58:06.357    dlg0xdb687c  .Received Request msg ACK/cseq=103 (rdata0xdb3ecc)
11:58:06.360   strm0xe038dc !Start talksprut..
11:58:06.361          speex  warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:06.363     alsa_dev.c  pb_thread_func: underrun!
11:58:06.587   Master/sound !160 samples reduced, buf_cnt=1888
11:58:06.587   Master/sound  Buffer size adjusted from 2048 to 1888 (eff_cnt=1280)
11:58:06.588     alsa_dev.c  ca_thread_func: overrun!
11:58:06.756     alsa_dev.c  ca_thread_func: overrun!
11:58:06.968   Master/sound  228 samples reduced, buf_cnt=1980
11:58:06.968   Master/sound  Buffer size adjusted from 2208 to 1980 (eff_cnt=1280)
11:58:06.968     alsa_dev.c  ca_thread_func: overrun!
11:58:06.981          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:07.083   Master/sound  317 samples reduced, buf_cnt=1983
11:58:07.083     alsa_dev.c  ca_thread_func: overrun!
11:58:07.098          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:07.321   Master/sound !280 samples reduced, buf_cnt=1703
11:58:07.321   Master/sound  Buffer size adjusted from 1983 to 1703 (eff_cnt=1280)
11:58:07.321     alsa_dev.c  ca_thread_func: overrun!
11:58:07.493     alsa_dev.c  ca_thread_func: overrun!
11:58:07.505          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:07.707   Master/sound !182 samples reduced, buf_cnt=2161
11:58:07.711     alsa_dev.c  ca_thread_func: overrun!
11:58:07.506     alsa_dev.c !pb_thread_func: underrun!
11:58:07.936   Master/sound !376 samples reduced, buf_cnt=1785
11:58:07.937   Master/sound  Buffer size adjusted from 2161 to 1785 (eff_cnt=1280)
11:58:07.937     alsa_dev.c  ca_thread_func: overrun!
11:58:07.950          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.001          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.099   Master/sound  467 samples reduced, buf_cnt=1958
11:58:08.100     alsa_dev.c  ca_thread_func: overrun!
11:58:08.108          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:08.331   Master/sound !390 samples reduced, buf_cnt=1568
11:58:08.332   Master/sound  Buffer size adjusted from 1958 to 1568 (eff_cnt=1280)
11:58:08.332     alsa_dev.c  ca_thread_func: overrun!
11:58:08.508     alsa_dev.c  ca_thread_func: overrun!
11:58:08.521          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.574          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.677   Master/sound  320 samples reduced, buf_cnt=2208
11:58:08.677     alsa_dev.c  ca_thread_func: overrun!
11:58:08.688          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:08.915   Master/sound !499 samples reduced, buf_cnt=2029
11:58:08.915     alsa_dev.c  ca_thread_func: overrun!
11:58:09.128   Master/sound  193 samples reduced, buf_cnt=1836
11:58:09.128   Master/sound  Buffer size adjusted from 2029 to 1836 (eff_cnt=1280)
11:58:09.129     alsa_dev.c  ca_thread_func: overrun!
11:58:09.142          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.197          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.300   Master/sound  257 samples reduced, buf_cnt=2219
11:58:09.300     alsa_dev.c  ca_thread_func: overrun!
11:58:09.308          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:09.309     alsa_dev.c  pb_thread_func: underrun!
11:58:09.523   Master/sound !427 samples reduced, buf_cnt=1792
11:58:09.523   Master/sound  Buffer size adjusted from 2219 to 1792 (eff_cnt=1280)
11:58:09.523     alsa_dev.c  ca_thread_func: overrun!
11:58:09.718     alsa_dev.c  ca_thread_func: overrun!
11:58:09.731          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.832   Master/sound  297 samples reduced, buf_cnt=2135
11:58:09.833     alsa_dev.c  ca_thread_func: overrun!
11:58:09.845          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:10.080   Master/sound !160 samples reduced, buf_cnt=1975
11:58:10.080   Master/sound  Buffer size adjusted from 2135 to 1975 (eff_cnt=1280)
11:58:10.080     alsa_dev.c  ca_thread_func: overrun!
11:58:10.316   Master/sound  110 samples reduced, buf_cnt=2185
11:58:10.316     alsa_dev.c  ca_thread_func: overrun!
11:58:10.329          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:10.427   Master/sound  527 samples reduced, buf_cnt=1978
11:58:10.427          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:10.530   Master/sound  142 samples reduced, buf_cnt=2156
11:58:10.531     alsa_dev.c  ca_thread_func: overrun!
11:58:10.538          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:10.768   Master/sound !169 samples reduced, buf_cnt=1987
11:58:10.768   Master/sound  Buffer size adjusted from 2156 to 1987 (eff_cnt=1280)
11:58:10.769     alsa_dev.c  ca_thread_func: overrun!
11:58:11.004   Master/sound  67 samples reduced, buf_cnt=2240
11:58:11.005     alsa_dev.c  ca_thread_func: overrun!
11:58:11.017          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:11.117   Master/sound  439 samples reduced, buf_cnt=2121
11:58:11.118     alsa_dev.c  ca_thread_func: overrun!
11:58:11.124          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:11.125     alsa_dev.c  pb_thread_func: underrun!
11:58:11.349   Master/sound !162 samples reduced, buf_cnt=1959
11:58:11.349   Master/sound  Buffer size adjusted from 2121 to 1959 (eff_cnt=1280)
11:58:11.349     alsa_dev.c  ca_thread_func: overrun!
11:58:11.574   Master/sound  39 samples reduced, buf_cnt=2240
11:58:11.575     alsa_dev.c  ca_thread_func: overrun!
11:58:11.584          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:11.809   Master/sound !423 samples reduced, buf_cnt=1817
11:58:11.810   Master/sound  Buffer size adjusted from 2240 to 1817 (eff_cnt=1280)
11:58:11.810     alsa_dev.c  ca_thread_func: overrun!
11:58:11.984     alsa_dev.c  ca_thread_func: overrun!
11:58:11.998          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:12.106   Master/sound  224 samples reduced, buf_cnt=2233
11:58:12.106     alsa_dev.c  ca_thread_func: overrun!
11:58:12.115          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:12.328   Master/sound !295 samples reduced, buf_cnt=1938
11:58:12.329   Master/sound  Buffer size adjusted from 2233 to 1938 (eff_cnt=1280)
11:58:12.329     alsa_dev.c  ca_thread_func: overrun!
11:58:12.564   Master/sound  31 samples reduced, buf_cnt=2227
11:58:12.565     alsa_dev.c  ca_thread_func: overrun!
11:58:12.573          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:12.574     alsa_dev.c  pb_thread_func: underrun!
11:58:12.803   Master/sound !368 samples reduced, buf_cnt=1859
11:58:12.804   Master/sound  Buffer size adjusted from 2227 to 1859 (eff_cnt=1280)
11:58:12.804     alsa_dev.c  ca_thread_func: overrun!
11:58:12.990     alsa_dev.c  ca_thread_func: overrun!
11:58:13.002          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.223   Master/sound !568 samples reduced, buf_cnt=1931
11:58:13.223     alsa_dev.c  ca_thread_func: overrun!
11:58:13.469   Master/sound  416 samples reduced, buf_cnt=1515
11:58:13.469   Master/sound  Buffer size adjusted from 1931 to 1515 (eff_cnt=1280)
11:58:13.470     alsa_dev.c  ca_thread_func: overrun!
11:58:13.474          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.658     alsa_dev.c !ca_thread_func: overrun!
11:58:13.826     alsa_dev.c  ca_thread_func: overrun!
11:58:13.833          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.834     alsa_dev.c  pb_thread_func: underrun!
11:58:14.041   Master/sound !450 samples reduced, buf_cnt=1385
11:58:14.041   Master/sound  Buffer size adjusted from 1835 to 1385 (eff_cnt=1280)
11:58:14.041     alsa_dev.c  ca_thread_func: overrun!
11:58:14.216     alsa_dev.c  ca_thread_func: overrun!
11:58:14.223          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:14.433   Master/sound !169 samples reduced, buf_cnt=1536
11:58:14.434   Master/sound  Buffer size adjusted from 1705 to 1536 (eff_cnt=1280)
11:58:14.434     alsa_dev.c  ca_thread_func: overrun!
11:58:14.606     alsa_dev.c  ca_thread_func: overrun!
11:58:14.613          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:14.843   Master/sound !459 samples reduced, buf_cnt=1397
11:58:14.843   Master/sound  Buffer size adjusted from 1856 to 1397 (eff_cnt=1280)
11:58:14.844     alsa_dev.c  ca_thread_func: overrun!
11:58:15.023     alsa_dev.c  ca_thread_func: overrun!
11:58:15.032          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:15.033     alsa_dev.c  pb_thread_func: underrun!
11:58:15.254   Master/sound !454 samples reduced, buf_cnt=1263
11:58:15.254   Master/sound  Buffer size adjusted from 1717 to 1263 (eff_cnt=1280)
11:58:15.254     alsa_dev.c  ca_thread_func: overrun!
11:58:15.448     alsa_dev.c  ca_thread_func: overrun!
11:58:15.455          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:15.636     alsa_dev.c !ca_thread_func: overrun!
11:58:15.808     alsa_dev.c  ca_thread_func: overrun!
11:58:15.814          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.029   Master/sound !300 samples reduced, buf_cnt=1603
11:58:16.030   Master/sound  Buffer size adjusted from 1903 to 1603 (eff_cnt=1280)
11:58:16.030     alsa_dev.c  ca_thread_func: overrun!
11:58:16.195     alsa_dev.c  ca_thread_func: overrun!
11:58:16.204          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.205     alsa_dev.c  pb_thread_func: underrun!
11:58:16.429   Master/sound !369 samples reduced, buf_cnt=1554
11:58:16.430   Master/sound  Buffer size adjusted from 1923 to 1554 (eff_cnt=1280)
11:58:16.430     alsa_dev.c  ca_thread_func: overrun!
11:58:16.609     alsa_dev.c  ca_thread_func: overrun!
11:58:16.617          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.851   Master/sound !399 samples reduced, buf_cnt=1475
11:58:16.851   Master/sound  Buffer size adjusted from 1874 to 1475 (eff_cnt=1280)
11:58:16.852     alsa_dev.c  ca_thread_func: overrun!
11:58:17.037     alsa_dev.c  ca_thread_func: overrun!
11:58:17.047          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:17.268   Master/sound !461 samples reduced, buf_cnt=1334
11:58:17.268   Master/sound  Buffer size adjusted from 1795 to 1334 (eff_cnt=1280)
11:58:17.269     alsa_dev.c  ca_thread_func: overrun!
11:58:17.460     alsa_dev.c  ca_thread_func: overrun!
11:58:17.469          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:17.470     alsa_dev.c  pb_thread_func: underrun!
11:58:17.681   Master/sound !215 samples reduced, buf_cnt=1439
11:58:17.681   Master/sound  Buffer size adjusted from 1654 to 1439 (eff_cnt=1280)
11:58:17.682     alsa_dev.c  ca_thread_func: overrun!
11:58:17.859     alsa_dev.c  ca_thread_func: overrun!
11:58:17.867          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.089   Master/sound !350 samples reduced, buf_cnt=1409
11:58:18.089   Master/sound  Buffer size adjusted from 1759 to 1409 (eff_cnt=1280)
11:58:18.089     alsa_dev.c  ca_thread_func: overrun!
11:58:18.274     alsa_dev.c  ca_thread_func: overrun!
11:58:18.284          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.511   Master/sound !254 samples reduced, buf_cnt=1475
11:58:18.511   Master/sound  Buffer size adjusted from 1729 to 1475 (eff_cnt=1280)
11:58:18.512     alsa_dev.c  ca_thread_func: overrun!
11:58:18.514    pjsua_acc.c !Sending 2 bytes keep-alive packet for acc 1 to 211.149.184.241:5060
11:58:18.515   tdta0xe088f8  Destroying txdata raw
11:58:18.689     alsa_dev.c !ca_thread_func: overrun!
11:58:18.701          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.881     alsa_dev.c !ca_thread_func: overrun!
11:58:18.888     alsa_dev.c !pb_thread_func: underrun!
11:58:19.105   Master/sound !283 samples reduced, buf_cnt=1832
11:58:19.105   Master/sound  Buffer size adjusted from 2115 to 1832 (eff_cnt=1280)
11:58:19.105     alsa_dev.c  ca_thread_func: overrun!
11:58:19.114          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.342   Master/sound !414 samples reduced, buf_cnt=1418
11:58:19.343   Master/sound  Buffer size adjusted from 1832 to 1418 (eff_cnt=1280)
11:58:19.343     alsa_dev.c  ca_thread_func: overrun!
11:58:19.517     alsa_dev.c  ca_thread_func: overrun!
11:58:19.526          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.736   Master/sound !173 samples reduced, buf_cnt=1565
11:58:19.736   Master/sound  Buffer size adjusted from 1738 to 1565 (eff_cnt=1280)
11:58:19.736     alsa_dev.c  ca_thread_func: overrun!
11:58:19.924     alsa_dev.c  ca_thread_func: overrun!
11:58:19.935          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.936     alsa_dev.c  pb_thread_func: underrun!
11:58:20.115     alsa_dev.c !ca_thread_func: overrun!
11:58:20.132   strm0xe038dc !VAD re-enabled
11:58:20.331   Master/sound !460 samples reduced, buf_cnt=1745
11:58:20.337   Master/sound  Buffer size adjusted from 2205 to 1745 (eff_cnt=1280)
11:58:20.337     alsa_dev.c  ca_thread_func: overrun!
11:58:20.339   strm0xe038dc !Starting silence
11:58:20.340          speex  warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:20.574   Master/sound !387 samples reduced, buf_cnt=1358
11:58:20.574   Master/sound  Buffer size adjusted from 1745 to 1358 (eff_cnt=1280)
11:58:20.574     alsa_dev.c  ca_thread_func: overrun!
11:58:20.760     alsa_dev.c  ca_thread_func: overrun!
11:58:20.762    tsx0xdf545c !Timeout timer event
11:58:20.762    tsx0xdf545c  .State changed from Completed to Terminated, event=TIMER
11:58:20.765    tsx0xdf545c  Timeout timer event
11:58:20.765    tsx0xdf545c  .State changed from Terminated to Destroyed, event=TIMER
11:58:20.766   tdta0xdf43f0  ..Destroying txdata Response msg 200/NOTIFY/cseq=102 (tdta0xdf43f0)
11:58:20.766    tsx0xdf545c  Transaction destroyed!
11:58:20.948     alsa_dev.c !ca_thread_func: overrun!
11:58:20.958          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:20.960     alsa_dev.c  pb_thread_func: underrun!
11:58:21.187   Master/sound !295 samples reduced, buf_cnt=1383
11:58:21.187   Master/sound  Buffer size adjusted from 1678 to 1383 (eff_cnt=1280)
11:58:21.187     alsa_dev.c  ca_thread_func: overrun!
11:58:21.378     alsa_dev.c  ca_thread_func: overrun!
11:58:21.387          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:21.610   Master/sound !419 samples reduced, buf_cnt=1284
11:58:21.610   Master/sound  Buffer size adjusted from 1703 to 1284 (eff_cnt=1280)
11:58:21.612     alsa_dev.c  ca_thread_func: overrun!
11:58:21.804     alsa_dev.c  ca_thread_func: overrun!
11:58:21.810          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:22.040   Master/sound !168 samples reduced, buf_cnt=1436
11:58:22.040   Master/sound  Buffer size adjusted from 1604 to 1436 (eff_cnt=1280)
11:58:22.040     alsa_dev.c  ca_thread_func: overrun!
11:58:22.053     alsa_dev.c !pb_thread_func: underrun!
11:58:22.230     alsa_dev.c !ca_thread_func: overrun!
11:58:22.414          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:22.440     alsa_dev.c !ca_thread_func: overrun!
11:58:22.619     alsa_dev.c  ca_thread_func: overrun!
11:58:22.805     alsa_dev.c  ca_thread_func: overrun!
11:58:22.815     alsa_dev.c !pb_thread_func: underrun!
11:58:23.039   Master/sound !232 samples reduced, buf_cnt=1524
11:58:23.039   Master/sound  Buffer size adjusted from 1756 to 1524 (eff_cnt=1280)
11:58:23.039     alsa_dev.c  ca_thread_func: overrun!
11:58:23.229     alsa_dev.c  ca_thread_func: overrun!
11:58:23.237          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:23.470   Master/sound !341 samples reduced, buf_cnt=1503
11:58:23.470   Master/sound  Buffer size adjusted from 1844 to 1503 (eff_cnt=1280)
11:58:23.471     alsa_dev.c  ca_thread_func: overrun!
11:58:23.645     alsa_dev.c  ca_thread_func: overrun!
11:58:23.652          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:23.860   Master/sound !167 samples reduced, buf_cnt=1656
11:58:23.861   Master/sound  Buffer size adjusted from 1823 to 1656 (eff_cnt=1280)
11:58:23.861     alsa_dev.c  ca_thread_func: overrun!
11:58:24.049     alsa_dev.c  ca_thread_func: overrun!
11:58:24.056          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:24.057     alsa_dev.c  pb_thread_func: underrun!
11:58:24.267   Master/sound !166 samples reduced, buf_cnt=1810
11:58:24.267   Master/sound  Buffer size adjusted from 1976 to 1810 (eff_cnt=1280)
11:58:24.268     alsa_dev.c  ca_thread_func: overrun!
11:58:24.505   Master/sound  450 samples reduced, buf_cnt=1360
11:58:24.505   Master/sound  Buffer size adjusted from 1810 to 1360 (eff_cnt=1280)
11:58:24.505     alsa_dev.c  ca_thread_func: overrun!
11:58:24.697     alsa_dev.c  ca_thread_func: overrun!
11:58:24.708          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:24.883     alsa_dev.c !ca_thread_func: overrun!
11:58:25.121   Master/sound  209 samples reduced, buf_cnt=1791
11:58:25.121   Master/sound  Buffer size adjusted from 2000 to 1791 (eff_cnt=1280)
11:58:25.122     alsa_dev.c  ca_thread_func: overrun!
11:58:25.132          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:25.133     alsa_dev.c  pb_thread_func: underrun!
11:58:25.354   Master/sound !319 samples reduced, buf_cnt=1472
11:58:25.354   Master/sound  Buffer size adjusted from 1791 to 1472 (eff_cnt=1280)
11:58:25.354     alsa_dev.c  ca_thread_func: overrun!
11:58:25.547     alsa_dev.c  ca_thread_func: overrun!
11:58:25.557          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:25.790   Master/sound !320 samples reduced, buf_cnt=1472
11:58:25.791   Master/sound  Buffer size adjusted from 1792 to 1472 (eff_cnt=1280)
11:58:25.791     alsa_dev.c  ca_thread_func: overrun!
11:58:25.982     alsa_dev.c  ca_thread_func: overrun!
11:58:25.990          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:26.218   Master/sound !201 samples reduced, buf_cnt=1591
11:58:26.218   Master/sound  Buffer size adjusted from 1792 to 1591 (eff_cnt=1280)
11:58:26.218     alsa_dev.c  ca_thread_func: overrun!
11:58:26.419          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:26.422     alsa_dev.c !ca_thread_func: overrun!
11:58:26.424     alsa_dev.c !pb_thread_func: underrun!
11:58:26.643   Master/sound !275 samples reduced, buf_cnt=1636
11:58:26.644   Master/sound  Buffer size adjusted from 1911 to 1636 (eff_cnt=1280)
11:58:26.644     alsa_dev.c  ca_thread_func: overrun!
11:58:26.646 sip_endpoint.c !Processing incoming message: Request msg INVITE/cseq=104 (rdata0xdb3ecc)
11:58:26.646   pjsua_core.c  .RX 841 bytes Request msg INVITE/cseq=104 (rdata0xdb3ecc) from UDP 211.149.184.241:5060:
INVITE sip:192.168.199.246:30003 SIP/2.0
Via: SIP/2.0/UDP 211.149.184.241:5060;branch=z9hG4bK0ed27c3d;rport
Max-Forwards: 70
From: <sip:103009844960152@211.149.184.241>;tag=as47643774
To: <sip:8002@192.168.199.246:30003;ob>;tag=d7d7f583-6390-4a16-9b9c-2f35c8bef97f
Contact: <sip:103009844960152@211.149.184.241:5060>
Call-ID: 356bbaf75eabf6633e02135d7019b2e8@211.149.184.241:5060
CSeq: 104 INVITE
User-Agent: Asterisk PBX 11.7.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 238


来源: stackexchange

问:
Using Mechanize To login to gmail
I am trying to scrap gmail.com and have used mechanize to authenticate but since gmail has two step authentication it was quite tricky but i managed to login but i face loading problem.
My code is

```<code>from os import system
import sys
import speech_recognition as sr
import pyaudio
import urllib, urllib2
from bs4 import BeautifulSoup, Comment
import unicodedata
import mechanize
import cookielib
import time

cj = cookielib.CookieJar()
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_cookiejar(cj)
br.open("https://www.gmail.com")

br.select_form(nr=0)
br.form.set_all_readonly(False)
br.form['Email'] = 'vivek0293@gmail.com'

br.submit()

br.select_form(nr=0)
br.form['Passwd'] = '*******'
br.submit()

print"Success"

soup = BeautifulSoup(br.response().read(),"html.parser")

for row in soup.find_all('div'):
    print "hi"
    print row.text
</code>```

My Output looks like this:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7      /Users/vivekrahul/PycharmProjects/untitled/sample.py
Success
hi

hi
Loading vivek0293@gmail.com…Loading standard view |  (for slow connections)This is taking longer than usual. Try reloading the page.If that doesn't work, you can:Disable Labs and try again.If you're on a slow connection, try .For more troubleshooting tips, visit the Help Centre.
hi
Loading vivek0293@gmail.com…
hi
Loading vivek0293@gmail.com…
hi

hi

hi
Loading standard view |  (for slow connections)
hi
This is taking longer than usual. Try reloading the page.If that doesn't work, you can:Disable Labs and try again.If you're on a slow connection, try .For more troubleshooting tips, visit the Help Centre.
hi
If that doesn't work, you can:Disable Labs and try again.If you're on a slow connection, try .For more troubleshooting tips, visit the Help Centre.
hi

Process finished with exit code 0

答:
After login submit basic html view form as shown below, you will be redirect to basic HTML view of gmail.</p>

```<code>  GMAIL_URL = 'https://mail.google.com/mail/u/0/'

  soup = BeautifulSoup(br.response().read(),"html.parser")
  form = soup.find("form")
  action = form.get('action')
  post_url = GMAIL_URL + action
  g_html = self.session.get(post_url)
  gmail_doc = BeautifulSoup(g_html.text, 'html.parser')
</code>```

ContentLicense: CC BY-SA 3.0

Title: Using Mechanize To login to gmail

Body:
I am trying to scrap gmail.com and have used mechanize to authenticate but since gmail has two step authentication it was quite tricky but i managed to login but i face loading problem.
My code is

from os import system
import sys
import speech_recognition as sr
import pyaudio
import urllib, urllib2
from bs4 import BeautifulSoup, Comment
import unicodedata
import mechanize
import cookielib
import time

cj = cookielib.CookieJar()
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_cookiejar(cj)
br.open("https://www.gmail.com")

br.select_form(nr=0)
br.form.set_all_readonly(False)
br.form['Email'] = 'vivek0293@gmail.com'

br.submit()

br.select_form(nr=0)
br.form['Passwd'] = '*******'
br.submit()

print"Success"

soup = BeautifulSoup(br.response().read(),"html.parser")

for row in soup.find_all('div'):
    print "hi"
    print row.text

My Output looks like this:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7      /Users/vivekrahul/PycharmProjects/untitled/sample.py
Success
hi

hi
Loading vivek0293@gmail.com…Loading standard view |  (for slow connections)This is taking longer than usual. Try reloading the page.If that doesn't work, you can:Disable Labs and try again.If you're on a slow connection, try .For more troubleshooting tips, visit the Help Centre.
hi
Loading vivek0293@gmail.com…
hi
Loading vivek0293@gmail.com…
hi

hi

hi
Loading standard view |  (for slow connections)
hi
This is taking longer than usual. Try reloading the page.If that doesn't work, you can:Disable Labs and try again.If you're on a slow connection, try .For more troubleshooting tips, visit the Help Centre.
hi
If that doesn't work, you can:Disable Labs and try again.If you're on a slow connection, try .For more troubleshooting tips, visit the Help Centre.
hi

Process finished with exit code 0

Body:
After login submit basic html view form as shown below, you will be redirect to basic HTML view of gmail.

  GMAIL_URL = 'https://mail.google.com/mail/u/0/'

  soup = BeautifulSoup(br.response().read(),"html.parser")
  form = soup.find("form")
  action = form.get('action')
  post_url = GMAIL_URL + action
  g_html = self.session.get(post_url)
  gmail_doc = BeautifulSoup(g_html.text, 'html.parser')


问:
Debug Acceleo mtl transformation
I have eclipse neon with Acceleo 3.7 and writing a simple example (the same as the one in Getting Started) but I cannot debug the transformation using the 'Acceleo Plug-in Application' configuration. Actually, when I select this configuration, I cannot run the transformation at all and I get the following error:

Couldn't load class org.eclipse.acceleo.module.umlsample.main.Generate from project org.eclipse.acceleo.module.umlsample

When I run/debug the transformation with the 'Java Application' as the runner configuration, then the transformation runs however still not possible to debug the transformation.
Any idea how to solve this issue?

答:
From Eclipse Mars and onward, the "plug-in application" launch is no longer functional because of API changes in the internal platform. It has been removed from the latest versions of Acceleo.

You will have to go the long way 'round to debug your generation: generate a UI launcher, start a new eclipse runtime from your current eclipse ("Run > Run configurations", double click "eclipse application" and launch that), and you will have a new action to start your generation on models from that new runtime's workspace (as shown on the wiki's last image). This is debuggable from your first eclipse.

Title: Debug Acceleo mtl transformation


问:
onclick slide to page down not working
In this website

www.homepreneurawards.com

when navbar menu is clicked it wont slide to the specific div content what could be the issue

```<code> <header class="header type-1">
        <div class="container">
            <div class="logo-block">
                <a class="logo" href="#"><img src="http://homepreneurawards.com/Homepreneur/img/logo.gif" alt=""></a>
            </div>
            <nav class="main-nav">
                <ul class="anchor-navigation">
                    <li><a class="anchor-scroll" href="#aboutbrandavatar">ABOUT</a></li>
                    <li><a class="anchor-scroll" href="#whoishomepreneur">HOMEPRENEUR ?</a></li>
                    <li><a class="anchor-scroll" href="#categories">CATEGORIES</a></li>
                    <li><a class="anchor-scroll" href="#jurymembers">JURY MEMBERS</a></li>
                    <li><a class="anchor-scroll" href="#timeline">PROCESS FLOW</a></li>
                    <li><a class="anchor-scroll" href="#organizers">ORGANIZERS</a></li>
                    <li><a class="anchor-scroll" href="#sponsorspartners">SPONSORS</a></li>
                    <li><a class="anchor-scroll" href="#partnerscontent">PARTNERS</a></li>
                    <li><a class="anchor-scroll" href="#contact">CONTACT US</a></li>
                </ul>
            </nav>
            <button class="cmn-toggle-switch"><span></span></button>
        </div>
    </header>
</code>```

答:
presuming it is all on one page, </p>

```<code><li><a class="anchor-scroll" href="#aboutbrandavatar">ABOUT</a></li>

<div id="#aboutbrandavatar">
  scrolls to here once navbar is clicked
</div>
</code>```

<p>you can also try </p>

```<code><a href="#" name="aboutbrandavatar">

<div id="aboutbrandavatar">
  My div
</div>
</code>```

Title: onclick slide to page down not working

Body:
In this website

www.homepreneurawards.com

when navbar menu is clicked it wont slide to the specific div content what could be the issue

ABOUT

HOMEPRENEUR ?

CATEGORIES

JURY MEMBERS

PROCESS FLOW

ORGANIZERS

SPONSORS

PARTNERS

CONTACT US

            <button class="cmn-toggle-switch"></button>

Body:
presuming it is all on one page,

<li><a class="anchor-scroll" href="#aboutbrandavatar">ABOUT</a></li>

<div id="#aboutbrandavatar">
  scrolls to here once navbar is clicked
</div>

you can also try

<a href="#" name="aboutbrandavatar">

<div id="aboutbrandavatar">
  My div
</div>


问:
Pre-defining clusters in r
I have a pretty big data table (about 100.000 observations) that I'd like to use for clustering. Since some of the data is categorical, I've tried using "gower distance" and then hclust() with the "ward" method.
The data itself is very heterogeneous, which is why I'd like to sort of "pre-cluster" the data and then do the actual cluster analysis. Have any of you done this before and can point me in the right direction? I'm at a loss at the moment :(
With the mentioned methods, I don't really get useful clusters.
Thanks guys, I really appreciate every tip I can get.

Edit: I think that I didn't really explain my problem right, so here's another attempt: let's say, that I have a dataset containing brands of cars and some of their features. Before clustering them by features I would like to precluster them by brand. So all BMW e.g. are in the same cluster and so on.. and only after that I would like to cluster by features, so I should get a cluster with fast cars etc.
does anybody know, how to do this in R?
this does not describe my dataset, but maybe the question I'm having is clearer now.

答:
You should start with a sample first.

Once you get good results on the sample, try to reproduce it on a different sample. Once the results are stable, you can either try to scale the algorithm to the entire data set (maybe try doubling first), or you can train a classifier and predict the clusters of the remaining data. With most clustering algorithms, a 1 nearest neighbor classifier will be very good.

Title: Pre-defining clusters in r


问:
Parent DIV to inherit width (%) from child div
I am currently trying to figure out a way to be able to have a layout that has a bottom-up, content-oriented resizing behavior.

I have the following situation: https://codepen.io/Flash1232/pen/JJYPVQ

What is wrong here is obviously that the wrapper divs do not wrap around the table divs. Now is there any solution for this involving just plain CSS and HTML or do I have to write something in JS like "set wrapper width to the width of its inner div"?

Thanks in advance for any clues!

答:
You may want to consider using a flexbox. Please see below. If there is anything that needs to be different, just let me know.

.outer-div {
  position: absolute;
  background: black;
  width: 800px;
  left: 0;
  top: 0;
  bottom: 0;
  overflow: auto;
  padding: 10px;
}

.area {
  overflow: auto;
  display: flex;
  border: 5px solid red;
  background: white;
  margin: 10px 40px 10px 10px;
}

.column {
  background: green;
  border: 5px solid blue;
}

.wrapper {
  display: flex;
  border: 5px solid yellow;
  justify-content: center;
  align-items: center;
}

.table {
  white-space: nowrap;
}

.violet {
  background: violet;
  width: 120%;
  height: 80px;
}

.red {
  background: red;
  width: 150%;
  height: 80px;
  margin-bottom: 20px;
}

.icons {
  Background: yellow;
  float: right;
  height: auto;
  width: auto;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="outer-div">
  <div class="area">
    <div class="column">
      <div class="wrapper">
        <div class="table red">
          <span>***Table Content***</span>
        </div>
      </div>
      <div class="wrapper">
        <div class="table violet">
          <span>***Table Content***</span>
        </div>
      </div>
    </div>
    <div class="column">
      <div class="wrapper">
        <div class="table violet">
          <span>***Table Content***</span>
        </div>
      </div>
    </div>
  </div>
  <div class="icons">
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
  </div>
</div></code>```

Body:
You may want to consider using a flexbox. Please see below. If there is anything that needs to be different, just let me know.

.outer-div {
  position: absolute;
  background: black;
  width: 800px;
  left: 0;
  top: 0;
  bottom: 0;
  overflow: auto;
  padding: 10px;
}

.area {
  overflow: auto;
  display: flex;
  border: 5px solid red;
  background: white;
  margin: 10px 40px 10px 10px;
}

.column {
  background: green;
  border: 5px solid blue;
}

.wrapper {
  display: flex;
  border: 5px solid yellow;
  justify-content: center;
  align-items: center;
}

.table {
  white-space: nowrap;
}

.violet {
  background: violet;
  width: 120%;
  height: 80px;
}

.red {
  background: red;
  width: 150%;
  height: 80px;
  margin-bottom: 20px;
}

.icons {
  Background: yellow;
  float: right;
  height: auto;
  width: auto;
}

<div class="outer-div">
  <div class="area">
    <div class="column">
      <div class="wrapper">
        <div class="table red">
          <span>***Table Content***</span>
        </div>
      </div>
      <div class="wrapper">
        <div class="table violet">
          <span>***Table Content***</span>
        </div>
      </div>
    </div>
    <div class="column">
      <div class="wrapper">
        <div class="table violet">
          <span>***Table Content***</span>
        </div>
      </div>
    </div>
  </div>
  <div class="icons">
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
    <p>Icon</p>
  </div>
</div>


问:
How to give custom name to images when downloading through scrapy
This is my program to download images through image pipeline. It works well and download images but the problem ** is it rename images in sha1 hash after that I am unable to identify them. Can there be any solution so that I can use the **model_name as of the images to be download?

```<code>   import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from selenium import webdriver
from urlparse import urljoin
import time

class CompItem(scrapy.Item):
    model_name = scrapy.Field()
    images = scrapy.Field()
    image_urls = scrapy.Field()
    image_name = scrapy.Field()

class criticspider(CrawlSpider):
    name = "buysmaart_images"
    allowed_domains = ["http://buysmaart.com/"]
    start_urls = ["http://buysmaart.com/productdetails/550/Samsung-Galaxy-Note-4",  "http://buysmaart.com/productdetails/115/HTC-One-M8-Eye",  "http://buysmaart.com/productdetails/506/OPPO-N1",  "http://buysmaart.com/productdetails/342/LG-G2-D802T"]

    def __init__(self, *args, **kwargs):
        super(criticspider, self).__init__(*args, **kwargs)
        self.download_delay = 0.25
        self.browser = webdriver.Firefox()
        self.browser.implicitly_wait(2)

    def parse_start_url(self, response):
        self.browser.get(response.url)
        time.sleep(8)
        sel = Selector(text=self.browser.page_source)
        item = CompItem()

        photos = sel.xpath('//ul[contains(@id,"productImageUl")]/li')
        print len(photos)
        all_photo_urls = []
        for photo in photos:
            item['image_name'] = sel.xpath('.//h3[contains(@class,"ng-binding")]/text()').extract()[0].encode('ascii','ignore')
            #tmp_url = photo.xpath('.//img/@src').extract()[0].encode('ascii','ignore')
            image_url = photo.xpath('.//img/@src').extract()[0]
            all_photo_urls.append(image_url)
            item['image_urls'] = all_photo_urls
        yield item
</code>```

pipeline

```<code>    from scrapy.contrib.pipeline.images import DownloadImagesPipeline
from scrapy.exceptions import DropItem
from scrapy.http import Request
class DownloadImagesPipeline(object):
    def process_item(self, item, spider):
         def get_media_requests(self, item, info):
        return [Request(x, meta={'image_names': item["image_name"]})
                for x in item.get('image_urls', [])]

def get_images(self, response, request, info):
    for key, image, buf, in super(DownloadImagesPipeline, self).get_images(response, request, info):
        if re.compile('^[0-9,a-f]+.jpg$').match(key):
            key = self.change_filename(key, response)
        yield key, image, buf

def change_filename(self, key, response):
    return "%s.jpg" % response.meta['image_name'][0]

    def item_completed(self, results, item, info):
        image_paths = [x['path'] for ok, x in results if ok]
        if not image_paths:
            raise DropItem("Item contains no images")
        item['image_paths'] = image_paths
        return item
</code>```

settings

```<code>BOT_NAME = 'download_images'

SPIDER_MODULES = ['download_images.spiders']
NEWSPIDER_MODULE = 'download_images.spiders'
ITEM_PIPELINES = ['scrapy.contrib.pipeline.images.ImagesPipeline']
IMAGES_STORE= '/home/john/Desktop/download_images/31_jul'
</code>```

答:
Scrapy 1.3.3 solution(override image_downloaded methods):

```<code>import scrapy
from scrapy.pipelines.images import ImagesPipeline
from scrapy.utils.misc import md5sum
class MyImagesPipeline(ImagesPipeline):
    def get_media_requests(self, item, info):
        for image_url in item['image_urls']:
            yield scrapy.Request(image_url, meta={'image_names': item["image_names"]})

    def image_downloaded(self, response, request, info):
        checksum = None
        for path, image, buf in self.get_images(response, request, info):
            if checksum is None:
                buf.seek(0)
                checksum = md5sum(buf)
            width, height = image.size
            path = 'full/%s' % response.meta['image_names'][0] # **Here Changed**
            self.store.persist_file(
                path, buf, info,
                meta={'width': width, 'height': height},
                headers={'Content-Type': 'image/jpeg'})
        return checksum
</code>```

Body:
This is my program to download images through image pipeline. It works well and download images but the problem ** is it rename images in sha1 hash after that I am unable to identify them. Can there be any solution so that I can use the **model_name as of the images to be download?

   import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from selenium import webdriver
from urlparse import urljoin
import time

class CompItem(scrapy.Item):
    model_name = scrapy.Field()
    images = scrapy.Field()
    image_urls = scrapy.Field()
    image_name = scrapy.Field()

class criticspider(CrawlSpider):
    name = "buysmaart_images"
    allowed_domains = ["http://buysmaart.com/"]
    start_urls = ["http://buysmaart.com/productdetails/550/Samsung-Galaxy-Note-4",  "http://buysmaart.com/productdetails/115/HTC-One-M8-Eye",  "http://buysmaart.com/productdetails/506/OPPO-N1",  "http://buysmaart.com/productdetails/342/LG-G2-D802T"]

    def __init__(self, *args, **kwargs):
        super(criticspider, self).__init__(*args, **kwargs)
        self.download_delay = 0.25
        self.browser = webdriver.Firefox()
        self.browser.implicitly_wait(2)

    def parse_start_url(self, response):
        self.browser.get(response.url)
        time.sleep(8)
        sel = Selector(text=self.browser.page_source)
        item = CompItem()

        photos = sel.xpath('//ul[contains(@id,"productImageUl")]/li')
        print len(photos)
        all_photo_urls = []
        for photo in photos:
            item['image_name'] = sel.xpath('.//h3[contains(@class,"ng-binding")]/text()').extract()[0].encode('ascii','ignore')
            #tmp_url = photo.xpath('.//img/@src').extract()[0].encode('ascii','ignore')
            image_url = photo.xpath('.//img/@src').extract()[0]
            all_photo_urls.append(image_url)
            item['image_urls'] = all_photo_urls
        yield item

pipeline

    from scrapy.contrib.pipeline.images import DownloadImagesPipeline
from scrapy.exceptions import DropItem
from scrapy.http import Request
class DownloadImagesPipeline(object):
    def process_item(self, item, spider):
         def get_media_requests(self, item, info):
        return [Request(x, meta={'image_names': item["image_name"]})
                for x in item.get('image_urls', [])]

def get_images(self, response, request, info):
    for key, image, buf, in super(DownloadImagesPipeline, self).get_images(response, request, info):
        if re.compile('^[0-9,a-f]+.jpg$').match(key):
            key = self.change_filename(key, response)
        yield key, image, buf

def change_filename(self, key, response):
    return "%s.jpg" % response.meta['image_name'][0]

    def item_completed(self, results, item, info):
        image_paths = [x['path'] for ok, x in results if ok]
        if not image_paths:
            raise DropItem("Item contains no images")
        item['image_paths'] = image_paths
        return item

settings

BOT_NAME = 'download_images'

SPIDER_MODULES = ['download_images.spiders']
NEWSPIDER_MODULE = 'download_images.spiders'
ITEM_PIPELINES = ['scrapy.contrib.pipeline.images.ImagesPipeline']
IMAGES_STORE= '/home/john/Desktop/download_images/31_jul'

Body:
Scrapy 1.3.3 solution(override image_downloaded methods):

import scrapy
from scrapy.pipelines.images import ImagesPipeline
from scrapy.utils.misc import md5sum
class MyImagesPipeline(ImagesPipeline):
    def get_media_requests(self, item, info):
        for image_url in item['image_urls']:
            yield scrapy.Request(image_url, meta={'image_names': item["image_names"]})

    def image_downloaded(self, response, request, info):
        checksum = None
        for path, image, buf in self.get_images(response, request, info):
            if checksum is None:
                buf.seek(0)
                checksum = md5sum(buf)
            width, height = image.size
            path = 'full/%s' % response.meta['image_names'][0] # **Here Changed**
            self.store.persist_file(
                path, buf, info,
                meta={'width': width, 'height': height},
                headers={'Content-Type': 'image/jpeg'})
        return checksum


问:
Save data randomly generated into label
I am fairly new to coding and was wondering if it was possible to save data I have randomly generated into a label. I can randomly generate the data and input it into the label but I am having difficulties saving the previous data from the label to an array. Is it possible to do this? And how would it be done?

Essentially I want the user to be able to go back to the previous text in the label if they press a button

Thank you for any help.

code:

This is how I am generating the random variable from an array which contains quotes

```<code>//right hand button tapped

@IBAction func RHSButton(_ sender: Any) {

// randomises variable to display
    var randomQuote: String {
        let randomNumber = Int(arc4random_uniform(UInt32(myQuotes.count)))
        return myQuotes[randomNumber]}

   quotesLabel.text = randomQuote

}
</code>```

I want to be able to store the data into an array called:

```<code>var randomGeneratedQuotes : [String] = []
</code>```

But I am not quite sure how

答:
If I understand you correctly you could save the value of your label into your randomGeneratedQuotes array just before you generate a new random value.

```<code>var randomQuote: String {
    let randomNumber = Int(arc4random_uniform(UInt32(myQuotes.count)))
    return myQuotes[randomNumber]
}

@IBAction func RHSButton(_ sender: Any) {
   //If a value is present, save it
   if let oldValue = quotesLabel.text {
       randomGeneratedQuotes.append(oldValue)
   }

   //and update the value
   quotesLabel.text = randomQuote
}
</code>```

From your previous questions I'm guessing you'd like a LHSButton function to give you the previous value, that could look like so:

```<code>@IBAction func LHSButton(_ sender: Any) {
   //Do we have a previous value?
   if randomGeneratedQuotes.count > 0 {
       //take that
       let previousValue = randomGeneratedQuotes.removeLast()
       //and use it
       quotesLabel.text = previousValue
   }
}
</code>```

Hope that works and helps.

Title: Save data randomly generated into label

Body:
I am fairly new to coding and was wondering if it was possible to save data I have randomly generated into a label. I can randomly generate the data and input it into the label but I am having difficulties saving the previous data from the label to an array. Is it possible to do this? And how would it be done?

Essentially I want the user to be able to go back to the previous text in the label if they press a button

Thank you for any help.

code:

This is how I am generating the random variable from an array which contains quotes

//right hand button tapped

@IBAction func RHSButton(_ sender: Any) {

// randomises variable to display
    var randomQuote: String {
        let randomNumber = Int(arc4random_uniform(UInt32(myQuotes.count)))
        return myQuotes[randomNumber]}

   quotesLabel.text = randomQuote

}

I want to be able to store the data into an array called:

var randomGeneratedQuotes : [String] = []

But I am not quite sure how

Body:
If I understand you correctly you could save the value of your label into your randomGeneratedQuotes array just before you generate a new random value.

var randomQuote: String {
    let randomNumber = Int(arc4random_uniform(UInt32(myQuotes.count)))
    return myQuotes[randomNumber]
}

@IBAction func RHSButton(_ sender: Any) {
   //If a value is present, save it
   if let oldValue = quotesLabel.text {
       randomGeneratedQuotes.append(oldValue)
   }

   //and update the value
   quotesLabel.text = randomQuote
}

From your previous questions I'm guessing you'd like a LHSButton function to give you the previous value, that could look like so:

@IBAction func LHSButton(_ sender: Any) {
   //Do we have a previous value?
   if randomGeneratedQuotes.count > 0 {
       //take that
       let previousValue = randomGeneratedQuotes.removeLast()
       //and use it
       quotesLabel.text = previousValue
   }
}

Hope that works and helps.


问:
4 images in one view using linear layout android
I wish to make 2 by 2 image using LinearLayout with you equal weight. Can someone please assist me thanks. Your help will be appreciated thanks

I am trying to get my xml for my Android app working but I have some problems. I am trying to display to equal sized 2 images side by side in a linear layout. There has to be a margin between them, on both sides right and left, and on top.

MY code can only give me 3 images but I need 4 images.
I'd appreciate any help solving this problem

This is my code:

```<code><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:orientation="horiztontal"
    android:weightSum="2">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"

        />

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:weightSum="2">

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:weightSum="1">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/imageView3"
                android:layout_weight="1" />

        </LinearLayout>
    </LinearLayout>
</code>```

答:
```<code>Use the Code split 4 images equally

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/linear1"
    android:orientation="horizontal"
    android:layout_weight="1">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="5dp"
    android:id="@+id/imageview"/>
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="5dp"
    android:id="@+id/imageview1"/>
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/linear2"
    android:orientation="horizontal"
    android:layout_weight="1">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_margin="5dp"
        android:id="@+id/imageview3"/>
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_margin="5dp"
        android:id="@+id/imageview14"/>
</LinearLayout>
</code>```

Each Image View Set the Scaletype property to set as FitXY

Body:
I wish to make 2 by 2 image using LinearLayout with you equal weight. Can someone please assist me thanks. Your help will be appreciated thanks

I am trying to get my xml for my Android app working but I have some problems. I am trying to display to equal sized 2 images side by side in a linear layout. There has to be a margin between them, on both sides right and left, and on top.

MY code can only give me 3 images but I need 4 images.
I'd appreciate any help solving this problem

This is my code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:orientation="horiztontal"
    android:weightSum="2">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"

        />

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:weightSum="2">

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:weightSum="1">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/imageView3"
                android:layout_weight="1" />

        </LinearLayout>
    </LinearLayout>

Body:
Use the Code split 4 images equally

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/linear1"
    android:orientation="horizontal"
    android:layout_weight="1">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="5dp"
    android:id="@+id/imageview"/>
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="5dp"
    android:id="@+id/imageview1"/>
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/linear2"
    android:orientation="horizontal"
    android:layout_weight="1">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_margin="5dp"
        android:id="@+id/imageview3"/>
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_margin="5dp"
        android:id="@+id/imageview14"/>
</LinearLayout>

Each Image View Set the Scaletype property to set as FitXY


问:
Simplex algorithm in scipy package python
I am reading the documentation of the Simplex Algorithm provided in the Scipy package of python, but the example shown in the last at this documentation page is solving a minimization problem. Whereas I want to do a maximization. How would you alter the parameters in order to perform a maximization if we can do maximization using this package?</p>

答:
Every maximization problem can be transformed into a minimization problem by multiplying the c-vector by -1: Say you have the 2-variable problem from the documentation, but want to maximize c=[-1,4]

```<code>from scipy.optimize import linprog
import numpy
c = numpy.array([-1, 4]) # your original c for maximization
c *= -1 # negate the objective coefficients
A = [[-3, 1], [1, 2]]
b = [6, 4]
x0_bnds = (None, None)
x1_bnds = (-3, None)
res = linprog(c, A, b, bounds=(x0_bnds, x1_bnds))
print("Objective = {}".format(res.get('fun') * -1)) # don't forget to retransform your objective back!
</code>```

outputs

```<code>>>> Objective = 11.4285714286
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Every maximization problem can be transformed into a minimization problem by multiplying the c-vector by -1: Say you have the 2-variable problem from the documentation, but want to maximize c=[-1,4]

from scipy.optimize import linprog
import numpy
c = numpy.array([-1, 4]) # your original c for maximization
c *= -1 # negate the objective coefficients
A = [[-3, 1], [1, 2]]
b = [6, 4]
x0_bnds = (None, None)
x1_bnds = (-3, None)
res = linprog(c, A, b, bounds=(x0_bnds, x1_bnds))
print("Objective = {}".format(res.get('fun') * -1)) # don't forget to retransform your objective back!

outputs

>>> Objective = 11.4285714286


问:
swfObject embeded object not working in ie11
After a long day of searching on the web, i didn't find any solution to my problem.

I have a problem loading an swf file in my webPage using swfObject, doesn't work in IE11 ( works fine in ie8-10,  firefox and chrome)

Here's my context  :
This is the initialization of the params send to IE through the swfObject
`

```<code>// For version detection
var swfVersionStr = "10.0.0";

// To use express install, set to playerProductInstall.swf
var xiSwfUrlStr = "commun/swf/playerProductInstall.swf";

//FlashVars : contains an url used for an http request that returns  the crossdomain.xml file with the crossDomainPolicy...
var flashvars = {
    crossdomainURL : httpOrigin + "the.url.to.crossdomain.policy.file"
};

var params = {};
params.quality = "high";
params.bgcolor = "white";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "dematMultiuploader";
attributes.name = "dematMultiuploader";
attributes.align = "middle";
swfobject.embedSWF(
    "the/url/to/SWFfile.swf", "falshContentID",
    "550", "280",
    swfVersionStr, xiSwfUrlStr,
    flashvars, params, attributes);
</code>```

`
And here's my object tag

```<code><noscript>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="280"     id="dematMultiuploader">
        <param name="movie" value="path/to/swf/file.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="white" />
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="true" />
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="gedemat/gecco/piece/pieceDocument.create.swf"
            width="350" height="130" id="dematMultiuploader">
            <param name="quality" value="high" />
            <param name="bgcolor" value="white" />
            <param name="allowScriptAccess" value="sameDomain" />
            <param name="allowFullScreen" value="true" />
            <!--<![endif]-->
            <!--[if gte IE 6]>-->
            <p>Either scripts and active content are not permitted to run or
                Adobe Flash Player version 10.0.0 or greater is not installed.</p>
            <!--<![endif]-->
            <a href="http://www.adobe.com/go/getflashplayer"> <img
                src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
                alt="Get Adobe Flash Player" />
            </a>
            <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
    </object>
</noscript>
</code>```

As you can see there's no flashVars param in the Object tag for IE, could that be the problem?

May be IE changed some parameters names for IE11 like crossDomainUrl?

I tryed already to put the flashvars param in the object tag with the crossDomain url but it didn't work.

In firefox and chrome i get this error  :

NetworkError: 404 not found - http://localhost:8080/crossdomain.xml

So they try to load the file directly at the root of the server without any success but it still works because the crossdomain.xml has already been loaded before this call. Maybe IE is having trouble finding this file at that particular moment? not taking into account the ones loaded before?

Any Ideas?

答:
falshContentID is not found in the html part. Remove the entire object tag and add
the below code in html area.</p>

```<code><div id="falshContentID"></div>
</code>```

Body:
After a long day of searching on the web, i didn't find any solution to my problem.

I have a problem loading an swf file in my webPage using swfObject, doesn't work in IE11 ( works fine in ie8-10,  firefox and chrome)

Here's my context  :
This is the initialization of the params send to IE through the swfObject
`

// For version detection
var swfVersionStr = "10.0.0";

// To use express install, set to playerProductInstall.swf
var xiSwfUrlStr = "commun/swf/playerProductInstall.swf";

//FlashVars : contains an url used for an http request that returns  the crossdomain.xml file with the crossDomainPolicy...
var flashvars = {
    crossdomainURL : httpOrigin + "the.url.to.crossdomain.policy.file"
};

var params = {};
params.quality = "high";
params.bgcolor = "white";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "dematMultiuploader";
attributes.name = "dematMultiuploader";
attributes.align = "middle";
swfobject.embedSWF(
    "the/url/to/SWFfile.swf", "falshContentID",
    "550", "280",
    swfVersionStr, xiSwfUrlStr,
    flashvars, params, attributes);

`
And here's my object tag

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="280"     id="dematMultiuploader">
        <param name="movie" value="path/to/swf/file.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="white" />
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="true" />

        <object type="application/x-shockwave-flash" data="gedemat/gecco/piece/pieceDocument.create.swf"
            width="350" height="130" id="dematMultiuploader">
            <param name="quality" value="high" />
            <param name="bgcolor" value="white" />
            <param name="allowScriptAccess" value="sameDomain" />
            <param name="allowFullScreen" value="true" />

Either scripts and active content are not permitted to run or
                Adobe Flash Player version 10.0.0 or greater is not installed.

        </object>

    </object>

As you can see there's no flashVars param in the Object tag for IE, could that be the problem?

May be IE changed some parameters names for IE11 like crossDomainUrl?

I tryed already to put the flashvars param in the object tag with the crossDomain url but it didn't work.

In firefox and chrome i get this error  :

NetworkError: 404 not found - http://localhost:8080/crossdomain.xml

So they try to load the file directly at the root of the server without any success but it still works because the crossdomain.xml has already been loaded before this call. Maybe IE is having trouble finding this file at that particular moment? not taking into account the ones loaded before?

Any Ideas?

Body:
falshContentID is not found in the html part. Remove the entire object tag and add
the below code in html area.

<div id="falshContentID"></div>


问:
gsub R extracting string
I am trying to extract a string between two commas with gsub. If I have the following

```<code>xz<- "1620 Honeylocust Drive, 60210 IL, USA"
</code>```

and I want to extract everything between the two commas, (60120 IL), is it possible to use gsub?

I have tried

```<code>gsub(".*,","",xz)
</code>```

The result is USA. How can I do it?

答:
We can match zero or more characters that are not a , ([^,]*) followed by a , followed by zero or more space from the start (^) of the string or | a ,  followed by zero or more characters that are not a , ([^,]*) at the end ($) of string and replace with blank ("")

```<code>gsub("^[^,]*,\\s*|,[^,]*$", "", xz)
#[1] "60210 IL"
</code>```

Or another option is using sub and capture as a group

```<code>sub("^[^,]+,\\s+([^,]+).*", "\\1", xz)
#[1] "60210 IL"
</code>```

Or another option is regexpr/regmatches

```<code>regmatches(xz, regexpr("(?<=,\\s)[^,]*(?=,)", xz, perl = TRUE))
#[1] "60210 IL"
</code>```

Or with str_extract from stringr

```<code>library(stringr)
str_extract(xz, "(?<=,\\s)[^,]*(?=,)")
#[1] "60210 IL"
</code>```

Update

With the new string,

```<code>xz1 <- "1620, Honeylocust Drive, 60210 IL, USA"
sub(".*,\\s+(+[0-9]+[^,]+).*", "\\1", xz1)
#[1] "60210 IL"
</code>```

Title: gsub R extracting string

Body:
I am trying to extract a string between two commas with gsub. If I have the following

xz<- "1620 Honeylocust Drive, 60210 IL, USA"

and I want to extract everything between the two commas, (60120 IL), is it possible to use gsub?

I have tried

gsub(".*,","",xz)

The result is USA. How can I do it?

Body:
We can match zero or more characters that are not a , ([^,]*) followed by a , followed by zero or more space from the start (^) of the string or | a ,  followed by zero or more characters that are not a , ([^,]*) at the end ($) of string and replace with blank ("")

gsub("^[^,]*,\\s*|,[^,]*$", "", xz)
#[1] "60210 IL"

Or another option is using sub and capture as a group

sub("^[^,]+,\\s+([^,]+).*", "\\1", xz)
#[1] "60210 IL"

Or another option is regexpr/regmatches

regmatches(xz, regexpr("(?<=,\\s)[^,]*(?=,)", xz, perl = TRUE))
#[1] "60210 IL"

Or with str_extract from stringr

library(stringr)
str_extract(xz, "(?<=,\\s)[^,]*(?=,)")
#[1] "60210 IL"

Update

With the new string,

xz1 <- "1620, Honeylocust Drive, 60210 IL, USA"
sub(".*,\\s+(+[0-9]+[^,]+).*", "\\1", xz1)
#[1] "60210 IL"


问:
count length of lookup field in Dynamics crm
I created a fetchxml to filter a contract lookup field in a CRM. I want to be able to see how many records is there in the contract lookup field. If there is only one record I want to be able to auto populate that lookup field.

Tried using an API function to be able to loop through the fetchxml records but not having any luck with returning the count. Is there another way to go about getting the results I need?

 function buildCustomView() {
        // Some GUID but only needs to be unique among the other available views for the lookup
        var viewId = "{00000000-0000-0000-0000-000000000001}";
        var viewDisplayName = "Contracts for This Account";

        //Only need Contracts for the selected Worksite and buisness unit if filled in
        var worksite = getFieldValue("hc_worksite");

        if (!worksite) { return; }
        if (!worksite[0]) { return; }
        if (!worksite[0].id) { return; }
        //check if buisness unit is availble and if it is can filter lookup further
        var buisnessUnit = getFieldValue("hc_businessunit");
        var condition;
        if (buisnessUnit != null) {
            condition = "<filter type='and'>" +
                                  "<condition attribute='hc_businessunit' operator='eq' value='" + buisnessUnit[0].id + "' />" +
                                "</filter>";
            ///if take out the account name, contract lookup will still be filteredl
        } else {
            condition = "";
        }

        //Get all Contracts that pertain to the selected worksite
        var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'  >" +
                         "<entity name='contract'>" +
                            "<attribute name='title' />" +
                            "<attribute name='customerid' />" +
                            "<attribute name='contractid' />" +
                            "<attribute name='hc_contracttype' />" +
                            "<attribute name='hc_contractsubtype' />" +
                            "<attribute name='activeon' />" +
                            "<attribute name='hc_contractlevel' />" +
                            "<attribute name='expireson' />" +
                            "<attribute name='hc_contractaccount' />" +
                            "<attribute name='hc_contract' />" +
                            "<order attribute='title' descending='false' />" + condition +
                            "<link-entity name='hc_account_contract' from='contractid' to='contractid' visible='false' intersect='true'>" +
                              "<link-entity name='account' from='accountid' to='accountid' alias='ab'>" +
                                "<filter type='and'>" +
                                  "<condition attribute='accountid' operator='eq' value='" + worksite[0].id + "' />" +
                                "</filter>" +
                              "</link-entity>" +
                            "</link-entity>" +
                          "</entity>" +
                        "</fetch>";
        //Set up the whole view's UI
        var layoutXml = "<grid name='resultset' object='1' jump='hc_contract' select='1' icon='1' preview='2'>" +
                         "<row name='result' id='contractid'>" +
                          "<cell name='title' width='300' />" +
                          "<cell name='hc_contractaccount' width='200' />" +
                          "<cell name='hc_contracttype' width='100' />" +
                          "<cell name='hc_contractsubtype' width='100' />" +
                          "<cell name='hc_contractlevel' width='100' />" +
                          "<cell name='activeon' width='100' />" +
                          "<cell name='expireson' width='100' />" +
                          "<cell name='customerid' width='150' />" +
                          "<cell name='hc_contract' width='100' />" +
                         "</row>" +
                        "</grid>";

        try {
            //Set the view
            Xrm.Page.getControl("hc_contract").addCustomView(viewId, "contract", viewDisplayName, fetchXml, layoutXml, true);
        } catch (e) {
            Xrm.Utility.alertDialog("Error: " + e.message);
        }
        var count = 0;
        //count results of fetch xml
         SDK.WEBAPI.executeFetchSync("contract", fetchXml,
            function (results) {

               for (i=0;i<results.length; i++){
                    count++;
                }
                Xrm.Utility.alertDialog(count);
            },
            function (error) {
                //Show error
                alertDialog("Error: " + error.message);
            });

    }```

答:
You can count the records returned by a FetchXML query using the count aggregate attribute. See documentation here.

Put aggregate='true' in the first line of your fetch:

```<code><fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' aggregate='true'>
</code>```

And then add a count aggregate attribute:

```<code><attribute name='contractid' alias='contract_count' aggregate='count' />
</code>```

Then get the value in your executeFetchSync success callback:

results.entities[0].contract_count;
```

Body:
You can count the records returned by a FetchXML query using the count aggregate attribute. See documentation here.

Put aggregate='true' in the first line of your fetch:

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' aggregate='true'>

And then add a count aggregate attribute:

<attribute name='contractid' alias='contract_count' aggregate='count' />

Then get the value in your executeFetchSync success callback:

results.entities[0].contract_count;


问:
I am calling a parent funciton in base class but returns nothing
```<code>class ajay{
    function test(){
        return "sandeep";
    }
}

class Sandeep extends ajay{
    function testing(){
        parent::test();
    }
}
$objct = new Sandeep();echo $objct->testing();
</code>```

答:
You forgot return in testing() method:

```<code>class ajay {
    function test(){
        return "sandeep";
    }
}

class Sandeep extends ajay{
    function testing(){
        return parent::test();
    }
}
</code>```

Body:
You forgot return in testing() method:

class ajay {
    function test(){
        return "sandeep";
    }
}

class Sandeep extends ajay{
    function testing(){
        return parent::test();
    }
}


问:
Non adjacent cells in excel using INDIRECT function
I am trying to create a formula to find only alpha numeric number in the cells and ignore the rest of the numbers and sum the values of the alpha numeric numbers alone. the formula I tired is working if I choose a range of cells. But I want to apply this only to alternate cells so I used INDIRECT function. I could see the indirect function is not grepping the values in the cell hence it fails. Can someone help me on this.

Attached, the sample excel pattern used

Formula working for continuous cells  Ctrl+Shift+Enter:

```<code>=SUM(IFERROR(VALUE(LEFT(A2:F2,LEN(A2:F2)-1)),0))
</code>```

Formula not working for non adjacent cells:

```<code>=SUM(IFERROR(VALUE(LEFT(INDIRECT({"A2","C2","E2"}),LEN(INDIRECT({"A2","C2","E2"}))-1)),0))
</code>```

In this I could see INDIRECT({"A2","C2","E2"}) itself is not returning the value of A2,C2,E2.

答:
Try this array-entered formula:</p>

```<code>{=SUM(IFERROR(VALUE(LEFT(T(OFFSET(A2,0,{0,2,4},1,1)),LEN(T(OFFSET(A2,0,{0,2,4},1,1)))-1)),0))}
</code>```

Body:
I am trying to create a formula to find only alpha numeric number in the cells and ignore the rest of the numbers and sum the values of the alpha numeric numbers alone. the formula I tired is working if I choose a range of cells. But I want to apply this only to alternate cells so I used INDIRECT function. I could see the indirect function is not grepping the values in the cell hence it fails. Can someone help me on this.

Attached, the sample excel pattern used

Formula working for continuous cells  Ctrl+Shift+Enter:

=SUM(IFERROR(VALUE(LEFT(A2:F2,LEN(A2:F2)-1)),0))

Formula not working for non adjacent cells:

=SUM(IFERROR(VALUE(LEFT(INDIRECT({"A2","C2","E2"}),LEN(INDIRECT({"A2","C2","E2"}))-1)),0))

In this I could see INDIRECT({"A2","C2","E2"}) itself is not returning the value of A2,C2,E2.

Body:
Try this array-entered formula:

{=SUM(IFERROR(VALUE(LEFT(T(OFFSET(A2,0,{0,2,4},1,1)),LEN(T(OFFSET(A2,0,{0,2,4},1,1)))-1)),0))}


问:
How to serialize an object that are in a library?
I am developing an Android application and need to store some objects to the disk for some reason (with the onSaveInstanceState() method) and then retrieve them back again (with the onRestoreInstanceState() method) with Serialization/Parcelable.

As you might know, to make a class as Parcelable, you need to use Parceler Library or write some boilerplate code.

My problem is, that I have some objects that don't write their class. They are a 3rd party or Android-Sdk related Class. For clarity here is my code:

```<code>private FragNavController mNavController;
private MenuItem mMenuItem;
private SharedPreferences mPrefs;

@Override
public void onCreate(Bundle savedInstanceState) {
    LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
    setDefaultLanguage(Locale.ENGLISH.toString());
    //Paper.init(getApplicationContext());

    mPrefs = getPreferences(MODE_PRIVATE);
    super.onCreate(savedInstanceState);
    .
    .
    .
}
</code>```

I use Parceler Library, Xstream ,icepick, paper, Gson and sharedPreferences Method, but in all of them, I fail to save some objects like mNavController and mMenuItem.

Has anyone faced this problem before and know the best solution to save these objects?

答:
A non-answer: do not do this.

Serialization of objects is always tricky business. You have to keep an eye on versioning; to ensure that upgrading your app will not break access to previously serialized objects.

That can be hard enough for your own things. But you intend to serialize objects you know nothing about. So any change to that the 3rd party makes to its classes might directly affect your app. The last thing you want to happen is that some update on the customer device that is not related to your product crashes your product; because all of a sudden previously serialized objects can't be deserialized any more.

Long story short: be cautious to preserve the state of your application by "simply" saving all the objects it is using. A much more robust approach would be to step back and identify the "data elements" in your design; and make sure that you can store that data as data; instead of storing objects - as those objects, yes contain your data; but probably many other things you really don't care about. But still you are forced to think about these other things, because you have to (de)serialize them, too.

In other words: A) first you should isolate the data that needs to be persisted; and when you got that B) you look into good ways of persisting that information. If you use your own database, or shared preferences, ...  might depend on your requirements.

Body:
I am developing an Android application and need to store some objects to the disk for some reason (with the onSaveInstanceState() method) and then retrieve them back again (with the onRestoreInstanceState() method) with Serialization/Parcelable.

As you might know, to make a class as Parcelable, you need to use Parceler Library or write some boilerplate code.

My problem is, that I have some objects that don't write their class. They are a 3rd party or Android-Sdk related Class. For clarity here is my code:

private FragNavController mNavController;
private MenuItem mMenuItem;
private SharedPreferences mPrefs;

@Override
public void onCreate(Bundle savedInstanceState) {
    LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
    setDefaultLanguage(Locale.ENGLISH.toString());
    //Paper.init(getApplicationContext());

    mPrefs = getPreferences(MODE_PRIVATE);
    super.onCreate(savedInstanceState);
    .
    .
    .
}

I use Parceler Library, Xstream ,icepick, paper, Gson and sharedPreferences Method, but in all of them, I fail to save some objects like mNavController and mMenuItem.

Has anyone faced this problem before and know the best solution to save these objects?