问:
Python threads garbage collection
Is a running thread eligable for garbage collection if the thread object is reasigned? For example:

```<code>class A(threading.Thread)
    def run():
        while True:
            #Do stuff

a = A()
a.start()
time.sleep(60)
a = A()
</code>```

at this point, even though thread A is still doing stuff, can the interpreter destroy the original A() thread? If it does, is there a way to prevent this from happening?

答:
My guess is no. There's still a reference to the thread in whatever structure Python uses to keep track of things. I'll test it out, but I'd be astonished if it didn't work.

EDIT Check it out:

```<code>#!/usr/bin/env python
import threading, time

class A(threading.Thread):
    def __init__(self, name):
            threading.Thread.__init__(self)
            self.name=name
            self.count=0
    def run(self):
            while self.count<10:
                    print self.name, "Running!"
                    time.sleep(1)
                    self.count+=1

a=A("first")
a.start()
time.sleep(5)
a=A("second")
a.start()
</code>```

```first Running!
first Running!
first Running!
first Running!
first Running!
second Running!
first Running!
second Running!
first Running!
first Running!
second Running!
first Running!
second Running!
first Running!
second Running!
second Running!
second Running!
second Running!
second Running!
second Running!```

Title: Python threads garbage collection

Body:
Is a running thread eligable for garbage collection if the thread object is reasigned? For example:

class A(threading.Thread)
    def run():
        while True:
            #Do stuff

a = A()
a.start()
time.sleep(60)
a = A()

at this point, even though thread A is still doing stuff, can the interpreter destroy the original A() thread? If it does, is there a way to prevent this from happening?

Body:
My guess is no. There's still a reference to the thread in whatever structure Python uses to keep track of things. I'll test it out, but I'd be astonished if it didn't work.

EDIT Check it out:

#!/usr/bin/env python
import threading, time

class A(threading.Thread):
    def __init__(self, name):
            threading.Thread.__init__(self)
            self.name=name
            self.count=0
    def run(self):
            while self.count<10:
                    print self.name, "Running!"
                    time.sleep(1)
                    self.count+=1

a=A("first")
a.start()
time.sleep(5)
a=A("second")
a.start()

first Running!
first Running!
first Running!
first Running!
first Running!
second Running!
first Running!
second Running!
first Running!
first Running!
second Running!
first Running!
second Running!
first Running!
second Running!
second Running!
second Running!
second Running!
second Running!
second Running!


来源: stackexchange

问:
Java Void to Scala Unit
I have a java library method requiring a class of Void as a parameter. for example, in com.mongodb.async.client.MongoCollection:

```<code>void insertOne(TDocument document, SingleResultCallback<Void> callback);
</code>```

I'm accessing this method from scala. Scala uses the type Unit as equivalent of Void (correct me if I'm wrong please)

How can I pass a SingleResultCallback[Unit] (instead of SingleResultCallback[Void]) to this method? The compiler is not allowing this. Shouldn't it be picking this up?

答:
Scala's Unit is like Java's void primitive, but it's not exactly the same thing.

Scala's Unit type and Java's Void type are completely unrelated. Java's Void class exists so you can use it as a type parameter analogous to primitive void, just like Integer exists as an analogue to primitive int. In Scala, Unit fulfills the role of both Void and void.

An implicit conversion between Unit and Void cannot exist, because implicit conversions work on instances, not on types. Also, Java's Void type cannot have an instance. (Scala's Unit does have an instance: ().)

Long story short, Scala's Unit and Java's Void are different beasts. Since your Java library requires the Void type parameter, you should just give it that.

ContentLicense: CC BY-SA 3.0

Title: Java Void to Scala Unit

Body:
I have a java library method requiring a class of Void as a parameter. for example, in com.mongodb.async.client.MongoCollection:

void insertOne(TDocument document, SingleResultCallback<Void> callback);

I'm accessing this method from scala. Scala uses the type Unit as equivalent of Void (correct me if I'm wrong please)

How can I pass a SingleResultCallback[Unit] (instead of SingleResultCallback[Void]) to this method? The compiler is not allowing this. Shouldn't it be picking this up?


问:
The geositemap file(s) is/are blocking your XML sitemaps from working properly in wordpress
I'm new to wordpress when i uploaded the geositemap through filemanager I get this issue in wordpress SEO Yoast plugin on top like this

The following file(s) is/are blocking your XML sitemaps from working properly:

```<code>/home/wallerrealestate/public_html/geositemap.xml
</code>```

Either delete them (this can be done with the "Fix it" button) or disable Yoast SEO XML sitemaps.

Please help me.

答:
The solution to this yoast plugin is very easy. If you want to use Yoast’s sitemap function, than delete the physical file located at the path in the error message. You can automatically delete the file by clicking the “Fix it” button or manually through FTP or a file manager. If you are unsure how to delete files on your server, please contact your webhost.
if You want to know more you can visit here i have explained it with pictures
http://techynews4u.com/yoast-error-file-is-blocking-your-xml-sitemaps-from-working-properly/</p>

Body:
I'm new to wordpress when i uploaded the geositemap through filemanager I get this issue in wordpress SEO Yoast plugin on top like this

The following file(s) is/are blocking your XML sitemaps from working properly:

/home/wallerrealestate/public_html/geositemap.xml

Either delete them (this can be done with the "Fix it" button) or disable Yoast SEO XML sitemaps.

Please help me.


问:
google plus login not working after put a play store in android
I have created google plus signed Apk and after put a play store.Then download the application google plus login not working in android.How to solve this problem</p>

答: Probably your production key and debug key difference, make sure you put both keys in your google-json file and both keys in console.google google+plus api correctly, use gradle build to get the SHA and MD5 correctly</p>


问:
ffmpeg doesn't generate video from images
I am trying to create a video from jpeg images using ffmpeg. The generated video should be in x264 or x265 format.

I have a directory with 36 images . Each image size is around 60Mpixel. They are names as follow:

frame00000.jpg

frame00001.jps

frame00002.jpg

....

frame00035.jpg

I read documentation and several posts in SO and I came to write a batch file to call ffmpeg as follow:

```<code> ffmpeg.exe -r 1/5 -start_number 0 -i %1\frame%%05d.jpg -c:v libx264 -vf "fps=1,format=yuv420p" out1.mp4
</code>```

when I run this command, I am getting this output from the ffmpeg, which is strange:

