问:
Pocketsphinx Input overrun, read calls are too rare
I try to install Pocketsphinx on a speaker which works with Buildroot. Before testing it on the speaker, I tried Pocketsphinx on my Raspberry-pi3.
The problem is that I have different results on both devices, despite them having approximately the same hardware performance.

When I try to decode a wav file, I have this result on both devices (both accuracy and time are similar):

```<code>pocketsphinx_continuous -infile /mnt/usb/file-16000.wav -dict /mnt/usb/sphinx-
french/fr.dict -lm /mnt/usb/sphinx-french/fr-small.lm.bin -hmm /mnt/usb/sphinx-f
rench/cmusphinx-fr-5.2
INFO: pocketsphinx.c(152): Parsed model-specific feature parameters from /mnt/usb/sphinx-french/cmusphinx-fr-5.2/feat.params
Current configuration:
[NAME]                  [DEFLT]         [VALUE]
-agc                    none            none
-agcthresh              2.0             2.000000e+00
-allphone
-allphone_ci            no              no
-alpha                  0.97            9.700000e-01
-ascale                 20.0            2.000000e+01
-aw                     1               1
-backtrace              no              no
-beam                   1e-48           1.000000e-48
-bestpath               yes             yes
-bestpathlw             9.5             9.500000e+00
-ceplen                 13              13
-cmn                    current         current
-cmninit                8.0             8.0
-compallsen             no              no
-debug                                  0
-dict                                   /mnt/usb/sphinx-french/fr.dict
-dictcase               no              no
-dither                 no              no
-doublebw               no              no
-ds                     1               1
-fdict
-feat                   1s_c_d_dd       1s_c_d_dd
-featparams
-fillprob               1e-8            1.000000e-08
-frate                  100             100
-fsg
-fsgusealtpron          yes             yes
-fsgusefiller           yes             yes
-fwdflat                yes             yes
-fwdflatbeam            1e-64           1.000000e-64
-fwdflatefwid           4               4
-fwdflatlw              8.5             8.500000e+00
-fwdflatsfwin           25              25
-fwdflatwbeam           7e-29           7.000000e-29
-fwdtree                yes             yes
-hmm                                    /mnt/usb/sphinx-french/cmusphinx-fr-5.2
-input_endian           little          little
-jsgf
-keyphrase
-kws
-kws_delay              10              10
-kws_plp                1e-1            1.000000e-01
-kws_threshold          1               1.000000e+00
-latsize                5000            5000
-lda
-ldadim                 0               0
-lifter                 0               22
-lm                                     /mnt/usb/sphinx-french/fr-small.lm.bin
-lmctl
-lmname
-logbase                1.0001          1.000100e+00
-logfn
-logspec                no              no
-lowerf                 133.33334       1.300000e+02
-lpbeam                 1e-40           1.000000e-40
-lponlybeam             7e-29           7.000000e-29
-lw                     6.5             6.500000e+00
-maxhmmpf               30000           30000
-maxwpf                 -1              -1
-mdef
-mean
-mfclogdir
-min_endfr              0               0
-mixw
-mixwfloor              0.0000001       1.000000e-07
-mllr
-mmap                   yes             yes
-ncep                   13              13
-nfft                   512             512
-nfilt                  40              25
-nwpen                  1.0             1.000000e+00
-pbeam                  1e-48           1.000000e-48
-pip                    1.0             1.000000e+00
-pl_beam                1e-10           1.000000e-10
-pl_pbeam               1e-10           1.000000e-10
-pl_pip                 1.0             1.000000e+00
-pl_weight              3.0             3.000000e+00
-pl_window              5               5
-rawlogdir
-remove_dc              no              no
-remove_noise           yes             yes
-remove_silence         yes             yes
-round_filters          yes             yes
-samprate               16000           1.600000e+04
-seed                   -1              -1
-sendump
-senlogdir
-senmgau
-silprob                0.005           5.000000e-03
-smoothspec             no              no
-svspec
-tmat
-tmatfloor              0.0001          1.000000e-04
-topn                   4               4
-topn_beam              0               0
-toprule
-transform              legacy          dct
-unit_area              yes             yes
-upperf                 6855.4976       6.800000e+03
-uw                     1.0             1.000000e+00
-vad_postspeech         50              50
-vad_prespeech          20              20
-vad_startspeech        10              10
-vad_threshold          2.0             2.000000e+00
-var
-varfloor               0.0001          1.000000e-04
-varnorm                no              no
-verbose                no              no
-warp_params
-warp_type              inverse_linear  inverse_linear
-wbeam                  7e-29           7.000000e-29
-wip                    0.65            6.500000e-01
-wlen                   0.025625        2.562500e-02

INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
INFO: acmod.c(152): Reading linear feature transformation from /mnt/usb/sphinx-french/cmusphinx-fr-5.2/feature_transform
INFO: mdef.c(518): Reading model definition: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/mdef
INFO: bin_mdef.c(181): Allocating 101051 * 8 bytes (789 KiB) for CD tree
INFO: tmat.c(149): Reading HMM transition probability matrices: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/transition_matrices
INFO: acmod.c(113): Attempting to use PTM computation module
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/means
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/variances
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(304): 0 variance values floored
INFO: ptm_mgau.c(804): Number of codebooks exceeds 256: 2108
INFO: acmod.c(115): Attempting to use semi-continuous computation module
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/means
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/variances
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(304): 0 variance values floored
INFO: acmod.c(117): Falling back to general multi-stream GMM computation
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/means
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/variances
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(304): 0 variance values floored
INFO: ms_senone.c(149): Reading senone mixture weights: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/mixture_weights
INFO: ms_senone.c(200): Truncating senone logs3(pdf) values by 10 bits
INFO: ms_senone.c(207): Not transposing mixture weights in memory
INFO: ms_senone.c(268): Read mixture weights for 2108 senones: 1 features x 8 codewords
INFO: ms_senone.c(320): Mapping senones to individual codebooks
INFO: ms_mgau.c(144): The value of topn: 4
INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0
INFO: dict.c(320): Allocating 109102 * 20 bytes (2130 KiB) for word entries
INFO: dict.c(333): Reading main dictionary: /mnt/usb/sphinx-french/fr.dict
INFO: dict.c(213): Dictionary size 105003, allocated 1018 KiB for strings, 1375 KiB for phones
INFO: dict.c(336): 105003 words read
INFO: dict.c(358): Reading filler dictionary: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/noisedict
INFO: dict.c(213): Dictionary size 105006, allocated 0 KiB for strings, 0 KiB for phones
INFO: dict.c(361): 3 words read
INFO: dict2pid.c(396): Building PID tables for dictionary
INFO: dict2pid.c(406): Allocating 36^3 * 2 bytes (91 KiB) for word-initial triphones
INFO: dict2pid.c(132): Allocated 15696 bytes (15 KiB) for word-final triphones
INFO: dict2pid.c(196): Allocated 15696 bytes (15 KiB) for single-phone word triphones
INFO: ngram_model_trie.c(347): Trying to read LM in trie binary format
INFO: ngram_search_fwdtree.c(74): Initializing search tree
INFO: ngram_search_fwdtree.c(101): 742 unique initial diphones
INFO: ngram_search_fwdtree.c(186): Creating search channels
INFO: ngram_search_fwdtree.c(323): Max nonroot chan increased to 122777
INFO: ngram_search_fwdtree.c(333): Created 733 root, 122649 non-root channels, 124 single-phone words
INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
INFO: continuous.c(307): pocketsphinx_continuous COMPILED ON: May 27 2019, AT: 10:26:52

INFO: ngram_search.c(459): Resized backpointer table to 10000 entries
INFO: ngram_search.c(467): Resized score stack to 200000 entries
INFO: ngram_search.c(459): Resized backpointer table to 20000 entries
INFO: cmn_prior.c(131): cmn_prior_update: from <  8.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 >
INFO: cmn_prior.c(149): cmn_prior_update: to   < 32.09  6.52  5.60  4.29 -3.16 -8.27 -12.06 10.93  2.41 -0.40 -8.79  0.44 -0.56 >
INFO: ngram_search_fwdtree.c(1550):    14013 words recognized (74/fr)
INFO: ngram_search_fwdtree.c(1552):   215554 senones evaluated (1134/fr)
INFO: ngram_search_fwdtree.c(1556):  1691781 channels searched (8904/fr), 88058 1st, 244061 last
INFO: ngram_search_fwdtree.c(1559):    25969 words for which last channels evaluated (136/fr)
INFO: ngram_search_fwdtree.c(1561):   232530 candidate words for entering last phone (1223/fr)
INFO: ngram_search_fwdtree.c(1564): fwdtree 7.54 CPU 3.968 xRT
INFO: ngram_search_fwdtree.c(1567): fwdtree 7.54 wall 3.971 xRT
INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 616 words
2019-05-28 12:25:39.086 [  3] E MessageRouter:sendFailed:reason=noActiveTransport
INFO: ngram_search_fwdflat.c(948):    10755 words recognized (57/fr)
INFO: ngram_search_fwdflat.c(950):   117062 senones evaluated (616/fr)
INFO: ngram_search_fwdflat.c(952):   610492 channels searched (3213/fr)
INFO: ngram_search_fwdflat.c(954):    60608 words searched (318/fr)
INFO: ngram_search_fwdflat.c(957):    31719 word transitions (166/fr)
INFO: ngram_search_fwdflat.c(960): fwdflat 2.83 CPU 1.491 xRT
INFO: ngram_search_fwdflat.c(963): fwdflat 2.84 wall 1.492 xRT
INFO: ngram_search.c(1197): </s> not found in last frame, using lin.188 instead
INFO: ngram_search.c(1250): lattice start node <s>.0 end node lin(2).106
INFO: ngram_search.c(1276): Eliminated 61 nodes before end node
INFO: ngram_search.c(1381): Lattice has 851 nodes, 10478 links
INFO: ps_lattice.c(1380): Bestpath score: -5096
INFO: ps_lattice.c(1384): Normalizer P(O) = alpha(lin(2):106:188) = -441437
INFO: ps_lattice.c(1441): Joint P(O,S) = -466741 P(S|O) = -25304
INFO: ngram_search.c(872): bestpath 0.34 CPU 0.182 xRT
INFO: ngram_search.c(875): bestpath 0.34 wall 0.182 xRT
l' effet lin
INFO: cmn_prior.c(131): cmn_prior_update: from < 32.09  6.52  5.60  4.29 -3.16 -8.27 -12.06 10.93  2.41 -0.40 -8.79  0.44 -0.56 >
INFO: cmn_prior.c(149): cmn_prior_update: to   < 34.37 10.57  2.93  6.10 -3.33 -8.18 -9.87  9.27  5.29 -1.59 -9.36 -0.16 -0.33 >
INFO: ngram_search_fwdtree.c(1550):     8923 words recognized (47/fr)
INFO: ngram_search_fwdtree.c(1552):   281781 senones evaluated (1483/fr)
INFO: ngram_search_fwdtree.c(1556):  2204387 channels searched (11602/fr), 105569 1st, 153123 last
INFO: ngram_search_fwdtree.c(1559):    19639 words for which last channels evaluated (103/fr)
INFO: ngram_search_fwdtree.c(1561):   259693 candidate words for entering last phone (1366/fr)
INFO: ngram_search_fwdtree.c(1564): fwdtree 12.02 CPU 6.328 xRT
INFO: ngram_search_fwdtree.c(1567): fwdtree 12.04 wall 6.335 xRT
INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 534 words
INFO: ngram_search_fwdflat.c(948):     4119 words recognized (22/fr)
INFO: ngram_search_fwdflat.c(950):   125859 senones evaluated (662/fr)
INFO: ngram_search_fwdflat.c(952):   345149 channels searched (1816/fr)
INFO: ngram_search_fwdflat.c(954):    41363 words searched (217/fr)
INFO: ngram_search_fwdflat.c(957):    27086 word transitions (142/fr)
INFO: ngram_search_fwdflat.c(960): fwdflat 1.86 CPU 0.977 xRT
INFO: ngram_search_fwdflat.c(963): fwdflat 1.86 wall 0.978 xRT
INFO: ngram_search.c(1250): lattice start node <s>.0 end node </s>.132
INFO: ngram_search.c(1276): Eliminated 5 nodes before end node
INFO: ngram_search.c(1381): Lattice has 630 nodes, 4128 links
INFO: ps_lattice.c(1380): Bestpath score: -6334
INFO: ps_lattice.c(1384): Normalizer P(O) = alpha(</s>:132:188) = -475100
INFO: ps_lattice.c(1441): Joint P(O,S) = -491474 P(S|O) = -16374
INFO: ngram_search.c(872): bestpath 0.10 CPU 0.053 xRT
INFO: ngram_search.c(875): bestpath 0.10 wall 0.055 xRT
comme lui
INFO: ngram_search_fwdtree.c(429): TOTAL fwdtree 19.56 CPU 5.176 xRT
INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 19.58 wall 5.180 xRT
INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 4.69 CPU 1.240 xRT
INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 4.69 wall 1.242 xRT
INFO: ngram_search.c(303): TOTAL bestpath 0.44 CPU 0.117 xRT
INFO: ngram_search.c(306): TOTAL bestpath 0.45 wall 0.118 xRT
</code>```

