问:
Installation of hpbandster and ConfigSpace failed
I created a virtual environment using virtualenv venv -p python3 and source venv/bin/activate under Ubuntu 18.04. Then I tried to install hpbandster which installes ConfigSpace as requirement. The installation of ConfigSpace failes throwing the following error:

```<code>Building wheel for ConfigSpace (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-aa1hsmn9
       cwd: /tmp/pip-install-lp6jkyvm/ConfigSpace/
  Complete output (33 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/ConfigSpace
  copying ConfigSpace/exceptions.py -> build/lib.linux-x86_64-3.7/ConfigSpace
  copying ConfigSpace/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
  copying ConfigSpace/__version__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
  creating build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/pcs.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/irace.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/json.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/pcs_new.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx
  copying ConfigSpace/nx/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
  copying ConfigSpace/nx/release.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
  copying ConfigSpace/nx/exception.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  copying ConfigSpace/nx/algorithms/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  copying ConfigSpace/nx/algorithms/cycles.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  copying ConfigSpace/nx/algorithms/dag.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  copying ConfigSpace/nx/classes/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  copying ConfigSpace/nx/classes/digraph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  copying ConfigSpace/nx/classes/graph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
  copying ConfigSpace/nx/algorithms/components/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
  copying ConfigSpace/nx/algorithms/components/strongly_connected.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
  running build_ext
  building 'ConfigSpace.hyperparameters' extension
  error: unknown file type '.pyx' (from 'ConfigSpace/hyperparameters.pyx')
  ----------------------------------------
  ERROR: Failed building wheel for ConfigSpace
  Running setup.py clean for ConfigSpace
  Building wheel for netifaces (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/netifaces/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/netifaces/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-c5zv0th0
       cwd: /tmp/pip-install-lp6jkyvm/netifaces/
  Complete output (20 lines):
  running bdist_wheel
  running build
  running build_ext
  checking for getifaddrs...found.
  checking for getnameinfo...found.
  checking for IPv6 socket IOCTLs...not found.
  checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h netrose/rose.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h.
  checking whether struct sockaddr has a length field...no.
  checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un rose ash ec ll atmpvc atmsvc dn irda llc.
  checking for routing socket support...no.
  checking for sysctl(CTL_NET...) support...no.
  checking for netlink support...yes.
  will use netlink to read routing table
  building 'netifaces' extension
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNETIFACES_VERSION=0.10.9 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_NETROSE_ROSE_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ROSE=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/home/anonymous/Documents/some_folder/venv/include -I/usr/include/python3.7m -c netifaces.c -o build/temp.linux-x86_64-3.7/netifaces.o
  netifaces.c:1:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for netifaces
  Running setup.py clean for netifaces
Failed to build ConfigSpace netifaces
Installing collected packages: cython, ConfigSpace, pytz, pandas, patsy, statsmodels, serpent, Pyro4, netifaces, hpbandster
    Running setup.py install for ConfigSpace ... error
    ERROR: Command errored out with exit status 1:
     command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c6j8cu8m/install-record.txt --single-version-externally-managed --compile --install-headers /home/anonymous/Documents/some_folder/venv/include/site/python3.7/ConfigSpace
         cwd: /tmp/pip-install-lp6jkyvm/ConfigSpace/
    Complete output (46 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/ConfigSpace
    copying ConfigSpace/exceptions.py -> build/lib.linux-x86_64-3.7/ConfigSpace
    copying ConfigSpace/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
    copying ConfigSpace/__version__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
    creating build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/pcs.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/irace.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/json.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/pcs_new.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx
    copying ConfigSpace/nx/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
    copying ConfigSpace/nx/release.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
    copying ConfigSpace/nx/exception.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    copying ConfigSpace/nx/algorithms/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    copying ConfigSpace/nx/algorithms/cycles.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    copying ConfigSpace/nx/algorithms/dag.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    copying ConfigSpace/nx/classes/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    copying ConfigSpace/nx/classes/digraph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    copying ConfigSpace/nx/classes/graph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
    copying ConfigSpace/nx/algorithms/components/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
    copying ConfigSpace/nx/algorithms/components/strongly_connected.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
    running build_ext
    cythoning ConfigSpace/hyperparameters.pyx to ConfigSpace/hyperparameters.c
    skipping 'ConfigSpace/forbidden.c' Cython extension (up-to-date)
    skipping 'ConfigSpace/conditions.c' Cython extension (up-to-date)
    skipping 'ConfigSpace/c_util.c' Cython extension (up-to-date)
    cythoning ConfigSpace/util.pyx to ConfigSpace/util.c
    skipping 'ConfigSpace/configuration_space.c' Cython extension (up-to-date)
    building 'ConfigSpace.hyperparameters' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/ConfigSpace
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/anonymous/Documents/some_folder/venv/include -I/usr/include/python3.7m -I/home/anonymous/Documents/some_folder/venv/lib/python3.7/site-packages/numpy/core/include -c ConfigSpace/hyperparameters.c -o build/temp.linux-x86_64-3.7/ConfigSpace/hyperparameters.o
    ConfigSpace/hyperparameters.c:4:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c6j8cu8m/install-record.txt --single-version-externally-managed --compile --install-headers /home/anonymous/Documents/some_folder/venv/include/site/python3.7/ConfigSpace Check the logs for full command output.
</code>```

I do not have sudo permission so I have to keep using Python 3.7.5. What causes this problem and how can I fix it?

答:
error: unknown file type '.pyx' (from 'ConfigSpace/hyperparameters.pyx')

There is a bug report 130, still open. The package seems to be broken and is not pip-installable.

Try to install Cython:

```<code>pip install Cython
pip install ConfigSpace
</code>```

fatal error: Python.h: No such file

You should install Python development/header files. Without superuser access install them from Python source code and direct compiler to use your local headers.

Body:
I created a virtual environment using virtualenv venv -p python3 and source venv/bin/activate under Ubuntu 18.04. Then I tried to install hpbandster which installes ConfigSpace as requirement. The installation of ConfigSpace failes throwing the following error:

