问:
How to read a truncated image with OpenCV?
cv2.imread returns None for the following image.

When I preview the image on MacOS, I just see a blank rectangular, but I can see the image on Chrome.

When I check with PIL by reading the image and saving it back to another file, it complains that the image is truncated.

I know that I can config PIL to accept "truncated" images, is there any way I can tell OpenCV that I know this is a truncated image, but please just try to read it.

答:
I don't know of a way to do that in OpenCV. You can, however, re-write the image first with ImageMagick (which is installed on most Linux distros and is available for macOS and Windows).

That would be this command in the Terminal:

```<code>magick broken.png fixed.png
</code>```

If @GlennRandersPehrson or someone familiar with PNG felt like having a look to see what is wrong with your file, here is the debug output:

```2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: utility.c/ExpandFilenames/943/Configure
  Command line: convert {-debug} {all} {blank.png} {a.png}
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/Users/mark/.config/ImageMagick/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: coder.c/LoadCoderCache/829/Configure
  Loading coder configuration file "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/coder.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1265/Module
  Searching for module "PNG" using filename "png.la"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/GetMagickModulePath/560/Module
  Searching for coder module file "png.la" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1274/Module
  Opening module at path "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//modules-Q16HDRI/coders/png.la"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1301/Module
  Method "RegisterPNGImage" in module "PNG" at address 0x108ebfed4
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1315/Module
  Method "UnregisterPNGImage" in module "PNG" at address 0x108ec9db2
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/Users/mark/.config/ImageMagick/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: magic.c/LoadMagicCache/853/Configure
  Loading magic configure file "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/magic.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Path; rights=Read; pattern="blank.png" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Blob convert[83500]: blob.c/OpenBlob/2986/Blob
    read 3 magic header bytes
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/DestroyPixelCache/960/Cache
  destroy
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Coder; rights=Read; pattern="PNG" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4348/Coder
  Enter ReadPNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Path; rights=Read; pattern="blank.png" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Blob convert[83500]: blob.c/OpenBlob/2986/Blob
    read 3 magic header bytes
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2401/Coder
    Enter ReadOnePNGImage()
    IM version     = 7.0.5-4
    Libpng version = 1.6.29
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2414/Coder
      Zlib version   = 1.2.8
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2446/Coder
      Before reading:
      image->alpha_trait=0      image->rendering_intent=2
      image->colorspace=23
      image->gamma=0.454545
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2735/Coder
      PNG width: 200, height: 200
    PNG color_type: 6, bit_depth: 8
    PNG compression_method: 0
    PNG interlace_method: 0, filter_method: 0
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3005/Coder
      Setting sRGB as if in input
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3321/Coder
      image->colorspace=23
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3494/Coder
      Reading PNG IDAT chunk(s)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Width: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Height: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/SetPixelChannelMask/6274/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6164/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    0: red (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    1: green (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    2: blue (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Area: 480KB/480KB/68.719GB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 480KB/469KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/OpenPixelCache/3562/Cache
  open blank.png[0] (Heap Memory, 200x200x3 469KiB)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 800B/470KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3512/Coder
      Converting PNG pixels to pixel packets
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Width: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Height: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/SetPixelChannelMask/6274/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6164/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    0: red (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    1: green (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    2: blue (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    3: alpha (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Area: 640KB/640KB/68.719GB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 640KB/1.069MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/ClonePixelCacheRepository/759/Cache
  Memory => Memory
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 480KB/626KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/OpenPixelCache/3562/Cache
  open blank.png[0] (Heap Memory, 200x200x4 625KiB)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3586/Coder
      Looking for cheap transparent pixel
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/MagickPNGWarningHandler/1704/Coder
    libpng-1.6.29 warning: Expected 8192 bytes; found 8067 bytes
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/Users/mark/.config/ImageMagick/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: locale.c/LoadLocaleCache/1181/Configure
  Loading locale configure file "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/locale.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/Users/mark/.config/ImageMagick/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: locale.c/LoadLocaleCache/1181/Configure
  Loading locale configure file "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/english.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Exception convert[83500]: png.c/MagickPNGWarningHandler/1707/Exception
  Expected 8192 bytes; found 8067 bytes `blank.png'
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/MagickPNGErrorHandler/1671/Coder
    libpng-1.6.29 error: Read Exception
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Exception convert[83500]: png.c/MagickPNGErrorHandler/1674/Exception
  Read Exception `blank.png'
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 800B/625KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2526/Coder
    exit ReadOnePNGImage() with error.
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4427/Coder
    page.w: 0, page.h: 0,page.x: 0, page.y: 0.
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4431/Coder
    image->colorspace: 23
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4436/Coder
  exit ReadPNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Exception convert[83500]: constitute.c/ReadImage/572/Exception
  Coder (PNG) generated an image despite an error (450), notify the developers
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Coder; rights=Write; pattern="PNG" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WritePNGImage/12090/Coder
  Enter WritePNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WritePNGImage/12685/Coder
    Chunks to be excluded from the output png:
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8428/Coder
    Enter WriteOnePNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8461/Coder
      IM version     = 7.0.5-4
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8463/Coder
      Libpng version = 1.6.29
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8470/Coder
      Zlib version   = 1.2.8
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8644/Coder
      image->storage_class=DirectClass
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8649/Coder
      image->taint=MagickFalse
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8901/Coder
      Enter BUILD_PALETTE:
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8906/Coder
        image->columns=200
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8908/Coder
        image->rows=200
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8910/Coder
        image->alpha_trait=4
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8912/Coder
        image->depth=8
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8948/Coder
        image->colors=0
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8952/Coder
          (zero means unknown)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8956/Coder
        Regenerate the colormap
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Width: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Height: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/SetPixelChannelMask/6274/Pixel
  a.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6164/Pixel
  a.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    0: red (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    1: green (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    2: blue (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    3: alpha (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Area: 640KB/640KB/68.719GB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 640KB/1.221MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/OpenPixelCache/3562/Cache
  open a.png[0] (Heap Memory, 200x200x4 625KiB)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9070/Coder
        Check colormap for background (65535,65535,65535)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9096/Coder
        No room in the colormap to add background color
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9105/Coder
        image has more than 256 colors
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9299/Coder
        image->colors=0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9323/Coder
        number_transparent     = 1
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9337/Coder
        number_opaque          > 256
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9341/Coder
        number_semitransparent = 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9358/Coder
        At least one pixel or the background is non-gray
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9361/Coder
      Exit BUILD_PALETTE:
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9733/Coder
     Cheap transparency is possible.
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9894/Coder
      width=200
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9896/Coder
      height=200
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9898/Coder
      image_matte=4
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9900/Coder
      image->depth=8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9902/Coder
      Tentative ping_bit_depth=8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9987/Coder
      Setting up bKGD chunk (1)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9989/Coder
        background_color index is 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9993/Coder
      ping_bit_depth=8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10131/Coder
    Selecting PNG colortype:
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10189/Coder
      Selected PNG colortype=6
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10226/Coder
      Number of colors: 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10229/Coder
      Tentative PNG bit depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10241/Coder
      Tentative PNG color type: RGB+Alpha (6)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10246/Coder
      image_info->type: 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10249/Coder
      image_depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10252/Coder
      image->depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10256/Coder
      ping_bit_depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10660/Coder
      PNG color type: RGB+Alpha (6)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10668/Coder
    Setting up deflate compression
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10671/Coder
      Compression buffer size: 32768
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10678/Coder
      Compression mem level: 9
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10757/Coder
      Compression level:    7
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10766/Coder
    Setting up filtering
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10770/Coder
      Base filter method: ADAPTIVE
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10905/Coder
    Writing PNG header chunks
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11046/Coder
    Setting up gAMA chunk
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11074/Coder
    Setting up cHRM chunk
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11090/Coder
      Setting up bKGD chunk
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11092/Coder
        background color = (255,255,255)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11097/Coder
        index = 0, gray=255
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Path; rights=Write; pattern="a.png" ...
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11304/Coder
    Writing PNG image data
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11307/Coder
      Allocating 800 bytes of memory for pixels
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 800B/1.221MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11511/Coder
      Writing row of pixels (3)
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11608/Coder
    Wrote PNG image data
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11611/Coder
      Width: 200
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11614/Coder
      Height: 200
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11623/Coder
      PNG bit-depth written: 8
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11632/Coder
      PNG color-type written: 6
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11635/Coder
      PNG Interlace method: 0
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11697/Coder
    Setting up text chunk
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11700/Coder
      keyword: 'date:create'
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11697/Coder
    Setting up text chunk
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11700/Coder
      keyword: 'date:modify'
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11815/Coder
    Writing PNG end info
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 800B/1.221MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Cache convert[83500]: cache.c/DestroyPixelCache/960/Cache
  destroy a.png[0]
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 640KB/625KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11883/Coder
    exit WriteOnePNGImage()
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WritePNGImage/12753/Coder
  exit WritePNGImage()
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Cache convert[83500]: cache.c/DestroyPixelCache/960/Cache
  destroy blank.png[0]
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 640KB/0B/32GiB
convert: Expected 8192 bytes; found 8067 bytes `blank.png' @ warning/png.c/MagickPNGWarningHandler/1707.
convert: Read Exception `blank.png' @ error/png.c/MagickPNGErrorHandler/1674.
```