But when I try to use pocketsphinx to decode  my words from a mic,it works on raspberry but not on my speaker.

I have this feedback from my raspberry:

```<code>pi@raspberrypi:~ $ pocketsphinx_continuous -inmic yes -adcdev plug:pcm.mic -dict sphinx-french/fr.dict -hmm sphinx-french/cmusphinx-fr-5.2 -lm sphinx-french/fr-small.lm.bin INFO: pocketsphinx.c(145): Parsed model-specific feature parameters from sphinx-french/cmusphinx-fr-5.2/feat.params Current configuration: [NAME]          [DEFLT]     [VALUE]
-agc            none        none
-agcthresh      2.0     2.000000e+00
-allphone
-allphone_ci        no      no
-alpha          0.97        9.700000e-01
-ascale         20.0        2.000000e+01
-aw         1       1
-backtrace      no      no
-beam           1e-48       1.000000e-48
-bestpath       yes     yes
-bestpathlw     9.5     9.500000e+00
-ceplen         13      13
-cmn            current     current
-cmninit        8.0     8.0
-compallsen     no      no
-debug                  0
-dict                   sphinx-french/fr.dict
-dictcase       no      no
-dither         no      no
-doublebw       no      no
-ds         1       1
-fdict                  sphinx-french/cmusphinx-fr-5.2/noisedict
-feat           1s_c_d_dd   1s_c_d_dd
-featparams             sphinx-french/cmusphinx-fr-5.2/feat.params
-fillprob       1e-8        1.000000e-08
-frate          100     100
-fsg
-fsgusealtpron      yes     yes
-fsgusefiller       yes     yes
-fwdflat        yes     yes
-fwdflatbeam        1e-64       1.000000e-64
-fwdflatefwid       4       4
-fwdflatlw      8.5     8.500000e+00
-fwdflatsfwin       25      25
-fwdflatwbeam       7e-29       7.000000e-29
-fwdtree        yes     yes
-hmm                    sphinx-french/cmusphinx-fr-5.2
-input_endian       little      little
-jsgf
-keyphrase
-kws
-kws_delay      10      10
-kws_plp        1e-1        1.000000e-01
-kws_threshold      1       1.000000e+00
-latsize        5000        5000
-lda                    sphinx-french/cmusphinx-fr-5.2/feature_transform
-ldadim         0       0
-lifter         0       22
-lm                 sphinx-french/fr-small.lm.bin
-lmctl
-lmname
-logbase        1.0001      1.000100e+00
-logfn
-logspec        no      no
-lowerf         133.33334   1.300000e+02
-lpbeam         1e-40       1.000000e-40
-lponlybeam     7e-29       7.000000e-29
-lw         6.5     6.500000e+00
-maxhmmpf       30000       30000
-maxwpf         -1      -1
-mdef                   sphinx-french/cmusphinx-fr-5.2/mdef
-mean                   sphinx-french/cmusphinx-fr-5.2/means
-mfclogdir
-min_endfr      0       0
-mixw                   sphinx-french/cmusphinx-fr-5.2/mixture_weights
-mixwfloor      0.0000001   1.000000e-07
-mllr
-mmap           yes     yes
-ncep           13      13
-nfft           512     512
-nfilt          40      25
-nwpen          1.0     1.000000e+00
-pbeam          1e-48       1.000000e-48
-pip            1.0     1.000000e+00
-pl_beam        1e-10       1.000000e-10
-pl_pbeam       1e-10       1.000000e-10
-pl_pip         1.0     1.000000e+00
-pl_weight      3.0     3.000000e+00
-pl_window      5       5
-rawlogdir
-remove_dc      no      no
-remove_noise       yes     yes
-remove_silence     yes     yes
-round_filters      yes     yes
-samprate       16000       1.600000e+04
-seed           -1      -1
-sendump
-senlogdir
-senmgau
-silprob        0.005       5.000000e-03
-smoothspec     no      no
-svspec
-tmat                   sphinx-french/cmusphinx-fr-5.2/transition_matrices
-tmatfloor      0.0001      1.000000e-04
-topn           4       4
-topn_beam      0       0
-toprule
-transform      legacy      dct
-unit_area      yes     yes
-upperf         6855.4976   6.800000e+03
-uw         1.0     1.000000e+00
-vad_postspeech     50      50
-vad_prespeech      20      20
-vad_startspeech    10      10
-vad_threshold      2.0     2.000000e+00
-var                    sphinx-french/cmusphinx-fr-5.2/variances
-varfloor       0.0001      1.000000e-04
-varnorm        no      no
-verbose        no      no
-warp_params
-warp_type      inverse_linear  inverse_linear
-wbeam          7e-29       7.000000e-29
-wip            0.65        6.500000e-01
-wlen           0.025625    2.562500e-02

INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none' INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0 INFO: acmod.c(154): Reading linear feature transformation from sphinx-french/cmusphinx-fr-5.2/feature_transform INFO: mdef.c(518): Reading model definition: sphinx-french/cmusphinx-fr-5.2/mdef INFO: bin_mdef.c(181): Allocating 101051 * 8 bytes (789 KiB) for CD tree INFO: tmat.c(206): Reading HMM transition probability matrices: sphinx-french/cmusphinx-fr-5.2/transition_matrices INFO: acmod.c(117): Attempting to use PTM computation module INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/means INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/variances INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(354): 0 variance values floored INFO: ptm_mgau.c(801): Number of codebooks exceeds 256: 2108 INFO: acmod.c(119): Attempting to use semi-continuous computation module INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/means INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/variances INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(354): 0 variance values floored INFO: acmod.c(121): Falling back to general multi-stream GMM computation INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/means INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/variances INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(354): 0 variance values floored INFO: ms_senone.c(149): Reading senone mixture weights: sphinx-french/cmusphinx-fr-5.2/mixture_weights INFO: ms_senone.c(200): Truncating senone logs3(pdf) values by 10 bits INFO: ms_senone.c(207): Not transposing mixture weights in memory INFO: ms_senone.c(268): Read mixture weights for 2108 senones: 1 features x 8 codewords INFO: ms_senone.c(320): Mapping senones to individual codebooks INFO: ms_mgau.c(141): The value of topn: 4 INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0 INFO: dict.c(320): Allocating 109102 * 20 bytes (2130 KiB) for word entries INFO: dict.c(333): Reading main dictionary: sphinx-french/fr.dict INFO: dict.c(213): Allocated 1018 KiB for strings, 1375 KiB for phones INFO: dict.c(336): 105003 words read INFO: dict.c(358): Reading filler dictionary: sphinx-french/cmusphinx-fr-5.2/noisedict INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones INFO: dict.c(361): 3 words read INFO: dict2pid.c(396): Building PID tables for dictionary INFO: dict2pid.c(406): Allocating 36^3 * 2 bytes (91 KiB) for word-initial triphones INFO: dict2pid.c(132): Allocated 15696 bytes (15 KiB) for word-final triphones INFO: dict2pid.c(196): Allocated 15696 bytes (15 KiB) for single-phone word triphones INFO: ngram_model_trie.c(456): Trying to read LM in trie binary format INFO: ngram_search_fwdtree.c(99): 742 unique initial diphones INFO: ngram_search_fwdtree.c(148): 0 root, 0 non-root channels, 132 single-phone words INFO: ngram_search_fwdtree.c(186): Creating search tree INFO: ngram_search_fwdtree.c(192): before: 0 root, 0 non-root channels, 132 single-phone words INFO: ngram_search_fwdtree.c(326): after: max nonroot chan increased to 122777 INFO: ngram_search_fwdtree.c(339): after: 733 root, 122649 non-root channels, 124 single-phone words INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25 INFO: continuous.c(305): pocketsphinx_continuous COMPILED ON: May 22 2016, AT: 22:01:16

READY.... Listening... INFO: ngram_search.c(459): Resized backpointer table to 10000 entries INFO: ngram_search.c(467): Resized score stack to 200000 entries INFO: ngram_search.c(459): Resized backpointer table to 20000 entries INFO: ngram_search.c(467): Resized score stack to 400000 entries INFO: ngram_search.c(459): Resized backpointer table to 40000 entries INFO: ngram_search_fwdtree.c(952): cand_sf[] increased to 64 entries Input overrun, read calls are too rare (non-fatal) INFO: cmn_prior.c(131): cmn_prior_update: from <  8.00  0.00  0.00  0.00
0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 > INFO: cmn_prior.c(149): cmn_prior_update: to   < 20.14  5.01  9.56  2.81
-0.91  5.44  1.24 -1.23 -0.46 -1.34 -0.56  1.64  3.27 > INFO: ngram_search_fwdtree.c(1553):    31150 words recognized (98/fr) INFO: ngram_search_fwdtree.c(1555):   504243 senones evaluated (1591/fr) INFO: ngram_search_fwdtree.c(1559):  6306963 channels searched (19895/fr), 208020 1st, 615812 last INFO: ngram_search_fwdtree.c(1562):    61696 words for which last channels evaluated (194/fr) INFO: ngram_search_fwdtree.c(1564):   787418 candidate words for entering last phone (2483/fr) INFO: ngram_search_fwdtree.c(1567): fwdtree 21.23 CPU 6.698 xRT INFO: ngram_search_fwdtree.c(1570): fwdtree 29.45 wall 9.290 xRT INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 1051 words INFO: ngram_search_fwdflat.c(948):    16647 words recognized (53/fr) INFO: ngram_search_fwdflat.c(950):   355200 senones evaluated (1121/fr) INFO: ngram_search_fwdflat.c(952):  1666450 channels searched (5256/fr) INFO: ngram_search_fwdflat.c(954):   142520 words searched (449/fr) INFO: ngram_search_fwdflat.c(957):    71616 word transitions (225/fr) INFO: ngram_search_fwdflat.c(960): fwdflat 6.84 CPU 2.158 xRT INFO: ngram_search_fwdflat.c(963): fwdflat 6.84 wall
2.159 xRT INFO: ngram_search.c(1200): </s> not found in last frame, using membres.315 instead INFO: ngram_search.c(1253): lattice start node <s>.0 end node membres.233 INFO: ngram_search.c(1279): Eliminated 201 nodes before end node INFO: ngram_search.c(1384): Lattice has 1802 nodes, 40836 links INFO: ps_lattice.c(1380): Bestpath score: -10518 INFO: ps_lattice.c(1384): Normalizer P(O) = alpha(membres:233:315) =
-772446 INFO: ps_lattice.c(1441): Joint P(O,S) = -795829 P(S|O) = -23383 INFO: ngram_search.c(875): bestpath 3.10 CPU 0.982 xRT INFO: ngram_search.c(878): bestpath 3.10 wall 0.982 xRT on vous vous vous membres
</code>```