Building wheel for ConfigSpace (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-aa1hsmn9
       cwd: /tmp/pip-install-lp6jkyvm/ConfigSpace/
  Complete output (33 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/ConfigSpace
  copying ConfigSpace/exceptions.py -> build/lib.linux-x86_64-3.7/ConfigSpace
  copying ConfigSpace/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
  copying ConfigSpace/__version__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
  creating build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/pcs.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/irace.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/json.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  copying ConfigSpace/read_and_write/pcs_new.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx
  copying ConfigSpace/nx/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
  copying ConfigSpace/nx/release.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
  copying ConfigSpace/nx/exception.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  copying ConfigSpace/nx/algorithms/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  copying ConfigSpace/nx/algorithms/cycles.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  copying ConfigSpace/nx/algorithms/dag.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  copying ConfigSpace/nx/classes/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  copying ConfigSpace/nx/classes/digraph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  copying ConfigSpace/nx/classes/graph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
  creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
  copying ConfigSpace/nx/algorithms/components/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
  copying ConfigSpace/nx/algorithms/components/strongly_connected.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
  running build_ext
  building 'ConfigSpace.hyperparameters' extension
  error: unknown file type '.pyx' (from 'ConfigSpace/hyperparameters.pyx')
  ----------------------------------------
  ERROR: Failed building wheel for ConfigSpace
  Running setup.py clean for ConfigSpace
  Building wheel for netifaces (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/netifaces/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/netifaces/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-c5zv0th0
       cwd: /tmp/pip-install-lp6jkyvm/netifaces/
  Complete output (20 lines):
  running bdist_wheel
  running build
  running build_ext
  checking for getifaddrs...found.
  checking for getnameinfo...found.
  checking for IPv6 socket IOCTLs...not found.
  checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h netrose/rose.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h.
  checking whether struct sockaddr has a length field...no.
  checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un rose ash ec ll atmpvc atmsvc dn irda llc.
  checking for routing socket support...no.
  checking for sysctl(CTL_NET...) support...no.
  checking for netlink support...yes.
  will use netlink to read routing table
  building 'netifaces' extension
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNETIFACES_VERSION=0.10.9 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_NETROSE_ROSE_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ROSE=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/home/anonymous/Documents/some_folder/venv/include -I/usr/include/python3.7m -c netifaces.c -o build/temp.linux-x86_64-3.7/netifaces.o
  netifaces.c:1:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for netifaces
  Running setup.py clean for netifaces
Failed to build ConfigSpace netifaces
Installing collected packages: cython, ConfigSpace, pytz, pandas, patsy, statsmodels, serpent, Pyro4, netifaces, hpbandster
    Running setup.py install for ConfigSpace ... error
    ERROR: Command errored out with exit status 1:
     command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c6j8cu8m/install-record.txt --single-version-externally-managed --compile --install-headers /home/anonymous/Documents/some_folder/venv/include/site/python3.7/ConfigSpace
         cwd: /tmp/pip-install-lp6jkyvm/ConfigSpace/
    Complete output (46 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/ConfigSpace
    copying ConfigSpace/exceptions.py -> build/lib.linux-x86_64-3.7/ConfigSpace
    copying ConfigSpace/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
    copying ConfigSpace/__version__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
    creating build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/pcs.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/irace.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/json.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    copying ConfigSpace/read_and_write/pcs_new.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx
    copying ConfigSpace/nx/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
    copying ConfigSpace/nx/release.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
    copying ConfigSpace/nx/exception.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    copying ConfigSpace/nx/algorithms/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    copying ConfigSpace/nx/algorithms/cycles.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    copying ConfigSpace/nx/algorithms/dag.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    copying ConfigSpace/nx/classes/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    copying ConfigSpace/nx/classes/digraph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    copying ConfigSpace/nx/classes/graph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
    creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
    copying ConfigSpace/nx/algorithms/components/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
    copying ConfigSpace/nx/algorithms/components/strongly_connected.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
    running build_ext
    cythoning ConfigSpace/hyperparameters.pyx to ConfigSpace/hyperparameters.c
    skipping 'ConfigSpace/forbidden.c' Cython extension (up-to-date)
    skipping 'ConfigSpace/conditions.c' Cython extension (up-to-date)
    skipping 'ConfigSpace/c_util.c' Cython extension (up-to-date)
    cythoning ConfigSpace/util.pyx to ConfigSpace/util.c
    skipping 'ConfigSpace/configuration_space.c' Cython extension (up-to-date)
    building 'ConfigSpace.hyperparameters' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/ConfigSpace
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/anonymous/Documents/some_folder/venv/include -I/usr/include/python3.7m -I/home/anonymous/Documents/some_folder/venv/lib/python3.7/site-packages/numpy/core/include -c ConfigSpace/hyperparameters.c -o build/temp.linux-x86_64-3.7/ConfigSpace/hyperparameters.o
    ConfigSpace/hyperparameters.c:4:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c6j8cu8m/install-record.txt --single-version-externally-managed --compile --install-headers /home/anonymous/Documents/some_folder/venv/include/site/python3.7/ConfigSpace Check the logs for full command output.

I do not have sudo permission so I have to keep using Python 3.7.5. What causes this problem and how can I fix it?

Body:
error: unknown file type '.pyx' (from 'ConfigSpace/hyperparameters.pyx')

There is a bug report 130, still open. The package seems to be broken and is not pip-installable.

Try to install Cython:

pip install Cython
pip install ConfigSpace

fatal error: Python.h: No such file

You should install Python development/header files. Without superuser access install them from Python source code and direct compiler to use your local headers.


来源: stackexchange

问:
React js a problem about updating the state value
i'am just a newbie at React , i'am trying to make a form , when submitting i call a function "handleSubmit"  that saves all the information into the state, and then displaying it into a grid , but it wont work for some reasons .
i really do need your help : here is my code :

```<code>  export default class products extends React.Component  {
    constructor() {
      super();
      this.handleSubmit = this.handleSubmit.bind(this);
      this.state =
                {
                   QrCode: ''
                   }
    }

    handleSubmit(event) {
      event.preventDefault();
      const data = new FormData(event.target);

       data.set('username', data.get('username').toUpperCase());

      this.setState({QrCode: data});
      console.log(this.state);

    }

    render() {

      return (
      <div >
        <div >
              <form onSubmit={this.handleSubmit}>
                  <label htmlFor="username">Enter username</label>
                  <input id="username" name="username" type="text" />
                  <button>Send data!</button>
              </form>
            </div>

            <div style={{margin: '10%', marginTop : '5%'}}>

                <GridComponent dataSource={this.state} />

            </div>

        </div>

      );
    }
  }
</code>```

and here what i get :
i keep getting empty array

and thank you.

答:
In React, you don't need use form to take values from inputs.

```<code>export default class App extends React.Component {
  constructor() {
    super();
    this.state = {
      userName: ""
    };
  }
  render() {
    return (
      <div className="App">
        <label htmlFor="username">Enter username</label>
        <input
          value={this.state.userName}
          onChange={e => this.setState({ userName: e.target.value })}
          name="username"
          type="text"
        />
        <button
          onClick={() => {
            alert(this.state.userName);
          }}
        >
          Send data!
        </button>
      </div>
    );
  }
}
</code>```

Hope it help you!

ContentLicense: CC BY-SA 4.0

Body:
i'am just a newbie at React , i'am trying to make a form , when submitting i call a function "handleSubmit"  that saves all the information into the state, and then displaying it into a grid , but it wont work for some reasons .
i really do need your help : here is my code :

  export default class products extends React.Component  {
    constructor() {
      super();
      this.handleSubmit = this.handleSubmit.bind(this);
      this.state =
                {
                   QrCode: ''
                   }
    }

    handleSubmit(event) {
      event.preventDefault();
      const data = new FormData(event.target);

       data.set('username', data.get('username').toUpperCase());

      this.setState({QrCode: data});
      console.log(this.state);

    }

    render() {

      return (

              <form onSubmit={this.handleSubmit}>
                  Enter username
                  <input id="username" name="username" type="text" />
                  <button>Send data!</button>
              </form>

                <GridComponent dataSource={this.state} />

      );
    }
  }

and here what i get :
i keep getting empty array

and thank you.

Body:
In React, you don't need use form to take values from inputs.

export default class App extends React.Component {
  constructor() {
    super();
    this.state = {
      userName: ""
    };
  }
  render() {
    return (
      <div className="App">
        <label htmlFor="username">Enter username</label>
        <input
          value={this.state.userName}
          onChange={e => this.setState({ userName: e.target.value })}
          name="username"
          type="text"
        />
        <button
          onClick={() => {
            alert(this.state.userName);
          }}
        >
          Send data!
        </button>
      </div>
    );
  }
}

Hope it help you!


问:
Convert AS project to Flex project in Flex Builder
Is there an easy way of converting a Actionscript 3 project to a Flex project in Flex Builder? When i right click on the project and hover "Flex Project Nature", all options are greyed out</p>

答:
It's a little dirty, but it works.

Delete the project in Flex Builder's Navigator.

It will ask if you want to delete the files from the file system too. Keep them.

Create a new Flex project in the same directory as the ActionScript project.

The old files will be unchanged, but the new project will have the Flex Project nature. If a file already exists that has the same name as a file that the project wizard wants to create, the existing file will be not be deleted.

If you have custom command line arguments, source or library directories, or any other project-specific settings, you may have to reset them.

Just in case something goes wrong, be sure to back up your project directory first. I've never lost files when I've recreated a Flex Builder project, though.

OwnerDisplayName: finpingvin

ContentLicense: CC BY-SA 2.5

OwnerDisplayName: joshtynjala


问:
Trying to pass values as navigation params but cant get the parameter in another component
I'm trying to implement i18n on my app, i've set a file named SettingsScreen.js, this file has a lot buttons to change languages (see the example below), and another file called HomeScreen.js, this file was supposed to get the param passed through SettingsScreen.js and change the language of the app, but i got this error:

So i'm gonna post the rest of the code below:

HomeScreen.js:

```<code>export default function HomeScreen({ route, navigation }) {
  let { lang } = route.params;

  i18n.locale = lang;

  <Rest of the content/>
}
</code>```

SettingsScreen.js:

```<code>export default function SettingsScreen({ navigation }) {
  let setPortuguese = () => {
    navigation.navigate("Dashboard", {
      screen: "HomeScreen",
      params: { lang: "pt" }
    })

    <Rest of the content />
  }
}
</code>```

app.js:

```<code>export default function App() {

  return (
    <NavigationContainer>
      <Drawer.Navigator>
        <Drawer.Screen name="Dashboard" component={Dashboard} />
        <Drawer.Screen name="Settings" component={SettingsScreen} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}
</code>```

答:
The issue is calling navigation.navigate passing wrongs params.

Try this code:

SettingsScreen.js:

export default function SettingsScreen({ navigation }) {
  let setPortuguese = () => {
    navigation.navigate("HomeScreen", {
      lang: "pt"
    })

    <Rest of the content />
  }
}
```

Body:
I'm trying to implement i18n on my app, i've set a file named SettingsScreen.js, this file has a lot buttons to change languages (see the example below), and another file called HomeScreen.js, this file was supposed to get the param passed through SettingsScreen.js and change the language of the app, but i got this error:

So i'm gonna post the rest of the code below:

HomeScreen.js:

export default function HomeScreen({ route, navigation }) {
  let { lang } = route.params;

  i18n.locale = lang;

  <Rest of the content/>
}

SettingsScreen.js:

export default function SettingsScreen({ navigation }) {
  let setPortuguese = () => {
    navigation.navigate("Dashboard", {
      screen: "HomeScreen",
      params: { lang: "pt" }
    })

    <Rest of the content />
  }
}

app.js:

export default function App() {

  return (
    <NavigationContainer>
      <Drawer.Navigator>
        <Drawer.Screen name="Dashboard" component={Dashboard} />
        <Drawer.Screen name="Settings" component={SettingsScreen} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}


问:
Is it possible to disable AMP Email on mobile devices?
As a developer, is it possible to disable AMP Email on mobile devices so that the text/html, MIME content-type would display instead?

答: No. You can, however, hide AMP elements and replace them by something non-AMP using media-queries and good old display:none (and probably some additional cross-email-client-compatible nonsense), but I am not sure if that is what one actually needs, unless you target mso obv. as then everything is allowed to me.


问:
Add elements of a list together python
I have this list

```<code>r1 = 2
r2 = 4
r3 = 5
r4 = 9
lst = [r1, r2, r3, r4]
</code>```

I want to create a new list which looks like this:

```<code>new_lst = [r1, r1+r2, r1+r2+r3, r1+r2+r3+r4]
</code>```

Except in the new_lst r1 is named "x1", r1+r2 named "x2 etc.

I'm currently doing this using:

```<code>new_lst = []
new_lst.append(sum(lst[0:1]))
new_lst.append(sum(lst[0:2]))
new_lst.append(sum(lst[0:3]))
new_lst.append(sum(lst[0:4]))
</code>```

And then refer to this list by saying if "n" is between 0 and x1, x1 and x1+x2 etc; print y. i.e.

```<code> if n >=0 and n <= new_lst[0]:
      print(y)
 elif n >=new_lst[0] and n <= new_lst[1]:
      print(z)
</code>```

答:
The code below does create the new_list.</p>

```<code>lst = [2,4,5,9]
new_lst = [sum(lst[0:i+1]) for i,v in enumerate(lst)]
</code>```

Title: Add elements of a list together python

Body:
I have this list

r1 = 2
r2 = 4
r3 = 5
r4 = 9
lst = [r1, r2, r3, r4]

I want to create a new list which looks like this:

new_lst = [r1, r1+r2, r1+r2+r3, r1+r2+r3+r4]

Except in the new_lst r1 is named "x1", r1+r2 named "x2 etc.

I'm currently doing this using:

new_lst = []
new_lst.append(sum(lst[0:1]))
new_lst.append(sum(lst[0:2]))
new_lst.append(sum(lst[0:3]))
new_lst.append(sum(lst[0:4]))

And then refer to this list by saying if "n" is between 0 and x1, x1 and x1+x2 etc; print y. i.e.

 if n >=0 and n <= new_lst[0]:
      print(y)
 elif n >=new_lst[0] and n <= new_lst[1]:
      print(z)

Body:
The code below does create the new_list.

lst = [2,4,5,9]
new_lst = [sum(lst[0:i+1]) for i,v in enumerate(lst)]


问:
git push is failing because of not asking token for login
I have a github repository in my organisation where I am a member of it.
I did cloning of that repository from intelliJ into using the token which i have created in my git account. I have added the remote in intelliJ using the same server name and token.

I am able to clone this repository and after updating the code, while trying to push the code  back to repository it is again asking for the userID and password. It is not showing the option to login with token itself, as shown below. (If I give the username and password instead of token it will not work)

Because of this i am not able to push any code changes into git. This was working fine earlier either without asking any login page or with login page which have option to provide token. I didnt make any changes in settings, but now facing this issue for last few days.

Is there anything that i have to make changes in settings?
Any help appreciated!

答: You didn't created your sshkey and added to your gitlab account that's why it is asking for user id and password again, Work after setting ssh key is better approach to work on project </p>


问:
Incorrect display of data from two combined queries
I have two tables: Employees and Clients.
I wanted to make a query from two tables that do not have any relations, but for some reason the data is not displayed correctly.

worker:

users:

The Employees table doesn't have an employee with this type of data, and the Users table does, but I don't understand why the worker field appears in the results instead of the user field

答:
From the MySQL documentation (emphasis added):

UNION combines the result from multiple SELECT statements into a single result set. The result set column names are taken from the column names of the first SELECT statement.

Your query is behaving as expected.


问:
Set up WordPress in a pc running XAMPP and IIS
I'm trying to install WordPress on my laptop I've already installed XAMPP and have Apache and MySQL running, I downloaded WordPress and extracted it inside htdocs, my laptop already had IIS installed.

When I go to localhost/WordPress I get 404 -Not found, looking at detailed info of the error the Physical path is set to C:\inetpub\wwwroot\WordPress and the label of the chrome tab is "IIS 8.5 detailed Error".

This makes me think that my localhost is set to run with IIS and not with XAMPP.

How can I change my localhost to run with XAMPP htdocs instead of IIS wwwroot?

答:
I think the best way is change listen port of XAMMP apache server or IIS...
I don't have IIS but think the two servers listening port 80...

In XAMMP stop all services and go to config for Apache module and chose httpd.conf.

Then replace LISTEN 80 (around line 58) to other port you want (eg : LISTEN 8080),

and ServerName localhost:8080(around line 225) with same listened port...

Now to run WordPress on XAMMP you have to run url localhost:8080/WordPress, or replace `8080' to your chosen port...

see this tuto or this answer for more information...

Only careful to don't chose any reserved port to avoid conflicts, see List_of_TCP_and_UDP_port_numbers for more information...

Or if you run windows, you can use WAMPSERVER who comes with best interface to control Apache virtualhost's.


问:
Get a list of all available languages in flutter
I need all available languages (with variants, like "English (United Kingdom)" )  in a DropdownButton, i couldn't find in the flutter SDK or dart builtins, so i ended scraping this site, and creating a filelang_list.dart with the following content

const LANGLIST = ["Afrikaans","Afrikaans (South Africa)","Arabic","Arabic (U.A.E.)","Arabic (Bahrain)","Arabic (Algeria)","Arabic (Egypt)","Arabic (Iraq)","Arabic (Jordan)","Arabic (Kuwait)","Arabic (Lebanon)","Arabic (Libya)","Arabic (Morocco)","Arabic (Oman)","Arabic (Qatar)","Arabic (Saudi Arabia)","Arabic (Syria)","Arabic (Tunisia)","Arabic (Yemen)","Azeri (Latin)","Azeri (Latin) (Azerbaijan)","Azeri (Cyrillic) (Azerbaijan)","Belarusian","Belarusian (Belarus)","Bulgarian","Bulgarian (Bulgaria)","Bosnian (Bosnia and Herzegovina)","Catalan","Catalan (Spain)","Czech","Czech (Czech Republic)","Welsh","Welsh (United Kingdom)","Danish","Danish (Denmark)","German","German (Austria)","German (Switzerland)","German (Germany)","German (Liechtenstein)","German (Luxembourg)","Divehi","Divehi (Maldives)","Greek","Greek (Greece)","English","English (Australia)","English (Belize)","English (Canada)","English (Caribbean)","English (United Kingdom)","English (Ireland)","English (Jamaica)","English (New Zealand)","English (Republic of the Philippines)","English (Trinidad and Tobago)","English (United States)","English (South Africa)","English (Zimbabwe)","Esperanto","Spanish","Spanish (Argentina)","Spanish (Bolivia)","Spanish (Chile)","Spanish (Colombia)","Spanish (Costa Rica)","Spanish (Dominican Republic)","Spanish (Ecuador)","Spanish (Castilian)","Spanish (Spain)","Spanish (Guatemala)","Spanish (Honduras)","Spanish (Mexico)","Spanish (Nicaragua)","Spanish (Panama)","Spanish (Peru)","Spanish (Puerto Rico)","Spanish (Paraguay)","Spanish (El Salvador)","Spanish (Uruguay)","Spanish (Venezuela)","Estonian","Estonian (Estonia)","Basque","Basque (Spain)","Farsi","Farsi (Iran)","Finnish","Finnish (Finland)","Faroese","Faroese (Faroe Islands)","French","French (Belgium)","French (Canada)","French (Switzerland)","French (France)","French (Luxembourg)","French (Principality of Monaco)","Galician","Galician (Spain)","Gujarati","Gujarati (India)","Hebrew","Hebrew (Israel)","Hindi","Hindi (India)","Croatian","Croatian (Bosnia and Herzegovina)","Croatian (Croatia)","Hungarian","Hungarian (Hungary)","Armenian","Armenian (Armenia)","Indonesian","Indonesian (Indonesia)","Icelandic","Icelandic (Iceland)","Italian","Italian (Switzerland)","Italian (Italy)","Japanese","Japanese (Japan)","Georgian","Georgian (Georgia)","Kazakh","Kazakh (Kazakhstan)","Kannada","Kannada (India)","Korean","Korean (Korea)","Konkani","Konkani (India)","Kyrgyz","Kyrgyz (Kyrgyzstan)","Lithuanian","Lithuanian (Lithuania)","Latvian","Latvian (Latvia)","Maori","Maori (New Zealand)","FYRO Macedonian","FYRO Macedonian (Former Yugoslav Republic of Macedonia)","Mongolian","Mongolian (Mongolia)","Marathi","Marathi (India)","Malay","Malay (Brunei Darussalam)","Malay (Malaysia)","Maltese","Maltese (Malta)","Norwegian (Bokm?l)","Norwegian (Bokm?l) (Norway)","Dutch","Dutch (Belgium)","Dutch (Netherlands)","Norwegian (Nynorsk) (Norway)","Northern Sotho","Northern Sotho (South Africa)","Punjabi","Punjabi (India)","Polish","Polish (Poland)","Pashto","Pashto (Afghanistan)","Portuguese","Portuguese (Brazil)","Portuguese (Portugal)","Quechua","Quechua (Bolivia)","Quechua (Ecuador)","Quechua (Peru)","Romanian","Romanian (Romania)","Russian","Russian (Russia)","Sanskrit","Sanskrit (India)","Sami (Northern)","Sami (Northern) (Finland)","Sami (Skolt) (Finland)","Sami (Inari) (Finland)","Sami (Northern) (Norway)","Sami (Lule) (Norway)","Sami (Southern) (Norway)","Sami (Northern) (Sweden)","Sami (Lule) (Sweden)","Sami (Southern) (Sweden)","Slovak","Slovak (Slovakia)","Slovenian","Slovenian (Slovenia)","Albanian","Albanian (Albania)","Serbian (Latin) (Bosnia and Herzegovina)","Serbian (Cyrillic) (Bosnia and Herzegovina)","Serbian (Latin) (Serbia and Montenegro)","Serbian (Cyrillic) (Serbia and Montenegro)","Swedish","Swedish (Finland)","Swedish (Sweden)","Swahili","Swahili (Kenya)","Syriac","Syriac (Syria)","Tamil","Tamil (India)","Telugu","Telugu (India)","Thai","Thai (Thailand)","Tagalog","Tagalog (Philippines)","Tswana","Tswana (South Africa)","Turkish","Turkish (Turkey)","Tatar","Tatar (Russia)","Tsonga","Ukrainian","Ukrainian (Ukraine)","Urdu","Urdu (Islamic Republic of Pakistan)","Uzbek (Latin)","Uzbek (Latin) (Uzbekistan)","Uzbek (Cyrillic) (Uzbekistan)","Vietnamese","Vietnamese (Viet Nam)","Xhosa","Xhosa (South Africa)","Chinese","Chinese (S)","Chinese (Hong Kong)","Chinese (Macau)","Chinese (Singapore)","Chinese (T)","Zulu","Zulu (South Africa)"];
```

so i can import in other files and uses this list.

Is this implementation ok? is there a method from flutter that does the same thing?

答: Flutter and Dart don't have this built in. If this solution works for you, I don't see an issue with it. </p>

Body:
I need all available languages (with variants, like "English (United Kingdom)" )  in a DropdownButton, i couldn't find in the flutter SDK or dart builtins, so i ended scraping this site, and creating a filelang_list.dart with the following content

const LANGLIST = ["Afrikaans","Afrikaans (South Africa)","Arabic","Arabic (U.A.E.)","Arabic (Bahrain)","Arabic (Algeria)","Arabic (Egypt)","Arabic (Iraq)","Arabic (Jordan)","Arabic (Kuwait)","Arabic (Lebanon)","Arabic (Libya)","Arabic (Morocco)","Arabic (Oman)","Arabic (Qatar)","Arabic (Saudi Arabia)","Arabic (Syria)","Arabic (Tunisia)","Arabic (Yemen)","Azeri (Latin)","Azeri (Latin) (Azerbaijan)","Azeri (Cyrillic) (Azerbaijan)","Belarusian","Belarusian (Belarus)","Bulgarian","Bulgarian (Bulgaria)","Bosnian (Bosnia and Herzegovina)","Catalan","Catalan (Spain)","Czech","Czech (Czech Republic)","Welsh","Welsh (United Kingdom)","Danish","Danish (Denmark)","German","German (Austria)","German (Switzerland)","German (Germany)","German (Liechtenstein)","German (Luxembourg)","Divehi","Divehi (Maldives)","Greek","Greek (Greece)","English","English (Australia)","English (Belize)","English (Canada)","English (Caribbean)","English (United Kingdom)","English (Ireland)","English (Jamaica)","English (New Zealand)","English (Republic of the Philippines)","English (Trinidad and Tobago)","English (United States)","English (South Africa)","English (Zimbabwe)","Esperanto","Spanish","Spanish (Argentina)","Spanish (Bolivia)","Spanish (Chile)","Spanish (Colombia)","Spanish (Costa Rica)","Spanish (Dominican Republic)","Spanish (Ecuador)","Spanish (Castilian)","Spanish (Spain)","Spanish (Guatemala)","Spanish (Honduras)","Spanish (Mexico)","Spanish (Nicaragua)","Spanish (Panama)","Spanish (Peru)","Spanish (Puerto Rico)","Spanish (Paraguay)","Spanish (El Salvador)","Spanish (Uruguay)","Spanish (Venezuela)","Estonian","Estonian (Estonia)","Basque","Basque (Spain)","Farsi","Farsi (Iran)","Finnish","Finnish (Finland)","Faroese","Faroese (Faroe Islands)","French","French (Belgium)","French (Canada)","French (Switzerland)","French (France)","French (Luxembourg)","French (Principality of Monaco)","Galician","Galician (Spain)","Gujarati","Gujarati (India)","Hebrew","Hebrew (Israel)","Hindi","Hindi (India)","Croatian","Croatian (Bosnia and Herzegovina)","Croatian (Croatia)","Hungarian","Hungarian (Hungary)","Armenian","Armenian (Armenia)","Indonesian","Indonesian (Indonesia)","Icelandic","Icelandic (Iceland)","Italian","Italian (Switzerland)","Italian (Italy)","Japanese","Japanese (Japan)","Georgian","Georgian (Georgia)","Kazakh","Kazakh (Kazakhstan)","Kannada","Kannada (India)","Korean","Korean (Korea)","Konkani","Konkani (India)","Kyrgyz","Kyrgyz (Kyrgyzstan)","Lithuanian","Lithuanian (Lithuania)","Latvian","Latvian (Latvia)","Maori","Maori (New Zealand)","FYRO Macedonian","FYRO Macedonian (Former Yugoslav Republic of Macedonia)","Mongolian","Mongolian (Mongolia)","Marathi","Marathi (India)","Malay","Malay (Brunei Darussalam)","Malay (Malaysia)","Maltese","Maltese (Malta)","Norwegian (Bokm?l)","Norwegian (Bokm?l) (Norway)","Dutch","Dutch (Belgium)","Dutch (Netherlands)","Norwegian (Nynorsk) (Norway)","Northern Sotho","Northern Sotho (South Africa)","Punjabi","Punjabi (India)","Polish","Polish (Poland)","Pashto","Pashto (Afghanistan)","Portuguese","Portuguese (Brazil)","Portuguese (Portugal)","Quechua","Quechua (Bolivia)","Quechua (Ecuador)","Quechua (Peru)","Romanian","Romanian (Romania)","Russian","Russian (Russia)","Sanskrit","Sanskrit (India)","Sami (Northern)","Sami (Northern) (Finland)","Sami (Skolt) (Finland)","Sami (Inari) (Finland)","Sami (Northern) (Norway)","Sami (Lule) (Norway)","Sami (Southern) (Norway)","Sami (Northern) (Sweden)","Sami (Lule) (Sweden)","Sami (Southern) (Sweden)","Slovak","Slovak (Slovakia)","Slovenian","Slovenian (Slovenia)","Albanian","Albanian (Albania)","Serbian (Latin) (Bosnia and Herzegovina)","Serbian (Cyrillic) (Bosnia and Herzegovina)","Serbian (Latin) (Serbia and Montenegro)","Serbian (Cyrillic) (Serbia and Montenegro)","Swedish","Swedish (Finland)","Swedish (Sweden)","Swahili","Swahili (Kenya)","Syriac","Syriac (Syria)","Tamil","Tamil (India)","Telugu","Telugu (India)","Thai","Thai (Thailand)","Tagalog","Tagalog (Philippines)","Tswana","Tswana (South Africa)","Turkish","Turkish (Turkey)","Tatar","Tatar (Russia)","Tsonga","Ukrainian","Ukrainian (Ukraine)","Urdu","Urdu (Islamic Republic of Pakistan)","Uzbek (Latin)","Uzbek (Latin) (Uzbekistan)","Uzbek (Cyrillic) (Uzbekistan)","Vietnamese","Vietnamese (Viet Nam)","Xhosa","Xhosa (South Africa)","Chinese","Chinese (S)","Chinese (Hong Kong)","Chinese (Macau)","Chinese (Singapore)","Chinese (T)","Zulu","Zulu (South Africa)"];

so i can import in other files and uses this list.

Is this implementation ok? is there a method from flutter that does the same thing?


问:
How to hide both line and circle in Python Bokeh plot using legend click policy?
I have a Python Bokeh plot (multiple plot lines+circle) as follows:

```<code> output_notebook()

source = ColumnDataSource(da)

col_names = paises

p = figure(
 title = "A",
 x_axis_type="datetime",
 plot_width=800,
 plot_height=400,
 sizing_mode='scale_width',
 toolbar_location='above',
 tools ="box_zoom,reset,wheel_zoom" )

p_dict = dict()

for col, c, col_name in zip(da.columns, color, col_names):
 p_dict[col_name] = p.circle('date', col, source=source, color=c, size=3.5, line_width=0.5, fill_color=None)
 p_dict[col_name] = p.line('date', col, source=source, color=c, line_width=1)

 p.add_tools(HoverTool(
     toggleable=False,
     renderers=[p_dict[col_name]],
     tooltips=[('datetime','@date{%F}'),(col, f'@{col}')],
     formatters={'@date': 'datetime'}
 ))

legend = Legend(items=[(x, [p_dict[x]]) for x in p_dict])

p.add_layout(legend)

p.legend.click_policy="hide"

p.legend.label_text_font_size = "1vw"
p.legend.location = 'top_left'
p.left[0].formatter.use_scientific = False

show(p)

</code>```

I am using legend.click_policy="hide" to hide the lines but when clicking the legend, only hides the circle but not the line. Is there a way to hide both line and circle?

Thanks!

答:
If you can avoid constructing the legend manually, you can just provide the glyph functions with the same legend_name:

from bokeh.io import show
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure

source = ColumnDataSource(dict(x=[0, 1, 2], y=[0, 2, 1]))

p = figure()

p.line('x', 'y', source=source, legend_label='line_with_circles')
p.circle('x', 'y', source=source, legend_label='line_with_circles')

p.legend.click_policy = "hide"
p.legend.location = 'top_left'

show(p)
```

If you have to create the legend manually, just create a single legend item and provide it with both renderers.

Body:
I have a Python Bokeh plot (multiple plot lines+circle) as follows:

 output_notebook()

source = ColumnDataSource(da)

col_names = paises

p = figure(
 title = "A",
 x_axis_type="datetime",
 plot_width=800,
 plot_height=400,
 sizing_mode='scale_width',
 toolbar_location='above',
 tools ="box_zoom,reset,wheel_zoom" )

p_dict = dict()

for col, c, col_name in zip(da.columns, color, col_names):
 p_dict[col_name] = p.circle('date', col, source=source, color=c, size=3.5, line_width=0.5, fill_color=None)
 p_dict[col_name] = p.line('date', col, source=source, color=c, line_width=1)

 p.add_tools(HoverTool(
     toggleable=False,
     renderers=[p_dict[col_name]],
     tooltips=[('datetime','@date{%F}'),(col, f'@{col}')],
     formatters={'@date': 'datetime'}
 ))

legend = Legend(items=[(x, [p_dict[x]]) for x in p_dict])

p.add_layout(legend)

p.legend.click_policy="hide"

p.legend.label_text_font_size = "1vw"
p.legend.location = 'top_left'
p.left[0].formatter.use_scientific = False

show(p)

I am using legend.click_policy="hide" to hide the lines but when clicking the legend, only hides the circle but not the line. Is there a way to hide both line and circle?

Thanks!

Body:
If you can avoid constructing the legend manually, you can just provide the glyph functions with the same legend_name:

from bokeh.io import show
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure

source = ColumnDataSource(dict(x=[0, 1, 2], y=[0, 2, 1]))

p = figure()

p.line('x', 'y', source=source, legend_label='line_with_circles')
p.circle('x', 'y', source=source, legend_label='line_with_circles')

p.legend.click_policy = "hide"
p.legend.location = 'top_left'

show(p)

If you have to create the legend manually, just create a single legend item and provide it with both renderers.


问:
Running rake task on ubuntu startup
Hi I'm having a bit of trouble with setting up a rake task to run on startup/reboot of a ubuntu instance on Amazon EC2.

I need to make my instance start a simple delayed jobs "rake jobs:work" command when a new instance is launched, without me having to login using ssh, and run the command manually. The problem is - I can't get it to execute the command. It works fine from terminal, but not by it self on startup. I have tried to follow the instructions in this link, but nothing seems to work.

I'm on a Natty 11.04 instance and I have installed ruby and gems through rvm.

答:
You'll need to call something in a bash script that looks like this:

```<code>su - deploy -c "cd $RAILS_ROOT && rake RAILS_ENV=development jobs:work" >> $RAILS_ROOT/log/myjob.log 2>&1
</code>```

Then call it from from your /etc/init.d/mystartup_filename. The file could look something like:

```<code>#! /bin/sh
RAILS_ROOT="/home/deploy/rails_root"
ENV="development"

case "$1" in
    start)
    echo -n "Starting my job: "
    su - deploy -c "cd $RAILS_ROOT && rake RAILS_ENV=$ENV jobs:work" >> $RAILS_ROOT/log/myjob.log 2>&1
    echo "done."
    ;;
    stop)
    echo -n "Stopping my job: "
    su - deploy -c "cd $RAILS_ROOT && rake RAILS_ENV=$ENV jobs:stopwork" >> $RAILS_ROOT/log/myjob.log 2>&1
    echo "done."
    ;;
    *)
    echo "Usage: $N {start|stop}" >&2
    exit 1
    ;;
esac

exit 0
</code>```

ContentLicense: CC BY-SA 3.0

Title: Running rake task on ubuntu startup

Body:
You'll need to call something in a bash script that looks like this:

su - deploy -c "cd $RAILS_ROOT && rake RAILS_ENV=development jobs:work" >> $RAILS_ROOT/log/myjob.log 2>&1

Then call it from from your /etc/init.d/mystartup_filename. The file could look something like:

#! /bin/sh
RAILS_ROOT="/home/deploy/rails_root"
ENV="development"

case "$1" in
    start)
    echo -n "Starting my job: "
    su - deploy -c "cd $RAILS_ROOT && rake RAILS_ENV=$ENV jobs:work" >> $RAILS_ROOT/log/myjob.log 2>&1
    echo "done."
    ;;
    stop)
    echo -n "Stopping my job: "
    su - deploy -c "cd $RAILS_ROOT && rake RAILS_ENV=$ENV jobs:stopwork" >> $RAILS_ROOT/log/myjob.log 2>&1
    echo "done."
    ;;
    *)
    echo "Usage: $N {start|stop}" >&2
    exit 1
    ;;
esac

exit 0


问:
Additional include paths and linker options Gradle for C++
I was trying to use Gradle to compile a C++ project, but I can't find the way of declaring what additional include paths I want at compile time, and what additional libraries at link time.
I've seen solutions involving model { } inside project (I don't remember exactly). (But didn't work, Gradle complains all the time about non existing function.)

Also does not seem to be a clear or simple way to add Conan dependencies to a Gradle project yet. That leaves me compiling libraries on my own and then adding to the build system, but again, I can't find the way.

I've been looking in the docs for the answer, but all I find is about adding maven dependencies (But GLFW, GLEW and DearIMGUI aren't on Maven I guess...).

