Author Archives: Robins

VMware Virtualcenter failed firstboot. Failed to generate Virtu when installing vCenter6.7 on Windows Server 2008R2

VMware Virtualcenter failed firstboot. Failed to Generate Virtu appeared when Win2008R2 installed vCenter6.7

Unable to continue installation, you can only rollback to exit the installation

Start installing the MS17-012 patch
http://download.windowsupdate.com/d/msdownload/update/software/secu/2017/02/windows6.1-kb4012212-x64_2decefaa02e2058dcd965702509a992d8c4e92b3.msu
MS17-010
http://download.windowsupdate.com/c/msdownload/update/software/secu/2017/03/windows6.1-kb4012215-x64_a777b8c251dcd8378ecdafa81aefbe7f9009c72b.msu


The installation is complete

Window installation of MongoDB exception: connect failed exception

After Mongo is installed, the following problems are found after Mongo starts (H: \MongoDB\bin)

It took a lot of searching to find the answer
Create a mongo. config // touch mongo. config with Git

Then add the following in mongo.config


dbpath=H:\MongoDB\data
## all output locations
logpath=H:\MongoDB\log\mongo.log

Create the corresponding folder
in the file directory and then execute the configuration file mongod from the command line

If there is no task exception, do not close the command,
open MongDB/bin directory, then double-click mongo. Exe
, the link has been successful, and the mongo xshell can be executed

Install anaconda error: failed to create anaconda menus

Problem: my computer is Windows server 2008, installed anaconda 64 bit

Finally, failed to create anaconda menus, the following references for picture reference,

Solution:
to install Microsoft Visual c + + 2008 Redistributable Package (x64)
https://www.microsoft.com/en-us/download/details.aspx?id=15336
You should be able to run the Anaconda installer again.
Reference: https://github.com/ContinuumIO/anaconda-issues/issues/732

Endnote inserting documents causes word to crash! ! Solution

Read the following online.
1. Close Proofreading
2. Recovery from backups
The above is a bit tedious.
———————– official response ——————-
The cause of the problem is that there are interactions such as field codes that conflict with the endnotes. The solution is to clean the word file, i.e. delete the field code.
Official Steps.
The details are as follows (see original English for windows and mac):
1. back up your documents
2. Ctrl + a check mark
3.Crtl + 6 to remove the code (this is the key step)
4. Ctrl + C and V to copy to a new document.
Actually, operation 3 should solve the problem, I did try copying to the new document and indeed I can insert documents at will without crashing.
—————————————————————–
PS (error): just tried, will be in front of the chart directory ctrl + 6 after the document can be inserted into the literature normally.
My steps are: 1. select all the preceding directories 2. ctrl + 6 3. find the location of the insert literature or directly follow the new, successfully completed 4. ctrl + z to reply to the directory link status.
I hope this will help you.

 

tomcat Issues org.apache.catalina.LifecycleException: Failed to start component

1. Problem description

Sep 09, 2019 11:38:05 AM org.apache.catalina.core.ContainerBase startInternal
Warning: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/third]]
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/third]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
	... 6 more
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/third] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector]
	at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2178)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2124)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1985)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1946)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1931)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	... 6 more

Sep 09, 2019 11:38:05 AM org.apache.catalina.core.ContainerBase startInternal
Warning: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:738)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	... 6 more

Sep 09, 2019 11:38:05 AM org.apache.catalina.startup.Catalina start
Warning: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:738)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	... 11 more

Sep 09, 2019 11:38:05 AM org.apache.coyote.AbstractProtocol pause
Message: Pausing ProtocolHandler ["http-bio-8080"]
Sep 09, 2019 11:38:05 AM org.apache.coyote.AbstractProtocol pause
Message: Pausing ProtocolHandler ["ajp-bio-8009"]
Sep 09, 2019 11:38:05 AM org.apache.catalina.core.StandardService stopInternal
Message: Stopping service Catalina
Sep 09, 2019 11:38:05 AM org.apache.coyote.AbstractProtocol destroy
Message: Destroying ProtocolHandler ["http-bio-8080"]
Sep 09, 2019 11:38:05 AM org.apache.coyote.AbstractProtocol destroy
Message: Destroying ProtocolHandler ["ajp-bio-8009"]