But It ends up with this feedback on my speaker (I don't put the whole log because of character limitation):

```<code>INFO: continuous.c(252): Ready....
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
</code>```

(For the note, I use pocketsphinx french model)

My question is: do you have any idea why ? It is probably not a problem of  power processing, since it works on raspberry.

答:
The message says that processing is too slow.

You need to run decoding from a file on your device, not from a microphone and tune the speed first. Speed must be faster than realtime in the logs.

You need to use smaller models or optimize the speed with beams/other parameters as described in the wiki

Body:
I try to install Pocketsphinx on a speaker which works with Buildroot. Before testing it on the speaker, I tried Pocketsphinx on my Raspberry-pi3.
The problem is that I have different results on both devices, despite them having approximately the same hardware performance.

When I try to decode a wav file, I have this result on both devices (both accuracy and time are similar):

pocketsphinx_continuous -infile /mnt/usb/file-16000.wav -dict /mnt/usb/sphinx-
french/fr.dict -lm /mnt/usb/sphinx-french/fr-small.lm.bin -hmm /mnt/usb/sphinx-f
rench/cmusphinx-fr-5.2
INFO: pocketsphinx.c(152): Parsed model-specific feature parameters from /mnt/usb/sphinx-french/cmusphinx-fr-5.2/feat.params
Current configuration:
[NAME]                  [DEFLT]         [VALUE]
-agc                    none            none
-agcthresh              2.0             2.000000e+00
-allphone
-allphone_ci            no              no
-alpha                  0.97            9.700000e-01
-ascale                 20.0            2.000000e+01
-aw                     1               1
-backtrace              no              no
-beam                   1e-48           1.000000e-48
-bestpath               yes             yes
-bestpathlw             9.5             9.500000e+00
-ceplen                 13              13
-cmn                    current         current
-cmninit                8.0             8.0
-compallsen             no              no
-debug                                  0
-dict                                   /mnt/usb/sphinx-french/fr.dict
-dictcase               no              no
-dither                 no              no
-doublebw               no              no
-ds                     1               1
-fdict
-feat                   1s_c_d_dd       1s_c_d_dd
-featparams
-fillprob               1e-8            1.000000e-08
-frate                  100             100
-fsg
-fsgusealtpron          yes             yes
-fsgusefiller           yes             yes
-fwdflat                yes             yes
-fwdflatbeam            1e-64           1.000000e-64
-fwdflatefwid           4               4
-fwdflatlw              8.5             8.500000e+00
-fwdflatsfwin           25              25
-fwdflatwbeam           7e-29           7.000000e-29
-fwdtree                yes             yes
-hmm                                    /mnt/usb/sphinx-french/cmusphinx-fr-5.2
-input_endian           little          little
-jsgf
-keyphrase
-kws
-kws_delay              10              10
-kws_plp                1e-1            1.000000e-01
-kws_threshold          1               1.000000e+00
-latsize                5000            5000
-lda
-ldadim                 0               0
-lifter                 0               22
-lm                                     /mnt/usb/sphinx-french/fr-small.lm.bin
-lmctl
-lmname
-logbase                1.0001          1.000100e+00
-logfn
-logspec                no              no
-lowerf                 133.33334       1.300000e+02
-lpbeam                 1e-40           1.000000e-40
-lponlybeam             7e-29           7.000000e-29
-lw                     6.5             6.500000e+00
-maxhmmpf               30000           30000
-maxwpf                 -1              -1
-mdef
-mean
-mfclogdir
-min_endfr              0               0
-mixw
-mixwfloor              0.0000001       1.000000e-07
-mllr
-mmap                   yes             yes
-ncep                   13              13
-nfft                   512             512
-nfilt                  40              25
-nwpen                  1.0             1.000000e+00
-pbeam                  1e-48           1.000000e-48
-pip                    1.0             1.000000e+00
-pl_beam                1e-10           1.000000e-10
-pl_pbeam               1e-10           1.000000e-10
-pl_pip                 1.0             1.000000e+00
-pl_weight              3.0             3.000000e+00
-pl_window              5               5
-rawlogdir
-remove_dc              no              no
-remove_noise           yes             yes
-remove_silence         yes             yes
-round_filters          yes             yes
-samprate               16000           1.600000e+04
-seed                   -1              -1
-sendump
-senlogdir
-senmgau
-silprob                0.005           5.000000e-03
-smoothspec             no              no
-svspec
-tmat
-tmatfloor              0.0001          1.000000e-04
-topn                   4               4
-topn_beam              0               0
-toprule
-transform              legacy          dct
-unit_area              yes             yes
-upperf                 6855.4976       6.800000e+03
-uw                     1.0             1.000000e+00
-vad_postspeech         50              50
-vad_prespeech          20              20
-vad_startspeech        10              10
-vad_threshold          2.0             2.000000e+00
-var
-varfloor               0.0001          1.000000e-04
-varnorm                no              no
-verbose                no              no
-warp_params
-warp_type              inverse_linear  inverse_linear
-wbeam                  7e-29           7.000000e-29
-wip                    0.65            6.500000e-01
-wlen                   0.025625        2.562500e-02

INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
INFO: acmod.c(152): Reading linear feature transformation from /mnt/usb/sphinx-french/cmusphinx-fr-5.2/feature_transform
INFO: mdef.c(518): Reading model definition: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/mdef
INFO: bin_mdef.c(181): Allocating 101051 * 8 bytes (789 KiB) for CD tree
INFO: tmat.c(149): Reading HMM transition probability matrices: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/transition_matrices
INFO: acmod.c(113): Attempting to use PTM computation module
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/means
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/variances
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(304): 0 variance values floored
INFO: ptm_mgau.c(804): Number of codebooks exceeds 256: 2108
INFO: acmod.c(115): Attempting to use semi-continuous computation module
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/means
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/variances
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(304): 0 variance values floored
INFO: acmod.c(117): Falling back to general multi-stream GMM computation
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/means
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(127): Reading mixture gaussian parameter: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/variances
INFO: ms_gauden.c(242): 2108 codebook, 1 feature, size:
INFO: ms_gauden.c(244):  8x32
INFO: ms_gauden.c(304): 0 variance values floored
INFO: ms_senone.c(149): Reading senone mixture weights: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/mixture_weights
INFO: ms_senone.c(200): Truncating senone logs3(pdf) values by 10 bits
INFO: ms_senone.c(207): Not transposing mixture weights in memory
INFO: ms_senone.c(268): Read mixture weights for 2108 senones: 1 features x 8 codewords
INFO: ms_senone.c(320): Mapping senones to individual codebooks
INFO: ms_mgau.c(144): The value of topn: 4
INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0
INFO: dict.c(320): Allocating 109102 * 20 bytes (2130 KiB) for word entries
INFO: dict.c(333): Reading main dictionary: /mnt/usb/sphinx-french/fr.dict
INFO: dict.c(213): Dictionary size 105003, allocated 1018 KiB for strings, 1375 KiB for phones
INFO: dict.c(336): 105003 words read
INFO: dict.c(358): Reading filler dictionary: /mnt/usb/sphinx-french/cmusphinx-fr-5.2/noisedict
INFO: dict.c(213): Dictionary size 105006, allocated 0 KiB for strings, 0 KiB for phones
INFO: dict.c(361): 3 words read
INFO: dict2pid.c(396): Building PID tables for dictionary
INFO: dict2pid.c(406): Allocating 36^3 * 2 bytes (91 KiB) for word-initial triphones
INFO: dict2pid.c(132): Allocated 15696 bytes (15 KiB) for word-final triphones
INFO: dict2pid.c(196): Allocated 15696 bytes (15 KiB) for single-phone word triphones
INFO: ngram_model_trie.c(347): Trying to read LM in trie binary format
INFO: ngram_search_fwdtree.c(74): Initializing search tree
INFO: ngram_search_fwdtree.c(101): 742 unique initial diphones
INFO: ngram_search_fwdtree.c(186): Creating search channels
INFO: ngram_search_fwdtree.c(323): Max nonroot chan increased to 122777
INFO: ngram_search_fwdtree.c(333): Created 733 root, 122649 non-root channels, 124 single-phone words
INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
INFO: continuous.c(307): pocketsphinx_continuous COMPILED ON: May 27 2019, AT: 10:26:52

INFO: ngram_search.c(459): Resized backpointer table to 10000 entries
INFO: ngram_search.c(467): Resized score stack to 200000 entries
INFO: ngram_search.c(459): Resized backpointer table to 20000 entries
INFO: cmn_prior.c(131): cmn_prior_update: from <  8.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 >
INFO: cmn_prior.c(149): cmn_prior_update: to   < 32.09  6.52  5.60  4.29 -3.16 -8.27 -12.06 10.93  2.41 -0.40 -8.79  0.44 -0.56 >
INFO: ngram_search_fwdtree.c(1550):    14013 words recognized (74/fr)
INFO: ngram_search_fwdtree.c(1552):   215554 senones evaluated (1134/fr)
INFO: ngram_search_fwdtree.c(1556):  1691781 channels searched (8904/fr), 88058 1st, 244061 last
INFO: ngram_search_fwdtree.c(1559):    25969 words for which last channels evaluated (136/fr)
INFO: ngram_search_fwdtree.c(1561):   232530 candidate words for entering last phone (1223/fr)
INFO: ngram_search_fwdtree.c(1564): fwdtree 7.54 CPU 3.968 xRT
INFO: ngram_search_fwdtree.c(1567): fwdtree 7.54 wall 3.971 xRT
INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 616 words
2019-05-28 12:25:39.086 [  3] E MessageRouter:sendFailed:reason=noActiveTransport
INFO: ngram_search_fwdflat.c(948):    10755 words recognized (57/fr)
INFO: ngram_search_fwdflat.c(950):   117062 senones evaluated (616/fr)
INFO: ngram_search_fwdflat.c(952):   610492 channels searched (3213/fr)
INFO: ngram_search_fwdflat.c(954):    60608 words searched (318/fr)
INFO: ngram_search_fwdflat.c(957):    31719 word transitions (166/fr)
INFO: ngram_search_fwdflat.c(960): fwdflat 2.83 CPU 1.491 xRT
INFO: ngram_search_fwdflat.c(963): fwdflat 2.84 wall 1.492 xRT
INFO: ngram_search.c(1197): </s> not found in last frame, using lin.188 instead
INFO: ngram_search.c(1250): lattice start node <s>.0 end node lin(2).106
INFO: ngram_search.c(1276): Eliminated 61 nodes before end node
INFO: ngram_search.c(1381): Lattice has 851 nodes, 10478 links
INFO: ps_lattice.c(1380): Bestpath score: -5096
INFO: ps_lattice.c(1384): Normalizer P(O) = alpha(lin(2):106:188) = -441437
INFO: ps_lattice.c(1441): Joint P(O,S) = -466741 P(S|O) = -25304
INFO: ngram_search.c(872): bestpath 0.34 CPU 0.182 xRT
INFO: ngram_search.c(875): bestpath 0.34 wall 0.182 xRT
l' effet lin
INFO: cmn_prior.c(131): cmn_prior_update: from < 32.09  6.52  5.60  4.29 -3.16 -8.27 -12.06 10.93  2.41 -0.40 -8.79  0.44 -0.56 >
INFO: cmn_prior.c(149): cmn_prior_update: to   < 34.37 10.57  2.93  6.10 -3.33 -8.18 -9.87  9.27  5.29 -1.59 -9.36 -0.16 -0.33 >
INFO: ngram_search_fwdtree.c(1550):     8923 words recognized (47/fr)
INFO: ngram_search_fwdtree.c(1552):   281781 senones evaluated (1483/fr)
INFO: ngram_search_fwdtree.c(1556):  2204387 channels searched (11602/fr), 105569 1st, 153123 last
INFO: ngram_search_fwdtree.c(1559):    19639 words for which last channels evaluated (103/fr)
INFO: ngram_search_fwdtree.c(1561):   259693 candidate words for entering last phone (1366/fr)
INFO: ngram_search_fwdtree.c(1564): fwdtree 12.02 CPU 6.328 xRT
INFO: ngram_search_fwdtree.c(1567): fwdtree 12.04 wall 6.335 xRT
INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 534 words
INFO: ngram_search_fwdflat.c(948):     4119 words recognized (22/fr)
INFO: ngram_search_fwdflat.c(950):   125859 senones evaluated (662/fr)
INFO: ngram_search_fwdflat.c(952):   345149 channels searched (1816/fr)
INFO: ngram_search_fwdflat.c(954):    41363 words searched (217/fr)
INFO: ngram_search_fwdflat.c(957):    27086 word transitions (142/fr)
INFO: ngram_search_fwdflat.c(960): fwdflat 1.86 CPU 0.977 xRT
INFO: ngram_search_fwdflat.c(963): fwdflat 1.86 wall 0.978 xRT
INFO: ngram_search.c(1250): lattice start node <s>.0 end node </s>.132
INFO: ngram_search.c(1276): Eliminated 5 nodes before end node
INFO: ngram_search.c(1381): Lattice has 630 nodes, 4128 links
INFO: ps_lattice.c(1380): Bestpath score: -6334
INFO: ps_lattice.c(1384): Normalizer P(O) = alpha(</s>:132:188) = -475100
INFO: ps_lattice.c(1441): Joint P(O,S) = -491474 P(S|O) = -16374
INFO: ngram_search.c(872): bestpath 0.10 CPU 0.053 xRT
INFO: ngram_search.c(875): bestpath 0.10 wall 0.055 xRT
comme lui
INFO: ngram_search_fwdtree.c(429): TOTAL fwdtree 19.56 CPU 5.176 xRT
INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 19.58 wall 5.180 xRT
INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 4.69 CPU 1.240 xRT
INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 4.69 wall 1.242 xRT
INFO: ngram_search.c(303): TOTAL bestpath 0.44 CPU 0.117 xRT
INFO: ngram_search.c(306): TOTAL bestpath 0.45 wall 0.118 xRT

But when I try to use pocketsphinx to decode  my words from a mic,it works on raspberry but not on my speaker.

I have this feedback from my raspberry:

pi@raspberrypi:~ $ pocketsphinx_continuous -inmic yes -adcdev plug:pcm.mic -dict sphinx-french/fr.dict -hmm sphinx-french/cmusphinx-fr-5.2 -lm sphinx-french/fr-small.lm.bin INFO: pocketsphinx.c(145): Parsed model-specific feature parameters from sphinx-french/cmusphinx-fr-5.2/feat.params Current configuration: [NAME]          [DEFLT]     [VALUE]
-agc            none        none
-agcthresh      2.0     2.000000e+00
-allphone
-allphone_ci        no      no
-alpha          0.97        9.700000e-01
-ascale         20.0        2.000000e+01
-aw         1       1
-backtrace      no      no
-beam           1e-48       1.000000e-48
-bestpath       yes     yes
-bestpathlw     9.5     9.500000e+00
-ceplen         13      13
-cmn            current     current
-cmninit        8.0     8.0
-compallsen     no      no
-debug                  0
-dict                   sphinx-french/fr.dict
-dictcase       no      no
-dither         no      no
-doublebw       no      no
-ds         1       1
-fdict                  sphinx-french/cmusphinx-fr-5.2/noisedict
-feat           1s_c_d_dd   1s_c_d_dd
-featparams             sphinx-french/cmusphinx-fr-5.2/feat.params
-fillprob       1e-8        1.000000e-08
-frate          100     100
-fsg
-fsgusealtpron      yes     yes
-fsgusefiller       yes     yes
-fwdflat        yes     yes
-fwdflatbeam        1e-64       1.000000e-64
-fwdflatefwid       4       4
-fwdflatlw      8.5     8.500000e+00
-fwdflatsfwin       25      25
-fwdflatwbeam       7e-29       7.000000e-29
-fwdtree        yes     yes
-hmm                    sphinx-french/cmusphinx-fr-5.2
-input_endian       little      little
-jsgf
-keyphrase
-kws
-kws_delay      10      10
-kws_plp        1e-1        1.000000e-01
-kws_threshold      1       1.000000e+00
-latsize        5000        5000
-lda                    sphinx-french/cmusphinx-fr-5.2/feature_transform
-ldadim         0       0
-lifter         0       22
-lm                 sphinx-french/fr-small.lm.bin
-lmctl
-lmname
-logbase        1.0001      1.000100e+00
-logfn
-logspec        no      no
-lowerf         133.33334   1.300000e+02
-lpbeam         1e-40       1.000000e-40
-lponlybeam     7e-29       7.000000e-29
-lw         6.5     6.500000e+00
-maxhmmpf       30000       30000
-maxwpf         -1      -1
-mdef                   sphinx-french/cmusphinx-fr-5.2/mdef
-mean                   sphinx-french/cmusphinx-fr-5.2/means
-mfclogdir
-min_endfr      0       0
-mixw                   sphinx-french/cmusphinx-fr-5.2/mixture_weights
-mixwfloor      0.0000001   1.000000e-07
-mllr
-mmap           yes     yes
-ncep           13      13
-nfft           512     512
-nfilt          40      25
-nwpen          1.0     1.000000e+00
-pbeam          1e-48       1.000000e-48
-pip            1.0     1.000000e+00
-pl_beam        1e-10       1.000000e-10
-pl_pbeam       1e-10       1.000000e-10
-pl_pip         1.0     1.000000e+00
-pl_weight      3.0     3.000000e+00
-pl_window      5       5
-rawlogdir
-remove_dc      no      no
-remove_noise       yes     yes
-remove_silence     yes     yes
-round_filters      yes     yes
-samprate       16000       1.600000e+04
-seed           -1      -1
-sendump
-senlogdir
-senmgau
-silprob        0.005       5.000000e-03
-smoothspec     no      no
-svspec
-tmat                   sphinx-french/cmusphinx-fr-5.2/transition_matrices
-tmatfloor      0.0001      1.000000e-04
-topn           4       4
-topn_beam      0       0
-toprule
-transform      legacy      dct
-unit_area      yes     yes
-upperf         6855.4976   6.800000e+03
-uw         1.0     1.000000e+00
-vad_postspeech     50      50
-vad_prespeech      20      20
-vad_startspeech    10      10
-vad_threshold      2.0     2.000000e+00
-var                    sphinx-french/cmusphinx-fr-5.2/variances
-varfloor       0.0001      1.000000e-04
-varnorm        no      no
-verbose        no      no
-warp_params
-warp_type      inverse_linear  inverse_linear
-wbeam          7e-29       7.000000e-29
-wip            0.65        6.500000e-01
-wlen           0.025625    2.562500e-02

INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none' INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0 INFO: acmod.c(154): Reading linear feature transformation from sphinx-french/cmusphinx-fr-5.2/feature_transform INFO: mdef.c(518): Reading model definition: sphinx-french/cmusphinx-fr-5.2/mdef INFO: bin_mdef.c(181): Allocating 101051 * 8 bytes (789 KiB) for CD tree INFO: tmat.c(206): Reading HMM transition probability matrices: sphinx-french/cmusphinx-fr-5.2/transition_matrices INFO: acmod.c(117): Attempting to use PTM computation module INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/means INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/variances INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(354): 0 variance values floored INFO: ptm_mgau.c(801): Number of codebooks exceeds 256: 2108 INFO: acmod.c(119): Attempting to use semi-continuous computation module INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/means INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/variances INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(354): 0 variance values floored INFO: acmod.c(121): Falling back to general multi-stream GMM computation INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/means INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(198): Reading mixture gaussian parameter: sphinx-french/cmusphinx-fr-5.2/variances INFO: ms_gauden.c(292): 2108 codebook, 1 feature, size:  INFO: ms_gauden.c(294):  8x32 INFO: ms_gauden.c(354): 0 variance values floored INFO: ms_senone.c(149): Reading senone mixture weights: sphinx-french/cmusphinx-fr-5.2/mixture_weights INFO: ms_senone.c(200): Truncating senone logs3(pdf) values by 10 bits INFO: ms_senone.c(207): Not transposing mixture weights in memory INFO: ms_senone.c(268): Read mixture weights for 2108 senones: 1 features x 8 codewords INFO: ms_senone.c(320): Mapping senones to individual codebooks INFO: ms_mgau.c(141): The value of topn: 4 INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0 INFO: dict.c(320): Allocating 109102 * 20 bytes (2130 KiB) for word entries INFO: dict.c(333): Reading main dictionary: sphinx-french/fr.dict INFO: dict.c(213): Allocated 1018 KiB for strings, 1375 KiB for phones INFO: dict.c(336): 105003 words read INFO: dict.c(358): Reading filler dictionary: sphinx-french/cmusphinx-fr-5.2/noisedict INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones INFO: dict.c(361): 3 words read INFO: dict2pid.c(396): Building PID tables for dictionary INFO: dict2pid.c(406): Allocating 36^3 * 2 bytes (91 KiB) for word-initial triphones INFO: dict2pid.c(132): Allocated 15696 bytes (15 KiB) for word-final triphones INFO: dict2pid.c(196): Allocated 15696 bytes (15 KiB) for single-phone word triphones INFO: ngram_model_trie.c(456): Trying to read LM in trie binary format INFO: ngram_search_fwdtree.c(99): 742 unique initial diphones INFO: ngram_search_fwdtree.c(148): 0 root, 0 non-root channels, 132 single-phone words INFO: ngram_search_fwdtree.c(186): Creating search tree INFO: ngram_search_fwdtree.c(192): before: 0 root, 0 non-root channels, 132 single-phone words INFO: ngram_search_fwdtree.c(326): after: max nonroot chan increased to 122777 INFO: ngram_search_fwdtree.c(339): after: 733 root, 122649 non-root channels, 124 single-phone words INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25 INFO: continuous.c(305): pocketsphinx_continuous COMPILED ON: May 22 2016, AT: 22:01:16

READY.... Listening... INFO: ngram_search.c(459): Resized backpointer table to 10000 entries INFO: ngram_search.c(467): Resized score stack to 200000 entries INFO: ngram_search.c(459): Resized backpointer table to 20000 entries INFO: ngram_search.c(467): Resized score stack to 400000 entries INFO: ngram_search.c(459): Resized backpointer table to 40000 entries INFO: ngram_search_fwdtree.c(952): cand_sf[] increased to 64 entries Input overrun, read calls are too rare (non-fatal) INFO: cmn_prior.c(131): cmn_prior_update: from <  8.00  0.00  0.00  0.00
0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 > INFO: cmn_prior.c(149): cmn_prior_update: to   < 20.14  5.01  9.56  2.81
-0.91  5.44  1.24 -1.23 -0.46 -1.34 -0.56  1.64  3.27 > INFO: ngram_search_fwdtree.c(1553):    31150 words recognized (98/fr) INFO: ngram_search_fwdtree.c(1555):   504243 senones evaluated (1591/fr) INFO: ngram_search_fwdtree.c(1559):  6306963 channels searched (19895/fr), 208020 1st, 615812 last INFO: ngram_search_fwdtree.c(1562):    61696 words for which last channels evaluated (194/fr) INFO: ngram_search_fwdtree.c(1564):   787418 candidate words for entering last phone (2483/fr) INFO: ngram_search_fwdtree.c(1567): fwdtree 21.23 CPU 6.698 xRT INFO: ngram_search_fwdtree.c(1570): fwdtree 29.45 wall 9.290 xRT INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 1051 words INFO: ngram_search_fwdflat.c(948):    16647 words recognized (53/fr) INFO: ngram_search_fwdflat.c(950):   355200 senones evaluated (1121/fr) INFO: ngram_search_fwdflat.c(952):  1666450 channels searched (5256/fr) INFO: ngram_search_fwdflat.c(954):   142520 words searched (449/fr) INFO: ngram_search_fwdflat.c(957):    71616 word transitions (225/fr) INFO: ngram_search_fwdflat.c(960): fwdflat 6.84 CPU 2.158 xRT INFO: ngram_search_fwdflat.c(963): fwdflat 6.84 wall
2.159 xRT INFO: ngram_search.c(1200): </s> not found in last frame, using membres.315 instead INFO: ngram_search.c(1253): lattice start node <s>.0 end node membres.233 INFO: ngram_search.c(1279): Eliminated 201 nodes before end node INFO: ngram_search.c(1384): Lattice has 1802 nodes, 40836 links INFO: ps_lattice.c(1380): Bestpath score: -10518 INFO: ps_lattice.c(1384): Normalizer P(O) = alpha(membres:233:315) =
-772446 INFO: ps_lattice.c(1441): Joint P(O,S) = -795829 P(S|O) = -23383 INFO: ngram_search.c(875): bestpath 3.10 CPU 0.982 xRT INFO: ngram_search.c(878): bestpath 3.10 wall 0.982 xRT on vous vous vous membres

But It ends up with this feedback on my speaker (I don't put the whole log because of character limitation):

INFO: continuous.c(252): Ready....
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)
Input overrun, read calls are too rare (non-fatal)

(For the note, I use pocketsphinx french model)

My question is: do you have any idea why ? It is probably not a problem of  power processing, since it works on raspberry.


来源: stackexchange

问:
Pick every ip address but one in particular
I need to create a regex which returns me every possible ip address so between 0.0.0.0 and 255.255.255.255 but one in particular which is 127.0.0.1

i played a little bit with regex but they are a little bit complex
i was doing something like that but even using regex101.com im not able to obtain the proper one.

```<code>^(?![0-9\.]+:)(?!127.0.0.1:)
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I need to create a regex which returns me every possible ip address so between 0.0.0.0 and 255.255.255.255 but one in particular which is 127.0.0.1

i played a little bit with regex but they are a little bit complex
i was doing something like that but even using regex101.com im not able to obtain the proper one.

^(?![0-9\.]+:)(?!127.0.0.1:)

Body:
^(?!127\.0\.0\.1)(([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$

Should work as required

Brief explanation:

first checks that it does not contain 127.0.0.1,

followed by 3 loads of 0-255. ending with 0-255


问:
Problem Passing a function reference in Kotlin
The following line of code is throwing a compile error related to Renderer::onScoreChange. The reported error is:
Type mismatch.
Required:(Int, Int) → Unit
Found: KFunction3<Renderer, @ParameterName Int, @ParameterName Int, Unit>

```<code>var score by EngineObserver<Int>(20, Renderer::onScoreChange)
</code>```

I'm trying to pass a function reference to a custom Delegate extending from the ObservableProperty class but not sure why its not recognizing the passed member function as satisfying the requirements of the function argument. Thoughts from anyone?

```<code>class EngineObserver<T>(
   initialValue: T,
   val notify : (oldVal : T, newVal : T) -> Unit
) : ObservableProperty<T>(initialValue) {
   override fun afterChange(property: KProperty<*>,
                            oldValue: T,
                            newValue: T) {
        super.afterChange(property, oldValue, newValue)
        notify(oldValue, newValue)
   }
}

class Renderer {
   fun onScoreChange(oldVal : Int, newVal : Int){
      println("Score changed from $oldVal to $newVal")
   }
}
</code>```

答:
Renderer::onScoreChange is a member function which has Renderer as its first parameter.
You probably need a function reference applied to a certain instance: renderer::onScoreChange

Body:
The following line of code is throwing a compile error related to Renderer::onScoreChange. The reported error is:
Type mismatch.
Required:(Int, Int) → Unit
Found: KFunction3<Renderer, @ParameterName Int, @ParameterName Int, Unit>

var score by EngineObserver<Int>(20, Renderer::onScoreChange)

I'm trying to pass a function reference to a custom Delegate extending from the ObservableProperty class but not sure why its not recognizing the passed member function as satisfying the requirements of the function argument. Thoughts from anyone?

class EngineObserver<T>(
   initialValue: T,
   val notify : (oldVal : T, newVal : T) -> Unit
) : ObservableProperty<T>(initialValue) {
   override fun afterChange(property: KProperty<*>,
                            oldValue: T,
                            newValue: T) {
        super.afterChange(property, oldValue, newValue)
        notify(oldValue, newValue)
   }
}

class Renderer {
   fun onScoreChange(oldVal : Int, newVal : Int){
      println("Score changed from $oldVal to $newVal")
   }
}


问:
Multi-Index Sorting in Pandas
I have a multi-index DataFrame created via a groupby operation.  I'm trying to do a compound sort using several levels of the index, but I can't seem to find a sort function that does what I need.

Initial dataset looks something like this (daily sales counts of various products):

```<code>         Date Manufacturer Product Name Product Launch Date  Sales
0  2013-01-01        Apple         iPod          2001-10-23     12
1  2013-01-01        Apple         iPad          2010-04-03     13
2  2013-01-01      Samsung       Galaxy          2009-04-27     14
3  2013-01-01      Samsung   Galaxy Tab          2010-09-02     15
4  2013-01-02        Apple         iPod          2001-10-23     22
5  2013-01-02        Apple         iPad          2010-04-03     17
6  2013-01-02      Samsung       Galaxy          2009-04-27     10
7  2013-01-02      Samsung   Galaxy Tab          2010-09-02      7
</code>```

I use groupby to get a sum over the date range:

```<code>> grouped = df.groupby(['Manufacturer', 'Product Name', 'Product Launch Date']).sum()
                                               Sales
Manufacturer Product Name Product Launch Date
Apple        iPad         2010-04-03              30
             iPod         2001-10-23              34
Samsung      Galaxy       2009-04-27              24
             Galaxy Tab   2010-09-02              22
</code>```

So far so good!

Now the last thing I want to do is sort each manufacturer's products by launch date, but keep them grouped hierarchically under Manufacturer - here's all I am trying to do:

```<code>                                               Sales
Manufacturer Product Name Product Launch Date
Apple        iPod         2001-10-23              34
             iPad         2010-04-03              30
Samsung      Galaxy       2009-04-27              24
             Galaxy Tab   2010-09-02              22
</code>```

When I try sortlevel() I lose the nice per-company hierarchy I had before:

```<code>> grouped.sortlevel('Product Launch Date')
                                               Sales
Manufacturer Product Name Product Launch Date
Apple        iPod         2001-10-23              34
Samsung      Galaxy       2009-04-27              24
Apple        iPad         2010-04-03              30
Samsung      Galaxy Tab   2010-09-02              22
</code>```

sort() and sort_index() just fail:

```<code>grouped.sort(['Manufacturer','Product Launch Date'])
KeyError: u'no item named Manufacturer'

grouped.sort_index(by=['Manufacturer','Product Launch Date'])
KeyError: u'no item named Manufacturer'
</code>```

Seems like a simple operation, but I can't quite figure it out.

I'm not tied to using a MultiIndex for this, but since that's what groupby() returns, that's what I've been working with.

BTW the code to produce the initial DataFrame is:

```<code>data = {
  'Date': ['2013-01-01', '2013-01-01', '2013-01-01', '2013-01-01', '2013-01-02', '2013-01-02', '2013-01-02', '2013-01-02'],
  'Manufacturer' : ['Apple', 'Apple', 'Samsung', 'Samsung', 'Apple', 'Apple', 'Samsung', 'Samsung',],
  'Product Name' : ['iPod', 'iPad', 'Galaxy', 'Galaxy Tab', 'iPod', 'iPad', 'Galaxy', 'Galaxy Tab'],
  'Product Launch Date' : ['2001-10-23', '2010-04-03', '2009-04-27', '2010-09-02','2001-10-23', '2010-04-03', '2009-04-27', '2010-09-02'],
  'Sales' : [12, 13, 14, 15, 22, 17, 10, 7]
}
df = DataFrame(data, columns=['Date', 'Manufacturer', 'Product Name', 'Product Launch Date', 'Sales'])
</code>```

答:
To sort a MultiIndex by the "index columns" (aka. levels) you need to use the .sort_index() method and set its level argument. If you want to sort by multiple levels, the argument needs to be set to a list of level names in sequential order.

This should give you the DataFrame you need:

```<code>df.groupby(['Manufacturer',
            'Product Name',
            'Launch Date']
          ).sum().sort_index(level=['Manufacturer','Launch Date'])
</code>```

ContentLicense: CC BY-SA 3.0

Title: Multi-Index Sorting in Pandas

Body:
I have a multi-index DataFrame created via a groupby operation.  I'm trying to do a compound sort using several levels of the index, but I can't seem to find a sort function that does what I need.

Initial dataset looks something like this (daily sales counts of various products):

         Date Manufacturer Product Name Product Launch Date  Sales
0  2013-01-01        Apple         iPod          2001-10-23     12
1  2013-01-01        Apple         iPad          2010-04-03     13
2  2013-01-01      Samsung       Galaxy          2009-04-27     14
3  2013-01-01      Samsung   Galaxy Tab          2010-09-02     15
4  2013-01-02        Apple         iPod          2001-10-23     22
5  2013-01-02        Apple         iPad          2010-04-03     17
6  2013-01-02      Samsung       Galaxy          2009-04-27     10
7  2013-01-02      Samsung   Galaxy Tab          2010-09-02      7

I use groupby to get a sum over the date range:

> grouped = df.groupby(['Manufacturer', 'Product Name', 'Product Launch Date']).sum()
                                               Sales
Manufacturer Product Name Product Launch Date
Apple        iPad         2010-04-03              30
             iPod         2001-10-23              34
Samsung      Galaxy       2009-04-27              24
             Galaxy Tab   2010-09-02              22

So far so good!

Now the last thing I want to do is sort each manufacturer's products by launch date, but keep them grouped hierarchically under Manufacturer - here's all I am trying to do:

                                               Sales
Manufacturer Product Name Product Launch Date
Apple        iPod         2001-10-23              34
             iPad         2010-04-03              30
Samsung      Galaxy       2009-04-27              24
             Galaxy Tab   2010-09-02              22

When I try sortlevel() I lose the nice per-company hierarchy I had before:

> grouped.sortlevel('Product Launch Date')
                                               Sales
Manufacturer Product Name Product Launch Date
Apple        iPod         2001-10-23              34
Samsung      Galaxy       2009-04-27              24
Apple        iPad         2010-04-03              30
Samsung      Galaxy Tab   2010-09-02              22

sort() and sort_index() just fail:

grouped.sort(['Manufacturer','Product Launch Date'])
KeyError: u'no item named Manufacturer'

grouped.sort_index(by=['Manufacturer','Product Launch Date'])
KeyError: u'no item named Manufacturer'

Seems like a simple operation, but I can't quite figure it out.

I'm not tied to using a MultiIndex for this, but since that's what groupby() returns, that's what I've been working with.

BTW the code to produce the initial DataFrame is:

data = {
  'Date': ['2013-01-01', '2013-01-01', '2013-01-01', '2013-01-01', '2013-01-02', '2013-01-02', '2013-01-02', '2013-01-02'],
  'Manufacturer' : ['Apple', 'Apple', 'Samsung', 'Samsung', 'Apple', 'Apple', 'Samsung', 'Samsung',],
  'Product Name' : ['iPod', 'iPad', 'Galaxy', 'Galaxy Tab', 'iPod', 'iPad', 'Galaxy', 'Galaxy Tab'],
  'Product Launch Date' : ['2001-10-23', '2010-04-03', '2009-04-27', '2010-09-02','2001-10-23', '2010-04-03', '2009-04-27', '2010-09-02'],
  'Sales' : [12, 13, 14, 15, 22, 17, 10, 7]
}
df = DataFrame(data, columns=['Date', 'Manufacturer', 'Product Name', 'Product Launch Date', 'Sales'])

Body:
To sort a MultiIndex by the "index columns" (aka. levels) you need to use the .sort_index() method and set its level argument. If you want to sort by multiple levels, the argument needs to be set to a list of level names in sequential order.

This should give you the DataFrame you need:

df.groupby(['Manufacturer',
            'Product Name',
            'Launch Date']
          ).sum().sort_index(level=['Manufacturer','Launch Date'])


问:
Instantiation of Array vs. Objects in Javascript. When is an array an object and when does it get the methods of an array?
I have some experience in C/C++/PIC assembly and VHDL, but am completely lost with javascript. I'm building a single page application in React, but this question is more to better my understanding than to solve a problem (as I already found my problem).

My question is, in Javascript, when is a variable an array and when is it an object? How do I tell the difference? (Given that 'typeof' always says object).

In case it ever helps someone, my initial problem was that in my state, I had an array of objects and I needed the length. I tried to get it with Array.length() but it should have been Array.length. In the 30 minutes I wasted before I figured this out, I developed more questions.

This was my constructor:

```<code>constructor(props, context) {
        super(props, context);

        this.state = {
            activeItem: 'home',
            currentSections: [ { key: 'Home', content: 'Home', link: true } ]
        };

        this.handleItemClick = this.handleItemClick.bind(this);
        this.handleTabChange = this.handleTabChange.bind(this);
    }
</code>```

For context, I was working on building a breadcrumb trail for the application. In order to determine whether I needed to pop the last element of the array prior to adding a new one, I needed the length of the currentSections array.

```<code>handleTabChange = (e, data) => {

        let newSections = [];

        newSections = this.state.currentSections;
        if (newSections.length() > 2) {
            newSections.pop();
        }

        let newSection = {
            key: data.panes[data.activeIndex].name,
            content: data.panes[data.activeIndex].menuItem,
            link: true
        };
        newSections.push(newSection);
                this.setState({currentSections: newSections});

    };
</code>```

This code produces the error:
Uncaught TypeError: newSections.length is not a function

In case you're reading this because you're having a similar problem, the problem was that newSections.length() should be newSections.length. I hate myself. Before I figured that out though, I had thought for some reason that my array in state currentSections was not actually an array. Which led me to my question, when is an array an array in Javascript? Do I misunderstand what 'typeof' returns?

```<code>let newSections = [];
console.log(typeof newSections); //object
newSections = this.state.currentSections;
console.log(typeof newSections); //object
let newSections = [1,2,3];
console.log(typeof newSections); //object
</code>```

I get that an array is an object, but is there a way to tell whether a variable is being treated as an array vs. a plain object? I couldn't find anything discussing this, but it may be because I don't what terms to search for.

答:
Difference between Objects & Arrays

Despite just being objects under the hood, arrays behave very
  differently from regular objects. The reason is the Array.prototype
  object, which has all the Array specific methods. Every new array
  inherits these extra methods from Array.prototype.

Key thing to note is that the value of the prototype property of
  Array.prototype is Object.prototype. This means two things:

Arrays are just objects but with some extra methods.

There is nothing an object can do that an array can’t.

Read: https://www.frontendmayhem.com/javascript-arrays-objects/

Body:
I have some experience in C/C++/PIC assembly and VHDL, but am completely lost with javascript. I'm building a single page application in React, but this question is more to better my understanding than to solve a problem (as I already found my problem).

My question is, in Javascript, when is a variable an array and when is it an object? How do I tell the difference? (Given that 'typeof' always says object).

In case it ever helps someone, my initial problem was that in my state, I had an array of objects and I needed the length. I tried to get it with Array.length() but it should have been Array.length. In the 30 minutes I wasted before I figured this out, I developed more questions.

This was my constructor:

constructor(props, context) {
        super(props, context);

        this.state = {
            activeItem: 'home',
            currentSections: [ { key: 'Home', content: 'Home', link: true } ]
        };

        this.handleItemClick = this.handleItemClick.bind(this);
        this.handleTabChange = this.handleTabChange.bind(this);
    }

For context, I was working on building a breadcrumb trail for the application. In order to determine whether I needed to pop the last element of the array prior to adding a new one, I needed the length of the currentSections array.

handleTabChange = (e, data) => {

        let newSections = [];

        newSections = this.state.currentSections;
        if (newSections.length() > 2) {
            newSections.pop();
        }

        let newSection = {
            key: data.panes[data.activeIndex].name,
            content: data.panes[data.activeIndex].menuItem,
            link: true
        };
        newSections.push(newSection);
                this.setState({currentSections: newSections});

    };

This code produces the error:
Uncaught TypeError: newSections.length is not a function

In case you're reading this because you're having a similar problem, the problem was that newSections.length() should be newSections.length. I hate myself. Before I figured that out though, I had thought for some reason that my array in state currentSections was not actually an array. Which led me to my question, when is an array an array in Javascript? Do I misunderstand what 'typeof' returns?

let newSections = [];
console.log(typeof newSections); //object
newSections = this.state.currentSections;
console.log(typeof newSections); //object
let newSections = [1,2,3];
console.log(typeof newSections); //object

I get that an array is an object, but is there a way to tell whether a variable is being treated as an array vs. a plain object? I couldn't find anything discussing this, but it may be because I don't what terms to search for.


问:
Could not find a valid gem 'mysql2-0.3.18.gem'
i am new to Ruby on rails and i have facing this problem during Rails installation. I have searched a lot and tried many solution which were available on stackoverflow but nothing work for me. Please help how can i get out of this problem..

答:
I ran the following and mysql2 installed successfully.

gem install mysql2 -s http://rubygems.org
  But the problem remaied the same when re ran the "bundle install"


问:
QNetworkAccessManager::setProxy example
may someone give an example of using properly QNetworkAccessManager::setProxy, i meant i primaly a java developer mostly using HttpClient all the time.
Thx!</p>

答: Ricardo, in Qt source code directory go to "examples/declarative/cppextensions/networkaccessmanagerfactory" or go to http://qt.gitorious.org/qt/qt/trees/4.7/examples/declarative/cppextensions/networkaccessmanagerfactory. There is nothing complicated in that class method so you should be able to use it.</p>

Title: QNetworkAccessManager::setProxy example


问:
Make match input and if-else
I have my script here

from tkinter import *
from tkinter import messagebox
import commands

db=''

def launch():
        # Database Check.
            if db.lower() == 'y':
                commands.db_download()
            else:
                db.lower() == 'n'

root = Tk()

checklabel = Label(root, text="Check for new databases? Y/N: ")
checkentree = Entry(root, textvariable=db)
checkbutton = Button(root, text="Go", command=launch)

checklabel.pack()
checkentree.pack()
checkbutton.pack()

root.mainloop()
```

And everything works except the matching part.
When I enter "y" or "n", or even anything else in the Entry box and click Go, nothing happens... Why isnt anything happening? And how could i make it work?

答:
```<code>checkentree = Entry(root, textvariable=db)
</code>```

The textvariable parameter should be a StringVar. But db is a string, not a StringVar.

Try passing a StringVar instead.

```<code>from tkinter import *
from tkinter import messagebox
import commands

def launch():
        # Database Check.
            if db.get().lower() == 'y':
                commands.db_download()
            #don't actually need these following lines because they don't do anything
            #else:
            #    #db.get().lower() == 'n'

root = Tk()
db=StringVar()

checklabel = Label(root, text="Check for new databases? Y/N: ")
checkentree = Entry(root, textvariable=db)
checkbutton = Button(root, text="Go", command=launch)

checklabel.pack()
checkentree.pack()
checkbutton.pack()

root.mainloop()
</code>```

Title: Make match input and if-else

Body:
I have my script here

from tkinter import *
from tkinter import messagebox
import commands

db=''

def launch():
        # Database Check.
            if db.lower() == 'y':
                commands.db_download()
            else:
                db.lower() == 'n'

root = Tk()

checklabel = Label(root, text="Check for new databases? Y/N: ")
checkentree = Entry(root, textvariable=db)
checkbutton = Button(root, text="Go", command=launch)

checklabel.pack()
checkentree.pack()
checkbutton.pack()

root.mainloop()

And everything works except the matching part.
When I enter "y" or "n", or even anything else in the Entry box and click Go, nothing happens... Why isnt anything happening? And how could i make it work?

Body:
checkentree = Entry(root, textvariable=db)

The textvariable parameter should be a StringVar. But db is a string, not a StringVar.

Try passing a StringVar instead.

from tkinter import *
from tkinter import messagebox
import commands

def launch():
        # Database Check.
            if db.get().lower() == 'y':
                commands.db_download()
            #don't actually need these following lines because they don't do anything
            #else:
            #    #db.get().lower() == 'n'

root = Tk()
db=StringVar()

checklabel = Label(root, text="Check for new databases? Y/N: ")
checkentree = Entry(root, textvariable=db)
checkbutton = Button(root, text="Go", command=launch)

checklabel.pack()
checkentree.pack()
checkbutton.pack()

root.mainloop()


问:
How can I check if any of my boolean variable is false in VB.NET
Can I ask if is this is the only way to check if a variable is false in VB.net?

here is my code

```<code>if a = true and b = true and c = true then
     msgbox("ok")
else if a= true and b = true and c = false then
     msgbox("c has errors")
else if a= true and b = false and c = true then
     msgbox("b has errors")
else if a= false and b = true and c = true then
     msgbox("a has errors")
end if
</code>```

答:
Although I like Cristoph's answer, if the goal is to throw an error message and not proceed then could you not also just do this?</p>

```<code>Public Sub DoSomething(a as Boolean, b as Boolean, c as Boolean)

    If Not a Then
        MsgBox("A has errors!") ' Or have a log message or throw an exception.
        Exit Sub                ' Or Return Nothing if it's a function
    End If

    If Not b Then
        MsgBox("B has errors!") ' Or have a log message or throw an exception.
        Exit Sub                ' Or Return Nothing if it's a function
    End If

    If Not c Then
        MsgBox("C has errors!") ' Or have a log message or throw an exception.
        Exit Sub                ' Or Return Nothing if it's a function
    End If

    DoNextThing()

End Sub
</code>```

Body:
Can I ask if is this is the only way to check if a variable is false in VB.net?

here is my code

if a = true and b = true and c = true then
     msgbox("ok")
else if a= true and b = true and c = false then
     msgbox("c has errors")
else if a= true and b = false and c = true then
     msgbox("b has errors")
else if a= false and b = true and c = true then
     msgbox("a has errors")
end if

Body:
Although I like Cristoph's answer, if the goal is to throw an error message and not proceed then could you not also just do this?

Public Sub DoSomething(a as Boolean, b as Boolean, c as Boolean)

    If Not a Then
        MsgBox("A has errors!") ' Or have a log message or throw an exception.
        Exit Sub                ' Or Return Nothing if it's a function
    End If

    If Not b Then
        MsgBox("B has errors!") ' Or have a log message or throw an exception.
        Exit Sub                ' Or Return Nothing if it's a function
    End If

    If Not c Then
        MsgBox("C has errors!") ' Or have a log message or throw an exception.
        Exit Sub                ' Or Return Nothing if it's a function
    End If

    DoNextThing()

End Sub


问:
Not able to click an element on span
I am trying to automate a guide wire claim application. the element i am trying to click is a triangle. I have attached the Screenshot with HTML. I have used the xpath -//*[@id='TabBar:ClaimTab-btnWrap']- but it is not the correct xpath since it  taking me to next page not which is not we are expecting. we are expecting to show us a menu bar. I research online and tried all the method such as. Hoverandclick using xoffset,yoffset. nothing is working. Can someone give us any suggestion. I am using C# for coding.
My code:

```<code>Actions action = new Actions(driver);

action
 .MoveToElement(elementToHover, 24, 0)
 .ContextClick(elementToClick)
 .Build()
 .Perform();
</code>```

Can anyone please suggest some solution Screenshot

HTML:

C
laim

答: Please send Arrow_down key using sendkeys method after click on that tab. This is the only way.</p>

Title: Not able to click an element on span

Body:
I am trying to automate a guide wire claim application. the element i am trying to click is a triangle. I have attached the Screenshot with HTML. I have used the xpath -//*[@id='TabBar:ClaimTab-btnWrap']- but it is not the correct xpath since it  taking me to next page not which is not we are expecting. we are expecting to show us a menu bar. I research online and tried all the method such as. Hoverandclick using xoffset,yoffset. nothing is working. Can someone give us any suggestion. I am using C# for coding.
My code:

Actions action = new Actions(driver);

action
 .MoveToElement(elementToHover, 24, 0)
 .ContextClick(elementToClick)
 .Build()
 .Perform();

Can anyone please suggest some solution Screenshot

HTML:

C
laim


问:
Does Bugzilla support any markup language?
Maybe I'm just blind, but I can't find documentation about how to format text in Bugzilla. Does Bugzilla support Markdown, Textile or some sort of markup language out of the box?

-- EDIT --

Half interesting news: there is an open P3 enhancement [1] for adding optional support for Markdown [2] and it is possible to voteup. Though it doesn't seem there is too much enthusiasm around it.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=330707

[2] http://daringfireball.net/projects/markdown/

答:
At this moment, Markdown formatting is supported on https://bugzilla.mozilla.org/ based on my own testing just now. There's a small link that says "Markdown styling now supported"

However, Mozilla's bugzilla instance appears to be running one of several Markdown Bugzilla extensions listed on GitHub, since Markdown doesn't seem to be mentioned in the bugzilla code repository.

As for version history, bugzilla.mozilla.org links to documentation indicating they are running Bugzilla 4.2. Markdown was introduced in the Bugzilla 4.5.6 development snapshot, but reverted from 5.0. Then, Markdown support was included in the Bugzilla 5.1.2 documentation.

I can't find current plans. There was discussion here without clarity about what happened:

https://bugzilla.mozilla.org/show_bug.cgi?id=330707

https://wiki.mozilla.org/Bugzilla:Markdown

Conclusion

Any given Bugzilla installation may or may not support Markdown right now, but Markdown was designed to be readable, so go ahead and use it. It seems likely it will be rendered as HTML in the near future even if it isn't right now.


问:
RegEx for replacing the middle letter
Invalid regular expression: Invalid group

I tried except ( ) , fixed and changed . to $
but does not work

```<code>var name = 'ABC'
var pattern = /(?<=.{1})./
return name.replace(pattern, " * ")
</code>```

I want to replace like 'A*C'

Invalid regular expression: Invalid group

答:
A regex solution with capturing group:

```<code>var name = 'ABC';
var pattern = /(.)./;
return name.replace(pattern, "$1 * ")
</code>```

What you match with first parentheses is available in the replacement argument through $1.

Quick test:

var name = 'ABC'
var pattern = /(.)./
console.log(name.replace(pattern, "$1 * "))```

Title: RegEx for replacing the middle letter

Body:
Invalid regular expression: Invalid group

I tried except ( ) , fixed and changed . to $
but does not work

var name = 'ABC'
var pattern = /(?<=.{1})./
return name.replace(pattern, " * ")

I want to replace like 'A*C'

Invalid regular expression: Invalid group

Body:
A regex solution with capturing group:

var name = 'ABC';
var pattern = /(.)./;
return name.replace(pattern, "$1 * ")

What you match with first parentheses is available in the replacement argument through $1.

Quick test:

var name = 'ABC'
var pattern = /(.)./
console.log(name.replace(pattern, "$1 * "))


问:
get current status instead timerange
in Azure workbooks with the below query I am able to get avg of 2 columns a as per time range selected but here least time we can select is 30 mins we have a requirement to show last 1 min status of the result for that I need another column and show last 1 mins status

```<code>let start = {TimeRange:start};
let grain =  {TimeRange:grain};
workspace(name).site1_CL
| extend healty=iff(Status_s == 'Connected' , 100 , 0)
| summarize table1= avg(healty) by ClientName_s
|join
(workspace(name).site2_CL
| extend Availability=iff(StatusDescription_s == 'OK' , 100 , 0)
|summarize table2=avg(Availability) by  ClientName_s
 )
 on ClientName_s
| extend HealthStatus=(table1+table2)/2
| project Client=ClientName_s,Environment=EnvName_s,HealthStatus
</code>```

req another column and show current status instead aggregation of selected timerange this column should override selected timerange and show last 1 minute aggregation of 2 tables

答:
Couldn´t you just set the start to use the value you need?</p>

```<code>let start = now(-1m); //last minute
</code>```

Title: get current status instead timerange

Body:
in Azure workbooks with the below query I am able to get avg of 2 columns a as per time range selected but here least time we can select is 30 mins we have a requirement to show last 1 min status of the result for that I need another column and show last 1 mins status

let start = {TimeRange:start};
let grain =  {TimeRange:grain};
workspace(name).site1_CL
| extend healty=iff(Status_s == 'Connected' , 100 , 0)
| summarize table1= avg(healty) by ClientName_s
|join
(workspace(name).site2_CL
| extend Availability=iff(StatusDescription_s == 'OK' , 100 , 0)
|summarize table2=avg(Availability) by  ClientName_s
 )
 on ClientName_s
| extend HealthStatus=(table1+table2)/2
| project Client=ClientName_s,Environment=EnvName_s,HealthStatus

req another column and show current status instead aggregation of selected timerange this column should override selected timerange and show last 1 minute aggregation of 2 tables

Body:
Couldn´t you just set the start to use the value you need?

let start = now(-1m); //last minute


问:
Uses of Java Native Interface(JNI)
Could you please help me understanding under what scenario JNI (or Java Native Interface) could be useful from web application development perspective?

I did read some articles that promises that JNI can give you access to native application like menu bar/scroll bar etc, so the user interface can be more catchy... however these things can be done in other technologies rather than Java.

I'm still not able to find practical uses of JNI. Have you used the JNI in your projects/apps ever? and for what?

答:
JNI is useful if you need to call some lower level language (C, C++, assembler) function from within Java. Many projects use JNI, for example:

JOGL (Java library for making calls to OpenGL, a C library)

SWT (Java UI library that uses JNI to call a native windowing library, for example GTK on Linux)

There are utilities to automatically generate JNI code, like SWIG, which can dramatically ease the pain of generating JNI wrapper code (which involves writing a bit of Java and some of the underlying language).

Title: Uses of Java Native Interface(JNI)


问:
Configure Jenkins CI build to use TFVC hosted in Azure DevOps
We recently migrated from an on-premise TFS server to Azure DevOps. Our team uses TFVC for source control, and I'm getting the following exception when Jenkins polls for new check-ins:

FATAL: This server requires federated authentication but no mechanism was available to handle it.
  com.microsoft.tfs.core.exceptions.TFSFederatedAuthException: This server requires federated authentication but no mechanism was available to handle it.

Given the exception class name is TFSFederatedAuthException I suspect Azure is expecting some sort of OAuth integration, but Jenkins doesn't appear to support that for TFVC.

All I did was change the Collection URL for that Jenkins build to https://dev.azure.com/MyCompany. The Project path remains the same, and I verified this, because I was able to re-map all of my TFVC branches in Visual Studio by just pointing to the different collection URL and keeping the same project path. A screenshot of the Jenkins source control config is below:

This Jenkins server is internal with no public facing IP address or host name.

How can I allow Jenkins to poll a TFVC repository hosted in Azure DevOps in order to trigger a CI build in Jenkins?

Why not use Azure pipelines? That's a much bigger migration effort at the moment, and I'm just trying to solve a short term problem.

Using Azure pipelines is my long term goal, but I need to figure out how our automated tests can use an Oracle database first, because all data is deleted before each test is executed using Selenium.

答:
Azure DevOps uses OAuth to communicate by default, putting in your username and password won't work because of that. Instead, the trick is to generate a Personal Access Token (I suspect the Code|Read+Write scope should do it) and pass that in.

For the username pass in ., for the password your generated personal access token. Give the token a nice name so you know which one is about to expire once you get the email notification.


问:
Fastest way to compute a function on the patches of two images
I have two equal sized images and I want to compute a function lets suppose f on the patches of the images and calculate one number at each image location

The patch extraction is easy

```<code>   patches1 = image.extract_patches_2d(img1,(5,5))
   patches2 = image.extract_patches_2d(img2,(5,5))
</code>```

Now applying the function could be something like as follows

```<code>   result = numpy.zeros((image1.shape[0], img1.shape[1]))
   for i in range(len(image1.shape[0])):
       for j in range(len(image1.shape[1])):
           result[i,j] = f(patches1[i], patches1[j])
</code>```

But this is very slow!!!

I am wondering that what could be the best possible way to calculate it fast and get rid of the loops.

Thanks

EDIT1:

The implementation of f is

```<code>    def f (patch1, patch2):
        return np.sqrt(patch1^2 + patch2^2)
</code>```

答:
I had a try at this - anyone wanting to benchmark their code is welcome to copy my initialisation. Basically it creates a single standardised image and compares the black part of the image as patch A with the white part as patch B.

```<code>#!/usr/local/bin/python3

import numpy as np
import math

# Generate a standardised "random" array
shape=(768,1024)
np.random.seed(42)
img = np.random.randint(0,256,shape,dtype=np.uint8)

def loopy(patch1,patch2):
    """Version with loops"""
    h, w = patch1.shape[0], patch1.shape[1]
    result = np.zeros((h, w), dtype=np.float)
    for i in range(h):
        for j in range(w):
            p1 = float(patch1[i,j])
            p2 = float(patch2[i,j])
            result[i,j] = math.sqrt(p1*p1+p2*p2)
    return result

def me(patch1,patch2):
    A = patch1.astype(np.float) * patch1.astype(np.float)
    B = patch2.astype(np.float) * patch2.astype(np.float)
    return np.sqrt(A + B)

# Run loopy and me and compare results
l = loopy(img[100:200,100:200],img[400:500,400:500])
m = me(img[100:200,100:200],img[400:500,400:500])
print(np.mean(m-l))

%timeit loopy(img[100:200,100:200],img[400:500,400:500])
# 5.73 ms ± 74.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

%timeit me(img[100:200,100:200],img[400:500,400:500])
# 40.2 µs ± 1.05 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
</code>```

Body:
I have two equal sized images and I want to compute a function lets suppose f on the patches of the images and calculate one number at each image location

The patch extraction is easy

   patches1 = image.extract_patches_2d(img1,(5,5))
   patches2 = image.extract_patches_2d(img2,(5,5))

Now applying the function could be something like as follows

   result = numpy.zeros((image1.shape[0], img1.shape[1]))
   for i in range(len(image1.shape[0])):
       for j in range(len(image1.shape[1])):
           result[i,j] = f(patches1[i], patches1[j])

But this is very slow!!!

I am wondering that what could be the best possible way to calculate it fast and get rid of the loops.

Thanks

EDIT1:

The implementation of f is

    def f (patch1, patch2):
        return np.sqrt(patch1^2 + patch2^2)

Body:
I had a try at this - anyone wanting to benchmark their code is welcome to copy my initialisation. Basically it creates a single standardised image and compares the black part of the image as patch A with the white part as patch B.

#!/usr/local/bin/python3

import numpy as np
import math

# Generate a standardised "random" array
shape=(768,1024)
np.random.seed(42)
img = np.random.randint(0,256,shape,dtype=np.uint8)

def loopy(patch1,patch2):
    """Version with loops"""
    h, w = patch1.shape[0], patch1.shape[1]
    result = np.zeros((h, w), dtype=np.float)
    for i in range(h):
        for j in range(w):
            p1 = float(patch1[i,j])
            p2 = float(patch2[i,j])
            result[i,j] = math.sqrt(p1*p1+p2*p2)
    return result

def me(patch1,patch2):
    A = patch1.astype(np.float) * patch1.astype(np.float)
    B = patch2.astype(np.float) * patch2.astype(np.float)
    return np.sqrt(A + B)

# Run loopy and me and compare results
l = loopy(img[100:200,100:200],img[400:500,400:500])
m = me(img[100:200,100:200],img[400:500,400:500])
print(np.mean(m-l))

%timeit loopy(img[100:200,100:200],img[400:500,400:500])
# 5.73 ms ± 74.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

%timeit me(img[100:200,100:200],img[400:500,400:500])
# 40.2 µs ± 1.05 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)


问:
How to access global variables inside functions
I have following simple code:

```<code>line = "Hello"

def myfn()
    puts line
end

myfn()
</code>```

The variable line is not accessible in function. How can global variables be accessed inside functions?

答:
You could make it a constant via capitalization.

```<code>LINE = "Hello"

def myfn()
    puts LINE
end

myfn()
</code>```

If you want it to be variable pass it in as an argument, that's what they're for.

```<code>line = "Hello"

def myfn(msg)
    puts msg
end

myfn(line)
</code>```

Body:
I have following simple code:

line = "Hello"

def myfn()
    puts line
end

myfn()

The variable line is not accessible in function. How can global variables be accessed inside functions?

Body:
You could make it a constant via capitalization.

LINE = "Hello"

def myfn()
    puts LINE
end

myfn()

If you want it to be variable pass it in as an argument, that's what they're for.

line = "Hello"

def myfn(msg)
    puts msg
end

myfn(line)


问:
Difference between (int ret = 0; !ret && ret !=0)
What the difference between:

```<code>1) !ret
2) ret != 0
</code>```

?

```<code>if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
{
  if (!ret && *line)
    *line = NULL;
  return (ret);
}
</code>```

答:
These two expressions are different

```<code>1) !ret
2) ret != 0
</code>```

The first one yields 1 (i.e. true; in C there is no boolean type. The type _Bool is an integer type not boolean) when ret is equal to 0.

The second one yields 1 (i.e. true) when ret is not equal to 0.

So in this code snippet

```<code>if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
{
  if (!ret && *line)
    *line = NULL;
  return (ret);
}
</code>```

In the first condition

```<code>if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
</code>```

there is checked whether ret is not equal to 0 (It can be equal to 0 but the if statement nevertheless will be executed due to other sub-conditions of the condition). While in the second condition

```<code>if (!ret && *line)
</code>```

there is checked whether ret is equal to 0.

So in the inner if statement

```<code>if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
{
  if (!ret && *line)
    *line = NULL;
  return (ret);
}
</code>```

if the variable ret is equal to 0 and the value of *line is not equal to 0 then the expression *line is set to NULL.

Body:
What the difference between:

1) !ret
2) ret != 0

?

if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
{
  if (!ret && *line)
    *line = NULL;
  return (ret);
}

Body:
These two expressions are different

1) !ret
2) ret != 0

The first one yields 1 (i.e. true; in C there is no boolean type. The type _Bool is an integer type not boolean) when ret is equal to 0.

The second one yields 1 (i.e. true) when ret is not equal to 0.

So in this code snippet

if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
{
  if (!ret && *line)
    *line = NULL;
  return (ret);
}

In the first condition

if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')

there is checked whether ret is not equal to 0 (It can be equal to 0 but the if statement nevertheless will be executed due to other sub-conditions of the condition). While in the second condition

if (!ret && *line)

there is checked whether ret is equal to 0.

So in the inner if statement

if (ret != 0 || stack[fd] == NULL || stack[fd][0] == '\0')
{
  if (!ret && *line)
    *line = NULL;
  return (ret);
}

if the variable ret is equal to 0 and the value of *line is not equal to 0 then the expression *line is set to NULL.


问:
How do I parse an email to extract text (password) and store in a variable
I have a system that sends an email to a user with a temporary password.  I am using the following script to output the email but I am looking for a way to extract the password and store the value in a variable.  The body of the email will have the following text "Your temporary password is "  I would like to parse the email body and extract .  I assume that I could use a parse module to search for "Your temporary password is" and then store the next token to a variable but my knowledge of perl is not that great.  Can anyone point me in the right direction?</p>

```<code>#!/usr/bin/perl

