1.WXS部分
WXS(WeiXin Script)是小程序的一套脚本语言,结合 WXML,可以构建出页面的结构。
分类: 1. 全栈开发
允许通过HTTPS和HTTP两种方式访问WordPress网站——解决以HTTPS协议访问网站却因请求了不安全的资源报错
以HTTPS协议访问https://www.deaboway.com/,发生如下错误:
Mixed Content: The page at 'https://www.deaboway.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://www.deaboway.com/wp-content/cache/autoptimize/css/autoptimize_fabbbb6a8a981a178f0f8eeeb8cf4232.css'. This request has been blocked; the content must be served over HTTPS. VM235:2 Mixed Content: The page at 'https://www.deaboway.com/' was loaded over HTTPS, but requested an insecure script 'http://www.deaboway.com/wp-includes/js/wp-emoji-release.min.js?ver=4.9.5'. This request has been blocked; the content must be served over HTTPS. VM235:2 Mixed Content: The page at 'https://www.deaboway.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://www.deaboway.com/wp-includes/css/dashicons.min.css?ver=4.9.5'. This request has been blocked; the content must be served over HTTPS. VM235:2 Mixed Content: The page at 'https://www.deaboway.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://www.deaboway.com/wp-includes/css/admin-bar.min.css?ver=4.9.5'. This request has been blocked; the content must be served over HTTPS. VM234:1 Mixed Content: The page at 'https://www.deaboway.com/' was loaded over HTTPS, but requested an insecure script 'http://www.deaboway.com/wp-includes/js/jquery/jquery.js?ver=1.12.4'. This request has been blocked; the content must be served over HTTPS
解决办法:
把资源的引用从http改成https,具体用神马办法呢?
这里的方案是让http和https两种访问方式并存。而不是只允许https访问哈!!!
1. 将siteurl和home都从 http://www.deaboway.com 改成 https://www.deaboway.com —— 不必须
2. 在wp的数据库中运行: SELECT * FROM `wp_options` where option_value like ‘http://%’; 查找http的条目,改成https协议。 —— 不必须
3. vim /etc/nginx/nginx.conf 在443端口的https中添加: —— 不必须
add_header Front-End-Https on;
nginx -s reload
4. 编辑当前主题下的 functions.php 文件 HTTPS 相对链接替换 —— 必须,同时支持http和https协议访问
//WordPress SSL function deaboway_ssl(){ if( is_ssl() ){ function deaboway_ssl_main ($content){ $siteurl = get_option('siteurl'); $upload_dir = wp_upload_dir(); $content = str_replace( 'http:'.strstr($siteurl, '//'), strstr($siteurl, '//'), $content); $content = str_replace( 'http:'.strstr($upload_dir['baseurl'], '//'), strstr($upload_dir['baseurl'], '//'), $content); return $content; } ob_start("deaboway_ssl_main"); } } add_filter('get_header', 'deaboway_ssl');
5. 由于我使用了cloudflare cdn,需要将ssl改成full模式 —— 根据实际使用的cdn的情况确定
Crypto change setting { "Name": "SSL", "Old value": "flexible", "Type": "crypto", "Value": "full", "Zone name": "deaboway.com" }
特别注意:如果用了CDN的话,记得使用支持HTTPS协议的CDN,要不然会出问题的哦!
参考:
从Gitblit迁移到Gogs,终于不会内存泄露到server down啦!
先附上几个GIT仓库开源软件的比较:
通过这个表格得出如下的结论:
- 如果你希望开展git仓库托管服务并且信任gitlab的实力,可以采用gitlab,不过中文化的工作量不小。
- 如果仅仅是小型团队的内部git仓库管理,gogs足够了。尽管缺少细致的权限控制,但是极低的资源占用,丰富的功能还是很吸引人的。而且,gogs的开发似乎很活跃,贡献人数也比较多。BTW,gogs项目是中国人创建的。
- 如果必须采用java部署,gitblit目前是不错的选择,但是gitblit缺少了pull request这个重量级的协作工具是一大遗憾。
同时,受够了GitBlit三天两头因为内存泄露导致Server内存和swap被吃空,CPU忙着搬砖导致占用率100%,因此,迁移到Gogs。
整个过程很顺利也很方便。参考:https://gogs.io/
其中,特别需要注意的一点是Gogs需要MySQL5.7以上版本。
gogs.io中把库名创建好之后,直接从gitblit的data中把git库cp 覆盖gogs的库即可。
最后,做一些打扫工作:
- /etc/init.d/ 中 gitblit删除,gogs添加。开机自启动。 (scripts/init/centos/gogs cp 到/etc/init.d/ 修改里面的内容)
- systemctl list-unit-files | grep enabled 查看开机启动的服务,不需要的systemctl disable掉
完工!一个顺畅的server又飞起~
搭建Truffle开发和测试环境,并进行开发测试
1. node.js官网下载node安装
https://nodejs.org/en/download/
2. 确认安装成功及版本
node -v
npm -v
3. 安装truffle
npm install -g truffle
4. 安装testrpc
npm install -g ethereumjs-testrpc
继续阅读“搭建Truffle开发和测试环境,并进行开发测试”
创建以太坊私链、建立节点集群,并发生交易
1. 启动节点, 加上console 表示启动后,启用命令行:
geth –datadir ./data/00 –networkid 168 console
在启动客户端时添加参数–dev,开发模式
2. 查看账户
eth.accounts
继续阅读“创建以太坊私链、建立节点集群,并发生交易”