```<code>C:\Users\m\Desktop\ffmpeg-20170702-c885356-win64-static\bin>ffmpeg.exe -r 1/5 -start_number 0 -i "C:\Resized"\frame%05d.jpg -c:v libx264 -vf "fps=1,format=yuv420p" out1.mp4
ffmpeg version N-86691-gc885356 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 67.100 / 55. 67.100
  libavcodec     57.100.103 / 57.100.103
  libavformat    57. 75.100 / 57. 75.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 94.100 /  6. 94.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, image2, from 'C:\Resized\frame%05d.jpg':
  Duration: 00:00:01.44, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 11000x5500 [SAR 1:1 DAR 2:1], 25 tbr, 25 tbn, 25 tbc
File 'out1.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 00000000006662e0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 000000000017b220] using SAR=1/1
[libx264 @ 000000000017b220] frame MB size (688x344) > level limit (139264)
[libx264 @ 000000000017b220] DPB size (4 frames, 946688 mbs) > level limit (2 frames, 696320 mbs)
[libx264 @ 000000000017b220] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000000000017b220] profile High, level 6.2
[libx264 @ 000000000017b220] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out1.mp4':
  Metadata:
    encoder         : Lavf57.75.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 11000x5500 [SAR 1:1 DAR 2:1], q=-1--1, 1 fps, 16384 tbn, 1 tbc
    Metadata:
      encoder         : Lavc57.100.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    1 fps=0.9 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    2 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    3 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    4 fps=1.3 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    5 fps=1.4 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    5 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    6 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    7 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    8 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    9 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   10 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   10 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   11 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   13 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   14 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   15 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   15 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   16 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   17 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   18 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   19 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   20 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   20 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   21 fps=1.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   22 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   23 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   24 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   25 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   25 fps=0.5 q=0.0 size=   55040kB time=00:00:00.00 bitrate=N/A speed=   frame=   26 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   27 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   28 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   29 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   30 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   31 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   32 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   34 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   35 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   35 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   36 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   37 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   39 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   40 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   40 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   41 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   43 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   44 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   45 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   46 fps=0.1 q=0.0 size=   77568kB time=00:00:00.00 bitrate=N/A speed=   frame=   47 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   48 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   49 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   50 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   50 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   51 fps=0.0 q=17.0 size=    8448kB time=-00:00:01.99 bitrate=N/A speed=Nframe=   52 fps=0.0 q=17.0 size=    8448kB time=-00:00:00.99 bitrate=N/A speed=Nframe=   53 fps=0.0 q=17.0 size=    8448kB time=00:00:00.00 bitrate=1134531147.5frame=   54 fps=0.0 q=17.0 size=    8448kB time=00:00:01.00 bitrate=69202.2kbitsframe=   55 fps=0.0 q=17.0 size=    8448kB time=00:00:02.00 bitrate=34602.1kbitsframe=   55 fps=0.0 q=17.0 size=    8448kB time=00:00:02.00 bitrate=34602.1kbitsframe=   56 fps=0.0 q=17.0 size=   14848kB time=00:00:03.00 bitrate=40544.2kbitsframe=   57 fps=0.0 q=17.0 size=   14848kB time=00:00:04.00 bitrate=30408.3kbitsframe=   58 fps=0.0 q=17.0 size=   14848kB time=00:00:05.00 bitrate=24326.7kbitsframe=   59 fps=0.0 q=17.0 size=   14848kB time=00:00:06.00 bitrate=20272.3kbitsframe=   60 fps=0.0 q=17.0 size=   22016kB time=00:00:07.00 bitrate=25764.8kbitsframe=   60 fps=0.0 q=17.0 size=   22016kB time=00:00:07.00 bitrate=25764.8kbitsframe=   61 fps=0.0 q=17.0 size=   22016kB time=00:00:08.00 bitrate=22544.3kbitsframe=   62 fps=0.0 q=17.0 size=   22016kB time=00:00:09.00 bitrate=20039.4kbitsframe=   63 fps=0.0 q=17.0 size=   22016kB time=00:00:10.00 bitrate=18035.4kbitsframe=   64 fps=0.0 q=17.0 size=   29696kB time=00:00:11.00 bitrate=22115.3kbitsframe=   65 fps=0.0 q=17.0 size=   29696kB time=00:00:12.00 bitrate=20272.4kbitsframe=   65 fps=0.0 q=17.0 size=   29696kB time=00:00:12.00 bitrate=20272.4kbitsframe=   66 fps=0.0 q=17.0 size=   29696kB time=00:00:13.00 bitrate=18713.0kbitsframe=   67 fps=0.0 q=17.0 size=   29696kB time=00:00:14.00 bitrate=17376.4kbitsframe=   68 fps=0.0 q=17.0 size=   37376kB time=00:00:15.00 bitrate=20412.2kbitsframe=   69 fps=0.0 q=17.0 size=   37376kB time=00:00:16.00 bitrate=19136.5kbitsframe=   70 fps=0.0 q=17.0 size=   37376kB time=00:00:17.00 bitrate=18010.8kbitsframe=   70 fps=0.0 q=17.0 size=   37376kB time=00:00:17.00 bitrate=18010.8kbitsframe=   71 fps=0.0 q=17.0 size=   37376kB time=00:00:18.00 bitrate=17010.2kbitsframe=   72 fps=0.0 q=17.0 size=   37376kB time=00:00:19.00 bitrate=16114.9kbitsframe=   73 fps=0.0 q=17.0 size=   37376kB time=00:00:20.00 bitrate=15309.2kbitsframe=   74 fps=0.0 q=17.0 size=   37376kB time=00:00:21.00 bitrate=14580.2kbitsframe=   75 fps=0.0 q=17.0 size=   37376kB time=00:00:22.00 bitrate=13917.4kbitsframe=   75 fps=0.0 q=17.0 size=   37376kB time=00:00:22.00 bitrate=13917.4kbitsframe=   76 fps=0.0 q=17.0 size=   44032kB time=00:00:23.00 bitrate=15683.0kbitsframe=   77 fps=0.0 q=17.0 size=   44032kB time=00:00:24.00 bitrate=15029.6kbitsframe=   78 fps=0.0 q=17.0 size=   44032kB time=00:00:25.00 bitrate=14428.4kbitsframe=   79 fps=0.0 q=17.0 size=   44032kB time=00:00:26.00 bitrate=13873.4kbitsframe=   80 fps=0.0 q=17.0 size=   50944kB time=00:00:27.00 bitrate=15456.8kbitsframe=   80 fps=0.0 q=17.0 size=   50944kB time=00:00:27.00 bitrate=15456.8kbitsframe=   81 fps=0.0 q=17.0 size=   50944kB time=00:00:28.00 bitrate=14904.7kbitsframe=   82 fps=0.0 q=17.0 size=   50944kB time=00:00:29.00 bitrate=14390.8kbitsframe=   83 fps=0.0 q=17.0 size=   50944kB time=00:00:30.00 bitrate=13911.1kbitsframe=   84 fps=0.0 q=17.0 size=   58368kB time=00:00:31.00 bitrate=15424.2kbitsframe=   85 fps=0.0 q=17.0 size=   58368kB time=00:00:32.00 bitrate=14942.2kbitsframe=   85 fps=0.0 q=17.0 size=   58368kB time=00:00:32.00 bitrate=14942.2kbitsframe=   86 fps=0.0 q=17.0 size=   58368kB time=00:00:33.00 bitrate=14489.4kbitsframe=   87 fps=0.0 q=17.0 size=   58368kB time=00:00:34.00 bitrate=14063.2kbitsframe=   88 fps=0.0 q=17.0 size=   66048kB time=00:00:35.00 bitrate=15459.0kbitsframe=   89 fps=0.0 q=17.0 size=   66048kB time=00:00:36.00 bitrate=15029.6kbitsframe=   90 fps=0.0 q=17.0 size=   66048kB time=00:00:37.00 bitrate=14623.4kbitsframe=   90 fps=0.0 q=17.0 size=   66048kB time=00:00:37.00 bitrate=14623.4kbitsframe=   91 fps=0.0 q=17.0 size=   66048kB time=00:00:38.00 bitrate=14238.5kbitsframe=   92 fps=0.0 q=17.0 size=   66048kB time=00:00:39.00 bitrate=13873.5kbitsframe=   93 fps=0.0 q=17.0 size=   66048kB time=00:00:40.00 bitrate=13526.6kbitsframe=   94 fps=0.0 q=17.0 size=   66048kB time=00:00:41.00 bitrate=13196.7kbitsframe=   95 fps=0.0 q=17.0 size=   66048kB time=00:00:42.00 bitrate=12882.5kbitsframe=   95 fps=0.0 q=17.0 size=   66048kB time=00:00:42.00 bitrate=12882.5kbitsframe=   96 fps=0.0 q=17.0 size=   72448kB time=00:00:43.00 bitrate=13802.2kbitsframe=   97 fps=0.0 q=17.0 size=   72448kB time=00:00:44.00 bitrate=13488.5kbitsframe=   99 fps=0.0 q=17.0 size=   72448kB time=00:00:46.00 bitrate=12902.0kbitsframe=  100 fps=0.0 q=17.0 size=   79360kB time=00:00:47.00 bitrate=13832.3kbitsframe=  100 fps=0.0 q=17.0 size=   79360kB time=00:00:47.00 bitrate=13832.3kbitsframe=  101 fps=0.0 q=17.0 size=   79360kB time=00:00:48.00 bitrate=13544.1kbitsframe=  103 fps=0.0 q=17.0 size=   79360kB time=00:00:50.00 bitrate=13002.3kbitsframe=  104 fps=0.0 q=17.0 size=   86528kB time=00:00:51.00 bitrate=13898.8kbitsframe=  105 fps=0.0 q=17.0 size=   86528kB time=00:00:52.00 bitrate=13631.5kbitsframe=  105 fps=0.0 q=17.0 size=   86528kB time=00:00:52.00 bitrate=13631.5kbitsframe=  106 fps=0.0 q=17.0 size=   86528kB time=00:00:53.00 bitrate=13374.3kbitsframe=  107 fps=0.0 q=17.0 size=   86528kB time=00:00:54.00 bitrate=13126.6kbitsframe=  108 fps=0.0 q=17.0 size=   94208kB time=00:00:55.00 bitrate=14031.8kbitsframe=  109 fps=0.0 q=17.0 size=   94208kB time=00:00:56.00 bitrate=13781.3kbitsframe=  110 fps=0.0 q=17.0 size=   94208kB time=00:00:57.00 bitrate=13539.5kbitsframe=  111 fps=0.0 q=17.0 size=   94208kB time=00:00:58.00 bitrate=13306.1kbitsframe=  112 fps=0.0 q=17.0 size=   94464kB time=00:00:59.00 bitrate=13116.1kbitsframe=  113 fps=0.0 q=17.0 size=   94464kB time=00:01:00.00 bitrate=12897.5kbitsframe=  115 fps=0.0 q=17.0 size=   94464kB time=00:01:02.00 bitrate=12481.4kbitsframe=  115 fps=0.0 q=17.0 size=   94464kB time=00:01:02.00 bitrate=12481.4kbitsframe=  116 fps=0.0 q=17.0 size=  100608kB time=00:01:03.00 bitrate=13082.2kbitsframe=  117 fps=0.0 q=17.0 size=  100608kB time=00:01:04.00 bitrate=12877.8kbitsframe=  119 fps=0.0 q=17.0 size=  100608kB time=00:01:06.00 bitrate=12487.6kbitsframe=  120 fps=0.0 q=17.0 size=  107520kB time=00:01:07.00 bitrate=13146.3kbitsframe=  121 fps=0.0 q=17.0 size=  107520kB time=00:01:08.00 bitrate=12953.0kbitsframe=  123 fps=0.0 q=17.0 size=  107520kB time=00:01:10.00 bitrate=12582.9kbitsframe=  125 fps=0.0 q=17.0 size=  114944kB time=00:01:12.00 bitrate=13078.1kbitsframe=  126 fps=0.0 q=17.0 size=  114944kB time=00:01:13.00 bitrate=12898.9kbitsframe=  128 fps=0.0 q=17.0 size=  122880kB time=00:01:15.00 bitrate=13421.8kbitsframe=  129 fps=0.0 q=17.0 size=  122880kB time=00:01:16.00 bitrate=13245.2kbitsframe=  130 fps=0.0 q=17.0 size=  122880kB time=00:01:17.00 bitrate=13073.1kbitsframe=  130 fps=0.0 q=17.0 size=  122880kB time=00:01:17.00 bitrate=13073.1kbitsframe=  131 fps=0.0 q=17.0 size=  122880kB time=00:01:18.00 bitrate=12905.5kbitsframe=  133 fps=0.0 q=17.0 size=  122880kB time=00:01:20.00 bitrate=12582.9kbitsframe=  135 fps=0.0 q=17.0 size=  122880kB time=00:01:22.00 bitrate=12276.0kbitsframe=  135 fps=0.0 q=17.0 size=  122880kB time=00:01:22.00 bitrate=12276.0kbitsframe=  136 fps=0.0 q=17.0 size=  129280kB time=00:01:23.00 bitrate=12759.8kbitsframe=  137 fps=0.0 q=17.0 size=  129280kB time=00:01:24.00 bitrate=12607.9kbitsframe=  138 fps=0.0 q=17.0 size=  129280kB time=00:01:25.00 bitrate=12459.5kbitsframe=  140 fps=0.0 q=17.0 size=  136448kB time=00:01:27.00 bitrate=12848.1kbitsframe=  140 fps=0.0 q=17.0 size=  136448kB time=00:01:27.00 bitrate=12848.1kbitsframe=  141 fps=0.0 q=17.0 size=  136448kB time=00:01:28.00 bitrate=12702.1kbitsframe=  143 fps=0.0 q=17.0 size=  136448kB time=00:01:30.00 bitrate=12419.8kbitsframe=  145 fps=0.0 q=17.0 size=  143872kB time=00:01:32.00 bitrate=12810.9kbitsframe=  146 fps=0.0 q=17.0 size=  143872kB time=00:01:33.00 bitrate=12673.1kbitsframe=  148 fps=0.0 q=17.0 size=  151552kB time=00:01:35.00 bitrate=13068.6kbitsframe=  149 fps=0.0 q=17.0 size=  151552kB time=00:01:36.00 bitrate=12932.4kbitsframe=  150 fps=0.0 q=17.0 size=  151552kB time=00:01:37.00 bitrate=12799.1kbitsframe=  150 fps=0.0 q=17.0 size=  151552kB time=00:01:37.00 bitrate=12799.1kbitsframe=  151 fps=0.0 q=17.0 size=  151552kB time=00:01:38.00 bitrate=12668.5kbitsframe=  153 fps=0.0 q=17.0 size=  151552kB time=00:01:40.00 bitrate=12415.1kbitsframe=  155 fps=0.0 q=17.0 size=  151552kB time=00:01:42.00 bitrate=12171.7kbitsframe=  156 fps=0.0 q=17.0 size=  157952kB time=00:01:43.00 bitrate=12562.5kbitsframe=  157 fps=0.0 q=17.0 size=  157952kB time=00:01:44.00 bitrate=12441.8kbitsframe=  159 fps=0.0 q=17.0 size=  157952kB time=00:01:46.00 bitrate=12207.0kbitsframe=  160 fps=0.0 q=17.0 size=  164864kB time=00:01:47.00 bitrate=12622.1kbitsframe=  161 fps=0.0 q=17.0 size=  164864kB time=00:01:48.00 bitrate=12505.2kbitsframe=  163 fps=0.0 q=17.0 size=  164864kB time=00:01:50.00 bitrate=12277.9kbitsframe=  165 fps=0.0 q=17.0 size=  172288kB time=00:01:52.00 bitrate=12601.6kbitsframe=  166 fps=0.0 q=17.0 size=  172288kB time=00:01:53.00 bitrate=12490.1kbitsframe=  168 fps=0.0 q=17.0 size=  179968kB time=00:01:55.00 bitrate=12820.0kbitsframe=  169 fps=0.0 q=17.0 size=  179968kB time=00:01:56.00 bitrate=12709.5kbitsframe=  170 fps=0.0 q=17.0 size=  179968kB time=00:01:57.00 bitrate=12600.8kbitsframe=  171 fps=0.0 q=17.0 size=  179968kB time=00:01:58.00 bitrate=12494.0kbitsframe=  173 fps=0.0 q=17.0 size=  179968kB time=00:02:00.00 bitrate=12285.8kbitsframe=  175 fps=0.0 q=17.0 size=  179968kB time=00:02:02.00 bitrate=12084.4kbitsframe=  176 fps=0.0 q=17.0 size=  186368kB time=00:02:03.00 bitrate=12412.4kbitsframe=  176 fps=0.0 q=-1.0 Lsize=  254547kB time=00:02:53.00 bitrate=12053.5kbits/s speed=0.0344x
video:254543kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001571%
[libx264 @ 000000000017b220] frame I:1     Avg QP: 7.13  size:8716365
[libx264 @ 000000000017b220] frame P:44    Avg QP:10.34  size:5710783
[libx264 @ 000000000017b220] frame B:131   Avg QP:13.29  size:  5046
[libx264 @ 000000000017b220] consecutive B-frames:  0.6%  0.0%  1.7% 97.7%
[libx264 @ 000000000017b220] mb I  I16..4: 22.8% 68.7%  8.5%
[libx264 @ 000000000017b220] mb P  I16..4:  0.8% 44.9%  3.6%  P16..4:  4.9%  5.5%  3.1%  0.0%  0.0%    skip:37.1%
[libx264 @ 000000000017b220] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.6%  0.0%  0.0%  direct: 0.1%  skip:99.2%  L0:42.7% L1:55.9% BI: 1.5%
[libx264 @ 000000000017b220] 8x8 transform intra:90.1% inter:72.0%
[libx264 @ 000000000017b220] coded y,uvDC,uvAC intra: 96.9% 93.0% 90.5% inter: 3.6% 3.7% 3.6%
[libx264 @ 000000000017b220] i16 v,h,dc,p: 50% 15% 14% 21%
[libx264 @ 000000000017b220] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 29% 21%  4%  5%  4%  7%  5%  9%
[libx264 @ 000000000017b220] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 33% 11%  6%  9%  6%  9%  5%  8%
[libx264 @ 000000000017b220] i8c dc,h,v,p: 50% 29% 16%  5%
[libx264 @ 000000000017b220] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000017b220] ref P L0: 44.8% 21.7% 12.8% 20.8%
[libx264 @ 000000000017b220] ref B L0: 85.0% 14.0%  1.0%
[libx264 @ 000000000017b220] ref B L1: 98.0%  2.0%
[libx264 @ 000000000017b220] kb/s:11847.81
</code>```