use Net::POP3;

my $username="user";
my $password="password";
my $host="192.168.17.50";

    # Constructors
    my $pop = Net::POP3->new($host)||
        die "Problem calling Net::PoP->new\n$!\n";

#    $pop = Net::POP3->new($host, Timeout => 60);
    if ($pop->login($username, $password) > 0) {
      my $msgnums = $pop->list; # hashref of msgnum => size
      foreach my $msgnum (keys %$msgnums) {
        my $msg = $pop->get($msgnum);
        my $password = extract_password($msg)||
           die "Problem with extract_password\n$!\n";
        print $password;
        $pop->delete($msgnum);
      }
    }
    $pop->quit;
</code>```

答:
Here's a function that receives the message text and returns the password, or undef if it's not found.

```<code>sub extract_password {
    my $text = shift;

    if ($text =~ /Your temporary password is (\S+)/) {
        return $1;
    }
    else {
        return undef;
    }
}
</code>```

Then you can say my $password = extract_password($msg_text).

Body:
I have a system that sends an email to a user with a temporary password.  I am using the following script to output the email but I am looking for a way to extract the password and store the value in a variable.  The body of the email will have the following text "Your temporary password is "  I would like to parse the email body and extract .  I assume that I could use a parse module to search for "Your temporary password is" and then store the next token to a variable but my knowledge of perl is not that great.  Can anyone point me in the right direction?

#!/usr/bin/perl

use Net::POP3;

my $username="user";
my $password="password";
my $host="192.168.17.50";

    # Constructors
    my $pop = Net::POP3->new($host)||
        die "Problem calling Net::PoP->new\n$!\n";

#    $pop = Net::POP3->new($host, Timeout => 60);
    if ($pop->login($username, $password) > 0) {
      my $msgnums = $pop->list; # hashref of msgnum => size
      foreach my $msgnum (keys %$msgnums) {
        my $msg = $pop->get($msgnum);
        my $password = extract_password($msg)||
           die "Problem with extract_password\n$!\n";
        print $password;
        $pop->delete($msgnum);
      }
    }
    $pop->quit;

Body:
Here's a function that receives the message text and returns the password, or undef if it's not found.

sub extract_password {
    my $text = shift;

    if ($text =~ /Your temporary password is (\S+)/) {
        return $1;
    }
    else {
        return undef;
    }
}

Then you can say my $password = extract_password($msg_text).