2. Solutions
Just adjust your Tomcat memory parameters

-Xms256m -Xmx512m -XX:PermSize=256M -XX:MaxPermSize=512m


Mac USB error 3: Unable to claim interface: Access denied (insufficient permissions)

View USB device information
You can view information about the USB device to which you are connected at the terminal input: system_profiler SPUSBDataType
For example, my USB information is as follows (part content) :
Android:

          Product ID: 0x2769

          Vendor ID: 0x22d9

          Version: 2.31

          Serial Number: 6e5d48a4

          Speed: Up to 480 Mb/sec

          Manufacturer: Android

          Location ID: 0x1d110000/8

          Current Available (mA): 500

          Current Required (mA): 500

See the vendor ID for my Android phone: 0 x22d9 Remember this ID!
USB error 3: Unable to declare interface: Access denied (insufficient permissions)
Here are the steps on how to do it.

Create information. plist/Proxmark3 /System/Library/Extensions. kext/Contents. if missing. the parent folder should be created and the file contents should look like this:

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <!-- This is a dummy driver which binds to Proxmark. It -->
    <!-- contains no actual code; its only purpose is to     -->
    <!-- prevent Apple's USBHID driver from exclusively      -->
    <!-- opening the device.                                 -->
    <plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleIconFile</key>
        <string></string>
        <key>CFBundleIdentifier</key>
        <string>com.proxmark.driver.dummy</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>1.0.0d1</string>
        <key>IOKitPersonalities</key>
        <dict>
            <!-- The Proxmark3 USB interface -->
            <key>Proxmark3</key>
            <dict>
                <key>CFBundleIdentifier</key>
                <string>com.apple.kpi.iokit</string>
                <key>IOClass</key>
                <string>IOService</string>
                <key>IOProviderClass</key>
                <string>IOUSBInterface</string>
                <key>bConfigurationValue</key>
                <integer>1</integer>
                <key>bInterfaceNumber</key>
                <integer>0</integer>
                <key>idProduct</key>
                <integer>{your-usb-hardware-product-id}</integer>
                <key>idVendor</key>
                <integer>{your-usb-hardware-vendor-id}</integer>
            </dict>
        </dict>
        <key>OSBundleLibraries</key>
        <dict>
            <key>com.apple.iokit.IOUSBFamily</key>
            <string>1.8</string>
        </dict>
    </dict>
</plist>

Note:{your-usb-hardware-product-id} and {your-usb-hardware-vendor-id} must be your own hardware id, which can be obtained from About this mac – System Report – Hardware – USB.

Enter /System/Library/Extensions as the root runner.

sudo chown -R root:wheel Proxmark3.kext

sudo chmod -R 755 Proxmark3.kext

sudo kextcache -system-caches
    1. Restart the system and view the results.

About the solution of ERROR: Failed building wheel for dlib

Error reporting in some dependency libraries with dlib and Face_recognition installed

