text:
Q: Installing Matplotlib on Windows 10 machines I am trying to install Matplotlib on my Windows 10 64-bit computer using Python's pip installer. Any advice would be appreciated. When I try I get the following extensive error return that I do not understand:
C:\Users\Todd Huffman>python -m pip install matplotlib
Collecting matplotlib
  Using cached https://files.pythonhosted.org/packages/12/d1/7b12cd79c791348cb0c78ce6e7d16bd72992f13c9f1e8e43d2725a6d8adf/matplotlib-3.1.1.tar.gz
Requirement already satisfied: cycler>=0.10 in d:\python38\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in d:\python38\lib\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in d:\python38\lib\site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: python-dateutil>=2.1 in d:\python38\lib\site-packages (from matplotlib) (2.8.0)
Requirement already satisfied: numpy>=1.11 in d:\python38\lib\site-packages (from matplotlib) (1.17.2)
Requirement already satisfied: six in d:\python38\lib\site-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in d:\python38\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (41.2.0)
Installing collected packages: matplotlib
  Running setup.py install for matplotlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'D:\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Todd Huffman\\AppData\\Local\\Temp\\pip-install-_sa1y_nr\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Todd Huffman\\AppData\\Local\\Temp\\pip-install-_sa1y_nr\\matplotlib\\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\Todd Huffman\AppData\Local\Temp\pip-record-50m5un7r\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Todd Huffman\AppData\Local\Temp\pip-install-_sa1y_nr\matplotlib\
    Complete output (505 lines):
    ================================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
      matplotlib: yes [3.1.1]
          python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC
                      v.1916 64 bit (AMD64)]]
        platform: yes [win32]

    OPTIONAL SUBPACKAGES
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]

    OPTIONAL BACKEND EXTENSIONS
             agg: yes [installing]
           tkagg: yes [installing; run-time loading from Python Tcl/Tk]
          macosx: no  [Mac OS-X only]

    OPTIONAL PACKAGE DATA
            dlls: no  [skipping due to configuration]

    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    copying lib\pylab.py -> build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\afm.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\animation.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\artist.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\axis.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\backend_bases.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\backend_managers.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\backend_tools.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\bezier.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\blocking_input.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\category.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\cm.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\collections.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\colorbar.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\colors.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\container.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\contour.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\dates.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\docstring.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\dviread.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\figure.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\fontconfig_pattern.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\font_manager.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\gridspec.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\hatch.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\image.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\legend.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\legend_handler.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\lines.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\markers.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\mathtext.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\mlab.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\offsetbox.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\patches.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\path.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\patheffects.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\pylab.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\pyplot.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\quiver.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\rcsetup.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\sankey.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\scale.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\spines.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\stackplot.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\streamplot.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\table.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\texmanager.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\text.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\textpath.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\ticker.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\tight_bbox.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\tight_layout.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\transforms.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\type1font.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\units.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\widgets.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_animation_data.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_cm.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_cm_listed.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_color_data.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_constrained_layout.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_layoutbox.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_mathtext_data.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_pylab_helpers.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\_version.py -> build\lib.win-amd64-3.8\matplotlib
    copying lib\matplotlib\__init__.py -> build\lib.win-amd64-3.8\matplotlib
    creating build\lib.win-amd64-3.8\mpl_toolkits
    copying lib\mpl_toolkits\__init__.py -> build\lib.win-amd64-3.8\mpl_toolkits
    creating build\lib.win-amd64-3.8\matplotlib\axes
    copying lib\matplotlib\axes\_axes.py -> build\lib.win-amd64-3.8\matplotlib\axes
    copying lib\matplotlib\axes\_base.py -> build\lib.win-amd64-3.8\matplotlib\axes
    copying lib\matplotlib\axes\_secondary_axes.py -> build\lib.win-amd64-3.8\matplotlib\axes
    copying lib\matplotlib\axes\_subplots.py -> build\lib.win-amd64-3.8\matplotlib\axes
    copying lib\matplotlib\axes\__init__.py -> build\lib.win-amd64-3.8\matplotlib\axes
    creating build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_agg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_cairo.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_gtk3.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_gtk3agg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_gtk3cairo.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_macosx.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_mixed.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_nbagg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_pdf.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_pgf.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_ps.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_qt4.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_qt4agg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_qt4cairo.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_qt5.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_qt5agg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_qt5cairo.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_svg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_template.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_tkagg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_tkcairo.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_webagg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_webagg_core.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_wx.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_wxagg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\backend_wxcairo.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\qt_compat.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\tkagg.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\windowing.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\wx_compat.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\_backend_pdf_ps.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\_backend_tk.py -> build\lib.win-amd64-3.8\matplotlib\backends
    copying lib\matplotlib\backends\__init__.py -> build\lib.win-amd64-3.8\matplotlib\backends
    creating build\lib.win-amd64-3.8\matplotlib\cbook
    copying lib\matplotlib\cbook\deprecation.py -> build\lib.win-amd64-3.8\matplotlib\cbook
    copying lib\matplotlib\cbook\__init__.py -> build\lib.win-amd64-3.8\matplotlib\cbook
    creating build\lib.win-amd64-3.8\matplotlib\compat
    copying lib\matplotlib\compat\subprocess.py -> build\lib.win-amd64-3.8\matplotlib\compat
    copying lib\matplotlib\compat\__init__.py -> build\lib.win-amd64-3.8\matplotlib\compat
    creating build\lib.win-amd64-3.8\matplotlib\projections
    copying lib\matplotlib\projections\geo.py -> build\lib.win-amd64-3.8\matplotlib\projections
    copying lib\matplotlib\projections\polar.py -> build\lib.win-amd64-3.8\matplotlib\projections
    copying lib\matplotlib\projections\__init__.py -> build\lib.win-amd64-3.8\matplotlib\projections
    creating build\lib.win-amd64-3.8\matplotlib\sphinxext
    copying lib\matplotlib\sphinxext\mathmpl.py -> build\lib.win-amd64-3.8\matplotlib\sphinxext
    copying lib\matplotlib\sphinxext\plot_directive.py -> build\lib.win-amd64-3.8\matplotlib\sphinxext
    copying lib\matplotlib\sphinxext\__init__.py -> build\lib.win-amd64-3.8\matplotlib\sphinxext
    creating build\lib.win-amd64-3.8\matplotlib\style
    copying lib\matplotlib\style\core.py -> build\lib.win-amd64-3.8\matplotlib\style
    copying lib\matplotlib\style\__init__.py -> build\lib.win-amd64-3.8\matplotlib\style
    creating build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\compare.py -> build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\conftest.py -> build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\decorators.py -> build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\determinism.py -> build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\disable_internet.py -> build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\exceptions.py -> build\lib.win-amd64-3.8\matplotlib\testing
    copying lib\matplotlib\testing\__init__.py -> build\lib.win-amd64-3.8\matplotlib\testing
    creating build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\triangulation.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\tricontour.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\trifinder.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\triinterpolate.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\tripcolor.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\triplot.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\trirefine.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\tritools.py -> build\lib.win-amd64-3.8\matplotlib\tri
    copying lib\matplotlib\tri\__init__.py -> build\lib.win-amd64-3.8\matplotlib\tri
    creating build\lib.win-amd64-3.8\matplotlib\backends\qt_editor
    copying lib\matplotlib\backends\qt_editor\figureoptions.py -> build\lib.win-amd64-3.8\matplotlib\backends\qt_editor
    copying lib\matplotlib\backends\qt_editor\formlayout.py -> build\lib.win-amd64-3.8\matplotlib\backends\qt_editor
    copying lib\matplotlib\backends\qt_editor\formsubplottool.py -> build\lib.win-amd64-3.8\matplotlib\backends\qt_editor
    copying lib\matplotlib\backends\qt_editor\_formlayout.py -> build\lib.win-amd64-3.8\matplotlib\backends\qt_editor
    copying lib\matplotlib\backends\qt_editor\__init__.py -> build\lib.win-amd64-3.8\matplotlib\backends\qt_editor
    creating build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\Duration.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\Epoch.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\EpochConverter.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\StrConverter.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\UnitDbl.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\UnitDblConverter.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\UnitDblFormatter.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    copying lib\matplotlib\testing\jpl_units\__init__.py -> build\lib.win-amd64-3.8\matplotlib\testing\jpl_units
    creating build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\anchored_artists.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\angle_helper.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axes_divider.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axes_grid.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axes_rgb.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axes_size.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axislines.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axisline_style.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\axis_artist.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\clip_path.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\colorbar.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\floating_axes.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\grid_finder.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\grid_helper_curvelinear.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\inset_locator.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\parasite_axes.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    copying lib\mpl_toolkits\axes_grid\__init__.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid
    creating build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\anchored_artists.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\axes_divider.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\axes_grid.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\axes_rgb.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\axes_size.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\colorbar.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\inset_locator.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\mpl_axes.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\parasite_axes.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    copying lib\mpl_toolkits\axes_grid1\__init__.py -> build\lib.win-amd64-3.8\mpl_toolkits\axes_grid1
    creating build\lib.win-amd64-3.8\mpl_toolkits\axisartist
    copying lib\mpl_toolkits\axisartist\angle_helper.py -> build\lib.win-amd64-3.8\mpl_toolkits\axisartist

<many more 'copying' entries ensue and we pick it up later>

    copying lib\matplotlib\mpl-data\fonts\ttf\STIXGeneral.ttf -> build\lib.win-amd64-3.8\matplotlib\mpl-data\fonts\ttf
    UPDATING build\lib.win-amd64-3.8\matplotlib\_version.py
    set build\lib.win-amd64-3.8\matplotlib\_version.py to '3.1.1'
    running build_ext
    building 'matplotlib.ft2font' extension
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -ID:\Python38\lib\site-packages\numpy\core\include -ID:\Python38\include -ID:\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.23.28105\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019NEW\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc/checkdep_freetype2.c /Fobuild\temp.win-amd64-3.8\Release\src/checkdep_freetype2.obj
    checkdep_freetype2.c
    src/checkdep_freetype2.c(1): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019NEW\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Todd Huffman\\AppData\\Local\\Temp\\pip-install-_sa1y_nr\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Todd Huffman\\AppData\\Local\\Temp\\pip-install-_sa1y_nr\\matplotlib\\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\Todd Huffman\AppData\Local\Temp\pip-record-50m5un7r\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