Any quirk? How Can I possibly just register additional includes/link files?

My build.gradle.kts:

plugins {
    id("cpp-application")
}

tasks.register("runDebug") {
    doLast {
        exec {
            executable = "./build/exe/main/debug/my-app.exe"
        }
    }
}
```

答:
To add header directories or add compiler options; after the plugins section add an application section like this:

```<code>application {
  privateHeaders {
   from('src/headers')
   from('/usr/include/qt5')
   }
   // To add compiler args do the following below
   binaries.configureEach {
      compileTask.get().compilerArgs.add('-O2')
   }
}
</code>```

I am still trying to figure how to add the libraries or linker args :(

Body:
To add header directories or add compiler options; after the plugins section add an application section like this:

application {
  privateHeaders {
   from('src/headers')
   from('/usr/include/qt5')
   }
   // To add compiler args do the following below
   binaries.configureEach {
      compileTask.get().compilerArgs.add('-O2')
   }
}

I am still trying to figure how to add the libraries or linker args :(


问:
React/Typescript /VScode - an import path cannot end with a '.tsx' extension
I have a series of react projects which I have converted to typescript. Some of these use webpack, and some of them just use babel as they're libraries which are consumed by the other (webpack) projects/actual applications.

I've converted everything to typescript without problems, except in one non-webpack project, where I receive the error 'an import path cannot end with a .tsx extension', for example on

```<code>import LoadingLogo from '../ui/LoadingLogo.tsx';