As can be seen:

it reported:

deprecated pixel format used, make sure you did set range correctly

what that means?

It is trying to process more than 36 frames, when we only have 36 frames.

Until frame 25, size is zero and bitrate is N/A and after frame 25, size became none zero.

It runs for several hundred images and then stops, but I can not play video.

After frame 47, FPS became zero.

I can not play back the output video.

How can I fix these problems and create a video from these frames?

Edit1

After getting some reply, I noted that h264 can not support the final resolution so I converted to use VP9 and I am using this command:

```<code>ffmpeg -i %1\frame%%05d.jpg -c:v libvpx-vp9 -b:v 2M -c:a libvorbis output.webm
</code>```

I am getting the right number of frames, but I can not play the output using VLC.

Is there any player that can play this resolution?

Is there any way that I can check that the data in video is correct other than playing it? For example by extracting them into several images and view the images.

答:
It is trying to process more than 36 frames, when we only have 36 frames.

Your input rate is set as 1/5 i.e. show each frame for 5 seconds, but your output rate is set to 1 (fps=1), so ffmpeg will duplicate each frame 4 times (except the last one).

Until frame 25, size is zero and bitrate is N/A and after frame 25, size became none zero.

The size and bitrate are reported as the streams are muxed after encoding, so there is some lag.

After frame 47, FPS became zero.

It's frame 27, and this FPS value is processing speed. Your final processing speed is 0.03x i.e. 0.03 x 1 fps, so fps readout is getting rounded down or truncated to 0.0 -> not an error.

I can not play back the output video.

Two possible reasons:

Many video players cannot play low framerate videos. 5 tends to be a safe minimum. So fps=5. Also, change -r 1/5 to -framerate 1/5.

Other reason may be the frame size. Some players may not be geared to play a video with frames that large, either due to the size itself or the non-compliance with any valid H.264 level. If this is the case, you may have to downscale the stream.

Body:
I am trying to create a video from jpeg images using ffmpeg. The generated video should be in x264 or x265 format.

I have a directory with 36 images . Each image size is around 60Mpixel. They are names as follow:

frame00000.jpg

frame00001.jps

frame00002.jpg

....

frame00035.jpg

I read documentation and several posts in SO and I came to write a batch file to call ffmpeg as follow:

 ffmpeg.exe -r 1/5 -start_number 0 -i %1\frame%%05d.jpg -c:v libx264 -vf "fps=1,format=yuv420p" out1.mp4

when I run this command, I am getting this output from the ffmpeg, which is strange:

C:\Users\m\Desktop\ffmpeg-20170702-c885356-win64-static\bin>ffmpeg.exe -r 1/5 -start_number 0 -i "C:\Resized"\frame%05d.jpg -c:v libx264 -vf "fps=1,format=yuv420p" out1.mp4
ffmpeg version N-86691-gc885356 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 67.100 / 55. 67.100
  libavcodec     57.100.103 / 57.100.103
  libavformat    57. 75.100 / 57. 75.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 94.100 /  6. 94.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, image2, from 'C:\Resized\frame%05d.jpg':
  Duration: 00:00:01.44, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 11000x5500 [SAR 1:1 DAR 2:1], 25 tbr, 25 tbn, 25 tbc
