分类 Windows 下的文章

Windows 系统

清除 DNS 缓存

ipconfig /flushdns

查询 DNS 缓存

ipconfig/displaydns

Mac OS 系统

lookupd-flushcache

浏览器

Microsoft Edge

edge://net-internals/#dns

点击Clear Host Cache按钮

Microsoft Edge

chrome://net-internals/#dns

点击Clear Host Cache按钮

办公时间,总得放点音乐,边听歌边工作。外放音乐又不大好,但电脑又没有蓝牙,不能使用蓝牙耳机,使用有线耳机又碍事。于是想到了用手机来当电脑音箱,手机再连接蓝牙,这样就能间接实现电脑连接蓝牙耳机了。机智如我~

首先,有问题,当然是Google一下,于是找到了SoundWire这款软件。这软件有两个端,分别是服务端(电脑装)和接收端(手机装)。下面,开搞~

服务端

首先,从GeorgieLabs上下载服务端,然后开始安装。

image8e5cb39bbe5ac9e5.png

服务协议

image32f166d997777f2d.png

选择安装路径

imagea89da7c412fefe1d.png

选择开始菜单目录

image5db5b3d5e89b5e20.png

是否创建桌面图标

imagec42f26c53c9d21ac.png

确认安装信息

imagefdfddfeceb32a145.png

安装中

image9f7855e96863e5ba.png

安装成功,直接点Finish

image38fefa9df09f5002.png

一个警告,但似乎没太大影响,如果对音质要求不高的话。记下Server Address的IP地址,这是你电脑的IP地址,一会手机需要用到。

imagec851f363727f9af7.png

接下来就是手机的操作了,如果成功与手机连接上,Status会显示Connected

image15615ecfb833f494.png

接收端