A: Matplotlib on PyPI (where pip draws packages from) doesn't have any .whl files for Python 3.8 yet (as of this writing). So Python is (as you seem to be aware) trying to build from scratch and is failing. For what it's worth, I have personally run into similar issues with Python 3.8/Matplotlib.
If you want a quick solution, you should look at this page run by Christoph Gohlke. In short, it contains an extremely wide selection of "unofficial" Windows builds of various Python packages, include Matplotlib 3.1.1 for Python 3.8 in 32-bit and 64-bit flavors (matplotlib‑3.1.1‑cp38‑cp38‑win32.whl and matplotlib‑3.1.1‑cp38‑cp38‑win_amd64.whl respectively).
Simply download the appropriate .whl for your version of Python and use e.g. python -m pip install nameof.whl to install the wheel. You can use python -v if you aren't aware of whether your version of Python is 32-bit or 64-bit.

As a side note, independent of Python 3.8, I ran into an issue where Matplotlib 3.1.1 would crash Python every time I went to run a Matplotlib script. The offending package was actually the PyPI build of numpy, specifically the DLL for OpenBLAS. I resolved this issue by uninstalling the PyPI version of numpy and replacing it with a build of numpy+mkl from the page already cited. Just a bit of extra information if you run into any similar issues.


text:
Q: ExtJS - Mimicking MouseOver event via keyboard Within the gridcolumn xtype there are onTitleMouseOver and onTitleMouseOut events which toggle the display of an arrow, signifying there's a menu to view when clicking.

Is there a way of mimicking this behaviour when using the keyboard? For accessibility purposes, I'd like to display the same arrow when the item has been focused via keyboard navigation.
I'm using ExtJS 6.5.0 Classic.
Many thanks in advance.

redpajama_set_name: RedPajamaStackExchange


text:
Q: @Formula field is not recognized by client code Related to: How to countDistinct on multiple columns
I have an entity class that contains many fields, three of which are longitude, latitude and update_time. I am trying to add a @Formula field that concatenates the three:
@Formula("concat(longitude, latitude, update_time)")
public String fix;

I would then like to use that field as part of a countDistinct query:
@SuppressWarnings( {"unchecked", "rawtypes"} )
public long getCountDistinctPositions() {
    Session session = sessionFactory.openSession();

    CriteriaBuilder criteriaBuilder = session.getCriteriaBuilder();

    CriteriaQuery criteriaQuery = criteriaBuilder.createQuery();
    Root<Position> position = criteriaQuery.from(Position.class);
    Expression fix = position.get("fix");
    Expression countDistinct = criteriaBuilder.countDistinct(fix);
    criteriaQuery.select(countDistinct);
    Query query = session.createQuery(criteriaQuery);
    Long result = (Long)query.getSingleResult();

    session.close();

    return result;
}

But I keep getting an exception:
java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name [fix] on this ManagedType [aaa.Position]

A: A @Formula field cannot be queried, its basically a synthetic field that Hibernate will populate when a select query is executed only.
For your use case, you'd need to execute:
SELECT DISTINCT longitude, latitude, update_time FROM Entity

From a JPA query perspective, you'd need to execute #countDistinct on all 3 individual columns, not on the formula-column.
The best way to think of a formula column is that you've effectively translated the following method on your entity
@Transient
public String getFix() {
  return this.longitude + this.latitude + this.update_time;
}

to a property that the database concatenates for you at query-time.
UPDATE
CriteriaQuery<Long> countQuery = cb.createQuery( Long.class );
Root<TheEntity> root = countQuery.from( TheEntity.class );

countQuery.select( cb.count( root.get( "id" ) ) );

Subquery<Integer> subQuery = countQuery.subquery( Integer.class );
Root<TheEntity> subRoot = subQuery.from( TheEntity.class );
subQuery.select( cb.min( subRoot.get( "id" ) ) );
subQuery.groupBy( subRoot.get( "longitude" ),
   subRoot.get( "latitude" ),
   subRoot.get( "updateTime" ) );

countQuery.where( root.get( "id" ).in( subQuery ) );

Long count = entityManager.createQuery( countQuery ).getSingleResult();


text:
Q: Disable BIOS after POST, from OS I don't really know if this is the right website to post this question, but here it goes (TL;DR highlighted):
It actually starts with a funny story which is needed for me to tell in case there are any misunderstandings. A good friend of mine met somebody in an online game, and that somebody managed to infect him with some kind of custom-coded virus. My friend called me for help, and when I arrived I discovered that he was being controlled remotely from the attacker's computer, who had full control over my friend's network.
Anyway, after being able to control the computer and whatnot, he uploaded many programs (most likely written by him) and he had the ability to hear what was going on in the room (through my friend's phone, but that's another story). He also started sending messages to my friend's Skype. When I mentioned BIOS, he had sent a message saying that he disabled it and there's no way of me getting back into it.

So I tried, turned off the PC, turned it on and started spamming F2, F10, F12, Delete, Tab, and many other buttons which I have knowledge of that could open up the BIOS. It did not show up, then I started the computer again, and it booted into Windows after a few seconds of black screen. I had to stop the computer, reset the CMOS and then I actually managed to get into the BIOS, but after booting into Windows AGAIN, the BIOS went missing AGAIN, which led me to believe he placed an executable file in the Startup folder, or made it run whenever Windows got booted up—I was not connected to the Internet (or to the network, in fact) since the point when I discovered the BIOS was not working.

ACTUAL QUESTION:
Now, I was very surprised that this is possible, and if I were you I would not believe it myself if I were to read it in a random question on the Internet. But I really have to ask somebody, how is disabing the BIOS from the Operating System possible? Or if not specific enough, how is it possible to disable the BIOS after POST?
EDIT NOTES:
I tried highlighting the important parts for a TL;DR. As I said, I would not blame you for not believing this, and I really hope this question will not get closed for an improper format.

A: Nothing could have disabled BIOS in any way as your computer would not function.  The BIOS does a lot more than perform Power-On Self-Tests (POST). (See this for more information)
If the computer is running Windows 8, 8.1 or 10, accessing BIOS setttings is done differently to previous ways.
One of the most played-up features of Windows 8 is that it's so much faster than previous versions. So fast, in fact, that Microsoft had to change the way that users access the BIOS because 200 milliseconds just isn't enough time to hit the right key.  This continued into Windows 10.
To access BIOS settings on Windows 8 and 8.1 computers, you must follow these steps.

*

*Open Settings

*Select General

*Under Advanced Startup click Restart Now

*The computer will restart into the Boot Menu where you need to click on the Troubleshoot icon

*Then click UEFI Firmware Settings

To access BIOS settings on Windows 10 computers, you must follow these steps.

*

*Navigate to settings. ...

*Select Update & security.

*Select Recovery from the left menu.

*Click Restart Now under Advanced startup. ...

*Click Troubleshoot.

*Click Advanced options.

*Select UEFI Firmware Settings.

*Click Restart.


