If svg can convert to canvas, then it can download as image.
Sunday, May 31, 2020
Access windows web app from WSL2
It's long strong in Microsoft site.
To be short:
I have django in windows
python manage.py runserver --insecure 0.0.0.0:8000
Must use 0.0.0.0 in here.
In WSL2 ubuntu 20.04,
alex@DESKTOP:~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this fil
e, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.28.112.1
# This file was automatically generated by WSL. To stop automatic generation of this fil
e, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.28.112.1
Use the ip address in nameserver to access windows web app.
alex@DESKTOP:~$ curl -I http://172.28.112.1:8000/static/favicon.ico
HTTP/1.1 200 OK
Date: Sun, 31 May 2020 07:44:37 GMT
Server: WSGIServer/0.2 CPython/3.7.7
Content-Type: image/x-icon
Content-Length: 1150
Content-Disposition: inline; filename="favicon.ico"
Last-Modified: Thu, 05 Mar 2020 02:31:32 GMT
HTTP/1.1 200 OK
Date: Sun, 31 May 2020 07:44:37 GMT
Server: WSGIServer/0.2 CPython/3.7.7
Content-Type: image/x-icon
Content-Length: 1150
Content-Disposition: inline; filename="favicon.ico"
Last-Modified: Thu, 05 Mar 2020 02:31:32 GMT
Form validation
I have some experience with jquery.validation. Just need to follow up the document to set it up. The js methods look more customizable.
The syntax of jquery.form.validation looks much cleaner and intuitive. Better i18n. It can be very minimized in js. However, it may be harder to do advanced js jobs.
Monday, May 18, 2020
Saturday, May 16, 2020
Connect windows MySQL from wsl2
Can't connect to mysql server from wsl2.
>~/dvp/c$ mysql -u root -p --host 192.168.0.102 --port 3306 --protocol=TCP
Enter password:
ERROR 1130 (HY000): Host 'host.docker.internal' is not allowed to connect to this MySQL server
Same as
https://superuser.com/questions/1536619/connect-to-mysql-from-wsl2
Still looking for solution.
>~/dvp/c$ mysql -u root -p --host 192.168.0.102 --port 3306 --protocol=TCP
Enter password:
ERROR 1130 (HY000): Host 'host.docker.internal' is not allowed to connect to this MySQL server
Same as
https://superuser.com/questions/1536619/connect-to-mysql-from-wsl2
Still looking for solution.
Monday, May 11, 2020
Go installation in WSL ubuntun 20.04
sudo apt install golang-go
2 errors at the end.
Need further investigation.
After
sudo apt-get upgrade
sudo apt-get update
I am able to install it.
alex@DESKTOP:~$ sudo apt install golang-go
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base golang-1.13-go
golang-1.13-race-detector-runtime golang-1.13-src golang-race-detector-runtime golang-src libasan5 libatomic1 libbinutils
libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfile-fcntllock-perl libgcc-9-dev
libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev manpages-dev
pkg-config
Suggested packages:
binutils-doc cpp-doc gcc-9-locales g++-multilib g++-9-multilib gcc-9-doc gcc-multilib make autoconf automake libtool flex
bison gdb gcc-doc gcc-9-multilib bzr | brz mercurial subversion glibc-doc debian-keyring bzr libstdc++-9-doc dpkg-dev
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base golang-1.13-go
golang-1.13-race-detector-runtime golang-1.13-src golang-go golang-race-detector-runtime golang-src libasan5 libatomic1
libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfile-fcntllock-perl
libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev
manpages-dev pkg-config
0 upgraded, 40 newly installed, 0 to remove and 10 not upgraded.
Need to get 99.9 MB of archives.
After this operation, 496 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 binutils-common amd64 2.34-6ubuntu1 [207 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libbinutils amd64 2.34-6ubuntu1 [474 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libctf-nobfd0 amd64 2.34-6ubuntu1 [47.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libctf0 amd64 2.34-6ubuntu1 [46.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 binutils-x86-64-linux-gnu amd64 2.34-6ubuntu1 [1614 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 binutils amd64 2.34-6ubuntu1 [3376 B]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc-9-base amd64 9.3.0-10ubuntu2 [19.3 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 libisl22 amd64 0.22.1-1 [592 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 libmpc3 amd64 1.1.0-1 [40.8 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 cpp-9 amd64 9.3.0-10ubuntu2 [7491 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 cpp amd64 4:9.3.0-1ubuntu2 [27.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 libcc1-0 amd64 10-20200411-0ubuntu1 [41.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 libgomp1 amd64 10-20200411-0ubuntu1 [101 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/main amd64 libitm1 amd64 10-20200411-0ubuntu1 [26.3 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/main amd64 libatomic1 amd64 10-20200411-0ubuntu1 [9284 B]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 libasan5 amd64 9.3.0-10ubuntu2 [395 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/main amd64 liblsan0 amd64 10-20200411-0ubuntu1 [144 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/main amd64 libtsan0 amd64 10-20200411-0ubuntu1 [319 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/main amd64 libubsan1 amd64 10-20200411-0ubuntu1 [136 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/main amd64 libquadmath0 amd64 10-20200411-0ubuntu1 [146 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/main amd64 libgcc-9-dev amd64 9.3.0-10ubuntu2 [2359 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc-9 amd64 9.3.0-10ubuntu2 [8234 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc amd64 4:9.3.0-1ubuntu2 [5208 B]
Get:24 http://archive.ubuntu.com/ubuntu focal/main amd64 libc-dev-bin amd64 2.31-0ubuntu9 [71.8 kB]
Ign:25 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-28.32
Get:26 http://archive.ubuntu.com/ubuntu focal/main amd64 libcrypt-dev amd64 1:4.4.10-10ubuntu4 [104 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal/main amd64 libc6-dev amd64 2.31-0ubuntu9 [2520 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal/main amd64 libstdc++-9-dev amd64 9.3.0-10ubuntu2 [1711 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal/main amd64 g++-9 amd64 9.3.0-10ubuntu2 [8404 kB]
Err:25 http://security.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-28.32
404 Not Found [IP: 91.189.88.152 80]
Get:30 http://archive.ubuntu.com/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1ubuntu2 [1604 B]
Get:31 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-1.13-src amd64 1.13.8-1ubuntu1 [12.6 MB]
Get:32 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-1.13-go amd64 1.13.8-1ubuntu1 [47.6 MB]
Get:33 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-1.13-race-detector-runtime amd64 0.0+svn332029-0ubuntu2 [713
kB]
Get:34 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-src amd64 2:1.13~1ubuntu2 [4044 B]
Get:35 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-go amd64 2:1.13~1ubuntu2 [22.0 kB]
Get:36 http://archive.ubuntu.com/ubuntu focal/main amd64 libdpkg-perl all 1.19.7ubuntu3 [230 kB]
Get:37 http://archive.ubuntu.com/ubuntu focal/main amd64 libfile-fcntllock-perl amd64 0.22-3build4 [33.1 kB]
Get:38 http://archive.ubuntu.com/ubuntu focal/main amd64 manpages-dev all 5.05-1 [2266 kB]
Get:39 http://archive.ubuntu.com/ubuntu focal/main amd64 pkg-config amd64 0.29.1-0ubuntu4 [45.5 kB]
Get:40 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-race-detector-runtime amd64 2:1.13~1ubuntu2 [3836 B]
Fetched 98.8 MB in 23s (4358 kB/s)E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.4.0-28.32_amd64.deb 404 Not Found [
IP: 91.189.88.152 80]E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base golang-1.13-go
golang-1.13-race-detector-runtime golang-1.13-src golang-race-detector-runtime golang-src libasan5 libatomic1 libbinutils
libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfile-fcntllock-perl libgcc-9-dev
libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev manpages-dev
pkg-config
Suggested packages:
binutils-doc cpp-doc gcc-9-locales g++-multilib g++-9-multilib gcc-9-doc gcc-multilib make autoconf automake libtool flex
bison gdb gcc-doc gcc-9-multilib bzr | brz mercurial subversion glibc-doc debian-keyring bzr libstdc++-9-doc dpkg-dev
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base golang-1.13-go
golang-1.13-race-detector-runtime golang-1.13-src golang-go golang-race-detector-runtime golang-src libasan5 libatomic1
libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfile-fcntllock-perl
libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev
manpages-dev pkg-config
0 upgraded, 40 newly installed, 0 to remove and 10 not upgraded.
Need to get 99.9 MB of archives.
After this operation, 496 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 binutils-common amd64 2.34-6ubuntu1 [207 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libbinutils amd64 2.34-6ubuntu1 [474 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libctf-nobfd0 amd64 2.34-6ubuntu1 [47.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libctf0 amd64 2.34-6ubuntu1 [46.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 binutils-x86-64-linux-gnu amd64 2.34-6ubuntu1 [1614 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 binutils amd64 2.34-6ubuntu1 [3376 B]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc-9-base amd64 9.3.0-10ubuntu2 [19.3 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 libisl22 amd64 0.22.1-1 [592 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 libmpc3 amd64 1.1.0-1 [40.8 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 cpp-9 amd64 9.3.0-10ubuntu2 [7491 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 cpp amd64 4:9.3.0-1ubuntu2 [27.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 libcc1-0 amd64 10-20200411-0ubuntu1 [41.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 libgomp1 amd64 10-20200411-0ubuntu1 [101 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/main amd64 libitm1 amd64 10-20200411-0ubuntu1 [26.3 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/main amd64 libatomic1 amd64 10-20200411-0ubuntu1 [9284 B]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 libasan5 amd64 9.3.0-10ubuntu2 [395 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/main amd64 liblsan0 amd64 10-20200411-0ubuntu1 [144 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/main amd64 libtsan0 amd64 10-20200411-0ubuntu1 [319 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/main amd64 libubsan1 amd64 10-20200411-0ubuntu1 [136 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/main amd64 libquadmath0 amd64 10-20200411-0ubuntu1 [146 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/main amd64 libgcc-9-dev amd64 9.3.0-10ubuntu2 [2359 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc-9 amd64 9.3.0-10ubuntu2 [8234 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc amd64 4:9.3.0-1ubuntu2 [5208 B]
Get:24 http://archive.ubuntu.com/ubuntu focal/main amd64 libc-dev-bin amd64 2.31-0ubuntu9 [71.8 kB]
Ign:25 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-28.32
Get:26 http://archive.ubuntu.com/ubuntu focal/main amd64 libcrypt-dev amd64 1:4.4.10-10ubuntu4 [104 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal/main amd64 libc6-dev amd64 2.31-0ubuntu9 [2520 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal/main amd64 libstdc++-9-dev amd64 9.3.0-10ubuntu2 [1711 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal/main amd64 g++-9 amd64 9.3.0-10ubuntu2 [8404 kB]
Err:25 http://security.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-28.32
404 Not Found [IP: 91.189.88.152 80]
Get:30 http://archive.ubuntu.com/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1ubuntu2 [1604 B]
Get:31 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-1.13-src amd64 1.13.8-1ubuntu1 [12.6 MB]
Get:32 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-1.13-go amd64 1.13.8-1ubuntu1 [47.6 MB]
Get:33 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-1.13-race-detector-runtime amd64 0.0+svn332029-0ubuntu2 [713
kB]
Get:34 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-src amd64 2:1.13~1ubuntu2 [4044 B]
Get:35 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-go amd64 2:1.13~1ubuntu2 [22.0 kB]
Get:36 http://archive.ubuntu.com/ubuntu focal/main amd64 libdpkg-perl all 1.19.7ubuntu3 [230 kB]
Get:37 http://archive.ubuntu.com/ubuntu focal/main amd64 libfile-fcntllock-perl amd64 0.22-3build4 [33.1 kB]
Get:38 http://archive.ubuntu.com/ubuntu focal/main amd64 manpages-dev all 5.05-1 [2266 kB]
Get:39 http://archive.ubuntu.com/ubuntu focal/main amd64 pkg-config amd64 0.29.1-0ubuntu4 [45.5 kB]
Get:40 http://archive.ubuntu.com/ubuntu focal/main amd64 golang-race-detector-runtime amd64 2:1.13~1ubuntu2 [3836 B]
Fetched 98.8 MB in 23s (4358 kB/s)E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.4.0-28.32_amd64.deb 404 Not Found [
IP: 91.189.88.152 80]E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
2 errors at the end.
Need further investigation.
After
sudo apt-get upgrade
sudo apt-get update
I am able to install it.
Tuesday, May 05, 2020
apparmor
Can't get snap to work on my ubuntu 20.04
> sudo snap install helm --classic
error: cannot communicate with server: Post http://localhost/v2/snaps/helm: dial unix /run/snapd.socket: connect: no such file or directory
>/usr/lib/snapd$ ./snapd
AppArmor status: apparmor not enabled
>/usr/lib/snapd$ sudo aa-status
apparmor module is not loaded.
No exactly sure what are going on after some research.
Need to revisit later on.
> sudo snap install helm --classic
error: cannot communicate with server: Post http://localhost/v2/snaps/helm: dial unix /run/snapd.socket: connect: no such file or directory
>/usr/lib/snapd$ ./snapd
AppArmor status: apparmor not enabled
>/usr/lib/snapd$ sudo aa-status
apparmor module is not loaded.
No exactly sure what are going on after some research.
Need to revisit later on.
Sunday, May 03, 2020
docker apache2 installation
After many download and processes,
then the installation got stuck in Geographic area selection
After I enter 6, nothing going on.
Some research, I need to turn off interactive input.
So, the Dockerfile should add
ENV DEBIAN_FRONTEND noninteractive
then the installation got stuck in Geographic area selection
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc
2. America 5. Arctic 8. Europe 11. SystemV
3. Antarctica 6. Asia 9. Indian 12. US
Geographic area: 6
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc
2. America 5. Arctic 8. Europe 11. SystemV
3. Antarctica 6. Asia 9. Indian 12. US
Geographic area: 6
After I enter 6, nothing going on.
Some research, I need to turn off interactive input.
So, the Dockerfile should add
ENV DEBIAN_FRONTEND noninteractive
FROM ubuntu
RUN apt-get update
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install -y apache2
RUN apt-get clean
#ENTRYPOINT ["/usr/sbin/apache2", "-k", "start"]
#ENV APACHE_RUN_USER www-data
#ENV APACHE_RUN_GROUP www-data
#NEV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
CMD apachectl -D FOREGROUND
RUN apt-get update
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install -y apache2
RUN apt-get clean
#ENTRYPOINT ["/usr/sbin/apache2", "-k", "start"]
#ENV APACHE_RUN_USER www-data
#ENV APACHE_RUN_GROUP www-data
#NEV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
CMD apachectl -D FOREGROUND
Subscribe to:
Posts (Atom)