(face_recognition) C:\Users\FlynnLi>pip install dlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting dlib
  Downloading http://pypi.doubanio.com/packages/63/92/05c3b98636661cb80d190a5a777dd94effcc14c0f6893222e5ca81e74fbc/dlib-19.19.0.tar.gz (3.2 MB)
     |████████████████████████████████| 3.2 MB 2.2 MB/s
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\Python\Virtual\face_recognition\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\FlynnLi\AppData\Local\Temp\pip-wheel-4oqer9mq'
       cwd: C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\
  Complete output (55 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'dlib\__init__.py' not found (or not a regular file)
  running build_ext
  Building extension for Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
  Invoking CMake setup: 'cmake C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=D:\Python\Virtual\face_recognition\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\build\lib.win-amd64-3.7 -A x64'
  -- Building for: NMake Makefiles
  CMake Error at CMakeLists.txt:3 (project):
    Generator

      NMake Makefiles

    does not support platform specification, but platform

      x64

    was specified.


  CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
  CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/FlynnLi/AppData/Local/Temp/pip-install-ywrf5o_o/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\setup.py", line 261, in <module>
      'Topic :: Software Development',
    File "D:\Python\Virtual\face_recognition\lib\site-packages\setuptools\__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "d:\python\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "d:\python\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "d:\python\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "D:\Python\Virtual\face_recognition\lib\site-packages\wheel\bdist_wheel.py", line 223, in run
      self.run_command('build')
    File "d:\python\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\python\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "d:\python\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "d:\python\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\python\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\setup.py", line 135, in run
      self.build_extension(ext)
    File "C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\setup.py", line 172, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "d:\python\lib\subprocess.py", line 363, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=D:\\Python\\Virtual\\face_recognition\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for dlib
  Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'D:\Python\Virtual\face_recognition\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\FlynnLi\AppData\Local\Temp\pip-record-vngiiz8h\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Python\Virtual\face_recognition\include\site\python3.7\dlib'
         cwd: C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\
    Complete output (57 lines):
    running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=D:\Python\Virtual\face_recognition\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\build\lib.win-amd64-3.7 -A x64'
    -- Building for: NMake Makefiles
    CMake Error at CMakeLists.txt:3 (project):
      Generator

        NMake Makefiles

      does not support platform specification, but platform

        x64

      was specified.


    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/FlynnLi/AppData/Local/Temp/pip-install-ywrf5o_o/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "D:\Python\Virtual\face_recognition\lib\site-packages\setuptools\__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "d:\python\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "d:\python\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "d:\python\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "D:\Python\Virtual\face_recognition\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "d:\python\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "d:\python\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\python\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "d:\python\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "d:\python\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\python\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\setup.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\FlynnLi\AppData\Local\Temp\pip-install-ywrf5o_o\dlib\setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "d:\python\lib\subprocess.py", line 363, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=D:\\Python\\Virtual\\face_recognition\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Python\Virtual\face_recognition\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\FlynnLi\\AppData\\Local\\Temp\\pip-install-ywrf5o_o\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\FlynnLi\AppData\Local\Temp\pip-record-vngiiz8h\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Python\Virtual\face_recognition\include\site\python3.7\dlib' Check the logs for full command output.

Anaconda is downloaded according to the Suggestions on the Internet, conda is used to download, and the virtual environment is created before downloading

conda create -n face python=3.7 #Python3.7
activate face 

Installing Opencv has reported another error… Don’t recurse…

 D:\Anaconda\envs>conda install opencv-python
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

Actually, the name of the package under Python is OpencV-Python, and Anaconda is Opencv

conda install -c conda-forge opencv

Error reporting also occurred when installing the face_recognition library, and the solution is to use

pip install --no-dependencies face_recognition

And then I can introduce usage and write code normally.

Implement Ogre video texture with VMR9

These two days watch the KlayGE engine, video textures inside. I thought I’d do it in the Ogre.
The core idea is to use VMR9 to render video and update Ogre texture in Ogre frame monitoring. Below give their own code, if necessary, you can also ask me to learn together.
The key code is given below:

DShowVMR9Allocator. H

 1  
 2 
 3 #ifndef _DSHOWVMR9ALLOCATOR_HPP
 4 #define _DSHOWVMR9ALLOCATOR_HPP
 5 
 7   
 8 #ifndef CHECK_HRESULT 
 9 #define CHECK_HRESULT(x) { HRESULT _hr = x; if (static_cast<HRESULT>(_hr) < 0) { std::stringstream ss;ss << __FILE__ << ": " << __LINE__; throw std::runtime_error(ss.str()); } }
10 #endif
11 
12 #include <d3d9.h>
13 #include <strmif.h>
14 #include <vmr9.h>
15 #include <vector>
16 #include"Ogre.h"
17 #include "mutex.hpp"
18  
19 
20 
21 #define USER_ID  0x12345678
22 
23  class VMR9Allocator : public IVMRSurfaceAllocator9, IVMRImagePresenter9
24 { 
25     public:
26         explicit VMR9Allocator(HWND wnd,Ogre::String texname);
27         virtual~VMR9Allocator();
28          
29         virtual HRESULT STDMETHODCALLTYPE InitializeDevice(DWORD_PTR dwUserID,VMR9AllocationInfo *lpAllocInfo,DWORD *lpNumBuffers);
30         virtual HRESULT STDMETHODCALLTYPE TerminateDevice(DWORD_PTR dwID);
31         virtual HRESULT STDMETHODCALLTYPE GetSurface(DWORD_PTR dwUserID,DWORD SurfaceIndex,DWORD SurfaceFlags,IDirect3DSurface9 **lplpSurface);
32         virtual HRESULT STDMETHODCALLTYPE AdviseNotify(IVMRSurfaceAllocatorNotify9 *lpIVMRSurfAllocNotify);
33         virtual HRESULT STDMETHODCALLTYPE StartPresenting(DWORD_PTR dwUserID);
34         virtual HRESULT STDMETHODCALLTYPE StopPresenting(DWORD_PTR dwUserID);
35         virtual HRESULT STDMETHODCALLTYPE PresentImage(DWORD_PTR dwUserID,VMR9PresentationInfo *lpPresInfo);
36         virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid,void** ppvObject);
37         virtual ULONG STDMETHODCALLTYPE AddRef();
38         virtual ULONG STDMETHODCALLTYPE Release(); 
39     public:
40         void ResetDecive();
41         Ogre::TexturePtr PresentTexture(); 
42         Ogre::TexturePtr GetTexture()const{ return present_tex_;};
43 
44     protected: 
45         void CreateDevice();
46         void DeleteSurfaces();
47     private:  
48         static int d3DDLLRefCount_;
49         static HMODULE mod_d3d9_;
50     private:
51         HWND wnd_;
52         int    ref_count_;
53 
54         IDirect3D9* d3d_;
55         IDirect3DDevice9* d3d_device_;
56 
57         IVMRSurfaceAllocatorNotify9* vmr_surf_alloc_notify_;
58         std::vector<IDirect3DSurface9*>    surfaces_;
59         int cur_surf_index_; 
60         IDirect3DSurface9* cache_surf_; 
61 
62         typedef IDirect3D9* (WINAPI *Direct3DCreate9Func)(UINT SDKVersion);
63         Direct3DCreate9Func DynamicDirect3DCreate9_; 
64         D3DPRESENT_PARAMETERS d3dpp_; 
65    private:
66         Ogre::TexturePtr present_tex_; 
67         Ogre::String     texName;
68 private:
69     VMR::mutex  mMutex;
70     }; 
71 
72 #endif