File 'out1.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 00000000006662e0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 000000000017b220] using SAR=1/1
[libx264 @ 000000000017b220] frame MB size (688x344) > level limit (139264)
[libx264 @ 000000000017b220] DPB size (4 frames, 946688 mbs) > level limit (2 frames, 696320 mbs)
[libx264 @ 000000000017b220] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000000000017b220] profile High, level 6.2
[libx264 @ 000000000017b220] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out1.mp4':
  Metadata:
    encoder         : Lavf57.75.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 11000x5500 [SAR 1:1 DAR 2:1], q=-1--1, 1 fps, 16384 tbn, 1 tbc
    Metadata:
      encoder         : Lavc57.100.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    1 fps=0.9 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    2 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    3 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    4 fps=1.3 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    5 fps=1.4 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    5 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    6 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    7 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    8 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=    9 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   10 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   10 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   11 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   13 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   14 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   15 fps=1.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   15 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   16 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   17 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   18 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   19 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   20 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   20 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   21 fps=1.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   22 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   23 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   24 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   25 fps=1.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   25 fps=0.5 q=0.0 size=   55040kB time=00:00:00.00 bitrate=N/A speed=   frame=   26 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   27 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   28 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   29 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   30 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   31 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   32 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   34 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   35 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   35 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   36 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   37 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   39 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   40 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   40 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   41 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   43 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   44 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   45 fps=0.1 q=0.0 size=   55296kB time=00:00:00.00 bitrate=N/A speed=   frame=   46 fps=0.1 q=0.0 size=   77568kB time=00:00:00.00 bitrate=N/A speed=   frame=   47 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   48 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   49 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   50 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   50 fps=0.0 q=0.0 size=   77824kB time=00:00:00.00 bitrate=N/A speed=   frame=   51 fps=0.0 q=17.0 size=    8448kB time=-00:00:01.99 bitrate=N/A speed=Nframe=   52 fps=0.0 q=17.0 size=    8448kB time=-00:00:00.99 bitrate=N/A speed=Nframe=   53 fps=0.0 q=17.0 size=    8448kB time=00:00:00.00 bitrate=1134531147.5frame=   54 fps=0.0 q=17.0 size=    8448kB time=00:00:01.00 bitrate=69202.2kbitsframe=   55 fps=0.0 q=17.0 size=    8448kB time=00:00:02.00 bitrate=34602.1kbitsframe=   55 fps=0.0 q=17.0 size=    8448kB time=00:00:02.00 bitrate=34602.1kbitsframe=   56 fps=0.0 q=17.0 size=   14848kB time=00:00:03.00 bitrate=40544.2kbitsframe=   57 fps=0.0 q=17.0 size=   14848kB time=00:00:04.00 bitrate=30408.3kbitsframe=   58 fps=0.0 q=17.0 size=   14848kB time=00:00:05.00 bitrate=24326.7kbitsframe=   59 fps=0.0 q=17.0 size=   14848kB time=00:00:06.00 bitrate=20272.3kbitsframe=   60 fps=0.0 q=17.0 size=   22016kB time=00:00:07.00 bitrate=25764.8kbitsframe=   60 fps=0.0 q=17.0 size=   22016kB time=00:00:07.00 bitrate=25764.8kbitsframe=   61 fps=0.0 q=17.0 size=   22016kB time=00:00:08.00 bitrate=22544.3kbitsframe=   62 fps=0.0 q=17.0 size=   22016kB time=00:00:09.00 bitrate=20039.4kbitsframe=   63 fps=0.0 q=17.0 size=   22016kB time=00:00:10.00 bitrate=18035.4kbitsframe=   64 fps=0.0 q=17.0 size=   29696kB time=00:00:11.00 bitrate=22115.3kbitsframe=   65 fps=0.0 q=17.0 size=   29696kB time=00:00:12.00 bitrate=20272.4kbitsframe=   65 fps=0.0 q=17.0 size=   29696kB time=00:00:12.00 bitrate=20272.4kbitsframe=   66 fps=0.0 q=17.0 size=   29696kB time=00:00:13.00 bitrate=18713.0kbitsframe=   67 fps=0.0 q=17.0 size=   29696kB time=00:00:14.00 bitrate=17376.4kbitsframe=   68 fps=0.0 q=17.0 size=   37376kB time=00:00:15.00 bitrate=20412.2kbitsframe=   69 fps=0.0 q=17.0 size=   37376kB time=00:00:16.00 bitrate=19136.5kbitsframe=   70 fps=0.0 q=17.0 size=   37376kB time=00:00:17.00 bitrate=18010.8kbitsframe=   70 fps=0.0 q=17.0 size=   37376kB time=00:00:17.00 bitrate=18010.8kbitsframe=   71 fps=0.0 q=17.0 size=   37376kB time=00:00:18.00 bitrate=17010.2kbitsframe=   72 fps=0.0 q=17.0 size=   37376kB time=00:00:19.00 bitrate=16114.9kbitsframe=   73 fps=0.0 q=17.0 size=   37376kB time=00:00:20.00 bitrate=15309.2kbitsframe=   74 fps=0.0 q=17.0 size=   37376kB time=00:00:21.00 bitrate=14580.2kbitsframe=   75 fps=0.0 q=17.0 size=   37376kB time=00:00:22.00 bitrate=13917.4kbitsframe=   75 fps=0.0 q=17.0 size=   37376kB time=00:00:22.00 bitrate=13917.4kbitsframe=   76 fps=0.0 q=17.0 size=   44032kB time=00:00:23.00 bitrate=15683.0kbitsframe=   77 fps=0.0 q=17.0 size=   44032kB time=00:00:24.00 bitrate=15029.6kbitsframe=   78 fps=0.0 q=17.0 size=   44032kB time=00:00:25.00 bitrate=14428.4kbitsframe=   79 fps=0.0 q=17.0 size=   44032kB time=00:00:26.00 bitrate=13873.4kbitsframe=   80 fps=0.0 q=17.0 size=   50944kB time=00:00:27.00 bitrate=15456.8kbitsframe=   80 fps=0.0 q=17.0 size=   50944kB time=00:00:27.00 bitrate=15456.8kbitsframe=   81 fps=0.0 q=17.0 size=   50944kB time=00:00:28.00 bitrate=14904.7kbitsframe=   82 fps=0.0 q=17.0 size=   50944kB time=00:00:29.00 bitrate=14390.8kbitsframe=   83 fps=0.0 q=17.0 size=   50944kB time=00:00:30.00 bitrate=13911.1kbitsframe=   84 fps=0.0 q=17.0 size=   58368kB time=00:00:31.00 bitrate=15424.2kbitsframe=   85 fps=0.0 q=17.0 size=   58368kB time=00:00:32.00 bitrate=14942.2kbitsframe=   85 fps=0.0 q=17.0 size=   58368kB time=00:00:32.00 bitrate=14942.2kbitsframe=   86 fps=0.0 q=17.0 size=   58368kB time=00:00:33.00 bitrate=14489.4kbitsframe=   87 fps=0.0 q=17.0 size=   58368kB time=00:00:34.00 bitrate=14063.2kbitsframe=   88 fps=0.0 q=17.0 size=   66048kB time=00:00:35.00 bitrate=15459.0kbitsframe=   89 fps=0.0 q=17.0 size=   66048kB time=00:00:36.00 bitrate=15029.6kbitsframe=   90 fps=0.0 q=17.0 size=   66048kB time=00:00:37.00 bitrate=14623.4kbitsframe=   90 fps=0.0 q=17.0 size=   66048kB time=00:00:37.00 bitrate=14623.4kbitsframe=   91 fps=0.0 q=17.0 size=   66048kB time=00:00:38.00 bitrate=14238.5kbitsframe=   92 fps=0.0 q=17.0 size=   66048kB time=00:00:39.00 bitrate=13873.5kbitsframe=   93 fps=0.0 q=17.0 size=   66048kB time=00:00:40.00 bitrate=13526.6kbitsframe=   94 fps=0.0 q=17.0 size=   66048kB time=00:00:41.00 bitrate=13196.7kbitsframe=   95 fps=0.0 q=17.0 size=   66048kB time=00:00:42.00 bitrate=12882.5kbitsframe=   95 fps=0.0 q=17.0 size=   66048kB time=00:00:42.00 bitrate=12882.5kbitsframe=   96 fps=0.0 q=17.0 size=   72448kB time=00:00:43.00 bitrate=13802.2kbitsframe=   97 fps=0.0 q=17.0 size=   72448kB time=00:00:44.00 bitrate=13488.5kbitsframe=   99 fps=0.0 q=17.0 size=   72448kB time=00:00:46.00 bitrate=12902.0kbitsframe=  100 fps=0.0 q=17.0 size=   79360kB time=00:00:47.00 bitrate=13832.3kbitsframe=  100 fps=0.0 q=17.0 size=   79360kB time=00:00:47.00 bitrate=13832.3kbitsframe=  101 fps=0.0 q=17.0 size=   79360kB time=00:00:48.00 bitrate=13544.1kbitsframe=  103 fps=0.0 q=17.0 size=   79360kB time=00:00:50.00 bitrate=13002.3kbitsframe=  104 fps=0.0 q=17.0 size=   86528kB time=00:00:51.00 bitrate=13898.8kbitsframe=  105 fps=0.0 q=17.0 size=   86528kB time=00:00:52.00 bitrate=13631.5kbitsframe=  105 fps=0.0 q=17.0 size=   86528kB time=00:00:52.00 bitrate=13631.5kbitsframe=  106 fps=0.0 q=17.0 size=   86528kB time=00:00:53.00 bitrate=13374.3kbitsframe=  107 fps=0.0 q=17.0 size=   86528kB time=00:00:54.00 bitrate=13126.6kbitsframe=  108 fps=0.0 q=17.0 size=   94208kB time=00:00:55.00 bitrate=14031.8kbitsframe=  109 fps=0.0 q=17.0 size=   94208kB time=00:00:56.00 bitrate=13781.3kbitsframe=  110 fps=0.0 q=17.0 size=   94208kB time=00:00:57.00 bitrate=13539.5kbitsframe=  111 fps=0.0 q=17.0 size=   94208kB time=00:00:58.00 bitrate=13306.1kbitsframe=  112 fps=0.0 q=17.0 size=   94464kB time=00:00:59.00 bitrate=13116.1kbitsframe=  113 fps=0.0 q=17.0 size=   94464kB time=00:01:00.00 bitrate=12897.5kbitsframe=  115 fps=0.0 q=17.0 size=   94464kB time=00:01:02.00 bitrate=12481.4kbitsframe=  115 fps=0.0 q=17.0 size=   94464kB time=00:01:02.00 bitrate=12481.4kbitsframe=  116 fps=0.0 q=17.0 size=  100608kB time=00:01:03.00 bitrate=13082.2kbitsframe=  117 fps=0.0 q=17.0 size=  100608kB time=00:01:04.00 bitrate=12877.8kbitsframe=  119 fps=0.0 q=17.0 size=  100608kB time=00:01:06.00 bitrate=12487.6kbitsframe=  120 fps=0.0 q=17.0 size=  107520kB time=00:01:07.00 bitrate=13146.3kbitsframe=  121 fps=0.0 q=17.0 size=  107520kB time=00:01:08.00 bitrate=12953.0kbitsframe=  123 fps=0.0 q=17.0 size=  107520kB time=00:01:10.00 bitrate=12582.9kbitsframe=  125 fps=0.0 q=17.0 size=  114944kB time=00:01:12.00 bitrate=13078.1kbitsframe=  126 fps=0.0 q=17.0 size=  114944kB time=00:01:13.00 bitrate=12898.9kbitsframe=  128 fps=0.0 q=17.0 size=  122880kB time=00:01:15.00 bitrate=13421.8kbitsframe=  129 fps=0.0 q=17.0 size=  122880kB time=00:01:16.00 bitrate=13245.2kbitsframe=  130 fps=0.0 q=17.0 size=  122880kB time=00:01:17.00 bitrate=13073.1kbitsframe=  130 fps=0.0 q=17.0 size=  122880kB time=00:01:17.00 bitrate=13073.1kbitsframe=  131 fps=0.0 q=17.0 size=  122880kB time=00:01:18.00 bitrate=12905.5kbitsframe=  133 fps=0.0 q=17.0 size=  122880kB time=00:01:20.00 bitrate=12582.9kbitsframe=  135 fps=0.0 q=17.0 size=  122880kB time=00:01:22.00 bitrate=12276.0kbitsframe=  135 fps=0.0 q=17.0 size=  122880kB time=00:01:22.00 bitrate=12276.0kbitsframe=  136 fps=0.0 q=17.0 size=  129280kB time=00:01:23.00 bitrate=12759.8kbitsframe=  137 fps=0.0 q=17.0 size=  129280kB time=00:01:24.00 bitrate=12607.9kbitsframe=  138 fps=0.0 q=17.0 size=  129280kB time=00:01:25.00 bitrate=12459.5kbitsframe=  140 fps=0.0 q=17.0 size=  136448kB time=00:01:27.00 bitrate=12848.1kbitsframe=  140 fps=0.0 q=17.0 size=  136448kB time=00:01:27.00 bitrate=12848.1kbitsframe=  141 fps=0.0 q=17.0 size=  136448kB time=00:01:28.00 bitrate=12702.1kbitsframe=  143 fps=0.0 q=17.0 size=  136448kB time=00:01:30.00 bitrate=12419.8kbitsframe=  145 fps=0.0 q=17.0 size=  143872kB time=00:01:32.00 bitrate=12810.9kbitsframe=  146 fps=0.0 q=17.0 size=  143872kB time=00:01:33.00 bitrate=12673.1kbitsframe=  148 fps=0.0 q=17.0 size=  151552kB time=00:01:35.00 bitrate=13068.6kbitsframe=  149 fps=0.0 q=17.0 size=  151552kB time=00:01:36.00 bitrate=12932.4kbitsframe=  150 fps=0.0 q=17.0 size=  151552kB time=00:01:37.00 bitrate=12799.1kbitsframe=  150 fps=0.0 q=17.0 size=  151552kB time=00:01:37.00 bitrate=12799.1kbitsframe=  151 fps=0.0 q=17.0 size=  151552kB time=00:01:38.00 bitrate=12668.5kbitsframe=  153 fps=0.0 q=17.0 size=  151552kB time=00:01:40.00 bitrate=12415.1kbitsframe=  155 fps=0.0 q=17.0 size=  151552kB time=00:01:42.00 bitrate=12171.7kbitsframe=  156 fps=0.0 q=17.0 size=  157952kB time=00:01:43.00 bitrate=12562.5kbitsframe=  157 fps=0.0 q=17.0 size=  157952kB time=00:01:44.00 bitrate=12441.8kbitsframe=  159 fps=0.0 q=17.0 size=  157952kB time=00:01:46.00 bitrate=12207.0kbitsframe=  160 fps=0.0 q=17.0 size=  164864kB time=00:01:47.00 bitrate=12622.1kbitsframe=  161 fps=0.0 q=17.0 size=  164864kB time=00:01:48.00 bitrate=12505.2kbitsframe=  163 fps=0.0 q=17.0 size=  164864kB time=00:01:50.00 bitrate=12277.9kbitsframe=  165 fps=0.0 q=17.0 size=  172288kB time=00:01:52.00 bitrate=12601.6kbitsframe=  166 fps=0.0 q=17.0 size=  172288kB time=00:01:53.00 bitrate=12490.1kbitsframe=  168 fps=0.0 q=17.0 size=  179968kB time=00:01:55.00 bitrate=12820.0kbitsframe=  169 fps=0.0 q=17.0 size=  179968kB time=00:01:56.00 bitrate=12709.5kbitsframe=  170 fps=0.0 q=17.0 size=  179968kB time=00:01:57.00 bitrate=12600.8kbitsframe=  171 fps=0.0 q=17.0 size=  179968kB time=00:01:58.00 bitrate=12494.0kbitsframe=  173 fps=0.0 q=17.0 size=  179968kB time=00:02:00.00 bitrate=12285.8kbitsframe=  175 fps=0.0 q=17.0 size=  179968kB time=00:02:02.00 bitrate=12084.4kbitsframe=  176 fps=0.0 q=17.0 size=  186368kB time=00:02:03.00 bitrate=12412.4kbitsframe=  176 fps=0.0 q=-1.0 Lsize=  254547kB time=00:02:53.00 bitrate=12053.5kbits/s speed=0.0344x