Body:
I don't know of a way to do that in OpenCV. You can, however, re-write the image first with ImageMagick (which is installed on most Linux distros and is available for macOS and Windows).

That would be this command in the Terminal:

magick broken.png fixed.png

If @GlennRandersPehrson or someone familiar with PNG felt like having a look to see what is wrong with your file, here is the debug output:

2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: utility.c/ExpandFilenames/943/Configure
  Command line: convert {-debug} {all} {blank.png} {a.png}
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/Users/mark/.config/ImageMagick/coder.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: coder.c/LoadCoderCache/829/Configure
  Loading coder configuration file "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/coder.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1265/Module
  Searching for module "PNG" using filename "png.la"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/GetMagickModulePath/560/Module
  Searching for coder module file "png.la" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1274/Module
  Opening module at path "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//modules-Q16HDRI/coders/png.la"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1301/Module
  Method "RegisterPNGImage" in module "PNG" at address 0x108ebfed4
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Module convert[83500]: module.c/OpenModule/1315/Module
  Method "UnregisterPNGImage" in module "PNG" at address 0x108ec9db2
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: configure.c/GetConfigureOptions/688/Configure
  Searching for configure file: "/Users/mark/.config/ImageMagick/magic.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: magic.c/LoadMagicCache/853/Configure
  Loading magic configure file "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/magic.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Path; rights=Read; pattern="blank.png" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Blob convert[83500]: blob.c/OpenBlob/2986/Blob
    read 3 magic header bytes
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/DestroyPixelCache/960/Cache
  destroy
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Coder; rights=Read; pattern="PNG" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4348/Coder
  Enter ReadPNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Path; rights=Read; pattern="blank.png" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Blob convert[83500]: blob.c/OpenBlob/2986/Blob
    read 3 magic header bytes
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2401/Coder
    Enter ReadOnePNGImage()
    IM version     = 7.0.5-4
    Libpng version = 1.6.29
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2414/Coder
      Zlib version   = 1.2.8
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2446/Coder
      Before reading:
      image->alpha_trait=0      image->rendering_intent=2
      image->colorspace=23
      image->gamma=0.454545
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2735/Coder
      PNG width: 200, height: 200
    PNG color_type: 6, bit_depth: 8
    PNG compression_method: 0
    PNG interlace_method: 0, filter_method: 0
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3005/Coder
      Setting sRGB as if in input
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3321/Coder
      image->colorspace=23
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3494/Coder
      Reading PNG IDAT chunk(s)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Width: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Height: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/SetPixelChannelMask/6274/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6164/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    0: red (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    1: green (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    2: blue (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Area: 480KB/480KB/68.719GB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 480KB/469KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/OpenPixelCache/3562/Cache
  open blank.png[0] (Heap Memory, 200x200x3 469KiB)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 800B/470KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3512/Coder
      Converting PNG pixels to pixel packets
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Width: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Height: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/SetPixelChannelMask/6274/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6164/Pixel
  blank.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    0: red (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    1: green (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    2: blue (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    3: alpha (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Area: 640KB/640KB/68.719GB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 640KB/1.069MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/ClonePixelCacheRepository/759/Cache
  Memory => Memory
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 480KB/626KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/OpenPixelCache/3562/Cache
  open blank.png[0] (Heap Memory, 200x200x4 625KiB)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/3586/Coder
      Looking for cheap transparent pixel
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/MagickPNGWarningHandler/1704/Coder
    libpng-1.6.29 warning: Expected 8192 bytes; found 8067 bytes
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/Users/mark/.config/ImageMagick/locale.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: locale.c/LoadLocaleCache/1181/Configure
  Loading locale configure file "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/locale.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/lib/ImageMagick//config-Q16HDRI/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/etc/ImageMagick-7/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/usr/local/Cellar/imagemagick/7.0.5-4/share/doc/ImageMagick-7/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Locale convert[83500]: locale.c/GetLocaleOptions/829/Locale
  Searching for locale file: "/Users/mark/.config/ImageMagick/english.xml"
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Configure convert[83500]: locale.c/LoadLocaleCache/1181/Configure
  Loading locale configure file "/usr/local/Cellar/imagemagick/7.0.5-4/share/ImageMagick-7/english.xml" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Exception convert[83500]: png.c/MagickPNGWarningHandler/1707/Exception
  Expected 8192 bytes; found 8067 bytes `blank.png'
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/MagickPNGErrorHandler/1671/Coder
    libpng-1.6.29 error: Read Exception
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Exception convert[83500]: png.c/MagickPNGErrorHandler/1674/Exception
  Read Exception `blank.png'
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 800B/625KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadOnePNGImage/2526/Coder
    exit ReadOnePNGImage() with error.
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4427/Coder
    page.w: 0, page.h: 0,page.x: 0, page.y: 0.
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4431/Coder
    image->colorspace: 23
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/ReadPNGImage/4436/Coder
  exit ReadPNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Exception convert[83500]: constitute.c/ReadImage/572/Exception
  Coder (PNG) generated an image despite an error (450), notify the developers
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Coder; rights=Write; pattern="PNG" ...
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WritePNGImage/12090/Coder
  Enter WritePNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WritePNGImage/12685/Coder
    Chunks to be excluded from the output png:
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8428/Coder
    Enter WriteOnePNGImage()
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8461/Coder
      IM version     = 7.0.5-4
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8463/Coder
      Libpng version = 1.6.29
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8470/Coder
      Zlib version   = 1.2.8
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8644/Coder
      image->storage_class=DirectClass
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8649/Coder
      image->taint=MagickFalse
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8901/Coder
      Enter BUILD_PALETTE:
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8906/Coder
        image->columns=200
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8908/Coder
        image->rows=200
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8910/Coder
        image->alpha_trait=4
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8912/Coder
        image->depth=8
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8948/Coder
        image->colors=0
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8952/Coder
          (zero means unknown)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/8956/Coder
        Regenerate the colormap
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Width: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Height: 200B/0P/107.4MP
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/SetPixelChannelMask/6274/Pixel
  a.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6164/Pixel
  a.png[07ffffff]
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    0: red (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    1: green (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    2: blue (update,blend)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Pixel convert[83500]: pixel.c/LogPixelChannels/6255/Pixel
    3: alpha (update)
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Area: 640KB/640KB/68.719GB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 640KB/1.221MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.000 0.000u 7.0.5 Cache convert[83500]: cache.c/OpenPixelCache/3562/Cache
  open a.png[0] (Heap Memory, 200x200x4 625KiB)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9070/Coder
        Check colormap for background (65535,65535,65535)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9096/Coder
        No room in the colormap to add background color
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9105/Coder
        image has more than 256 colors
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9299/Coder
        image->colors=0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9323/Coder
        number_transparent     = 1
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9337/Coder
        number_opaque          > 256
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9341/Coder
        number_semitransparent = 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9358/Coder
        At least one pixel or the background is non-gray
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9361/Coder
      Exit BUILD_PALETTE:
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9733/Coder
     Cheap transparency is possible.
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9894/Coder
      width=200
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9896/Coder
      height=200
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9898/Coder
      image_matte=4
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9900/Coder
      image->depth=8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9902/Coder
      Tentative ping_bit_depth=8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9987/Coder
      Setting up bKGD chunk (1)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9989/Coder
        background_color index is 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/9993/Coder
      ping_bit_depth=8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10131/Coder
    Selecting PNG colortype:
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10189/Coder
      Selected PNG colortype=6
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10226/Coder
      Number of colors: 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10229/Coder
      Tentative PNG bit depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10241/Coder
      Tentative PNG color type: RGB+Alpha (6)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10246/Coder
      image_info->type: 0
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10249/Coder
      image_depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10252/Coder
      image->depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10256/Coder
      ping_bit_depth: 8
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10660/Coder
      PNG color type: RGB+Alpha (6)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10668/Coder
    Setting up deflate compression
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10671/Coder
      Compression buffer size: 32768
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10678/Coder
      Compression mem level: 9
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10757/Coder
      Compression level:    7
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10766/Coder
    Setting up filtering
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10770/Coder
      Base filter method: ADAPTIVE
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/10905/Coder
    Writing PNG header chunks
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11046/Coder
    Setting up gAMA chunk
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11074/Coder
    Setting up cHRM chunk
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11090/Coder
      Setting up bKGD chunk
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11092/Coder
        background color = (255,255,255)
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11097/Coder
        index = 0, gray=255
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Policy convert[83500]: policy.c/IsRightsAuthorized/601/Policy
  Domain: Path; rights=Write; pattern="a.png" ...
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11304/Coder
    Writing PNG image data
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11307/Coder
      Allocating 800 bytes of memory for pixels
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Resource convert[83500]: resource.c/AcquireMagickResource/319/Resource
  Memory: 800B/1.221MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.010 0.000u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11511/Coder
      Writing row of pixels (3)
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11608/Coder
    Wrote PNG image data
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11611/Coder
      Width: 200
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11614/Coder
      Height: 200
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11623/Coder
      PNG bit-depth written: 8
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11632/Coder
      PNG color-type written: 6
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11635/Coder
      PNG Interlace method: 0
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11697/Coder
    Setting up text chunk
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11700/Coder
      keyword: 'date:create'
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11697/Coder
    Setting up text chunk
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11700/Coder
      keyword: 'date:modify'
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11815/Coder
    Writing PNG end info
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 800B/1.221MiB/32GiB
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Cache convert[83500]: cache.c/DestroyPixelCache/960/Cache
  destroy a.png[0]
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 640KB/625KiB/32GiB
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WriteOnePNGImage/11883/Coder
    exit WriteOnePNGImage()
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Coder convert[83500]: png.c/WritePNGImage/12753/Coder
  exit WritePNGImage()
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Cache convert[83500]: cache.c/DestroyPixelCache/960/Cache
  destroy blank.png[0]
2017-03-31T08:45:37+01:00 0:00.020 0.020u 7.0.5 Resource convert[83500]: resource.c/RelinquishMagickResource/968/Resource
  Memory: 640KB/0B/32GiB
convert: Expected 8192 bytes; found 8067 bytes `blank.png' @ warning/png.c/MagickPNGWarningHandler/1707.
convert: Read Exception `blank.png' @ error/png.c/MagickPNGErrorHandler/1674.


来源: stackexchange

问:
Opencart add custom page in admin folder getting error Page Not Found
Am creating a custom page called no.tpl in admin folder. It used for No-Order for selected customer.

In view/template/sale/order_list.tpl
Am creating a link for No Order page.

```<code><a href="<?php echo $no; ?>" data-toggle="tooltip" title="No Order" class="btn btn-primary"><i class="fa fa-ban"></i> No Order</a>
</code>```

And i called this link in controller/sale/order.php

```<code>$data['no'] = $this->url->link('sale/order/no', 'token=' . $this->session->data['token'], 'SSL');
</code>```

Then am creating a no.tpl file in view/template/sale/. That code is following

```<code><?php echo $header; ?><?php echo $column_left; ?>
/*
some content here
*/
</code>```

And finally and creating a controller this is the path controller/sale/no.php
And that page code following

```<code>class ControllerSaleNo extends Controller {
    private $error = array();
    public function index() {

           $data=$this->request->post;
           $customerId=$data['customer_id'];

        $this->sendMail($customerId);

        $data['column_left'] = $this->load->controller('common/column_left');
        $data['column_right'] = $this->load->controller('common/column_right');
        $data['content_top'] = $this->load->controller('common/content_top');
        $data['content_bottom'] = $this->load->controller('common/content_bottom');
        $data['footer'] = $this->load->controller('common/footer');
        $data['header'] = $this->load->controller('common/header');

        $this->response->setOutput($this->load->view('default/template/product/no.tpl', $data));

        }
}
</code>```

But am getting error link

Page Not Found!
  The page you are looking for could not be found! Please contact your administrator if the problem persists.

How can i clear this error and where i did mistake

Thank You in advance.

答:
Your link wants to access to no function in order controller:

```<code>$data['no'] = $this->url->link('sale/order/no', 'token=' . $this->session->data['token'], 'SSL');
</code>```

change it to:

```<code>$data['no'] = $this->url->link('sale/no', 'token=' . $this->session->data['token'], 'SSL');
</code>```

PS: your controller/sale/no.php has some errors, you must fix Them.

ContentLicense: CC BY-SA 3.0

Body:
Am creating a custom page called no.tpl in admin folder. It used for No-Order for selected customer.

In view/template/sale/order_list.tpl
Am creating a link for No Order page.

<a href="<?php echo $no; ?>" data-toggle="tooltip" title="No Order" class="btn btn-primary"> No Order

And i called this link in controller/sale/order.php

$data['no'] = $this->url->link('sale/order/no', 'token=' . $this->session->data['token'], 'SSL');

Then am creating a no.tpl file in view/template/sale/. That code is following

<?php echo $header; ?><?php echo $column_left; ?>
/*
some content here
*/

And finally and creating a controller this is the path controller/sale/no.php
And that page code following

class ControllerSaleNo extends Controller {
    private $error = array();
    public function index() {

           $data=$this->request->post;
           $customerId=$data['customer_id'];

        $this->sendMail($customerId);

        $data['column_left'] = $this->load->controller('common/column_left');
        $data['column_right'] = $this->load->controller('common/column_right');
        $data['content_top'] = $this->load->controller('common/content_top');
        $data['content_bottom'] = $this->load->controller('common/content_bottom');
        $data['footer'] = $this->load->controller('common/footer');
        $data['header'] = $this->load->controller('common/header');

        $this->response->setOutput($this->load->view('default/template/product/no.tpl', $data));

        }
}

But am getting error link

Page Not Found!
  The page you are looking for could not be found! Please contact your administrator if the problem persists.

How can i clear this error and where i did mistake

Thank You in advance.

Body:
Your link wants to access to no function in order controller:

$data['no'] = $this->url->link('sale/order/no', 'token=' . $this->session->data['token'], 'SSL');

change it to:

$data['no'] = $this->url->link('sale/no', 'token=' . $this->session->data['token'], 'SSL');

PS: your controller/sale/no.php has some errors, you must fix Them.


问:
Setting margin on view in RelativeLayout programmatically doesn't have any affect
In Android, I create an ImageView in the Java code and set its layout parameters: width, height and top margin before adding it to the main layout (RelativeLayout). The width and height are applied successfully, but the margin doesn't have any affect on the image view position. The actual top margin stays 0.

How to apply the top margin to views? The code is below.

```<code>public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initClouds();
    }

    private void initClouds() {
        addCloud(R.drawable.cloud1, R.dimen.cloud1_top_margin);
        addCloud(R.drawable.cloud2, R.dimen.cloud2_top_margin);
    }

    private void addCloud(int imageResId, int topMarginResId) {
        RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.mainLayout);

        ImageView cloud = new ImageView(this);
        int height = (int) getResources().getDimension(R.dimen.cloud_height);
        int width = (int) getResources().getDimension(R.dimen.cloud_width);
        ViewGroup.MarginLayoutParams params = new ViewGroup.MarginLayoutParams(width, height);
        params.topMargin = (int) getResources().getDimension(topMarginResId);
        cloud.setImageResource(imageResId);
        mainLayout.addView(cloud, params);
    }
}
</code>```

答:
For setting the margin for a view inside RelativeLayout you should use RelativeLayout.LayoutParams . Change your code like this , </p>

```<code>private void addCloud(int imageResId, int topMarginResId) {
        RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.mainLayout);

        ImageView cloud = new ImageView(this);
        int height = (int) getResources().getDimension(R.dimen.cloud_height);
        int width = (int) getResources().getDimension(R.dimen.cloud_width);
        RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(width, height);
        param.topMargin = (int) getResources().getDimension(topMarginResId);

        cloud.setImageResource(imageResId);
        mainLayout.addView(cloud, param);
    }
</code>```

Body:
In Android, I create an ImageView in the Java code and set its layout parameters: width, height and top margin before adding it to the main layout (RelativeLayout). The width and height are applied successfully, but the margin doesn't have any affect on the image view position. The actual top margin stays 0.

How to apply the top margin to views? The code is below.

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initClouds();
    }

    private void initClouds() {
        addCloud(R.drawable.cloud1, R.dimen.cloud1_top_margin);
        addCloud(R.drawable.cloud2, R.dimen.cloud2_top_margin);
    }

    private void addCloud(int imageResId, int topMarginResId) {
        RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.mainLayout);

        ImageView cloud = new ImageView(this);
        int height = (int) getResources().getDimension(R.dimen.cloud_height);
        int width = (int) getResources().getDimension(R.dimen.cloud_width);
        ViewGroup.MarginLayoutParams params = new ViewGroup.MarginLayoutParams(width, height);
        params.topMargin = (int) getResources().getDimension(topMarginResId);
        cloud.setImageResource(imageResId);
        mainLayout.addView(cloud, params);
    }
}

Body:
For setting the margin for a view inside RelativeLayout you should use RelativeLayout.LayoutParams . Change your code like this ,

private void addCloud(int imageResId, int topMarginResId) {
        RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.mainLayout);

        ImageView cloud = new ImageView(this);
        int height = (int) getResources().getDimension(R.dimen.cloud_height);
        int width = (int) getResources().getDimension(R.dimen.cloud_width);
        RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(width, height);
        param.topMargin = (int) getResources().getDimension(topMarginResId);

        cloud.setImageResource(imageResId);
        mainLayout.addView(cloud, param);
    }


问:
Scenario: Global variables in DLL which is used by Multi-threaded Application
Few months back, I had come across this interesting scenario asked by a guy (on orkut). Though, I've come up with a "non-portable" solution to this problem (have tested it with small code), but still would like to know what you guys have to say and suggest.

Suppose, I created a DLL, exporting some functionalities, written in C++, for single threaded client. This DLL declares lots of global variables, some maybe const variables (read-only) and others are modifiable.

Anyway, later things changed and now I want the same DLL to work with multi-threaded application (without modifying the DLL); that means, several threads access the functions and global variables from the DLL, and modify them.. and so on. All these may cause global variables to hold inconsistent values.

So the question is,

Can we do something in the client code to prevent multi-access of the DLL, and at the same time, ensuring that each thread runs in it's own context (meaning, when it gets access to the DLL, the DLL's global values are same as it was before)?

答:
Sure, you can always create a wrapper-layer handling multi-threading specific tasks such as locking. You could even do so in a second DLL that links with the original one, and then have the final project link with that new DLL.

Be aware that no matter how you implement it, this won't be an easy task. You have to know exactly which thread is able to modify which value at what time, who is able to read what and when etc. unless you want to run into problems like deadlocks or race conditions.

If you're solution allows it, it's often best to assign a single thread to modify any data, and have all others just read and never write, as concurrent reading access is always easier to implement than concurrent writing access (Boost provides all basic functionality to do so, for example shared_mutex).

ContentLicense: CC BY-SA 2.5


问:
Training a convolutional neural network by layer-wise
Are there approaches to train a convolutional neural network by layer-wise(Instead of end-to-end), to understand how each layer contributes to the final architecture performance?  </p>

答: You can freeze every other layer and only train one layer at a time. After each epoch/iteration you can freez other layers and only train one other layer. So this is possible.</p>


问:
query with order by and where does not work
I am trying to get visit_no using below query:

```<code>String strNumber = "SELECT visit_no from tracking order by id DESC limit 1 where c_no = '" + string1 + "' ";
Log.d("strNumber:", strNumber);
</code>```

Whenever, I run above query getting same query in a log, not the actual visit_no because, later I need to use same visit_no in below query see visit_no = strNumber.

```<code>db.execSQL("update csv set visit_no = strNumber where c_no = '" + string1 + "' ");
</code>```

So here is the complete method, where I have written everything

```<code>public void checkingRecord(String string1) {

  SQLiteDatabase db = this.getWritableDatabase();

  String strNumber = "SELECT visit_no from tracking order by id DESC limit 1 where c_no = '" + string1 + "' ";
  // db.execSQL(strNumber);

  db.execSQL("update csv set visit_no = strNumber where c_no = '" + string1 + "' ");

  db.close();

}
</code>```

答:
```<code>public int checkingRecord(String string1) {
        int visit_no = 0;
        String selectQuery = "SELECT visit_no from tracking order by id DESC limit 1 where c_no = '" + string1 + "' ";

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor c = db.rawQuery(selectQuery, null);

        if (c != null && c.moveToFirst()) {
            visit_no = c.getInt(c.getColumnIndex(KEY_COMPANY_ID));
            c.close();
        }

        db.close();

        return visit_no;
    }
</code>```

After that:

```<code>public int updateRecord(int visit_no, String string1) {

        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put("visit_no", visit_no);

        // Which row to update, based on the ID
        String whereClause = c_no + " = ? ";
        String[] whereArgs = {String.valueOf(string1)};

        int affectedRows = db.update(
                TABLE_NAME,
                values,
                whereClause,
                whereArgs
        );

        return affectedRows;
    }
</code>```

In your activity:

```<code>DatabaseHelper databaseHelper = new DatabaseHelper(YourActivity.this);

int visit_no = databaseHelper.checkingRecord();

int update_row = databaseHelper.updateRecord(visit_no, string1);
</code>```

Body:
I am trying to get visit_no using below query:

String strNumber = "SELECT visit_no from tracking order by id DESC limit 1 where c_no = '" + string1 + "' ";
Log.d("strNumber:", strNumber);

Whenever, I run above query getting same query in a log, not the actual visit_no because, later I need to use same visit_no in below query see visit_no = strNumber.

db.execSQL("update csv set visit_no = strNumber where c_no = '" + string1 + "' ");

So here is the complete method, where I have written everything

public void checkingRecord(String string1) {

  SQLiteDatabase db = this.getWritableDatabase();

  String strNumber = "SELECT visit_no from tracking order by id DESC limit 1 where c_no = '" + string1 + "' ";
  // db.execSQL(strNumber);

  db.execSQL("update csv set visit_no = strNumber where c_no = '" + string1 + "' ");

  db.close();

}

Body:
public int checkingRecord(String string1) {
        int visit_no = 0;
        String selectQuery = "SELECT visit_no from tracking order by id DESC limit 1 where c_no = '" + string1 + "' ";

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor c = db.rawQuery(selectQuery, null);

        if (c != null && c.moveToFirst()) {
            visit_no = c.getInt(c.getColumnIndex(KEY_COMPANY_ID));
            c.close();
        }

        db.close();

        return visit_no;
    }

After that:

public int updateRecord(int visit_no, String string1) {

        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put("visit_no", visit_no);

        // Which row to update, based on the ID
        String whereClause = c_no + " = ? ";
        String[] whereArgs = {String.valueOf(string1)};

        int affectedRows = db.update(
                TABLE_NAME,
                values,
                whereClause,
                whereArgs
        );

        return affectedRows;
    }

In your activity:

DatabaseHelper databaseHelper = new DatabaseHelper(YourActivity.this);

int visit_no = databaseHelper.checkingRecord();

int update_row = databaseHelper.updateRecord(visit_no, string1);


问:
Uncaught TypeError: all Spaces need to be clear for https?
I am creating a website with https: .
It always showing errors for all spaces within tags (in chrome developer console).

If I clear a space showing in error, it again points to the new line that containing a space/break/enter between every tags whenever I try to clear the error message.

I know it wants me to clear all the spaces between each of html tags, that unnecessary. But how can I remove for the whole thousands code containing website, text replacing is not also OK for attribute's spaces.

How can I escape that error catch. Thank you so much.

error line 239 is moved to line 236 for clearing spaces in this picture.

If I clear spaces in line 236 :It moved to 235

```<code><div class="android-drawer mdl-layout__drawer">
    <span class="mdl-layout-title">
      <img class="android-logo-image" src="images/text.png">
    </span>
    <nav class="mdl-navigation">
        <a class="mdl-navigation__link"><b style="color:black;align:center;">Your abc</b></a>
 <!--     <a class="mdl-navigation__link" href="">Tablets</a>
      <div class="android-drawer-separator"></div>
      <span class="mdl-navigation__link" href="">Versions</span>
      <a class="mdl-navigation__link" href="">Lollipop 5.0</a> -->
    </nav></div><div class="android-content mdl-layout__content" style="overflow:hidden;"><a name="top"></a><div class="android-be-together-section mdl-typography--text-center"><div class="logo-font android-slogan ">
</code>```

Please help me .

答:
I think you are looking at it the wrong way.
The error clearly says

```<code>'cannot read property addEventListener of null'
</code>```

SOLUTION 1:

This  means that you are trying to add an evenLisener on a dom object which is not present. Please look at you javascript code which is adding even listener to a null object.

SOLUTION 2:

If you are not adding any event listeners and still the error is coming then some of your library is causing this problem. Please load the libraries after the html is loaded. That may help you debug and find which library is causing the problem.

Body:
I am creating a website with https: .
It always showing errors for all spaces within tags (in chrome developer console).

If I clear a space showing in error, it again points to the new line that containing a space/break/enter between every tags whenever I try to clear the error message.

I know it wants me to clear all the spaces between each of html tags, that unnecessary. But how can I remove for the whole thousands code containing website, text replacing is not also OK for attribute's spaces.

How can I escape that error catch. Thank you so much.

error line 239 is moved to line 236 for clearing spaces in this picture.

If I clear spaces in line 236 :It moved to 235

        Your abc

Please help me .

Body:
I think you are looking at it the wrong way.
The error clearly says

'cannot read property addEventListener of null'

SOLUTION 1:

This  means that you are trying to add an evenLisener on a dom object which is not present. Please look at you javascript code which is adding even listener to a null object.

SOLUTION 2:

If you are not adding any event listeners and still the error is coming then some of your library is causing this problem. Please load the libraries after the html is loaded. That may help you debug and find which library is causing the problem.


问:
Linux - unzip file in place
I need to download VM image provided in zip. Zip is 10 gb, unpacked VM image around 16gb and I have around 20gb space on disk. Is it possible to unzip downloaded file "in-place"?</p>

答: Here user Adam described how to mount zip file using virtual filesystem and unzip file to Your local filesystem.</p>

Title: Linux - unzip file in place


问:
Comparing big files
So I've got really big .bin files with bytes written in them. They have 96-bit numbers written in them as two's complement numbers (still no ASCII, only bytes). Now I have to write an assembly program to sort the numbers in this files and save it to another file (don't ask why, assembly class). I've done it for a file with 32k numbers, like this:

```<code>./main < inSort32Kx96b.bin > XD.bin
diff outSort32Kx96b.bin XD.bin
</code>```

The file outSort32Kx96b.bin is given to me by my teacher. So now diff doesn't output anything, they are identical (I can check that with hexdump or mcview). But I got another file inSort1Kx96b.bin. And I also sort it. But then diff says:

```<code>Binary files outSort1Kx96b.bin and XD.bin differ
</code>```

@Edit:

cmp gave the number of byte where those 2 files differ. Now I can see the difference:

So the difference appears from 0x000017C0. Then I don't know now. If they are written as two's complement numbers in little endian order, then which one is bigger, f.e

```<code>00 00 00 00  00 00 00 81  00 00 00 00
</code>```

or

```<code>00 00 00 00  00 00 00 7F  00 00 00 00
</code>```

?

答:
A hexdump shows you the single bytes in big endian order. If a bunch of bytes have to be interpreted as a number, only the byte order is reversed.

```<code>little endian                           big endian (C notation)
AB CD EF                              = 0xEFCDAB
01 02 03 04  05 06 07 08  09 10 11 12 = 0x121110090807060504030201
</code>```

Let's translate your examples to big endian order:

```<code>0x000000008100000000000000
0x000000007F00000000000000
</code>```

You can see that the first number is bigger.

"Two's complement number" is not a very clear expression. Better is "signed integer". The sign which shows whether the number is positive or negativ, is the very first bit of the number. This bit can be found at the begginning of a big endian number and the end of a little endian number.

Positive:

```<code>00 00 00 00  00 00 00 81  00 00 00 00 = 0x000000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 10 = 0x100000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 7F = 0x7F0000008100000000000000
</code>```

Negativ:

```<code>00 00 00 00  00 00 00 81  00 00 00 80 = 0x800000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 CD = 0xCD0000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 F0 = 0xF00000008100000000000000
</code>```

Title: Comparing big files

Body:
So I've got really big .bin files with bytes written in them. They have 96-bit numbers written in them as two's complement numbers (still no ASCII, only bytes). Now I have to write an assembly program to sort the numbers in this files and save it to another file (don't ask why, assembly class). I've done it for a file with 32k numbers, like this:

./main < inSort32Kx96b.bin > XD.bin
diff outSort32Kx96b.bin XD.bin

The file outSort32Kx96b.bin is given to me by my teacher. So now diff doesn't output anything, they are identical (I can check that with hexdump or mcview). But I got another file inSort1Kx96b.bin. And I also sort it. But then diff says:

Binary files outSort1Kx96b.bin and XD.bin differ

@Edit:

cmp gave the number of byte where those 2 files differ. Now I can see the difference:

So the difference appears from 0x000017C0. Then I don't know now. If they are written as two's complement numbers in little endian order, then which one is bigger, f.e

00 00 00 00  00 00 00 81  00 00 00 00

or

00 00 00 00  00 00 00 7F  00 00 00 00

?

Body:
A hexdump shows you the single bytes in big endian order. If a bunch of bytes have to be interpreted as a number, only the byte order is reversed.

little endian                           big endian (C notation)
AB CD EF                              = 0xEFCDAB
01 02 03 04  05 06 07 08  09 10 11 12 = 0x121110090807060504030201

Let's translate your examples to big endian order:

0x000000008100000000000000
0x000000007F00000000000000

You can see that the first number is bigger.

"Two's complement number" is not a very clear expression. Better is "signed integer". The sign which shows whether the number is positive or negativ, is the very first bit of the number. This bit can be found at the begginning of a big endian number and the end of a little endian number.

Positive:

00 00 00 00  00 00 00 81  00 00 00 00 = 0x000000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 10 = 0x100000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 7F = 0x7F0000008100000000000000

Negativ:

00 00 00 00  00 00 00 81  00 00 00 80 = 0x800000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 CD = 0xCD0000008100000000000000
00 00 00 00  00 00 00 81  00 00 00 F0 = 0xF00000008100000000000000


问:
how to append columns in existing excel sheet using panda in python
```<code>import pandas as pd

from pandas import ExcelWriter

trans=pd.read_csv('HMIS-DICR-2011-12-Manipur-Bishnupur.csv')
df=trans[["April 10-11","May 10-11","June 10-11","July 10-11","August 10-11","September 10-11","October 10-11","November 10-11","December 10-11","January 10-11","February 10-11","March 10-11","April 11-12","May 11-12","June 11-12","July 11-12","August 11-12","September 11-12","October 11-12","November 11-12","December 11-12","January 11-12","February 11-12","March 11-12"]]
writer1 = ExcelWriter('manipur1.xlsx')
df.to_excel(writer1,'Sheet1',index=False)
writer1.save()
</code>```

this code successfully writes the data in a sheet 1 but how can append data of another data frame(df) from different excel file(mention below) into existing sheet(sheet1) "manipur1" excel file

for example:
my data frame is like:

```<code> trans=pd.read_csv('HMIS-DICR-2013-2014-Manipur-Bishnupur.csv')
    df=trans[["April 12-13","May 12-13","June 12-13","July 12-13","August 12-13","September 12-13","October 12-13","November 12-13","December 12-13","January 12-13","February 12-13","March 12-13","April 13-14","May 13-14","June 13-14","July 13-14","August 13-14","September 13-14","October 13-14","November 13-14","December 13-14","January 13-14","February 13-14","March 13-14"]]
</code>```

答:
You can only append new data to an existing excel file while loading the existing data into pandas, appending the new data, and saving the concatenated data frame again.

To preserve existing sheets which are supposed to remain unchanged, you need to iterate over the entire workbook and handle each sheet. Sheets to be changed and appended are defined in the to_update dictionary.

```<code># get data to be appended
trans=pd.read_csv('HMIS-DICR-2011-12-Manipur-Bishnupur.csv')
df_append = trans[["April 12-13","May 12-13","June 12-13","July 12-13","August 12-13","September 12-13","October 12-13","November 12-13","December 12-13","January 12-13","February 12-13","March 12-13","April 13-14","May 13-14","June 13-14","July 13-14","August 13-14","September 13-14","October 13-14","November 13-14","December 13-14","January 13-14","February 13-14","March 13-14"]]

# define what sheets to update
to_update = {"Sheet1": df_append}

# load existing data
file_name = 'manipur1.xlsx'
excel_reader = pd.ExcelFile(file_name)

# write and update
excel_writer = pd.ExcelWriter(file_name)

for sheet in excel_reader.sheet_names:
    sheet_df = excel_reader.parse(sheet)
    append_df = to_update.get(sheet)

    if append_df is not None:
        sheet_df = pd.concat([sheet_df, append_df], axis=1)

    sheet_df.to_excel(excel_writer, sheet, index=False)

excel_writer.save()
</code>```

However, any layouting/formatting in your existing excel will be lost. You can use openpyxl if you want to retain the formatting but this is more complicated.

Body:
import pandas as pd

from pandas import ExcelWriter

trans=pd.read_csv('HMIS-DICR-2011-12-Manipur-Bishnupur.csv')
df=trans[["April 10-11","May 10-11","June 10-11","July 10-11","August 10-11","September 10-11","October 10-11","November 10-11","December 10-11","January 10-11","February 10-11","March 10-11","April 11-12","May 11-12","June 11-12","July 11-12","August 11-12","September 11-12","October 11-12","November 11-12","December 11-12","January 11-12","February 11-12","March 11-12"]]
writer1 = ExcelWriter('manipur1.xlsx')
df.to_excel(writer1,'Sheet1',index=False)
writer1.save()

this code successfully writes the data in a sheet 1 but how can append data of another data frame(df) from different excel file(mention below) into existing sheet(sheet1) "manipur1" excel file

for example:
my data frame is like:

 trans=pd.read_csv('HMIS-DICR-2013-2014-Manipur-Bishnupur.csv')
    df=trans[["April 12-13","May 12-13","June 12-13","July 12-13","August 12-13","September 12-13","October 12-13","November 12-13","December 12-13","January 12-13","February 12-13","March 12-13","April 13-14","May 13-14","June 13-14","July 13-14","August 13-14","September 13-14","October 13-14","November 13-14","December 13-14","January 13-14","February 13-14","March 13-14"]]

Body:
You can only append new data to an existing excel file while loading the existing data into pandas, appending the new data, and saving the concatenated data frame again.

To preserve existing sheets which are supposed to remain unchanged, you need to iterate over the entire workbook and handle each sheet. Sheets to be changed and appended are defined in the to_update dictionary.

# get data to be appended
trans=pd.read_csv('HMIS-DICR-2011-12-Manipur-Bishnupur.csv')
df_append = trans[["April 12-13","May 12-13","June 12-13","July 12-13","August 12-13","September 12-13","October 12-13","November 12-13","December 12-13","January 12-13","February 12-13","March 12-13","April 13-14","May 13-14","June 13-14","July 13-14","August 13-14","September 13-14","October 13-14","November 13-14","December 13-14","January 13-14","February 13-14","March 13-14"]]

# define what sheets to update
to_update = {"Sheet1": df_append}

# load existing data
file_name = 'manipur1.xlsx'
excel_reader = pd.ExcelFile(file_name)

# write and update
excel_writer = pd.ExcelWriter(file_name)

for sheet in excel_reader.sheet_names:
    sheet_df = excel_reader.parse(sheet)
    append_df = to_update.get(sheet)

    if append_df is not None:
        sheet_df = pd.concat([sheet_df, append_df], axis=1)

    sheet_df.to_excel(excel_writer, sheet, index=False)

excel_writer.save()

However, any layouting/formatting in your existing excel will be lost. You can use openpyxl if you want to retain the formatting but this is more complicated.


问:
Node Async with functions
I'm trying to use Async module with 2 functions, here is the code. There's something wrong, the  console.dir are working, but the last one in function(err, results) doesn't work. Can any one help me?

The last step that I want to do is render the oftArrayFullInfo and oftNextInfo

```<code>async.parallel({
        one: function(callback){
            auxFunctions.foofunc1(foo1, foo1, function(oftArrayFullInfo){
                console.log("****** ASYNC 1 ARRAY");
                console.dir(oftArrayFullInfo);
                callback(oftArrayFullInfo);
            });
        },
        two: function(callback){
            auxFunctions.foofunc2(foo1, foo1, function(oftNextInfo){
                console.log("****** ASYNC 2 ARRAY");
                console.dir(oftNextInfo);
                callback(oftNextInfo);
            });
        }
    },
    function(err, results){
        console.log("****** RENDER 1");
        console.dir(results.one);
        console.log("****** RENDER 2")
        console.dir(results.two);
        //res.render('myView', {title: 'Job Info', oftArrayFullInfo}, {title: 'Next Jobs Info', oftNextInfo});
    });
</code>```

答:
Your main issue is that you're not calling the callbacks correctly.

async callbacks, and asynchronous callbacks in Node.js in general, take two arguments: the first one is used to pass any errors (or null if there aren't any), the second one is used to pass the result.

You are calling them with only the first argument:

```<code>callback(oftArrayFullInfo);
</code>```

This will make async think that the function has failed, which will cause results in the final callback to be undefined. When you subsequently try to access results.one, an error will be thrown.

To fix this, you should call the callbacks properly:

```<code>callback(null, oftArrayFullInfo)
callback(null, oftNextInfo)
</code>```

And, as suggested already, you should uncomment the res.render().

Eventually, you should also make your auxilliary functions (auxFunctions.foofunc1 and auxFunctions.foofunc2) adhere to the same calling convention.

Title: Node Async with functions

Body:
I'm trying to use Async module with 2 functions, here is the code. There's something wrong, the  console.dir are working, but the last one in function(err, results) doesn't work. Can any one help me?

The last step that I want to do is render the oftArrayFullInfo and oftNextInfo

async.parallel({
        one: function(callback){
            auxFunctions.foofunc1(foo1, foo1, function(oftArrayFullInfo){
                console.log("****** ASYNC 1 ARRAY");
                console.dir(oftArrayFullInfo);
                callback(oftArrayFullInfo);
            });
        },
        two: function(callback){
            auxFunctions.foofunc2(foo1, foo1, function(oftNextInfo){
                console.log("****** ASYNC 2 ARRAY");
                console.dir(oftNextInfo);
                callback(oftNextInfo);
            });
        }
    },
    function(err, results){
        console.log("****** RENDER 1");
        console.dir(results.one);
        console.log("****** RENDER 2")
        console.dir(results.two);
        //res.render('myView', {title: 'Job Info', oftArrayFullInfo}, {title: 'Next Jobs Info', oftNextInfo});
    });

Body:
Your main issue is that you're not calling the callbacks correctly.

async callbacks, and asynchronous callbacks in Node.js in general, take two arguments: the first one is used to pass any errors (or null if there aren't any), the second one is used to pass the result.

You are calling them with only the first argument:

callback(oftArrayFullInfo);

This will make async think that the function has failed, which will cause results in the final callback to be undefined. When you subsequently try to access results.one, an error will be thrown.

To fix this, you should call the callbacks properly:

callback(null, oftArrayFullInfo)
callback(null, oftNextInfo)

And, as suggested already, you should uncomment the res.render().

Eventually, you should also make your auxilliary functions (auxFunctions.foofunc1 and auxFunctions.foofunc2) adhere to the same calling convention.


问:
CSS - How can I make a font readable over any color?
Assuming I have a set font color that I must maintain, and that it overlays content that can be of any color, how can I make sure the font is readable no matter what it's overlaying?

Here is a jsFiddle to demonstrate the effect I am trying to describe.
http://jsfiddle.net/4AUDr/

```<code>#overlay
{
    position: relative;
    top: -150px;
    color: #860101;
}
</code>```

Meme captions utilize white text with a black outline to make it readable over any hypothetical meme image, however I don't think there is a cross-browser compatible CSS only method of achieving that, and it would potentially look quite horrible with smaller fonts.

What solutions are there to this problem?

答:
While text-shadow is nice, it doesn't actually give the result you want. A shadow is a shadow and what you need to have for most readable text is a "text border". Unfortunately. there is no such thing as text-border in css, but we can make one !

I am surprised by how much unpopular multiple shadows are. This is a case where by multiple shadows you can do miracles :

CSS

```<code>p {
    color: white;
    font-size: 20px;
    text-shadow:
        0.07em 0 black,
        0 0.07em black,
        -0.07em 0 black,
        0 -0.07em black;
}
</code>```

This style will simply add a thin shadow (as thin as 7% of your actual font-size) around your text (up, down, left, right).

But are four shadows enough ? Maybe you can get a better result with eight ? It looks like the answer is yes, makes sense to me, but it could also be that we are overkilling things here. Note that in this case I also decreased each shadow's size :

CSS

```<code>p.with-eight {
    text-shadow:
        0.05em 0 black,
        0 0.05em black,
        -0.05em 0 black,
        0 -0.05em black,
        -0.05em -0.05em black,
        -0.05em 0.05em black,
        0.05em -0.05em black,
        0.05em 0.05em black;
}
</code>```

Then in this markup in a colourful background you have a nicely readable text:

HTML

```<code><html>
<body>
    <p>This text is readable on any background.</p>
    <p class="with-eight">This text is using eight text-shadows.</p>
</body>
</html>
</code>```

JSFiddle example here

Body:
Assuming I have a set font color that I must maintain, and that it overlays content that can be of any color, how can I make sure the font is readable no matter what it's overlaying?

Here is a jsFiddle to demonstrate the effect I am trying to describe.
http://jsfiddle.net/4AUDr/

#overlay
{
    position: relative;
    top: -150px;
    color: #860101;
}

Meme captions utilize white text with a black outline to make it readable over any hypothetical meme image, however I don't think there is a cross-browser compatible CSS only method of achieving that, and it would potentially look quite horrible with smaller fonts.

What solutions are there to this problem?

Body:
While text-shadow is nice, it doesn't actually give the result you want. A shadow is a shadow and what you need to have for most readable text is a "text border". Unfortunately. there is no such thing as text-border in css, but we can make one !

I am surprised by how much unpopular multiple shadows are. This is a case where by multiple shadows you can do miracles :

CSS

p {
    color: white;
    font-size: 20px;
    text-shadow:
        0.07em 0 black,
        0 0.07em black,
        -0.07em 0 black,
        0 -0.07em black;
}

This style will simply add a thin shadow (as thin as 7% of your actual font-size) around your text (up, down, left, right).

But are four shadows enough ? Maybe you can get a better result with eight ? It looks like the answer is yes, makes sense to me, but it could also be that we are overkilling things here. Note that in this case I also decreased each shadow's size :

CSS

p.with-eight {
    text-shadow:
        0.05em 0 black,
        0 0.05em black,
        -0.05em 0 black,
        0 -0.05em black,
        -0.05em -0.05em black,
        -0.05em 0.05em black,
        0.05em -0.05em black,
        0.05em 0.05em black;
}

Then in this markup in a colourful background you have a nicely readable text:

HTML

<html>
<body>
    <p>This text is readable on any background.</p>
    <p class="with-eight">This text is using eight text-shadows.</p>
</body>
</html>

JSFiddle example here

ContentLicense: CC BY-SA 4.0


问:
How to disable Firefox pop up blocker via CentOS 7 terminal
Running selenium tests on a CentOS 7 minimal VM. Need to disable Firfox popup blocker. Don't have UI, need to find a way to disable using the terminal.

Any commands available for that?

答:
What you could do is set the default preferences for the profile you use to run your test instance of Firefox.

The preference which controls the popup blocker behavior is dom.disable_open_during_load. Simply add the following entry to your prefs.js file:

```<code>user_pref("dom.disable_open_during_load", true);
</code>```

Body:
What you could do is set the default preferences for the profile you use to run your test instance of Firefox.

The preference which controls the popup blocker behavior is dom.disable_open_during_load. Simply add the following entry to your prefs.js file:

user_pref("dom.disable_open_during_load", true);