DShowVMR9Allocator.cpp



View Code

VMR9Allocator::VMR9Allocator(HWND wnd,Ogre::String texname): wnd_(wnd),texName(texname), ref_count_(1),cur_surf_index_(0xFFFFFFFF),cache_surf_(nullptr)
{
    if(d3DDLLRefCount_++==0)
     VMR9Allocator::mod_d3d9_ = ::LoadLibraryW(L"d3d9.dll");
    if (nullptr == mod_d3d9_)
     {
         ::MessageBoxW(nullptr, L"failure to load d3d9.dll", L"Error", MB_OK);
     }
         if (mod_d3d9_ != nullptr)
         {
             DynamicDirect3DCreate9_ = reinterpret_cast<Direct3DCreate9Func>(::GetProcAddress(mod_d3d9_, "Direct3DCreate9"));
         }
         d3d_ =  DynamicDirect3DCreate9_(D3D_SDK_VERSION);
         this->CreateDevice();
}

VMR9Allocator::~VMR9Allocator()
{    
    this->DeleteSurfaces();
    if( --d3DDLLRefCount_==0) FreeLibrary( VMR9Allocator::mod_d3d9_);
}



View Code

HRESULT VMR9Allocator::InitializeDevice(DWORD_PTR dwUserID,VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers)
{
        if (dwUserID != USER_ID)
        {
            return S_OK;
        }

        if (nullptr == lpNumBuffers)
        {
            return E_POINTER;
        }

        if (!vmr_surf_alloc_notify_)
        {
            return E_FAIL;
        }
         

        HRESULT hr = S_OK;
 
        lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;
        this->DeleteSurfaces();
        surfaces_.resize(*lpNumBuffers);
        hr = vmr_surf_alloc_notify_->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &surfaces_[0]);
        if (FAILED(hr) && !(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget))
        {
            this->DeleteSurfaces();

            lpAllocInfo->dwFlags &= ~VMR9AllocFlag_TextureSurface;
            lpAllocInfo->dwFlags |= VMR9AllocFlag_OffscreenSurface;

            CHECK_HRESULT(vmr_surf_alloc_notify_->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &surfaces_[0]));
        } 
         
        
        //Create Ogre Texture
        if(present_tex_.isNull())
        {
            printf("Create Ogre\n");
            present_tex_=Ogre::TextureManager::getSingleton().createManual(
            texName,
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D,
            lpAllocInfo->dwWidth,
            lpAllocInfo->dwHeight,
            0,
            Ogre::PF_BYTE_BGRA,
            Ogre::TU_DYNAMIC_WRITE_ONLY
            );
        }
        CHECK_HRESULT(d3d_device_->CreateOffscreenPlainSurface(lpAllocInfo->dwWidth, lpAllocInfo->dwHeight,
            D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &cache_surf_, nullptr)); 

        return S_OK;
}