video:254543kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001571%
[libx264 @ 000000000017b220] frame I:1     Avg QP: 7.13  size:8716365
[libx264 @ 000000000017b220] frame P:44    Avg QP:10.34  size:5710783
[libx264 @ 000000000017b220] frame B:131   Avg QP:13.29  size:  5046
[libx264 @ 000000000017b220] consecutive B-frames:  0.6%  0.0%  1.7% 97.7%
[libx264 @ 000000000017b220] mb I  I16..4: 22.8% 68.7%  8.5%
[libx264 @ 000000000017b220] mb P  I16..4:  0.8% 44.9%  3.6%  P16..4:  4.9%  5.5%  3.1%  0.0%  0.0%    skip:37.1%
[libx264 @ 000000000017b220] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.6%  0.0%  0.0%  direct: 0.1%  skip:99.2%  L0:42.7% L1:55.9% BI: 1.5%
[libx264 @ 000000000017b220] 8x8 transform intra:90.1% inter:72.0%
[libx264 @ 000000000017b220] coded y,uvDC,uvAC intra: 96.9% 93.0% 90.5% inter: 3.6% 3.7% 3.6%
[libx264 @ 000000000017b220] i16 v,h,dc,p: 50% 15% 14% 21%
[libx264 @ 000000000017b220] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 29% 21%  4%  5%  4%  7%  5%  9%
[libx264 @ 000000000017b220] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 33% 11%  6%  9%  6%  9%  5%  8%
[libx264 @ 000000000017b220] i8c dc,h,v,p: 50% 29% 16%  5%
[libx264 @ 000000000017b220] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000017b220] ref P L0: 44.8% 21.7% 12.8% 20.8%
[libx264 @ 000000000017b220] ref B L0: 85.0% 14.0%  1.0%
[libx264 @ 000000000017b220] ref B L1: 98.0%  2.0%
[libx264 @ 000000000017b220] kb/s:11847.81

As can be seen:

it reported:

deprecated pixel format used, make sure you did set range correctly

what that means?

It is trying to process more than 36 frames, when we only have 36 frames.

Until frame 25, size is zero and bitrate is N/A and after frame 25, size became none zero.

It runs for several hundred images and then stops, but I can not play video.

After frame 47, FPS became zero.

I can not play back the output video.

How can I fix these problems and create a video from these frames?

Edit1

After getting some reply, I noted that h264 can not support the final resolution so I converted to use VP9 and I am using this command:

ffmpeg -i %1\frame%%05d.jpg -c:v libvpx-vp9 -b:v 2M -c:a libvorbis output.webm

I am getting the right number of frames, but I can not play the output using VLC.

Is there any player that can play this resolution?

Is there any way that I can check that the data in video is correct other than playing it? For example by extracting them into several images and view the images.


问:
when trigger enter it execute fast and return?
when i press the button everything fine but When press enter it's trigger the function and return fast on my browser, in the snippest it desapiar. i tried several ways to trigger the button when press enter but i get same issue

function calculate() {

      var response = document.getElementById("text").value;

    if (response ==0 || response =="" || response >100 || response < 0) {
        alert('you should write a 0<number<100');

    } else{

     var start = new Date();
     var date = start.getFullYear();

   var result = date - response;

    x.innerHTML = 'Your Birth is '+ result;
    document.getElementById('ma').style.color = 'lightpink';
    document.getElementById('ma').style.fontFamily = 'sans-serif';
    document.getElementById('ma').style.fontSize = "45px";

    } ;

};

var x= document.getElementById('ma');
document.getElementById("button").onclick = function(){calculate();};

   ```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    outline: none;
}
h1 {
     font-family: fresca;
    outline: none;
    font-size: 35px;
    color:cornflowerblue;

}
form {
    margin-top: 20em;
   outline: none;
}

#text{
    width: 35em;
    height: 3em;
    padding-left: 20px;
    border-radius: 5px;
    outline: none;

}
#text:focus {
    background: lightblue;
}
#button{
    width: 80;
    height: 3em;
    text-align: center;
    border-radius: 10px;
    border-style: none;
    background: lightblue;
outline: none;
}

#button:hover {
    background: lightgreen;

}</code>```

<link rel="stylesheet" type="text/css" href="css.css">
<link href="https://fonts.googleapis.com/css?family=Fresca" rel="stylesheet">

    <form>
        <input type="text" placeholder="Your Age" id="text" onkeypress="Javascript: if (event.keyCode==13) calculate();" >
        <input type="button" id="button" value="Calculate">
    </form>

Manaf