text:
Q: Mockito: How to match a String and List arguments I'm basically trying to verify whether the correct parameters are being invoked in a method.
Here's a snippet of the code I'm trying to test:
Criteria criteria = session.createCriteria(User.class);
criteria.add(Restrictions.in("type", Arrays.asList("employee", "supervisor");

Verifying this using:
Mockito.verify(mockSession).createCriteria(User.class);
Mockito.verify(mockCriteria).add(Restrictions.in("type", Arrays.asList("employee", "supervisor"));

The first verify statement works. The second doesn't because, I believe, that the JVM detects two different List objects being compared to. However, when I change the second verify statement to:
Mockito.verify(mockCriteria).add(Restrictions.in("type", Mockito.anyList());

It works like a charm. However, I do want to ensure that the two Strings, employee and supervisor, are inside the List and that won't happen by using Mockito.anyList().
How do I get this to work?
EDIT: Please take note that I do not wish to only verify whether a List has been passed. I want to ensure that the correct Strings are passed inside that List as well

A: Unfortunately, here you cannot easily check what you want to check with matchers.
Mockito matchers work via side-effects, where a call to a matcher tells Mockito to use the matcher rather than testing equality. That means that Mockito matchers don't work at all when nested within objects like Criterion.
verify(mockCriteria).add(
     Restrictions.in("type", Arrays.asList("employee", "supervisor"));

In the above, you don't use matchers, you're verifying that mockCriteria.add is called with an object that equals the Criterion you specify. However, if the returned Criterion doesn't override equals (and hashCode) then it will only test that the instances are the same—which will never be true here, because you're creating a new one in the verify statement.
verify(mockCriteria).add(Restrictions.in("type", anyList()));

Here, it looks like you're verifying that mockCriteria.add is called with any list, but anyList() actually tells Mockito to skip checking for one parameter and returns the dummy value null. You then create a Criterion where "type" in null, and then Mockito sees one any matcher on the stack for a one-argument method call, discards the newly-created invalid Criterion, and just checks that add was called at all. It looks like everything's working, but your mockCriteria could receive literally any parameter including null and the test would still pass. (If you were using a second matcher, or if add took two parameters, you would get InvalidUseOfMatchersException instead of your false positive.)
To make this work with Mockito matchers, you would need to write your own Hamcrest matcher that matches the entire Criterion, and then use argThat to let Mockito match arguments with it.

As Andy Turner mentioned, one way to solve this is to use ArgumentCaptor:
ArgumentCaptor<Criterion> captor = ArgumentCaptor.forClass(Criterion.class);
verify(mockCriteria).add(captor.capture());
Criterion criterion = captor.getValue();
// assert against criterion

However, be warned that this may be of limited use: Criterion doesn't have a lot of properties you can inspect. You may need to use toString(), as in this SO question.


text:
Q: duplicate websocket writing I'm new in NodeJS and I would appreciate help with duplicate socket writing.
I have the following code in my client part of application and when something happens, I'm sending an alert to the server:
    socket.emit('change', {alertType: ALERT_TYPE});

And on the server side I have this:
    var app = require('express')()
       , server = require('http').createServer(app)
       , io = require('socket.io').listen(server);
       server.listen(3000);

    io.sockets.on('connection', function (socket) {
       socket.on('change', function (data) {
           io.sockets.emit('change-done', data);
       });
    });

And if more people are using the app I get multiple socket writing like this:
debug - websocket writing 5:::{"name":"change-done","args":[{"alertType":"waiting_delivery"}]}
debug - websocket writing 5:::{"name":"change-done","args":[{"alertType":"waiting_delivery"}]}
debug - websocket writing 5:::{"name":"change-done","args":[{"alertType":"waiting_delivery"}]}

And the number of these sockets writings increases as more people are using this. How can I fix this?
Thank you in advance for your help.


text:
Q: Terminal won't choose new window settings at startup I've been running into an odd behavior on 10.7 where editing Terminal preferences to launch a new window setting via "On startup, open" doesn't result in the changed terminal after a quit/launch.
Any idea what I may be doing wrong and/or how to trigger the new style?

A: It sounds like Lion's resume feature is confusing the cause-effect relationship between settings and application behavior.
The "On Startup, open" should work, assuming that you had no windows open when you closed Terminal.app.  Lion's resume feature is enabled for Terminal.app by default, so quitting the application before closing any windows will yield the same windows the Terminal is re-launched.
The simplest fix is this:

*

*Make sure you've closed all Terminal windows.

*Restart Terminal.app.

In the normal course of events, the resulting window should have the "On Start, open..." settings. If the steps above do not fix the issue, then I recommend deleting your Terminal preferences with a backup so that you can revert if needed.

Disable Resume for Terminal.app
You can also just disable resume for Terminal.app. Run the following command and re-launch Terminal.app twice:
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false


text:
Q: Xuggler decoding h264 issues I'm trying to use Xuggler to transcode IP Camera rtsp streams to rtmp streams (all with h264 codecs). I currently have 2 IP cameras to test with, and wrote a basic Java program using Xuggler to do the transcoding of these streams.
Here's snippet of code in question:
    // Setup the Input Container
    InContainer = IContainer.make();
    if(InContainer.open(InUrl, IContainer.Type.READ, null, false, false) < 0)
    {
        System.err.println("Could not open input container");
        return false;
    }
    System.out.println("Input cointainer opened...");

    // Loop until we find the key packet
    IPacket keyPacket = IPacket.make();
    InContainer.readNextPacket(keyPacket);
    //System.out.println("Waiting on key frame...");
    //while(InContainer.readNextPacket(keyPacket) >= 0 && !keyPacket.isKeyPacket()) {
        //System.out.println(keyPacket.toString());
    //}
    System.out.println(keyPacket.toString());
    System.out.println(bytesToHex(keyPacket.getData().getByteArray(0, keyPacket.getData().getSize())));

    videoStreamId = -1;
    int numStreams = InContainer.getNumStreams();
    System.out.println("Num. Streams in Container: " + numStreams);
    for(int i = 0; i < numStreams; i++){
        IStream stream = InContainer.getStream(i);
        IStreamCoder coder = stream.getStreamCoder();

        if(coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO)
        {
            VideoDecoder = coder;
            videoStreamId = i;

            if(VideoDecoder.open(null, null) < 0){
                System.err.println("Could not open video decoder for input container");
                return false;
            }
            System.out.println("Video decoder opened...");
            // Need to decode at least one key frame
            IVideoPicture keyPicture = IVideoPicture.make(VideoDecoder.getPixelType(), 0, 0);
            int bytesDecoded = VideoDecoder.decodeVideo(keyPicture, keyPacket, 0);
            if(bytesDecoded < 0)
            {
                throw new RuntimeException("Unable to decode key video packet");
            }

            System.out.println(DatatypeConverter.printBase64Binary(VideoDecoder.getExtraData().getByteArray(0, VideoDecoder.getExtraData().getSize())));
        }
        else // The stream has an unkown codec type, and no codec ID, we need to set the StreamCoder
        {
            coder.setCodec(ICodec.findDecodingCodec(ICodec.ID.CODEC_ID_H264));
            coder.setWidth(352);
            coder.setHeight(288);
            coder.setPixelType(IPixelFormat.Type.YUV420P);

            VideoDecoder = coder;
            videoStreamId = i;

            /*
            // Create the Extradata buffer
            byte[] start_sequence = new byte[]{0, 0, 1};
            byte[] extraData1 = DatatypeConverter.parseBase64Binary("Z0IAHtoFglMCKQI=");
            byte[] extraData2 = DatatypeConverter.parseBase64Binary("aN4Fcg==");
            int extraDataSize = extraData1.length + extraData2.length + start_sequence.length * 2;
            int destPos = 0;
            byte[] extraData = new byte[extraDataSize];
            System.arraycopy(start_sequence, 0, extraData, destPos, start_sequence.length);
            destPos += start_sequence.length;
            System.arraycopy(extraData1, 0, extraData, destPos, extraData1.length);
            destPos += extraData1.length;
            System.arraycopy(start_sequence, 0, extraData, destPos, start_sequence.length);
            destPos += start_sequence.length;
            System.arraycopy(extraData2, 0, extraData, destPos, extraData2.length);
            */
            if(VideoDecoder.open(null, null) < 0)
            {
                System.err.println("Could not open video decoder for input container");
                return false;
            }

            /*
            // Set the StreamCoder extradata
            IBuffer extraBuffer = IBuffer.make(null, extraData, 0, extraDataSize);
            int result = VideoDecoder.setExtraData(extraBuffer, 0, extraDataSize, true);
            if(result < 0)
            {
                System.err.println("Could not set the coder ExtraData");
            }
            else
            {
                System.out.println("VideoDecoder ExtraData set!");
            }*/

            //System.out.println(DatatypeConverter.printBase64Binary(VideoDecoder.getExtraData().getByteArray(0, VideoDecoder.getExtraData().getSize())));

            IVideoPicture keyPicture = IVideoPicture.make(VideoDecoder.getPixelType(), VideoDecoder.getWidth(), VideoDecoder.getHeight());
            int bytesDecoded = VideoDecoder.decodeVideo(keyPicture, keyPacket, 0); //key/keyPacket
            if(bytesDecoded < 0)
            {
                throw new RuntimeException("Unable to decode key video packet");
            }
        }

    }

This program is able to successfully transcode one of the camera's streams without any problems.
The other, however, has been giving me constant headaches for several days now. In the loop to look at the container's streams, I have an else statement because the problem stream has CODEC_TYPE_UNKOWN and CODEC_ID_NONE, so i thought i would need to set everything manually. I've gotten all kinds of errors such as:
15:22:36.964 [main] ERROR org.ffmpeg - [h264 @ 0000000000423870] no frame!

I get this error EVERY time i try to decode a frame. I realize this usually means that no key frames have been read and that the decoder needs the SPS/PPS information for h264 decoding, which i've tried to manually set (you can see in one of the commented sections), but with no success.
I've even tried creating a packet, filling it with the SPS/PPS info, setting the key packet to true, etc... also with no success. Even in the while loop (currently commented out) the program never seems to get a key frame from the one camera.
I've also gotten this warning from Xuggler:
16:22:43.412 [main] WARN  com.xuggle.xuggler - Could not find streams in input container (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:898)

... which i've also looked into but none of the solutions i've seen have worked.
I've tried running both of these camera's streams through FFMPEG itself in the command line
 and both are transcoded with no errors. I also thought that maybe Xuggler was built with too old of a version of FFMPEG to support rtsp streaming properly, but i went back and downloaded many of the older builds (0.10, 1.0.1 - 1.2, and current 2.2) and tried through the command line and all have succeeded.
I've seen a lot of threads across the Xuggler google group that address problems with rtsp streams and the "no frame!" error, but none of them have had a solution (or at least one that worked for me).
Does anyone have any idea what might be causing this? I have absolutely no ideas left! (First time posting here as well, my apologies if I did anything incorrectly or left out information) Thanks.

A: After many long hours of searching and testing, I found a solution to my problem.
For starters, i learned that the "no frame!" error is likely caused when no NAL Units/extradata have been set. Upon further investigation i found that this information is found in the SDP information sent from an RTSP DESCRIBE response.
I then looked at what the camera was sending in the SDP using WireShark, and everything looked fine, so the problem must have been in the Xuggler program.
I used the Xuggler function to set the captive FFMPEG logging level to debug, so that when the stream IContainer was opened, FFMPEG printed the SDP information it got. Again, this looked exactly the same as what Wireshark was showing me.
I then found that Xuggler IContainers have a "createSDP()" method, which will print the SDP of the container. After using that, i saw that the SDP was in fact getting parsed incorrectly. The media payload type was specified (in the original SDP) as 35 RTP/AVP, and the "rtpmap" line in the SDP was setting it to H264. However, the "createSDP" method was showing the media payload type as just "3".
I dug around the captive FFMPEG code contained in Xuggler and found that the logic of parsing the media payload type was backwards, and that it checks for the dynamic types (96 +) first, and then the static payload types (1-34), which does not account for the unassigned payload types (such as 35 in my case). I adjusted the logic to that of the current FFMPEG code, and Xuggler then parsed the 35 as a dynamic payload type, and the stream is set up and transcoded successfully.
I don't know if this is a proper fix to the problem, but it does work, and as far as I understand the payload types, it shouldn't affect any other parts of the program.
You can see my full post on the Xuggler google groups here.


text:
Q: Django Database Model Sum I have business logic to ranking user by closing rate (selling some item) this is my models
class Payments(models.Model):
    method = models.CharField(max_length=50)

class Status(models.Model):
    status_name = models.CharField(max_length=50)

class DataCustomer(models.Model):
    name = models.CharField(max_length=100, blank=True, null=True)
    payment_method = models.ForeignKey(Payments, on_delete=models.CASCADE, default=None)
    sales_name = models.ForeignKey(settings.AUTH_USER_MODEL, default=None, on_delete=models.CASCADE)
    status = models.ForeignKey(Status, default=None, on_delete=models.CASCADE, blank=True, null=True)

If sales selling something with payment method CASH with status Deal get point 13
and if with payment method CREDIT with status Deal get point 8
how can i impelement the query in views.py and in template tag?

A: You can define a method on your DataCustomer model to give the points acording to the condition. Something like this:
class DataCustomer(models.Model):
    name = models.CharField(max_length=100, blank=True, null=True)
    payment_method = models.ForeignKey(Payments, on_delete=models.CASCADE, default=None)
    sales_name = models.ForeignKey(settings.AUTH_USER_MODEL, default=None, on_delete=models.CASCADE)
    status = models.ForeignKey(Status, default=None, on_delete=models.CASCADE, blank=True, null=True)

    def calculate_points(self):
        if self.payment_method__method == 'CASH' and self.status__status_name == 'Deal':
            return 13
        elif self.payment_method__method == 'CREDIT' and self.status__status_name == 'Deal':
            return 8
        return 0

Then is just call .calculate_points() on DataCustomer object on views or templates.

A: If you want to store the points of each Sales in the database, first you should have a field in you models:
class Sales(models.Model):
    # other fields ...
    points = models.IntegerField(default=0)

Then, you need a trigger like pre_save for your DataCustomer model:
models.py
from django.db.models.signals import pre_save
from django.dispatch import reveicer

@receiver(pre_save, sender=DataCustomer)
def data_customer_pre_save_receiver(sender, instance, *args, **kwargs):
    if not instance.pk:  # checking whether the object is new or it's being updated
        sale = instance.sales_name
        if instance.status == Status.objects.get(status_name='Deal') and instance.payment_method == Payments.objects.get(method='CASH'):
            sale.points += 13
        if instance.status == Status.objects.get(status_name='Deal') and instance.payment_method == Payments.objects.get(method='CREDIT'):
            sale.points += 8
        sale.save()


text:
Q: How to array_unique dimensional arrays How to array_unique dimensional arrays
I have array below :
Input Array
[0] => Array
    (
        [staff_id] => 1
        [service_id] => 1
        [avatar_url] => gallery-1.png
        [full_name] => Germaine
        [price] => 0.00
    )

[1] => Array
    (
        [staff_id] => 3
        [service_id] => 1
        [avatar_url] => team-5.png
        [full_name] => Jenny
        [price] => 0.00
    )

[2] => Array
    (
        [staff_id] => 5
        [service_id] => 1
        [avatar_url] => gallery-6.png
        [full_name] => Shawn
        [price] => 0.00
    )

[3] => Array
    (
        [staff_id] => 2
        [service_id] => 6
        [avatar_url] => team-3.png
        [full_name] => Gabriel
        [price] => 0.00
    )

[4] => Array
    (
        [staff_id] => 3
        [service_id] => 6
        [avatar_url] => team-5.png
        [full_name] => Jenny
        [price] => 0.00
    )

And i want have result:
Expected Output Array
[0] => Array
    (
        [staff_id] => 1
        [service_id] => 1
        [avatar_url] => gallery-1.png
        [full_name] => Germaine
        [price] => 0.00
    )

[1] => Array
    (
        [staff_id] => 3
        [service_id] => 1
        [avatar_url] => team-5.png
        [full_name] => Jenny
        [price] => 0.00
    )

[2] => Array
    (
        [staff_id] => 5
        [service_id] => 1
        [avatar_url] => gallery-6.png
        [full_name] => Shawn
        [price] => 0.00
    )

[3] => Array
    (
        [staff_id] => 2
        [service_id] => 6
        [avatar_url] => team-3.png
        [full_name] => Gabriel
        [price] => 0.00
    )

Can someone help me. How to do that ?. I use array_unique but it not woking with dimensional arrays. How to resolve this ?
Thanks u

A: You can do this:
$output_array = array();
$arr_temp_id = array();
foreach($your_array as $arr)
{
      if(!in_array($arr['staff_id'], $arr_temp_id))
      {
          $arr_temp_id[] = $arr['staff_id'];
          $output_array[] = $arr;
      }
}

print_r($output_array);

A: Try this code
$input = array_map("unserialize", array_unique(array_map("serialize", $input)));


text:
Q: Error in select statement, with union all in a subquery In Oracle 11g, I came across an error for a query and cannot figure why it is erroring on me. Here is the query:
select
  main_data.issue_number,
  main_data.transaction_number
 from
 (
    select
      p1.payment_date,
      p1.media_number,
      p1.payment_amount,
      p1.issue_number,
      p1.advice_na_number,
      name.name_address_line_1,
      name.name_address_line_2,
      name.name_address_line_3,
      name.name_address_line_4,
      name.name_address_line_5,
      name.name_address_line_6,
      name.name_address_line_7,
      name.name_address_city,
      name.state_code,
      name.address_country_code,
      name.zip_code,
      name.tax_id_number,
      p1.output_tx_number_prin,
      p1.output_tx_number_int,
      '' as "transaction_number",
      p1header.check_account_number

    from
    p1
    left join name on p1.name_address_number = name.name_address_number
    left join p1header on p1.issue_number = p1header.issue_number

  UNION ALL

  select
      check.date_of_payment,
      check.media_number,
      check.payment_amount,
      check.issue_number,
      check.payee_na_number,
      name.name_address_line_1,
      name.name_address_line_2,
      name.name_address_line_3,
      name.name_address_line_4,
      name.name_address_line_5,
      name.name_address_line_6,
      name.name_address_line_7,
      name.name_address_city,
      name.state_code,
      name.address_country_code,
      name.zip_code,
      name.tax_id_number,
      '' as "output_tx_number_prin",
      '' as "output_tx_number_int",
      check.transaction_number,
      check.dda_number as "check_account_number"
  from check
  left join name on check.payee_na_number = name.name_address_number
) main_data

Selecting individual fields like above will give me an "invalid identifier error". If I do select * then it gives me back the data without any error. What am I doing wrong here? Thank you.

A: The old quoted identifier problem... see point 9 in the database object naming documentation, and note that Oracle does not recommend using quoted identifiers.
You've put your column alias as lower case inside double-quotes. That means that any references to it also have to be quoted and exactly match the case. So this would work:
select
  main_data.issue_number,
  main_data."transaction_number"
from
...

But unless you have a burning need to have that alias like that - and I doubt you do as all the identifier names from the actual table columns are not quoted - it would be simpler to remove the double quotes from the inner selects:
select
  main_data.issue_number,
  main_data.transaction_number
 from
 (
    select
  ...
      '' as transaction_number,
      p1header.check_account_number
  ...
  UNION ALL
  select
    ...
      '' as output_tx_number_prin,
      '' as output_tx_number_int,
      check.transaction_number,
      check.dda_number as check_account_number
    ...

You don't actually need to alias the columns in the second branch of the union; the column identifiers will all be taken from the first branch.


text:
Q: Getting only the last row in Datagrid with datagrid.items[index] I am trying to run a loop on a datagrid having five rows, but I am only getting the last row in the datagrid.
    for (int i = 0; i < mydataGrid.Items.Count; i++)
    {

        var newrow = (My_DTO)mydataGrid.Items[i];

        MessageBox.Show(newrow.FirstName.ToString());
    }

A: Try using this. This should help you get the row :
for (int i = 0; i < dataGrid.Items.Count; i++)
{
    DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(i);
}

A: Each time you call MessageBox.Show(newrow.Firstname.ToString()); you'll be overwriting the previous name.
Try:
String names = "";
for (int i = 0; i < mydataGrid.Items.Count; i++)
{
    var newrow = (My_DTO)mydataGrid.Items[i];
    names += newrow.FirstName.ToString());
}
MessageBox.Show(names);

That should just show the names one after the other with no spaces, but I'm not sure how you want to display the names, so that part is up to you.


text:
Q: Disabling/Enabling logging when using syslog I intend to use syslog for logging in an application. I need to be able to disable logging, at compile time, perhaps using a macro. Is this possible to do with the syslog facilities, or do I need to wrap syslog in my own macros/functions? The ability to disable/enable log messages based on their priority is a plus.

A: Maybe you could wrap a call to setlogmask in define block.

setlogmask sets a mask (the "logmask") that determines which future
  syslog calls shall be ignored. If a program has not called setlogmask,
  syslog doesn't ignore any calls. You can use setlogmask to specify
  that messages of particular priorities shall be ignored in the future.

something like this :
#ifdef LOG_LEVEL1
setlogmask (LOG_UPTO (LOG_NOTICE));
#endif
#ifdef LOG_LEVEL2
setlogmask (LOG_UPTO (LOG_WARNING));
#endif


text:
Q: I am using ubuntu 14.04 LTS . I am trying to compile simple Kernel Module Program but when I run Makefile by "make" command this error terminates the compilation
Whats the solution to this issue:
Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler


text:
Q: How to solve this Gradle Error in Intellij Idea First time in Intellij IDEA Community, and I can't continue because of this error:
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
I just downloaded the source code of this repo: https://github.com/FabricMC/fabric-example-mod
And when I do "open project", It doesn't want to build.
I re-downloaded Intellij Community but no success...


text:
Q: How to use Layout Inspector to inspect Notification View? Is it possible to inspect notifications list using Layout Inspector? I would like to check my Notification view parameters.

A: Ok, I found the solution:

*

*Start emulator and expand status bar

*In Layout Inspector select
process com.android.systemui
Now we have access to notification
views.


text:
Q: How to instantiate multiple components with variable size ports in vhdl? I want to retiteratively elaborate a couple of components using for generate statements, these components have variable size ports and I don't have an idea of how assign these variable size ports to signals.
I'm using a package with this declaration:
library ieee;
use ieee.std_logic_1164.all;

PACKAGE Arrays_package IS
    type Generic_ARRAY_type is array (integer range <>) of std_logic_vector;
END Arrays_package;

The components are Pre_pre_buffer_conv and Pre_buffer_conv in the code below.
How I can to declare the signal xdataout_preprebuffer?
library ieee;
use ieee.std_logic_1164.all;
use work.Arrays_package.all;

entity Naive_RNC_problem is

    generic(
                no_col_imag     : integer := 28;
                no_bits         : integer := 9;
                no_bits_fraction : natural := 8;
                no_col_filt     : integer := 3
    );

    port
    (
    CLOCK_50   : in std_logic;
    KEY        : in std_logic_vector(3 downto 0);
    SW         : in std_logic_vector(17 downto 0);

    xdataout_pre_buffer_conv : out Generic_ARRAY_type(no_col_filt*no_col_filt-1 downto 0)((no_bits-1) downto 0)

    );

end entity;

architecture rtl of Naive_RNC_problem is

component Image_ROM IS
    PORT
    (
        address     : IN STD_LOGIC_VECTOR (9 DOWNTO 0);
        clock       : IN STD_LOGIC  := '1';
        q       : OUT STD_LOGIC_VECTOR (8 DOWNTO 0)
    );
END component;

component generic_mask_nxn_v2 is
    generic(
                no_col_imag     : integer := 28;
                no_col_filt     : integer := 3;
                stride          : integer := 1;
                no_bits         : integer := 10
    );

    Port (
            -- ENTRADAS ------------------------
                iclk, irst    : in std_logic;
                ien               : in std_logic;
                idatain           : in std_logic_vector (no_bits-1 downto 0);
                index         : in integer;
                iindex_ctrl   : in std_logic_vector(7 downto 0);
            -- SALIDAS -------------------------
               odataout   : out Generic_ARRAY_type(no_col_filt-1 downto 0)((no_col_filt*no_bits-1) downto 0) ;
                omasken     : out std_logic

          );
end component;

component Pre_pre_buffer_conv is
    generic
    (
        no_col_filt     : integer := 3;
        no_bits         : integer := 10
    );

    port
    (
    -- ENTRADAS ------------------------
        iclk, irst    : in std_logic;
        ien               : in std_logic;
        index         : in integer;
        iindex_ctrl   : in std_logic_vector(7 downto 0);
        idatain           : in  Generic_ARRAY_type(no_col_filt-1 downto 0)(no_col_filt*no_bits-1 downto 0);
    -- SALIDAS -------------------------
        odataout          : out Generic_ARRAY_type(no_col_filt-1 downto 0)(no_col_filt*no_bits-1 downto 0)
    );
end component;

component Pre_buffer_conv is
    generic
    (
        no_col_filt     : integer := 3;
        no_bits         : integer := 9
    );

    port
    (
    -- ENTRADAS ------------------------
        iclk, irst    : in std_logic;
        ien               : in std_logic;
        idatain           : in Generic_ARRAY_type(no_col_filt-1 downto 0)(no_col_filt*no_bits-1 downto 0);
        isel_row         : in std_logic_vector(3 downto 0);
        isel_col         : in std_logic_vector(3 downto 0);
    -- SALIDAS -------------------------
        odataout          : out std_logic_vector (no_bits-1 downto 0)
    );
end component;

component Top_Control_prepre_buffer is
    port (-- ENTRADAS -----------
            iclk, ireset     : in std_logic;

            iStart          : in std_logic;
            imasken_conv    : in std_logic;
            ifin_convolvers   : in std_logic;
            ifin_interfaz_Conv_pool : in std_logic;

            -- SALIDAS -----------------------
            oidle           : out std_logic;
            orst            : out std_logic;
            oen_line_buffer_conv : out std_logic;
            odir_imagen     : out std_logic_Vector(15 downto 0);
            ocarga_prepre_buffer     : out std_logic;
            ocarga_pre_buffer_conv   : out std_logic;
            oind_pre_buffers_conv : out std_logic_Vector(15 downto 0);
            oStart_convolver         : out std_logic;
            oinicia_interfaz_Conv_pool : out std_logic
    );
end component;

--=======================================================
--  Signal  declarations
--=======================================================

signal xRST            : std_logic;
signal xrst_ctrl       : std_logic;
signal xStart          : std_logic;
signal xclk_50 : std_logic;
signal xaddress_memoria_MNIST_ROM, xaddress_MNIST_PORTA: STD_LOGIC_VECTOR (9 DOWNTO 0);
signal xdataout_MNIST_ROM    : STD_LOGIC_VECTOR (8 DOWNTO 0);
signal xaddress_memoria_MNIST_ctrl : STD_LOGIC_VECTOR (15 DOWNTO 0);
signal  xrst_buffer_conv      :  std_logic;
signal  xdatain_buffer  :  std_logic_vector (no_bits-1 downto 0);
signal   xdataout_buffer  : Generic_ARRAY_type(no_col_filt-1 downto 0)((no_col_filt*no_bits-1) downto 0) ;
signal  xmasken_buffer    :  std_logic;
signal   xen_line_buffer_conv   : std_logic;
signal xcarga_prepre_buffer : std_logic;
signal xsel_row_pre_buffer : std_logic_vector(3 downto 0);
signal xsel_col_pre_buffer : std_logic_vector(3 downto 0);
signal xstart_fill_buffers_conv : std_logic;
signal xcarga_pre_buffer_conv : std_logic;
signal xind_pre_buffers_conv_ctrl : std_logic_vector(15 downto 0);
signal xind_pre_buffers_conv : std_logic_vector(7 downto 0);
signal xrst_contol_prepre_buffer : std_logic;
signal xfin_convolver, xfin_Interfaz_conv_pool : std_logic;

    --  how to declare this signal? ---------------------------
type my_type1 is array (no_col_filt-1 downto 0) of std_logic_vector((no_col_filt*no_bits-1) downto 0);
type my_type2 is array(no_col_filt*no_col_filt-1 downto 0) of my_type1;
signal xdataout_preprebuffer : my_type2;
    ----
--=======================================================
--  Structural coding
--=======================================================

begin

xRST <= not KEY(0);
xStart <= not KEY(1);

-- RELOJES ===============================================

    xclk_50 <= CLOCK_50;

-- MEMORIA IMAGEN MNIST ===============================================

    MemoriaROM_MNIST : Image_ROM port map (xaddress_memoria_MNIST_ROM, xclk_50, xdataout_MNIST_ROM);

    xaddress_memoria_MNIST_ROM <= xaddress_memoria_MNIST_Ctrl(9 downto 0);

-- Line Buffer convolucion ==============================================

    Buffer_mask : generic_mask_nxn_v2 generic map ( no_col_imag => no_col_imag,
                                                              no_col_filt => no_col_filt,
                                                              stride      => 1,
                                                              no_bits     => no_bits
                                                                )

                                            port map (-- ENTRADAS ------------------------
                                                         xclk_50, xrst_buffer_conv,
                                                         xen_line_buffer_conv, xdatain_buffer,
                                                         0,
                                                         (others => '0'),
                                                        -- SALIDAS -------------------------
                                                         xdataout_buffer, -- this is a variable size port (no problem here)
                                                         xmasken_buffer
                                                            );

    xrst_buffer_conv <=  xRST or xrst_ctrl ;--(not xRST) or
    xdatain_buffer <= xdataout_MNIST_ROM;

    -- Control Prepre Buffer convolucion ==============================================

    Prepre_buffer_ctrl : Top_Control_prepre_buffer port map (-- ENTRADAS -----------------------
                                                                xclk_50, xrst_contol_prepre_buffer,
                                                                xStart,
                                                                xmasken_buffer,
                                                                xfin_convolver,
                                                                xfin_Interfaz_conv_pool,
                                                              -- SALIDAS -----------------------
                                                              open, xrst_ctrl,
                                                              xen_line_buffer_conv,
                                                              xaddress_memoria_MNIST_ctrl,
                                                              xcarga_prepre_buffer, xcarga_pre_buffer_conv, xind_pre_buffers_conv_ctrl,
                                                              open,
                                                              open

                                                                );
    xrst_contol_prepre_buffer <= xRST;
    xfin_convolver <= '1';
    xfin_Interfaz_conv_pool <= '1';

-- Pre pre Buffer convolucion ===========================================

    pre_pre_buffers_conV : for i in 0 to (no_col_filt*no_col_filt-1) generate
        pre_pre_buffer_conV_cmp : Pre_pre_buffer_conv generic map (no_col_filt => no_col_filt,
                                                                            no_bits     => no_bits
                                                                            )
                                                                     port map (-- ENTRADAS -----------------------
                                                                        xclk_50, xrst_buffer_conv,
                                                                        xcarga_prepre_buffer,
                                                                        i,
                                                                        xind_pre_buffers_conv,
                                                                        xdataout_buffer, -- this is a variable size port (no problem here)
                                                                        -- SALIDAS -----------------------
                                                                        xdataout_preprebuffer(i) -- this is a variable size port (ERROR HERE)
                                                                  );

    end generate;

-- Pre Buffer convolucion ==============================================

    pre_buffers_conV : for i in 0 to (no_col_filt*no_col_filt-1) generate
        pre_buffer_conV_cmp : Pre_buffer_conv generic map (no_col_filt => no_col_filt,
                                                                            no_bits     => no_bits
                                                                            )
                                                          port map (-- ENTRADAS -----------------------
                                                                        xclk_50, xrst_buffer_conv,
                                                                        xcarga_pre_buffer_conv,
                                                                        xdataout_preprebuffer(i),  -- this is a variable size port (ERROR HERE)
                                                                        xsel_row_pre_buffer,
                                                                        xsel_col_pre_buffer,
                                                                        -- SALIDAS -----------------------
                                                                        xdataout_pre_buffer_conv(i)
                                                                  );
    end generate;

   xind_pre_buffers_conv <= xind_pre_buffers_conv_ctrl(7 downto 0);
    xsel_row_pre_buffer <= (others => '0');
    xsel_col_pre_buffer <= (others => '0');

end rtl;

The errors thrown by analysis & elaboration stage were:

Error (10381): VHDL Type Mismatch error at Naive_RNC_problem.vhd(228):
  indexed name returns a value whose type does not match
  "Generic_ARRAY_type", the type of the target expression
Error: Quartus Prime Analysis & Elaboration was unsuccessful. 1 error,
  0 warnings

I believe that the signal xdataout_preprebuffer has to be declared as 2d array signal, but I don't know how to accomplish that.

A: Two changes.
An added type in the package:
library ieee;
use ieee.std_logic_1164.all;

package arrays_package is
    type generic_array_type is array (integer range <>) of std_logic_vector;
    type generic_array_of_generic_type is   -- ADDED type
                            array (integer range <>) of generic_array_type;
end package arrays_package;

and the signal declaration:
signal xdataout_preprebuffer:   generic_array_of_generic_type  -- type mark
                            -- index subtype:
                                    (no_col_filt * no_bits - 1 downto 0)
                            -- element constraint (generic_array_type):
                                -- index subtype:
                                    (no_col_filt - 1 downto 0)
                                --  element index constraint (std_logic_vector):
                                    (no_col_filt * no_bits - 1 downto 0);

After which your code will analyze (elaboration and simulation requires the entities to which all those components are bound during elaboration. With entity declarations and dummy architecture bodies for your components your code elaborates and simulates (showing associations and assignments don't have bounds errors).
The added type uses the -2008 unbounded array definition as does the original (See IEEE Std 1076-2008 5.3.2 Array types, 5.3.2.1 General,
5.3.2.2 Index constraints and discrete ranges, 6.3 Subtype declarations).
What we have is an unbound one-dimensional array type (generic_array_of_generic_type) whose element type (unbounded one-dimensional type generic_array_type) has it's own element unbounded one-dimensional array type (std_logic_vector). The index constraints for the unbounded array types are provided during object declaration.


text:
Q: Undo accidental check-in with TFS
Possible Duplicate:
How to rollback in Visual Studio TFS?

I need to undo my check-in in TFS.
How do I go about?
where can i read up on how to do it please?
thanks

A: I found plenty of examples, i did not search for it correctly
How to rollback in Visual Studio TFS?
How do I rollback a TFS check-in?


text:
Q: Doubt about findind a reference about the following extending a pullback into two exact sequences involving cokernels. In an abelian category, lets have the following pullback diagram
$$
\array{
Z' &\stackrel{g'}{\to} & X
\\
\downarrow^{f'} &&\downarrow^{f}
\\
Z' &\stackrel{g}{\to} & X.
}
$$
I already proved in three pages by hand that we can complete the last diagram to the following commutative and exact diagram
$$
\array{
Z' &\stackrel{g'}{\to} & X &\stackrel{\pi '}{\to} & Coker(g') &\to & 0
\\
\downarrow^{f'} &&\downarrow^{f}  &&\downarrow^{h}
\\
Z' &\stackrel{g}{\to} & Y  &\stackrel{\pi '}{\to} & Coker(g') &\to & 0 .
}
$$
where $h$ is a monorphism. I needed this result for some other result but Im not sure if there is a book or text where I can reference this one? I didnt find in Rotman's Homological algebra or neither other homological algebra. Also wondering if for the dual for an initial push out diagram the morphism $h$ between the two kernels should be epimorphism or it is still monomorphism?


text:
Q: Best free crash reporter for iOS I want to get the crash logs of my app from the user, so that I can solve the show stoppers in my next update. For this purpose, I can use some third party crash reporter with my application code. Initially I start with PLCrashReporter. It is cool framework that will generate the logs (like apple created logs).
Then, I selected to implement Crashlytics with my app. It creates the logs in a elegant way with more details than other crash reporters.
My questions are,

*

*What is the difference between these two? Which one is better in your experience?

*Is they are legal? Can I add them without any condition in my app?

*Or, is there any other free crash reporter available better than these two?

Thanks in Advance

A: We use Crashlytics in our commercial apps. Works great. Of course it's now owned by Twitter so assume some day it will be killed like everything they own. Nothing wrong with tracking crashes, in the long run it helps you create a better product. After all Apple supports crash reporting in iTunesConnect but it sucks big time.


text:
Q: ¿Cómo validar si hay campos vacios dentro de una lista en Java? Tengo el siguiente método que regresa una lista, dentro de esa lista estan los campos de mi entidad, los cuales necesito validar que no regresen null o esten vacios, si ese es el caso debo de setearles el valor 0.00
pero como valido esos campos dentro de la lista? como seria con un foreach? y de que manera se hace en java 8?
    public ResponseEntity<?> consultar(String datenIni, String dateFin) throws Exception {
    Map<String, Object> response = new HashMap<>();
    List<ValuesDto> listVal = new ArrayList<ValuesDto>();
    try {
        listVal = consultRepository
                .consulValues(datenIni, dateFin);

    } catch (Exception e) {
        LOGGER.error("An error ocurred looking for ValuesDto Data");
        response.put("success", false);
        response.put("error", e.getMessage());
        return new ResponseEntity<Map<String, Object>>(response, HttpStatus.INTERNAL_SERVER_ERROR);
    }
    response.put("success", true);
    response.put("data", listVal);
    return new ResponseEntity<>(response, HttpStatus.OK);
}

mi Entidad:
@Entity
    @Table
    public class ValuesDto implements Serializable {

    @Id
    @Column(name = "IDREGISTRO")
    private Integer idRegistro;

    @Column(name = "NOOPCIONES")
    private Double noOpciones;

    @Column(name = "FECHACOTIZACION")
    private Date fechaCotizacion;

    @Column(name = "NOREGISTROS")
    private String noRegistros;

    @Column(name = "NOPagos")
    private String noPagos;

    }

A: Lo primero para poder variar los valores de tu entidad necesitas crear los getters y setters, Una vez eso una manera facil de comprobar los valores de la lista puede ser usar un Iterator con un bucle y asi ya puedes comprobar si es null y darle un valor si asi quieres.
List<ValuesDto> listVal = new ArrayList<ValuesDto>();
Iterator<ValuesDto> iterator = listVal.iterator();
while(iterator.hasNext()) {
    ValuesDto aux = iterator.next();
    if(!aux.getNoOpciones())
        aux.setNoOpciones(0);
    //Asi con el resto de valores o como te sea mas comodo
}

A: Con esto recorrerías la lista chequeando por los valores que quieras.
Deberías agregarle los getters y setters en tu entity.
Para la comparación podes usar isBlank() que te va a devolver true si es null o vacío.
for (ValuesDto item : listVal) {
    if(StringUtils.isBlank(item.getNoRegistros()))
        item.setNoRegistros("0.00");
}


text:
Q: Retrieving limited columns using jpa specifications I am using spring boot JPA specifications for executing complex queries. However, the table I am querying contains more than 20 columns and I need to pull just 3. I tried cq.multiselect(...) but it didn't work and returned me the entity with all the columns.
On investigation, I got to know that it's a bug with specifications that's not yet fixed. Another option was to use projections but specifications can't be combined with projections. An attempt to do so returns the complete entity.
I do not want to switch to Querydsl or @Query approach since it's an existing code and I am stuck with specifications. Any pointers on how to limit the number of columns will be much appreciated :)

A: Got to know Spring boot JPA Specifications doesn't provide any way to limit the number of columns. There is a bug related to this feature and it's pending for more than 3 years now. Not sure if it will be available soon

A:
Use QueryDslPredicateExecutor.findAll(Predicate predicate, Pageable
pageable) and then get the actual results back using PageRequest.of(0,
limit).

Querydsl limit record example


text:
Q: What is the homology of the real coordinate ring of SO(n,R)? Other compact matrix groups? As someone whose knowledge of cohomology is patchy and picked up on a need-to-know basis, and whose algebraic geometry is even worse, I wondered if someone could help with this question. (I ran into it a while back while trying to answer some questions about the Fourier algebras of compact Lie groups.) The solution could just be to point me to the right bit of the right literature.
In more detail: using R to denotes the reals, regard the special orthogonal group SO(n,R) as an affine variety in Mn(R)=Rn^2; and let A be the coordinate ring of this variety, regarded as an R-algebra (I think this is the correct terminology; I just mean the algebra of R-valued functions on the group that is generated by the coordinate functions). I would like to know the largest d for which Hdalt(A,A) is non-zero, where Hd is Hochschild homology of A with coefficients in itself, and "alt" is the part generated by alternating a.k.a. antisymmetric cycles.
The vague idea I had was that said d should be equal to the dimension of the tangent space (as defined via maximal ideals in A) at a point of the original variety, and hence to the dimension of SO(n,R) as a real manifold. I've tried to do some hunting in the literature, but much of what I come across is for general affine/projective varieties, and so is overly general and not exactly self-contained.
Is there a general picture telling us that the Hochschild homology of A can be calculated in terms of the Lie algebra cohomology of so(n,R)? If so, does this work for compact forms of other semisimple Lie algebras?
Edit: it's been pointed out that, if we know A is a smooth ring in the sense of commutative algebra, then one can wheel in the Hochschild-Kostant-Rosenberg theorem. I had avoided mentioning this, because although I'm sure A should be smooth in this sense, one of my problems is trying to find an explicit reference to this putative fact. It also feels (since the variety SO(n,R) has such good global symmetry) as if there should be a proof which doesn't rely on proving smoothness of A.
Final edit (for now): Having gone and done some reading in a few textbooks, it look s like the simplest - if not the most elementary solution is to "observe" or cite the fact that SO(n,R) is a smooth variety over R, use localization to reduce the computation to Hochschild homology of the local ring at a point, and then use HKR or something similar. This still feels like overkill to me, but at least it looks to give a well-defined proof. (If you can see a better route, please feel free to add a new comment!)

A: I am very far from an expert on the subject, but I think the Hochschild homology of the coordinate ring should be the algebraic de Rham complex of your variety SO(n, R)--not the cohomology of the complex, just the groups in the complex (with 0 differential if you like).  This is the Hochschild-Kostant-Rosenberg theorem and should just require smoothness, not the fact that you have a Lie group.
I don't know what HH^{alt} is, but maybe you can figure it out from this description.  Unless I am very confused about something, HH_k is nonzero exactly for 0 <= k <= the dimension of SO(n, R), so your guess about d sounds plausible.

A: First some general references on homology of lie groups:

*

*Cohomology Theory of Lie Groups and Lie Algebras
Claude Chevalley and Samuel Eilenberg
Transactions of the American Mathematical Society, Vol. 63, No. 1 (Jan., 1948), pp. 85-124

*Borel, Armand
Homology and cohomology of compact connected Lie groups.
Proc. Nat. Acad. Sci. U. S. A. 39, (1953). 1142--1146.

*Bott, R. On the Chern-Weil homomorphism and the continuous cohomology of Lie-groups. Advances in Math. 11 (1973), 289--303.

*Dwyer, W. G.; Wilkerson, C. W. Homotopy fixed-point methods for Lie groups and finite loop spaces. Ann. of Math. (2) 139 (1994), no. 2, 395--442.

As far as I remember in the SO(n,R) case the easiest thing to is to write the spectral sequence of the fiber space:
SO(n-1)->SO(n,R)->S^n


text:
Q: Adding sublayer to view.layer changes the frame position? I'm adding a CALayer as a sublayer to a UIView's layer property as follows:
_graphicLayer = [[GraphicLayer alloc] init];
        self.bounds = _graphicLayer.bounds;
        _graphicLayer.position = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
        [self.layer addSublayer:_graphicLayer];

As you can see, I change the position of _graphicLayer to account for the centered anchorPoint. I'm noticing after I add this sublayer, that it's changing the views frame to (-self.bounds.width / 2, -self.bounds.height / 2). Why is this happening? If I change the position of _graphicLayer, I thought that was only relative to its parent view. Why would it affect the views frame property? (and I don't want to have to adjust the anchorPoint of either the views layer property or _graphicLayer).

A: You're currently doing
self.bounds = _graphicLayer.bounds;

which would change the view's (self's) frame as it would change the width and height. Maybe you meant to do :
_graphicLayer.bounds = self.bounds;

See here about how bounds affect the frame:Link


text:
Q: Why Puppeteer is not downloading into folder specified with "Page.setDownloadBehavior" in Windows? I use the following piece of code to achieve the download of a file by making Puppeteer click the button that emits the event
await page._client.send(
  'Page.setDownloadBehavior',
  {
    behavior: 'allow',
    downloadPath: './temporal/files/',
  },
);

It works pretty fine in a Mac OS machine, but it does nothing in a Windows one
The try/catch that wraps this block it doesn't catch anything, and when I use the headless: false setting, it's proven to "download the file", but there is no file in all the hard drive

A: In case Windows API needs an absolute path, you can compose it with __dirname and relative path.

A: For newer versions (tested in version 12.0.1 on Windows)
page._client is deprecated, instead, use page.client()
downloadPath needs to be absolute for Windows (see the accepted answer)
await page.client().send("Page.setDownloadBehavior", {
  behavior: "allow",
  downloadPath: __dirname + "./", // referenced from the accepted answer
});


text:
Q: How to continue trying to attempt a connection if connection fails (python)
So I have a basic connection that works fine as long as whatever I want to connect to is online. The code is turned into a standalone using pyinstaller. If whatever I want to connect to is offline, when the standalone program is run it gives me a "Failed to excecute script test" (test being name of the program). How can I make it so it continues trying to establish a connection until it succeeds? Here is what I attempted below.
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

while True:
        result = s.connect_ex((host,port))
        if result == 0:
                break
        else:
                sleep_for = random.randrange(1,10)
                time.sleep( sleep_for )
                pass

Func1()
Func2()
s.close()

A: The documentation for connect_ex says:

Like connect(address), return an error indicator instead of raising an exception for errors returned by the C-level connect() call (other problems, such as "host not found," can still raise exceptions)

That means that you still need to catch exceptions in order to infinitely retry to connect. In order to not make double work: processing connect_ex return value and catching exceptions, you can switch from using connect_ex to connect method and rewrite your code like this:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

while True:
        try:
                s.connect((host,port))
                break
        except socket.error:
                sleep_for = random.randrange(1,10)
                time.sleep( sleep_for )
                pass

Func1()
Func2()
s.close()


text:
Q: Dafny simple assertion does not hold In exercise_1a what could be done to make the assertion cnt > 0 valid?
method exercise_1a(n: int)
    requires n > 0
{
    var idx := 0;
    var cnt := 0;

    while idx < n
        decreases n - idx
    {
        idx := idx + 1;
        cnt := cnt + 1;
    }

    assert idx > 0; // valid
    assert cnt > 0; // *** invalid ***
}

Surprisingly, this version invalidates the assertion idx > 0, as well:
method exercise_1b(n: int)
    requires n > 0
{
    var idx := 0;
    var cnt := 0;

    while idx < n && cnt < n
        decreases n - idx
        decreases n - cnt
    {
        idx := idx + 1;
        cnt := cnt + 1;
    }

    assert idx > 0; // *** invalid ***
    assert cnt > 0; // *** invalid ***
}

A: In your first snippet of code, when the while loop exits, all Dafny knows is that !(idx < n). Therefore, it can infer that idx > 0. However, Dafny doesn't know anything about the cnt variable at this point, so your second assertion fails.
In the second snippet of code, when the while loop exits, all Dafny is knows is that !(idx < n && cnt < n) (again, the negation of the condition on the while loop). This is equivalent to idx > n || cnt > n. From there, Dafny could infer idx > 0 || cnt > 0, but it wouldn't be able to prove either idx > 0 or cnt > 0 on its own.
To fix this, you need to add some relation between the variables cnt and idx that Dafny could check and then use.
    while idx < n && cnt < n
        decreases n - idx
        decreases n - cnt
        invariant idx == cnt
    {
        idx := idx + 1;
        cnt := cnt + 1;
    }

The extra invariant line tells Dafny check that idx == cnt will hold across every iteration of the loop, and then it can use that fact at the end. However, Dafny would not know to bring the fact idx == cnt under consideration unless you tell it to do so.
(As a side note, you'll see that Dafny is able to determine, on its own, that n > 0 holds at the end of the while loop, even while you don't specify it explicitly as in invariant. This is because n is not modified in the body of the while loop, so Dafny will automatically carry across the fact that n > 0 from the beginning.)


text:
Q: How to position background image on a longer  link on IE6 I have a problem with an  link's background.
For my exam this must work on all browsers down to IE 6. Problem is I am using a background image that should be positioned on the left of the links, but if the link is longer than one line IE 6 gets confused and positions the background image centered left, not top left...
I am using a 2colors .gif image and the anchor tag is located as follows

        recent comments

                Etiam placerataaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

        ...

If it cannot be done I will still appreciate someone stopping me from trying again and again.
Thank you for your time!

A: According to this article, several versions of IE just don't do the right things when rendering background images on multiline inline elements.  There are several possible work-around mentioned in the article.  The simplest looks to be using inline-block as the display style, but you can see the other work-arounds in the article.
There is also plenty written on the web about this issue so with the right Google search ("inline element background image"), you can find many other articles.
You also may want to make sure a background image is top/left by specifying both top and left:
You have this:
background: url(../assets/bullet2.gif) left no-repeat;

Might as well use this:
background: url(../assets/bullet2.gif) left top no-repeat;

It looks like top/left is supposed to be the default, but it doesn't hurt to specify what you want.


text:
Q: JSON power shell command line argument to python script I trying to pass JSON as an argument to python script using Powershell but everything getting new issues in python script. I am new to python so not sure whats wrong with script.
import json, sys, traceback
import requests
from aws_requests_auth.aws_auth import AWSRequestsAuth

try:
   if(len(sys.argv)>1):
        print("*** json.dumps() ***")
        print(json.dumps(sys.argv[1]))
        print("**** json.loads() ****")
        print(json.loads(sys.argv[1]))
        print("**** json.dumps-loads() ****")
        print(json.loads(json.dumps(sys.argv[1])))
        jsonInput = json.loads(json.dumps(sys.argv[1]));

        print(jsonInput['endpoint']);
        print(jsonInput['headers']);
        print(jsonInput['method']);

except Exception as e:
    output ={}
    output['error_message'] = e
    output['status_code']='1050'
    print(output)

This is how I am running command in PowerShell:
python C:\Folder\server\agent\scripts\PythonLibrary\cloudAPIInvoker.py '"{""endpoint"":""https://XXXXXX.execute-api.us-west-2.vpce.amazonaws.com/dev/transit-connectivity/api/v1/user"",""method"":""post"",""headers"":{""x-apigw-api-id"":""xxxx""},""queryParam"":"""",""body"":{""site_id"":""XXXXXXX"",""account_id"":""XXXXX"",""change_request"":""RITM0021337"",""customer_id"":""0000000"",""provider"":""aws"",""customer"":""new"",""region"":""us-east-1"",""network_id"":""vpc-00000000"",""cidr"":""10.10.10.0/00"",""egress_filter"":[""""],""route_tables"":[],""transit_connected"":true,""high_availability"":true,""service_now_notify"":true,""public_subnets"":[""10.10.10.0/00"",""10.10.00.00/00""]}}"'

Here is the output: Anyone has seen a similar issue?
*** json.dumps() ***
"{\"endpoint\":\"https://XXXXXX.execute-api.us-west-2.vpce.amazonaws.com/dev/transit-connectivity/api/v1/user\",\"method\":\"post\",\"headers\":{\"x-apigw-api-id\":\"xxxx\"},\"queryParam\":\"\",\"body\":{\"site_id\":\"XXXXXXX\",\"account_id\":\"XXXXX\",\"cha
nge_request\":\"RITM0021337\",\"customer_id\":\"0000000\",\"provider\":\"aws\",\"customer\":\"new\",\"region\":\"us-east-1\",\"network_id\":\"vpc-00000000\",\"cidr\":\"10.10.10.0/00\",\"egress_filter\":[\"\"],\"route_tables\":[],\"transit_connected\":true,\"
high_availability\":true,\"service_now_notify\":true,\"public_subnets\":[\"10.10.10.0/00\",\"10.10.00.00/00\"]}}"
**** json.loads() ****
{'endpoint': 'https://XXXXXX.execute-api.us-west-2.vpce.amazonaws.com/dev/transit-connectivity/api/v1/user', 'method': 'post', 'headers': {'x-apigw-api-id': 'xxxx'}, 'queryParam': '', 'body': {'site_id': 'XXXXXXX', 'account_id': 'XXXXX', 'change_request': 'R
ITM0021337', 'customer_id': '0000000', 'provider': 'aws', 'customer': 'new', 'region': 'us-east-1', 'network_id': 'vpc-00000000', 'cidr': '10.10.10.0/00', 'egress_filter': [''], 'route_tables': [], 'transit_connected': True, 'high_availability': True, 'servi
ce_now_notify': True, 'public_subnets': ['10.10.10.0/00', '10.10.00.00/00']}}
**** json.dumps-loads() ****
{"endpoint":"https://XXXXXX.execute-api.us-west-2.vpce.amazonaws.com/dev/transit-connectivity/api/v1/user","method":"post","headers":{"x-apigw-api-id":"xxxx"},"queryParam":"","body":{"site_id":"XXXXXXX","account_id":"XXXXX","change_request":"RITM0021337","cu
stomer_id":"0000000","provider":"aws","customer":"new","region":"us-east-1","network_id":"vpc-00000000","cidr":"10.10.10.0/00","egress_filter":[""],"route_tables":[],"transit_connected":true,"high_availability":true,"service_now_notify":true,"public_subnets"
:["10.10.10.0/00","10.10.00.00/00"]}}
{'error_message': TypeError('string indices must be integers'), 'status_code': '1050'}

A: Change
# WRONG: json.dumps() converts the input string to a *JSON string value*,
#        which json.loads() then reconverts to a string.
#        The whole operations is equivalent to:
#           jsonInput = sys.argv[1]
jsonInput = json.loads(json.dumps(sys.argv[1]));

to:
# OK: parse the JSON text as-is.
jsonInput = json.loads(sys.argv[1]);

json.dumps() is for converting Python objects to JSON. In your case, that object was a string, and the result was a single JSON string value.
Applying json.loads() to the result effectively reconverts that JSON string value to the original string, and the only way to index into a string object is to use a numeric (character-position) index - hence the error message.


text:
Q: What if adapter class needs to be type hinted? (php) so a basic, working example:
class Test
{
    public function test()
    {
        return 'a';
    }
}

/**
 * @mixin Adapter
 */
class TestAdapter
{
    /**
     * @var Test
     */
    private $test;

    public function __construct(Test $test)
    {
        $this->test = $test;
    }

    public function __call($method, $args)
    {
        switch($method)
        {
            case 'test' :
                return 'decorated: '.$this->test();
            default :
                throw new \Exception('Unhandled method call: '.$method);
        }
    }
}

$test = new Test();
$testAdapter = new TestAdapter($test);
$testAdapter->test();

so far so good. But what if this Test is needed for someone? What if abstraction comes in place?
abstract class TestAbstract
{
    public abstract function t();
}

class Test extends TestAbstract
{
    public function t()
    {
        return 't';
    }

    public function test()
    {
        return 'test';
    }
}

class WannaTest
{
    public function __construct(Test $test)
    {
    }
}

this way:
$test = new Test();
$testAdapter = new TestAdapter($test);
$wannaTest = new WannaTest($testAdapter); // would throw fatal!

this wont work, since WannaTest expects Test.
Of course I could extends TestAdapter:
class TestAdapter extends Test
{
    public function t()
    {
        // now I cant mock it!
    }
}

but in that case, if I have 10 abstract method, I would have to implement them, even though one of them is only used. This way I cant use __call either as a proxy. So its a bit smelly. How to workaround that? Removing typehint is not an option...

A: You can create an inline class that extends Test and decorates the method as you need it to. Here's an example.
class TestDecorator //decorator sounds more appropriate
{

    public static function decorate(Test $test) {
       return new class($test) extends Test {
            private $test;
            public function __construct(Test $test) {
                 $this->test = $test;
            }
            public function test() {
                return 'decorated: '.$this->test->test();
            }
        };

    }
}
$test = new Test();
$decorated = TestDecorator::decorate($test);
echo $decorated->test();

Type-hinting Test should now work since the decorated class does actually extend Test


text:
Q: How to fill by counting last and forward N values with static window in pandas I have a calendar data of type of dayworks - the day is the holiday or not.
I want to create a new feautures:

*

*The value in the cell is the number of holidays in the week.

*The value in the cell is the number of holidays in the N-window (right and left windows). In example - N=5 (and including current value)

Example:
         is_holiday   feature_1 feature_2
idx
0          0              2         0
1          0              2         1
2          0              2         2
3          0              2         2
4          0              2         2
5          1              2         2
6          1              2         2
7          0              3         3
8          0              3         4
9          0              3         5
10         0              3         4
11         1              3         3
12         1              3         3
13         1              3         3
...

A: I think you need grouping for each 7 values and aggregate sum and for second is used Series.rolling:
df['f1'] = df.groupby(df.index // 7)['is_holiday'].transform('sum')
df['f2'] = df['is_holiday'].rolling(9, center=True, min_periods=1).sum().astype(int)
print (df)
     is_holiday  feature_1  feature_2  f1  f2
idx
0             0          2          0   2   0
1             0          2          1   2   1
2             0          2          2   2   2
3             0          2          2   2   2
4             0          2          2   2   2
5             1          2          2   2   2
6             1          2          2   2   2
7             0          3          3   3   3
8             0          3          4   3   4
9             0          3          5   3   5
10            0          3          4   3   4
11            1          3          3   3   3
12            1          3          3   3   3
13            1          3          3   3   3


text:
Q: Replace dual-boot system with ubuntu currently my file system is dual boot between windows 7 and ubuntu 16.04. First I wanted to allocate space between the two operating systems, but now i decided it is best to just erase windows in favor of ubuntu. As far as I know, I have two options.

*

*Boot into windows, boot from a brand new ubuntu usb stick, select "Replace xxx with ubuntu" (what stands in xxx? windows7/ubuntu?) The question is whether I have to deinstall the old ubuntu first or if the installer is capable of obliterating all partitions from the entire disk space and build a brand new system.

*Remove windows 7 from the dual boot setup and allocate disk space to ubuntu. I would prefer that option as my ubuntu system and all the configurations would remain but am afraid of not being able to manage possible problems that might occur. Also it seems problematic that the free disk space would be left from my partition.
What is the easiest and safest way for someone who does not know anything about partitioning aside from pulling sliders in the windows menu?

A: If you completely want to remove Windows, then I would recommend using GParted. It is a very comprehensive partitioning tool.
Here are the steps I would take:

*

*Take a backup of all files you don't want to lose

*Boot from your bootable ubuntu usb

*Try to only have your OS-drive be attached (e.g. no extra usb or external hdd), to minimise chance to do something wrong

*Open GParted, let it scan your disks

*Remove the windows partition(s), this can be done by selecting the partition and clicking the trashcan in the top bar

*Resize the extended partition that contains the main ext4 file system and the swap partition so it fills the entire disk. This can be done by right-clicking on the partition and choosing the resize/move tool

*Move the swap partition to the end, also done with the resize/move-tool. At this point, there may be a warning telling you that moving partitions may cause your OS to fail to boot. Should your system fail to boot after the fact, take a look at this thread.

*enlarge the main file system (ext4 partition) to fill the entire extended partition (the box around the ext4 and swap partitions)

*Apply the operations via the top bar

The first step is the most important one, do not try to skip it
It might take a couple of hours to move partitions, depending on the size of the partition. To be clear, this will destroy your windows-partition, you will lose all files from this partition.
If you have any more questions, ask them in the comments.


text:
Q: SQL Group rows together based on specified Value I'm looking to group rows together based on a set value. so I have a query that has 100 rows I would like to group them by every 10 rows and assign a number starting with 1.
So
First 10 rows would be assigned 1, next 10 get 2 next 10 get 3 and so on.
I have tried working this out with row_number, rank etc but not been able to do it.
is this possible?
Cheers
Patrick

A: Based on ROW_NUMBER and integer division:
(Row_Number () Over (ORDER BY whatever) -1) / 10 + 1