View Code

Ogre::TexturePtr VMR9Allocator::PresentTexture()
{ 
    if(present_tex_.isNull())
    {
        printf("wenli\n");
        return Ogre::TexturePtr();
    }
    VMR::TryLock _lock(mMutex);
    if(!_lock.IsLock()) return Ogre::TexturePtr();

    if (FAILED(d3d_device_->TestCooperativeLevel()))
    {
            return Ogre::TexturePtr();
    } 

    if (cur_surf_index_ < surfaces_.size())
    {
            CHECK_HRESULT(d3d_device_->GetRenderTargetData(surfaces_[cur_surf_index_], cache_surf_));

            D3DLOCKED_RECT d3dlocked_rc;
            if(cache_surf_==NULL) return Ogre::TexturePtr();
            CHECK_HRESULT(cache_surf_->LockRect(&d3dlocked_rc, nullptr, D3DLOCK_NOSYSLOCK | D3DLOCK_READONLY));

            uint32_t const width = present_tex_->getWidth();
            uint32_t const height = present_tex_->getHeight(); 
            uint8_t const * src = static_cast<uint8_t const *>(d3dlocked_rc.pBits);
            {  
                Ogre::HardwarePixelBufferSharedPtr pixelBuffer = present_tex_->getBuffer();
                pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
                const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
                size_t rowPitch = pixelBox.rowPitch;
                Ogre::uint32* dst = static_cast<Ogre::uint32*>(pixelBox.data);
                {
                    for (uint32_t y = 0; y < height; ++ y)
                    {
                        memcpy(dst, src, width * 4);
                        dst += rowPitch;
                        src += d3dlocked_rc.Pitch;
                    }
                } 
                pixelBuffer->unlock();
            } 
            CHECK_HRESULT(cache_surf_->UnlockRect());
    } 
    return present_tex_;
}

ShowVideoTexture.h



View Code

#pragma once
#include <windows.h>
#include <control.h>
#include <d3d9.h>
#include <strmif.h>
#include <vmr9.h>
#include "Ogre.h"
#include "OgreFrameListener.h"
#include "string" 
using namespace std;


enum ShowState
{
    SS_Unkown,
    SS_Uninit,
    SS_Stopped,
    SS_Paused,
    SS_Playing,
};

//已解决D3D设备丢失 纹理重设

class ShowVideoTexture:public Ogre::FrameListener,public Ogre::RenderSystem::Listener
{
public:
    ShowVideoTexture(HWND hwnd);
    ~ShowVideoTexture();

    bool IsComplete();

    void Load(std::string const & fileName);
    Ogre::TexturePtr PresentTexture();

    ShowState State(long msTimeout = -1);