接收端要从Google Play Store上下载,由于国内打不开,这里我保存了一份在蓝奏云(https://wampserver.lanzous.com/b00tv3m1c 密码:8ucv)

安装好之后,在Server处输入服务端的IP地址,然后点中间的弹簧形状图标进行连接。

image71ade25c6796d974.png

结语

到这里就结束了,更多的可以自己探索下。总的来说,感觉效果还不差,就是音频会延迟一秒左右,听歌的话,是能接受的。音质方面,没感觉。

使用了一会,发现会有广告语,每隔一段时间就会有一个机器女声说SoundWire Free

如果想降低延迟,可以在接收端的Settings里调整Audio buffer size,值越小延迟越低。但网络环境不好的话,值越小音频会出现断续问题。

1.安装Visual Studio 2019
https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&rel=16

2.安装时,勾选上“使用 C++ 的桌面开发”
请输入图片描述

3.安装好之后,在开始菜单打开Visual Studio 2019-x64 Native Tools Command Prompt for VS 2019
QQ截图20200827112523.png

4.下载PHP SDK
打开https://github.com/microsoft/php-sdk-binary-tools/releases,下载php-sdk-2.2.0

5.解压PHP SDK
创建php-sdk目录,然后将下载的php-sdk-2.2.0压缩包里php-sdk-binary-tools-php-sdk-2.2.0目录下的所有文件解压到php-sdk目录。

6.切换到刚刚创建的php-sdk目录

cd E:\php-sdk

7.执行“调用初学者脚本”

phpsdk-vs16-x64.bat

输出:

[vcvarsall.bat] Environment initialized for: 'x64'

PHP SDK 2.2.0

OS architecture:    64-bit
Build architecture: 64-bit
Visual C++:         14.27.29111.0
PHP-SDK path:       E:\php-sdk

8.运行批处理脚本
脚本会自动创建所需的目录结构

phpsdk_buildtree phpdev

9.下载php8源代码
打开https://github.com/php/php-src/releases,下载PHP8的源代码压缩包

10.解压PHP源代码
将源代码压缩包内php-src-php-8.0.0beta2目录下的所有文件解压到E:\php-sdk\phpdev\vs16\x64\php-8.0.0-src

11.获取PHP所依赖的库
切换到php源代码目录

cd E:\php-sdk\phpdev\vs16\x64\php-8.0.0-src

使用 PHP SDK 工具通过phpsdk_deps -u命令自动获取适当的依赖关系。这里的下载速度很感人。。。

phpsdk_deps -u

输出

Configuration: 8.0-vs16-x64-stable

Processing package apache-2.4.43-vs16-x64.zip
Processing package c-client-2007f-vs16-x64.zip
Processing package fbclient-3.0.6-nocrt-x64.zip
Processing package freetype-2.9.1-1-vs16-x64.zip
Processing package glib-2.53.3-vs16-x64.zip
Processing package ICU-67.1-vs16-x64.zip
Processing package libargon2-20190702-vs16-x64.zip
Processing package libbzip2-1.0.8-vs16-x64.zip
Processing package libcurl-7.71.1-vs16-x64.zip
Processing package libenchant2-2.2.8-vs16-x64.zip
Processing package libffi-3.3-1-vs16-x64.zip
Processing package libiconv-1.16-2-vs16-x64.zip
Processing package libintl-0.18.3-5-vs16-x64.zip
Processing package libjpeg-9c-vs16-x64.zip
Processing package liblmdb-0.9.22-3-vs16-x64.zip
Processing package liblzma-5.2.5-vs16-x64.zip
Processing package libonig-6.9.5-1-vs16-x64.zip
Processing package libpng-1.6.34-4-vs16-x64.zip
Processing package libpq-11.4-vs16-x64.zip
Processing package libqdbm-1.8.78-vs16-x64.zip
Processing package libsasl-2.1.27-2-vs16-x64.zip
Processing package libsodium-1.0.18-vs16-x64.zip
Processing package libssh2-1.9.0-vs16-x64.zip
Processing package libtidy-5.6.0-2-vs16-x64.zip
Processing package libwebp-1.1.0-vs16-x64.zip
Processing package libxml2-2.9.10-vs16-x64.zip
Processing package libxpm-3.5.12-5-vs16-x64.zip
Processing package libxslt-1.1.34-vs16-x64.zip
Processing package libzip-1.7.1-vs16-x64.zip
Processing package mpir-3.0.0-vs16-x64.zip
Processing package net-snmp-5.7.3-1-vs16-x64.zip
Processing package nghttp2-1.40.0-vs16-x64.zip
Processing package openldap-2.4.47-vs16-x64.zip
Processing package openssl-1.1.1g-vs16-x64.zip
Processing package sqlite3-3.33.0-vs16-x64.zip
Processing package wineditline-2.205-1-vs16-x64.zip
Processing package zlib-1.2.11-vs16-x64.zip
Updates performed successfully.
Old dependencies backed up into 'E:\php-sdk\phpdev\vs16\x64\deps.202008270422'.
buildconf
Rebuilding configure.js
Now run 'configure --help'
configure --help
PHP Version: 8.0.0beta2

Options that enable extensions and SAPI will accept 'yes' or 'no' as a
parameter. They also accept 'shared' as a synonym for 'yes' and request a
shared build of that module. Not all modules can be built as shared modules;
configure will display [shared] after the module name if can be built that
way.

  --enable-snapshot-build           Build a snapshot; turns on everything it
                                    can and ignores build errors
  --with-verbosity                  Output verbosity, 0-2.
  --with-toolset                    Toolset to use for the compilation, give:
                                    vs, clang, icc. The only recommended and
                                    supported toolset for production use is
                                    Visual Studio. Use others at your own
                                    risk.
  --with-cygwin                     Path to cygwin utilities on your system
  --enable-object-out-dir           Alternate location for binary objects
                                    during build
  --enable-debug                    Compile with debugging symbols
  --enable-debug-pack               Release binaries with external debug
                                    symbols (--enable-debug must not be
                                    specified)
  --enable-pgi                      Generate PGO instrumented binaries
  --with-pgo                        Compile optimized binaries using training
                                    data from folder
  --disable-zts                     Thread safety
  --with-prefix                     where PHP will be installed
  --with-mp                         Tell Visual Studio use up to
                                    [n,auto,disable] processes for compilation
  --with-php-build                  Path to where you extracted the
                                    development libraries
                                    (http://wiki.php.net/internals/windows/libs).
                                    Assumes that it is a sibling of this
                                    source dir (..\deps) if not specified
  --with-extra-includes             Extra include path to use when building
                                    everything
  --with-extra-libs                 Extra library path to use when linking
                                    everything
  --with-analyzer                   Enable static analyzer. Pass vs for Visual
                                    Studio, clang for clang, cppcheck for
                                    Cppcheck, pvs for PVS-Studio
  --disable-ipv6                    Disable IPv6 support (default is turn it
                                    on if available)
  --enable-fd-setsize               Set maximum number of sockets for
                                    select(2)
  --with-snapshot-template          Path to snapshot builder template dir
  --disable-security-flags          Disable the compiler security flags
  --without-uncritical-warn-choke   Disable some uncritical warnings
  --enable-sanitizer                Enable ASan and UBSan extensions
  --with-codegen-arch               Architecture for code generation: ia32.
                                    Use --enable-native-intrinsics to enable
                                    SIMD optimizations.
  --with-all-shared                 Force all the non obligatory extensions to
                                    be shared
  --with-config-profile             Name of the configuration profile to save
                                    this to in php-src/config.name.bat
  --disable-test-ini                Enable automatic php.ini generation. The
                                    test.ini will be put into the build dir
                                    and used to automatically load the shared
                                    extensions.
  --with-test-ini-ext-exclude       Comma separated list of shared extensions
                                    to be excluded from the test.ini
  --enable-native-intrinsics        Comma separated list of intrinsic
                                    optimizations to enable. Available
                                    instruction set names are sse, sse2, sse3,
                                    ssse3, sse4.1, sse4.2, avx, avx2. SSE and
                                    SSE2 are enabled by default. The best
                                    instruction set specified will
                                    automatically enable all the older
                                    instruction sets. Note, that the produced
                                    binary might not work properly, if the
                                    chosen instruction sets are not available
                                    on the target processor.
  --enable-apache2handler           Build Apache 2.x handler
  --enable-apache2-2handler         Build Apache 2.2.x handler
  --enable-apache2-4handler         Build Apache 2.4.x handler
  --disable-cgi                     Build CGI version of PHP
  --disable-cli                     Build CLI version of PHP
  --enable-cli-win32                Build console-less CLI version of PHP
  --enable-embed                    Embedded SAPI library
  --enable-phpdbg                   Build phpdbg
  --enable-phpdbgs                  Build phpdbg shared
  --disable-phpdbg-webhelper        Build phpdbg webhelper
  --disable-bcmath                  bc style precision math functions
  --with-bz2                        BZip2
  --disable-calendar                calendar conversion support
  --disable-com-dotnet              COM and .Net support
  --disable-ctype                   ctype
  --with-curl                       cURL support
  --with-dba                        DBA support
  --with-qdbm                       DBA: QDBM support
  --with-db                         DBA: Berkeley DB support
  --with-lmdb                       DBA: Lightning memory-mapped database
                                    support
  --with-enchant                    Enchant Support
  --with-ffi                        ffi support
  --enable-fileinfo                 fileinfo support
  --disable-filter                  Filter Support
  --enable-ftp                      ftp support
  --without-gd                      Bundled GD support
  --without-libwebp                 webp support
  --with-gettext                    gettext support
  --with-gmp                        Include GNU MP support.
  --with-mhash                      mhash support (BC via hash)
  --without-iconv                   iconv support
  --with-imap                       IMAP Support
  --enable-intl                     Enable internationalization support
  --with-ldap                       LDAP support
  --enable-mbstring                 multibyte string functions
  --enable-mbregex                  multibyte regex support
  --without-mysqlnd                 Mysql Native Client Driver
  --with-oci8                       OCI8 support
  --with-oci8-11g                   OCI8 support using Oracle 11g Instant
                                    Client
  --with-oci8-12c                   OCI8 support using Oracle Database 12c
                                    Instant Client
  --enable-odbc                     ODBC support
  --with-odbcver                    Force support for the passed ODBC version.
                                    A hex number is expected, default 0x0350.
                                    Use the special value of 0 to prevent an
                                    explicit ODBCVER to be defined.
  --disable-opcache                 whether to enable Zend OPcache support
  --disable-opcache-jit             whether to enable JIT
  --with-openssl                    OpenSSL support
  --without-pcre-jit                Enable PCRE JIT support
  --with-pgsql                      PostgreSQL support
  --with-pspell                     pspell/aspell (whatever it's called this
                                    month) support
  --without-readline                Readline support
  --disable-session                 session support
  --enable-shmop                    shmop support
  --with-snmp                       SNMP support
  --enable-sockets                  SOCKETS support
  --with-sodium                     for libsodium support
  --with-sqlite3                    SQLite 3 support
  --with-password-argon2            Argon2 support
  --with-config-file-scan-dir       Dir to check for additional php ini files
  --enable-sysvshm                  SysV Shared Memory support
  --with-tidy                       TIDY support
  --disable-tokenizer               tokenizer support
  --enable-zend-test                enable zend-test extension
  --disable-zip                     ZIP support
  --disable-zlib                    ZLIB support
  --without-libxml                  LibXML support
  --without-dom                     DOM support
  --enable-exif                     Exchangeable image information (EXIF)
                                    Support
  --with-mysqli                     MySQLi support
  --enable-pdo                      Enable PHP Data Objects support
  --with-pdo-dblib                  freetds dblib (Sybase, MS-SQL) support for
                                    PDO
  --with-pdo-mssql                  Native MS-SQL support for PDO
  --with-pdo-firebird               Firebird support for PDO
  --with-pdo-mysql                  MySQL support for PDO
  --with-pdo-oci                    Oracle OCI support for PDO
  --with-pdo-odbc                   ODBC support for PDO
  --with-pdo-pgsql                  PostgreSQL support for PDO
  --with-pdo-sqlite                 for pdo_sqlite support
  --disable-phar                    disable phar support
  --enable-phar-native-ssl          enable phar with native OpenSSL support
  --without-simplexml               Simple XML support
  --enable-soap                     SOAP support
  --without-xml                     XML support
  --disable-xmlreader               XMLReader support
  --disable-xmlwriter               XMLWriter support
  --with-xsl                        xsl support

Some influential environment variables:
  CFLAGS      C compiler flags
  LDFLAGS     linker flags
configure --disable-all --enable-cli --enable-$remains
PHP Version: 8.0.0beta2

Saving configure options to config.nice.bat
Checking for cl.exe ...  <in default path>
  Detected compiler Visual C++ 2019
  Detected 64-bit compiler
Checking for link.exe ...  <in default path>
Checking for nmake.exe ...  <in default path>
Checking for lib.exe ...  <in default path>
Checking for bison.exe ...  <in default path>
  Detected bison version 3.3.2
Checking for sed.exe ...  <in default path>
Checking for re2c.exe ...  <in default path>
  Detected re2c version 1.1.1
Checking for zip.exe ...  <in default path>
Checking for lemon.exe ...  <in default path>
Checking for 7za.exe ...  <in default path>
Checking for mc.exe ...  E:\Windows Kits\10\bin\10.0.18362.0\x64
Checking for mt.exe ...  E:\Windows Kits\10\bin\10.0.18362.0\x64
Enabling multi process build

Build dir: E:\php-sdk\phpdev\vs16\x64\php-8.0.0-src\x64\Release_TS
PHP Core:  php8ts.dll and php8ts.lib

Checking for wspiapi.h ...  <in default path>
Enabling IPv6 support
Enabling SAPI sapi\cli
Checking for library edit_a.lib;edit.lib ... <in deps path> \lib\edit_a.lib
Checking for editline/readline.h ...  <in deps path> \include
Enabling extension ext\date
Enabling extension ext\hash
Checking for KeccakHash.h ...  ext/hash/sha3/generic64lc
Enabling extension ext\json
Enabling extension ext\pcre
Enabling extension ext\reflection
Enabling extension ext\spl
Checking for timelib_config.h ...  ext/date/lib
Enabling extension ext\standard

Creating build dirs...
Generating files...
Generating Makefile
Generating main/internal_functions.c
Generating main/config.w32.h
Generating phpize
Done.



Enabled extensions:
-----------------------
| Extension  | Mode   |
-----------------------
| date       | static |
| hash       | static |
| json       | static |
| pcre       | static |
| reflection | static |
| spl        | static |
| standard   | static |
-----------------------


Enabled SAPI:
-------------
| Sapi Name |
-------------
| cli       |
-------------


---------------------------------------
|                   |                 |
---------------------------------------
| Build type        | Release         |
| Thread Safety     | Yes             |
| Compiler          | Visual C++ 2019 |
| Architecture      | x64             |
| Optimization      | PGO disabled    |
| Native intrinsics | SSE2            |
| Static analyzer   | disabled        |
---------------------------------------


WARNING
The following arguments is invalid, and therefore ignored:
 --enable-$remains


Type 'nmake' to build PHP
nmake

最近,一打开v2ray.exe就闪退,日志文件里也没有记录到错误信息,试了好久都找不到具体原因。后面尝试在控制台打开v2ray.exe,才发现具体的错误信息,然后问题也顺利解决了。

打开CMD控制台,转到v2ray所在目录,然后执行下面的命令

# .\v2ray.exe

命令执行后,提示以下错误信息

V2Ray 4.21.3 (V2Fly, a community-driven edition of V2Ray.) Custom
A unified platform for anti-censorship.
Failed to start v2ray.com/core/app/proxyman/inbound: failed to listen TCP on 1080 > v2ray.com/core/transport/internet: failed to listen on address: 0.0.0.0:1080 > listen tcp 0.0.0.0:1080: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

大概意思是

启动失败:无法监听TCP 1080端口,无法监听0.0.0.0:1080地址,无权访问socket

找了下资料,得到的信息很少,尝试把0.0.0.0换成127.0.0.1也不行。然后想,是不是端口被占用了,执行netstat -ano|findstr ":1080",也没有找到被谁占用,但还是尝试换了个端口,竟然没有问题了。

虽然问题解决了,但原因没找到,这就很纳闷了。一直到家里的电脑突然也出现了同样的问题以后,仔细想想,才知道是什么导致了的。
原来是我装了Hyper-V,导致1080端口被系统保留了,真是操蛋了~

用下面这命令在控制台执行,可以查看系统保留的tcp端口

netsh interface ipv4 show excludedportrange protocol=tcp

用下面这命令在控制台执行,可以查看系统保留的udp端口

netsh interface ipv4 show excludedportrange protocol=udp

如果确实解决不了系统保留的问题,我们就只能改端口了,改成系统保留范围外的端口。

在线上环境的服务器,一般都是关闭了数据库外网访问的权限,这时候外网就不能直接连接数据库了,需要在服务器内才能操作数据库。但Navicat软件提供了HTTP通道代理连接数据库功能,只要服务器上有HTTP服务,并且端口开放了,就可以使用HTTP通道来连接数据库。

基本原理

数据库端口没开放外网访问的时候,Navicat在外网无法访问数据库。
服务器上运行着PHP,并且我们是可以访问到PHP的。
PHP可以连接MySQL数据库并执行SQL语句,因为它们都在内网和PHP支持MySQL。

虽然Navicat无法连接上MySQL,但是Navicat对数据库所有的查询可以让PHP代为查询,然后把结果返回给Navicat。
所以把一个php脚本放到服务器上,就可以让Navicat间接连接数据库,对数据库进行操作了。

上传PHP脚本

Navicat软件自带三个php代理脚本,它在Navicat安装目录下,分别是:ntunnel_mysql.php ntunnel_pgsql.php ntunnel_sqlite.php
这里主要讲MySQL,所以用到的是ntunnel_mysql.php脚本,其他数据库基本同理。

ntunnel_mysql.php上传到服务器,并测试能否通过浏览器访问到

Navicat连接设置

在新建或者编辑连接的时候,选项卡里面都会有一个HTTP,切换到HTTP选项卡。
然后勾选使用HTTP通道通道网址处输入ntunnel_mysql.php的网址。

建议勾选上用base64编码传出查询,不然有可能出现700 Invalid response: 500错误。
这个错误主要出现在获取数据库列表和表结构的时候出现,服务器有使用防护软件,也有可能是它捣的鬼。

然后在常规选项卡里,设置好端口用户名密码主机输入127.0.0.1或者对应的内网IP
简单来说就是服务器上项目配置里的数据库连接配置怎么设置的,这里就怎么设置,因为是用php来代替连接数据库

测试连接

最后,测试下连接。如果有错误,按照错误信息修改下对应的配置即可。