</code>```

I can get round this by omitting the extension, or using // @ts-ignore, but neither of these are optimal solutions, since the project will be a mix of jsx and tsx while it is being refactored and I'd like to be able to see at a glance which file type is being used in the import.

The steps I've taken to convert the project to typescript are

Install typescript

Install @babel/preset-typescript

add

```<code>presets: [ @babel/preset-typescript ]
</code>```

to my babel.config.js

To make matters even more confusing, in one of the other (non-webpack) apps, I've got the same babel setup running and I'm not seeing this issue. Is there something obvious I'm missing? For reference, my babel.config in the project with the issue looks like this

```<code>module.exports = function(api) {
  api.cache(true);

  return {
    ignore: ['node_modules/**/*'],
    presets: [
      ['@babel/preset-typescript'],
      [
        '@babel/preset-env',
        {
          loose: true,
          targets: {
            node: 'current'
          }
        }
      ],
      '@babel/preset-react'
    ],
    env: {
      translations: {
        plugins: [
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node',
          [
            'react-intl',
            {
              messagesDir: './messages',
              enforceDescriptions: false
            }
          ]
        ]
      },
      production: {
        plugins: [
          'jsx-strip-ext',
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      },
      development: {
        plugins: [
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      }
    },
    plugins: [
      '@babel/plugin-transform-runtime',
      '@babel/plugin-syntax-dynamic-import',
      '@babel/plugin-syntax-import-meta',
      '@babel/plugin-proposal-class-properties',
      '@babel/plugin-proposal-json-strings',
      '@babel/plugin-transform-classes'
    ]
  };
};
</code>```

and my babel config in the non-webpack project without the issue looks like this

```<code>module.exports = function(api) {
  api.cache(true);

  return {
    presets: ['@babel/preset-typescript'],
    ignore: ['node_modules/**/*'],
    extends: 'myProject/babel.config.js',
    env: {
      production: {
        plugins: [
          [
            'module-resolver',
            {
              alias: {
                '^myProject/src/(.+)': 'myProject/lib/\\1'
              },
              extensions: ['.js', '.jsx'],
              stripExtensions: ['.js', '.jsx']
            }
          ],
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      },
      development: {
        plugins: [
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      }
    }
  };
};

</code>```

tsconfig.json for both projects looks like this

```<code>{
  "compilerOptions": {
    "module": "esnext",
    "outDir": "dist/",
    "noImplicitAny": true,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true,
    "target": "ESNext",
    "allowJs": true,
    "checkJs": false,
    "jsx": "react",
    "pretty": true,
    "skipLibCheck": true,
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "lib": ["dom", "dom.iterable", "ESNext"],
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "isolatedModules": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "**/*.spec.ts"]
}
</code>```

My first instinct was to look at the module resolver plugin, but that didn't seem to make any difference. Is there something obvious I'm missing?

答:
I'm sorry to say that I doubt you are going to be able to resolve this in the way you desire. TypeScript (specifically TSC) disallows explicit extensions for ts/tsx files... It has to do with implicit file extensions in imports, and how ts/tsx files are compiled down to js/jsx files. The world may not be happy about it, but it seems to be the way that it is.

You could use // @ts-ignore, but then I think you would lose intellisense

Update: it has come to my attention from comments below that some TypeScript tools do allow extensions. Evidently Deno requires them, though I have not worked with Deno. The TSC compiler disallows them.

Body:
I have a series of react projects which I have converted to typescript. Some of these use webpack, and some of them just use babel as they're libraries which are consumed by the other (webpack) projects/actual applications.

I've converted everything to typescript without problems, except in one non-webpack project, where I receive the error 'an import path cannot end with a .tsx extension', for example on

import LoadingLogo from '../ui/LoadingLogo.tsx';

I can get round this by omitting the extension, or using // @ts-ignore, but neither of these are optimal solutions, since the project will be a mix of jsx and tsx while it is being refactored and I'd like to be able to see at a glance which file type is being used in the import.

The steps I've taken to convert the project to typescript are

Install typescript

Install @babel/preset-typescript

add

presets: [ @babel/preset-typescript ]

to my babel.config.js

To make matters even more confusing, in one of the other (non-webpack) apps, I've got the same babel setup running and I'm not seeing this issue. Is there something obvious I'm missing? For reference, my babel.config in the project with the issue looks like this

module.exports = function(api) {
  api.cache(true);

  return {
    ignore: ['node_modules/**/*'],
    presets: [
      ['@babel/preset-typescript'],
      [
        '@babel/preset-env',
        {
          loose: true,
          targets: {
            node: 'current'
          }
        }
      ],
      '@babel/preset-react'
    ],
    env: {
      translations: {
        plugins: [
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node',
          [
            'react-intl',
            {
              messagesDir: './messages',
              enforceDescriptions: false
            }
          ]
        ]
      },
      production: {
        plugins: [
          'jsx-strip-ext',
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      },
      development: {
        plugins: [
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      }
    },
    plugins: [
      '@babel/plugin-transform-runtime',
      '@babel/plugin-syntax-dynamic-import',
      '@babel/plugin-syntax-import-meta',
      '@babel/plugin-proposal-class-properties',
      '@babel/plugin-proposal-json-strings',
      '@babel/plugin-transform-classes'
    ]
  };
};

and my babel config in the non-webpack project without the issue looks like this

module.exports = function(api) {
  api.cache(true);

  return {
    presets: ['@babel/preset-typescript'],
    ignore: ['node_modules/**/*'],
    extends: 'myProject/babel.config.js',
    env: {
      production: {
        plugins: [
          [
            'module-resolver',
            {
              alias: {
                '^myProject/src/(.+)': 'myProject/lib/\\1'
              },
              extensions: ['.js', '.jsx'],
              stripExtensions: ['.js', '.jsx']
            }
          ],
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      },
      development: {
        plugins: [
          [
            'babel-plugin-styled-components',
            {
              ssr: true
            }
          ],
          'syntax-async-functions',
          '@babel/plugin-syntax-dynamic-import',
          'dynamic-import-node'
        ]
      }
    }
  };
};

tsconfig.json for both projects looks like this

{
  "compilerOptions": {
    "module": "esnext",
    "outDir": "dist/",
    "noImplicitAny": true,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true,
    "target": "ESNext",
    "allowJs": true,
    "checkJs": false,
    "jsx": "react",
    "pretty": true,
    "skipLibCheck": true,
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "lib": ["dom", "dom.iterable", "ESNext"],
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "isolatedModules": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "**/*.spec.ts"]
}

My first instinct was to look at the module resolver plugin, but that didn't seem to make any difference. Is there something obvious I'm missing?


问:
Python Dictionary How to create combinations of list items?
I have a dictionary which has value as a list.

```<code>thisdict = {  'G1' : [10,20],
              'G2' : [12,13]

}
</code>```

I want to create new dictionary with  all possible 4 combinations.

C1 :[10,12]

C2 :[10,13]

C3 :[20,12]

C4 :[20,13]

How do I create that ?

答:
I think you are looking for: itertools.combinations()

This might help too
Getting all combinations of key/value pairs in Python dict

Body:
I have a dictionary which has value as a list.

thisdict = {  'G1' : [10,20],
              'G2' : [12,13]

}

I want to create new dictionary with  all possible 4 combinations.

C1 :[10,12]

C2 :[10,13]

C3 :[20,12]

C4 :[20,13]

How do I create that ?


问:
Arduino convex hull algorithm
I am working on a project using an Arduino that needs to calculate the area of a polygon made up of many points. I use surveyor's theorem,

But the points are in random order, not (counter)clockwise. Some make lines that cross, and they make polygons like a bow-tie or hourglass, which don't work for the surveyor's theorem, so I need to sort them in (counter)clockwise order. what is the easiest way to do this?

答:
You could find the center of gravity (cx,cy) of the points and then calculate the angles of the points relative to (cx,cy).

```<code>angle[i] = atan2(y[i]-cy, x[i]-cx) ;
</code>```

Then sort the points by angle.

Just beware that a random set of points does not describe a single unique polygon.  So this method will just give you one of the possible polygons, and not necessarily the polygon you would have obtained if you had manually connected the dots.

Title: Arduino convex hull algorithm

Body:
You could find the center of gravity (cx,cy) of the points and then calculate the angles of the points relative to (cx,cy).

angle[i] = atan2(y[i]-cy, x[i]-cx) ;

Then sort the points by angle.

Just beware that a random set of points does not describe a single unique polygon.  So this method will just give you one of the possible polygons, and not necessarily the polygon you would have obtained if you had manually connected the dots.


问:
Flutter : Create directory on external storage path - path provider getExternalStorageDirectory()
I'm creating a flutter app where I want to download and store an image to the external storage (not documents directory) so it can be viewed by any photo gallery app.
I'm using the following code to create a directory

```<code>var dir = await getExternalStorageDirectory();
  if(!Directory("${dir.path}/myapp").existsSync()){
    Directory("${dir.path}/myapp").createSync(recursive: true);
  }
</code>```

It's giving me following error:

```<code>FileSystemException: Creation failed, path = '/storage/emulated/0/myapp' (OS Error: Permission denied, errno = 13)
</code>```

I have set up permissions in the manifest file and using the following code for runtime permissions

```<code>List<Permissions> permissions = await Permission.getPermissionStatus([PermissionName.Storage]);
permissions.forEach((p) async {
  if(p.permissionStatus != PermissionStatus.allow){
    final res = await Permission.requestSinglePermission(PermissionName.Storage);
    print(res);
  }
});
</code>```

I have verified in settings that app has got the permission, also as suggested on some answers here I've also tried giving permission from settings app manually which did not work.

答:
You need to request permissions before saving a file using getExternalStorageDirectory.

Add this to Androidmanifest.xml:

```<code> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</code>```

Then use the permission_handler package to get Storage permission:

https://pub.dev/packages/permission_handler

If you are running in the Emulator, getExternalStorageDirectory returns:

```<code>/storage/emulated/0/Android/data/com.example.myapp/files/
</code>```

If you just need the external dir to create a directory under it, then just use:

```<code>/storage/emulated/0/
</code>```

You can create a directory under this folder, so they user will be able to open the files.

Body:
I'm creating a flutter app where I want to download and store an image to the external storage (not documents directory) so it can be viewed by any photo gallery app.
I'm using the following code to create a directory

var dir = await getExternalStorageDirectory();
  if(!Directory("${dir.path}/myapp").existsSync()){
    Directory("${dir.path}/myapp").createSync(recursive: true);
  }

It's giving me following error:

FileSystemException: Creation failed, path = '/storage/emulated/0/myapp' (OS Error: Permission denied, errno = 13)

I have set up permissions in the manifest file and using the following code for runtime permissions

List<Permissions> permissions = await Permission.getPermissionStatus([PermissionName.Storage]);
permissions.forEach((p) async {
  if(p.permissionStatus != PermissionStatus.allow){
    final res = await Permission.requestSinglePermission(PermissionName.Storage);
    print(res);
  }
});

I have verified in settings that app has got the permission, also as suggested on some answers here I've also tried giving permission from settings app manually which did not work.

Body:
You need to request permissions before saving a file using getExternalStorageDirectory.

Add this to Androidmanifest.xml:

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Then use the permission_handler package to get Storage permission:

https://pub.dev/packages/permission_handler

If you are running in the Emulator, getExternalStorageDirectory returns:

/storage/emulated/0/Android/data/com.example.myapp/files/

If you just need the external dir to create a directory under it, then just use:

/storage/emulated/0/

You can create a directory under this folder, so they user will be able to open the files.


问:
Socket accept - "Too many open files"
I am working on a school project where I had to write a multi-threaded server, and now I am comparing it to apache by running some tests against it. I am using autobench to help with that, but after I run a few tests, or if I give it too high of a rate (around 600+) to make the connections,  I get a "Too many open files" error.

After I am done with dealing with request, I always do a close() on the socket. I have tried to use the shutdown() function as well, but nothing seems to help. Any way around this?

答:
For future reference, I ran into a similar problem; I was creating too many file descriptors (FDs) by creating too many files and sockets (on Unix OSs, everything is a FD). My solution was to increase FDs at runtime with setrlimit().

First I got the FD limits, with the following code:

// This goes somewhere in your code
struct rlimit rlim;

if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
    std::cout << "Soft limit: " << rlim.rlim_cur << std::endl;
    std::cout << "Hard limit: " << rlim.rlim_max << std::endl;
} else {
    std::cout << "Unable to get file descriptor limits" << std::endl;
}
```

<p>After running <code>getrlimit()</code>, I could confirm that on my system, the soft limit is 256 FDs, and the hard limit is infinite FDs (this is different depending on your distro and specs). Since I was creating > 300 FDs between files and sockets, my code was crashing.</p>

<p>In my case I couldn't decrease the number of FDs, so I decided to increase the FD soft limit instead, with this code:</p>

<pre class="lang-cpp prettyprint-override"><code>// This goes somewhere in your code
struct rlimit rlim;

rlim.rlim_cur = NEW_SOFT_LIMIT;
rlim.rlim_max = NEW_HARD_LIMIT;

if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
    std::cout << "Unable to set file descriptor limits" << std::endl;
}
</code>```

Note that you can also get the number of FDs that you are using, and the source of these FDs, with this code.

Also you can find more information on gettrlimit() and setrlimit() here and here.

Title: Socket accept - "Too many open files"

Body:
For future reference, I ran into a similar problem; I was creating too many file descriptors (FDs) by creating too many files and sockets (on Unix OSs, everything is a FD). My solution was to increase FDs at runtime with setrlimit().

First I got the FD limits, with the following code:

// This goes somewhere in your code
struct rlimit rlim;

if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
    std::cout << "Soft limit: " << rlim.rlim_cur << std::endl;
    std::cout << "Hard limit: " << rlim.rlim_max << std::endl;
} else {
    std::cout << "Unable to get file descriptor limits" << std::endl;
}

After running getrlimit(), I could confirm that on my system, the soft limit is 256 FDs, and the hard limit is infinite FDs (this is different depending on your distro and specs). Since I was creating > 300 FDs between files and sockets, my code was crashing.

In my case I couldn't decrease the number of FDs, so I decided to increase the FD soft limit instead, with this code:

// This goes somewhere in your code
struct rlimit rlim;

rlim.rlim_cur = NEW_SOFT_LIMIT;
rlim.rlim_max = NEW_HARD_LIMIT;

if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
    std::cout << "Unable to set file descriptor limits" << std::endl;
}

Note that you can also get the number of FDs that you are using, and the source of these FDs, with this code.

Also you can find more information on gettrlimit() and setrlimit() here and here.


问:
Revit API - Remove family completely from Revit project
I'm running into a problem trying to remove a family from a project. I'm able to delete the family types but it seems like the family is still loaded in the project. Is there a way to remove it completely?

so far, i've looked at these sources:

1) https://adndevblog.typepad.com/aec/2012/07/supported-workflow-for-unloading-a-family-using-the-revit-api.html

2) https://adndevblog.typepad.com/aec/2012/07/supported-workflow-for-unloading-a-family-using-the-revit-api.html

here's my code:

```<code>FilteredElementCollector colTitleBlocks = new FilteredElementCollector(doc)
                .OfClass(typeof(FamilySymbol))
                .OfCategory(BuiltInCategory.OST_TitleBlocks);

using (Transaction tx6 = new Transaction(doc))
{
    tx6.Start("load custom titleblock that you just made");

    Element family2Unload = null;
    foreach (FamilySymbol xfamily in colTitleBlocks )
        {

        if (xfamily.FamilyName == "E1 30 x 42 Horizontal")
             {

             family2Unload = doc.GetElement(xfamily.Id) as Element;

             }
        }
   doc.Delete(family2Unload.Id);

   tx6.Commit();
}
</code>```

答:
Families

FamilyInstance => a placed instance of a family

FamilySymbol => a family type with 0-m instances

Family => A family with with n types 0-m instances

Example : FamilyDelete.pushbutton

Here is one of my script from pyRevitMEP to delete families :

"""
Copyright (c) 2017 Cyril Waechter
Python scripts for Autodesk Revit
This file is part of pypevitmep repository at https://github.com/CyrilWaechter/pypevitmep
pypevitmep is an extension for pyRevit. It contain free set of scripts for Autodesk Revit:
you can redistribute it and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
See this link for a copy of the GNU General Public License protecting this package.
https://github.com/CyrilWaechter/pypevitmep/blob/master/LICENSE
"""
import rpw
doc = rpw.revit.doc
uidoc = rpw.revit.uidoc

from Autodesk.Revit.DB import Transaction, FamilySymbol

__doc__ = "Delete selected families from project"
__title__ = "Family delete"
__author__ = "Cyril Waechter"
__context__ = "Selection"

with rpw.db.Transaction("Delete families from project"):
    # Find families of selected object and delete it
    for id in uidoc.Selection.GetElementIds():
        el = doc.GetElement(id)
        family_id = el.Symbol.Family.Id
        doc.Delete(family_id)
```

You have the same one for family types : FamilyTypeDelete.pushbutton

Body:
I'm running into a problem trying to remove a family from a project. I'm able to delete the family types but it seems like the family is still loaded in the project. Is there a way to remove it completely?

so far, i've looked at these sources:

1) https://adndevblog.typepad.com/aec/2012/07/supported-workflow-for-unloading-a-family-using-the-revit-api.html

2) https://adndevblog.typepad.com/aec/2012/07/supported-workflow-for-unloading-a-family-using-the-revit-api.html

here's my code:

FilteredElementCollector colTitleBlocks = new FilteredElementCollector(doc)
                .OfClass(typeof(FamilySymbol))
                .OfCategory(BuiltInCategory.OST_TitleBlocks);

using (Transaction tx6 = new Transaction(doc))
{
    tx6.Start("load custom titleblock that you just made");

    Element family2Unload = null;
    foreach (FamilySymbol xfamily in colTitleBlocks )
        {

        if (xfamily.FamilyName == "E1 30 x 42 Horizontal")
             {

             family2Unload = doc.GetElement(xfamily.Id) as Element;

             }
        }
   doc.Delete(family2Unload.Id);

   tx6.Commit();
}

Body:
Families

FamilyInstance => a placed instance of a family

FamilySymbol => a family type with 0-m instances

Family => A family with with n types 0-m instances

Example : FamilyDelete.pushbutton

Here is one of my script from pyRevitMEP to delete families :

"""
Copyright (c) 2017 Cyril Waechter
Python scripts for Autodesk Revit
This file is part of pypevitmep repository at https://github.com/CyrilWaechter/pypevitmep
pypevitmep is an extension for pyRevit. It contain free set of scripts for Autodesk Revit:
you can redistribute it and/or modify it under the terms of the GNU General Public License
version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
See this link for a copy of the GNU General Public License protecting this package.
https://github.com/CyrilWaechter/pypevitmep/blob/master/LICENSE
"""
import rpw
doc = rpw.revit.doc
uidoc = rpw.revit.uidoc

from Autodesk.Revit.DB import Transaction, FamilySymbol

__doc__ = "Delete selected families from project"
__title__ = "Family delete"
__author__ = "Cyril Waechter"
__context__ = "Selection"

with rpw.db.Transaction("Delete families from project"):
    # Find families of selected object and delete it
    for id in uidoc.Selection.GetElementIds():
        el = doc.GetElement(id)
        family_id = el.Symbol.Family.Id
        doc.Delete(family_id)

You have the same one for family types : FamilyTypeDelete.pushbutton


问:
Counting the number of items in two mutually exclusive rows of categories
Here is the sheet for testing: https://docs.google.com/spreadsheets/d/11CoQ_PAtVNQBkbtnHH0xR4bhCQVU-pcz645h1akTQuA/edit?usp=sharing

I have a table like this:

```
| id | category | irrelevant |
|----|----------|------------|
| 1  | cat1     | FALSE      |
| 2  | cat2     | FALSE      |
| 3  |          | TRUE       |
| 4  | cat1     | FALSE      |
```

Each item has an ID and a category or, if it is considered irrelevant, it has no category and the column "irrelevant" is marked as TRUE.

What I would like to do is to write a formula that will return the number of items in each category plus a row with the number of irrelevant items. So in the case above the result would be:

```
| category   | number |
|------------|--------|
| cat1       | 2      |
| cat2       | 1      |
| irrelevant | 1      |
```

If I try something like:

=QUERY(A1:C5,"select B,count(A) group by B")

I get the correct numbers, but since "irrelevant" is not a category its cell is empty, so the result is:

```
| category | count id |
|----------|----------|
|          |        1 |
| cat1     |        2 |
| cat2     |        1 |
```

Notice the empty "B2" cell. Is there a way to rename it to "irrelevant" without altering the first table? One thing I tried was just to count the irrelevant items.

=transpose(query(A1:C5, "select count(A) where C = TRUE label count(A) 'irrelevant'"))

which returns me simply

```
| irrelevant | 1 |
```

And then altering slightly the first formula so it doesn't count the "empty" categories and finally joining both of them in an array:

```<code>={
  QUERY(A1:C5,"select B,count(A) where B <> '' group by B");
  TRANSPOSE(QUERY(A1:C5, "select count(A) where C = TRUE label count(A) 'irrelevant'"))
}
</code>```

This returns me what I want for the example above

```
| category   | count id |
|------------|----------|
| cat1       |        2 |
| cat2       |        1 |
| irrelevant |        1 |
```

But this won't work if my original table doesn't have irrelevant items. Which can occur depending on the range I chose to query, so if I want to query a table like this:

```
| id | category | irrelevant |
|----|----------|------------|
|  5 | cat1     |    FALSE   |
|  6 | cat2     |    FALSE   |
|  7 | cat2     |    FALSE   |
|  8 | cat3     |    FALSE   |
```

The solution I found will not work. Any suggestions on how can I do that?

答:
try:</p>

```<code>=ARRAYFORMULA(QUERY(IF((B2:B="")*(C2:C<>""), "irrelevant", ),
 "select Col1,count(Col21)
  where Col1 is not null
  group by Col1
  label count(Col2)''"))
</code>```

Body:
Here is the sheet for testing: https://docs.google.com/spreadsheets/d/11CoQ_PAtVNQBkbtnHH0xR4bhCQVU-pcz645h1akTQuA/edit?usp=sharing

I have a table like this:

| id | category | irrelevant |
|----|----------|------------|
| 1  | cat1     | FALSE      |
| 2  | cat2     | FALSE      |
| 3  |          | TRUE       |
| 4  | cat1     | FALSE      |

Each item has an ID and a category or, if it is considered irrelevant, it has no category and the column "irrelevant" is marked as TRUE.

What I would like to do is to write a formula that will return the number of items in each category plus a row with the number of irrelevant items. So in the case above the result would be:

| category   | number |
|------------|--------|
| cat1       | 2      |
| cat2       | 1      |
| irrelevant | 1      |

If I try something like:

=QUERY(A1:C5,"select B,count(A) group by B")

I get the correct numbers, but since "irrelevant" is not a category its cell is empty, so the result is:

| category | count id |
|----------|----------|
|          |        1 |
| cat1     |        2 |
| cat2     |        1 |

Notice the empty "B2" cell. Is there a way to rename it to "irrelevant" without altering the first table? One thing I tried was just to count the irrelevant items.

=transpose(query(A1:C5, "select count(A) where C = TRUE label count(A) 'irrelevant'"))

which returns me simply

| irrelevant | 1 |

And then altering slightly the first formula so it doesn't count the "empty" categories and finally joining both of them in an array:

={
  QUERY(A1:C5,"select B,count(A) where B <> '' group by B");
  TRANSPOSE(QUERY(A1:C5, "select count(A) where C = TRUE label count(A) 'irrelevant'"))
}

This returns me what I want for the example above

| category   | count id |
|------------|----------|
| cat1       |        2 |
| cat2       |        1 |
| irrelevant |        1 |

But this won't work if my original table doesn't have irrelevant items. Which can occur depending on the range I chose to query, so if I want to query a table like this:

| id | category | irrelevant |
|----|----------|------------|
|  5 | cat1     |    FALSE   |
|  6 | cat2     |    FALSE   |
|  7 | cat2     |    FALSE   |
|  8 | cat3     |    FALSE   |

The solution I found will not work. Any suggestions on how can I do that?

Body:
try:

=ARRAYFORMULA(QUERY(IF((B2:B="")*(C2:C<>""), "irrelevant", ),
 "select Col1,count(Col21)
  where Col1 is not null
  group by Col1
  label count(Col2)''"))


问:
Android APP using Arabic Reshaper/KIVY crashes
I have been experimenting with KIVY + Arabic text using Reshaper library
Has anybody succeeded in deploying APK to Android?
I could run the APP on Linux/Pycharm setup Flawlessly, but when I deploy it to Android it Crashes on startup

If I remove import code lines for both Reshaper and BIDI algorithm, it works on Android

Any hint?

答:
Have you ever configured the buildozer.spec file ? If you import libraries or  frameworks that are not built-in, so you need to specify the libraries that you want to use in buildozer.spec file.

```<code># (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy
</code>```

Add the libraries in requirements line as shown above.

Body:
Have you ever configured the buildozer.spec file ? If you import libraries or  frameworks that are not built-in, so you need to specify the libraries that you want to use in buildozer.spec file.

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy

Add the libraries in requirements line as shown above.


问:
nesting multiple .cmd files with prerequisites running in a certain order
I'm having trouble figuring out the logic behind this. I have 11 .cmd files that need to run in a certain order. 5 of them can start simultaneously, the next 5 are directly dependent on the corresponding of the first five, and the last file is dependent on the second set of five to be run.

Image of workflow:

Step 1 is to start QAQC processes 1-5.

Step 2 is to start the corresponding CONVERT processes for each QAQC process as it finishes.

Step 3 is to merge all outputs once all 5 CONVERT processes are finished.

I imagine I need to make a .cmd or .bat file for each and then call the 5 files in one file.

file1.cmd:

```<code> call QAQC1
 call CONVERT1
</code>```

file2.cmd:

```<code>call QAQC2
call CONVERT2
</code>```

and so on...

And the final file would be something like:

FINAL_FINAL.cmd:

```<code>start "QAQC1.cmd" QAQC1.cmd
start "QAQC2.cmd" QAQC2.cmd
start "QAQC3.cmd" QAQC3.cmd
start "QAQC4.cmd" QAQC4.cmd
start "QAQC5.cmd" QAQC5.cmd
</code>```

I'm still unclear if this is correct or how I would make all of these steps finish before I make a call to the final file that merges everything together and requires all 10 other files to complete. Any help would be greatly appreciated!

答:
```<code>@echo off
setlocal enabledelayedexpansion
for /l %%a in (1,1,5) do (
  set /a x=!random! %% 10
  >QAQC%%a.cmd (
    echo @echo QAQC%%a
    echo @timeout !x!
  )
  >CONVERT!%%a.cmd (
    echo @echo CONVERT%%a
    echo @timeout !x!
  )
)
echo @echo merge running >merge.cmd
echo @timeout 3 >>merge.cmd
REM ignore anything before this line; it just creates a test environment

@echo off
echo wait for qaqcX and convertX to finish...
( start cmd /c "qaqc1.cmd & convert1.cmd"
  start cmd /c "qaqc2.cmd & convert2.cmd"
  start cmd /c "qaqc3.cmd & convert3.cmd"
  start cmd /c "qaqc4.cmd & convert4.cmd"
  start cmd /c "qaqc5.cmd & convert5.cmd"
) | pause >nul
call merge.cmd
echo done.
</code>```

Body:
I'm having trouble figuring out the logic behind this. I have 11 .cmd files that need to run in a certain order. 5 of them can start simultaneously, the next 5 are directly dependent on the corresponding of the first five, and the last file is dependent on the second set of five to be run.

Image of workflow:

Step 1 is to start QAQC processes 1-5.

Step 2 is to start the corresponding CONVERT processes for each QAQC process as it finishes.

Step 3 is to merge all outputs once all 5 CONVERT processes are finished.

I imagine I need to make a .cmd or .bat file for each and then call the 5 files in one file.

file1.cmd:

 call QAQC1
 call CONVERT1

file2.cmd:

call QAQC2
call CONVERT2

and so on...

And the final file would be something like:

FINAL_FINAL.cmd:

start "QAQC1.cmd" QAQC1.cmd
start "QAQC2.cmd" QAQC2.cmd
start "QAQC3.cmd" QAQC3.cmd
start "QAQC4.cmd" QAQC4.cmd
start "QAQC5.cmd" QAQC5.cmd

I'm still unclear if this is correct or how I would make all of these steps finish before I make a call to the final file that merges everything together and requires all 10 other files to complete. Any help would be greatly appreciated!


问:
Why can't React Native (RN) convert the main.bundle.js to native code to avoid the RN Bridge between VM & Native Modules
I was wondering why do we need the RN Bridge in the React Native engine which connects the Javascript VM (JavascriptCore) with the Native Modules. This bridge and message passing setup only slows down the app speed and creates a bottleneck. Why can't the package bundler spawned by React Native CLI, instead of just bundling javascript codes to main.bundle.js, also convert it to native code? one reason I've heard is coz javascript is not strongly typed, but this reason doesn't seem unsolvable. Any other reasons?</p>

答:
Indeed transpiling javascript into native code will provide tremendous performance improvements however it is not an easy thing to do at all. That being said, there are a lot of reasons why transpilation from one language to another is hard, and this is especially true if we consider the host language to be javascript and the target language to be java or something similar like C# and objective c.

Javascript is extremely different from these languages, many of the ideas are hard to map into a one to one, and the mindset is completely different.

Another thing that is special about javascript, and that makes it hard to transpile it to another language, is that javascript can never be a versioned language, and that since its the language of the web it has to always support backward compatibility. This means if a tool were to transpile from javascript to another language, this tool needs to support everything that javascript supports - one might argue that a tool might support only a recent subset of javascript, something like es6, however this is dangerous for two reasons, one it will be hard to define this subset exactly since a lot of es6 features are working by polyfills from es5, and two that this means that this tool wont be able to support all the javascript ecosystem.

here are some of details about some challenging parts of javascript to be transpiled into a language like java:

javascript is a dynamic language, not only there are no restrictions on types, but javascript do an extremely complex type coercing techniques in different operations under different conditions

```<code>consider this
true + 1 === 1 + '1' // false
true + 1 === 1 + +1 // true
</code>```

Javascript introduced modules system only recently (starting from es6) this practically means that any program is  one huge chunk of code, where variables live through out the entire program.

Javascript inheritance system (the Prototypal Inheritance system) is extremely different from classical inheritance systems in these languages, for example in javascript at runtime you can change the the class of an object, at the same time in runtime you can also change the methods of a class.

Now on top of all the technical challenges, notice that there is a product wise decision here, in making RN like this. This enabled RN to go to market faster, and not be tied to certain native language, this means its much more easier this way to support new environments by just transpiling ui controls to the native ui of that environment, and keeping javascript as it is. And on top of that if tomorrow, someone find a way to transpile javascript to java, this tool can be easily integrated into RN pipeline, without affecting the other components and supported environments of RN.

Body:
Indeed transpiling javascript into native code will provide tremendous performance improvements however it is not an easy thing to do at all. That being said, there are a lot of reasons why transpilation from one language to another is hard, and this is especially true if we consider the host language to be javascript and the target language to be java or something similar like C# and objective c.

Javascript is extremely different from these languages, many of the ideas are hard to map into a one to one, and the mindset is completely different.

Another thing that is special about javascript, and that makes it hard to transpile it to another language, is that javascript can never be a versioned language, and that since its the language of the web it has to always support backward compatibility. This means if a tool were to transpile from javascript to another language, this tool needs to support everything that javascript supports - one might argue that a tool might support only a recent subset of javascript, something like es6, however this is dangerous for two reasons, one it will be hard to define this subset exactly since a lot of es6 features are working by polyfills from es5, and two that this means that this tool wont be able to support all the javascript ecosystem.

here are some of details about some challenging parts of javascript to be transpiled into a language like java:

javascript is a dynamic language, not only there are no restrictions on types, but javascript do an extremely complex type coercing techniques in different operations under different conditions

consider this
true + 1 === 1 + '1' // false
true + 1 === 1 + +1 // true

Javascript introduced modules system only recently (starting from es6) this practically means that any program is  one huge chunk of code, where variables live through out the entire program.

Javascript inheritance system (the Prototypal Inheritance system) is extremely different from classical inheritance systems in these languages, for example in javascript at runtime you can change the the class of an object, at the same time in runtime you can also change the methods of a class.

Now on top of all the technical challenges, notice that there is a product wise decision here, in making RN like this. This enabled RN to go to market faster, and not be tied to certain native language, this means its much more easier this way to support new environments by just transpiling ui controls to the native ui of that environment, and keeping javascript as it is. And on top of that if tomorrow, someone find a way to transpile javascript to java, this tool can be easily integrated into RN pipeline, without affecting the other components and supported environments of RN.