    bool frameStarted(const Ogre::FrameEvent& evt);
    void eventOccurred(const Ogre::String &  eventName,const Ogre::NameValuePairList *parameters = 0);

private:
    IGraphBuilder*        graph_;
    IBaseFilter*        filter_;
    IMediaControl*        media_control_;
    IMediaEvent*        media_event_;
    IMediaSeeking*      media_seek_;
    IVMRSurfaceAllocator9* vmr_allocator_;
    ShowState    state_;
    HWND HWnd;
    float               mtimeOffset;
    float               currTimeflow;
private:
    void Init();
    void Free();

    void DoPlay();
    void DoStop();
    void DoPause(); 

public:
    bool CanPlay() const;
    bool CanStop() const;
    bool CanPause() const;
    bool IsInitialized() const;

    void Play();
    void Stop();
    void Pause(); 
    LONGLONG GetMediaLength()const;
    LONGLONG GetCurrPosition()const;
    void SetPosition(LONGLONG );

    void SetTexUpdateTimeOffset(float timeos){mtimeOffset = timeos;};

    Ogre::TexturePtr GetTexture();
    string VideofileName;

private:
    void CreateMaterial(Ogre::String matName);
    Ogre::MaterialPtr mMaterial;
    bool ResetTexture;
public:
    Ogre::MaterialPtr GetMaterial()const{return mMaterial;};
};

ShowVideoTexture.cpp



View Code

ShowVideoTexture::ShowVideoTexture(HWND hwnd):HWnd(hwnd),vmr_allocator_(NULL),media_seek_(NULL),ResetTexture(false),
        media_event_(NULL),media_control_(NULL),filter_(NULL),graph_(NULL),mtimeOffset(0.05f),currTimeflow(0)
{
        Ogre::Root::getSingletonPtr()->addFrameListener(this);
        Ogre::Root::getSingletonPtr()->getRenderSystem()->addListener(this);
}

ShowVideoTexture::~ShowVideoTexture()
{
        this->Free();
        Ogre::Root::getSingletonPtr()->removeFrameListener(this);
        Ogre::Root::getSingletonPtr()->getRenderSystem()->removeListener(this);
}

Create Ogre materials



View Code

void ShowVideoTexture::CreateMaterial(Ogre::String matName)
{ 
    mMaterial=Ogre::MaterialManager::getSingleton().create(matName,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    //Create texture objects and set parameters
    Ogre::TextureUnitState *tex= mMaterial->getTechnique(0)->getPass(0)->createTextureUnitState();
    tex->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_NONE);
    //Get the texture space and assign a value to it.
    tex=mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0); 
    tex->setTexture( GetTexture());  
}



View Code

void ShowVideoTexture::Load(std::string const & fileName)
{
         this->Free();
         this->Init(); 
         VideofileName = fileName;
         
        CHECK_HRESULT(::CoCreateInstance(CLSID_FilterGraph, nullptr, CLSCTX_ALL,
            IID_IGraphBuilder, reinterpret_cast<void**>(&graph_))); 

     
        CHECK_HRESULT(::CoCreateInstance(CLSID_VideoMixingRenderer9, nullptr, CLSCTX_INPROC_SERVER,
            IID_IBaseFilter, reinterpret_cast<void**>(&filter_))); 

        IVMRFilterConfig9* filter_config;
        { 
            CHECK_HRESULT(filter_->QueryInterface(IID_IVMRFilterConfig9, reinterpret_cast<void**>(&filter_config))); 
        }

        CHECK_HRESULT(filter_config->SetRenderingMode(VMR9Mode_Renderless));
        CHECK_HRESULT(filter_config->SetNumberOfStreams(1));

        IVMRSurfaceAllocatorNotify9*vmr_surf_alloc_notify; 
            CHECK_HRESULT(filter_->QueryInterface(IID_IVMRSurfaceAllocatorNotify9, reinterpret_cast<void**>(&vmr_surf_alloc_notify))); 


        std::wstring fn;
        ConvertToWstr(fn, fileName);

        // create our surface allocator
        vmr_allocator_ =  new VMR9Allocator(HWnd,fileName);

        // let the allocator and the notify know about each other
        CHECK_HRESULT(vmr_surf_alloc_notify->AdviseSurfaceAllocator(static_cast<DWORD_PTR>(USER_ID),vmr_allocator_));
        CHECK_HRESULT(vmr_allocator_->AdviseNotify(vmr_surf_alloc_notify));
          
        CHECK_HRESULT(graph_->AddFilter(filter_, fn.c_str()));

        { 
            CHECK_HRESULT(graph_->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&media_control_))); 
        }
        { 
            CHECK_HRESULT(graph_->QueryInterface(IID_IMediaEvent, reinterpret_cast<void**>(&media_event_))); 
        } 
    
        CHECK_HRESULT(graph_->RenderFile(fn.c_str(), nullptr));  
        { 
            CHECK_HRESULT(graph_->QueryInterface(IID_IMediaSeeking, reinterpret_cast<void**>(&media_seek_))); 
        } 
        state_ = SS_Stopped;

        media_seek_->SetTimeFormat(&TIME_FORMAT_FRAME);  

        CreateMaterial(fileName);
}