```

答:
```<code><h1 id="ma" >Manaf</h1>
</code>```

hello, as you are wrapping in a form thats why its trigger on enter

Body:
when i press the button everything fine but When press enter it's trigger the function and return fast on my browser, in the snippest it desapiar. i tried several ways to trigger the button when press enter but i get same issue

function calculate() {

      var response = document.getElementById("text").value;

    if (response ==0 || response =="" || response >100 || response < 0) {
        alert('you should write a 0<number<100');

    } else{

     var start = new Date();
     var date = start.getFullYear();

   var result = date - response;

    x.innerHTML = 'Your Birth is '+ result;
    document.getElementById('ma').style.color = 'lightpink';
    document.getElementById('ma').style.fontFamily = 'sans-serif';
    document.getElementById('ma').style.fontSize = "45px";

    } ;

};

var x= document.getElementById('ma');
document.getElementById("button").onclick = function(){calculate();};

body {
    outline: none;
}
h1 {
     font-family: fresca;
    outline: none;
    font-size: 35px;
    color:cornflowerblue;

}
form {
    margin-top: 20em;
   outline: none;
}

#text{
    width: 35em;
    height: 3em;
    padding-left: 20px;
    border-radius: 5px;
    outline: none;

}
#text:focus {
    background: lightblue;
}
#button{
    width: 80;
    height: 3em;
    text-align: center;
    border-radius: 10px;
    border-style: none;
    background: lightblue;
outline: none;
}

#button:hover {
    background: lightgreen;

}

<link rel="stylesheet" type="text/css" href="css.css">
<link href="https://fonts.googleapis.com/css?family=Fresca" rel="stylesheet">

    <form>
        <input type="text" placeholder="Your Age" id="text" onkeypress="Javascript: if (event.keyCode==13) calculate();" >
        <input type="button" id="button" value="Calculate">
    </form>

Manaf

Body:
<h1 id="ma" >Manaf</h1>

hello, as you are wrapping in a form thats why its trigger on enter


问:
Is there a way to create AWS Dashboard using cloudformation or AWS CLI
I wanted to create an AWS Dashboard using cloudformation but did find a way.
Guess AWS has not yet added support for that.

As an alternative is it possible to create that using AWS CLI

答:
AWS just announced support for this.

https://aws.amazon.com/blogs/aws/new-api-cloudformation-support-for-amazon-cloudwatch-dashboards/

CloudFormation documentation is also available: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-dashboard.html


问:
how to continuously watch for scope variable until update
In angular.js there is $watch to watch the scoped variables for updates. but is there anything that I can do, such as execute a function until the variable gets updated</p>

答:
watch until value change</p>

```<code>var watchVar = $scope.$watch('value', function(newValue , oldValue){
  if(newValue!=oldValue){
  //value changed remove watch
  watchVar();
 }
});
</code>```

Body:
watch until value change

var watchVar = $scope.$watch('value', function(newValue , oldValue){
  if(newValue!=oldValue){
  //value changed remove watch
  watchVar();
 }
});


问:
Passing Array to model function query codeigniter
Here is my function I want to put array values in IN() clause but it is not working

    Here $ids is the array passing to it.

```<code>    function get_school_students_data($ids){
    $query=$this->db->query("SELECT * FROM screening_answers where uid
    IN(".implode(',',$ids).")");
    $result=$query->result_array();
     return $query->num_rows();
    }
</code>```

答:
Try this its work for me
//For Simple/Random Search

```<code> function search($designation){
        $this->db->select("*");
        foreach($designation as $single_data) $this->db->or_like("designation",$single_data);
        $this->db->order_by('rand()');
        $this->db->limit(100);
        $this->db->from('content');
        $query = $this->db->get();
        return $query->result();
    }
</code>```

Body:
Here is my function I want to put array values in IN() clause but it is not working

    Here $ids is the array passing to it.

    function get_school_students_data($ids){
    $query=$this->db->query("SELECT * FROM screening_answers where uid
    IN(".implode(',',$ids).")");
    $result=$query->result_array();
     return $query->num_rows();
    }

Body:
Try this its work for me
//For Simple/Random Search

 function search($designation){
        $this->db->select("*");
        foreach($designation as $single_data) $this->db->or_like("designation",$single_data);
        $this->db->order_by('rand()');
        $this->db->limit(100);
        $this->db->from('content');
        $query = $this->db->get();
        return $query->result();
    }


问:
How can I select the minimum price per item from my database?
I want to select minimum price per item from my MySQL database, but I'm not sure how to write the query.

Here is an example table.

```<code>  id |  price | quantity
    1|   $200 |      200
    2|  $1000 |       10
    3|     $5 |        1
</code>```

In this case the price/item for id 1 would be $1 (200/200), for id 2 it's $100 (1000/10), for id 3 it's $5 (5/1) and the query would return $1, because it is the minimum price/item.

So how can it be translated to SQL? I thought about:

```<code>SELECT MIN(price)/200 WHERE quantity=200
</code>```

but it only works with a hard coded quantity and I must write the quantity for each id and would be impossible with 1000+ different prices and quantities. So I would need something flexible with variables or something, like:

```<code>SELECT MIN(price)/quantity
</code>```

but that's not correct syntax. (or it just doesn't work for me)

What is the correct way to write it in MySQL?

答:
I think this does what you want:

```<code>select min(price / quantity)
from t;
</code>```

If you want all the information in the row, then use order by and limit:

```<code>select t.*, (price / quantity) as unit_price
from t
order by unit_price asc
limit 1;
</code>```

Body:
I want to select minimum price per item from my MySQL database, but I'm not sure how to write the query.

Here is an example table.

  id |  price | quantity
    1|   $200 |      200
    2|  $1000 |       10
    3|     $5 |        1

In this case the price/item for id 1 would be $1 (200/200), for id 2 it's $100 (1000/10), for id 3 it's $5 (5/1) and the query would return $1, because it is the minimum price/item.

So how can it be translated to SQL? I thought about:

SELECT MIN(price)/200 WHERE quantity=200

but it only works with a hard coded quantity and I must write the quantity for each id and would be impossible with 1000+ different prices and quantities. So I would need something flexible with variables or something, like:

SELECT MIN(price)/quantity

but that's not correct syntax. (or it just doesn't work for me)

What is the correct way to write it in MySQL?

Body:
I think this does what you want:

select min(price / quantity)
from t;

If you want all the information in the row, then use order by and limit:

select t.*, (price / quantity) as unit_price
from t
order by unit_price asc
limit 1;


问:
How should I debug a Nokogiri Null Pointer exception?
A contractor created a fairly complex XSLT for a client of mine.  It works great in various transform testing tools, using real data from our application.   But Nokogiri barfs on it during transform.  With $VERBOSE and $DEBUG set, I still get the uninformative:

```<code>Exception `RuntimeError' at nokogiri/XsltStylesheet.java:231 - java.lang.NullPointerException
</code>```

So I thought I would create a custom Nokogiri Gem with some debug code in it, using this in my Gemfile:

```<code>gem 'nokogiri', :git => 'ssh://git@192.168.185.65:7999/bssc/nokogiri.git'
</code>```

That doesn't work because of a versioning issue I don't understand how to resolve:

```<code>Source does not contain any versions of 'nokogiri java'
</code>```

So at this point I thought I'd reach out and ask the community for a better idea.  I'm sure it's something in the stylesheet that Nokogiri is not happy with, but it is difficult to locate because of the complexity of the XSLT.

Suggestions?

答:
... have done some Java native ext lifting with Nokogiri (performance/cleanup updates in 1.7/1.8)

it depends whether you have a trace that points to a reasonable location or not, try jruby -Xbacktrace.style=raw ... if that does not reveal valuable insight you might need to get into building the gem yourself (there's a rake task for it just make sure you're doing it under JRuby).

you can not use Bundler with :git since the .gemspec is generated depending on the Ruby platform, thus you will need to build and manually gem install (adjust the version and set it with Bundler so you know which one you're using).

good luck!

Body:
A contractor created a fairly complex XSLT for a client of mine.  It works great in various transform testing tools, using real data from our application.   But Nokogiri barfs on it during transform.  With $VERBOSE and $DEBUG set, I still get the uninformative:

Exception `RuntimeError' at nokogiri/XsltStylesheet.java:231 - java.lang.NullPointerException

So I thought I would create a custom Nokogiri Gem with some debug code in it, using this in my Gemfile:

gem 'nokogiri', :git => 'ssh://git@192.168.185.65:7999/bssc/nokogiri.git'

That doesn't work because of a versioning issue I don't understand how to resolve:

Source does not contain any versions of 'nokogiri java'

So at this point I thought I'd reach out and ask the community for a better idea.  I'm sure it's something in the stylesheet that Nokogiri is not happy with, but it is difficult to locate because of the complexity of the XSLT.

Suggestions?


问:
Why is this Perl script using the File::Tail module not working?
I'm working on a simple Perl script to monitor a log file using the File::Tail module, but I can't seem to get the module working properly.

The idea is to use it over IRC, but this didn't seem to work so after tinkering with the interactive interpreter I've narrowed the problem down to File::Tail. I've cut it down the following basic example to monitor the file and nothing happens at all when new entries are appended to the file:

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

use strict;

use File::Tail;

my $file = File::Tail->new("/var/log/apache2/error.log");

while(defined(my $line = $file->read))
{
    print "$line\n";
}
</code>```

Can anyone suggest what the problem might be? I've gone through the perldoc entry and this is virtually copied from there so I can't really see that I've made any glaring errors. I'm running Ubuntu Lucid.

答:
I've just realised that I've been a complete tool...

It works perfectly - I just didn't leave it long enough before hitting Ctrl-C. D'oh! Oh well, lesson learned! Thanks for your help anyway!

ContentLicense: CC BY-SA 2.5

Body:
I'm working on a simple Perl script to monitor a log file using the File::Tail module, but I can't seem to get the module working properly.

The idea is to use it over IRC, but this didn't seem to work so after tinkering with the interactive interpreter I've narrowed the problem down to File::Tail. I've cut it down the following basic example to monitor the file and nothing happens at all when new entries are appended to the file:

#!/usr/bin/perl -w

use strict;

use File::Tail;

my $file = File::Tail->new("/var/log/apache2/error.log");

while(defined(my $line = $file->read))
{
    print "$line\n";
}

Can anyone suggest what the problem might be? I've gone through the perldoc entry and this is virtually copied from there so I can't really see that I've made any glaring errors. I'm running Ubuntu Lucid.


问:
Django cascade update by foreign key
I have a five models with a is_delete field in a each model.

What a right way cascade set this property is_delete for each child model if I set it in a parent model?

I know that Django have  ON_CASCADE property field for DELETE method.
But have the same method for UPDATE?

I know about signals but may be another way?

Thanks  a lot.

答:
You could add your own methods for your models.

I haven't tested this, but it could look like this :

```<code>class FooModel(models.Model):

    ...

    def alt_delete(self):
        for e in self.tracking_entries:
            e.alt_delete()
        self.is_delete = True
        self.save()

class BarModel(models.Model):

    ...
    foo = models.ForeignKey(FooModel, related_name="tracking_entries")

    def alt_delete(self):
        self.is_delete = True
        self.save()
</code>```

Title: Django cascade update by foreign key

Body:
You could add your own methods for your models.

I haven't tested this, but it could look like this :

class FooModel(models.Model):

    ...

    def alt_delete(self):
        for e in self.tracking_entries:
            e.alt_delete()
        self.is_delete = True
        self.save()

class BarModel(models.Model):

    ...
    foo = models.ForeignKey(FooModel, related_name="tracking_entries")

    def alt_delete(self):
        self.is_delete = True
        self.save()


问:
Is there any limit on the number of repositories in Gerrit?
I am trying to find out if there are any limits on the number of repositories we can create in Gerrit ?</p>

答: There's no limit on the number of Gerrit repositories. Take a look at the Gerrit Scaling Documentation to get more info about this.</p>


问:
Converting the result of Func<T, IConvertible> to int in a lambda expression
I am abstracting a bit of code, and ran into an issue with casting the result of a Func to an integer for comparison.

I have a function:

```<code>public static IConvertible GetIllnessRateByParity(IEnumerable<ILLNESS_OBJECT> pItems, int pParity, Func<ILLNESS_OBJECT, IConvertible> pSelector)
    {
        var filtered = pItems.Where(a => a.Parity == pParity);
        return Math.Round(filtered.Count(a => Convert.ToInt32(pSelector(a)) == 1) / (double)GetBirthCountByParity(pItems, pParity), 2);
    }

public class ILLNESS_OBJECT
{
    public int ID { get; set; }
    public DateTime Day { get; set; }
    public int Parity { get; set; }
    public int Afterbirth { get; set; }
    public int OvaryInfection { get; set; }
    etc...
}
</code>```

Which calculates the rate of a specific illness within a set of data. The illness to be analysed is input through a selector, which selects an IConvertible value from the ILLNESS_OBJECT object.

I call the method like this:

```<code>GetIllnessRateByParity(data, 1, a => a.AfterBirth)
</code>```

data is an IEnumerable with non-null values.

The method throws an InvalidCastException at the Convert.ToInt32(pSelector(a)) part without clear indication of why this cast fails, could anyone explain it to me? I am under the impression that pSelector(a) returns an IConvertible value which is cast-compatible with int, right? Any help would be greatly appreciated!

EDIT: Exception message:
An exception of type 'System.InvalidCastException' occurred in CONFIDENTIAL.CLASS.dll but was not handled in user code

Message: Specified cast is not valid.

答:
The last parameter is called pSelector, but it's not actually a selector.

It's just returning a value (int, float...), and the actual selection is being done by the labmda in the Count method:

```<code>filtered.Count(a => Convert.ToInt32(pSelector(a)) == 1)
</code>```

So pSelector is going to return a value of some data type, and then you're relying on being able to convert that to an int32.

But you only need to do that to compare it to 1. Given the info in your question, you don't really need an int32, you need a bool.

So what if you refactor pSelector to be a selector, by moving the comparison to 1 inside the selector:

```<code>public static double GetIllnessRateByParity(IEnumerable<ILLNESS_OBJECT> pItems, int pParity, Func<ILLNESS_OBJECT, bool> pSelector)
{
    var filtered = pItems.Where(a => a.Parity == pParity);
    return Math.Round(filtered.Count(pSelector) / (double)GetBirthCountByParity(pItems, pParity), 2);
}
GetIllnessRateByParity(data, 1, a => a.AfterBirth==1)
</code>```

Body:
I am abstracting a bit of code, and ran into an issue with casting the result of a Func to an integer for comparison.

I have a function:

public static IConvertible GetIllnessRateByParity(IEnumerable<ILLNESS_OBJECT> pItems, int pParity, Func<ILLNESS_OBJECT, IConvertible> pSelector)
    {
        var filtered = pItems.Where(a => a.Parity == pParity);
        return Math.Round(filtered.Count(a => Convert.ToInt32(pSelector(a)) == 1) / (double)GetBirthCountByParity(pItems, pParity), 2);
    }

public class ILLNESS_OBJECT
{
    public int ID { get; set; }
    public DateTime Day { get; set; }
    public int Parity { get; set; }
    public int Afterbirth { get; set; }
    public int OvaryInfection { get; set; }
    etc...
}

Which calculates the rate of a specific illness within a set of data. The illness to be analysed is input through a selector, which selects an IConvertible value from the ILLNESS_OBJECT object.

I call the method like this:

GetIllnessRateByParity(data, 1, a => a.AfterBirth)

data is an IEnumerable with non-null values.

The method throws an InvalidCastException at the Convert.ToInt32(pSelector(a)) part without clear indication of why this cast fails, could anyone explain it to me? I am under the impression that pSelector(a) returns an IConvertible value which is cast-compatible with int, right? Any help would be greatly appreciated!

EDIT: Exception message:
An exception of type 'System.InvalidCastException' occurred in CONFIDENTIAL.CLASS.dll but was not handled in user code

Message: Specified cast is not valid.

Body:
The last parameter is called pSelector, but it's not actually a selector.

It's just returning a value (int, float...), and the actual selection is being done by the labmda in the Count method:

filtered.Count(a => Convert.ToInt32(pSelector(a)) == 1)

So pSelector is going to return a value of some data type, and then you're relying on being able to convert that to an int32.

But you only need to do that to compare it to 1. Given the info in your question, you don't really need an int32, you need a bool.

So what if you refactor pSelector to be a selector, by moving the comparison to 1 inside the selector:

public static double GetIllnessRateByParity(IEnumerable<ILLNESS_OBJECT> pItems, int pParity, Func<ILLNESS_OBJECT, bool> pSelector)
{
    var filtered = pItems.Where(a => a.Parity == pParity);
    return Math.Round(filtered.Count(pSelector) / (double)GetBirthCountByParity(pItems, pParity), 2);
}
GetIllnessRateByParity(data, 1, a => a.AfterBirth==1)


问:
Adding css to the front-end via plugin and variable
Ok, I'm not really sure how to do this so maybe someone can help me out.

I am trying to create a function in my plugin that calls CSS to be used on the front-end of the site.  Sounds simple... but there's a catch.

Rather than calling a CSS file, I want to be able to call a PHP file that outputs the CSS styles from the database (plugin saved variable)..

For example... the standard method:

```<code><?php

function register_style(){
    wp_register_style( 'front_stylesheet', plugins_url( '/css/custom.css', __FILE__ ) );
    wp_enqueue_style( 'front_stylesheet' );
}
add_action( 'enqueue_scripts', 'register_style' );

?>
</code>```

but I know I can't simply change "/css/rs.css" to the PHP file path. So how would I refer to that PHP file instead?

The PHP file is basically just a simple page that obtains the CSS styles from the database and outputs that content "without the STYLE tags because the tags are already echoed.

Any help would be appreciated.

答:
You can add the file as normal using the register_style method as you said and have the path as "/css/custom.php", and in the top of your custom.php file that generates the css, add:

```<code>header("Content-type: text/css");
</code>```

This has to be the first line of the file with no whitespace before it.

Body:
Ok, I'm not really sure how to do this so maybe someone can help me out.

I am trying to create a function in my plugin that calls CSS to be used on the front-end of the site.  Sounds simple... but there's a catch.

Rather than calling a CSS file, I want to be able to call a PHP file that outputs the CSS styles from the database (plugin saved variable)..

For example... the standard method:

<?php

function register_style(){
    wp_register_style( 'front_stylesheet', plugins_url( '/css/custom.css', __FILE__ ) );
    wp_enqueue_style( 'front_stylesheet' );
}
add_action( 'enqueue_scripts', 'register_style' );

?>

but I know I can't simply change "/css/rs.css" to the PHP file path. So how would I refer to that PHP file instead?

The PHP file is basically just a simple page that obtains the CSS styles from the database and outputs that content "without the STYLE tags because the tags are already echoed.

Any help would be appreciated.

Body:
You can add the file as normal using the register_style method as you said and have the path as "/css/custom.php", and in the top of your custom.php file that generates the css, add:

header("Content-type: text/css");

This has to be the first line of the file with no whitespace before it.


问:
Architectural and design question about uploading photos from iPhone app and S3
I want to allow users of an iPhone app to upload photos and use Amazon S3.  There are 2 ways I see going about this:

Upload from iPhone to my server, which proxies it then to Amazon S3.

Upload from iPhone direct to S3

For option 1, the security is straightforward. I don't ever have to tell the iPhone my S3 secret. Downside is that everything is proxied through our server for uploads which sort of defeats the purpose of going to S3.

For option 2, in theory it's better but the issue is how do you enable the iPhone (or any mobile app on a different platform) to write into my S3 bucket without giving it my secret?  Additionally, I'm not sure if this is a good design or not because the flow would be: iphone uploads to S3, gets the URL, then tells the server what the URL is so it can add it to our database to reference in the future. However, since the communication is separated into 2 legs (iphone->S3 vs iPhone->My-Server) it leaves it fragile as a non-atomic operation.

I've found some older info that references using Browser-based Uploads using POST but unsure if that is still the recommended approach. I'm hoping for a better solution where we can just use the REST APIs rather than relying on POST.  I've also see the AWS iOS Beta SDK, but their docs didn't help much and I found an Amazon article that was equally unhelpful as it cautions you on what not to do, but doesn't tell you an alternative approach:

The mobile AWS SDKs sign the API
  requests sent to Amazon Web Services
  (AWS) in order to validate the
  identity of the AWS account making the
  request. Otherwise, a malicious
  developer could easily make requests
  to another developer's infrastructure.
  The requests are signed using an AWS
  Access Key ID and a Secret Access Key
  that AWS provides. The Secret Access
  Key is similar to a password, and it
  is extremely important to keep secret.

Tip: You can view all your AWS
  security credentials, including Access
  Key ID and Secret Access Key, on the
  AWS web site at
  http://aws.amazon.com/security-credentials.

Embedding credentials in source code
  is problematic for software, including
  mobile applications, because malicious
  users can de-compile the software or
  view the source code to retrieve the
  Secret Access Key.

Does anyone have any advice on the best architectural design and flow for this?

Update: The more I dig into this, it seems that a bunch of pople recommend using the HTTP POST method with the json policy file as described here: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?UsingHTTPPOST.html.

With this, the flow would be something like (1) iPhone makes request to my server, asking for policy file (2) server generates json policy file and gives back to client (3) iPhone does HTTP POST of photo + json policy to S3.  I hate that I'm using HTTP POST in an apparently kludgy way but it appears to be better because it removes the need for my server to store the photo at all.

答:
I've discussed this issue on the AWS forums before. As I say there, the proper solution for accessing AWS from a mobile device is to use the AWS Identity and Access Management service to generate temporary, limited-privilege access keys for each user. The service is great, but it's still in beta for now and it's not part of the mobile SDK yet. I have a feeling once this thing is released for good, you'll see it out on the mobile SDK immediately afterwards.

Until then, generate presigned URLs for your users, or proxy through your own server like some others have suggested. The presigned URL will allow your users to temporarily GET or PUT to an S3 object in one of your buckets without actually having your credentials (they are hashed into the signature). You can read about the details here.

EDIT: I've implemented a proper solution for this problem, using the preview beta of IAM. It's available on GitHub, and you can read about it here.


问:
How to make changes in Jenkins "Global configuration" page? (page is read-only)
I am running an instance of Jenkins (I have all privileges), and trying to create and add a shared library of Groovy Pipeline code.  There seems to be a way to do this through the UI by clicking the "Global Configuration" found on the left-hand side of the root Jenkins page.  (This is not the "Manage Jenkins" link - that link works just fine.)

When I click on "Global Configuration", there are all sorts of things it appears I can configure, but every item seems to be disabled.  When I type in the description box, no characters appear.  When I check a checkbox, it doesn't changed to checked.  The "Add" button way way down in "Global Pipeline Libraries" (in fact, all of the buttons) is disabled and cannot be pressed.

I'm sure I'm missing something terribly obvious, but I just can't find it.  Any ideas why the global configuration page would be read-only for a Jenkins administrator?

答:
The link on the main Jenkins page for "Global configuration" appears to bring up a page identical to the page accessed from "Manage Jenkins" -> "Configure system" (very first link!).

When accessed via "Global configuration" it is read-only.

When accessed via "Manage Jenkins" -> "configure system" it can be edited.

Two days of head-scratching, and I only figure it out AFTER I save the question here.  At least, I hope this head-scratching exercise helps somebody else!


问:
React Router 4 / path-to-regexp multiple optional segments
In React router 3 I could have path like this:

```<code>/root(/id/:id)(/di/:di)
</code>```

That would match

```<code>/root
/root/id/1
/root/di/2
/root/id/1/di/2
</code>```

Perfect.

I can't figure out how to do it in React Router 4. All examples are doing only one thing.

Using Express Route tester I can come up with a route like

```<code>/root/id/:id?/di/:di?
</code>```

But that would match only

```<code>/root/id/1/di/2
</code>```

Is there a solution for this?

答:
Here's how I did it in the end, it's a litte bit ridiculous but it works:</p>

```<code>  <Route
    path="/root/:firstKey?/:firstId?/:secondKey?/:secondId?"
    render={({ match: { params: { firstKey, secondKey, firstId, secondId } } }) => {
      const params = { [firstKey]: firstId, [secondKey]: secondId }
      return (<Whatever {...params} />)
    }}
  />
</code>```

Body:
In React router 3 I could have path like this:

/root(/id/:id)(/di/:di)

That would match

/root
/root/id/1
/root/di/2
/root/id/1/di/2

Perfect.

I can't figure out how to do it in React Router 4. All examples are doing only one thing.

Using Express Route tester I can come up with a route like

/root/id/:id?/di/:di?

But that would match only

/root/id/1/di/2

Is there a solution for this?

Body:
Here's how I did it in the end, it's a litte bit ridiculous but it works:

  <Route
    path="/root/:firstKey?/:firstId?/:secondKey?/:secondId?"
    render={({ match: { params: { firstKey, secondKey, firstId, secondId } } }) => {
      const params = { [firstKey]: firstId, [secondKey]: secondId }
      return (<Whatever {...params} />)
    }}
  />


问:
How can I remove the commas in a numeric value in R?
```<code>column19 <- 19
mdf[,column19] <- lapply(mdf[,column19],function(x){as.numeric(gsub(",", "", x))})
</code>```

this snippet works but also results in duplicate values

答:
If there is only a single column, we don't need lapply

```<code>mdf[, column19] <- as.numeric(gsub(",", "", mdf[, column19], fixed = TRUE))
</code>```

The reason why the OP's code didn't work out as expected is because lapply on a single column after converting it to a vector (mdf[, column19]) and loop through each of the single element of the column and return a list.  Now, we are assigning the output of list back to that single column

```<code>column19 <- 19
mdf[,column19] <- lapply(mdf[,column19],function(x) as.numeric(gsub(",", "", x)))
</code>```

Warning message: In [<-.data.frame(*tmp*, , column19, value =
  list(27, 49, 510,  :   provided 5 variables to replace 1 variables

Instead, if we want to use the same procedure either keep the data.frame structure by mdf[column19] or mdf[, column19, drop = FALSE] and then loop using lapply.  In this way, it will be a list with a single vector

```<code>mdf[column19] <- lapply(mdf[column19],function(x) as.numeric(gsub(",", "", x)))
</code>```

This is more related to dropping of dimensions when using [ on a single column or row as by default it is drop = TRUE.

data

```<code>set.seed(24)
mdf <- as.data.frame(matrix(sample(paste(1:5, 6:10, sep=","),
   5*20, replace = TRUE), 5, 20), stringsAsFactors=FALSE)
</code>```

Body:
column19 <- 19
mdf[,column19] <- lapply(mdf[,column19],function(x){as.numeric(gsub(",", "", x))})

this snippet works but also results in duplicate values

Body:
If there is only a single column, we don't need lapply

mdf[, column19] <- as.numeric(gsub(",", "", mdf[, column19], fixed = TRUE))

The reason why the OP's code didn't work out as expected is because lapply on a single column after converting it to a vector (mdf[, column19]) and loop through each of the single element of the column and return a list.  Now, we are assigning the output of list back to that single column

column19 <- 19
mdf[,column19] <- lapply(mdf[,column19],function(x) as.numeric(gsub(",", "", x)))

Warning message: In [<-.data.frame(*tmp*, , column19, value =
  list(27, 49, 510,  :   provided 5 variables to replace 1 variables

Instead, if we want to use the same procedure either keep the data.frame structure by mdf[column19] or mdf[, column19, drop = FALSE] and then loop using lapply.  In this way, it will be a list with a single vector

mdf[column19] <- lapply(mdf[column19],function(x) as.numeric(gsub(",", "", x)))

This is more related to dropping of dimensions when using [ on a single column or row as by default it is drop = TRUE.

data

set.seed(24)
mdf <- as.data.frame(matrix(sample(paste(1:5, 6:10, sep=","),
   5*20, replace = TRUE), 5, 20), stringsAsFactors=FALSE)


问:
How to get current language code with Swift?
I want get the language code of the device (en, es...) in my app written with Swift. How can get this?

I'm trying this:

```<code>var preferredLanguages : NSLocale!
let pre = preferredLanguages.displayNameForKey(NSLocaleIdentifier, value: preferredLanguages)
</code>```

But this returns nil.

答:
swift 3

```<code>let preferredLanguage = Locale.preferredLanguages[0] as String
print (preferredLanguage) //en-US

let arr = preferredLanguage.components(separatedBy: "-")
let deviceLanguage = arr.first
print (deviceLanguage) //en
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I want get the language code of the device (en, es...) in my app written with Swift. How can get this?

I'm trying this:

var preferredLanguages : NSLocale!
let pre = preferredLanguages.displayNameForKey(NSLocaleIdentifier, value: preferredLanguages)

But this returns nil.

Body:
swift 3

let preferredLanguage = Locale.preferredLanguages[0] as String
print (preferredLanguage) //en-US

let arr = preferredLanguage.components(separatedBy: "-")
let deviceLanguage = arr.first
print (deviceLanguage) //en


问:
how compile SynEdit in Delphi 7?
I tried to load and use 'SynEdit_D7.dpk' and 'SynEdit_R7.dpk' in Delphi 7 to install but following error raised:

```<code>[Fatal Error] SynEditHighlighter.pas(57): File not found: 'SynEditHighlighterOptions.dcu'
</code>```

I did:

downloaded SynEdit-2_0_8.zip

Extracted somewhere and opened Delphi 7.

Loaded SynEdit_D7.dpk.

Clicked on install.

Received error.

答:
I have the same problem with Delphi 2007 and I am very sure that this is a bug in SynEdit. They most likely forgot to add "SynEditHighlighterOptions.pas" to the DPKs of the earlier Delphi versions. Separately adding it to the runtime package solves the problem. No need to change the search path just for 1 unit.

If you have a SourceForge account, I would be glad if you could create a bug report for it.

Title: how compile SynEdit in Delphi 7?

Body:
I tried to load and use 'SynEdit_D7.dpk' and 'SynEdit_R7.dpk' in Delphi 7 to install but following error raised:

[Fatal Error] SynEditHighlighter.pas(57): File not found: 'SynEditHighlighterOptions.dcu'

I did:

downloaded SynEdit-2_0_8.zip

Extracted somewhere and opened Delphi 7.

Loaded SynEdit_D7.dpk.

Clicked on install.

Received error.


问:
Flexbox overflow issue in Firefox
I'm getting stuck on a test project using flexbox. The goal is to build a dashboard with some lists of cards inside, side-by-side with infinite overflowing.

I managed to do just that, the problem is: each one those lists have a header, a card list and a footer inside, and the lists height can't exceed the parent available height. If that happen, the list must only apply overflow on the card list.

On chrome it works just fine, but on firefox... It seems the renderer can't handle the possibility of the content overflowing that way! I'm getting really mad with this one.

Example:

The code (also on Plunker)

// Code goes here
(function (angular) {
  angular.module("app", []);

  angular.module("app").controller("AppController", AppController);

  AppController.$inject = ["$scope"];

  function AppController($scope) {
    var ctrl = this;
    ctrl.addCard = function (list) {
      list.cards.push({title: "Card " + (list.cards.length + 1)});
    };
    ctrl.lists = [
      {
        title: "List 1",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      },
      {
        title: "List 2",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"},
          {title: "Card 6"},
          {title: "Card 7"},
          {title: "Card 8"},
          {title: "Card 9"},
          {title: "Card 10"},
          {title: "Card 11"},
          {title: "Card 12"},
          {title: "Card 13"},
          {title: "Card 14"},
          {title: "Card 15"},
          {title: "Card 16"},
          {title: "Card 17"},
          {title: "Card 18"},
          {title: "Card 19"},
          {title: "Card 20"}
        ]
      },
      {
        title: "List 3",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      },
      {
        title: "List 4",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      },
      {
        title: "List 5",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      }
    ];
  }
}(angular))```
<pre class="snippet-code-css lang-css prettyprint-override"><code>html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
}

.container {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  float: column;
  height: 100%;
  margin: 0;
  max-height: 100%;
  max-width: 100%;
  padding: 0;
  width: 100%;
}

.container .container-head {
  background: red;
  padding: 10px;
  -webkit-flex-grow: 0;
  -moz-flex-grow: 0;
  flex-grow: 0;
}

.container .container-head .header-title {
  margin: 0;
  padding: 0;
}

.container .container-body {
  background: green;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  -webkit-flex-grow: 1;
  -moz-flex-grow: 1;
  flex-grow: 1;
  padding: 5px;
}

.container .container-body .view {
  background: blue;
  box-sizing: border-box;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  float: left;
  overflow-x: auto;
  padding: 0;
  -webkit-flex-grow: 1;
  -moz-flex-grow: 1;
  flex-grow: 1;
}

.container .container-body .view .list-block {
  box-sizing: border-box;
  background: darkblue;
  display: inline-block;
  flex: 0 0 auto;
  float: left;
  margin: 0;
  padding: 5px;
  width: 280px;
  min-height:0;
}

.container .container-body .view .list-block .list {
  background: darkorange;
  border-radius: 4px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  float: left;
  max-height: 100%;
  margin: 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.container .container-body .view .list-block .list .list-header {
  background: orange;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-bottom: 1px solid darkorange;
  -webkit-flex-grow: 0 0 auto;
  -moz-flex-grow: 0 0 auto;
  flex-grow: 0 0 auto;
  float: left;
  height: auto;
  padding: 10px;
}

.container .container-body .view .list-block .list .list-cards {
  background: orange;
  border-bottom: 1px solid darkorange;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  float: left;
  max-height: 100%;
  overflow-y: auto;
  padding: 5px;
}

.container .container-body .view .list-block .list .list-cards .card {
  background: #ffc107;
  border-radius: 4px;
  float: left;
  margin: 5px;
  padding: 10px;
}

.container .container-body .view .list-block .list .list-cards .card:hover {
  background: #fdc002;
}

.container .container-body .view .list-block .list .list-footer {
  background: orange;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  -webkit-flex-grow: 0;
  -moz-flex-grow: 0;
  flex-grow: 0;
  height: auto;
  padding: 10px;
  float: left;
  text-align: center;
}</code>```

<!DOCTYPE html>

    <meta charset="utf-8" />
    <title></title>

    <link rel="stylesheet" href="./style.css" />

Flexbox

{{list.title}}

                  {{card.title}}

                  Add Card

```

On Chrome (Everything working)

On Firefox (Doesn't apply the vertical overflow control correctly)

Hope you guys can help me out.

答:
Just put min-height: 0; to .container-body this will fix your issue

```<code>.container .container-body {
  min-height: 0;
}
</code>```

See this answer for more details

Title: Flexbox overflow issue in Firefox

Body:
I'm getting stuck on a test project using flexbox. The goal is to build a dashboard with some lists of cards inside, side-by-side with infinite overflowing.

I managed to do just that, the problem is: each one those lists have a header, a card list and a footer inside, and the lists height can't exceed the parent available height. If that happen, the list must only apply overflow on the card list.

On chrome it works just fine, but on firefox... It seems the renderer can't handle the possibility of the content overflowing that way! I'm getting really mad with this one.

Example:

The code (also on Plunker)

// Code goes here
(function (angular) {
  angular.module("app", []);

  angular.module("app").controller("AppController", AppController);

  AppController.$inject = ["$scope"];

  function AppController($scope) {
    var ctrl = this;
    ctrl.addCard = function (list) {
      list.cards.push({title: "Card " + (list.cards.length + 1)});
    };
    ctrl.lists = [
      {
        title: "List 1",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      },
      {
        title: "List 2",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"},
          {title: "Card 6"},
          {title: "Card 7"},
          {title: "Card 8"},
          {title: "Card 9"},
          {title: "Card 10"},
          {title: "Card 11"},
          {title: "Card 12"},
          {title: "Card 13"},
          {title: "Card 14"},
          {title: "Card 15"},
          {title: "Card 16"},
          {title: "Card 17"},
          {title: "Card 18"},
          {title: "Card 19"},
          {title: "Card 20"}
        ]
      },
      {
        title: "List 3",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      },
      {
        title: "List 4",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      },
      {
        title: "List 5",
        cards: [
          {title: "Card 1"},
          {title: "Card 2"},
          {title: "Card 3"},
          {title: "Card 4"},
          {title: "Card 5"}
        ]
      }
    ];
  }
}(angular))

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
}

.container {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  float: column;
  height: 100%;
  margin: 0;
  max-height: 100%;
  max-width: 100%;
  padding: 0;
  width: 100%;
}

.container .container-head {
  background: red;
  padding: 10px;
  -webkit-flex-grow: 0;
  -moz-flex-grow: 0;
  flex-grow: 0;
}

.container .container-head .header-title {
  margin: 0;
  padding: 0;
}

.container .container-body {
  background: green;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  -webkit-flex-grow: 1;
  -moz-flex-grow: 1;
  flex-grow: 1;
  padding: 5px;
}

.container .container-body .view {
  background: blue;
  box-sizing: border-box;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  float: left;
  overflow-x: auto;
  padding: 0;
  -webkit-flex-grow: 1;
  -moz-flex-grow: 1;
  flex-grow: 1;
}

.container .container-body .view .list-block {
  box-sizing: border-box;
  background: darkblue;
  display: inline-block;
  flex: 0 0 auto;
  float: left;
  margin: 0;
  padding: 5px;
  width: 280px;
  min-height:0;
}

.container .container-body .view .list-block .list {
  background: darkorange;
  border-radius: 4px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  float: left;
  max-height: 100%;
  margin: 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.container .container-body .view .list-block .list .list-header {
  background: orange;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-bottom: 1px solid darkorange;
  -webkit-flex-grow: 0 0 auto;
  -moz-flex-grow: 0 0 auto;
  flex-grow: 0 0 auto;
  float: left;
  height: auto;
  padding: 10px;
}

.container .container-body .view .list-block .list .list-cards {
  background: orange;
  border-bottom: 1px solid darkorange;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  flex-direction: column;
  float: left;
  max-height: 100%;
  overflow-y: auto;
  padding: 5px;
}

.container .container-body .view .list-block .list .list-cards .card {
  background: #ffc107;
  border-radius: 4px;
  float: left;
  margin: 5px;
  padding: 10px;
}

.container .container-body .view .list-block .list .list-cards .card:hover {
  background: #fdc002;
}

.container .container-body .view .list-block .list .list-footer {
  background: orange;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  -webkit-flex-grow: 0;
  -moz-flex-grow: 0;
  flex-grow: 0;
  height: auto;
  padding: 10px;
  float: left;
  text-align: center;
}

<!DOCTYPE html>

    <meta charset="utf-8" />
    <title></title>

    <link rel="stylesheet" href="./style.css" />

Flexbox

{{list.title}}

                  {{card.title}}

                  Add Card

On Chrome (Everything working)

On Firefox (Doesn't apply the vertical overflow control correctly)

Hope you guys can help me out.

Body:
Just put min-height: 0; to .container-body this will fix your issue

.container .container-body {
  min-height: 0;
}

See this answer for more details