View Code

bool ShowVideoTexture::frameStarted(const Ogre::FrameEvent& evt)
{ 
    if(ResetTexture)
    {
        printf("Resetting Texture Materials\n");
        mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTexture( GetTexture());  
        ResetTexture = false;
        return true;
    }

    //mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTexture( GetTexture());  

        currTimeflow+=evt.timeSinceLastFrame;
        if(currTimeflow >mtimeOffset)
        {
            currTimeflow = 0;
            this->PresentTexture();
        }  
//         if(IsComplete()) 
//         {
//             SetPosition(0);
//             Play();
//         }  
        return true;
}



View Code

void ShowVideoTexture::eventOccurred(const Ogre::String &  eventName,const Ogre::NameValuePairList *parameters)
{    
         if (eventName == "DeviceRestored")
        {  
            printf("Resetting Messages\n"); 
            ((VMR9Allocator*)vmr_allocator_)->ResetDecive();
            Play();   
            ResetTexture = true; 
         }
}



View Code

#pragma once

#include "Windows.h"

namespace VMR
{

    class Lock;
    class TryLock;

    class mutex
    {
        protected: 
        mutex(mutex&);
        mutex& operator=(mutex const&);
    public:
        mutex()
        {
           InitializeCriticalSection(&critical_sec);
        }
        ~mutex()
        {
            DeleteCriticalSection(&critical_sec);
        }

        friend Lock;
        friend TryLock;

    private:
        void Lock()
        {
            EnterCriticalSection(&critical_sec);
        }
        void UnLock()
        {
            LeaveCriticalSection(&critical_sec);
        }
        bool TryLock()
        {
            return TryEnterCriticalSection(&critical_sec);
        }

    private:
        CRITICAL_SECTION critical_sec;
    };

    class Lock
    {
    public:
        Lock(mutex&mut):mut_(&mut)
        {
            mut_->Lock();
        }

        ~Lock()
        {
            mut_->UnLock();
        }
    private:
        Lock(Lock&);
        Lock& operator=(Lock const&);
        mutex*mut_;
    }; 



    class TryLock
    {
    public:
        TryLock(mutex&mut):mut_(&mut),islock(false)
        {
            islock = mut_->TryLock();
        }

        ~TryLock()
        {
            if(islock)
            mut_->UnLock();
        }

        bool IsLock()const{return islock;};
    private:
        TryLock(Lock&);
        TryLock& operator=(TryLock const&);
        mutex*mut_;
        bool islock;
    }; 
}

The VMR9Allocator class is used to allocate the VMR9 resources and implement the corresponding interfaces, and is also responsible for the actual Ogre texture update. The ShowVideoTexture class is used to create the Ogre materials and provide the interfaces for external calls. Meanwhile, the ShowVideoTexture class is also responsible for the responses such as Lost of the corresponding D3D Device. Ogre is easy to device lost, and so is THE D3D device of VMR9. Here, I am responsible for the re-initialization of video texture resources after Ogre D3D device lost.
I’m not good at writing, just post the code. Welcome board brick. Here is the effect map: